creative-connections/aurelia-bodylight-plugin

View on GitHub
docs/pdbe-molstar-component-1.1.1.js

Summary

Maintainability
A
0 mins
Test Coverage
/**
 * pdbe-molstar
 * @version 1.1.1
 * @link https://github.com/PDBeurope/pdbe-molstar
 * @license Apache 2.0
 */
/**
 * Copyright 2019-2020 Mandar Deshpande <mandar@ebi.ac.uk>
 * European Bioinformatics Institute (EBI, http://www.ebi.ac.uk/)
 * European Molecular Biology Laboratory (EMBL, http://www.embl.de/)
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 */
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=418)}([function(e,t,r){"use strict";r.r(t),r.d(t,"__extends",(function(){return i})),r.d(t,"__assign",(function(){return a})),r.d(t,"__rest",(function(){return o})),r.d(t,"__decorate",(function(){return s})),r.d(t,"__param",(function(){return u})),r.d(t,"__metadata",(function(){return c})),r.d(t,"__awaiter",(function(){return l})),r.d(t,"__generator",(function(){return d})),r.d(t,"__createBinding",(function(){return f})),r.d(t,"__exportStar",(function(){return p})),r.d(t,"__values",(function(){return m})),r.d(t,"__read",(function(){return h})),r.d(t,"__spread",(function(){return g})),r.d(t,"__spreadArrays",(function(){return v})),r.d(t,"__spreadArray",(function(){return b})),r.d(t,"__await",(function(){return y})),r.d(t,"__asyncGenerator",(function(){return _})),r.d(t,"__asyncDelegator",(function(){return S})),r.d(t,"__asyncValues",(function(){return x})),r.d(t,"__makeTemplateObject",(function(){return O})),r.d(t,"__importStar",(function(){return C})),r.d(t,"__importDefault",(function(){return j})),r.d(t,"__classPrivateFieldGet",(function(){return P})),r.d(t,"__classPrivateFieldSet",(function(){return E}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var a=function(){return(a=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}function s(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o}function u(e,t){return function(r,n){t(r,n,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function l(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{u(n.next(e))}catch(e){a(e)}}function s(e){try{u(n.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))}function d(e,t){var r,n,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(r)throw new TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&a[0]?n.return:a[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,a[1])).done)return i;switch(n=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],n=0}finally{r=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}var f=Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]};function p(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||f(t,e,r)}function m(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function h(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,a=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(i)throw i.error}}return o}function g(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function v(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),i=0;for(t=0;t<r;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)n[i]=a[o];return n}function b(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||t)}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function _(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),a=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(e){i[e]&&(n[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||s(e,t)}))})}function s(e,t){try{(r=i[e](t)).value instanceof y?Promise.resolve(r.value.v).then(u,c):l(a[0][2],r)}catch(e){l(a[0][3],e)}var r}function u(e){s("next",e)}function c(e){s("throw",e)}function l(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function S(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:y(e[n](t)),done:"return"===n}:i?i(t):t}:i}}function x(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=m(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){(function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)})(n,i,(t=e[r](t)).done,t.value)}))}}}function O(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var w=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function C(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&f(t,e,r);return w(t,e),t}function j(e){return e&&e.__esModule?e:{default:e}}function P(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}function E(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r}},function(e,t,r){"use strict";r.r(t),r.d(t,"Mat4",(function(){return i.c})),r.d(t,"Mat3",(function(){return i.b})),r.d(t,"Vec2",(function(){return i.e})),r.d(t,"Vec3",(function(){return i.f})),r.d(t,"Vec4",(function(){return i.g})),r.d(t,"Quat",(function(){return i.d})),r.d(t,"EPSILON",(function(){return i.a})),r.d(t,"Tensor",(function(){return n}));var n,i=r(25);!function(e){function t(e,t,i){var a=function(e,t,r){for(var n=[],i=0;i<t.length;i++)n[i]=t[t.length-i-1];var a=[1];for(i=1;i<e.length;i++)a[i]=e[n[i-1]];return{dimensions:e,axisOrderFastToSlow:n,axisOrderSlowToFast:t,accessDimensions:a,defaultCtor:r||Float64Array}}(e,t,i),o=r(a),s=o.get,u=o.set,c=o.add,l=o.dataOffset,d=o.getCoords;return{rank:e.length,dimensions:e,axisOrderSlowToFast:t,create:n(a),get:s,set:u,add:c,dataOffset:l,getCoords:d}}function r(e){var t=e.dimensions,r=e.axisOrderFastToSlow;switch(t.length){case 1:return{get:function(e,t){return e[t]},set:function(e,t,r){return e[t]=r},add:function(e,t,r){return e[t]+=r},dataOffset:function(e){return e},getCoords:function(e,t){return t[0]=e,t}};case 2:if(0===r[0]&&1===r[1]){var n=t[0];return{get:function(e,t,r){return e[r*n+t]},set:function(e,t,r,i){return e[r*n+t]=i},add:function(e,t,r,i){return e[r*n+t]+=i},dataOffset:function(e,t){return t*n+e},getCoords:function(e,t){return t[0]=e%n,t[1]=Math.floor(e/n),t}}}if(1===r[0]&&0===r[1]){var i=t[1];return{get:function(e,t,r){return e[t*i+r]},set:function(e,t,r,n){return e[t*i+r]=n},add:function(e,t,r,n){return e[t*i+r]+=n},dataOffset:function(e,t){return e*i+t},getCoords:function(e,t){return t[0]=Math.floor(e/i),t[1]=e%i,t}}}throw new Error("bad axis order");case 3:if(0===r[0]&&1===r[1]&&2===r[2]){var o=t[0],s=t[1],u=o*s;return{get:function(e,t,r,n){return e[t+r*o+n*u]},set:function(e,t,r,n,i){return e[t+r*o+n*u]=i},add:function(e,t,r,n,i){return e[t+r*o+n*u]+=i},dataOffset:function(e,t,r){return e+t*o+r*u},getCoords:function(e,t){var r=Math.floor(e/o);return t[0]=e%o,t[1]=r%s,t[2]=Math.floor(r/s),t}}}if(0===r[0]&&2===r[1]&&1===r[2]){var c=t[0],l=t[2],d=c*l;return{get:function(e,t,r,n){return e[t+n*c+r*d]},set:function(e,t,r,n,i){return e[t+n*c+r*d]=i},add:function(e,t,r,n,i){return e[t+n*c+r*d]+=i},dataOffset:function(e,t,r){return e+r*c+t*d},getCoords:function(e,t){var r=Math.floor(e/c);return t[0]=e%c,t[1]=Math.floor(r/l),t[2]=r%l,t}}}if(1===r[0]&&0===r[1]&&2===r[2]){var f=t[1],p=t[0],m=f*p;return{get:function(e,t,r,n){return e[r+t*f+n*m]},set:function(e,t,r,n,i){return e[r+t*f+n*m]=i},add:function(e,t,r,n,i){return e[r+t*f+n*m]+=i},dataOffset:function(e,t,r){return t+e*f+r*m},getCoords:function(e,t){var r=Math.floor(e/f);return t[0]=r%p,t[1]=e%f,t[2]=Math.floor(r/p),t}}}if(1===r[0]&&2===r[1]&&0===r[2]){var h=t[1],g=t[2],v=h*g;return{get:function(e,t,r,n){return e[r+n*h+t*v]},set:function(e,t,r,n,i){return e[r+n*h+t*v]=i},add:function(e,t,r,n,i){return e[r+n*h+t*v]+=i},dataOffset:function(e,t,r){return t+r*h+e*v},getCoords:function(e,t){var r=Math.floor(e/h);return t[0]=Math.floor(r/g),t[1]=e%h,t[2]=r%g,t}}}if(2===r[0]&&0===r[1]&&1===r[2]){var b=t[2],y=t[0],_=b*y;return{get:function(e,t,r,n){return e[n+t*b+r*_]},set:function(e,t,r,n,i){return e[n+t*b+r*_]=i},add:function(e,t,r,n,i){return e[n+t*b+r*_]+=i},dataOffset:function(e,t,r){return r+e*b+t*_},getCoords:function(e,t){var r=Math.floor(e/b);return t[0]=r%y,t[1]=Math.floor(r/y),t[2]=e%b,t}}}if(2===r[0]&&1===r[1]&&0===r[2]){var S=t[2],x=t[1],O=S*x;return{get:function(e,t,r,n){return e[n+r*S+t*O]},set:function(e,t,r,n,i){return e[n+r*S+t*O]=i},add:function(e,t,r,n,i){return e[n+r*S+t*O]+=i},dataOffset:function(e,t,r){return r+t*S+e*O},getCoords:function(e,t){var r=Math.floor(e/S);return t[0]=Math.floor(r/x),t[1]=r%x,t[2]=e%S,t}}}throw new Error("bad axis order");default:return{get:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t[a(e,r)]},set:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t[a(e,r)]=r[r.length-1]},add:function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return t[a(e,r)]+=r[r.length-1]},dataOffset:function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return a(e,t)},getCoords:function(t,r){return function(e,t,r){for(var n=e.dimensions,i=e.axisOrderFastToSlow,a=n.length,o=t,s=0;s<a;s++){var u=n[i[s]];r[i[s]]=o%u,o=Math.floor(o/u)}return r[i[a+1]]=o,r}(e,t,r)}}}}function n(e){for(var t=e.dimensions,r=1,n=0,i=t.length;n<i;n++)r*=t[n];return function(t){return new(t||e.defaultCtor)(r)}}function a(e,t){for(var r=e.accessDimensions,n=e.axisOrderFastToSlow,i=r.length-1,a=r[i]*t[n[i]],o=i-1;o>=0;o--)a=(a+t[n[o]])*r[o];return a}function o(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=e[t[n]];return r}e.create=function(e,t){return{space:e,data:t}},e.Space=t,e.Data1=function(e){return e},e.Vector=function(e,r){return t([e],[0],r)},e.ColumnMajorMatrix=function(e,r,n){return t([e,r],[1,0],n)},e.RowMajorMatrix=function(e,r,n){return t([e,r],[0,1],n)},e.toMat4=function(e,t,r){if(2!==t.rank)throw new Error("Invalid tensor rank");for(var n=Math.min(4,t.dimensions[0]),a=Math.min(4,t.dimensions[1]),o=0;o<n;o++)for(var s=0;s<a;s++)i.c.setValue(e,o,s,t.get(r,o,s));return e},e.toMat3=function(e,t,r){if(2!==t.rank)throw new Error("Invalid tensor rank");for(var n=Math.min(3,t.dimensions[0]),a=Math.min(3,t.dimensions[1]),o=0;o<n;o++)for(var s=0;s<a;s++)i.b.setValue(e,o,s,t.get(r,o,s));return e},e.toVec3=function(e,t,r){if(1!==t.rank)throw new Error("Invalid tensor rank");for(var n=Math.min(3,t.dimensions[0]),i=0;i<n;i++)e[i]=r[i];return e},e.toVec4=function(e,t,r){if(1!==t.rank)throw new Error("Invalid tensor rank");for(var n=Math.min(4,t.dimensions[0]),i=0;i<n;i++)e[i]=r[i];return e},e.areEqualExact=function(e,t){var r=e.length;if(r!==t.length)return!1;for(var n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0},e.invertAxisOrder=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=e[e.length-r-1];return t},e.convertToCanonicalAxisIndicesFastToSlow=function(e){for(var t=new Int32Array(e.length),r=0;r<e.length;r++)t[e[r]]=r;return function(e){return o(e,t)}},e.convertToCanonicalAxisIndicesSlowToFast=function(e){for(var t=new Int32Array(e.length),r=0;r<e.length;r++)t[e[e.length-r-1]]=r;return function(e){return o(e,t)}}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"ParamDefinition",(function(){return n}));var n,i=r(0),a=r(5),o=r(1),s=r(87),u=r(42),c=r(100),l=r(119);!function(e){function t(e,t){return t?(t.label&&(e.label=t.label),t.description&&(e.description=t.description),t.legend&&(e.legend=t.legend),t.fieldLabels&&(e.fieldLabels=t.fieldLabels),t.isHidden&&(e.isHidden=t.isHidden),t.shortLabel&&(e.shortLabel=t.shortLabel),t.twoColumns&&(e.twoColumns=t.twoColumns),t.isEssential&&(e.isEssential=t.isEssential),t.category&&(e.category=t.category),t.hideIf&&(e.hideIf=t.hideIf),t.help&&(e.help=t.help),e):e}function r(e,r,n){return t({type:"select",defaultValue:P(e,r),options:r,cycle:null==n?void 0:n.cycle},n)}function n(e,t){return t?(void 0!==t.min&&(e.min=t.min),void 0!==t.max&&(e.max=t.max),void 0!==t.step&&(e.step=t.step),e):e}function d(e,r){var n=t({type:"group",defaultValue:(null==r?void 0:r.customDefault)||m(e),params:e},r);return(null==r?void 0:r.isExpanded)&&(n.isExpanded=r.isExpanded),(null==r?void 0:r.isFlat)&&(n.isFlat=r.isFlat),(null==r?void 0:r.pivot)&&(n.pivot=r.pivot),n}function f(){return m(this.element)}function p(){throw new Error("getValue not set. Fix runtime.")}function m(e){for(var t={},r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];e[i].isOptional||(t[i]=e[i].defaultValue)}return t}function h(e,t){return function(){return e(t)}}function g(e,t,r){if(t)if("value-ref"===e.type)(n=t).ref?n.getValue=h(e.resolveRef,n.ref):n.getValue=function(){throw new Error("Unset ref in ValueRef value.")};else if("data-ref"===e.type){(n=t).ref?n.getValue=h(r,n.ref):n.getValue=function(){throw new Error("Unset ref in ValueRef value.")}}else if("group"===e.type)y(e.params,t,r);else if("mapped"===e.type){var n=t;g(e.map(n.name),n.params,r)}else if("object-list"===e.type){if(!b(e.element))return;for(var i=0,a=t;i<a.length;i++){var o=a[i];y(e.element,o,r)}}}function v(e){if("value-ref"===e.type||"data-ref"===e.type)return!0;if("group"===e.type){if(b(e.params))return!0}else if("mapped"===e.type)for(var t=0,r=e.select.options;t<r.length;t++){var n=r[t][0];if(v(e.map(n)))return!0}else if("object-list"===e.type)return b(e.element);return!1}function b(e){for(var t=0,r=Object.keys(e);t<r.length;t++){if(v(e[r[t]]))return!0}return!1}function y(e,t,r){for(var n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];g(e[a],null==t?void 0:t[a],r)}}function _(e,t,r){if(t===r)return!0;if("object"!=typeof t||"object"!=typeof r)return!1;for(var n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];if(!S(e[a],t[a],r[a]))return!1}return!0}function S(e,t,r){if(t===r)return!0;if("group"===e.type)return _(e.params,t,r);if("mapped"===e.type){var n=r;return(c=t).name===n.name&&S(e.map(c.name),c.params,n.params)}if("multi-select"===e.type){n=r;if((c=t).length!==n.length)return!1;if(c.length<10){for(var i=0,s=c.length;i<s;i++)if(c[i]!==n[i]&&n.indexOf(c[i])<0)return!1}else{var u=new Set(n);for(i=0,s=c.length;i<s;i++)if(c[i]!==n[i]&&!u.has(c[i]))return!1}return!0}if("interval"===e.type)return t[0]===r[0]&&t[1]===r[1];if("line-graph"===e.type){n=r;if((c=t).length!==n.length)return!1;for(i=0,s=c.length;i<s;i++)if(!o.Vec2.areEqual(c[i],n[i]))return!1;return!0}if("vec3"===e.type)return o.Vec3.equals(t,r);if("mat4"===e.type)return o.Mat4.areEqual(t,r,o.EPSILON);if("script"===e.type){n=r;return(c=t).language===n.language&&c.expression===n.expression}if("object-list"===e.type){n=r;var c,l=(c=t).length;if(l!==n.length)return!1;for(i=0;i<l;i++)if(!_(e.element,c[i],n[i]))return!1;return!0}return"object"==typeof t&&"object"==typeof r&&Object(a.l)(t,r)}function x(e,t,r){if(void 0===t)return Object(i.__assign)({},r);if(void 0===r)return Object(i.__assign)({},t);for(var n=Object.create(null),a=0,o=Object.keys(e);a<o.length;a++){var s=o[a];n[s]=O(e[s],t[s],r[s])}return n}function O(e,t,r){if(void 0===t)return"object"!=typeof r||Array.isArray(r)?r:Object(i.__assign)({},r);if(void 0===r)return"object"!=typeof t||Array.isArray(t)?t:Object(i.__assign)({},t);if("group"===e.type)return x(e.params,t,r);if("mapped"===e.type){var n=t,a=r;if(n.name!==a.name)return Object(i.__assign)({},a);var o=e.map(a.name);return{name:a.name,params:O(o,n.params,a.params)}}return"value"===e.type?r:"object"==typeof t&&"object"==typeof r?Array.isArray(r)?r:Object(i.__assign)(Object(i.__assign)({},t),r):r}function w(e,t){for(var r=0,n=e.options;r<n.length;r++){if(n[r][0]===t)return!0}return!1}function C(e,t,r){if(null==t)return r?e.defaultValue:void 0;if("value"===e.type)return t;if("group"===e.type){for(var n=Object.create(null),i=0,a=Object.keys(e.params);i<a.length;i++){var o=a[i],s=e.params[o];void 0===t[o]?r&&(n[o]=s.defaultValue):n[o]=C(s,t[o],r)}return n}if("mapped"===e.type){var u=t;if("string"!=typeof u.name)return e.defaultValue;if(void 0===u.params)return r?e.defaultValue:void 0;if(!w(e.select,u.name))return e.defaultValue;s=e.map(u.name);return{name:u.name,params:C(s,u.params,r)}}if("select"===e.type)return w(e,t)?t:e.defaultValue;if("multi-select"===e.type){if(!Array.isArray(t))return e.defaultValue;n=t.filter((function(e){return w(this,e)}),e);return t.length>0&&0===n.length?e.defaultValue:n}return"object-list"===e.type?Array.isArray(t)?t.map((function(t){return j(e.element,t,r?"all":"skip")})):e.defaultValue:t}function j(e,t,r){if("object"!=typeof t||null===t)return r?m(e):t;for(var n=Object.create(null),i=0,a=Object.keys(e);i<a.length;i++){var o=a[i],s=e[o];void 0===t[o]?"all"===r&&(n[o]=s.defaultValue):n[o]=C(s,t[o],"skip"!==r)}return n}function P(e,t){for(var r=0,n=t;r<n.length;r++){if(n[r][0]===e)return e}return t.length>0?t[0][0]:void 0}e.Essential={isEssential:!0},e.Optional=function(e){var t=Object(i.__assign)({},e);return t.isOptional=!0,t},e.Value=function(e,r){return t({type:"value",defaultValue:e},r)},e.Select=r,e.MultiSelect=function(e,r,n){var i=t({type:"multi-select",defaultValue:e,options:r},n);return(null==n?void 0:n.emptyValue)&&(i.emptyValue=n.emptyValue),i},e.Boolean=function(e,r){return t({type:"boolean",defaultValue:e},r)},e.Text=function(e,r){return void 0===e&&(e=""),t({type:"text",defaultValue:e},r)},e.Color=function(e,r){var n=t({type:"color",defaultValue:e},r);return(null==r?void 0:r.isExpanded)&&(n.isExpanded=r.isExpanded),n},e.ColorList=function(e,r){var n;if("string"==typeof e){var i=Object(c.getColorListFromName)(e);n={kind:"qualitative"!==i.type?"interpolate":"set",colors:i.list}}else n=e;return t({type:"color-list",presetKind:(null==r?void 0:r.presetKind)||"all",defaultValue:n,offsets:!!(null==r?void 0:r.offsets)},r)},e.Vec3=function(e,r,i){return t(n({type:"vec3",defaultValue:e},r),i)},e.Mat4=function(e,r){return t({type:"mat4",defaultValue:e},r)},e.Url=function(e,r){return t({type:"url",defaultValue:"string"==typeof e?l.Asset.Url(e):l.Asset.Url(e.url,{body:e.body})},r)},e.File=function(e){var r=t({type:"file",defaultValue:null},e);return(null==e?void 0:e.accept)&&(r.accept=e.accept),r},e.FileList=function(e){var r=t({type:"file-list",defaultValue:null},e);return(null==e?void 0:e.accept)&&(r.accept=e.accept),r},e.Numeric=function(e,r,i){var a=t(n({type:"number",defaultValue:e},r),i);return(null==i?void 0:i.immediateUpdate)&&(a.immediateUpdate=!0),a},e.Interval=function(e,r,i){return t(n({type:"interval",defaultValue:e},r),i)},e.LineGraph=function(e,r){return t({type:"line-graph",defaultValue:e},r)},e.Group=d,e.EmptyGroup=function(e){return d({},e)},e.Mapped=function(e,n,i,a){var o=P(e,n);return t({type:"mapped",defaultValue:{name:o,params:i(o).defaultValue},select:r(o,n,a),map:i},a)},e.MappedStatic=function(e,n,i){var a=(null==i?void 0:i.options)?i.options:Object.keys(n).map((function(e){return[e,n[e].label||Object(u.d)(e)]})),o=P(e,a);return t({type:"mapped",defaultValue:{name:o,params:n[o].defaultValue},select:r(o,a,i),map:function(e){return n[e]}},i)},e.ObjectList=function(e,r,n){return t({type:"object-list",element:e,getLabel:r,ctor:f,defaultValue:(null==n?void 0:n.defaultValue)||[]},n)},e.ValueRef=function(e,r,n){var i;return t({type:"value-ref",defaultValue:{ref:null!==(i=null==n?void 0:n.defaultRef)&&void 0!==i?i:"",getValue:p},getOptions:e,resolveRef:r},n)},e.DataRef=function(e){var r;return t({type:"data-ref",defaultValue:{ref:null!==(r=null==e?void 0:e.defaultRef)&&void 0!==r?r:"",getValue:p}},e)},e.Converted=function(e,t,r){return{type:"converted",defaultValue:t(r.defaultValue),converted:r,fromValue:e,toValue:t}},e.Conditioned=function(e,n,i,a,o){var s=Object.keys(n).map((function(e){return[e,e]}));return t({type:"conditioned",select:r(i(e),s,o),defaultValue:e,conditionParams:n,conditionForValue:i,conditionedValue:a},o)},e.Script=function(e,r){return t({type:"script",defaultValue:e},r)},e.For=function(e){return 0},e.getDefaultValues=m,e.resolveRefs=y,e.setDefaultValues=function(e,t){for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];e[i].isOptional||(e[i].defaultValue=t[i])}},e.clone=function(e){return Object(s.b)(e)},e.validate=function(e,t){},e.areEqual=_,e.isParamEqual=S,e.merge=x,e.mergeParam=O,e.normalizeParams=j,e.objectToOptions=function(e,t){for(var r=[],n=0,i=Object.keys(e);n<i.length;n++){var a=i[n];if(t){var o=t(a,e[a]);r.push("string"==typeof o?[a,o]:[a,o[0],o[1]])}else"string"==typeof e[a]?r.push([a,e[a]]):r.push([a,null===t?a:Object(u.d)(a)])}return r},e.arrayToOptions=function(e,t){for(var r=[],n=0,i=e;n<i.length;n++){var a=i[n];t?r.push([a,t(a)]):r.push([a,null===t?a:Object(u.d)(a)])}return r},e.optionLabel=function(e,t){for(var r=0,n=e.options;r<n.length;r++){var i=n[r];if(i[0]===t)return i[1]}return""}}(n||(n={}))},function(e,t,r){"use strict";e.exports=r(420)},function(e,t,r){"use strict";r.r(t),r.d(t,"Time",(function(){return n.b})),r.d(t,"Coordinates",(function(){return n.a})),r.d(t,"Topology",(function(){return i.a})),r.d(t,"IndexedCustomProperty",(function(){return a.a})),r.d(t,"Model",(function(){return a.b})),r.d(t,"Types",(function(){return a.e})),r.d(t,"Symmetry",(function(){return a.d})),r.d(t,"StructureSequence",(function(){return a.c})),r.d(t,"StructureElement",(function(){return o.d})),r.d(t,"Bond",(function(){return o.a})),r.d(t,"Structure",(function(){return o.c})),r.d(t,"Unit",(function(){return o.g})),r.d(t,"StructureSymmetry",(function(){return o.f})),r.d(t,"StructureProperties",(function(){return o.e})),r.d(t,"UnitRing",(function(){return o.h})),r.d(t,"UnitRings",(function(){return o.i})),r.d(t,"CifExportContext",(function(){return o.b})),r.d(t,"mmCIF_Export_Filters",(function(){return o.k})),r.d(t,"encode_mmCIF_categories",(function(){return o.j})),r.d(t,"QueryContext",(function(){return s.b})),r.d(t,"Queries",(function(){return s.a})),r.d(t,"StructureSelection",(function(){return s.d})),r.d(t,"StructureQuery",(function(){return s.c})),r.d(t,"ArrayTrajectory",(function(){return u.a}));var n=r(171),i=r(351),a=r(192),o=r(28),s=r(173),u=r(252)},function(e,t,r){"use strict";r.d(t,"d",(function(){return u.a})),r.d(t,"e",(function(){return u.b})),r.d(t,"a",(function(){return i.a})),r.d(t,"b",(function(){return a.a})),r.d(t,"c",(function(){return o.a})),r.d(t,"j",(function(){return c})),r.d(t,"f",(function(){return l})),r.d(t,"g",(function(){return f})),r.d(t,"k",(function(){return p})),r.d(t,"l",(function(){return m})),r.d(t,"h",(function(){return h})),r.d(t,"i",(function(){return v}));var n,i=r(214),a=r(108),o=r(200);function s(e,t){return e-t}!function(e){var t=function(){function e(){this.size=0}return e.prototype.has=function(e){return!1},e.prototype.forEach=function(e,t){return t},e}(),r=function(){function e(e){this.idx=e,this.size=1}return e.prototype.has=function(e){return e===this.idx},e.prototype.forEach=function(e,t){return e(this.idx,t),t},e}(),n=function(){function e(e,t){this.mask=e,this.size=t,this.length=e.length}return e.prototype.has=function(e){return e<this.length&&!!this.mask[e]},e.prototype._forEach=function(e,t){for(var r=0;r<this.length;r++)this.mask[r]&&e(r,t)},e.prototype.forEach=function(e,t){return this._forEach(e,t),t},e}(),i=function(){function e(e){this.size=e}return e.prototype.has=function(e){return!0},e.prototype._forEach=function(e,t){for(var r=0;r<this.size;r++)e(r,t)},e.prototype.forEach=function(e,t){return this._forEach(e,t),t},e}(),a=function(){function e(e){this.set=e,this._flat=void 0,this.size=e.size}return e.prototype.has=function(e){return this.set.has(e)},e.prototype._forEach=function(e,t){for(var r=0,n=this.flatten();r<n.length;r++){e(n[r],t)}},e.prototype.flatten=function(){if(this._flat)return this._flat;var e,t=new Int32Array(this.size),r=0;return this.set.forEach((function(e){return t[r++]=e})),e=t,Array.prototype.sort.call(e,s),this._flat=t,this._flat},e.prototype.forEach=function(e,t){return this._forEach(e,t),t},e}();function o(e){return new a(e)}function u(e,t){return new n(e,t)}e.always=function(e){return new i(e)},e.never=new t,e.ofSet=o,e.singleton=function(e){return new r(e)},e.ofUniqueIndices=function(e){var o=e.length;if(0===o)return new t;if(1===o)return new r(e[0]);for(var s=0,u=0,c=e;u<c.length;u++){(p=c[u])>s&&(s=p)}if(o===s)return new i(o);if(o/s<1/12){for(var l=new Set,d=0,f=e;d<f.length;d++){var p=f[d];l.add(p)}return new a(l)}for(var m=new Int8Array(s+1),h=0,g=e;h<g.length;h++){m[p=g[h]]=1}return new n(m,e.length)},e.ofMask=u,e.hasAny=function(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];if(e.has(i))return!0}return!1},e.complement=function(e,t){var r=0,n=0;if(t.forEach((function(t){e.has(t)||(r++,t>n&&(n=t))})),r/n<1/12){var i=new Set;return t.forEach((function(t){e.has(t)||i.add(t)})),o(i)}var a=new Uint8Array(n+1);return t.forEach((function(t){e.has(t)||(a[t]=1)})),u(a,r)}}(n||(n={}));var u=r(58),c=function(){};function l(e,t){var r=e.length;if(r!==t.length)return!1;for(var n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}var d=Object.prototype.hasOwnProperty;function f(e,t){if(e===t)return!0;var r=Array.isArray(e),n=Array.isArray(t);if(r&&n){if(e.length!==t.length)return!1;for(var i=0;i<e.length;i++)if(!f(e[i],t[i]))return!1;return!0}if(r!==n)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){var a=Object.keys(e);if(a.length!==Object.keys(t).length)return!1;var o=e instanceof Date,s=t instanceof Date;if(o&&s)return e.getTime()===t.getTime();if(o!==s)return!1;var u=e instanceof RegExp,c=t instanceof RegExp;if(u&&c)return e.toString()===t.toString();if(u!==c)return!1;for(i=0;i<a.length;i++)if(!d.call(t,a[i]))return!1;for(i=0;i<a.length;i++)if(!f(e[a[i]],t[a[i]]))return!1;return!0}return!1}function p(e,t){if(e===t)return!0;var r=Array.isArray(e),n=Array.isArray(t);return r&&n?function(e,t){if(e===t)return!0;if(!e||!t)return!1;if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;++r)if(e[r]!==t[r])return!1;return!0}(e,t):r===n&&(!(!e||!t||"object"!=typeof e||"object"!=typeof t)&&m(e,t))}function m(e,t){if(e===t)return!0;if(!e||!t)return!1;var r=Object.keys(e);if(Object.keys(t).length!==r.length)return!1;for(var n=0,i=r;n<i.length;n++){var a=i[n];if(!d.call(e,a)||e[a]!==t[a])return!1}return!0}function h(e,t){return void 0!==e?e:t}Object.assign;function g(e){return(e<10?"0":"")+e}function v(e){var t=e.getHours(),r=e.getMinutes(),n=e.getSeconds();return t+":"+g(r)+":"+g(n)}},function(e,t,r){"use strict";r.r(t),r.d(t,"Interval",(function(){return T})),r.d(t,"OrderedSet",(function(){return Xe})),r.d(t,"Segmentation",(function(){return nt})),r.d(t,"SortedArray",(function(){return ge})),r.d(t,"Tuple",(function(){return a})),r.d(t,"LinkedIndex",(function(){return ot})),r.d(t,"IntMap",(function(){return st})),r.d(t,"Iterator",(function(){return ut.a}));var n,i=r(12);!function(e){e.Zero=0;var t,r,n=(t=new ArrayBuffer(8),r=new ArrayBuffer(8),{_int32:new Int32Array(t),_float64:new Float64Array(t),_int32_1:new Int32Array(r),_float64_1:new Float64Array(r)}),a=n._int32,o=n._float64,s=n._int32_1,u=n._float64_1;e.is=function(e){return"number"==typeof e},e.create=function(e,t){return a[0]=e,a[1]=t,o[0]},e.fst=function(e){return o[0]=e,a[0]},e.snd=function(e){return o[0]=e,a[1]},e.areEqual=function(e,t){return o[0]=e,u[0]=t,a[0]===s[0]&&a[1]===s[1]},e.compare=function(e,t){o[0]=e,u[0]=t;var r=a[0]-s[0];return 0!==r?r:a[1]-s[1]},e.compareInArray=function(e,t,r){o[0]=e[t],u[0]=e[r];var n=a[0]-s[0];return 0!==n?n:a[1]-s[1]},e.hashCode=function(e){return o[0]=e,Object(i.i)(a[0],a[1])},e.toString=function(e){return o[0]=e,"("+a[0]+", "+a[1]+")"}}(n||(n={}));var a=n,o=a.Zero;function s(e,t){return t<e?a.create(e,e):a.create(e,t+1)}function u(e,t){return t<=e?a.create(e,e):a.create(e,t)}function c(e){return e<0?a.create(0,0):a.create(0,e)}var l=a.is,d=a.fst,f=a.snd,p=a.fst;function m(e){return a.snd(e)-1}function h(e){return a.snd(e)-a.fst(e)}var g=a.hashCode,v=a.toString;function b(e,t){return a.fst(e)<=t&&t<a.snd(e)}function y(e,t){var r=d(e);return t>=r&&t<f(e)?t-r:-1}function _(e,t){return a.fst(e)+t}var S,x,O=a.areEqual;function w(e,t){var r=h(e),n=h(t);return 0===r&&0===n||r>0&&n>0&&m(e)>=p(t)&&p(e)<=m(t)}function C(e,t){return h(e)?!h(t)||d(e)<=d(t)&&f(e)>=f(t):0===h(t)}function j(e,t){var r=d(e);if(t<=r)return 0;var n=f(e);return t>=n?n-r:t-r}function P(e,t,r){var n=d(r),i=d(e);if(t<=n+i)return n;var a=f(r);return t>=a+i?a:t-i}function E(e,t,r){return u(j(e,t),j(e,r+1))}function A(e,t){return w(e,t)?u(Math.max(d(e),d(t)),Math.min(f(e),f(t))):o}function D(e,t){return h(E(e,p(t),m(t)))}(x=S||(S={})).Empty=o,x.ofSingleton=function(e){return s(e,e)},x.ofRange=s,x.ofBounds=u,x.ofLength=c,x.is=l,x.has=b,x.indexOf=y,x.getAt=_,x.start=d,x.end=f,x.min=p,x.max=m,x.size=h,x.hashCode=g,x.toString=v,x.areEqual=O,x.areIntersecting=w,x.isSubInterval=C,x.findPredecessorIndex=j,x.findPredecessorIndexInInterval=P,x.findRange=E,x.intersectionSize=D,x.intersect=A;var T=S,I=[];function M(e){return[e]}function k(e){return e}function B(e){return Object(i.q)(e),e}function V(e,t){if(t<e)return[];for(var r=new Int32Array(t-e+1),n=e;n<=t;n++)r[n-e]=n;return r}function R(e){return e&&(Array.isArray(e)||!!e.buffer)}function L(e){return e[0]}function N(e){return e[e.length-1]+1}function F(e){return e[0]}function U(e){return e[e.length-1]}function z(e){return e.length}function H(e){var t=e.length;return t?t>2?Object(i.k)(t,e[0],e[t-1],e[t>>1]):Object(i.j)(t,e[0],e[t-1]):0}function G(e){var t=e.length;return t>5?"["+e[0]+", "+e[1]+", ..., "+e[t-1]+"], length "+t:"["+e.join(", ")+"]"}function q(e,t){var r=e.length;return 0===r?-1:e[0]<=t&&t<=e[r-1]?$(e,t,0,r):-1}function W(e,t,r){return X(e,t,T.start(r),T.end(r))}function X(e,t,r,n){return 0===e.length||n<=r?-1:e[r]<=t&&t<=e[n-1]?$(e,t,r,n):-1}function Y(e,t){return q(e,t)>=0}function Q(e,t){if(e===t)return!0;var r=e.length;if(r!==t.length||e[0]!==t[0]||e[r-1]!==t[r-1])return!1;for(var n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}function K(e,t){var r=e.length;return t<=e[0]?0:t>e[r-1]?r:ee(e,t,0,r)}function Z(e,t,r){var n=T.start(r),i=T.end(r),a=e[n];return t<=a?n:i>n&&t>e[i-1]?i:t-a<=11?function(e,t,r,n){for(var i=r;i<n;i++)if(t<=e[i])return i;return n}(e,t,n+1,i):ee(e,t,n,i)}function J(e,t,r){return T.ofBounds(K(e,t),K(e,r+1))}function $(e,t,r,n){for(var i=r,a=n-1;i<=a;){if(i+11>a){for(var o=i;o<=a;o++)if(t===e[o])return o;return-1}var s=i+a>>1,u=e[s];if(t<u)a=s-1;else{if(!(t>u))return s;i=s+1}}return-1}function ee(e,t,r,n){for(var i=r,a=n-1;i<a;){if(i+11>a){for(var o=i;o<=a;o++)if(t<=e[o])return o;return a+1}var s=i+a>>1,u=e[s];if(t<u)a=s-1;else{if(!(t>u))return s;i=s+1}}return i>a?a+1:e[i]>=t?i:i+1}function te(e,t){if(e===t)return!0;for(var r=pe(e,t),n=r.startI,i=r.startJ,a=r.endI,o=r.endJ;n<a&&i<o;){var s=e[n],u=t[i];if(s<u)n++;else{if(!(s>u))return!0;i++}}return!1}function re(e,t){if(e===t)return!0;var r=t.length,n=pe(e,t),i=n.startI,a=n.startJ,o=n.endI,s=n.endJ;if(s-a<r||o-i<r)return!1;for(var u=0;i<o&&a<s;){var c=e[i],l=t[a];c<l?i++:c>l?a++:(i++,a++,u++)}return u===r}function ne(e,t){if(e===t)return e;var r=e.length,n=t.length;if(0===r)return t;if(0===n)return e;if(e[0]>t[0])return ne(t,e);var i=pe(e,t),a=i.startI,o=i.startJ,s=i.endI,u=i.endJ,c=ae(e,t,a,o,s,u);if(c===r&&c===n||c===n)return e;if(c===r)return t;var l=new Int32Array(r+n-c),d=0,f=0,p=0;for(d=0;d<a;d++)l[p++]=e[d];for(;f<u&&e[a]>t[f];)l[p++]=t[f++];for(;d<s&&f<u;){var m=e[d],h=t[f];m<h?(l[p++]=m,d++):m>h?(l[p++]=h,f++):(l[p++]=m,d++,f++)}for(;d<s;d++)l[p++]=e[d];for(;f<u;f++)l[p++]=t[f];for(;d<r;d++)l[p++]=e[d];for(;f<n;f++)l[p++]=t[f];return l}function ie(e,t){if(e===t)return z(e);var r=pe(e,t);return ae(e,t,r.startI,r.startJ,r.endI,r.endJ)}function ae(e,t,r,n,i,a){for(var o=r,s=n,u=0;o<i&&s<a;){var c=e[o],l=t[s];c<l?o++:c>l?s++:(o++,s++,u++)}return u}function oe(e,t){if(e===t)return e;var r=pe(e,t),n=r.startI,i=r.startJ,a=r.endI,o=r.endJ,s=ae(e,t,n,i,a,o),u=e.length,c=t.length;if(!s)return I;if(s===u&&s===c||s===c)return t;if(s===u)return e;for(var l=new Int32Array(s),d=0,f=n,p=i;f<a&&p<o;){var m=e[f],h=t[p];m<h?f++:(m>h||(l[d++]=m,f++),p++)}return l}function se(e,t){if(e===t)return I;for(var r=e.length,n=pe(e,t),i=n.startI,a=n.startJ,o=n.endI,s=n.endJ,u=i,c=a,l=0;u<o&&c<s;){(m=e[u])<(h=t[c])?u++:m>h?c++:(u++,c++,l++)}if(!l)return e;if(l>=r)return I;for(var d=new Int32Array(r-l),f=0,p=0;p<i;p++)d[f++]=e[p];for(u=i,c=a;u<o&&c<s;){var m,h;(m=e[u])<(h=t[c])?(d[f++]=m,u++):(m>h||u++,c++)}for(;u<r;u++)d[f++]=e[u];return d}function ue(e){if(e.length<2)return e;for(var t=1,r=0,n=e.length-1;r<n;r++)e[r]!==e[r+1]&&t++;if(t===e.length)return e;var i=new Int32Array(t),a=0;for(r=0,n=e.length-1;r<n;r++)e[r]!==e[r+1]&&(i[a++]=e[r]);return i[a]=e[e.length-1],i}function ce(e,t){if(e===t)return Object(i.g)(0,e.length-1);for(var r=pe(e,t),n=r.startI,a=r.startJ,o=r.endI,s=r.endJ,u=n,c=a,l=0;u<o&&c<s;){(m=e[u])<(h=t[c])?u++:m>h?c++:(u++,c++,l++)}var d=e.length;if(!l)return I;if(l===d)return Object(i.g)(0,e.length-1);var f=new Int32Array(l),p=0;for(u=n,c=a;u<o&&c<s;){var m,h;(m=e[u])<(h=t[c])?u++:(m>h||(f[p++]=u,u++),c++)}return f}var le,de,fe={startI:0,startJ:0,endI:0,endJ:0};function pe(e,t){var r=e.length,n=t.length,i=r/n;return r>=128||n>=128||i<=.34||i>=2.99?(fe.startI=K(e,L(t)),fe.startJ=K(t,L(e)),fe.endI=K(e,N(t)),fe.endJ=K(t,N(e))):(fe.startI=0,fe.startJ=0,fe.endI=r,fe.endJ=n),fe}(de=le||(le={})).Empty=I,de.ofUnsortedArray=B,de.ofSingleton=M,de.ofSortedArray=k,de.ofRange=V,de.ofBounds=function(e,t){return V(e,t-1)},de.is=R,de.has=Y,de.indexOf=q,de.indexOfInInterval=W,de.indexOfInRange=X,de.start=L,de.end=N,de.min=F,de.max=U,de.size=z,de.hashCode=H,de.toString=G,de.areEqual=Q,de.areIntersecting=te,de.isSubset=re,de.union=ne,de.intersect=oe,de.subtract=se,de.findPredecessorIndex=K,de.findPredecessorIndexInInterval=Z,de.findRange=J,de.intersectionSize=ie,de.deduplicate=ue,de.indicesOf=ce;var me,he,ge=le,ve=T.Empty,be=T.ofSingleton,ye=T.ofRange,_e=T.ofBounds;function Se(e){return e.length?e[e.length-1]-e[0]+1===e.length?T.ofRange(e[0],e[e.length-1]):e:ve}function xe(e){return T.is(e)?T.size(e):ge.size(e)}function Oe(e,t){return T.is(e)?T.has(e,t):ge.has(e,t)}function we(e,t){return T.is(e)?T.indexOf(e,t):ge.indexOf(e,t)}function Ce(e,t){return T.is(e)?T.getAt(e,t):e[t]}function je(e){return T.is(e)?T.min(e):ge.min(e)}function Pe(e){return T.is(e)?T.max(e):ge.max(e)}function Ee(e){return T.is(e)?T.start(e):ge.start(e)}function Ae(e){return T.is(e)?T.end(e):ge.end(e)}function De(e){return T.is(e)?T.hashCode(e):ge.hashCode(e)}function Te(e,t){return T.is(e)?T.is(t)?T.areEqual(e,t):Ue(e,t):T.is(t)?Ue(t,e):ge.areEqual(e,t)}function Ie(e,t){return T.is(e)?T.is(t)?T.areIntersecting(e,t):ze(t,e):T.is(t)?ze(e,t):ge.areIntersecting(e,t)}function Me(e,t){return T.is(e)?T.is(t)?T.isSubInterval(e,t):function(e,t){var r=T.min(e),n=T.max(e);if(n-r+1==0)return!1;var i=ge.min(t),a=ge.max(t);return i>=r&&a<=n}(e,t):T.is(t)?function(e,t){var r=T.min(t),n=T.max(t);if(n-r+1==0)return!0;var i=ge.min(e),a=ge.max(e);if(r<i||n>a)return!1;var o=ge.findRange(e,r,n);return T.size(o)===T.size(t)}(e,t):ge.isSubset(e,t)}function ke(e,t){return T.is(e)?T.findPredecessorIndex(e,t):ge.findPredecessorIndex(e,t)}function Be(e,t,r){return T.is(e)?T.findPredecessorIndexInInterval(e,t,r):ge.findPredecessorIndexInInterval(e,t,r)}function Ve(e,t,r){return T.is(e)?T.findRange(e,t,r):ge.findRange(e,t,r)}function Re(e,t){return T.is(e)?T.is(t)?T.intersectionSize(e,t):Ge(t,e):T.is(t)?Ge(e,t):ge.intersectionSize(e,t)}function Le(e,t){return T.is(e)?T.is(t)?function(e,t){if(T.areEqual(e,t))return e;var r=T.size(e),n=T.size(t);if(!n)return e;if(!r)return t;var i,a,o,s,u=T.min(e),c=T.min(t);if(function(e,t){var r=xe(e),n=xe(t);return 0===r&&0===n||r>0&&n>0&&Pe(e)>=je(t)&&je(e)<=Pe(t)}(e,t))return T.ofRange(Math.min(u,c),Math.max(T.max(e),T.max(t)));u<c?(i=r,a=u,o=n,s=c):(i=n,a=c,o=r,s=u);for(var l=new Int32Array(r+n),d=0;d<i;d++)l[d]=d+a;for(d=0;d<o;d++)l[d+i]=d+s;return Se(l)}(e,t):He(t,e):T.is(t)?He(e,t):Se(ge.union(e,t))}function Ne(e,t){return T.is(e)?T.is(t)?T.intersect(e,t):qe(t,e):T.is(t)?qe(e,t):Se(ge.intersect(e,t))}function Fe(e,t){return T.is(e)?T.is(t)?function(e,t){if(T.areEqual(e,t))return ve;if(!T.areIntersecting(e,t))return e;var r=T.min(e),n=T.max(e),i=T.min(t),a=T.max(t);if(n<r||a<i)return e;if(T.isSubInterval(t,e))return ve;if(T.isSubInterval(e,t)){var o=i-r,s=n-a;if(o<=0)return T.ofRange(a+1,a+s);if(s<=0)return T.ofRange(r,r+o-1);for(var u=new Int32Array(o+s),c=0,l=0;l<o;l++)u[c++]=r+l;for(l=1;l<=s;l++)u[c++]=a+l;return Se(u)}return r<i?T.ofRange(r,i-1):T.ofRange(a+1,n)}(e,t):function(e,t){var r=T.min(e),n=T.max(e);if(n<r)return e;var i=n-r+1,a=ge.findRange(t,r,n),o=T.start(a),s=T.end(a),u=s-o;if(0===u)return e;var c=i-u;if(c<=0)return ve;for(var l=new Int32Array(c),d=t.length-1,f=t[Math.min(o,d)],p=t[Math.min(s,d)],m=0,h=r;h<f;h++)l[m++]=h;for(h=f;h<=p;h++)ge.indexOfInInterval(t,h,a)<0&&(l[m++]=h);for(h=p+1;h<=n;h++)l[m++]=h;return Se(l)}(e,t):T.is(t)?function(e,t){var r=T.min(t),n=T.max(t);if(n<r)return e;var i=ge.findRange(e,r,n),a=T.start(i),o=T.end(i),s=e.length-(o-a);if(s<=0)return ve;if(s===e.length)return e;for(var u=new Int32Array(s),c=0,l=0;l<a;l++)u[c++]=e[l];l=o;for(var d=e.length;l<d;l++)u[c++]=e[l];return Se(u)}(e,t):Se(ge.subtract(e,t))}function Ue(e,t){return T.size(e)===ge.size(t)&&T.start(e)===ge.start(t)&&T.end(e)===ge.end(t)}function ze(e,t){return 0!==e.length&&0!==T.size(ge.findRange(e,T.min(t),T.max(t)))}function He(e,t){var r=T.size(t);if(!r)return e;if(function(e,t){return xe(e)?!xe(t)||je(e)<=je(t)&&Pe(e)>=Pe(t):0===xe(t)}(t,e))return t;for(var n=T.min(t),i=T.max(t),a=ge.findRange(e,n,i),o=T.start(a),s=T.end(a),u=new Int32Array(o+(e.length-s)+r),c=0,l=0;l<o;l++)u[c++]=e[l];for(l=n;l<=i;l++)u[c++]=l;l=s;for(var d=e.length;l<d;l++)u[c++]=e[l];return Se(u)}function Ge(e,t){if(!T.size(t))return 0;var r=ge.findRange(e,T.min(t),T.max(t));return T.end(r)-T.start(r)}function qe(e,t){if(!T.size(t))return ve;var r=ge.findRange(e,T.min(t),T.max(t)),n=T.start(r),i=T.end(r),a=i-n;if(!a)return ve;if(a===e.length)return e;for(var o=new Int32Array(a),s=0,u=n;u<i;u++)o[s++]=e[u];return Se(o)}function We(e,t,r){if(t===r)return e;var n=xe(e),i=t.length,a=r.length;if(0===n||0===i||0===a)return ve;for(var o=ge.findPredecessorIndex(r,t[je(e)]),s=ge.findPredecessorIndex(r,t[Pe(e)]+1),u=0,c=0,l=0,d=o;l<n&&d<s;){(p=t[Ce(e,l)])<(m=r[d])?l++:(p>m||(u++,l++),d++)}if(0===u)return ve;if(u===i&&u===a)return e;var f=new Int32Array(u);for(c=0,l=0,d=o;l<n&&d<s;){var p,m;(p=t[Ce(e,l)])<(m=r[d])?l++:(p>m||(f[c++]=d,l++),d++)}return Se(f)}(he=me||(me={})).Empty=ve,he.ofSingleton=be,he.ofRange=ye,he.ofBounds=_e,he.ofSortedArray=Se,he.has=Oe,he.indexOf=we,he.getAt=Ce,he.min=je,he.max=Pe,he.start=Ee,he.end=Ae,he.size=xe,he.hashCode=De,he.areEqual=Te,he.areIntersecting=Ie,he.isSubset=Me,he.union=Le,he.intersect=Ne,he.indexedIntersect=We,he.subtract=Fe,he.findPredecessorIndex=ke,he.findPredecessorIndexInInterval=Be,he.findRange=Ve,he.intersectionSize=Re,he.forEach=function(e,t,r){return function(e,t,r){if(T.is(e))for(var n=T.min(e),i=n,a=T.max(e);i<=a;i++)t(i,i-n,r);else for(i=0,a=e.length;i<a;i++)t(e[i],i,r);return r}(e,t,r)},he.forEachSegment=function(e,t,r,n){return function(e,t,r,n){if(T.is(e))for(var i=0,a=T.min(e),o=T.max(e);a<=o;a++){for(var s=t(a),u=a+1;u<o&&t(u)===s;)u++;a=u-1,r(s,i,n),i++}else for(i=0,a=0,o=e.length;a<o;a++){for(s=t(e[a]),u=a+1;u<o&&t(e[u])===s;)u++;a=u-1,r(s,i,n),i++}return n}(e,t,r,n)},he.isInterval=function(e){return T.is(e)},he.isSortedArray=function(e){return!T.is(e)},he.toArray=function(e){var t=[];return he.forEach(e,(function(e){return t.push(e)})),t},he.toString=function(e){return function(e){return T.is(e)?T.toString(e):ge.toString(e)}(e)};var Xe=me;function Ye(e){for(var t=ge.ofSortedArray(e),r=ge.max(t),n=new Int32Array(r),i=0,a=e.length-1;i<a;i++)for(var o=e[i],s=e[i+1];o<s;o++)n[o]=i;return{offsets:t,index:n,count:e.length-1}}function Qe(e,t){for(var r=T.start(t),n=new Int32Array(e.length+1),i=0,a=e.length;i<a;i++)n[i]=e[i]-r;return n[e.length]=T.end(t)-r,Ye(n)}function Ke(e){return e.count}function Ze(e,t){return e.index[t]}function Je(e,t,r){var n=e.offsets,i=r>=Xe.max(n)?-1:Xe.findPredecessorIndex(n,r-1);return Xe.findRange(t,Xe.getAt(n,i),Xe.getAt(n,i+1)-1)}var $e,et,tt=function(){function e(e,t,r,n){this.segments=e,this.segmentMap=t,this.set=r,this.segmentMin=0,this.segmentMax=0,this.setRange=T.Empty,this.value={index:0,start:0,end:0},this.hasNext=!1,this.setRange=n,this.updateSegmentRange()}return e.prototype.move=function(){for(;this.hasNext;){if(this.updateValue()){this.value.index=this.segmentMin++,this.hasNext=this.segmentMax>=this.segmentMin&&T.size(this.setRange)>0;break}this.updateSegmentRange()}return this.value},e.prototype.updateValue=function(){var e=this.segments[this.segmentMin+1],t=Xe.findPredecessorIndexInInterval(this.set,e,this.setRange);return this.value.start=T.start(this.setRange),this.value.end=t,this.setRange=T.ofBounds(t,T.end(this.setRange)),t>this.value.start},e.prototype.updateSegmentRange=function(){var e=T.min(this.setRange),t=T.max(this.setRange);t<e?this.hasNext=!1:(this.segmentMin=this.segmentMap[Xe.getAt(this.set,e)],this.segmentMax=this.segmentMap[Xe.getAt(this.set,t)],this.hasNext=this.segmentMax>=this.segmentMin)},e.prototype.setSegment=function(e){this.setRange=T.ofBounds(e.start,e.end),this.updateSegmentRange()},e}();function rt(e,t,r){var n=void 0!==r?T.ofBounds(r.start,r.end):T.ofBounds(0,Xe.size(t));return new tt(e.offsets,e.index,t,n)}(et=$e||($e={})).create=Ye,et.ofOffsets=Qe,et.count=Ke,et.getSegment=Ze,et.projectValue=Je,et.transientSegments=rt;var nt=$e;var it,at=function(){function e(e){this.head=e>0?0:-1,this.prev=new Int32Array(e),this.next=new Int32Array(e);for(var t=0;t<e;t++)this.next[t]=t+1,this.prev[t]=t-1;this.prev[0]=-1,this.next[e-1]=-1}return e.prototype.remove=function(e){var t=this.prev,r=this.next,n=t[e],i=r[e];n>=0&&(r[n]=i,t[e]=-1),i>=0&&(t[i]=n,r[e]=-1),e===this.head&&(this.head=n<0?i:n)},e.prototype.has=function(e){return this.prev[e]>=0||this.next[e]>=0||this.head===e},e}(),ot=function(e){return new at(e)};!function(e){function t(){return new Map}e.Empty=new Map,e.keyArray=function(e){return Object(i.n)(e.keys())},e.Mutable=t,e.asImmutable=function(e){return e},e.copy=function(e){for(var r=t(),n=e.keys();;){var i=n.next(),a=i.done,o=i.value;if(a)break;r.set(o,e.get(o))}return r},e.addFrom=function(e,t){for(var r=t.keys();;){var n=r.next(),i=n.done,a=n.value;if(i)break;e.set(a,t.get(a))}return e}}(it||(it={}));var st=it,ut=r(298)},function(e,t,r){"use strict";r.d(t,"c",(function(){return w})),r.d(t,"d",(function(){return O})),r.d(t,"a",(function(){return m})),r.d(t,"b",(function(){return n}));var n={};r.r(n),r.d(n,"getArrayBounds",(function(){return a})),r.d(n,"createArray",(function(){return o})),r.d(n,"fillArrayValues",(function(){return s})),r.d(n,"createAndFillArray",(function(){return u})),r.d(n,"isTypedArray",(function(){return c})),r.d(n,"typedArrayWindow",(function(){return l}));var i=r(0);function a(e,t){return{start:t&&void 0!==t.start?Math.max(Math.min(t.start,e-1),0):0,end:t&&void 0!==t.end?Math.min(t.end,e):e}}function o(e,t){var r=t&&void 0!==t.array?t.array:Array,n=a(e,t),i=n.start,o=n.end;return{array:new r(o-i),start:i,end:o}}function s(e,t,r){for(var n=0,i=t.length;n<i;n++)t[n]=e(r+n);return t}function u(e,t,r){var n=o(e,r);return s(t,n.array,n.start)}function c(e){return!!e.buffer&&"number"==typeof e.byteLength&&"number"==typeof e.BYTES_PER_ELEMENT}function l(e,t){var r=e.constructor,n=e.buffer,i=e.length,o=e.byteOffset,s=e.BYTES_PER_ELEMENT,u=a(i,t),c=u.start,l=u.end;return 0===c&&l===i?e:new r(n,o+s*c,Math.min(i,l-c))}var d,f=r(1),p=r(101);!function(e){var t;function r(e,t){return h(t.T,e,t,1)}function n(e){return g(e)}!function(e){function t(t,r){return void 0===r&&(r=e.float),{"@type":"tensor",T:t.create(),space:t,valueType:"tensor",baseType:r}}e.str={"@type":"str",T:"",valueType:"str"},e.int={"@type":"int",T:0,valueType:"int"},e.coord={"@type":"coord",T:0,valueType:"float"},e.float={"@type":"float",T:0,valueType:"float"},e.Str=function(e){return void 0===e&&(e=""),{"@type":"str",T:e,valueType:"str"}},e.Int=function(e){return void 0===e&&(e=0),{"@type":"int",T:e,valueType:"int"}},e.Float=function(e){return void 0===e&&(e=0),{"@type":"float",T:e,valueType:"float"}},e.Tensor=t,e.Vector=function(r,n){return void 0===n&&(n=e.float),t(f.Tensor.Vector(r,"int"===n["@type"]?Int32Array:Float64Array),n)},e.Matrix=function(r,n,i){return void 0===i&&(i=e.float),t(f.Tensor.ColumnMajorMatrix(r,n,"int"===i["@type"]?Int32Array:Float64Array),i)},e.Aliased=function(e,t){return void 0!==t?Object(i.__assign)(Object(i.__assign)({},e),{T:t}):e},e.List=function(e,t,r){return void 0===r&&(r=[]),{"@type":"list",T:r,separator:e,itemParse:t,valueType:"list"}}}(t=e.Schema||(e.Schema={})),e.is=function(e){return!!e&&!!e.schema&&!!e.value},e.Undefined=r,e.ofConst=function(e,t,r){return h(e,t,r,0)},e.ofLambda=n,e.range=function(e,r){return n({value:function(t){return t+e},rowCount:Math.max(r-e+1,0),schema:t.int})},e.ofArray=function(e){return v(e)},e.ofIntArray=function(e){return v({array:e,schema:t.int})},e.ofFloatArray=function(e){return v({array:e,schema:t.float})},e.ofStringArray=function(e){return v({array:e,schema:t.str})},e.ofStringAliasArray=function(e){return v({array:e,schema:t.Aliased(t.str)})},e.ofStringListArray=function(e,r){return void 0===r&&(r=","),v({array:e,schema:t.List(r,(function(e){return e}))})},e.ofIntTokens=function(e){var r=e.count,n=e.data,i=e.indices;return g({value:function(e){return Object(p.d)(n,i[2*e],i[2*e+1])||0},rowCount:r,schema:t.int})},e.ofFloatTokens=function(e){var r=e.count,n=e.data,i=e.indices;return g({value:function(e){return Object(p.b)(n,i[2*e],i[2*e+1])||0},rowCount:r,schema:t.float})},e.ofStringTokens=function(e){var r=e.count,n=e.data,i=e.indices;return g({value:function(e){var t=n.substring(i[2*e],i[2*e+1]);return"."===t||"?"===t?"":t},rowCount:r,schema:t.str})},e.window=function(e,t,r){return function(e,t,r){return e.isDefined?0===t&&r===e.rowCount?e:e.__array&&c(e.__array)?function(e,t,r){var n=l(e.__array,{start:t,end:r}),i=e.valueKind;return v({array:n,schema:e.schema,valueKind:function(e){return i(t+e)}})}(e,t,r):function(e,t,r){var n=e.value,i=e.valueKind,a=e.areValuesEqual,s=0===t?n:function(e){return n(e+t)},u=r-t;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:u,value:s,valueKind:0===t?i:function(e){return i(e+t)},toArray:function(e){for(var r=o(u,e).array,i=0,a=r.length;i<a;i++)r[i]=n(i+t);return r},areValuesEqual:0===t?a:function(e,r){return a(e+t,r+t)}}}(e,t,r):d.Undefined(r-t,e.schema)}(e,t,r)},e.view=function(e,t,r){return void 0===r&&(r=!0),i=t,a=r,0===(n=e).rowCount||a&&function(e,t){if(e.length!==t)return!1;for(var r=0,n=e.length;r<n;r++)if(e[r]!==r)return!1;return!0}(i,n.rowCount)?n:n.__array&&typeof n.value(0)==typeof n.__array[0]?function(e,t){for(var r=e.__array,n=new r.constructor(t.length),i=0,a=t.length;i<a;i++)n[i]=r[t[i]];var o=e.valueKind;return v({array:n,schema:e.schema,valueKind:function(e){return o(t[e])}})}(n,i):function(e,t){var r=e.value,n=e.valueKind,i=e.areValuesEqual,a=t.length;return{schema:e.schema,__array:void 0,isDefined:e.isDefined,rowCount:a,value:function(e){return r(t[e])},valueKind:function(e){return n(t[e])},toArray:function(e){for(var n=o(a,e).array,i=0,s=n.length;i<s;i++)n[i]=r(t[i]);return n},areValuesEqual:function(e,r){return i(t[e],t[r])}}}(n,i);var n,i,a},e.createFirstIndexMap=function(e){return function(e){for(var t=new Map,r=0,n=e.rowCount;r<n;r++){var i=e.value(r);t.has(i)||t.set(e.value(r),r)}return t}(e)},e.createIndexer=function(e){return function(e){for(var t=new Map,r=0,n=e.rowCount;r<n;r++){var i=e.value(r);t.has(i)||t.set(e.value(r),r)}return function(e){return t.has(e)?t.get(e):-1}}(e)},e.mapToArray=function(e,t,r){return function(e,t,r){for(var n=new r(e.rowCount),i=0,a=e.rowCount;i<a;i++)n[i]=t(e.value(i));return n}(e,t,r||Array)},e.areEqual=function(e,t){return function(e,t){return e===t||e.rowCount===t.rowCount&&e.isDefined===t.isDefined&&e.schema.valueType===t.schema.valueType&&(e.__array&&t.__array?function(e,t){for(var r=e.__array,n=t.__array,i=0,a=e.rowCount;i<a;i++)if(r[i]!==n[i])return!1;return!0}(e,t):function(e,t){for(var r=e.value,n=t.value,i=0,a=e.rowCount;i<a;i++)if(r(i)!==n(i))return!1;return!0}(e,t))}(e,t)},e.indicesOf=function(e,t){return function(e,t){for(var r=[],n=e.value,i=0,a=e.rowCount;i<a;i++)t(n(i))&&(r[r.length]=i);return r}(e,t)},e.asArrayColumn=function(e,t){return e.__array?e:e.isDefined?v({array:e.toArray({array:t}),schema:e.schema,valueKind:e.valueKind}):r(e.rowCount,e.schema)},e.copyToArray=function(e,t,r){if(void 0===r&&(r=0),e.isDefined){var n=e.__array;if(n)for(var i=0,a=n.length;i<a;i++)t[r+i]=n[i];else for(i=0,a=e.rowCount;i<a;i++)t[r+i]=e.value(i)}},e.isIdentity=function(e){for(var t=0,r=e.rowCount;t<r;t++)if(t!==e.value(t))return!1;return!0}}(d||(d={}));var m=d;function h(e,t,r,n){return{schema:r,__array:void 0,isDefined:0===n,rowCount:t,value:function(t){return e},valueKind:function(e){return n},toArray:function(r){for(var n=o(t,r).array,i=0,a=n.length;i<a;i++)n[i]=e;return n},areValuesEqual:function(e,t){return!0}}}function g(e){var t=e.value,r=e.valueKind,n=e.areValuesEqual,i=e.rowCount;return{schema:e.schema,__array:void 0,isDefined:!0,rowCount:i,value:t,valueKind:r||function(e){return 0},toArray:function(e){for(var r=o(i,e),n=r.array,a=r.start,s=0,u=n.length;s<u;s++)n[s]=t(s+a);return n},areValuesEqual:n||function(e,r){return t(e)===t(r)}}}function v(e){var t=e.array,r=e.schema,n=e.valueKind,i=t.length,o="str"===r.valueType?function(e){var r=t[e];return"string"==typeof r?r:""+r}:function(e){return t[e]},s=c(t);return{schema:r,__array:t,isDefined:!0,rowCount:i,value:o,valueKind:n||function(e){return 0},toArray:"str"===r.valueType?function(e){for(var r=a(i,e),n=r.start,o=r.end,s=new(e&&void 0!==e.array?e.array:t.constructor)(o-n),u=0,c=o-n;u<c;u++){var l=t[n+u];s[u]="string"==typeof l?l:""+l}return s}:s?function(e){return l(t,e)}:function(e){var r=a(i,e),n=r.start,o=r.end;if(0===n&&o===t.length)return t;for(var s=new(e&&void 0!==e.array?e.array:t.constructor)(o-n),u=0,c=o-n;u<c;u++)s[u]=t[n+u];return s},areValuesEqual:function(e,r){return t[e]===t[r]}}}var b,y=r(280),_=r(5);!function(e){function t(e,t,r){var n=Object.create(null),i=Object.keys(t);n._rowCount=r.length,n._columns=i,n._schema=t;for(var a=0,o=i;a<o.length;a++){var s=o[a];n[s]=m.view(e[s],r)}return n}function r(e,t){for(var r=Object.create(null),n=e._columns,i=0;i<n.length;i++){var a=n[i];r[a]=e[a].value(t)}return r}e.is=function(e){return e&&"number"==typeof e._rowCount&&!!e._columns&&!!e._schema},e.pickColumns=function(e,t,r){void 0===r&&(r={});var n=Object.create(null),i=Object.keys(e);n._rowCount=t._rowCount,n._columns=i,n._schema=e;for(var a=0,o=i;a<o.length;a++){var s=o[a];if(t[s])n[s]=t[s];else{if(!r[s])throw Error("Cannot find column '"+s+"'.");n[s]=r[s]}}return n},e.ofColumns=function(e,t){var r=Object.keys(t),n=t[r[0]].rowCount;return Object(i.__assign)({_rowCount:n,_columns:r,_schema:e},t)},e.ofPartialColumns=function(e,t,r){var n=Object.create(null),i=Object.keys(e);n._rowCount=r,n._columns=i,n._schema=e;for(var a=0,o=i;a<o.length;a++){var s=o[a];n[s]=s in t?t[s]:m.Undefined(r,e[s])}return n},e.ofUndefinedColumns=function(e,t){var r=Object.create(null),n=Object.keys(e);r._rowCount=t,r._columns=n,r._schema=e;for(var i=0,a=n;i<a.length;i++){var o=a[i];r[o]=m.Undefined(t,e[o])}return r},e.ofRows=function(e,t){var r=Object.create(null),n=t.length,i=Object.keys(e);r._rowCount=n,r._columns=i,r._schema=e;for(var a=function(i){r[i]=m.ofLambda({rowCount:n,schema:e[i],value:function(e){return t[e][i]},valueKind:function(e){return void 0===t[e][i]?1:0}})},o=0,s=i;o<s.length;o++){a(s[o])}return r},e.ofArrays=function(e,t){var r,n=Object.create(null),i=Object.keys(e);n._rowCount=0,n._columns=i,n._schema=e;for(var a=0,o=i;a<o.length;a++){var s=o[a];void 0!==t[s]?(n[s]=m.ofArray({array:t[s],schema:e[s]}),n._rowCount=null===(r=t[s])||void 0===r?void 0:r.length):n[s]=m.Undefined(n._rowCount,e[s])}return n},e.view=t,e.pick=function(e,r,n){for(var i=[],a=0,o=e._rowCount;a<o;++a)n(a)&&i.push(a);return t(e,r,i)},e.window=function(e,t,r,n){if(0===r&&n===e._rowCount)return e;var i=Object.create(null),a=Object.keys(t);i._rowCount=n-r,i._columns=a,i._schema=t;for(var o=0,s=a;o<s.length;o++){var u=s[o];i[u]=m.window(e[u],r,n)}return i},e.concat=function(e,t){var r=Object.create(null),n=Object.keys(t);r._rowCount=0;for(var i=0,a=e;i<a.length;i++){var o=a[i];r._rowCount+=o._rowCount}for(var s={},u=0,c=n;u<c.length;u++){s[c[u]]=new Array(r._rowCount)}r._columns=n,r._schema=t;for(var l=0,d=0,f=e;d<f.length;d++){o=f[d];for(var p=0,h=n;p<h.length;p++){var g=h[p];m.copyToArray(o[g],s[g],l)}l+=o._rowCount}for(var v=0,b=n;v<b.length;v++){r[g=b[v]]=m.ofArray({array:s[g],schema:t[g]})}return r},e.columnToArray=function(e,t,r){e[t]=m.asArrayColumn(e[t],r)},e.sort=function(e,t){for(var r=new Int32Array(e._rowCount),n=0,i=r.length;n<i;n++)r[n]=n;Object(y.c)(r,(function(e,r,n){return t(r,n)}));var a=!0;for(n=0,i=r.length;n<i;n++)if(r[n]!==n){a=!1;break}if(a)return e;var o=Object.create(null);o._rowCount=e._rowCount,o._columns=e._columns,o._schema=e._schema;for(var s=0,u=e._columns;s<u.length;s++){var c=u[s];o[c]=m.view(e[c],r,!1)}return o},e.areEqual=function(e,t){if(e._rowCount!==t._rowCount)return!1;if(e._columns.length!==t._columns.length)return!1;for(var r=0,n=e._columns;r<n.length;r++){if(!t[o=n[r]])return!1}for(var i=0,a=e._columns;i<a.length;i++){var o=a[i];if(!m.areEqual(e[o],t[o]))return!1}return!0},e.getRow=r,e.pickRow=function(e,t){for(var n=0,i=e._rowCount;n<i;++n)if(t(n))return r(e,n)},e.getRows=function(e){for(var t=[],n=e._rowCount,i=0;i<n;i++)t[i]=r(e,i);return t},e.toArrays=function(e){for(var t={},r=e._columns,n=0;n<r.length;n++){var i=r[n];t[i]=e[i].toArray()}return t},e.formatToString=function(e){var t=_.b.create(),r=e._columns,n=e._rowCount,i=1;_.b.write(t,"|");for(var a=0;a<r.length;a++)_.b.write(t,r[a]),_.b.write(t,"|"),i+=r[a].length+1;_.b.newline(t),_.b.write(t,new Array(i+1).join("-")),_.b.newline(t);for(var o=0;o<n;o++){_.b.write(t,"|");for(a=0;a<r.length;a++){var s=e[r[a]];0===s.valueKind(o)?(_.b.write(t,s.value(o)),_.b.write(t,"|")):_.b.write(t,".|")}_.b.newline(t)}return _.b.getString(t)}}(b||(b={}));var S,x,O=b;(x=S||(S={})).ofTables=function(e,t,r){var n=Object.keys(r),i=Object.create(null),a=[];i._name=e,i._tableNames=a,i._schema=t;for(var o=0,s=n;o<s.length;o++){var u=s[o];O.is(r[u])&&(i[u]=r[u],a[a.length]=u)}return i},x.getTablesAsRows=function(e){for(var t={},r=0,n=e._tableNames;r<n.length;r++){var i=n[r];t[i]=O.getRows(e[i])}return t};var w=S},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i}));var n,i,a=r(0),o=r(13);!function(e){function t(t){return e.Create(Object(a.__assign)(Object(a.__assign)({},t),{typeClass:"Representation3D"}))}e.Create=o.StateObject.factory(),e.isRepresentation3D=function(e){return!!e&&"Representation3D"===e.type.typeClass},e.isBehavior=function(e){return!!e&&"Behavior"===e.type.typeClass},e.CreateRepresentation3D=t,e.CreateBehavior=function(t){return e.Create(Object(a.__assign)(Object(a.__assign)({},t),{typeClass:"Behavior"}))};var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Root",typeClass:"Root"}));e.Root=r;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Group",typeClass:"Group"}));e.Group=n,function(t){var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"String Data",typeClass:"Data"}));t.String=r;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Binary Data",typeClass:"Data"}));t.Binary=n;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Data Blob",typeClass:"Data"}));t.Blob=i}(e.Data||(e.Data={})),function(t){var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"JSON Data",typeClass:"Data"}));t.Json=r;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"CIF File",typeClass:"Data"}));t.Cif=n;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Cube File",typeClass:"Data"}));t.Cube=i;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"PSF File",typeClass:"Data"}));t.Psf=o;var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"PLY File",typeClass:"Data"}));t.Ply=s;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"CCP4/MRC/MAP File",typeClass:"Data"}));t.Ccp4=u;var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"DSN6/BRIX File",typeClass:"Data"}));t.Dsn6=c;var l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"DX File",typeClass:"Data"}));t.Dx=l;var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Format Blob",typeClass:"Data"}));t.Blob=d}(e.Format||(e.Format={})),function(r){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Coordinates",typeClass:"Object"}));r.Coordinates=n;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Topology",typeClass:"Object"}));r.Topology=i;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Model",typeClass:"Object"}));r.Model=o;var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Trajectory",typeClass:"Object"}));r.Trajectory=s;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Structure",typeClass:"Object"}));r.Structure=u,function(r){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(t({name:"Structure 3D"}));r.Representation3D=n;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Structure 3D State",typeClass:"Object"}));r.Representation3DState=i;var o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Selections",typeClass:"Object"}));r.Selections=o}(u=r.Structure||(r.Structure={}))}(e.Molecule||(e.Molecule={})),function(r){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Volume",typeClass:"Object"}));r.Data=n;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(t({name:"Volume 3D"}));r.Representation3D=i}(e.Volume||(e.Volume={})),function(r){var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(e.Create({name:"Shape Provider",typeClass:"Object"}));r.Provider=n;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(t({name:"Shape 3D"}));r.Representation3D=i}(e.Shape||(e.Shape={}))}(n||(n={})),function(e){e.CreateBuiltIn=o.StateTransformer.factory("ms-plugin"),e.BuiltIn=o.StateTransformer.builderFactory("ms-plugin")}(i||(i={}))},function(e,t,r){"use strict";r.d(t,"i",(function(){return i})),r.d(t,"h",(function(){return a.a})),r.d(t,"e",(function(){return f})),r.d(t,"f",(function(){return d})),r.d(t,"d",(function(){return p})),r.d(t,"c",(function(){return b})),r.d(t,"b",(function(){return g.a})),r.d(t,"g",(function(){return S.a})),r.d(t,"a",(function(){return x}));var n=r(1);function i(e,t,r){for(var n=new Float32Array(e),i=0;i<n.length;i++)n[i]=t+r*i;return n}var a=r(134),o=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[-1,0,0,0],[0,-1,0,0],[0,0,-1,0],[0,1,0,.5],[1,0,0,.5],[-1,0,0,.5],[0,0,1,.5],[0,-1,0,.5],[0,0,-1,.5],[1,0,0,.25],[0,-1,0,.25],[0,0,1,.25],[-1,0,0,.25],[0,1,0,.25],[0,-1,0,.75],[0,0,1,.75],[0,1,0,.75],[1,0,0,.75],[-1,0,0,.75],[0,0,-1,.25],[0,0,-1,.75],[1,-1,0,0],[-1,1,0,0],[0,0,1,1/3],[0,0,1,2/3],[1,0,0,2/3],[0,1,0,1/3],[0,-1,0,2/3],[1,-1,0,1/3],[-1,1,0,2/3],[-1,0,0,1/3],[1,0,0,1/3],[0,1,0,2/3],[0,-1,0,1/3],[1,-1,0,2/3],[-1,1,0,1/3],[-1,0,0,2/3],[0,0,-1,1/3],[0,0,-1,2/3],[0,0,1,5/6],[0,0,1,1/6],[0,0,-1,5/6],[0,0,-1,1/6]],s=[[0,1,2],[3,4,5],[3,1,5],[3,6,5],[7,6,2],[8,6,5],[0,4,2],[0,4,9],[7,10,2],[7,10,9],[0,10,2],[8,10,5],[3,1,11],[3,6,11],[0,10,9],[8,6,11],[3,4,2],[0,4,5],[3,4,9],[7,10,5],[8,4,9],[8,10,9],[8,10,2],[0,6,9],[3,10,9],[0,10,11],[7,1,9],[8,1,11],[7,4,11],[7,6,9],[7,10,11],[3,10,2],[8,1,5],[0,4,11],[3,1,2],[3,1,9],[7,4,2],[8,1,2],[8,1,9],[3,6,9],[7,4,9],[8,6,2],[8,6,9],[3,6,2],[12,13,14],[15,16,14],[12,17,18],[15,19,18],[20,13,18],[21,16,18],[20,17,14],[21,19,14],[0,1,5],[8,10,11],[7,6,11],[7,6,5],[8,4,2],[7,4,5],[7,1,5],[7,1,11],[0,10,5],[0,1,11],[0,6,11],[0,6,5],[3,10,11],[8,4,11],[15,13,22],[12,16,22],[15,17,23],[12,19,23],[21,13,23],[20,16,23],[21,17,22],[20,19,22],[4,0,2],[1,3,2],[4,0,14],[1,3,18],[4,0,9],[1,3,9],[4,0,18],[1,3,14],[10,7,9],[6,8,9],[4,7,14],[6,3,18],[10,0,18],[1,8,14],[1,3,5],[4,0,5],[6,8,11],[10,7,11],[1,3,11],[4,0,11],[10,7,2],[6,8,2],[3,10,22],[7,1,23],[8,4,23],[0,6,22],[1,0,5],[4,3,5],[1,0,23],[4,3,22],[10,7,14],[6,8,18],[8,6,22],[7,10,23],[4,3,11],[1,0,11],[1,0,22],[4,3,23],[10,7,18],[6,8,14],[8,6,23],[7,10,22],[6,7,11],[10,8,11],[8,1,23],[0,10,22],[3,6,22],[7,4,23],[4,3,2],[1,0,2],[10,8,2],[6,7,2],[4,3,9],[1,0,9],[10,8,9],[6,7,9],[4,8,14],[6,0,18],[10,3,18],[1,7,14],[4,8,18],[6,0,14],[10,3,14],[1,7,18],[6,7,5],[10,8,5],[6,8,5],[10,7,5],[8,1,22],[0,10,23],[3,6,23],[7,4,22],[4,24,2],[25,3,2],[4,24,26],[25,3,27],[4,24,27],[25,3,26],[28,29,26],[30,31,26],[32,33,26],[34,35,27],[36,37,27],[38,39,27],[2,0,1],[1,2,0],[1,25,5],[24,0,5],[39,36,40],[35,38,40],[37,34,40],[33,30,41],[29,32,41],[31,28,41],[5,3,4],[4,5,3],[25,1,5],[0,24,5],[24,4,5],[3,25,5],[4,3,41],[25,1,40],[24,4,41],[3,25,40],[4,3,40],[25,1,41],[24,4,40],[3,25,41],[35,34,40],[37,36,40],[39,38,40],[29,28,41],[31,30,41],[33,32,41],[3,5,4],[5,4,3],[25,1,2],[0,24,2],[24,4,2],[3,25,2],[25,1,9],[0,24,9],[24,4,9],[3,25,9],[30,33,26],[32,29,26],[28,31,26],[36,39,27],[38,35,27],[34,37,27],[0,2,1],[2,1,0],[30,33,42],[32,29,42],[28,31,42],[36,39,43],[38,35,43],[34,37,43],[7,9,6],[9,6,7],[25,1,11],[0,24,11],[24,4,11],[3,25,11],[35,34,44],[37,36,44],[39,38,44],[29,28,45],[31,30,45],[33,32,45],[8,11,10],[11,10,8],[1,25,2],[24,0,2],[1,25,42],[24,0,43],[1,25,43],[24,0,42],[1,25,27],[24,0,26],[1,25,26],[24,0,27],[1,25,9],[24,0,9],[4,24,5],[25,3,5],[4,24,11],[25,3,11],[1,0,40],[4,3,44],[0,24,45],[1,0,41],[4,3,45],[0,24,44],[0,24,40],[0,24,41],[2,3,4],[5,3,1],[5,0,4],[4,2,3],[1,5,3],[4,5,0],[2,7,6],[2,8,10],[5,8,6],[5,7,10],[1,9,7],[4,9,8],[1,11,8],[4,11,7],[9,0,6],[9,3,10],[11,3,6],[11,0,10],[6,2,7],[10,2,8],[6,5,8],[10,5,7],[9,7,1],[9,8,4],[11,8,1],[11,7,4],[6,9,0],[10,9,3],[6,11,3],[10,11,0],[9,7,6],[9,8,10],[11,8,6],[11,7,10],[6,9,7],[10,9,8],[6,11,8],[10,11,7],[2,3,10],[5,8,1],[11,0,4],[10,2,3],[1,5,8],[4,11,0],[5,0,1],[2,0,4],[2,3,1],[1,5,0],[4,2,0],[1,2,3],[11,8,10],[11,7,6],[9,7,10],[9,8,6],[10,11,8],[6,11,7],[10,9,7],[6,9,8],[5,8,10],[5,7,6],[2,7,10],[2,8,6],[4,11,8],[1,11,7],[4,9,7],[1,9,8],[11,3,10],[11,0,6],[9,0,10],[9,3,6],[10,5,8],[6,5,7],[10,2,7],[6,2,8],[11,8,4],[11,7,1],[9,7,4],[9,8,1],[10,11,3],[6,11,0],[10,9,0],[6,9,3],[22,15,13],[22,12,16],[14,12,13],[14,15,16],[13,22,15],[16,22,12],[13,14,12],[16,14,15],[22,21,17],[22,20,19],[14,20,17],[14,21,19],[13,23,21],[16,23,20],[13,18,20],[16,18,21],[23,15,17],[23,12,19],[18,12,17],[18,15,19],[17,22,21],[19,22,20],[17,14,20],[19,14,21],[23,21,13],[23,20,16],[18,20,13],[18,21,16],[17,23,15],[19,23,12],[17,18,12],[19,18,15],[5,0,6],[2,7,4],[9,3,1],[6,5,0],[4,2,7],[1,9,3],[0,2,4],[3,2,1],[0,5,1],[2,1,3],[2,4,0],[5,1,0],[7,9,10],[8,9,6],[7,11,6],[9,6,8],[9,10,7],[11,6,7],[1,7,11],[4,8,11],[1,8,9],[4,7,9],[0,9,10],[3,9,6],[3,11,10],[0,11,6],[2,6,8],[2,10,7],[5,6,7],[5,10,8],[6,0,11],[10,3,11],[6,3,9],[10,0,9],[7,2,10],[8,2,6],[8,5,10],[7,5,6],[9,1,8],[9,4,7],[11,1,7],[11,4,8],[7,9,4],[8,9,1],[8,11,4],[7,11,1],[9,6,3],[9,10,0],[11,6,0],[11,10,3],[19,12,23],[13,15,22],[16,21,18],[17,20,14],[20,14,17],[21,18,16],[15,22,13],[12,23,19],[18,16,21],[14,17,20],[23,19,12],[22,13,15],[19,20,22],[13,21,23],[16,15,14],[17,12,18],[20,18,13],[21,14,19],[15,23,17],[12,22,16],[18,19,15],[14,13,12],[23,16,20],[22,17,21],[16,12,22],[17,15,23],[19,21,14],[13,20,18],[12,14,13],[15,18,19],[21,22,17],[20,23,16],[14,16,15],[18,17,12],[22,19,20],[23,13,21],[16,20,23],[17,21,22],[19,15,18],[13,12,14],[12,18,17],[15,14,16],[21,23,13],[20,22,19],[14,19,21],[18,13,20],[22,16,12],[23,17,15],[19,12,22],[17,21,23],[16,15,18],[13,20,14],[20,14,13],[15,18,16],[21,23,17],[12,22,19],[18,16,15],[14,13,20],[22,19,12],[23,17,21],[3,2,4],[3,5,1],[0,5,4],[2,4,3],[5,1,3],[5,4,0],[1,7,9],[4,8,9],[1,8,11],[4,7,11],[0,9,6],[3,9,10],[3,11,6],[0,11,10],[2,6,7],[2,10,8],[5,6,8],[5,10,7],[6,0,9],[10,3,9],[6,3,11],[10,0,11],[7,2,6],[8,2,10],[8,5,6],[7,5,10],[9,1,7],[9,4,8],[11,1,8],[11,4,7],[7,9,1],[8,9,4],[8,11,1],[7,11,4],[9,6,0],[9,10,3],[11,6,3],[11,10,0],[8,9,10],[8,11,6],[7,11,10],[9,10,8],[11,6,8],[11,10,7],[6,0,2],[10,3,2],[6,3,5],[10,0,5],[7,2,1],[8,2,4],[8,5,1],[7,5,4],[9,1,0],[9,4,3],[11,1,3],[11,4,0],[1,7,2],[4,8,2],[1,8,5],[4,7,5],[0,9,1],[3,9,4],[3,11,1],[0,11,4],[2,6,0],[2,10,3],[5,6,3],[5,10,0],[0,2,6],[3,2,10],[3,5,6],[0,5,10],[2,1,7],[2,4,8],[5,1,8],[5,4,7],[16,12,14],[13,21,18],[19,15,23],[17,20,22],[12,14,16],[21,18,13],[15,23,19],[20,22,17],[14,16,12],[18,13,21],[23,19,15],[22,17,20],[19,20,18],[17,15,14],[16,21,22],[13,12,23],[20,18,19],[15,14,17],[21,22,16],[12,23,13],[18,19,20],[14,17,15],[22,16,21],[23,13,12],[6,0,5],[10,3,5],[6,3,2],[10,0,2],[7,2,4],[8,2,1],[8,5,4],[7,5,1],[9,1,3],[9,4,0],[11,1,0],[11,4,3],[1,7,5],[4,8,5],[1,8,2],[4,7,2],[0,9,4],[3,9,1],[3,11,4],[0,11,1],[2,6,3],[2,10,0],[5,6,0],[5,10,3],[0,2,10],[3,2,6],[3,5,10],[0,5,6],[2,1,8],[2,4,7],[5,1,7],[5,4,8],[21,17,23],[20,16,22],[12,13,18],[15,19,14],[23,21,17],[22,20,16],[18,12,13],[14,15,19],[17,23,21],[16,22,20],[13,18,12],[19,14,15],[21,13,22],[20,19,23],[12,17,14],[15,16,18],[23,15,13],[22,12,19],[18,20,17],[14,21,16],[17,22,15],[16,23,12],[13,14,20],[19,18,21],[15,17,22],[12,16,23],[20,13,14],[21,19,18],[22,21,13],[23,20,19],[14,12,17],[18,15,16],[13,23,15],[19,22,12],[17,18,20],[16,14,21],[15,13,23],[12,19,22],[20,17,18],[21,16,14],[22,15,17],[23,12,16],[14,20,13],[18,21,19],[13,22,21],[19,23,20],[17,14,12],[16,18,15],[6,5,3],[4,9,3],[9,3,4],[5,7,4],[4,5,7],[5,3,6]],u=[[0],[0,1],[0,2],[0,3],[0,2,4,5],[0,6],[0,7],[0,6,4,8],[0,7,4,9],[0,6,2,1],[0,3,1,10],[0,6,2,1,4,8,5,11],[0,12,1,7],[0,1,13,14],[0,12,1,7,4,15,11,9],[0,16,2,17],[0,18,12,17],[0,16,5,19],[0,20,13,19],[0,18,12,17,4,21,15,19],[0,16,2,17,4,22,5,19],[0,16,2,17,23,24,13,25,26,20,27,28,4,22,5,19],[0,16,17,2,29,21,30,15],[0,20,13,19,29,31,32,33],[0,16,6,34],[0,18,7,34],[0,16,7,35],[0,16,36,37],[0,18,36,38],[0,16,14,39],[0,20,40,34],[0,16,8,41],[0,18,8,42],[0,16,9,42],[0,16,6,34,4,22,8,41],[0,18,7,34,4,21,9,41],[0,16,7,35,4,22,9,42],[0,16,6,34,23,24,14,39],[0,16,10,43,23,24,7,35],[0,16,36,37,23,24,9,42],[0,16,8,41,23,24,40,38],[0,16,6,34,23,24,14,39,26,20,40,38,4,22,8,41],[0,16,44,45,23,24,46,47,26,20,48,49,4,22,50,51],[0,16,6,34,29,21,9,42],[0,16,8,41,29,21,7,35],[0,16,36,37,29,21,14,39],[0,16,2,17,1,52,6,34],[0,16,2,17,53,54,9,42],[0,16,12,33,1,52,7,35],[0,16,2,17,11,55,8,41],[0,56,2,57,1,58,6,37],[0,56,15,25,1,58,9,39],[0,20,27,17,1,59,40,34],[0,56,12,28,1,58,7,38],[0,16,5,19,1,52,8,41],[0,22,13,28,1,55,14,38],[0,18,13,60,1,61,14,43],[0,16,15,30,1,52,9,42],[0,16,5,19,11,55,6,34],[0,21,12,19,1,54,7,41],[0,20,13,19,1,59,14,41],[0,20,3,30,1,59,10,42],[0,18,12,17,1,61,7,34,4,21,15,19,11,54,9,41],[0,24,13,17,1,62,14,34,4,20,27,19,11,59,40,41],[0,16,2,17,1,52,6,34,4,22,5,19,11,55,8,41],[0,16,12,33,1,52,7,35,4,22,15,30,11,55,9,42],[0,31,3,17,1,63,10,34,4,56,32,19,11,58,36,41],[0,22,2,19,64,59,14,38,4,16,5,17,65,62,40,39],[0,16,2,17,1,52,6,34,23,24,13,25,64,62,14,39,26,20,27,28,65,59,40,38,4,22,5,19,11,55,8,41],[0,16,2,17,66,67,44,45,23,24,13,25,68,69,46,47,26,20,27,28,70,71,48,49,4,22,5,19,72,73,50,51],[0,16,2,17,1,52,6,34,29,21,15,30,53,54,9,42],[0,16,5,19,1,52,8,41,29,21,12,33,53,54,7,35],[0,20,13,19,1,59,14,41,29,31,32,33,53,63,36,35],[0,31,3,17,1,63,10,34,29,20,27,30,53,59,40,42],[0,16,74,75],[0,18,76,77],[0,16,78,79],[0,18,80,81],[0,16,74,75,29,21,82,83],[0,21,84,85,29,16,86,87],[0,16,88,89],[0,16,88,89,29,21,90,91],[0,16,74,75,1,52,88,89],[0,16,78,79,1,52,92,93],[0,16,94,95,11,55,88,89],[0,16,82,83,53,54,88,89],[0,16,74,75,1,52,88,89,29,21,82,83,53,54,90,91],[0,21,84,85,96,97,88,91,29,16,86,87,98,99,90,89],[0,16,74,75,2,17,100,101],[0,16,94,95,5,19,100,101],[0,18,76,77,2,33,102,103],[0,18,104,105,106,107,100,108],[0,16,78,79,2,17,109,108],[0,16,82,83,15,30,100,101],[0,18,80,81,2,33,110,111],[0,18,112,113,114,115,100,108],[0,16,74,75,2,17,100,101,29,21,82,83,15,30,116,117],[0,21,84,85,118,119,116,101,29,16,86,87,120,121,100,117],[0,16,74,75,6,34,122,123],[0,16,74,75,8,41,124,125],[0,16,78,79,7,35,122,123],[0,16,82,83,9,42,122,123],[0,16,74,75,7,35,126,127],[0,16,74,75,9,42,128,129],[0,16,78,79,6,34,126,127],[0,16,78,79,8,41,128,129],[0,16,74,75,6,34,122,123,29,21,82,83,9,42,128,129],[0,16,74,75,7,35,126,127,29,21,82,83,8,41,124,125],[0,21,84,85,6,42,130,131,29,16,86,87,9,34,132,133],[0,21,84,85,7,41,134,135,29,16,86,87,8,35,136,137],[0,16,89,88,2,17,122,123],[0,16,89,88,12,33,126,127],[0,16,89,88,5,19,124,125],[0,16,89,88,15,30,128,129],[0,16,88,89,6,34,100,101],[0,16,89,88,7,35,109,108],[0,16,89,88,8,41,138,139],[0,16,89,88,9,42,116,117],[0,16,89,88,6,34,100,101,29,21,91,90,9,42,116,117],[0,16,89,88,7,35,109,108,29,21,91,90,8,41,138,139],[0,16,89,88,2,17,122,123,29,21,91,90,15,30,128,129],[0,16,89,88,118,121,132,131,29,21,91,90,120,119,130,133],[0,16,74,75,2,17,100,101,1,52,88,89,6,34,122,123],[0,16,74,75,12,33,109,108,1,52,88,89,7,35,126,127],[0,16,74,75,2,17,100,101,11,55,140,141,8,41,124,125],[0,16,74,75,2,17,100,101,53,54,90,91,9,42,128,129],[0,16,74,75,5,19,138,139,1,52,88,89,8,41,124,125],[0,16,74,75,15,30,116,117,1,52,88,89,9,42,128,129],[0,16,94,95,5,19,100,101,11,55,88,89,6,34,124,125],[0,16,94,95,15,30,109,108,11,55,88,89,7,35,128,129],[0,16,78,79,2,17,109,108,1,52,92,93,6,34,126,127],[0,16,78,79,12,33,100,101,1,52,92,93,7,35,122,123],[0,16,82,83,12,33,138,139,53,54,88,89,8,41,126,127],[0,16,82,83,2,17,116,117,53,54,88,89,9,42,122,123],[0,16,78,79,5,19,116,117,1,52,92,93,8,41,128,129],[0,16,82,83,15,30,100,101,1,52,90,91,9,42,122,123],[0,16,82,83,15,30,100,101,53,54,88,89,6,34,128,129],[0,16,82,83,5,19,109,108,53,54,88,89,7,35,124,125],[0,16,74,75,2,17,100,101,1,52,88,89,6,34,122,123,29,21,82,83,15,30,116,117,53,54,90,91,9,42,128,129],[0,16,74,75,12,33,109,108,1,52,88,89,7,35,126,127,29,21,82,83,5,19,138,139,53,54,90,91,8,41,124,125],[0,21,84,85,118,119,116,101,96,97,88,91,9,34,132,133,29,16,86,87,120,121,100,117,98,99,90,89,6,42,130,131],[0,21,84,85,142,143,138,108,96,97,88,91,8,35,136,137,29,16,86,87,144,145,109,139,98,99,90,89,7,41,134,135],[0,146,147],[0,148,149],[0,150,151],[0,146,147,152,153,154,155,156,157],[0,158,159],[0,146,147,1,160,161],[0,146,147,1,160,161,152,153,154,162,163,164,155,156,157,165,166,167],[0,158,159,1,168,169],[0,146,147,101,170,171],[0,146,147,100,172,173],[0,148,149,174,175,171],[0,148,149,100,176,177],[0,150,151,178,179,171],[0,150,151,100,180,181],[0,146,147,100,172,173,152,153,154,182,183,184,155,156,157,185,186,187],[0,158,159,101,188,189],[0,146,147,122,190,191],[0,146,147,123,192,193],[0,146,147,126,194,195],[0,146,147,127,196,197],[0,146,147,122,190,191,152,153,154,198,199,200,155,156,157,201,202,203],[0,158,159,123,204,205],[0,146,147,126,194,195,152,153,154,206,207,208,155,156,157,209,210,211],[0,158,159,129,212,213],[0,146,147,101,170,171,1,160,161,123,192,193],[0,146,147,108,214,215,1,160,161,127,196,197],[0,146,147,100,172,173,1,160,161,122,190,191],[0,146,147,109,216,217,1,160,161,126,194,195],[0,146,147,100,172,173,1,160,161,122,190,191,152,153,154,182,183,184,162,163,164,198,199,200,155,156,157,185,186,187,165,166,167,201,202,203],[0,158,159,101,188,189,1,168,169,123,204,205],[0,146,147,109,216,217,1,160,161,126,194,195,152,153,154,218,219,220,162,163,164,206,207,208,155,156,157,221,222,223,165,166,167,209,210,211],[0,158,159,117,224,225,1,168,169,129,212,213],[0,146,147,16,226,227],[0,148,149,18,228,229],[0,150,151,18,230,231],[0,150,151,16,232,233],[0,148,149,16,234,235],[0,146,147,18,236,237],[0,146,147,52,238,239],[0,146,147,16,226,227,1,160,161,52,238,239],[0,146,147,18,236,237,1,160,161,61,240,241],[0,146,147,16,226,227,100,172,173,101,170,171],[0,148,149,18,228,229,242,172,181,243,214,244],[0,150,151,18,230,231,245,172,177,246,214,247],[0,150,151,16,232,233,245,172,177,174,170,248],[0,148,149,16,234,235,242,172,181,178,170,249],[0,146,147,18,236,237,100,172,173,108,214,215],[0,146,147,16,226,227,122,190,191,123,192,193],[0,146,147,16,226,227,126,194,195,127,196,197],[0,146,147,18,236,237,126,194,195,123,192,193],[0,146,147,18,236,237,122,190,191,127,196,197],[0,146,147,52,238,239,122,190,191,101,170,171],[0,146,147,61,240,241,126,194,195,101,170,171],[0,146,147,52,238,239,100,172,173,123,192,193],[0,146,147,61,240,241,100,172,173,127,196,197],[0,146,147,16,226,227,100,172,173,101,170,171,1,160,161,52,239,238,122,190,191,123,192,193],[0,146,147,16,226,227,109,216,217,108,214,215,1,160,161,52,239,238,126,194,195,127,196,197],[0,146,147,18,236,237,109,216,217,101,170,171,1,160,161,61,241,240,126,194,195,123,192,193],[0,146,147,18,236,237,100,172,173,108,214,215,1,160,161,61,241,240,122,190,191,127,196,197],[0,16,2,17,158,250,251,252,159,253,254,255],[0,16,2,17,158,250,251,252,159,253,254,255,23,24,13,25,256,257,258,259,260,261,262,263,26,20,27,28,264,265,266,267,268,269,270,271,4,22,5,19,272,273,274,275,276,277,278,279],[0,16,2,17,158,250,251,252,159,253,254,255,29,21,15,30,280,281,282,283,284,285,286,287],[0,20,13,19,158,273,266,259,159,261,278,271],[0,20,13,19,158,273,266,259,159,261,278,271,29,31,32,33,280,288,289,290,284,291,292,293],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299],[0,16,2,17,158,250,251,252,159,253,254,255,53,54,9,42,300,301,302,303,304,305,306,307],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299,23,24,13,25,256,257,258,259,260,261,262,263,64,62,14,39,308,309,310,311,312,313,314,315,26,20,27,28,264,265,266,267,268,269,270,271,65,59,40,38,316,317,318,319,320,321,322,323,4,22,5,19,272,273,274,275,276,277,278,279,11,55,8,41,324,325,326,327,328,329,330,331],[0,16,2,17,158,250,251,252,159,253,254,255,66,67,44,45,332,333,334,335,336,337,338,339,23,24,13,25,256,257,258,259,260,261,262,263,68,69,46,47,340,341,342,343,344,345,346,347,26,20,27,28,264,265,266,267,268,269,270,271,70,71,48,49,348,349,350,351,352,353,354,355,4,22,5,19,272,273,274,275,276,277,278,279,72,73,50,51,356,357,358,359,360,361,362,363],[0,16,2,17,158,250,251,252,159,253,254,255,1,52,6,34,168,294,295,296,169,297,298,299,29,21,15,30,280,281,282,283,284,285,286,287,53,54,9,42,300,301,302,303,304,305,306,307],[0,20,13,19,158,273,266,259,159,261,278,271,1,59,14,41,168,325,318,311,169,313,330,323],[0,20,13,19,158,273,266,259,159,261,278,271,1,59,14,41,168,325,318,311,169,313,330,323,29,31,32,33,280,288,289,290,284,291,292,293,53,63,36,35,300,364,365,366,304,367,368,369],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,23,24,13,25,256,257,258,259,260,261,262,263,382,383,384,385,386,387,388,389,390,391,392,393,26,20,27,28,264,265,266,267,268,269,270,271,394,395,396,397,398,399,400,401,402,403,404,405,4,22,5,19,272,273,274,275,276,277,278,279,138,139,95,94,406,407,408,409,410,411,412,413],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,29,21,15,30,280,281,282,283,284,285,286,287,116,117,83,82,376,377,224,378,379,380,381,225],[0,20,13,19,158,273,266,259,159,261,278,271,450,415,440,429,454,431,420,445,458,447,436,425],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473,29,31,32,33,280,288,289,290,284,291,292,293,450,415,440,429,454,431,420,445,458,447,436,425],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479,23,24,13,25,256,257,258,259,260,261,262,263,480,481,482,483,484,485,486,487,488,489,490,491,26,20,27,28,264,265,266,267,268,269,270,271,492,493,494,495,496,497,498,499,500,501,502,503,4,22,5,19,272,273,274,275,276,277,278,279,125,124,140,141,504,505,506,507,508,509,510,511],[0,16,2,17,158,250,251,252,159,253,254,255,123,122,88,89,204,474,475,476,205,477,478,479,29,21,15,30,280,281,282,283,284,285,286,287,129,128,90,91,212,512,513,514,213,515,516,517],[0,16,2,17,158,250,251,252,159,253,254,255,129,128,90,91,212,512,513,514,213,515,516,517],[0,16,2,17,158,250,251,252,159,253,254,255,129,128,90,91,212,512,513,514,213,515,516,517,23,24,13,25,256,257,258,259,260,261,262,263,518,519,520,521,522,523,524,525,526,527,528,529,26,20,27,28,264,265,266,267,268,269,270,271,530,531,532,533,534,535,536,537,538,539,540,541,4,22,5,19,272,273,274,275,276,277,278,279,127,126,92,93,542,543,544,545,546,547,548,549],[0,20,13,19,158,273,266,259,159,261,278,271,550,551,552,553,554,555,556,557,558,559,560,561,29,31,32,33,280,288,289,290,284,291,292,293,562,563,564,565,566,567,568,569,570,571,572,573],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,53,54,9,42,300,301,302,303,304,305,306,307,128,129,91,90,513,514,212,512,517,516,515,213],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,1,52,6,34,168,294,295,296,169,297,298,299,128,129,91,90,513,514,212,512,517,516,515,213],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,53,54,9,42,300,301,302,303,304,305,306,307,122,123,89,88,475,476,204,474,479,478,477,205],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205,23,24,13,25,256,257,258,259,260,261,262,263,382,383,384,385,386,387,388,389,390,391,392,393,64,62,14,39,308,309,310,311,312,313,314,315,481,480,483,482,486,487,484,485,491,490,489,488,26,20,27,28,264,265,266,267,268,269,270,271,394,395,396,397,398,399,400,401,402,403,404,405,65,59,40,38,316,317,318,319,320,321,322,323,493,492,495,494,498,499,496,497,503,502,501,500,4,22,5,19,272,273,274,275,276,277,278,279,138,139,95,94,406,407,408,409,410,411,412,413,11,55,8,41,324,325,326,327,328,329,330,331,124,125,141,140,506,507,504,505,511,510,509,508],[0,16,2,17,158,250,251,252,159,253,254,255,116,117,83,82,376,377,224,378,379,380,381,225,1,52,6,34,168,294,295,296,169,297,298,299,128,129,91,90,513,514,212,512,517,516,515,213,23,24,13,25,256,257,258,259,260,261,262,263,574,575,576,577,578,579,580,581,582,583,584,585,64,62,14,39,308,309,310,311,312,313,314,315,519,518,521,520,524,525,522,523,529,528,527,526,26,20,27,28,264,265,266,267,268,269,270,271,586,587,588,589,590,591,592,593,594,595,596,597,65,59,40,38,316,317,318,319,320,321,322,323,531,530,533,532,536,537,534,535,541,540,539,538,4,22,5,19,272,273,274,275,276,277,278,279,109,108,79,78,598,599,600,601,602,603,604,605,11,55,8,41,324,325,326,327,328,329,330,331,126,127,93,92,544,545,542,543,549,548,547,546],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,66,69,50,49,332,349,342,359,336,361,354,347,493,123,483,140,498,507,204,485,503,490,509,205,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,68,67,48,51,340,357,334,351,344,353,362,339,124,480,89,494,506,499,484,474,511,478,501,488,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,70,73,46,45,348,333,358,343,352,345,338,363,122,492,141,482,475,487,496,505,479,510,489,500,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461,72,71,44,47,356,341,350,335,360,337,346,355,481,125,495,88,486,476,504,497,491,502,477,508],[0,24,5,28,158,265,258,275,159,277,270,263,414,415,416,417,418,419,420,421,422,423,424,425,606,607,608,609,610,611,612,613,614,615,616,617,531,129,521,92,536,545,212,523,541,528,547,213,23,16,27,19,256,273,251,267,260,269,278,255,426,427,428,429,430,431,432,433,434,435,436,437,618,619,620,621,622,623,624,625,626,627,628,629,126,518,91,532,544,537,522,512,549,516,539,526,26,22,13,17,264,250,274,259,268,261,254,279,438,439,440,441,442,443,444,445,446,447,448,449,630,631,632,633,634,635,636,637,638,639,640,641,128,530,93,520,513,525,534,543,517,548,527,538,4,20,2,25,272,257,266,252,276,253,262,271,450,451,452,453,454,455,456,457,458,459,460,461,642,643,644,645,646,647,648,649,650,651,652,653,519,127,533,90,524,514,542,535,529,540,515,546],[0,16,2,17,158,250,251,252,159,253,254,255,100,101,75,74,370,371,188,372,373,374,375,189,1,52,6,34,168,294,295,296,169,297,298,299,122,123,89,88,475,476,204,474,479,478,477,205,29,21,15,30,280,281,282,283,284,285,286,287,116,117,83,82,376,377,224,378,379,380,381,225,53,54,9,42,300,301,302,303,304,305,306,307,128,129,91,90,513,514,212,512,517,516,515,213],[0,20,13,19,158,273,266,259,159,261,278,271,462,463,464,465,466,467,468,469,470,471,472,473,1,59,14,41,168,325,318,311,169,313,330,323,551,550,553,552,556,557,554,555,561,560,559,558,29,31,32,33,280,288,289,290,284,291,292,293,450,415,440,429,454,431,420,445,458,447,436,425,53,63,36,35,300,364,365,366,304,367,368,369,563,562,565,564,568,569,566,567,573,572,571,570],[0,16],[0,18],[0,16,26,20],[0,2,23,13],[0,3,4,32],[0,2,29,15],[0,3,29,27],[0,52],[0,63],[0,52,26,59],[0,63,26,54],[0,52,16,1],[0,18,1,61],[0,52,16,1,26,59,20,65],[0,31,1,63],[0,1,24,62],[0,15,1,9],[0,5,1,8],[0,31,1,63,26,21,65,54],[0,2,57,56],[0,60,3,16],[0,22,57,3],[0,2,28,20],[0,17,13,24],[0,20,19,13,4,24,17,27],[0,22,57,3,4,16,60,32],[0,22,57,3,23,20,30,12,26,24,33,15,4,16,60,32],[0,22,57,3,29,18,27,25],[0,22,3,57,1,55,10,37],[0,22,385,396,3,57,109,117],[0,22,57,3,159,279,654,655,158,274,656,657,29,18,25,27,284,658,262,269,280,659,257,267]],c={"P 1":0,"P -1":1,"P 1 2 1":2,"P 1 21 1":3,"C 1 2 1":4,"P 1 m 1":5,"P 1 c 1":6,"C 1 m 1":7,"C 1 c 1":8,"P 1 2/m 1":9,"P 1 21/m 1":10,"C 1 2/m 1":11,"P 1 2/c 1":12,"P 1 21/c 1":13,"C 1 2/c 1":14,"P 2 2 2":15,"P 2 2 21":16,"P 21 21 2":17,"P 21 21 21":18,"C 2 2 21":19,"C 2 2 2":20,"F 2 2 2":21,"I 2 2 2":22,"I 21 21 21":23,"P m m 2":24,"P m c 21":25,"P c c 2":26,"P m a 2":27,"P c a 21":28,"P n c 2":29,"P m n 21":30,"P b a 2":31,"P n a 21":32,"P n n 2":33,"C m m 2":34,"C m c 21":35,"C c c 2":36,"A m m 2":37,"A b m 2":38,"A m a 2":39,"A b a 2":40,"F m m 2":41,"F d d 2":42,"I m m 2":43,"I b a 2":44,"I m a 2":45,"P 2/m 2/m 2/m":46,"P m m m":46,"P 2/n 2/n 2/n":47,"P n n n":47,"P 2/c 2/c 2/m":48,"P c c m":48,"P 2/b 2/a 2/n":49,"P b a n":49,"P 21/m 2/m 2/a":50,"P m m a":50,"P 2/n 21/n 2/a":51,"P n n a":51,"P 2/m 2/n 21/a":52,"P m n a":52,"P 21/c 2/c 2/a":53,"P c c a":53,"P 21/b 21/a 2/m":54,"P b a m":54,"P 21/c 21/c 2/n":55,"P c c n":55,"P 2/b 21/c 21/m":56,"P b c m":56,"P 21/n 21/n 2/m":57,"P n n m":57,"P 21/m 21/m 2/n":58,"P m m n":58,"P 21/b 2/c 21/n":59,"P b c n":59,"P 21/b 21/c 21/a":60,"P b c a":60,"P 21/n 21/m 21/a":61,"P n m a":61,"C 2/m 2/c 21/m":62,"C m c m":62,"C 2/m 2/c 21/a":63,"C m c a":63,"C 2/m 2/m 2/m":64,"C m m m":64,"C 2/c 2/c 2/m":65,"C c c m":65,"C 2/m 2/m 2/a":66,"C m m a":66,"C 2/c 2/c 2/a":67,"C c c a":67,"F 2/m 2/m 2/m":68,"F m m m":68,"F 2/d 2/d 2/d":69,"F d d d":69,"I 2/m 2/m 2/m":70,"I m m m":70,"I 2/b 2/a 2/m":71,"I b a m":71,"I 21/b 21/c 21/a":72,"I b c a":72,"I 21/m 21/m 21/a":73,"I m m a":73,"P 4":74,"P 41":75,"P 42":76,"P 43":77,"I 4":78,"I 41":79,"P -4":80,"I -4":81,"P 4/m":82,"P 42/m":83,"P 4/n":84,"P 42/n":85,"I 4/m":86,"I 41/a":87,"P 4 2 2":88,"P 4 21 2":89,"P 41 2 2":90,"P 41 21 2":91,"P 42 2 2":92,"P 42 21 2":93,"P 43 2 2":94,"P 43 21 2":95,"I 4 2 2":96,"I 41 2 2":97,"P 4 m m":98,"P 4 b m":99,"P 42 c m":100,"P 42 n m":101,"P 4 c c":102,"P 4 n c":103,"P 42 m c":104,"P 42 b c":105,"I 4 m m":106,"I 4 c m":107,"I 41 m d":108,"I 41 c d":109,"P -4 2 m":110,"P -4 2 c":111,"P -4 21 m":112,"P -4 21 c":113,"P -4 m 2":114,"P -4 c 2":115,"P -4 b 2":116,"P -4 n 2":117,"I -4 m 2":118,"I -4 c 2":119,"I -4 2 m":120,"I -4 2 d":121,"P 4/m 2/m 2/m":122,"P4/m m m":122,"P 4/m 2/c 2/c":123,"P4/m c c":123,"P 4/n 2/b 2/m":124,"P4/n b m":124,"P 4/n 2/n 2/c":125,"P4/n n c":125,"P 4/m 21/b 2/m":126,"P4/m b m":126,"P 4/m 21/n 2/c":127,"P4/m n c":127,"P 4/n 21/m 2/m":128,"P4/n m m":128,"P 4/n 2/c 2/c":129,"P4/n c c":129,"P 42/m 2/m 2/c":130,"P42/m m c":130,"P 42/m 2/c 2/m":131,"P42/m c m":131,"P 42/n 2/b 2/c":132,"P42/n b c":132,"P 42/n 2/n 2/m":133,"P42/n n m":133,"P 42/m 21/b 2/c":134,"P42/m b c":134,"P 42/m 21/n 2/m":135,"P42/m n m":135,"P 42/n 21/m 2/c":136,"P42/n m c":136,"P 42/n 21/c 2/m":137,"P42/n c m":137,"I 4/m 2/m 2/m":138,"I4/m m m":138,"I 4/m 2/c 2/m":139,"I4/m c m":139,"I 41/a 2/m 2/d":140,"I41/a m d":140,"I 41/a 2/c 2/d":141,"I41/a c d":141,"P 3":142,"P 31":143,"P 32":144,"H 3":145,"R 3":146,"P -3":147,"H -3":148,"R -3":149,"P 3 1 2":150,"P 3 2 1":151,"P 31 1 2":152,"P 31 2 1":153,"P 32 1 2":154,"P 32 2 1":155,"H 3 2":156,"R 3 2":157,"P 3 m 1":158,"P 3 1 m":159,"P 3 c 1":160,"P 3 1 c":161,"H 3 m":162,"R 3 m":163,"H 3 c":164,"R 3 c":165,"P -3 1 2/m":166,"P -3 1 m":166,"P -3 1 2/c":167,"P -3 1 c":167,"P -3 2/m 1":168,"P -3 m 1":168,"P -3 2/c 1":169,"P -3 c 1":169,"H -3 2/m":170,"H -3 m":170,"R -3 2/m":171,"R -3 m":171,"H -3 2/c":172,"H -3 c":172,"R -3 2/c":173,"R -3 c":173,"P 6":174,"P 61":175,"P 65":176,"P 62":177,"P 64":178,"P 63":179,"P -6":180,"P 6/m":181,"P 63/m":182,"P 6 2 2":183,"P 61 2 2":184,"P 65 2 2":185,"P 62 2 2":186,"P 64 2 2":187,"P 63 2 2":188,"P 6 m m":189,"P 6 c c":190,"P 63 c m":191,"P 63 m c":192,"P -6 m 2":193,"P -6 c 2":194,"P -6 2 m":195,"P -6 2 c":196,"P 6/m 2/m 2/m":197,"P 6/m m m":197,"P 6/m 2/c 2/c":198,"P 6/m c c":198,"P 63/m 2/c 2/m":199,"P 63/m c m":199,"P 63/m 2/m 2/c":200,"P 63/m m c":200,"P 2 3":201,"F 2 3":202,"I 2 3":203,"P 21 3":204,"I 21 3":205,"P 2/m -3":206,"P m -3":206,"P 2/n -3":207,"P n -3":207,"F 2/m -3":208,"F m -3":208,"F 2/d -3":209,"F d -3":209,"I 2/m -3":210,"I m -3":210,"P 21/a -3":211,"P a -3":211,"I 21/a -3":212,"I a -3":212,"P 4 3 2":213,"P 42 3 2":214,"F 4 3 2":215,"F 41 3 2":216,"I 4 3 2":217,"P 43 3 2":218,"P 41 3 2":219,"I 41 3 2":220,"P -4 3 m":221,"F -4 3 m":222,"I -4 3 m":223,"P -4 3 n":224,"F -4 3 c":225,"I -4 3 d":226,"P 4/m -3 2/m":227,"P m -3 m":227,"P 4/n -3 2/n":228,"P n -3 n":228,"P 42/m -3 2/n":229,"P m -3 n":229,"P 42/n -3 2/m":230,"P n -3 m":230,"F 4/m -3 2/m":231,"F m -3 m":231,"F 4/m -3 2/c":232,"F m -3 c":232,"F 41/d -3 2/m":233,"F d -3 m":233,"F 41/d -3 2/c":234,"F d -3 c":234,"I 4/m -3 2/m":235,"I m -3 m":235,"I 41/a -3 2/d":236,"I a -3 d":236,"P 1 1 2":237,"P 1 1 21":238,"B 1 1 2":239,"B 2":239,"A 1 2 1":240,"C 1 21 1":241,"I 1 2 1":242,"I 2":242,"I 1 21 1":243,"P 1 1 m":244,"P 1 1 b":245,"B 1 1 m":246,"B 1 1 b":247,"P 1 1 2/m":248,"P 1 1 21/m":249,"B 1 1 2/m":250,"P 1 1 2/b":251,"P 1 1 21/b":252,"P 1 21/n 1":253,"P 1 21/a 1":254,"B 1 1 2/b":255,"P 21 2 2":256,"P 2 21 2":257,"P 21 21 2 (a)":258,"P 21 2 21":259,"P 2 21 21":260,"C 2 2 21a)":261,"C 2 2 2a":262,"F 2 2 2a":263,"I 2 2 2a":264,"P 21/m 21/m 2/n a":265,"P 42 21 2a":266,"I 2 3a":267};function l(e){if(e<146)return e+1;if(146===e)return 1146;if(e<149)return e+1-1;if(149===e)return 1148;if(e<157)return e+1-2;if(157===e)return 1155;if(e<163)return e+1-3;if(163===e)return 1160;if(e<165)return e+1-4;if(165===e)return 1161;if(e<171)return e+1-5;if(171===e)return 1166;if(e<173)return e+1-6;if(173===e)return 1167;if(e<237)return e+1-7;if(237===e)return 1003;if(238===e)return 1004;if(239===e)return 1005;if(240===e)return 2005;if(241===e)return 3005;if(242===e)return 4005;if(243===e)return 5005;if(244===e)return 1006;if(245===e)return 1007;if(246===e)return 1008;if(247===e)return 1009;if(248===e)return 1010;if(249===e)return 1011;if(250===e)return 1012;if(251===e)return 1013;if(252===e)return 1014;if(253===e)return 2014;if(254===e)return 3014;if(255===e)return 1015;if(256===e)return 1017;if(257===e)return 2017;if(258===e)return 1018;if(259===e)return 2018;if(260===e)return 3018;if(261===e)return 1020;if(262===e)return 1021;if(263===e)return 1022;if(264===e)return 1023;if(265===e)return 1059;if(266===e)return 1094;if(267===e)return 1197;throw new Error("unknown spacegroup index '"+e+"'")}var d,f,p,m=function(){for(var e=Object.create(null),t=0,r=Object.keys(c);t<r.length;t++){var n=r[t];e[c[n]]=n}return e}(),h=function(){for(var e=Object.create(null),t=0,r=Object.keys(c);t<r.length;t++){var n=r[t],i=c[n];e[i]=l(i)}return e}();!function(e){function t(t,r,i){var a=function(e){var t="number"==typeof e?function(e){switch(e){case 1146:return 146;case 1148:return 149;case 1155:return 157;case 1160:return 163;case 1161:return 165;case 1166:return 171;case 1167:return 173;case 1003:return 237;case 1004:return 238;case 1005:return 239;case 2005:return 240;case 3005:return 241;case 4005:return 242;case 5005:return 243;case 1006:return 244;case 1007:return 245;case 1008:return 246;case 1009:return 247;case 1010:return 248;case 1011:return 249;case 1012:return 250;case 1013:return 251;case 1014:return 252;case 2014:return 253;case 3014:return 254;case 1015:return 255;case 1017:return 256;case 2017:return 257;case 1018:return 258;case 2018:return 259;case 3018:return 260;case 1020:return 261;case 1021:return 262;case 1022:return 263;case 1023:return 264;case 1059:return 265;case 1094:return 266;case 1197:return 267}var t=0;return e>146&&++t,e>148&&++t,e>155&&++t,e>160&&++t,e>161&&++t,e>166&&++t,e>167&&++t,e-1+t}(e):c[e];return void 0===t||void 0===m[t]?-1:t}(t);if(a<0)return console.warn("Unknown spacegroup '"+t+"', returning a 'P 1' with cellsize [1, 1, 1]"),e.Zero;var o=r[0]*r[1]*r[2],s=i[0],u=i[1],l=i[2],d=r[0],f=r[1],p=r[2],h=Math.cos(u),g=(Math.cos(s)-Math.cos(u)*Math.cos(l))/Math.sin(l),v=Math.sqrt(1-h*h-g*g),b=[d,0,0],y=[Math.cos(l)*f,Math.sin(l)*f,0],_=[h*p,g*p,v*p],S=n.Mat4.ofRows([[b[0],y[0],_[0],0],[0,y[1],_[1],0],[0,0,_[2],0],[0,0,0,1]]);return{index:a,size:r,volume:o,anglesInRadians:i,toFractional:n.Mat4.invert(n.Mat4.zero(),S),fromFractional:S}}e.Zero=t("P 1",n.Vec3.create(1,1,1),n.Vec3.create(Math.PI/2,Math.PI/2,Math.PI/2)),e.isZero=function(e){return!e||0===e.index&&1===e.size[0]&&1===e.size[1]&&1===e.size[1]},e.create=t}(d||(d={})),function(e){function t(e){var t=u[e.index].map((function(e){return r=o[(t=s[e])[0]],i=o[t[1]],a=o[t[2]],n.Mat4.ofRows([r,i,a,[0,0,0,1]]);var t,r,i,a}));return{name:m[e.index],num:h[e.index],cell:e,operators:t}}e.ZeroP1=t(d.Zero),e.create=t;var r=Object(n.Vec3)(),i=Object(n.Mat4)();function c(e,t,a,o,s,u){return n.Vec3.set(r,a,o,s),n.Mat4.fromTranslation(i,r),n.Mat4.mul(u,n.Mat4.mul(u,n.Mat4.mul(u,e.cell.fromFractional,i),e.operators[t]),e.cell.toFractional)}e.setOperatorMatrix=c,e.getSymmetryOperator=function(e,t,r,i,o){var s=c(e,t,r,i,o,n.Mat4.zero());return a.a.create(t+1+"_"+(5+r)+(5+i)+(5+o),s,{hkl:n.Vec3.create(r,i,o),spgrOp:t})};var l=Object(n.Vec3)(),f=Object(n.Vec3)(),p=Object(n.Vec3)(),g=Object(n.Vec3)();function v(e,t,r){var n=[];if(e>0?n.push("+X"):e<0&&n.push("-X"),t>0?n.push("+Y"):t<0&&n.push("-Y"),r>0?n.push("+Z"):r<0&&n.push("-Z"),1===n.length)return"+"===n[0].charAt(0)?n[0].substr(1):n[0];if(2===n.length){var i=n[0].charAt(0),a=n[1].charAt(0);if("+"===i)return""+n[0].substr(1)+n[1];if("+"===a)return""+n[1].substr(1)+n[0]}throw new Error("unknown rotation '"+n+"', "+e+" "+t+" "+r)}function b(e){switch(e){case.5:return"1/2";case 1/4:return"1/4";case 3/4:return"3/4";case 1/3:return"1/3";case 2/3:return"2/3";case 1/6:return"1/6";case 5/6:return"5/6"}return""}function y(e,t){return""===t?e:e.length>2?e+"+"+t:"-"===e.charAt(0)?""+t+e:t+"+"+e}e.getSymmetryOperatorRef=function(e,t,i,o,s,u){var c=n.Mat4.zero();n.Vec3.set(r,i,o,s),n.Vec3.floor(l,u),n.Mat4.copy(c,e.operators[t]),n.Vec3.floor(f,n.Vec3.transformMat4(f,u,c)),n.Mat4.getTranslation(g,c),n.Vec3.sub(g,g,f),n.Vec3.add(g,g,l),n.Vec3.add(g,g,r),n.Mat4.setTranslation(c,g),n.Mat4.mul(c,e.cell.fromFractional,c),n.Mat4.mul(c,c,e.cell.toFractional),n.Vec3.sub(p,f,l);var d=i-p[0],m=o-p[1],h=s-p[2];return a.a.create(t+1+"_"+(5+d)+(5+m)+(5+h),c,{hkl:n.Vec3.create(d,m,h),spgrOp:t})},e.getOperatorXyz=function(e){return[y(v(e[0],e[4],e[8]),b(e[12])),y(v(e[1],e[5],e[9]),b(e[13])),y(v(e[2],e[6],e[10]),b(e[14]))].join(",")}}(f||(f={})),function(e){e.add=function(e,t,r){e.squaredDistances[e.count]=r,e.indices[e.count++]=t},e.reset=function(e){e.count=0},e.create=function(){return{count:0,indices:[],squaredDistances:[]}},e.copy=function(e,t){for(var r=0;r<t.count;++r)e.indices[r]=t.indices[r],e.squaredDistances[r]=t.squaredDistances[r];return e.count=t.count,e}}(p||(p={}));var g=r(254),v=r(6);function b(e,t,r){return new y(e,t,r)}var y=function(){function e(e,t,r){var i=function(e,t,r){var i,a,o=g.a.expand(Object(g.a)(),t.box,n.Vec3.create(.5,.5,.5)),s=e.indices,u=g.a.size(n.Vec3.zero(),o),c=v.OrderedSet.size(s),l="number"==typeof r?r:32,d=Array.isArray(r)&&r;if(d)a=[Math.ceil(u[0]/d[0]),Math.ceil(u[1]/d[1]),Math.ceil(u[2]/d[2])],i=d;else if(c>0){var f=Math.ceil(c/l),p=Math.pow(f/(u[0]*u[1]*u[2]),1/3);a=[Math.ceil(u[0]*p),Math.ceil(u[1]*p),Math.ceil(u[2]*p)],i=[u[0]/a[0],u[1]/a[1],u[2]/a[2]]}else i=u,a=[1,1,1];var m={x:e.x,y:e.y,z:e.z,indices:s,radius:e.radius};return function(e){for(var t=e.expandedBox,r=e.size,n=r[0],i=r[1],a=r[2],o=e.data,s=o.x,u=o.y,c=o.z,l=o.radius,d=o.indices,f=e.elementCount,p=e.delta,m=n*i*a,h=t.min,g=h[0],b=h[1],y=h[2],_=0,S=0,x=new Uint32Array(m),O=new Int32Array(f),w=0;w<f;w++){var C=v.OrderedSet.getAt(d,w),j=Math.floor((s[C]-g)/p[0]),P=Math.floor((u[C]-b)/p[1]),E=Math.floor((c[C]-y)/p[2]),A=(j*i+P)*a+E;1===(x[A]+=1)&&(S+=1),O[w]=A}if(l)for(w=0;w<f;w++){C=v.OrderedSet.getAt(d,w);l[C]>_&&(_=l[C])}for(var D=new Int32Array(S),T=(C=0,0);C<m;C++){var I=x[C];I>0&&(x[C]=T+1,D[T]=I,T+=1)}var M=new Uint32Array(S);for(C=1;C<S;++C)M[C]+=M[C-1]+D[C-1];var k=new Int32Array(S),B=new Int32Array(f);for(C=0;C<f;C++){var V=x[O[C]];if(V>0){var R=V-1;B[M[R]+k[R]]=C,k[R]+=1}}return{size:e.size,bucketArray:B,bucketCounts:D,bucketOffset:M,grid:x,delta:p,min:e.expandedBox.min,data:e.data,maxRadius:_,expandedBox:e.expandedBox,boundingBox:e.boundingBox,boundingSphere:e.boundingSphere}}({size:a,data:m,expandedBox:o,boundingBox:t.box,boundingSphere:t.sphere,elementCount:c,delta:i})}(e,t,r);this.ctx={grid:i,x:.1,y:.1,z:.1,radius:.1,result:p.create(),isCheck:!1},this.boundary={box:i.boundingBox,sphere:i.boundingSphere},this.buckets={offset:i.bucketOffset,count:i.bucketCounts,array:i.bucketArray},this.result=this.ctx.result}return e.prototype.find=function(e,t,r,n){return this.ctx.x=e,this.ctx.y=t,this.ctx.z=r,this.ctx.radius=n,this.ctx.isCheck=!1,_(this.ctx),this.ctx.result},e.prototype.check=function(e,t,r,n){return this.ctx.x=e,this.ctx.y=t,this.ctx.z=r,this.ctx.radius=n,this.ctx.isCheck=!0,_(this.ctx)},e}();function _(e){var t=e.grid,r=t.min,n=t.size,i=n[0],a=n[1],o=n[2],s=t.bucketOffset,u=t.bucketCounts,c=t.bucketArray,l=t.grid,d=t.data,f=d.x,m=d.y,h=d.z,g=d.indices,b=d.radius,y=t.delta,_=t.maxRadius,S=e.radius,x=e.isCheck,O=e.x,w=e.y,C=e.z,j=e.result,P=S+_,E=P*P;p.reset(j);var A=Math.max(0,Math.floor((O-P-r[0])/y[0])),D=Math.max(0,Math.floor((w-P-r[1])/y[1])),T=Math.max(0,Math.floor((C-P-r[2])/y[2])),I=Math.min(i-1,Math.floor((O+P-r[0])/y[0])),M=Math.min(a-1,Math.floor((w+P-r[1])/y[1])),k=Math.min(o-1,Math.floor((C+P-r[2])/y[2]));if(A>I||D>M||T>k)return!1;for(var B=A;B<=I;B++)for(var V=D;V<=M;V++)for(var R=T;R<=k;R++){var L=l[(B*a+V)*o+R];if(0!==L)for(var N=L-1,F=s[N],U=F+u[N],z=F;z<U;z++){var H=v.OrderedSet.getAt(g,c[z]),G=f[H]-O,q=m[H]-w,W=h[H]-C,X=G*G+q*q+W*W;if(X<=E){if(_>0&&Math.sqrt(X)-b[H]>S)continue;if(x)return!0;p.add(j,c[z],X)}}}return j.count>0}var S=r(250);function x(){return x.empty()}!function(e){function t(){return{origin:Object(n.Vec3)(),dirA:Object(n.Vec3)(),dirB:Object(n.Vec3)(),dirC:Object(n.Vec3)()}}function r(e,t){return n.Vec3.copy(e.origin,t.origin),n.Vec3.copy(e.dirA,t.dirA),n.Vec3.copy(e.dirB,t.dirB),n.Vec3.copy(e.dirC,t.dirC),e}function i(e,t){return n.Vec3.set(e,2*n.Vec3.magnitude(t.dirA),2*n.Vec3.magnitude(t.dirB),2*n.Vec3.magnitude(t.dirC))}e.create=function(e,t,r,n){return{origin:e,dirA:t,dirB:r,dirC:n}},e.empty=t,e.copy=r,e.clone=function(e){return r(t(),e)},e.size=i;var a=Object(n.Vec3)();e.volume=function(e){return i(a,e),a[0]*a[1]*a[2]},e.normalize=function(e,t){return n.Vec3.copy(e.origin,t.origin),n.Vec3.normalize(e.dirA,t.dirA),n.Vec3.normalize(e.dirB,t.dirB),n.Vec3.normalize(e.dirC,t.dirC),e};var o=n.Mat3.zero();e.transform=function(e,t,r){n.Vec3.transformMat4(e.origin,t.origin,r);var i=n.Mat3.directionTransform(o,r);return n.Vec3.transformMat3(e.dirA,t.dirA,i),n.Vec3.transformMat3(e.dirB,t.dirB,i),n.Vec3.transformMat3(e.dirC,t.dirC,i),e}}(x||(x={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"MolScriptBuilder",(function(){return n}));var n,i=r(14);!function(e){e.core=i.a.core,e.struct=i.a.structureQuery,e.internal=i.a.internal,e.atomName=function(t){return e.struct.type.atomName([t])},e.es=function(t){return e.struct.type.elementSymbol([t])},e.list=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.core.type.list(t)},e.set=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return e.core.type.set(t)},e.re=function(t,r){return e.core.type.regex([t,r])},e.fn=function(t){return e.core.ctrl.fn([t])},e.evaluate=function(t){return e.core.ctrl.eval([t])};var t=e.struct.atomProperty.core,r=e.struct.atomProperty.macromolecular,n=e.struct.atomProperty.topology;function a(e){return t[e]()}function o(e){return n[e]()}function s(e){return r[e]()}e.acp=a,e.atp=o,e.ammp=s;var u=e.struct.atomSet.propertySet;e.acpSet=function(e){return u([a(e)])},e.atpSet=function(e){return u([o(e)])},e.ammpSet=function(e){return u([s(e)])}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"m",(function(){return i})),r.d(t,"l",(function(){return a})),r.d(t,"a",(function(){return o})),r.d(t,"j",(function(){return s})),r.d(t,"i",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"c",(function(){return l})),r.d(t,"k",(function(){return d})),r.d(t,"f",(function(){return f})),r.d(t,"e",(function(){return p})),r.d(t,"g",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"b",(function(){return S}));var n=r(0);function i(e,t){var r={},n={},i={},a={},o={};return Object.keys(e).forEach((function(s){var u=e[s];"attribute"===u.type&&(r[s]=t[s]),"define"===u.type&&(n[s]=t[s]),"texture"===u.type&&void 0!==t[s]&&(i[s]=t[s]),"uniform"===u.type&&void 0!==t[s]&&(u.isMaterial?o[s]=t[s]:a[s]=t[s])})),{attributeValues:r,defineValues:n,textureValues:i,uniformValues:a,materialUniformValues:o}}function a(e){var t={};return Object.keys(e).forEach((function(r){t[r]=e[r].ref.version})),t}function o(e,t,r){return{type:"attribute",kind:e,itemSize:t,divisor:r}}function s(e,t){return void 0===t&&(t=!1),{type:"uniform",kind:e,isMaterial:t}}function u(e,t,r,n){return{type:"texture",kind:e,format:t,dataType:r,filter:n}}function c(e){return{type:"elements",kind:e}}function l(e,t){return{type:"define",kind:e,options:t}}function d(e){return{type:"value",kind:e}}var f={uModel:s("m4"),uView:s("m4"),uInvView:s("m4"),uModelView:s("m4"),uInvModelView:s("m4"),uProjection:s("m4"),uInvProjection:s("m4"),uModelViewProjection:s("m4"),uInvModelViewProjection:s("m4"),uIsOrtho:s("f"),uPixelRatio:s("f"),uViewportHeight:s("f"),uViewport:s("v4"),uViewOffset:s("v2"),uDrawingBufferSize:s("v2"),uCameraPosition:s("v3"),uCameraDir:s("v3"),uNear:s("f"),uFar:s("f"),uFogNear:s("f"),uFogFar:s("f"),uFogColor:s("v3"),uTransparentBackground:s("b"),uClipObjectType:s("i[]"),uClipObjectInvert:s("b[]"),uClipObjectPosition:s("v3[]"),uClipObjectRotation:s("v4[]"),uClipObjectScale:s("v3[]"),uLightIntensity:s("f"),uAmbientIntensity:s("f"),uMetalness:s("f"),uRoughness:s("f"),uReflectivity:s("f"),uPickingAlphaThreshold:s("f"),uInteriorDarkening:s("f"),uInteriorColorFlag:s("b"),uInteriorColor:s("v3"),uHighlightColor:s("v3"),uSelectColor:s("v3"),uXrayEdgeFalloff:s("f"),uRenderWboit:s("b")},p={tDepth:u("texture","depth","ushort","nearest")},m={uObjectId:s("i")},h={uColor:s("v3",!0),uColorTexDim:s("v2"),tColor:u("image-uint8","rgb","ubyte","nearest"),dColorType:l("string",["uniform","attribute","instance","group","groupInstance","vertex","vertexInstance"])},g={uSize:s("f",!0),uSizeTexDim:s("v2"),tSize:u("image-uint8","rgb","ubyte","nearest"),dSizeType:l("string",["uniform","attribute","instance","group","groupInstance"]),uSizeFactor:s("f")},v={uMarkerTexDim:s("v2"),tMarker:u("image-uint8","alpha","ubyte","nearest")},b={uOverpaintTexDim:s("v2"),tOverpaint:u("image-uint8","rgba","ubyte","nearest"),dOverpaint:l("boolean")},y={uTransparencyTexDim:s("v2"),tTransparency:u("image-uint8","alpha","ubyte","nearest"),dTransparency:l("boolean"),transparencyAverage:d("number")},_={dClipObjectCount:l("number"),dClipVariant:l("string",["instance","pixel"]),uClippingTexDim:s("v2"),tClipping:u("image-uint8","alpha","ubyte","nearest"),dClipping:l("boolean")},S=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},h),v),b),y),_),{aInstance:o("float32",1,1),aTransform:o("float32",16,1),uAlpha:s("f",!0),uVertexCount:s("i"),uInstanceCount:s("i"),uGroupCount:s("i"),uInvariantBoundingSphere:s("v4"),drawCount:d("number"),instanceCount:d("number"),alpha:d("number"),matrix:d("m4"),transform:d("float32"),extraTransform:d("float32"),hasReflection:d("boolean"),boundingSphere:d("sphere"),invariantBoundingSphere:d("sphere")})},function(e,t,r){"use strict";var n;r.d(t,"a",(function(){return n})),r.d(t,"o",(function(){return o})),r.d(t,"b",(function(){return u})),r.d(t,"h",(function(){return c})),r.d(t,"i",(function(){return l})),r.d(t,"j",(function(){return d})),r.d(t,"k",(function(){return f})),r.d(t,"m",(function(){return p})),r.d(t,"f",(function(){return m})),r.d(t,"l",(function(){return h})),r.d(t,"e",(function(){return i.a})),r.d(t,"q",(function(){return i.c})),r.d(t,"p",(function(){return i.b})),r.d(t,"c",(function(){return g.a})),r.d(t,"n",(function(){return g.d})),r.d(t,"g",(function(){return g.c})),r.d(t,"d",(function(){return g.b})),function(e){function t(e){var t=e.growBy*e.elementSize;e.currentSize=t,e.currentIndex=0,e.currentChunk=new e.ctor(t),e.allocatedSize+=t,e.chunks[e.chunks.length]=e.currentChunk}function r(e,t){var r=e.ctor,n=e.chunks,i=e.currentIndex;if(!n.length)return new r(0);if(1===n.length&&(t||i===e.allocatedSize))return n[0];for(var a=0,o=0,s=n.length-1;o<s;o++)a+=n[o].length;var u=new r(a+=e.currentIndex),c=0;if(u.buffer)for(o=0,s=n.length-1;o<s;o++)u.set(n[o],c),c+=n[o].length;else for(o=0,s=n.length-1;o<s;o++){for(var l=n[o],d=0,f=l.length;d<f;d++)u[c+d]=l[d];c+=l.length}var p=n[n.length-1];if(u.buffer&&i>=e.currentSize)u.set(p,c);else for(d=0,f=p.length;d<f;d++)u[c+d]=p[d];return u}e.is=function(e){return e.creator&&e.chunkSize},e.add4=function(e,r,n,i,a){e.currentIndex>=e.currentSize&&t(e);var o=e.currentChunk,s=e.currentIndex;return o[s]=r,o[s+1]=n,o[s+2]=i,o[s+3]=a,e.currentIndex+=4,e.elementCount++},e.add3=function(e,r,n,i){e.currentIndex>=e.currentSize&&t(e);var a=e.currentChunk,o=e.currentIndex;return a[o]=r,a[o+1]=n,a[o+2]=i,e.currentIndex+=3,e.elementCount++},e.add2=function(e,r,n){e.currentIndex>=e.currentSize&&t(e);var i=e.currentChunk,a=e.currentIndex;return i[a]=r,i[a+1]=n,e.currentIndex+=2,e.elementCount++},e.add=function(e,r){return e.currentIndex>=e.currentSize&&t(e),e.currentChunk[e.currentIndex]=r,e.currentIndex+=1,e.elementCount++},e.addRepeat=function(e,r,n){for(var i=0;i<r;i++)e.currentIndex>=e.currentSize&&t(e),e.currentChunk[e.currentIndex++]=n,e.elementCount++;return e.elementCount},e.addMany=function(e,r){for(var n=e.elementSize,i=0,a=r.length;i<a;i+=n){e.currentIndex>=e.currentSize&&t(e);for(var o=e.currentChunk,s=0;s<n;s++)o[e.currentIndex++]=r[i+s];e.elementCount++}return e.elementCount},e.compact=function(e,t){return void 0===t&&(t=!1),r(e,t)},e._compact=r,e.create=function(e,t,r,n){var i={ctor:e,elementSize:t,growBy:Math.max(1,Math.ceil(r)),allocatedSize:0,elementCount:0,currentSize:0,currentChunk:void 0,currentIndex:0,chunks:[]};if(void 0===n)return i;if("number"==typeof n)return i.currentChunk=new e(n*t),i.allocatedSize=n*t,i.currentSize=i.currentChunk.length,i.chunks[0]=i.currentChunk,i;var a=n;if(a.length%t!=0)throw new Error("initialChunk length must be a multiple of the element size.");return i.currentChunk=a,i.allocatedSize=a.length,i.currentSize=a.length,i.chunks[0]=a,i}}(n||(n={}));var i=r(280);function a(e,t,r){return e[t].key<e[r].key?-1:1}function o(e,t,r){var n=r&&r.start||0,o=r&&r.end||e.length;if(o-n<=0)throw new Error("Can only bucket non-empty collections.");return function(e,t,r,n,o){for(var s=new Map,u=[],c=t(e[0]),l=!0,d=n;d<o;d++){var f=t(e[d]);if(s.has(f))s.get(f).count++,c!==f&&(l=!1);else{var p={key:f,count:1,offset:d};s.set(f,p),u[u.length]=p}c=f}var m=new Int32Array(u.length+1);m[u.length]=o;var h=!0;if(r){d=1;for(var g=u.length;d<g;d++)if(u[d-1].key>u[d].key){h=!1;break}}if(l&&h){for(d=0;d<u.length;d++)m[d]=u[d].offset;return m}r&&!h&&Object(i.b)(u,0,u.length,a,i.a);var v=0;for(d=0;d<u.length;d++){var b=u[d];b.offset=v,v+=b.count}var y=new Int32Array(o-n);for(d=n;d<o;d++){f=t(e[d]);y[(p=s.get(f)).offset++]=e[d]}for(d=0,g=y.length;d<g;d++)e[d+n]=y[d];for(m[0]=n,d=1;d<u.length;d++)m[d]=u[d-1].offset+n;return m}(e,t,!(!r||!r.sort),n,o)}var s=function(){function e(e,t){this.getHash=e,this.areEqual=t,this.id=0,this.byHash=new Map,this.groups=[]}return e.prototype.createGroup=function(e,t){var r=this.id++,n=[e];return this.groups[r]=n,{id:r,keys:n,value:t}},e.prototype.add=function(e,t){var r=this.getHash(t);if(this.byHash.has(r)){for(var n=this.byHash.get(r),i=0,a=n.length;i<a;i++){var o=n[i];if(this.areEqual(t,o.value))return o.keys[o.keys.length]=e,o.value}var s=this.createGroup(e,t);return n[n.length]=s,s.value}s=this.createGroup(e,t);return this.byHash.set(r,[s]),s.value},e}();function u(e,t){return new s(e,t)}function c(e){var t=e^e>>4;return t=(3735928559^t)+(t<<5),t^=t>>11}function l(e,t){var r=23;return r=31*(r=31*r+e|0)+t|0,r=(3735928559^(r^=r>>4))+(r<<5),r^=r>>11}function d(e,t,r){var n=23;return n=31*(n=31*(n=31*n+e|0)+t|0)+r|0,n=(3735928559^(n^=n>>4))+(n<<5),n^=n>>11}function f(e,t,r,n){var i=23;return i=31*(i=31*(i=31*(i=31*i+e|0)+t|0)+r|0)+n|0,i=(3735928559^(i^=i>>4))+(i<<5),i^=i>>11}function p(e){for(var t=0,r=0,n=e.length;r<n;r++)t=(t<<5)-t+e.charCodeAt(r++)|0;return t}function m(e,t){return(e+t)*(e+t+1)/2+t}function h(e){for(var t=2166136261,r=0,n=e.length;r<n;++r)t^=e[r],t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}r(7),function(){function e(e){this.getKey=e,this.map=new Map,this.keys=[],this.groups=[]}e.prototype.add=function(e){var t=this.getKey(e);if(this.map.has(t)){(r=this.map.get(t))[r.length]=e}else{var r=[e];this.map.set(t,r),this.keys[this.keys.length]=t,this.groups[this.groups.length]=r}},e.prototype.getGrouping=function(){return{keys:this.keys,groups:this.groups,map:this.map}}}();var g=r(348)},function(e,t,r){"use strict";r.r(t),r.d(t,"StateObject",(function(){return n})),r.d(t,"StateObjectCell",(function(){return i})),r.d(t,"StateObjectTracker",(function(){return s})),r.d(t,"StateObjectSelector",(function(){return u})),r.d(t,"StateObjectRef",(function(){return o})),r.d(t,"StateTree",(function(){return c})),r.d(t,"TransientTree",(function(){return m})),r.d(t,"State",(function(){return V})),r.d(t,"StateBuilder",(function(){return x})),r.d(t,"StateSelection",(function(){return b})),r.d(t,"StateTransformer",(function(){return _.a})),r.d(t,"StateTransform",(function(){return d.a})),r.d(t,"StateAction",(function(){return ie.a}));var n,i,a=r(5);!function(e){function t(e){var t;return(t=function(){function t(t,r){this.data=t,this.id=a.c.create22(),this.type=e,this.label=r&&r.label||e.name,this.description=r&&r.description}return t.is=function(t){return!!t&&e===t.type},t}()).type=e,t}e.factory=function(){return function(e){return t(e)}},e.create=t,e.hasTag=function(e,t){if(!e.tags)return!1;for(var r=0,n=e.tags;r<n.length;r++){if(n[r]===t)return!0}return!1},e.Null={id:a.c.create22(),type:{name:"Null",typeClass:"Null"},data:void 0,label:"Null"}}(n||(n={})),function(e){e.is=function(e){var t=e;return!!(t&&t.transform&&t.parent&&t.status)},e.resolve=function(t,r){var n="string"==typeof r?r:e.is(r)?r.transform.ref:r.ref;return t.cells.get(n)}}(i||(i={}));var o,s=function(){function e(e){this.state=e,this.version=""}return e.prototype.setQuery=function(e){this.query=b.compile(e)},e.prototype.update=function(){var e=this.state.select(this.query)[0],t=e?e.transform.version:void 0,r=this.cell!==e||this.version!==t;return this.cell=e,this.version=t||"",this.data=e&&e.obj?e.obj.data:void 0,r},e}(),u=function(){function e(e,t){this.ref=e,this.state=t}return Object.defineProperty(e.prototype,"cell",{get:function(){var e;return null===(e=this.state)||void 0===e?void 0:e.cells.get(this.ref)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"obj",{get:function(){var e,t;return null===(t=null===(e=this.state)||void 0===e?void 0:e.cells.get(this.ref))||void 0===t?void 0:t.obj},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){var e;return null===(e=this.obj)||void 0===e?void 0:e.data},enumerable:!1,configurable:!0}),e.prototype.update=function(e,t){if(!this.state)throw new Error("To use update() from StateObjectSelector, 'state' must be defined.");return t||(t=this.state.build()),(t||this.state.build()).to(this).update(e),t},e.prototype.checkValid=function(){if(!this.state)throw new Error("Unassigned State.");var e=this.cell;if(!e)throw new Error("Not created at all. Did you await/then the corresponding state update?");if("ok"===e.status)return!0;if("error"===e.status)throw new Error(e.errorText);if(e.obj===n.Null)throw new Error("The object is Null.");throw new Error("Unresolved. Did you await/then the corresponding state update?")},Object.defineProperty(e.prototype,"isOk",{get:function(){var e=this.cell;return e&&"ok"===e.status&&e.obj!==n.Null},enumerable:!1,configurable:!0}),e}();!function(e){function t(e,t){if(t)return i.is(t)?t:"string"==typeof t?e.cells.get(t):t.cell}e.resolveRef=function(e){var t;if(e)return"string"==typeof e?e:i.is(e)?e.transform.ref:null===(t=e.cell)||void 0===t?void 0:t.transform.ref},e.resolve=t,e.resolveAndCheck=function(e,r){var n=t(e,r);if(n&&n.obj&&"ok"===n.status)return n}}(o||(o={}));var c,l=r(102),d=r(84),f=r(87),p=r(29),m=function(){function e(e){this.tree=e,this.transforms=this.tree.transforms,this.children=this.tree.children,this.dependencies=this.tree.dependencies,this.changedNodes=!1,this.changedChildren=!1,this.changedDependencies=!1,this._childMutations=void 0,this._dependencyMutations=void 0,this._stateUpdates=void 0}return Object.defineProperty(e.prototype,"childMutations",{get:function(){return this._childMutations||(this._childMutations=new Map),this._childMutations},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dependencyMutations",{get:function(){return this._dependencyMutations||(this._dependencyMutations=new Map),this._dependencyMutations},enumerable:!1,configurable:!0}),e.prototype.changeNodes=function(){this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable())},e.prototype.changeChildren=function(){this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable())},e.prototype.changeDependencies=function(){this.changedDependencies||(this.changedDependencies=!0,this.dependencies=this.dependencies.asMutable())},Object.defineProperty(e.prototype,"root",{get:function(){return this.transforms.get(d.a.RootRef)},enumerable:!1,configurable:!0}),e.prototype.asTransient=function(){return this.asImmutable().asTransient()},e.prototype.addChild=function(e,t){if(this.changeChildren(),this.childMutations.has(e))this.childMutations.get(e).add(t);else{var r=this.children.get(e).asMutable();r.add(t),this.children.set(e,r),this.childMutations.set(e,r)}},e.prototype.removeChild=function(e,t){if(this.changeChildren(),this.childMutations.has(e))this.childMutations.get(e).remove(t);else{var r=this.children.get(e).asMutable();r.remove(t),this.children.set(e,r),this.childMutations.set(e,r)}},e.prototype.clearRoot=function(){var e=d.a.RootRef;if(0!==this.children.get(e).size){this.changeChildren();var t=Object(l.OrderedSet)();this.children.set(e,t),this.childMutations.set(e,t)}},e.prototype.mutateDependency=function(e,t,r){var n=this.dependencyMutations.get(e);if(!n){var i=this.dependencies.get(e);if(!i&&"remove"===r)return;this.changeDependencies(),n=i?i.asMutable():Object(l.OrderedSet)().asMutable(),this.dependencyMutations.set(e,n),this.dependencies.set(e,n)}"add"===r?n.add(t):n.remove(t)},e.prototype.changeParent=function(e,t){v(this.transforms,e);var r=this.transforms.get(e);this.removeChild(r.parent,e),this.addChild(t,e),this.changeNodes(),this.transforms.set(e,d.a.withParent(r,t))},e.prototype.add=function(e){var t=e.ref;this.transforms.has(e.ref)&&(this.transforms.get(e.ref).parent!==e.parent&&function(e){throw new Error("Transform '"+e+"' is already present in the tree.")}(e.ref));var r=this.children.get(e.parent);if(r||function(e){throw new Error("Parent '"+e+"' must be present in the tree.")}(e.parent),r.has(e.ref)||this.addChild(e.parent,e.ref),this.children.has(e.ref)||(this.changedChildren||(this.changedChildren=!0,this.children=this.children.asMutable()),this.children.set(e.ref,Object(l.OrderedSet)())),this.changeNodes(),this.transforms.set(t,e),e.dependsOn)for(var n=0,i=e.dependsOn;n<i.length;n++){var a=i[n];this.mutateDependency(a,t,"add")}return this},e.prototype.setParams=function(e,t){v(this.transforms,e);var r=this.transforms.get(e);return!Object(f.d)(r.params,t)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,d.a.withParams(r,t)),!0)},e.prototype.setTags=function(e,t){v(this.transforms,e);var r=this.transforms.get(e),n=d.a.withParams(r,t);return!Object(p.arrayEqual)(r.tags,n.tags)&&(this.changedNodes||(this.changedNodes=!0,this.transforms=this.transforms.asMutable()),this.transforms.set(r.ref,n),!0)},e.prototype.assignState=function(e,t){v(this.transforms,e);var r=this.transforms.get(e);if(this._stateUpdates&&this._stateUpdates.has(e))return d.a.assignState(r.state,t),r;this._stateUpdates||(this._stateUpdates=new Set),this._stateUpdates.add(r.ref),this.changeNodes();var n=d.a.withState(r,t);return this.transforms.set(e,n),n},e.prototype.remove=function(e){var t=this.transforms.get(e);if(!t)return[];var r=c.subtreePostOrder(this,t);if(e===d.a.RootRef){if(r.pop(),0===r.length)return r;this.clearRoot()}else{if(0===r.length)return r;this.removeChild(t.parent,t.ref)}this.changeNodes(),this.changeChildren();for(var n=0,i=r;n<i.length;n++){var a=i[n];this.transforms.delete(a.ref),this.children.delete(a.ref),this._childMutations&&this._childMutations.delete(a.ref)}for(var o=[],s=0,u=r;s<u.length;s++){if((a=u[s]).dependsOn)for(var l=0,f=a.dependsOn;l<f.length;l++){var p=f[l];this.transforms.has(p)&&this.mutateDependency(p,a.ref,"remove")}if(this.dependencies.has(a.ref)){var m=this.dependencies.get(a.ref).toArray();this.changeDependencies(),this.dependencies.delete(a.ref),this._dependencyMutations&&this._dependencyMutations.delete(a.ref);for(var h=0,g=m;h<g.length;h++){var v=g[h];if(this.transforms.has(v))for(var b=0,y=this.remove(v);b<y.length;b++){var _=y[b];o[o.length]=_}}}}for(var S=0,x=o;S<x.length;S++){v=x[S];r[r.length]=v}return r},e.prototype.asImmutable=function(){return this.changedNodes||this.changedChildren||this._childMutations?(this._childMutations&&this._childMutations.forEach(h,this.children),this._dependencyMutations&&this._dependencyMutations.forEach(g,this.dependencies),c.create(this.changedNodes?this.transforms.asImmutable():this.transforms,this.changedChildren?this.children.asImmutable():this.children,this.changedDependencies?this.dependencies.asImmutable():this.dependencies)):this.tree},e}();function h(e,t){this.set(t,e.asImmutable())}function g(e,t){0===e.size?this.delete(t):this.set(t,e.asImmutable())}function v(e,t){if(!e.has(t))throw new Error("Node '"+t+"' is not present in the tree.")}!function(e){var t=function(){function e(e,t,r){this.transforms=e,this.children=t,this.dependencies=r}return Object.defineProperty(e.prototype,"root",{get:function(){return this.transforms.get(d.a.RootRef)},enumerable:!1,configurable:!0}),e.prototype.asTransient=function(){return new m(this)},e}();function r(e,r,n){return new t(e,r,n)}function n(e){i(this,this.tree.transforms.get(e))}function i(e,t){var r=e.tree.children.get(t.ref);r&&r.size&&r.forEach(n,e),e.f(t,e.tree,e.state)}function a(e,t,r,n){var a={tree:e,state:r,f:n};return i(a,t),a.state}function o(e){s(this,this.tree.transforms.get(e))}function s(e,t){var r=e.f(t,e.tree,e.state);if("boolean"!=typeof r||r){var n=e.tree.children.get(t.ref);n&&n.size&&n.forEach(o,e)}}function u(e,t,r,n){var i={tree:e,state:r,f:n};return s(i,t),i.state}function c(e,t,r){r.push(e)}function f(e,t,r){r.push(d.a.toJSON(e))}e.createEmpty=function(e){var t=e||d.a.createRoot();return r(Object(l.Map)([[t.ref,t]]),Object(l.Map)([[t.ref,Object(l.OrderedSet)()]]),Object(l.Map)())},e.create=r,e.doPostOrder=a,e.doPreOrder=u,e.subtreePostOrder=function(e,t){return a(e,t,[],c)},e.toJSON=function(e){var t=[];return u(e,e.root,t,f),{transforms:t}},e.fromJSON=function(e){for(var t=Object(l.Map)().asMutable(),n=Object(l.Map)().asMutable(),i=Object(l.Map)().asMutable(),a=0,o=e.transforms;a<o.length;a++){var s=o[a],u=d.a.fromJSON(s);t.set(u.ref,u),n.has(u.ref)||n.set(u.ref,Object(l.OrderedSet)().asMutable()),u.ref!==u.parent&&n.get(u.parent).add(u.ref)}for(var c=new Set,f=0,p=e.transforms;f<p.length;f++){var m=(s=p[f]).ref;if(n.set(m,n.get(m).asImmutable()),s.dependsOn)for(var h=0,g=s.dependsOn;h<g.length;h++){var v=g[h];c.add(v),i.has(v)?i.get(v).add(m):i.set(v,Object(l.OrderedSet)([m]).asMutable())}}return c.forEach((function(e){i.set(e,i.get(e).asImmutable())})),r(t.asImmutable(),n.asImmutable(),i.asImmutable())},e.dump=function(e){console.log({tr:e.transforms.keySeq().toArray(),tr1:e.transforms.valueSeq().toArray().map((function(e){return e.ref})),ch:e.children.keySeq().toArray()})},e.subtreeHasRef=function(e,t,r){return!(!e.transforms.has(t)||!e.transforms.has(r))&&function e(t,r,n){if(r===n)return!0;for(var i=t.children.get(r).values();;){var a=i.next();if(a.done)return!1;if(e(t,a.value,n))return!0}}(e,t,r)},e.getDecoratorRoot=function e(t,r){var n=t.children.get(r);if(1!==n.size)return r;var i=t.transforms.get(n.first());return i.transformer.definition.isDecorator?e(t,i.ref):r}}(c||(c={}));var b,y=r(0),_=r(197),S=r(17);!function(e){function t(e,t){return r(e)(t)}function r(e){var t=e||n.root;return void 0!==t.compile?t.compile():function(e){return void 0!==e.transform&&void 0!==e.status}(t)?n.byValue(t).compile():function(e){return"function"==typeof e}(t)?t:n.byRef(t).compile()}e.select=t,e.compile=r;var n,i={select:function(e){return t(this,e||this.state)}};function a(e,t){i[e]=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.call.apply(t,Object(y.__spreadArrays)([void 0,this],e))}}function o(e){return Object.create(i,{compile:{writable:!1,configurable:!1,value:e}})}function s(e,t){var n=r(e);return o((function(){return function(e){for(var r=[],i=0,a=n(e);i<a.length;i++)for(var o=a[i],s=0,u=t(o,e);s<u.length;s++){var c=u[s];r.push(c)}return r}}))}function u(e,t){var n=r(e);return o((function(){return function(e){for(var r=[],i=0,a=n(e);i<a.length;i++){var o=a[i],s=t(o,e);s&&r.push(s)}return r}}))}function l(e){var t=r(e);return o((function(){return function(e){for(var r=new Set,n=[],i=0,a=t(e);i<a.length;i++){var o=a[i];o&&(r.has(o.transform.ref)||(r.add(o.transform.ref),n.push(o)))}return n}}))}function f(e){var t=r(e);return o((function(){return function(e){var r=t(e);return r.length?[r[0]]:[]}}))}function p(e,t){return s(e,(function(e){return t(e)?[e]:[]}))}function m(e,t){return p(e,(function(e){return e.status===t}))}function h(e,t){return p(e,(function(e){return!!e.transform.tags&&e.transform.tags.indexOf(t)>=0}))}function g(e){return s(e,(function(e,t){var r=[];return c.doPreOrder(t.tree,t.tree.transforms.get(e.transform.ref),r,(function(e,t,r){r.push(e.ref)})),r.map((function(e){return t.cells.get(e)}))}))}function v(e){return s(e,(function(e,t){var r=[];return t.tree.children.get(e.transform.ref).forEach((function(e){return r.push(t.cells.get(e))})),r}))}function b(e,t){return p(e,(function(e){return!!e.obj&&e.obj.type===t.type}))}function _(e,t){return l(u(e,(function(e,r){return E(r.tree,r.cells,e.transform.ref,t)})))}function S(e,t){return l(u(e,(function(e,r){return T(r.tree,r.cells,e.transform.ref,t)})))}function x(e,t){return l(u(e,(function(e,r){return D(r.tree,r.cells,e.transform.ref,t)})))}function O(e,t){return p(e,(function(e){return e.transform.transformer===t}))}function w(e,t){return l(u(e,(function(e,r){return A(r.tree,r.cells,e.transform.ref,t)})))}function C(e,t){return l(u(e,(function(e,r){return I(r.tree,r.cells,e.transform.ref,t)})))}function j(e){return l(u(e,(function(e,t){return t.cells.get(t.tree.transforms.get(e.transform.ref).parent)})))}function P(e,t,r,n,i){for(var a=e.transforms.get(r),o=void 0;;){a=e.transforms.get(a.parent);var s=t.get(a.ref);if(s.obj&&n(s)&&(o=s,i))return o;if(a.ref===d.a.RootRef)return o}}function E(e,t,r,n){return P(e,t,r,n,!0)}function A(e,t,r,n){return P(e,t,r,n,!1)}function D(e,t,r,n){return E(e,t,r,Array.isArray(n)?function(e){return n.indexOf(e.transform.transformer)>=0}:function(e){return e.transform.transformer===n})}function T(e,t,r,n){return E(e,t,r,M(n))}function I(e,t,r,n){return A(e,t,r,M(n))}function M(e){return Array.isArray(e)?function(t){for(var r=0,n=e;r<n.length;r++){if(n[r].type===t.obj.type)return!0}}:function(t){return t.obj.type===e.type}}function k(e,t,r){if(e.tags)for(var n=0,i=e.tags;n<i.length;n++){var a=i[n];if(r.tags.has(a)){r.refs[a]=e.ref;break}}return!0}function B(e,t,r){return!(e.tags&&e.tags.indexOf(r.tag)>=0)||(r.ref=e.ref,!1)}function V(e,t,r){if(e.tags)for(var n=r.tags.size,i=0,a=0,o=e.tags;a<o.length;a++){var s=o[a];if(r.tags.has(s)&&++i===n){r.refs.push(e);break}}else 0===r.tags.size&&r.refs.push(e)}!function(e){function t(e,t,r){var n=r.cells.get(e.ref);return!n||!n.obj||n.obj.type!==r.type||(r.roots.push(n),!1)}function r(e,t,r){var n=r.cells.get(e.ref);return n&&n.obj&&n.obj.type===r.type&&r.ret.push(n),!0}function n(e,t,r){var n=r.cells.get(e.ref);return n&&n.obj&&n.transform.transformer===r.t&&r.ret.push(n),!0}function i(e,t,r){var n=r.cells.get(e.ref);return n&&"error"===n.status&&n.transform.transformer===r.t&&r.ret.push(n),!0}e.root=o((function(){return function(e){return[e.cells.get(e.tree.root.ref)]}})),e.byRef=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o((function(){return function(t){for(var r=[],n=0,i=e;n<i.length;n++){var a=i[n],o=t.cells.get(a);o&&r.push(o)}return r}}))},e.byValue=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o((function(){return function(t){return e}}))},e.rootsOfType=function(e,r){return void 0===r&&(r=d.a.RootRef),o((function(){return function(n){var i={roots:[],cells:n.cells,type:e.type};return c.doPreOrder(n.tree,n.tree.transforms.get(r),i,t),i.roots}}))},e.ofType=function(e,t){return void 0===t&&(t=d.a.RootRef),o((function(){return function(n){var i={ret:[],cells:n.cells,type:e.type};return c.doPreOrder(n.tree,n.tree.transforms.get(t),i,r),i.ret}}))},e.ofTransformer=function(e,t){return void 0===t&&(t=d.a.RootRef),o((function(){return function(r){var i={ret:[],cells:r.cells,t:e};return c.doPreOrder(r.tree,r.tree.transforms.get(t),i,n),i.ret}}))},e.ofTransformerWithError=function(e,t){return void 0===t&&(t=d.a.RootRef),o((function(){return function(r){var n={ret:[],cells:r.cells,t:e};return c.doPreOrder(r.tree,r.tree.transforms.get(t),n,i),n.ret}}))}}(n=e.Generators||(e.Generators={})),a("flatMap",s),e.flatMap=s,a("mapObject",u),e.mapObject=u,a("unique",l),e.unique=l,a("first",f),e.first=f,a("filter",p),e.filter=p,a("withStatus",m),e.withStatus=m,a("withTag",h),e.withTag=h,a("subtree",g),e.subtree=g,a("children",v),e.children=v,a("ofType",b),e.ofType=b,a("ancestor",_),e.ancestor=_,a("ancestorOfType",S),e.ancestorOfType=S,a("ancestorWithTransformer",x),e.ancestorWithTransformer=x,a("withTransformer",O),e.withTransformer=O,a("root",w),e.root=w,a("rootOfType",C),e.rootOfType=C,a("parent",j),e.parent=j,e.findAncestor=E,e.findRoot=A,e.findAncestorWithTransformer=D,e.findAncestorOfType=T,e.findRootOfType=I,e.findUniqueTagsInSubtree=function(e,t,r){return c.doPreOrder(e,e.transforms.get(t),{refs:{},tags:r},k).refs},e.findTagInSubtree=function(e,t,r){return c.doPreOrder(e,e.transforms.get(t),{ref:void 0,tag:r},B).ref},e.findWithAllTags=function(e,t,r){return c.doPreOrder(e,e.transforms.get(t),{refs:[],tags:r},V).refs},e.tryFindDecorator=function e(t,r,n){if(t.transforms.get(r).transformer===n)return t.cells.get(r);var i=t.tree.children.get(r);if(1===i.size){var a=i.first();return t.transforms.get(a).transformer.definition.isDecorator?e(t,a,n):void 0}}}(b||(b={}));var x,O=r(186),w=r(158);function C(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=void 0,n=[],i=0,a=e;i<a.length;i++){var o=a[i];if(o)if(r||(r=new Set),"string"==typeof o){if(r.has(o))continue;r.add(o),n.push(o)}else for(var s=0,u=o;s<u.length;s++){var c=u[s];r.has(c)||(r.add(c),n.push(c))}}return n}!function(e){function t(e){if(!e.state||e.state.tree===e.editInfo.sourceTree)return e.tree.asImmutable();for(var t=e.state.tree.asTransient(),r=0,n=e.actions;r<n.length;r++){var i=n[r];switch(i.kind){case"add":t.add(i.transform);break;case"update":t.setParams(i.ref,i.params);break;case"delete":t.remove(i.ref);break;case"insert":var a=t.children.get(i.ref).toArray();t.add(i.transform);for(var o=0,s=a;o<s.length;o++){var u=s[o];t.changeParent(u,i.transform.ref)}}}return e.editInfo.sourceTree=e.tree,t.asImmutable()}e.is=function(e){return!!e&&"function"==typeof e.getTree},e.isTo=function(e){return!!e&&"function"==typeof e.getTree&&"string"==typeof e.ref};var r=function(){function e(e,t){this.state={state:t,tree:e.asTransient(),actions:[],editInfo:{applied:!1,sourceTree:e,count:0,lastUpdate:void 0}}}return Object.defineProperty(e.prototype,"editInfo",{get:function(){return this.state.editInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTree",{get:function(){return this.state.tree},enumerable:!1,configurable:!0}),e.prototype.to=function(e){var t="string"==typeof e?e:i.is(e)?e.transform.ref:e.ref;return new n(this.state,t,this)},e.prototype.toRoot=function(){return new n(this.state,this.state.tree.root.ref,this)},e.prototype.delete=function(e){var t=o.resolveRef(e);return t&&this.state.tree.transforms.has(t)?(this.editInfo.count++,this.state.tree.remove(t),this.state.actions.push({kind:"delete",ref:t}),this):this},e.prototype.getTree=function(){return t(this.state)},e.prototype.commit=function(e){if(!this.state.state)throw new Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,e))},e}();e.Root=r;var n=function(){function e(e,t,r){if(this.state=e,this.root=r,this.ref=t,!this.state.tree.transforms.has(t))throw new Error("Could not find node '"+t+"'.")}return Object.defineProperty(e.prototype,"editInfo",{get:function(){return this.state.editInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selector",{get:function(){return new u(this.ref,this.state.state)},enumerable:!1,configurable:!0}),e.prototype.getApplyRoot=function(){return c.getDecoratorRoot(this.state.tree,this.ref)},e.prototype.apply=function(t,r,n){if(t.definition.isDecorator)return this.insert(t,r,n);var i=this.getApplyRoot(),a=t.apply(i,r,n);return this.state.tree.add(a),this.editInfo.count++,this.editInfo.lastUpdate=a.ref,this.state.actions.push({kind:"add",transform:a}),new e(this.state,a.ref,this.root)},e.prototype.applyOrUpdate=function(e,t,r,n){if(this.state.tree.transforms.has(e)){var i=this.to(e);return r&&i.update(r),i}return this.apply(t,r,Object(y.__assign)(Object(y.__assign)({},n),{ref:e}))},e.prototype.applyOrUpdateTagged=function(t,r,n,i){if(r.definition.isDecorator)throw new Error("Can't use applyOrUpdateTagged on decorator transformers.");for(var a=this.getApplyRoot(),o=this.state.tree.children.get(a).values();;){var s=o.next();if(s.done)break;var u=this.state.tree.transforms.get(s.value);if(u&&d.a.hasTags(u,t)){var c=this.to(s.value);return c.updateTagged(n,C(u.tags,t,i&&i.tags)),c}}var l=r.apply(a,n,Object(y.__assign)(Object(y.__assign)({},i),{tags:C(t,i&&i.tags)}));return this.state.tree.add(l),this.editInfo.count++,this.editInfo.lastUpdate=l.ref,this.state.actions.push({kind:"add",transform:l}),new e(this.state,l.ref,this.root)},e.prototype.group=function(e,t,r){return this.apply(e,t,r)},e.prototype.insert=function(t,r,n){var i=this.state.tree.children.get(this.ref).toArray(),a=t.apply(this.ref,r,n);this.state.tree.add(a);for(var o=0,s=i;o<s.length;o++){var u=s[o];this.state.tree.changeParent(u,a.ref)}return this.editInfo.count++,this.editInfo.lastUpdate=a.ref,this.state.actions.push({kind:"insert",ref:this.ref,transform:a}),new e(this.state,a.ref,this.root)},e.prototype.updateTagged=function(e,t){(this.state.tree.setParams(this.ref,e)||this.state.tree.setTags(this.ref,t))&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:e}))},e.prototype.update=function(e,t){var r;if(t){var n=this.state.tree.transforms.get(this.ref);r=Object(w.b)(n.params,t)}else r="function"==typeof e?Object(w.b)(this.state.tree.transforms.get(this.ref).params,e):e;return this.state.tree.setParams(this.ref,r)&&(this.editInfo.count++,this.editInfo.lastUpdate=this.ref,this.state.actions.push({kind:"update",ref:this.ref,params:r})),this.root},e.prototype.to=function(e){return this.root.to(e)},e.prototype.toRoot=function(){return this.root.toRoot()},e.prototype.delete=function(e){return this.root.delete(e)},e.prototype.getTree=function(){return t(this.state)},e.prototype.commit=function(e){if(!this.state.state)throw new Error("Cannot commit template tree");return this.state.state.runTask(this.state.state.updateTree(this,e))},e}();e.To=n}(x||(x={}));var j,P=function(){function e(){this.ev=O.RxEventHelper.create(),this.actions=new Map,this.fromTypeIndex=new Map,this.events={added:this.ev(),removed:this.ev()}}return e.prototype.add=function(e){var t=_.a.is(e)?e.toAction():e;if(this.actions.has(t.id))return this;this.actions.set(t.id,t);for(var r=0,n=t.definition.from;r<n.length;r++){var i=n[r];this.fromTypeIndex.has(i.type)?this.fromTypeIndex.get(i.type).push(t):this.fromTypeIndex.set(i.type,[t])}return this.events.added.next(),this},e.prototype.remove=function(e){var t=_.a.is(e)?e.toAction().id:a.c.is(e)?e:e.id,r=this.actions.get(t);if(!r)return this;this.actions.delete(t);for(var n=0,i=r.definition.from;n<i.length;n++){var o=i[n],s=this.fromTypeIndex.get(o.type);s&&(Object(p.arraySetRemove)(s,r),0===s.length&&this.fromTypeIndex.delete(o.type))}return this.events.removed.next(),this},e.prototype.fromCell=function(e,t){var r=e.obj;if(!r)return[];var n=this.fromTypeIndex.get(r.type);if(!n)return[];for(var i=!1,a=0,o=n;a<o.length;a++){if((l=o[a]).definition.isApplicable){i=!0;break}}if(!i)return n;for(var s=[],u=0,c=n;u<c.length;u++){var l;(l=c[u]).definition.isApplicable?l.definition.isApplicable(r,e.transform,t)&&s.push(l):s.push(l)}return s},e.prototype.dispose=function(){this.ev.dispose()},e}(),E=r(249),A=r(75),D=r(2),T=r(311),I=r(62),M=function(){function e(){this.queue=[],this.signal=new I.a}return Object.defineProperty(e.prototype,"length",{get:function(){return this.queue.length},enumerable:!1,configurable:!0}),e.prototype.enqueue=function(e){return this.queue.push(e),1===this.queue.length||this.waitFor(e)},e.prototype.handled=function(e){Object(p.arrayRemoveInPlace)(this.queue,e),this.queue.length>0&&this.signal.next({v:this.queue[0],stillPresent:!0})},e.prototype.remove=function(e){var t=Object(p.arrayRemoveInPlace)(this.queue,e);return t&&this.signal.next({v:e,stillPresent:!1}),t},e.prototype.waitFor=function(e){var t=this;return new Promise((function(r){var n=t.signal.subscribe((function(t){var i=t.v,a=t.stillPresent;i===e&&(n.unsubscribe(),r(a))}))}))},e}(),k=r(48),B=r(57),V=function(){function e(e,t){var r=this;this.errorFree=!0,this.ev=O.RxEventHelper.create(),this.globalContext=void 0,this.events={cell:{stateUpdated:this.ev(),created:this.ev(),removed:this.ev()},object:{updated:this.ev(),created:this.ev(),removed:this.ev()},log:this.ev(),changed:this.ev(),historyUpdated:this.ev()},this.behaviors={currentObject:this.ev.behavior({state:this,ref:d.a.RootRef}),isUpdating:this.ev.behavior(!1)},this.actions=new P,this.cells=new Map,this.spine=new T.a.Impl(this.cells),this.tryGetCellData=function(e){var t,n,i=null===(n=null===(t=r.cells.get(e))||void 0===t?void 0:t.obj)||void 0===n?void 0:n.data;if(!e)throw new Error("Cell '"+e+"' data undefined.");return i},this.historyCapacity=5,this.history=[],this.undoingHistory=!1,this.inTransaction=!1,this.inTransactionError=!1,this._inUpdate=!1,this.reverted=!1,this.updateQueue=new M,this._tree=c.createEmpty(d.a.createRoot(t&&t.rootState)).asTransient();var n=this._tree.root;this.runTask=t.runTask,void 0!==(null==t?void 0:t.historyCapacity)&&(this.historyCapacity=t.historyCapacity),this.cells.set(n.ref,{parent:this,transform:n,sourceRef:void 0,obj:e,status:"ok",state:Object(y.__assign)({},n.state),errorText:void 0,params:{definition:{},values:{}},paramsNormalizedVersion:n.version,dependencies:{dependentBy:[],dependsOn:[]},cache:{}}),this.globalContext=t&&t.globalContext}return Object.defineProperty(e.prototype,"tree",{get:function(){return this._tree},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transforms",{get:function(){return this._tree.transforms},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"current",{get:function(){return this.behaviors.currentObject.value.ref},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this.cells.get(this._tree.root.ref)},enumerable:!1,configurable:!0}),e.prototype.build=function(){return new x.Root(this.tree,this)},e.prototype.addHistory=function(e,t){0!==this.historyCapacity&&(this.history.unshift([e,t||"Update"]),this.history.length>this.historyCapacity&&this.history.pop(),this.events.historyUpdated.next({state:this}))},e.prototype.clearHistory=function(){0!==this.history.length&&(this.history=[],this.events.historyUpdated.next({state:this}))},Object.defineProperty(e.prototype,"latestUndoLabel",{get:function(){return this.history.length>0?this.history[0][1]:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"canUndo",{get:function(){return this.history.length>0},enumerable:!1,configurable:!0}),e.prototype.undo=function(){var e=this;return S.b.create("Undo",(function(t){return Object(y.__awaiter)(e,void 0,void 0,(function(){var e;return Object(y.__generator)(this,(function(r){switch(r.label){case 0:if(!(e=this.history.shift()))return[2];this.events.historyUpdated.next({state:this}),this.undoingHistory=!0,r.label=1;case 1:return r.trys.push([1,,3,4]),[4,this.updateTree(e[0],{canUndo:!1}).runInContext(t)];case 2:return r.sent(),[3,4];case 3:return this.undoingHistory=!1,[7];case 4:return[2]}}))}))}))},e.prototype.getSnapshot=function(){return{tree:c.toJSON(this._tree)}},e.prototype.setSnapshot=function(e){var t=c.fromJSON(e.tree);return this.updateTree(t)},e.prototype.setCurrent=function(e){this.behaviors.currentObject.next({state:this,ref:e})},e.prototype.updateCellState=function(e,t){var r=this.cells.get(e);if(r){var n="function"==typeof t?t(r.state):t;d.a.assignState(r.state,n)&&(r.transform=this._tree.assignState(r.transform.ref,n),this.events.cell.stateUpdated.next({state:this,ref:e,cell:r}))}},e.prototype.dispose=function(){this.ev.dispose(),this.actions.dispose()},e.prototype.select=function(e){return b.select(e,this)},e.prototype.selectQ=function(e){return"string"==typeof e?b.select(e,this):b.select(e(b.Generators),this)},e.prototype.applyAction=function(e,t,r){var n=this;return void 0===r&&(r=d.a.RootRef),S.b.create("Apply Action",(function(i){var a=n.cells.get(r);if(!a)throw new Error("'"+r+"' does not exist.");if("ok"!==a.status)throw new Error("Action cannot be applied to a cell with status '"+a.status+"'");return ee(e.definition.run({ref:r,cell:a,a:a.obj,params:t,state:n},n.globalContext),i)}))},e.prototype.transaction=function(e,t){var r=this;return S.b.create("State Transaction",(function(n){return Object(y.__awaiter)(r,void 0,void 0,(function(){var r,i,a,o;return Object(y.__generator)(this,(function(s){switch(s.label){case 0:r=this.inTransaction,i=this._tree.asImmutable(),a=!1,s.label=1;case 1:return s.trys.push([1,5,8,9]),r||this.behaviors.isUpdating.next(!0),this.inTransaction=!0,this.inTransactionError=!1,[4,e(n)];case 2:return s.sent(),this.inTransactionError?(a=!0,[4,this.updateTree(i).runInContext(n)]):[3,4];case 3:s.sent(),s.label=4;case 4:return[3,9];case 5:return o=s.sent(),a?[3,7]:(a=!0,[4,this.updateTree(i).runInContext(n)]);case 6:s.sent(),this.events.log.next(E.a.error(""+o)),s.label=7;case 7:if(r)throw this.inTransactionError=!0,o;if(null==t?void 0:t.rethrowErrors)throw o;return[3,9];case 8:return r||(this.inTransaction=!1,this.events.changed.next({state:this,inTransaction:!1}),this.behaviors.isUpdating.next(!1),a||((null==t?void 0:t.canUndo)?this.addHistory(i,"string"==typeof t.canUndo?t.canUndo:void 0):this.clearHistory())),[7];case 9:return[2]}}))}))}))},Object.defineProperty(e.prototype,"inUpdate",{get:function(){return this._inUpdate},enumerable:!1,configurable:!0}),e.prototype.updateTree=function(e,t){var r=this,n={tree:e,options:t};return S.b.create("Update Tree",(function(i){return Object(y.__awaiter)(r,void 0,void 0,(function(){var r,a,o,s;return Object(y.__generator)(this,(function(c){switch(c.label){case 0:return[4,this.updateQueue.enqueue(n)];case 1:if(!c.sent())return[2];this._inUpdate=!0,r=(null==t?void 0:t.canUndo)?this._tree.asImmutable():void 0,a=!1,this.inTransaction||this.behaviors.isUpdating.next(!0),c.label=2;case 2:if(c.trys.push([2,,7,8]),x.is(e)){if(e.editInfo.applied)throw new Error("This builder has already been applied. Create a new builder for further state updates");e.editInfo.applied=!0}return this.reverted=!1,t&&(t.revertIfAborted||t.revertOnError)?[4,this._revertibleTreeUpdate(i,n,t)]:[3,4];case 3:return s=c.sent(),[3,6];case 4:return[4,this._updateTree(i,n)];case 5:s=c.sent(),c.label=6;case 6:return o=s,a=this.reverted,o.ctx.hadError&&(this.inTransactionError=!0),o.cell?[2,new u(o.cell.transform.ref,this)]:[2];case 7:return this._inUpdate=!1,this.updateQueue.handled(n),this.inTransaction||(this.behaviors.isUpdating.next(!1),(null==t?void 0:t.canUndo)?a||this.addHistory(r,"string"==typeof t.canUndo?t.canUndo:void 0):this.undoingHistory||this.clearHistory()),[7];case 8:return[2]}}))}))}),(function(){r.updateQueue.remove(n)}))},e.prototype._revertibleTreeUpdate=function(e,t,r){return Object(y.__awaiter)(this,void 0,void 0,(function(){var n,i;return Object(y.__generator)(this,(function(a){switch(a.label){case 0:return n=this.tree,[4,this._updateTree(e,t)];case 1:return i=a.sent(),(i.ctx.hadError||i.ctx.wasAborted)&&r.revertOnError||i.ctx.wasAborted&&r.revertIfAborted?(this.reverted=!0,[4,this._updateTree(e,{tree:n,options:t.options})]):[3,3];case 2:return[2,a.sent()];case 3:return[2,i]}}))}))},e.prototype._updateTree=function(e,t){return Object(y.__awaiter)(this,void 0,void 0,(function(){var r,n,i;return Object(y.__generator)(this,(function(a){switch(a.label){case 0:r=!1,n=this.updateTreeAndCreateCtx(t.tree,e,t.options),a.label=1;case 1:return a.trys.push([1,,3,4]),[4,L(n)];case 2:return r=a.sent(),x.isTo(t.tree)?(i=this.select(t.tree.ref)[0],[2,{ctx:n,cell:i}]):[2,{ctx:n}];case 3:return this.spine.current=void 0,r&&this.events.changed.next({state:this,inTransaction:this.inTransaction}),[7];case 4:return[2]}}))}))},e.prototype.updateTreeAndCreateCtx=function(e,t,r){var n=(x.is(e)?e.getTree():e).asTransient(),i=this._tree;this._tree=n;var a=this.cells,o={parent:this,editInfo:x.is(e)?e.editInfo:void 0,errorFree:this.errorFree,taskCtx:t,oldTree:i,tree:n,cells:this.cells,spine:this.spine,results:[],options:Object(y.__assign)(Object(y.__assign)({},R),r),changed:!1,hadError:!1,wasAborted:!1,newCurrent:void 0,getCellData:function(e){var t;return null===(t=a.get(e).obj)||void 0===t?void 0:t.data}};return this.errorFree=!0,o},e}();(j=V||(V={})).create=function(e,t){return new j(e,t)},(j.ObjectEvent||(j.ObjectEvent={})).isCell=function(e,t){return!!t&&e.ref===t.transform.ref&&e.state===t.parent};var R={doNotLogTiming:!1,doNotUpdateCurrent:!0,revertIfAborted:!1,revertOnError:!1,canUndo:!1};function L(e){return Object(y.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,o,s,u,l,d,f,p,m,h,g,v,b,_,S,x,O,w,C,j,P,E,A,D,T,I;return Object(y.__generator)(this,(function(y){switch(y.label){case 0:if(t=!(!e.editInfo||1!==e.editInfo.count||!e.editInfo.lastUpdate||e.editInfo.sourceTree!==e.oldTree),i=[],t)r=[],a=[e.editInfo.lastUpdate];else{for(r=function(e){var t={newTree:e.tree,cells:e.cells,deletes:[]};return c.doPostOrder(e.oldTree,e.oldTree.root,t,F),t.deletes}(e),T=e.parent.current,o=!1,s=0,u=r;s<u.length;s++)if((b=u[s])===T){o=!0;break}for(o&&(l=X(e.oldTree,T,r,e.cells),e.parent.setCurrent(l)),v=r.length-1;v>=0;v--)(O=e.cells.get(r[v]))&&J(O.transform,O.obj,null==O?void 0:O.transform.params,O.cache,e.parent.globalContext);for(d=0,f=r;d<f.length;d++)b=f[d],(O=e.cells.get(b))&&(O.parent=void 0,G(O)),p=O&&O.obj,e.cells.delete(b),i.push(p);M=e.cells,k=e.tree,V={roots:[],cells:M},c.doPreOrder(k,k.root,V,N),a=V.roots}for(m=function(e,t){for(var r,n={ctx:e,visited:new Set,added:[]},i=0,a=t;i<a.length;i++){var o=a[i];c.doPreOrder(e.tree,e.tree.transforms.get(o),n,q)}for(var s=0,u=n.added;s<u.length;s++){W(u[s],e)}return n.visited.forEach((function(t){for(var i=0,a=e.cells.get(t).dependencies.dependentBy;i<a.length;i++){var o=a[i];n.visited.has(o.transform.ref)||(r||(r=B.c.create()),B.c.add(r,o.transform.ref,o))}})),{added:n.added,dependent:r?r.array:void 0}}(e,a),h=0,g=m.added;h<g.length;h++)O=g[h],e.parent.events.cell.created.next({state:e.parent,ref:O.transform.ref,cell:O});for(v=0;v<r.length;v++)b=r[v],_=e.oldTree.transforms.get(b).parent,e.parent.events.object.removed.next({state:e.parent,ref:b,obj:i[v]}),e.parent.events.cell.removed.next({state:e.parent,ref:b,parent:_});if(i.length&&(i=[]),m.dependent)for(S=0,x=m.dependent;S<x.length;S++)O=x[S],a.push(O.transform.ref);!function(e,t){for(var r=0,n=t;r<n.length;r++){var i=n[r];c.doPreOrder(e.tree,e.tree.transforms.get(i),e,H)}}(e,a),w=0,C=a,y.label=1;case 1:return w<C.length?(j=C[w],[4,K(e,j)]):[3,4];case 2:y.sent(),y.label=3;case 3:return w++,[3,1];case 4:for(e.editInfo||function(e){c.doPreOrder(e.tree,e.tree.root,e,U)}(e),P=e.newCurrent,E=0,A=e.results;E<A.length;E++)"created"===(D=A[E]).action?(e.parent.events.object.created.next({state:e.parent,ref:D.ref,obj:D.obj}),e.newCurrent||e.tree.transforms.get(D.ref).state.isGhost||D.obj===n.Null||(P=D.ref)):"updated"===D.action?e.parent.events.object.updated.next({state:e.parent,ref:D.ref,action:"in-place",obj:D.obj,oldData:D.oldData}):"replaced"===D.action&&e.parent.events.object.updated.next({state:e.parent,ref:D.ref,action:"recreate",obj:D.obj,oldObj:D.oldObj});return P?e.options.doNotUpdateCurrent||e.parent.setCurrent(P):(T=e.parent.current,(I=e.cells.get(T))&&(I.obj===n.Null||"error"===I.status&&I.errorText===Q)&&(P=X(e.oldTree,T,[],e.cells),e.parent.setCurrent(P))),[2,r.length>0||a.length>0||e.changed]}var M,k,V}))}))}function N(e,t,r){var i=r.cells.get(e.ref);return i&&i.transform.version===e.version?"error"!==i.status&&(!i||i.obj!==n.Null):(r.roots.push(e.ref),!1)}function F(e,t,r){!r.newTree.transforms.has(e.ref)&&r.cells.has(e.ref)&&r.deletes.push(e.ref)}function U(e,t,r){var n=r.cells.get(e.ref);n&&d.a.syncState(n.state,e.state)&&r.parent.events.cell.stateUpdated.next({state:r.parent,ref:e.ref,cell:n})}function z(e,t,r,n){var i=e.cells.get(t),a=i.status!==r;i.status=r,i.errorText=n,a&&e.parent.events.cell.stateUpdated.next({state:e.parent,ref:t,cell:i})}function H(e,t,r){r.cells.get(e.ref).transform=e,z(r,e.ref,"pending")}function G(e){for(var t=0,r=e.dependencies.dependsOn;t<r.length;t++){var n=r[t];Object(p.arraySetRemove)(n.dependencies.dependentBy,e)}}function q(e,t,r){var n=r.ctx,i=r.added;if(r.visited.add(e.ref),!n.cells.has(e.ref)){var a={parent:n.parent,transform:e,sourceRef:void 0,status:"pending",state:Object(y.__assign)({},e.state),errorText:void 0,params:void 0,paramsNormalizedVersion:"",dependencies:{dependentBy:[],dependsOn:[]},cache:void 0};n.cells.set(e.ref,a),i.push(a)}}function W(e,t){if(e.transform.dependsOn)for(var r=0,n=e.transform.dependsOn;r<n.length;r++){var i=n[r];if(!t.tree.transforms.get(i))throw new Error("Cannot depend on a non-existent transform.");var a=t.cells.get(i);Object(p.arraySetAdd)(e.dependencies.dependsOn,a),Object(p.arraySetAdd)(a.dependencies.dependentBy,e)}}function X(e,t,r,i){return function e(t,r,i,a){if(r===d.a.RootRef)return r;var o=t.transforms.get(r),s=t.children.get(o.parent).values(),u=void 0,c=!1;for(;;){var l=s.next();if(l.done)break;if(!i.has(l.value)){var f=a.get(l.value);if(f&&"error"!==f.status&&f.obj!==n.Null){var p=t.transforms.get(l.value);if(!p.state.isGhost)if(l.value!==r){if(c)return p.ref;u=p.ref}else c=!0,i.has(r)||(u=r)}}}return u||e(t,o.parent,i,a)}(e,t,new Set(r),i)}function Y(e,t,r,n){n||(e.hadError=!0,e.parent.errorFree=!1);var i=e.cells.get(t);if(r){e.wasAborted=e.wasAborted||S.b.isAbort(r);var a=""+r;z(e,t,"error",a),n||e.parent.events.log.next({type:"error",timestamp:new Date,message:a})}else i.params=void 0;if(i.obj){var o=i.obj;i.obj=void 0,i.cache=void 0,e.parent.events.object.removed.next({state:e.parent,ref:t,obj:o})}for(var s=e.tree.children.get(t).values();;){var u=s.next();if(u.done)return;Y(e,u.value,void 0,n)}}var Q="Parent is null";function K(e,t){return Object(y.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,s,u,c;return Object(y.__generator)(this,(function(l){switch(l.label){case 0:z(e,t,"processing"),r=!1,l.label=1;case 1:return l.trys.push([1,3,,4]),i=Object(A.b)(),[4,Z(e,t)];case 2:return a=l.sent(),o=Object(A.b)()-i,"none"!==a.action&&(e.changed=!0),z(e,t,"ok"),e.results.push(a),"created"===a.action?(r=a.obj===n.Null)||e.options.doNotLogTiming||e.parent.events.log.next(E.a.info("Created "+a.obj.label+" in "+Object(A.a)(o)+".")):("updated"===a.action||"replaced"===a.action)&&((r=a.obj===n.Null)||e.options.doNotLogTiming||e.parent.events.log.next(E.a.info("Updated "+a.obj.label+" in "+Object(A.a)(o)+"."))),[3,4];case 3:return s=l.sent(),e.changed=!0,e.hadError||(e.newCurrent=t),Y(e,t,s,!1),k.b||console.error(s),[2];case 4:u=e.tree.children.get(t).values(),l.label=5;case 5:return(c=u.next()).done?[2]:r?(Y(e,c.value,void 0,!0),[3,8]):[3,6];case 6:return[4,K(e,c.value)];case 7:l.sent(),l.label=8;case 8:return[3,5];case 9:return[2]}}))}))}function Z(e,t){var r;return Object(y.__awaiter)(this,void 0,void 0,(function(){var i,a,o,s,u,c,l,p,m,h,g,v,S,x,O;return Object(y.__generator)(this,(function(y){switch(y.label){case 0:if(i=e.oldTree,a=e.tree,o=e.cells.get(t),s=o.transform,o.transform.ref===d.a.RootRef)return[2,{action:"none"}];if(!(u=0===s.transformer.definition.from.length?e.cells.get(o.transform.parent):b.findAncestorOfType(a,e.cells,t,s.transformer.definition.from)))throw new Error("No suitable parent found for '"+t+"'");return e.spine.current=o,c=u.obj,o.sourceRef=u.transform.ref,l=function(e,t,r,n){var i=t.transformer.definition.params,a=i?i(r,e.parent.globalContext):{};if(n.paramsNormalizedVersion!==t.version)t.params=D.ParamDefinition.normalizeParams(a,t.params,"all"),n.paramsNormalizedVersion=t.version;else{var o=D.ParamDefinition.getDefaultValues(a);t.params=t.params?Object(f.a)(t.params,o):o}return D.ParamDefinition.resolveRefs(a,t.params,e.getCellData),{definition:a,values:t.params}}(e,s,c,o),i.transforms.has(t)&&o.params?[3,2]:(o.params=l,[4,re(e,o,s.transformer,c,l.values)]);case 1:return $(p=y.sent(),s),o.obj=p,[2,{ref:t,action:"created",obj:p}];case 2:return m=o.params.values,h=o.cache,g=null===(r=o.obj)||void 0===r?void 0:r.data,v=l.values,o.params=l,o.obj&&o.obj!==n.Null?[4,ne(e,o,s.transformer,c,o.obj,m,v)]:[3,4];case 3:return S=y.sent(),[3,5];case 4:S=_.a.UpdateResult.Recreate,y.label=5;case 5:switch(S){case _.a.UpdateResult.Recreate:return[3,6];case _.a.UpdateResult.Updated:return[3,8];case _.a.UpdateResult.Null:return[3,9]}return[3,10];case 6:return x=o.obj,J(s,x,m,h,e.parent.globalContext),[4,re(e,o,s.transformer,c,v)];case 7:return $(O=y.sent(),s),o.obj=O,[2,{ref:t,action:"replaced",oldObj:x,obj:O}];case 8:return $(o.obj,s),[2,{ref:t,action:"updated",oldData:g,obj:o.obj}];case 9:return J(s,o.obj,m,h,e.parent.globalContext),o.obj=n.Null,[2,{ref:t,action:"updated",obj:o.obj}];case 10:return[2,{action:"none"}]}}))}))}function J(e,t,r,i,a){var o,s;null===(s=(o=e.transformer.definition).dispose)||void 0===s||s.call(o,{b:t!==n.Null?t:void 0,params:r,cache:i},a)}function $(e,t){e&&e!==n.Null&&(e.tags=t.tags)}function ee(e,t){return"function"==typeof e.runInContext?e.runInContext(t):e}function te(e){if(0!==e.dependencies.dependsOn.length){for(var t=Object.create(null),r=0,n=e.dependencies.dependsOn;r<n.length;r++){var i=n[r];if(!i.obj)throw new Error("Unresolved dependency.");t[i.transform.ref]=i.obj}return t}}function re(e,t,r,n,i){return t.cache||(t.cache=Object.create(null)),ee(r.definition.apply({a:n,params:i,cache:t.cache,spine:e.spine,dependencies:te(t)},e.parent.globalContext),e.taskCtx)}function ne(e,t,r,n,i,a,o){return Object(y.__awaiter)(this,void 0,void 0,(function(){return Object(y.__generator)(this,(function(s){return r.definition.update?(t.cache||(t.cache=Object.create(null)),[2,ee(r.definition.update({a:n,oldParams:a,b:i,newParams:o,cache:t.cache,spine:e.spine,dependencies:te(t)},e.parent.globalContext),e.taskCtx)]):[2,_.a.UpdateResult.Recreate]}))}))}var ie=r(350)},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(210),i=r(225),a=r(16),o=r(19),s=r(43),u={"@header":"Internal Queries",generator:{"@header":"Generators",bundleElement:Object(s.b)(o.b.Dictionary({groupedUnits:Object(o.a)(a.a.Any),set:Object(o.a)(a.a.Any),ranges:Object(o.a)(a.a.Any)}),a.a.Any),bundle:Object(s.b)(o.b.Dictionary({elements:Object(o.a)(a.a.Any)}),i.a.ElementSelectionQuery,"A selection with single structure containing represented by the bundle."),current:Object(s.b)(o.b.None,i.a.ElementSelectionQuery,"Current selection provided by the query context. Avoid using this in State Transforms.")}},c={core:n.b,structureQuery:i.b,internal:u};Object(s.a)(c);var l=Object(s.c)(c);!function(){for(var e=Object.create(null),t=0,r=l;t<r.length;t++){var n=r[t];e[n.id]=n}}()},function(e,t,r){"use strict";r.r(t),r.d(t,"Icon",(function(){return i})),r.d(t,"UnionSvg",(function(){return u})),r.d(t,"SubtractSvg",(function(){return l})),r.d(t,"IntersectSvg",(function(){return f})),r.d(t,"SetSvg",(function(){return m})),r.d(t,"MoleculeSvg",(function(){return g})),r.d(t,"CubeOutlineSvg",(function(){return b})),r.d(t,"CursorDefaultOutlineSvg",(function(){return _})),r.d(t,"FileOutlineSvg",(function(){return x})),r.d(t,"PencilRulerSvg",(function(){return w})),r.d(t,"AccountTreeOutlinedSvg",(function(){return j})),r.d(t,"AddSvg",(function(){return E})),r.d(t,"ArrowDownwardSvg",(function(){return D})),r.d(t,"ArrowDropDownSvg",(function(){return I})),r.d(t,"ArrowRightSvg",(function(){return k})),r.d(t,"ArrowUpwardSvg",(function(){return V})),r.d(t,"AutorenewSvg",(function(){return L})),r.d(t,"BlurOnSvg",(function(){return F})),r.d(t,"BookmarksOutlinedSvg",(function(){return z})),r.d(t,"BrushSvg",(function(){return G})),r.d(t,"BuildOutlinedSvg",(function(){return W})),r.d(t,"BuildSvg",(function(){return Y})),r.d(t,"CameraOutlinedSvg",(function(){return K})),r.d(t,"CameraSvg",(function(){return J})),r.d(t,"CancelOutlinedSvg",(function(){return ee})),r.d(t,"CancelSvg",(function(){return re})),r.d(t,"CenterFocusStrongSvg",(function(){return ie})),r.d(t,"CheckSvg",(function(){return oe})),r.d(t,"ClearSvg",(function(){return ue})),r.d(t,"CloseSvg",(function(){return le})),r.d(t,"CloudUploadSvg",(function(){return fe})),r.d(t,"CodeSvg",(function(){return me})),r.d(t,"CopySvg",(function(){return ge})),r.d(t,"CropSvg",(function(){return be})),r.d(t,"CropFreeSvg",(function(){return _e})),r.d(t,"CropOrginalSvg",(function(){return xe})),r.d(t,"DeleteOutlinedSvg",(function(){return we})),r.d(t,"DeleteSvg",(function(){return je})),r.d(t,"ErrorSvg",(function(){return Ee})),r.d(t,"ExtensionSvg",(function(){return De})),r.d(t,"FlipToFrontSvg",(function(){return Ie})),r.d(t,"FullscreenSvg",(function(){return ke})),r.d(t,"GetAppSvg",(function(){return Ve})),r.d(t,"HelpOutlineSvg",(function(){return Le})),r.d(t,"HomeOutlinedSvg",(function(){return Fe})),r.d(t,"LaunchSvg",(function(){return ze})),r.d(t,"LinearScaleSvg",(function(){return Ge})),r.d(t,"MoreHorizSvg",(function(){return We})),r.d(t,"NavigateBeforeSvg",(function(){return Ye})),r.d(t,"NavigateNextSvg",(function(){return Ke})),r.d(t,"OpenInBrowserSvg",(function(){return Je})),r.d(t,"PlayArrowSvg",(function(){return et})),r.d(t,"RefreshSvg",(function(){return rt})),r.d(t,"RemoveSvg",(function(){return it})),r.d(t,"RestoreSvg",(function(){return ot})),r.d(t,"SaveOutlinedSvg",(function(){return ut})),r.d(t,"ScatterPlotSvg",(function(){return lt})),r.d(t,"SkipPreviousSvg",(function(){return ft})),r.d(t,"StopSvg",(function(){return mt})),r.d(t,"SubscriptionsOutlinedSvg",(function(){return gt})),r.d(t,"SwapHorizSvg",(function(){return bt})),r.d(t,"TuneSvg",(function(){return _t})),r.d(t,"VisibilityOffOutlinedSvg",(function(){return xt})),r.d(t,"VisibilityOutlinedSvg",(function(){return wt})),r.d(t,"WarningSvg",(function(){return jt})),r.d(t,"SelectionModeSvg",(function(){return Pt})),r.d(t,"SuperposeAtomsSvg",(function(){return Et})),r.d(t,"SuperposeChainsSvg",(function(){return At})),r.d(t,"SuperpositionSvg",(function(){return Dt}));var n=r(3);function i(e){return e.svg?n.createElement("span",{className:"msp-icon msp-material-icon"+(e.inline?" msp-icon-inline":""),title:e.title,style:e.style},n.createElement(e.svg,null)):null}var a=n.createElement("circle",{r:"6px",id:"circle-left",cy:"12px",cx:"8px",strokeWidth:"1px"}),o=n.createElement("circle",{r:"6px",id:"circle-right",cy:"12px",cx:"16px",strokeWidth:"1px"}),s=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("defs",null,a,o),n.createElement("g",null,n.createElement("use",{href:"#circle-left",className:"msp-shape-filled"}),n.createElement("use",{href:"#circle-right",className:"msp-shape-filled"}),n.createElement("use",{href:"#circle-left",className:"msp-shape-empty"})));function u(){return s}var c=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("defs",null,a,o,n.createElement("mask",{id:"mask-left"},n.createElement("use",{href:"#circle-left",fill:"white",stroke:"white"}),n.createElement("use",{href:"#circle-right",fill:"black",strokeWidth:"0px",stroke:"white"}))),n.createElement("g",null,n.createElement("use",{href:"#circle-left",className:"msp-shape-filled",mask:"url(#mask-left)"}),n.createElement("use",{href:"#circle-right",className:"msp-shape-empty"})));function l(){return c}var d=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("defs",null,a,o,n.createElement("clipPath",{id:"clip-left"},n.createElement("use",{href:"#circle-right"}))),n.createElement("g",null,n.createElement("use",{href:"#circle-left",className:"msp-shape-filled",clipPath:"url(#clip-left)"}),n.createElement("use",{href:"#circle-left",className:"msp-shape-empty"}),n.createElement("use",{href:"#circle-right",className:"msp-shape-empty"})));function f(){return d}var p=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("defs",null,a,o),n.createElement("g",null,n.createElement("use",{href:"#circle-left",className:"msp-shape-empty"}),n.createElement("use",{href:"#circle-right",className:"msp-shape-filled"})));function m(){return p}var h=n.createElement("svg",{width:"17px",height:"17px",viewBox:"0 0 299.463 299.463",strokeWidth:"6px"},n.createElement("g",null,n.createElement("path",{d:"M256.851,173.832v-48.201c22.916-4.918,34.151-30.668,22.556-50.771c-11.547-20.004-39.486-23.251-55.242-5.844 l-41.746-24.106C189.618,22.603,172.861,0,149.734,0c-23.132,0-39.881,22.609-32.685,44.911L75.305,69.016 C59.522,51.586,31.597,54.88,20.061,74.863c-11.63,20.163-0.298,45.862,22.557,50.769v48.2 c-22.821,4.898-34.195,30.591-22.556,50.771c11.529,19.972,39.454,23.285,55.242,5.845l41.746,24.106 c-7.199,22.308,9.559,44.911,32.685,44.911c23.132,0,39.88-22.609,32.685-44.911l41.745-24.106 c15.817,17.469,43.73,14.099,55.242-5.844c0,0,0-0.001,0.001-0.002c4.587-7.953,5.805-17.213,3.431-26.076 C279.392,185.657,269.129,176.461,256.851,173.832z M249.62,72.088c20.568,0,27.428,27.191,10.008,37.239 c-0.003,0.002-0.006,0.003-0.009,0.005c-10.04,5.81-22.85,1.762-27.877-8.475C225.206,87.548,234.938,72.088,249.62,72.088z M149.734,14.4c11.005,0,19.958,8.954,19.958,19.959c0,11.127-9.077,19.958-19.958,19.958c-10.95,0-19.958-8.9-19.958-19.958 C129.776,23.354,138.729,14.4,149.734,14.4z M39.84,109.328c-17.451-10.067-10.534-37.24,10.01-37.24 c15.311,0,24.922,16.653,17.251,29.942C61.681,111.397,49.517,114.925,39.84,109.328z M59.802,224.702 c-9.535,5.503-21.768,2.229-27.268-7.298c-7.639-13.242,1.887-29.945,17.236-29.945c0.013,0,0.027,0,0.04,0 C70.07,187.48,77.49,214.469,59.802,224.702z M149.734,285.062c-11.005,0-19.958-8.954-19.958-19.958 c0-11.127,9.077-19.958,19.958-19.958c10.954,0,19.958,8.903,19.958,19.958C169.693,276.109,160.74,285.062,149.734,285.062z M216.953,217.982l-41.727,24.095c-13.778-15.22-37.459-14.94-50.983,0l-41.728-24.096c6.196-19.289-5.541-39.835-25.498-44.149 V125.63c19.752-4.268,31.762-24.65,25.498-44.149l41.727-24.095c13.629,15.055,37.32,15.093,50.983,0l41.728,24.096 c-6.196,19.29,5.534,39.835,25.498,44.149v48.202C222.61,178.123,210.721,198.581,216.953,217.982z M266.935,217.404 c-5.501,9.528-17.732,12.802-27.261,7.302c-17.682-10.23-10.301-37.247,10.032-37.247 C264.984,187.459,274.602,204.112,266.935,217.404z"})));function g(){return h}var v=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px"},n.createElement("path",{d:"M21,16.5C21,16.88 20.79,17.21 20.47,17.38L12.57,21.82C12.41,21.94 12.21,22 12,22C11.79,22 11.59,21.94 11.43,21.82L3.53,17.38C3.21,17.21 3,16.88 3,16.5V7.5C3,7.12 3.21,6.79 3.53,6.62L11.43,2.18C11.59,2.06 11.79,2 12,2C12.21,2 12.41,2.06 12.57,2.18L20.47,6.62C20.79,6.79 21,7.12 21,7.5V16.5M12,4.15L6.04,7.5L12,10.85L17.96,7.5L12,4.15M5,15.91L11,19.29V12.58L5,9.21V15.91M19,15.91V9.21L13,12.58V19.29L19,15.91Z"}));function b(){return v}var y=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M10.07,14.27C10.57,14.03 11.16,14.25 11.4,14.75L13.7,19.74L15.5,18.89L13.19,13.91C12.95,13.41 13.17,12.81 13.67,12.58L13.95,12.5L16.25,12.05L8,5.12V15.9L9.82,14.43L10.07,14.27M13.64,21.97C13.14,22.21 12.54,22 12.31,21.5L10.13,16.76L7.62,18.78C7.45,18.92 7.24,19 7,19A1,1 0 0,1 6,18V3A1,1 0 0,1 7,2C7.24,2 7.47,2.09 7.64,2.23L7.65,2.22L19.14,11.86C19.57,12.22 19.62,12.85 19.27,13.27C19.12,13.45 18.91,13.57 18.7,13.61L15.54,14.23L17.74,18.96C18,19.46 17.76,20.05 17.26,20.28L13.64,21.97Z"}));function _(){return y}var S=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px"},n.createElement("path",{fill:"currentColor",d:"M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"}));function x(){return S}var O=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px"},n.createElement("path",{d:"M3 17.25V21H6.75L17.81 9.93L14.06 6.18L3 17.25M22.61 18.36L18.36 22.61L13.16 17.41L14.93 15.64L15.93 16.64L18.4 14.16L19.82 15.58L18.36 17L19.42 18L20.84 16.6L22.61 18.36M6.61 10.83L1.39 5.64L5.64 1.39L7.4 3.16L4.93 5.64L6 6.7L8.46 4.22L9.88 5.64L8.46 7.05L9.46 8.05L6.61 10.83M20.71 7C21.1 6.61 21.1 6 20.71 5.59L18.37 3.29C18 2.9 17.35 2.9 16.96 3.29L15.12 5.12L18.87 8.87L20.71 7Z"}));function w(){return O}var C=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M22 11V3h-7v3H9V3H2v8h7V8h2v10h4v3h7v-8h-7v3h-2V8h2v3h7zM7 9H4V5h3v4zm10 6h3v4h-3v-4zm0-10h3v4h-3V5z"}));function j(){return C}var P=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}));function E(){return P}var A=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M20 12l-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z"}));function D(){return A}var T=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M7 10l5 5 5-5z"}));function I(){return T}var M=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M10 17l5-5-5-5v10z"}));function k(){return M}var B=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M4 12l1.41 1.41L11 7.83V20h2V7.83l5.58 5.59L20 12l-8-8-8 8z"}));function V(){return B}var R=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z"}));function L(){return R}var N=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M6 13c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm-3 .5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM6 5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm15 5.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM14 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0-3.5c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zm-11 10c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm7 7c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm0-17c.28 0 .5-.22.5-.5s-.22-.5-.5-.5-.5.22-.5.5.22.5.5.5zM10 7c.55 0 1-.45 1-1s-.45-1-1-1-1 .45-1 1 .45 1 1 1zm0 5.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm8 .5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-8c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0-4c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm3 8.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zM14 17c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm0 3.5c-.28 0-.5.22-.5.5s.22.5.5.5.5-.22.5-.5-.22-.5-.5-.5zm-4-12c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0 8.5c-.55 0-1 .45-1 1s.45 1 1 1 1-.45 1-1-.45-1-1-1zm4-4.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm0-4c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"}));function F(){return N}var U=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M15 7v12.97l-4.21-1.81-.79-.34-.79.34L5 19.97V7h10m4-6H8.99C7.89 1 7 1.9 7 3h10c1.1 0 2 .9 2 2v13l2 1V3c0-1.1-.9-2-2-2zm-4 4H5c-1.1 0-2 .9-2 2v16l7-3 7 3V7c0-1.1-.9-2-2-2z"}));function z(){return U}var H=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M7 14c-1.66 0-3 1.34-3 3 0 1.31-1.16 2-2 2 .92 1.22 2.49 2 4 2 2.21 0 4-1.79 4-4 0-1.66-1.34-3-3-3zm13.71-9.37l-1.34-1.34a.9959.9959 0 00-1.41 0L9 12.25 11.75 15l8.96-8.96c.39-.39.39-1.02 0-1.41z"}));function G(){return H}var q=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M22.61 18.99l-9.08-9.08c.93-2.34.45-5.1-1.44-7C9.79.61 6.21.4 3.66 2.26L7.5 6.11 6.08 7.52 2.25 3.69C.39 6.23.6 9.82 2.9 12.11c1.86 1.86 4.57 2.35 6.89 1.48l9.11 9.11c.39.39 1.02.39 1.41 0l2.3-2.3c.4-.38.4-1.01 0-1.41zm-3 1.6l-9.46-9.46c-.61.45-1.29.72-2 .82-1.36.2-2.79-.21-3.83-1.25C3.37 9.76 2.93 8.5 3 7.26l3.09 3.09 4.24-4.24-3.09-3.09c1.24-.07 2.49.37 3.44 1.31 1.08 1.08 1.49 2.57 1.24 3.96-.12.71-.42 1.37-.88 1.96l9.45 9.45-.88.89z"}));function W(){return q}var X=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"}));function Y(){return X}var Q=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M14.25 2.26l-.08-.04-.01.02C13.46 2.09 12.74 2 12 2 6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-4.75-3.31-8.72-7.75-9.74zM19.41 9h-7.99l2.71-4.7c2.4.66 4.35 2.42 5.28 4.7zM13.1 4.08L10.27 9l-1.15 2L6.4 6.3C7.84 4.88 9.82 4 12 4c.37 0 .74.03 1.1.08zM5.7 7.09L8.54 12l1.15 2H4.26C4.1 13.36 4 12.69 4 12c0-1.85.64-3.55 1.7-4.91zM4.59 15h7.98l-2.71 4.7c-2.4-.67-4.34-2.42-5.27-4.7zm6.31 4.91L14.89 13l2.72 4.7C16.16 19.12 14.18 20 12 20c-.38 0-.74-.04-1.1-.09zm7.4-3l-4-6.91h5.43c.17.64.27 1.31.27 2 0 1.85-.64 3.55-1.7 4.91z"}));function K(){return Q}var Z=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M9.4 10.5l4.77-8.26C13.47 2.09 12.75 2 12 2c-2.4 0-4.6.85-6.32 2.25l3.66 6.35.06-.1zM21.54 9c-.92-2.92-3.15-5.26-6-6.34L11.88 9h9.66zm.26 1h-7.49l.29.5 4.76 8.25C21 16.97 22 14.61 22 12c0-.69-.07-1.35-.2-2zM8.54 12l-3.9-6.75C3.01 7.03 2 9.39 2 12c0 .69.07 1.35.2 2h7.49l-1.15-2zm-6.08 3c.92 2.92 3.15 5.26 6 6.34L12.12 15H2.46zm11.27 0l-3.9 6.76c.7.15 1.42.24 2.17.24 2.4 0 4.6-.85 6.32-2.25l-3.66-6.35-.93 1.6z"}));function J(){return Z}var $=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z"}));function ee(){return $}var te=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"}));function re(){return te}var ne=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm-7 7H3v4c0 1.1.9 2 2 2h4v-2H5v-4zM5 5h4V3H5c-1.1 0-2 .9-2 2v4h2V5zm14-2h-4v2h4v4h2V5c0-1.1-.9-2-2-2zm0 16h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4z"}));function ie(){return ne}var ae=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}));function oe(){return ae}var se=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function ue(){return se}var ce=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}));function le(){return ce}var de=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"}));function fe(){return de}var pe=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"}));function me(){return pe}var he=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm-1 4H8c-1.1 0-1.99.9-1.99 2L6 21c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V11l-6-6zM8 21V7h6v5h5v9H8z"}));function ge(){return he}var ve=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z"}));function be(){return ve}var ye=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M3 5v4h2V5h4V3H5c-1.1 0-2 .9-2 2zm2 10H3v4c0 1.1.9 2 2 2h4v-2H5v-4zm14 4h-4v2h4c1.1 0 2-.9 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5c0-1.1-.9-2-2-2z"}));function _e(){return ye}var Se=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V5h14v14zm-5.04-6.71l-2.75 3.54-1.96-2.36L6.5 17h11l-3.54-4.71z"}));function xe(){return Se}var Oe=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z"}));function we(){return Oe}var Ce=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"}));function je(){return Ce}var Pe=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"}));function Ee(){return Pe}var Ae=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"}));function De(){return Ae}var Te=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px"},n.createElement("path",{d:"M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"}));function Ie(){return Te}var Me=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}));function ke(){return Me}var Be=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"}));function Ve(){return Be}var Re=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"}));function Le(){return Re}var Ne=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 5.69l5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3L2 12h3v8h6v-6h2v6h6v-8h3L12 3z"}));function Fe(){return Ne}var Ue=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}));function ze(){return Ue}var He=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19.5 9.5c-1.03 0-1.9.62-2.29 1.5h-2.92c-.39-.88-1.26-1.5-2.29-1.5s-1.9.62-2.29 1.5H6.79c-.39-.88-1.26-1.5-2.29-1.5C3.12 9.5 2 10.62 2 12s1.12 2.5 2.5 2.5c1.03 0 1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5s1.9-.62 2.29-1.5h2.92c.39.88 1.26 1.5 2.29 1.5 1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5z"}));function Ge(){return He}var qe=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"}));function We(){return qe}var Xe=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"}));function Ye(){return Xe}var Qe=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}));function Ke(){return Qe}var Ze=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"}));function Je(){return Ze}var $e=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M8 5v14l11-7z"}));function et(){return $e}var tt=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}));function rt(){return tt}var nt=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M19 13H5v-2h14v2z"}));function it(){return nt}var at=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"}));function ot(){return at}var st=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24",strokeWidth:"0.1px"},n.createElement("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm2 16H5V5h11.17L19 7.83V19zm-7-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zM6 6h9v4H6z"}));function ut(){return st}var ct=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("circle",{cx:"7",cy:"14",r:"3"}),n.createElement("circle",{cx:"11",cy:"6",r:"3"}),n.createElement("circle",{cx:"16.6",cy:"17.6",r:"3"}));function lt(){return ct}var dt=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M6 6h2v12H6zm3.5 6l8.5 6V6z"}));function ft(){return dt}var pt=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M6 6h12v12H6z"}));function mt(){return pt}var ht=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M4 6h16v2H4zm2-4h12v2H6zm14 8H4c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm0 10H4v-8h16v8zm-10-7.27v6.53L16 16z"}));function gt(){return ht}var vt=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z"}));function bt(){return vt}var yt=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z"}));function _t(){return yt}var St=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5-.59 1.22-1.42 2.27-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68C3.06 7.83 1.77 9.53 1 11.5 2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5l2.61 2.61c-.04.01-.08.02-.12.02-1.38 0-2.5-1.12-2.5-2.5 0-.05.01-.08.01-.13zm-3.4-3.4l1.75 1.75c-.23.55-.36 1.15-.36 1.78 0 2.48 2.02 4.5 4.5 4.5.63 0 1.23-.13 1.77-.36l.98.98c-.88.24-1.8.38-2.75.38-3.79 0-7.17-2.13-8.82-5.5.7-1.43 1.72-2.61 2.93-3.53z"}));function xt(){return St}var Ot=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M12 6c3.79 0 7.17 2.13 8.82 5.5C19.17 14.87 15.79 17 12 17s-7.17-2.13-8.82-5.5C4.83 8.13 8.21 6 12 6m0-2C7 4 2.73 7.11 1 11.5 2.73 15.89 7 19 12 19s9.27-3.11 11-7.5C21.27 7.11 17 4 12 4zm0 5c1.38 0 2.5 1.12 2.5 2.5S13.38 14 12 14s-2.5-1.12-2.5-2.5S10.62 9 12 9m0-2c-2.48 0-4.5 2.02-4.5 4.5S9.52 16 12 16s4.5-2.02 4.5-4.5S14.48 7 12 7z"}));function wt(){return Ot}var Ct=n.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},n.createElement("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}));function jt(){return Ct}var Pt=_,Et=lt,At=Ge,Dt=Ie},function(e,t,r){"use strict";var n;!function(e){function t(e,t,r){return{kind:"value",namespace:e,name:t,parent:r}}function r(e,t,r,n){for(var i=Object.create(null),a=0,o=n;a<o.length;a++){i[o[a]]=!0}return{kind:"oneof",namespace:e,name:t,type:r,values:i}}e.Variable=function(e,t,r){return{kind:"variable",name:e,type:t,isConstraint:r}},e.Value=t,e.Container=function(e,t,r,n){return{kind:"container",namespace:e,name:t,child:r,alias:n}},e.Union=function(e){return{kind:"union",types:e}},e.OneOf=r,e.Any={kind:"any"},e.AnyValue={kind:"any-value"},e.Num=t("","Number"),e.Str=t("","String"),e.Bool=r("","Bool",e.Str,["true","false"]),e.oneOfValues=function(e){var t=e.values;return Object.keys(t).sort()}}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"b",(function(){return a.a})),r.d(t,"a",(function(){return s.a})),r.d(t,"c",(function(){return l}));var n,i,a=r(266),o=r(320);(n||(n={})).Synchronous=o.a,function(e){e.format=function(e){return function e(t,r){void 0===r&&(r="");var n=t.progress;if(!t.children.length)return n.isIndeterminate?""+r+n.taskName+": "+n.message:""+r+n.taskName+": ["+n.current+"/"+n.max+"] "+n.message;var i=r+"  |_ ",a=t.children.map((function(t){return e(t,i)}));return n.isIndeterminate?""+r+n.taskName+": "+n.message+"\n"+a.join("\n"):""+r+n.taskName+": ["+n.current+"/"+n.max+"] "+n.message+"\n"+a.join("\n")}(e.root)}}(i||(i={}));var s=r(349),u=r(0);var c=r(75);function l(e,t,r,n,i){return Object(u.__awaiter)(this,void 0,void 0,(function(){var a,o,s,l,d,f,p;return Object(u.__generator)(this,(function(u){switch(u.label){case 0:if(a=Math.max(t,0),o=0,s=0,e.isSynchronous)return n(Number.MAX_SAFE_INTEGER,r),[2,r];l=Object(c.b)(),d=0,f=0,u.label=1;case 1:return(d=n(a,r))>0?(o+=d,p=Object(c.b)()-l,f+=p,s+=p,e.shouldUpdate?[4,i(e,r,o)]:[3,3]):[3,4];case 2:u.sent(),a=Math.round(f*o/s)+1,l=Object(c.b)(),f=0,u.label=3;case 3:return[3,1];case 4:return e.shouldUpdate?[4,i(e,r,o)]:[3,6];case 5:u.sent(),u.label=6;case 6:return[2,r]}}))}))}},function(e,t,r){"use strict";r.r(t),r.d(t,"ControlGroup",(function(){return s})),r.d(t,"TextInput",(function(){return c})),r.d(t,"ExpandableControlRow",(function(){return l})),r.d(t,"SectionHeader",(function(){return d})),r.d(t,"Button",(function(){return f})),r.d(t,"IconButton",(function(){return p})),r.d(t,"ToggleButton",(function(){return m})),r.d(t,"ExpandGroup",(function(){return h})),r.d(t,"ControlRow",(function(){return g}));var n=r(0),i=r(3),a=r(24),o=r(15),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!!t.props.initialExpanded},t.headerClicked=function(){t.props.onHeaderClick?t.props.onHeaderClick():t.setState({isExpanded:!t.state.isExpanded})},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props.hideOffset?"msp-control-group-children":"msp-control-group-children msp-control-offset";return this.props.childrenClassName&&(e+=" "+this.props.childrenClassName),i.createElement("div",{className:"msp-control-group-wrapper",style:{position:"relative",marginTop:this.props.noTopMargin?0:void 0}},i.createElement("div",{className:"msp-control-group-header",style:{marginLeft:this.props.headerLeftMargin},title:this.props.title},i.createElement(f,{onClick:this.headerClicked},!this.props.hideExpander&&i.createElement(o.Icon,{svg:this.state.isExpanded?o.ArrowRightSvg:o.ArrowDropDownSvg}),this.props.topRightIcon&&i.createElement(o.Icon,{svg:this.props.topRightIcon,style:{position:"absolute",right:"2px",top:0}}),i.createElement("b",null,this.props.header))),this.state.isExpanded&&i.createElement("div",{className:e,style:{display:this.state.isExpanded?"block":"none",maxHeight:this.props.maxHeight,overflow:"hidden",overflowY:"auto"}},this.props.children))},t}(i.Component);function u(e){return e}var c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.input=i.createRef(),t.delayHandle=void 0,t.pendingValue=void 0,t.state={originalValue:"",value:""},t.onBlur=function(){t.setState({value:""+t.state.originalValue}),t.props.onBlur&&t.props.onBlur()},t.raiseOnChange=function(){void 0!==t.pendingValue&&(t.props.onChange(t.pendingValue),t.pendingValue=void 0)},t.onChange=function(e){var r=e.target.value;if(t.props.isValid&&!t.props.isValid(r)||t.props.numeric&&Number.isNaN(+r))return t.clearTimeout(),void t.setState({value:r});if(t.props.numeric)t.setState({value:r},(function(){return t.triggerChanged(r,+r)}));else{var n=(t.props.toValue||u)(r),i=(t.props.fromValue||u)(n);t.setState({value:i},(function(){return t.triggerChanged(i,n)}))}},t.onKeyUp=function(e){27!==e.charCode&&27!==e.keyCode&&"Escape"!==e.key||t.props.blurOnEscape&&t.input.current&&t.input.current.blur()},t.onKeyPress=function(e){13!==e.keyCode&&13!==e.charCode&&"Enter"!==e.key||(t.isPending&&(t.clearTimeout(),t.raiseOnChange()),t.props.blurOnEnter&&t.input.current&&t.input.current.blur(),t.props.onEnter&&t.props.onEnter()),e.stopPropagation()},t}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"isPending",{get:function(){return void 0!==this.delayHandle},enumerable:!1,configurable:!0}),t.prototype.clearTimeout=function(){this.isPending&&(clearTimeout(this.delayHandle),this.delayHandle=void 0)},t.prototype.triggerChanged=function(e,t){this.clearTimeout(),e!==this.state.originalValue&&(this.props.delayMs?(this.pendingValue=t,this.delayHandle=setTimeout(this.raiseOnChange,this.props.delayMs)):this.props.onChange(t))},t.getDerivedStateFromProps=function(e,t){var r=e.fromValue?e.fromValue(e.value):e.value;return r===t.originalValue?null:{originalValue:r,value:r}},t.prototype.render=function(){return i.createElement("input",{type:"text",className:this.props.className,style:this.props.style,ref:this.input,onBlur:this.onBlur,value:this.state.value,placeholder:this.props.placeholder,onChange:this.onChange,onKeyPress:this.props.onEnter||this.props.blurOnEnter||this.props.blurOnEscape?this.onKeyPress:void 0,onKeyDown:this.props.blurOnEscape?this.onKeyUp:void 0,disabled:!!this.props.isDisabled})},t}(i.PureComponent),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.toggleExpanded=function(){return t.setState({isExpanded:!t.state.isExpanded})},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.label,r=e.pivot,n=e.controls;return i.createElement(i.Fragment,null,i.createElement(g,{label:i.createElement(i.Fragment,null,t,i.createElement("button",{className:"msp-btn-link msp-btn-icon msp-control-group-expander",onClick:this.toggleExpanded,title:(this.state.isExpanded?"Less":"More")+" options",style:{background:"transparent",textAlign:"left",padding:"0"}},i.createElement(o.Icon,{svg:this.state.isExpanded?o.RemoveSvg:o.AddSvg,style:{display:"inline-block"}}))),control:r},this.props.colorStripe&&i.createElement("div",{className:"msp-expandable-group-color-stripe",style:{backgroundColor:a.Color.toStyle(this.props.colorStripe)}})),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},n))},t}(i.Component);function d(e){return i.createElement("div",{className:"msp-section-header"+(e.accent?" msp-transform-header-brand-"+e.accent:"")},e.icon&&i.createElement(o.Icon,{svg:e.icon}),e.title," ",i.createElement("small",null,e.desc))}function f(e){var t="msp-btn";e.inline||(t+=" msp-btn-block"),e.noOverflow&&(t+=" msp-no-overflow"),e.flex&&(t+=" msp-flex-item"),("on"===e.commit||e.commit)&&(t+=" msp-btn-commit msp-btn-commit-on"),"off"===e.commit&&(t+=" msp-btn-commit msp-btn-commit-off"),e.children||(t+=" msp-btn-childless"),e.className&&(t+=" "+e.className);var r=void 0;return e.flex&&("number"==typeof e.flex?r={flex:"0 0 "+e.flex+"px",padding:0,maxWidth:e.flex+"px"}:"string"==typeof e.flex&&(r={flex:"0 0 "+e.flex,padding:0,maxWidth:e.flex})),e.style&&(r?Object.assign(r,e.style):r=e.style),i.createElement("button",{onClick:e.onClick,title:e.title,disabled:e.disabled,style:r,className:t,"data-id":e["data-id"],"data-color":e["data-color"],onContextMenu:e.onContextMenu,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave},e.icon&&i.createElement(o.Icon,{svg:e.icon}),e.children)}function p(e){var t="msp-btn msp-btn-icon"+(e.small?"-small":"")+(e.className?" "+e.className:"");void 0!==e.toggleState&&(t+=" msp-btn-link-toggle-"+(e.toggleState?"on":"off")),e.transparent&&(t+=" msp-transparent-bg");var r=void 0;return e.flex&&(r="boolean"==typeof e.flex?{flex:"0 0 32px",padding:0}:"number"==typeof e.flex?{flex:"0 0 "+e.flex+"px",padding:0,maxWidth:e.flex+"px"}:{flex:"0 0 "+e.flex,padding:0,maxWidth:e.flex}),e.style&&(r?Object.assign(r,e.style):r=e.style),i.createElement("button",{className:t,onClick:e.onClick,title:e.title,disabled:e.disabled,"data-id":e["data-id"],style:r},e.svg&&i.createElement(o.Icon,{svg:e.svg}),e.extraContent)}var m=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onClick=function(e){e.currentTarget.blur(),t.props.toggle()},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.label,r=e.isSelected?(e.className||"")+" msp-control-current":e.className;return i.createElement(f,{icon:this.props.icon,onClick:this.onClick,title:this.props.title,inline:this.props.inline,disabled:e.disabled,style:e.style,className:r},t&&this.props.isSelected?i.createElement("b",null,t):t)},t}(i.PureComponent),h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!!t.props.initiallyExpanded},t.toggleExpanded=function(){return t.setState({isExpanded:!t.state.isExpanded})},t}return Object(n.__extends)(t,e),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-control-group-header",style:{marginTop:void 0!==this.props.marginTop?this.props.marginTop:"1px",marginLeft:this.props.headerLeftMargin}},i.createElement("button",{className:"msp-btn msp-form-control msp-btn-block",onClick:this.toggleExpanded,style:this.props.headerStyle},i.createElement(o.Icon,{svg:this.state.isExpanded?o.ArrowDropDownSvg:o.ArrowRightSvg}),this.props.header)),this.state.isExpanded&&(this.props.noOffset?this.props.children:i.createElement("div",{className:this.props.accent?"msp-accent-offset":"msp-control-offset"},this.props.children)))},t}(i.PureComponent);function g(e){var t="msp-control-row";return e.className&&(t+=" "+e.className),i.createElement("div",{className:t},i.createElement("span",{className:"msp-control-row-label",title:e.title},e.label),i.createElement("div",{className:"msp-control-row-ctrl"},e.control),e.children)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return n})),r.d(t,"d",(function(){return o})),r.d(t,"c",(function(){return s})),r.d(t,"e",(function(){return u}));var n,i=r(142);function a(e,t){var r=t||{},n=r.description,i=void 0===n?void 0:n,a=r.isOptional,o=void 0!==a&&a,s=r.isRest,u=void 0!==s&&s,c=r.defaultValue;return{type:e,isOptional:o,isRest:u,defaultValue:void 0===c?void 0:c,description:i}}function o(e,t,r,n){var a=function(e){return i.a.Apply(i.a.Symbol(a.id),e)};return a.info={namespace:"",name:e,description:n},a.id="",a.args=t,a.type=r,a}function s(e,t,r,a){var o=function(e){return i.a.Apply(i.a.Symbol(o.id),e)};return o.info={namespace:e,name:t,description:a},o.id=e+"."+t,o.args=n.None,o.type=r,o}function u(e){var t=e;return"function"==typeof t&&!!t.info&&!!t.args&&"string"==typeof t.info.namespace&&!!t.type}!function(e){function t(e){return{kind:"dictionary",map:e,"@type":0}}e.None=t({}),e.Dictionary=t,e.List=function(e,t){var r=(t||{}).nonEmpty;return{kind:"list",type:e,nonEmpty:void 0!==r&&r,"@type":0}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return s})),r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(17);function o(e){return{data:e,position:0,length:e.length,lineNumber:1,tokenStart:0,tokenEnd:0}}function s(e,t,r){for(var n=t,i=r-1,a=e.charCodeAt(n);(9===a||32===a)&&n<=i;)a=e.charCodeAt(++n);for(a=e.charCodeAt(i);(9===a||32===a)&&i>=n;)a=e.charCodeAt(--i);return e.substring(n,i+1)}!function(e){function t(e){return e.data.substring(e.tokenStart,e.tokenEnd)}function r(e){for(var t=e.data;e.position<e.length;)switch(t.charCodeAt(e.position)){case 10:return e.tokenEnd=e.position,++e.position,++e.lineNumber,!0;case 13:return e.tokenEnd=e.position,++e.position,++e.lineNumber,10===t.charCodeAt(e.position)&&++e.position,!0;default:++e.position}return e.tokenEnd=e.position,e.tokenStart!==e.tokenEnd}function o(e){return e.tokenStart=e.position,r(e)}function s(e,t,r){for(var i=0,a=0;a<t;a++){if(!o(e))return i;n.addUnchecked(r,e.tokenStart,e.tokenEnd),i++}return i}e.getTokenString=t,e.reset=function(e){e.position=0,e.lineNumber=1,e.tokenStart=0,e.tokenEnd=0},e.eatLine=r,e.markStart=function(e){e.tokenStart=e.position},e.markLine=o,e.readLine=function(e){return o(e),t(e)},e.markLines=function(e,t){var r=n.create(e.data,2*t);return s(e,t,r),r},e.readLines=function(t,r){for(var n=[],i=0;i<r;i++)n.push(e.readLine(t));return n},e.readLinesAsync=function(e,t,r,o){return void 0===o&&(o=1e5),Object(i.__awaiter)(this,void 0,void 0,(function(){var u,c,l;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return u=e.length,c=n.create(e.data,2*t),l=0,[4,Object(a.c)(r,o,e,(function(e,r){var n=Math.min(t-l,e);return s(r,n,c),l+=n,n}),(function(e,t){return e.update({message:"Parsing...",current:t.position,max:u})}))];case 1:return i.sent(),[2,c]}}))}))},e.readAllLines=function(t){for(var r=e(t),i=n.create(r.data,Math.max(t.length/80,2));o(r);)n.add(i,r.tokenStart,r.tokenEnd);return i},e.readAllLinesAsync=function(t,r,s){return void 0===s&&(s=1e5),Object(i.__awaiter)(this,void 0,void 0,(function(){var u,c;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return u=e(t),c=n.create(u.data,Math.max(t.length/80,2)),[4,Object(a.c)(r,s,u,(function(e,t){return function(e,t,r){for(var i=0,a=0;a<t;a++){if(!o(e))return i;n.add(r,e.tokenStart,e.tokenEnd),i++}}(t,e,c),t.position<t.length?e:0}),(function(e,t){return e.update({message:"Parsing...",current:t.position,max:length})}))];case 1:return i.sent(),[2,c]}}))}))},e.eatValue=function(e){for(;e.position<e.length;)switch(e.data.charCodeAt(e.position)){case 9:case 10:case 13:case 32:return void(e.tokenEnd=e.position);default:++e.position}e.tokenEnd=e.position},e.skipWhitespace=function(e){for(var t=-1;e.position<e.length;){var r=e.data.charCodeAt(e.position);switch(r){case 9:case 32:t=r,++e.position;break;case 10:13!==t&&++e.lineNumber,t=r,++e.position;break;case 13:t=r,++e.position,++e.lineNumber;break;default:return t}}return t},e.trim=function(e,t,r){for(var n=e.data,i=t,a=r-1,o=n.charCodeAt(i);(9===o||32===o)&&i<=a;)o=n.charCodeAt(++i);for(o=n.charCodeAt(a);(9===o||32===o)&&a>=i;)o=n.charCodeAt(--a);return e.tokenStart=i,e.tokenEnd=a+1,e.position=r,e}}(o||(o={})),function(e){function t(e,t,r){var n=e;n.offset>n.indicesLenMinus2&&function(e){var t=new Uint32Array(1.61*e.indices.length|0);t.set(e.indices),e.indices=t,e.indicesLenMinus2=t.length-2|0}(n),n.indices[n.offset++]=t,n.indices[n.offset++]=r,e.count++}e.add=t,e.addToken=function(e,r){t(e,r.tokenStart,r.tokenEnd)},e.addUnchecked=function(e,t,r){e.indices[e.offset++]=t,e.indices[e.offset++]=r,e.count++},e.create=function(e,t){return{data:e,indicesLenMinus2:(t=Math.max(10,t))-2|0,count:0,offset:0,indices:new Uint32Array(t)}}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"ElementSymbol",(function(){return l})),r.d(t,"getElementFromAtomicNumber",(function(){return f})),r.d(t,"PolymerTypeAtomRoleId",(function(){return h})),r.d(t,"ProteinBackboneAtoms",(function(){return g})),r.d(t,"NucleicBackboneAtoms",(function(){return v})),r.d(t,"DProteinComponentTypeNames",(function(){return b})),r.d(t,"LProteinComponentTypeNames",(function(){return y})),r.d(t,"GammaProteinComponentTypeNames",(function(){return _})),r.d(t,"BetaProteinComponentTypeNames",(function(){return S})),r.d(t,"ProteinTerminusComponentTypeNames",(function(){return x})),r.d(t,"OtherProteinComponentTypeNames",(function(){return O})),r.d(t,"ProteinComponentTypeNames",(function(){return w})),r.d(t,"DNAComponentTypeNames",(function(){return C})),r.d(t,"RNAComponentTypeNames",(function(){return j})),r.d(t,"SaccharideComponentTypeNames",(function(){return P})),r.d(t,"OtherComponentTypeNames",(function(){return E})),r.d(t,"IonComponentTypeNames",(function(){return A})),r.d(t,"LipidComponentTypeNames",(function(){return D})),r.d(t,"WaterNames",(function(){return T})),r.d(t,"AminoAcidNamesL",(function(){return I})),r.d(t,"AminoAcidNamesD",(function(){return M})),r.d(t,"AminoAcidNames",(function(){return k})),r.d(t,"RnaBaseNames",(function(){return B})),r.d(t,"DnaBaseNames",(function(){return V})),r.d(t,"PeptideBaseNames",(function(){return R})),r.d(t,"PurineBaseNames",(function(){return L})),r.d(t,"PyrimidineBaseNames",(function(){return N})),r.d(t,"BaseNames",(function(){return F})),r.d(t,"isPurineBase",(function(){return U})),r.d(t,"isPyrimidineBase",(function(){return z})),r.d(t,"PolymerNames",(function(){return H})),r.d(t,"getMoleculeType",(function(){return G})),r.d(t,"getPolymerType",(function(){return q})),r.d(t,"getComponentType",(function(){return W})),r.d(t,"getDefaultChemicalComponent",(function(){return X})),r.d(t,"getEntityType",(function(){return Y})),r.d(t,"getEntitySubtype",(function(){return Q})),r.d(t,"isPolymer",(function(){return K})),r.d(t,"isNucleic",(function(){return Z})),r.d(t,"isProtein",(function(){return J})),r.d(t,"SecondaryStructureType",(function(){return p})),r.d(t,"MaxAsa",(function(){return ee})),r.d(t,"DefaultMaxAsa",(function(){return te})),r.d(t,"BondType",(function(){return $})),r.d(t,"ResidueHydrophobicity",(function(){return re})),r.d(t,"DefaultResidueHydrophobicity",(function(){return ne}));var n,i=r(214),a=r(184),o=r(96),s=new Set(["DAPC","DBPC","DFPC","DGPC","DIPC","DLPC","DNPC","DOPC","DPPC","DRPC","DTPC","DVPC","DXPC","DYPC","LPPC","PAPC","PEPC","PGPC","PIPC","POPC","PRPC","PUPC","DAPE","DBPE","DFPE","DGPE","DIPE","DLPE","DNPE","DOPE","DPPE","DRPE","DTPE","DUPE","DVPE","DXPE","DYPE","LPPE","PAPE","PGPE","PIPE","POPE","PQPE","PRPE","PUPE","DAPS","DBPS","DFPS","DGPS","DIPS","DLPS","DNPS","DOPS","DPPS","DRPS","DTPS","DUPS","DVPS","DXPS","DYPS","LPPS","PAPS","PGPS","PIPS","POPS","PQPS","PRPS","PUPS","DAPG","DBPG","DFPG","DGPG","DIPG","DLPG","DNPG","DOPG","DPPG","DRPG","DTPG","DVPG","DXPG","DYPG","LPPG","PAPG","PGPG","PIPG","POPG","PRPG","DAPA","DBPA","DFPA","DGPA","DIPA","DLPA","DNPA","DOPA","DPPA","DRPA","DTPA","DVPA","DXPA","DYPA","LPPA","PAPA","PGPA","PIPA","POPA","PRPA","PUPA","DPP","DPPI","PAPI","PIPI","POP","POPI","PUPI","PVP","PVPI","PADG","PIDG","PODG","PUDG","PVDG","APC","CPC","IPC","LPC","OPC","PPC","TPC","UPC","VPC","BNSM","DBSM","DPSM","DXSM","PGSM","PNSM","POSM","PVSM","XNSM","DPCE","DXCE","PNCE","XNCE","DMPC"]),u=new Set(["118","119","543","1AL","1CU","2FK","2HP","2OF","3CO","3MT","3NI","3OF","3P8","4MO","4PU","4TI","6MO","ACT","AG","AL","ALF","AM","ATH","AU","AU3","AUC","AZI","BA","BCT","BEF","BF4","BO4","BR","BS3","BSY","CA","CAC","CD","CD1","CD3","CD5","CE","CF","CHT","CL","CO","CO3","CO5","CON","CR","CS","CSB","CU","CU1","CU3","CUA","CUZ","CYN","DME","DMI","DSC","DTI","DY","E4N","EDR","EMC","ER3","EU","EU3","F","FE","FE2","FPO","GA","GD3","GEP","HAI","HG","HGC","IN","IOD","IR","IR3","IRI","IUM","K","KO4","LA","LCO","LCP","LI","LU","MAC","MG","MH2","MH3","MLI","MMC","MN","MN3","MN5","MN6","MO1","MO2","MO3","MO4","MO5","MO6","MOO","MOS","MOW","MW1","MW2","MW3","NA","NA2","NA5","NA6","NAO","NAW","NET","NH4","NI","NI1","NI2","NI3","NO2","NO3","NRU","O4M","OAA","OC1","OC2","OC3","OC4","OC5","OC6","OC7","OC8","OCL","OCM","OCN","OCO","OF1","OF2","OF3","OH","OS","OS4","OXL","PB","PBM","PD","PDV","PER","PI","PO3","PO4","PR","PT","PT4","PTN","RB","RH3","RHD","RU","SB","SCN","SE4","SEK","SM","SMO","SO3","SO4","SR","T1A","TB","TBA","TCN","TEA","TH","THE","TL","TMA","TRA","UNX","V","VN3","VO4","W","WO5","Y1","YB","YB2","YH","YT3","ZCM","ZN","ZN2","ZN3","ZNO","ZO3","ZR","NCO","OHX"]),c=function(){for(var e=Object.create(null),t=[],r="A".charCodeAt(0);r<="Z".charCodeAt(0);r++)t[t.length]=String.fromCharCode(r);for(r="a".charCodeAt(0);r<="z".charCodeAt(0);r++)t[t.length]=String.fromCharCode(r);for(r="0".charCodeAt(0);r<="9".charCodeAt(0);r++)t[t.length]=String.fromCharCode(r);for(var n=0,i=t;n<i.length;n++){var a=i[n];e[a]=a.toUpperCase();for(var o=0,s=t;o<s.length;o++){var u=s[o];e[a+u]=(a+u).toUpperCase();for(var c=0,l=t;c<l.length;c++){var d=l[c];e[a+u+d]=(a+u+d).toUpperCase()}}}return e}();function l(e){return c[e]||e.toUpperCase()}var d=new Map([[1,"H"],[2,"He"],[3,"Li"],[4,"Be"],[5,"B"],[6,"C"],[7,"N"],[8,"O"],[9,"F"],[10,"Ne"],[11,"Na"],[12,"Mg"],[13,"Al"],[14,"Si"],[15,"P"],[16,"S"],[17,"Cl"],[18,"Ar"],[19,"K"],[20,"Ca"],[21,"Sc"],[22,"Ti"],[23,"V"],[24,"Cr"],[25,"Mn"],[26,"Fe"],[27,"Co"],[28,"Ni"],[29,"Cu"],[30,"Zn"],[31,"Ga"],[32,"Ge"],[33,"As"],[34,"Se"],[35,"Br"],[36,"Kr"],[37,"Rb"],[38,"Sr"],[39,"Y"],[40,"Zr"],[41,"Nb"],[42,"Mo"],[43,"Tc"],[44,"Ru"],[45,"Rh"],[46,"Pd"],[47,"Ag"],[48,"Cd"],[49,"In"],[50,"Sn"],[51,"Sb"],[52,"Te"],[53,"I"],[54,"Xe"],[55,"Cs"],[56,"Ba"],[57,"La"],[58,"Ce"],[59,"Pr"],[60,"Nd"],[61,"Pm"],[62,"Sm"],[63,"Eu"],[64,"Gd"],[65,"Tb"],[66,"Dy"],[67,"Ho"],[68,"Er"],[69,"Tm"],[70,"Yb"],[71,"Lu"],[72,"Hf"],[73,"Ta"],[74,"W"],[75,"Re"],[76,"Os"],[77,"Ir"],[78,"Pt"],[79,"Au"],[80,"Hg"],[81,"Tl"],[82,"Pb"],[83,"Bi"],[84,"Po"],[85,"At"],[86,"Rn"],[87,"Fr"],[88,"Ra"],[89,"Ac"],[90,"Th"],[91,"Pa"],[92,"U"],[93,"Np"],[94,"Pu"],[95,"Am"],[96,"Cm"],[97,"Bk"],[98,"Cf"],[99,"Es"],[100,"Fm"],[101,"Md"],[102,"No"],[103,"Lr"],[104,"Rf"],[105,"Db"],[106,"Sg"],[107,"Bh"],[108,"Hs"],[109,"Mt"],[110,"Ds"],[111,"Rg"],[112,"Cn"],[113,"Uut"],[114,"Fl"],[115,"Uup"],[116,"Lv"],[117,"Uus"],[118,"Uuo"]].map((function(e){return[e[0],l(e[1])]})));function f(e){return d.has(e)?d.get(e):l("H")}var p,m,h=((n={})[0]={trace:new Set,directionFrom:new Set,directionTo:new Set,backboneStart:new Set,backboneEnd:new Set,coarseBackbone:new Set},n[1]={trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O","OC1","O1","OX1","OXT"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["C"]),coarseBackbone:new Set(["CA","BB","CA1"])},n[2]={trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CD"]),coarseBackbone:new Set(["CA"])},n[3]={trace:new Set(["CA"]),directionFrom:new Set(["C"]),directionTo:new Set(["O"]),backboneStart:new Set(["N"]),backboneEnd:new Set(["CG"]),coarseBackbone:new Set(["CA"])},n[4]={trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C4'","C4*"]),directionTo:new Set(["C3'","C3*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},n[5]={trace:new Set(["O3'","O3*"]),directionFrom:new Set(["C3'","C3*"]),directionTo:new Set(["C1'","C1*"]),backboneStart:new Set(["P"]),backboneEnd:new Set(["O3'","O3*"]),coarseBackbone:new Set(["P"])},n[6]={trace:new Set(["N4'","N4*"]),directionFrom:new Set(["N4'","N4*"]),directionTo:new Set(["C7'","C7*"]),backboneStart:new Set(["N1'","N1*"]),backboneEnd:new Set(["C'","C*"]),coarseBackbone:new Set(["P"])},n),g=new Set(["CA","C","N","O","O1","O2","OC1","OC2","OT1","OT2","OX1","OXT","H","H1","H2","H3","HA","HN","HXT","BB"]),v=new Set(["P","OP1","OP2","HOP2","HOP3","O2'","O3'","O4'","O5'","C1'","C2'","C3'","C4'","C5'","H1'","H2'","H2''","HO2'","H3'","H4'","H5'","H5''","HO3'","HO5'","O2*","O3*","O4*","O5*","C1*","C2*","C3*","C4*","C5*"]),b=new Set(["D-PEPTIDE LINKING","D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE COOH CARBOXY TERMINUS","D-GAMMA-PEPTIDE, C-DELTA LINKING","D-BETA-PEPTIDE, C-GAMMA LINKING"]),y=new Set(["L-PEPTIDE LINKING","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE COOH CARBOXY TERMINUS","L-GAMMA-PEPTIDE, C-DELTA LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING"]),_=new Set(["D-GAMMA-PEPTIDE, C-DELTA LINKING","L-GAMMA-PEPTIDE, C-DELTA LINKING"]),S=new Set(["D-BETA-PEPTIDE, C-GAMMA LINKING","L-BETA-PEPTIDE, C-GAMMA LINKING"]),x=new Set(["D-PEPTIDE NH3 AMINO TERMINUS","D-PEPTIDE COOH CARBOXY TERMINUS","L-PEPTIDE NH3 AMINO TERMINUS","L-PEPTIDE COOH CARBOXY TERMINUS"]),O=new Set(["PEPTIDE LINKING","PEPTIDE-LIKE"]),w=o.a.unionMany(b,y,O),C=new Set(["DNA LINKING","L-DNA LINKING","DNA OH 5 PRIME TERMINUS","DNA OH 3 PRIME TERMINUS"]),j=new Set(["RNA LINKING","L-RNA LINKING","RNA OH 5 PRIME TERMINUS","RNA OH 3 PRIME TERMINUS"]),P=new Set(["D-SACCHARIDE, BETA LINKING","L-SACCHARIDE, BETA LINKING","D-SACCHARIDE, ALPHA LINKING","L-SACCHARIDE, ALPHA LINKING","L-SACCHARIDE","D-SACCHARIDE","SACCHARIDE","D-SACCHARIDE 1,4 AND 1,4 LINKING","L-SACCHARIDE 1,4 AND 1,4 LINKING","D-SACCHARIDE 1,4 AND 1,6 LINKING","L-SACCHARIDE 1,4 AND 1,6 LINKING"]),E=new Set(["NON-POLYMER","OTHER"]),A=new Set(["ION"]),D=new Set(["LIPID"]),T=new Set(["SOL","WAT","HOH","H2O","W","DOD","D3O","TIP","TIP3","TIP4","SPC"]),I=new Set(["HIS","ARG","LYS","ILE","PHE","LEU","TRP","ALA","MET","PRO","CYS","ASN","VAL","GLY","SER","GLN","TYR","ASP","GLU","THR","SEC","PYL","UNK"]),M=new Set(["DAL","DAR","DSG","DAS","DCY","DGL","DGN","DHI","DIL","DLE","DLY","MED","DPN","DPR","DSN","DTH","DTR","DTY","DVA","DNE"]),k=o.a.unionMany(I,M),B=new Set(["A","C","T","G","I","U","N"]),V=new Set(["DA","DC","DT","DG","DI","DU","DN"]),R=new Set(["APN","CPN","TPN","GPN"]),L=new Set(["A","G","I","DA","DG","DI","APN","GPN"]),N=new Set(["C","T","U","DC","DT","DU","CPN","TPN"]),F=o.a.unionMany(B,V,R),U=function(e){return L.has(e.toUpperCase())},z=function(e){return N.has(e.toUpperCase())},H=o.a.unionMany(k,F);function G(e,t){return e=e.toUpperCase(),t=t.toUpperCase(),R.has(t)?8:w.has(e)?5:j.has(e)?6:C.has(e)?7:P.has(e)?9:T.has(t)?2:u.has(t)?3:s.has(t)?4:E.has(e)?a.c.has(t)?9:1:0}function q(e,t){return e=e.toUpperCase(),5===t?_.has(e)?2:S.has(e)?3:x.has(e)?0:1:6===t?4:7===t?5:8===t?6:0}function W(e){return e=e.toUpperCase(),k.has(e)?"peptide linking":B.has(e)?"RNA linking":V.has(e)?"DNA linking":a.c.has(e)?"saccharide":"other"}function X(e){return{formula:"",formula_weight:0,id:e,name:e,mon_nstd_flag:H.has(e)?"y":"n",pdbx_synonyms:[],type:W(e)}}function Y(e){return e=e.toUpperCase(),T.has(e)?"water":H.has(e)?"polymer":a.c.has(e)?"branched":"non-polymer"}function Q(e,t){return e=e.toUpperCase(),t=t.toUpperCase(),y.has(t)?"polypeptide(L)":b.has(t)?"polypeptide(D)":j.has(t)?"polyribonucleotide":C.has(t)?"polydeoxyribonucleotide":P.has(t)||a.c.has(e)?"oligosaccharide":R.has(e)?"peptide nucleic acid":I.has(e)?"polypeptide(L)":M.has(e)?"polypeptide(D)":B.has(e)?"polyribonucleotide":V.has(e)?"polydeoxyribonucleotide":A.has(t)||u.has(e)?"ion":D.has(t)||s.has(e)?"lipid":O.has(t)?"peptide-like":"other"}function K(e){return Z(e)||J(e)}function Z(e){return 7===e||6===e||8===e}function J(e){return 5===e}(m=p||(p={})).is=i.a.has,m.create=i.a.create,m.SecondaryStructureMmcif={HELX_LH_27_P:1058,HELX_LH_3T_P:2082,HELX_LH_AL_P:4130,HELX_LH_A_N:524321,HELX_LH_B_N:1048609,HELX_LH_GA_P:8226,HELX_LH_N:33,HELX_LH_OM_P:16418,HELX_LH_OT_N:131105,HELX_LH_OT_P:546,HELX_LH_P:34,HELX_LH_PI_P:32802,HELX_LH_PP_P:65570,HELX_LH_Z_N:262177,HELX_N:1,HELX_OT_N:1,HELX_OT_P:2,HELX_P:2,HELX_RH_27_P:1090,HELX_RH_3T_P:2114,HELX_RH_AL_P:4162,HELX_RH_A_N:524353,HELX_RH_B_N:1048641,HELX_RH_GA_P:8258,HELX_RH_N:65,HELX_RH_OM_P:16450,HELX_RH_OT_N:131137,HELX_RH_OT_P:578,HELX_RH_P:66,HELX_RH_PI_P:32834,HELX_RH_PP_P:65602,HELX_RH_Z_N:262209,STRN:4194308,TURN_OT_P:33554448,TURN_P:16,TURN_TY1P_P:67109136,TURN_TY1_P:67109008,TURN_TY2P_P:134218e3,TURN_TY2_P:134217872,TURN_TY3P_P:268435728,TURN_TY3_P:268435600},m.SecondaryStructurePdb={1:4162,2:16450,3:32834,4:8258,5:2114,6:4130,7:16418,8:8226,9:1026,10:65538},m.SecondaryStructureStride={H:4098,G:2050,I:32770,E:8388612,B:4194308,T:16,C:536870912},m.SecondaryStructureDssp={H:4098,B:4194308,E:8388612,G:2050,I:32770,T:16,S:8};var $,ee={ALA:121,ARG:265,ASN:187,ASP:187,CYS:148,GLU:214,GLN:214,GLY:97,HIS:216,ILE:195,LEU:191,LYS:230,MET:203,PHE:228,PRO:154,SER:143,THR:163,TRP:264,TYR:255,VAL:165},te=121;!function(e){function t(e){switch(e){case"covalent":return 1;case"metal-coordination":return 2;case"hydrogen-bond":return 4;case"disulfide":return 8;case"aromatic":return 16;case"computed":return 32}}e.is=i.a.has,e.create=function(e){return i.a.create(e)},e.isCovalent=function(e){return 0!=(1&e)},e.isAll=function(e){return e===Math.pow(2,6)-1},e.Names={covalent:1,"metal-coordination":2,"hydrogen-bond":4,disulfide:4,aromatic:4,computed:4},e.isName=function(t){return t in e.Names},e.fromName=t,e.fromNames=function(e){for(var r=0,n=0,i=e.length;n<i;++n)r|=t(e[n]);return r}}($||($={}));var re={ALA:[.17,.5,.33],ARG:[.81,1.81,1],ASN:[.42,.85,.43],ASP:[1.23,3.64,2.41],ASH:[-.07,.43,.5],CYS:[-.24,-.02,.22],GLN:[.58,.77,.19],GLU:[2.02,3.63,1.61],GLH:[-.01,.11,.12],GLY:[.01,1.15,1.14],HIS:[.17,.11,-.06],ILE:[-.31,-1.12,-.81],LEU:[-.56,-1.25,-.69],LYS:[.99,2.8,1.81],MET:[-.23,-.67,-.44],PHE:[-1.13,-1.71,-.58],PRO:[.45,.14,-.31],SER:[.13,.46,.33],THR:[.14,.25,.11],TRP:[-1.85,-2.09,-.24],TYR:[-.94,-.71,.23],VAL:[.07,-.46,-.53]},ne=[0,0,0]},function(e,t,r){"use strict";r.r(t),r.d(t,"EveryLoci",(function(){return m})),r.d(t,"isEveryLoci",(function(){return h})),r.d(t,"EmptyLoci",(function(){return v})),r.d(t,"isEmptyLoci",(function(){return b})),r.d(t,"isDataLoci",(function(){return y})),r.d(t,"areDataLociEqual",(function(){return _})),r.d(t,"isDataLociEmpty",(function(){return S})),r.d(t,"DataLoci",(function(){return x})),r.d(t,"Loci",(function(){return g}));var n=r(4),i=r(163),a=r(54),o=r(9),s=r(1),u=r(28),c=r(2),l=r(5),d=r(128),f=r(42),p=r(147),m={kind:"every-loci"};function h(e){return!!e&&"every-loci"===e.kind}var g,v={kind:"empty-loci"};function b(e){return!!e&&"empty-loci"===e.kind}function y(e){return!!e&&"data-loci"===e.kind}function _(e,t){if(!Object(l.k)(e.data,t.data)||e.tag!==t.tag)return!1;if(e.elements.length!==t.elements.length)return!1;for(var r=0,n=e.elements.length;r<n;++r)if(!Object(l.k)(e.elements[r],t.elements[r]))return!1;return!0}function S(e){return 0===e.elements.length}function x(e,t,r,n,i){return{kind:"data-loci",tag:e,data:t,elements:r,getBoundingSphere:n,getLabel:i}}!function(e){var t=new d.a("98");function r(e,t){if("every-loci"!==e.kind&&"empty-loci"!==e.kind)return t||(t=Object(o.g)()),"structure-loci"===e.kind?o.g.copy(t,e.structure.boundary.sphere):"element-loci"===e.kind?o.g.copy(t,n.StructureElement.Loci.getBoundary(e).sphere):"bond-loci"===e.kind?i.a.getBoundingSphere(e,t):"shape-loci"===e.kind?o.g.copy(t,e.shape.geometry.boundingSphere):"group-loci"===e.kind?a.b.getBoundingSphere(e,t):"data-loci"===e.kind?e.getBoundingSphere(t):"volume-loci"===e.kind?p.a.getBoundingSphere(e.volume,t):"isosurface-loci"===e.kind?p.a.Isosurface.getBoundingSphere(e.volume,e.isoValue,t):"cell-loci"===e.kind?p.a.Cell.getBoundingSphere(e.volume,e.indices,t):void 0}e.getBundleBoundingSphere=function(e){var n=e.loci.map((function(e){return r(e)})).filter((function(e){return!!e}));t.reset();for(var i=0,a=n;i<a.length;i++){var o=a[i];t.includePositionRadius(o.center,o.radius)}t.finishedIncludeStep();for(var s=0,u=n;s<u.length;s++){o=u[s];t.radiusPositionRadius(o.center,o.radius)}return t.getSphere()},e.areEqual=function(e,t){return!(!h(e)||!h(t))||(!(!b(e)||!b(t))||(y(e)&&y(t)?_(e,t):u.c.isLoci(e)&&u.c.isLoci(t)?u.c.areLociEqual(e,t):n.StructureElement.Loci.is(e)&&n.StructureElement.Loci.is(t)?n.StructureElement.Loci.areEqual(e,t):i.a.isLoci(e)&&i.a.isLoci(t)?i.a.areLociEqual(e,t):a.a.isLoci(e)&&a.a.isLoci(t)?a.a.areLociEqual(e,t):a.b.isLoci(e)&&a.b.isLoci(t)?a.b.areLociEqual(e,t):p.a.isLoci(e)&&p.a.isLoci(t)?p.a.areLociEqual(e,t):p.a.Isosurface.isLoci(e)&&p.a.Isosurface.isLoci(t)?p.a.Isosurface.areLociEqual(e,t):!(!p.a.Cell.isLoci(e)||!p.a.Cell.isLoci(t))&&p.a.Cell.areLociEqual(e,t)))},e.isEvery=function(e){return!!e&&"every-loci"===e.kind},e.isEmpty=function(e){return!h(e)&&(!!b(e)||(y(e)?S(e):u.c.isLoci(e)?u.c.isLociEmpty(e):n.StructureElement.Loci.is(e)?n.StructureElement.Loci.isEmpty(e):i.a.isLoci(e)?i.a.isLociEmpty(e):a.a.isLoci(e)?a.a.isLociEmpty(e):a.b.isLoci(e)?a.b.isLociEmpty(e):p.a.isLoci(e)?p.a.isLociEmpty(e):p.a.Isosurface.isLoci(e)?p.a.Isosurface.isLociEmpty(e):!!p.a.Cell.isLoci(e)&&p.a.Cell.isLociEmpty(e)))},e.remap=function(e,t){return t instanceof u.c&&(n.StructureElement.Loci.is(e)?e=n.StructureElement.Loci.remap(e,t):u.c.isLoci(e)?e=u.c.remapLoci(e,t):i.a.isLoci(e)&&(e=i.a.remapLoci(e,t))),e},e.getBoundingSphere=r;var l=o.g.zero();e.getCenter=function(e,t){var n=r(e,l);return n?s.Vec3.copy(t||Object(s.Vec3)(),n.center):void 0},e.getPrincipalAxes=function(e){if("every-loci"!==e.kind&&"empty-loci"!==e.kind)return"structure-loci"===e.kind?n.StructureElement.Loci.getPrincipalAxes(u.c.toStructureElementLoci(e.structure)):"element-loci"===e.kind?n.StructureElement.Loci.getPrincipalAxes(e):void("bond-loci"!==e.kind&&"shape-loci"!==e.kind&&"group-loci"!==e.kind&&"data-loci"!==e.kind&&"volume-loci"!==e.kind&&"isosurface-loci"!==e.kind&&e.kind)};var m={element:function(e){return e},residue:function(e){return n.StructureElement.Loci.is(e)?n.StructureElement.Loci.extendToWholeResidues(e,!0):e},chain:function(e){return n.StructureElement.Loci.is(e)?n.StructureElement.Loci.extendToWholeChains(e):e},entity:function(e){return n.StructureElement.Loci.is(e)?n.StructureElement.Loci.extendToWholeEntities(e):e},model:function(e){return n.StructureElement.Loci.is(e)?n.StructureElement.Loci.extendToWholeModels(e):e},structure:function(e){return n.StructureElement.Loci.is(e)?u.c.toStructureElementLoci(e.structure):a.b.isLoci(e)?a.a.Loci(e.shape):e},elementInstances:function(e){return n.StructureElement.Loci.is(e)?n.StructureElement.Loci.extendToAllInstances(e):e},residueInstances:function(e){return n.StructureElement.Loci.is(e)?n.StructureElement.Loci.extendToAllInstances(n.StructureElement.Loci.extendToWholeResidues(e,!0)):e},chainInstances:function(e){return n.StructureElement.Loci.is(e)?n.StructureElement.Loci.extendToAllInstances(n.StructureElement.Loci.extendToWholeChains(e)):e}};function g(e,t){return m[t](e)}e.GranularityOptions=c.ParamDefinition.objectToOptions(m,(function(e){switch(e){case"element":return"Atom/Coarse Element";case"elementInstances":return["Atom/Coarse Element Instances","With Symmetry"];case"structure":return"Structure/Shape";default:return e.indexOf("Instances")?[Object(f.d)(e),"With Symmetry"]:Object(f.d)(e)}})),e.simpleGranularity=function(e){return e.replace("Instances","")},e.applyGranularity=g,e.normalize=function(e,t){return"element"!==t&&i.a.isLoci(e)&&(e=i.a.toStructureElementLoci(e)),u.c.isLoci(e)&&(e=u.c.toStructureElementLoci(e.structure)),n.StructureElement.Loci.is(e)&&(e=n.StructureElement.Loci.remap(e,e.structure.root)),t&&(e=g(e,t)),e}}(g||(g={}))},function(e,t,r){"use strict";r.r(t);var n=r(46);r.d(t,"Color",(function(){return n.Color})),r.d(t,"ColorMap",(function(){return n.ColorMap})),r.d(t,"ColorTable",(function(){return n.ColorTable}));var i=r(347);r.d(t,"ColorScale",(function(){return i.a}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return n.a})),r.d(t,"b",(function(){return a})),r.d(t,"e",(function(){return s})),r.d(t,"f",(function(){return u.a})),r.d(t,"g",(function(){return l})),r.d(t,"d",(function(){return p})),r.d(t,"a",(function(){return d.a}));var n=r(107);function i(){return i.zero()}!function(e){function t(){var e=[.1,0,0,0,0,0,0,0,0];return e[0]=0,e}function r(){var e=t();return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}e.zero=t,e.identity=r,e.setIdentity=function(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t[r+4]=e[4],t[r+5]=e[5],t[r+6]=e[6],t[r+7]=e[7],t[r+8]=e[8],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e[4]=t[r+4],e[5]=t[r+5],e[6]=t[r+6],e[7]=t[r+7],e[8]=t[r+8],e},e.fromMat4=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[4],e[4]=t[5],e[5]=t[6],e[6]=t[8],e[7]=t[9],e[8]=t[10],e},e.create=function(e,r,n,i,a,o,s,u,c){var l=t();return l[0]=e,l[1]=r,l[2]=n,l[3]=i,l[4]=a,l[5]=o,l[6]=s,l[7]=u,l[8]=c,l};var n=r();function i(e,t,r){for(var n=0;n<9;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}function a(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8];return t*(c*a-o*u)+r*(-c*i+o*s)+n*(u*i-a*s)}function o(e){return e[0]+e[4]+e[8]}function s(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e}function c(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e}e.isIdentity=function(e,t){return i(e,n,void 0===t?d.a:t)},e.hasNaN=function(e){for(var t=0;t<9;t++)if(isNaN(e[t]))return!0;return!1},e.clone=function(t){return e.copy(e.zero(),t)},e.areEqual=i,e.setValue=function(e,t,r,n){e[3*r+t]=n},e.getValue=function(e,t,r){return e[3*r+t]},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},e.transpose=function(e,t){if(e===t){var r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e},e.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],d=l*o-s*c,f=-l*a+s*u,p=c*a-o*u,m=r*d+n*f+i*p;return m?(m=1/m,e[0]=d*m,e[1]=(-l*n+i*c)*m,e[2]=(s*n-i*o)*m,e[3]=f*m,e[4]=(l*r-i*u)*m,e[5]=(-s*r+i*a)*m,e[6]=p*m,e[7]=(-c*r+n*u)*m,e[8]=(o*r-n*a)*m,e):(console.warn("non-invertible matrix.",t),e)},e.symmtricFromUpper=function(e,t){return e===t?(e[3]=t[1],e[6]=t[2],e[7]=t[5]):(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[1],e[4]=t[4],e[5]=t[5],e[6]=t[2],e[7]=t[5],e[8]=t[8]),e},e.symmtricFromLower=function(e,t){return e===t?(e[1]=t[3],e[2]=t[6],e[5]=t[7]):(e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[3],e[4]=t[4],e[5]=t[7],e[6]=t[6],e[7]=t[7],e[8]=t[8]),e},e.determinant=a,e.trace=o,e.sub=s,e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e},e.mul=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],d=t[8],f=r[0],p=r[1],m=r[2],h=r[3],g=r[4],v=r[5],b=r[6],y=r[7],_=r[8];return e[0]=f*n+p*o+m*c,e[1]=f*i+p*s+m*l,e[2]=f*a+p*u+m*d,e[3]=h*n+g*o+v*c,e[4]=h*i+g*s+v*l,e[5]=h*a+g*u+v*d,e[6]=b*n+y*o+_*c,e[7]=b*i+y*s+_*l,e[8]=b*a+y*u+_*d,e},e.subScalar=function(e,t,r){return e[0]=t[0]-r,e[1]=t[1]-r,e[2]=t[2]-r,e[3]=t[3]-r,e[4]=t[4]-r,e[5]=t[5]-r,e[6]=t[6]-r,e[7]=t[7]-r,e[8]=t[8]-r,e},e.addScalar=function(e,t,r){return e[0]=t[0]+r,e[1]=t[1]+r,e[2]=t[2]+r,e[3]=t[3]+r,e[4]=t[4]+r,e[5]=t[5]+r,e[6]=t[6]+r,e[7]=t[7]+r,e[8]=t[8]+r,e},e.mulScalar=c;var l=Math.PI/3,f=e();e.symmetricEigenvalues=function(t,r){var n=r[1]*r[1]+r[2]*r[2]+r[5]*r[5];if(0===n)t[0]=r[0],t[1]=r[4],t[2]=r[8];else{var i=o(r)/3,u=r[0]-i,d=r[4]-i,p=r[8]-i,m=u*u+d*d+p*p+2*n,h=Math.sqrt(m/6);c(f,e.Identity,i),s(f,r,f),c(f,f,1/h);var g=a(f)/2,v=g<=-1?l:g>=1?0:Math.acos(g)/3;t[0]=i+2*h*Math.cos(v),t[2]=i+2*h*Math.cos(v+2*l),t[1]=3*i-t[0]-t[2]}return t};var p=[.1,0,0],m=[.1,0,0],h=[.1,0,0],g=[.1,0,0],v=[.1,0,0],b=[.1,0,0];e.eigenvector=function(e,t,r){u.a.set(p,t[0]-r,t[1],t[2]),u.a.set(m,t[1],t[4]-r,t[5]),u.a.set(h,t[2],t[5],t[8]-r),u.a.cross(g,p,m),u.a.cross(v,p,h),u.a.cross(b,m,h);var n=u.a.dot(g,g),i=u.a.dot(v,v),a=u.a.dot(b,b),o=n,s=0;return i>o&&(o=i,s=1),a>o&&(s=2),0===s?u.a.scale(e,g,1/Math.sqrt(n)):1===s?u.a.scale(e,v,1/Math.sqrt(i)):u.a.scale(e,b,1/Math.sqrt(a)),e},e.directionTransform=function(t,r){return e.fromMat4(t,r),e.invert(t,t),e.transpose(t,t),t},e.Identity=r()}(i||(i={}));var a=i;function o(){return o.zero()}!function(e){function t(){var e=[.1,0];return e[0]=0,e}e.zero=t,e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r},e.create=function(e,r){var n=t();return n[0]=e,n[1]=r,n},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e},e.set=function(e,t,r){return e[0]=t,e[1]=r,e},e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e},e.sub=function(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e},e.mul=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e},e.div=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e},e.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e},e.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e},e.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e},e.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e},e.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)},e.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1];return r*r+n*n},e.magnitude=function(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)},e.squaredMagnitude=function(e){var t=e[0],r=e[1];return t*t+r*r},e.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e},e.areEqual=function(e,t){return e[0]===t[0]&&e[1]===t[1]},e.toString=function(e,t){return"["+e[0].toPrecision(t)+" "+e[1].toPrecision(t)+"}]"}}(o||(o={}));var s=o,u=r(97);function c(){return c.zero()}!function(e){function t(){var e=[.1,0,0,0];return e[0]=0,e}function r(e,t){return e[0]=t.center[0],e[1]=t.center[1],e[2]=t.center[2],e[3]=t.radius,e}e.zero=t,e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},e.create=function(e,r,n,i){var a=t();return a[0]=e,a[1]=r,a[2]=n,a[3]=i,a},e.fromSphere=r,e.ofSphere=function(e){return r(t(),e)},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])||isNaN(e[2])||isNaN(e[3])},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e},e.toVec3Array=function(e,t,r){t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2]},e.fromVec3Array=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=0,e},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.set=function(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e},e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},e.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return Math.sqrt(r*r+n*n+i*i+a*a)},e.scale=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[4]=t[4]*r,e},e.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e},e.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e},e.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e},e.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],a=t[3]-e[3];return r*r+n*n+i*i+a*a},e.norm=function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)},e.squaredNorm=function(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i},e.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*a+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*a+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*a+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*a+r[15]*o,e},e.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},e.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e},e.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]},e.equals=function(e,t){var r=e[0],n=e[1],i=e[2],a=e[3],o=t[0],s=t[1],u=t[2],c=t[3];return Math.abs(r-o)<=d.a*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=d.a*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-u)<=d.a*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-c)<=d.a*Math.max(1,Math.abs(a),Math.abs(c))},e.toString=function(e,t){return"["+e[0].toPrecision(t)+" "+e[1].toPrecision(t)+" "+e[2].toPrecision(t)+"  "+e[3].toPrecision(t)+"]"}}(c||(c={}));var l=c,d=r(69);function f(){return f.zero()}!function(e){function t(){var e=[.1,0,0,0];return e[0]=0,e}function r(){var e=t();return e[3]=1,e}function n(e,t,r){r*=.5;var n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function i(e,t,r,n){var i,a,o,s,u,c=t[0],l=t[1],d=t[2],f=t[3],p=r[0],m=r[1],h=r[2],g=r[3];return(a=c*p+l*m+d*h+f*g)<0&&(a=-a,p=-p,m=-m,h=-h,g=-g),1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,u=Math.sin(n*i)/o):(s=1-n,u=n),e[0]=s*c+u*p,e[1]=s*l+u*m,e[2]=s*d+u*h,e[3]=s*f+u*g,e}e.zero=t,e.identity=r,e.setIdentity=function(e){e[0]=0,e[1]=0,e[2]=0,e[3]=1},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])||isNaN(e[2])||isNaN(e[3])},e.create=function(e,t,n,i){var a=r();return a[0]=e,a[1]=t,a[2]=n,a[3]=i,a},e.setAxisAngle=n,e.getAxisAngle=function(e,t){var r=2*Math.acos(t[3]),n=Math.sin(r/2);return 0!==n?(e[0]=t[0]/n,e[1]=t[1]/n,e[2]=t[2]/n):(e[0]=1,e[1]=0,e[2]=0),r},e.multiply=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=r[0],u=r[1],c=r[2],l=r[3];return e[0]=n*l+o*s+i*c-a*u,e[1]=i*l+o*u+a*s-n*c,e[2]=a*l+o*c+n*u-i*s,e[3]=o*l-n*s-i*u-a*c,e},e.rotateX=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+o*s,e[1]=i*u+a*s,e[2]=a*u-i*s,e[3]=o*u-n*s,e},e.rotateY=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u-a*s,e[1]=i*u+o*s,e[2]=a*u+n*s,e[3]=o*u-i*s,e},e.rotateZ=function(e,t,r){r*=.5;var n=t[0],i=t[1],a=t[2],o=t[3],s=Math.sin(r),u=Math.cos(r);return e[0]=n*u+i*s,e[1]=i*u-n*s,e[2]=a*u+o*s,e[3]=o*u-a*s,e},e.calculateW=function(e,t){var r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e},e.slerp=i,e.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a,s=o?1/o:0;return e[0]=-r*s,e[1]=-n*s,e[2]=-i*s,e[3]=a*s,e},e.conjugate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e},e.fromMat3=function(e,t){var r,n=t[0]+t[4]+t[8];if(n>0)r=Math.sqrt(n+1),e[3]=.5*r,r=.5/r,e[0]=(t[5]-t[7])*r,e[1]=(t[6]-t[2])*r,e[2]=(t[1]-t[3])*r;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(t[3*i+i]-t[3*a+a]-t[3*o+o]+1),e[i]=.5*r,r=.5/r,e[3]=(t[3*a+o]-t[3*o+a])*r,e[a]=(t[3*a+i]+t[3*i+a])*r,e[o]=(t[3*o+i]+t[3*i+o])*r}return e};var o=Object(u.a)();function s(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r*r+n*n+i*i+a*a;return o>0&&(o=1/Math.sqrt(o),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=a*o),e}e.fromUnitVec3=function(e,t,r){var n=u.a.dot(t,r)+1;return n<d.a?(n=0,Math.abs(t[0])>Math.abs(t[2])?u.a.set(o,-t[1],t[0],0):u.a.set(o,0,-t[2],t[1])):u.a.cross(o,t,r),e[0]=o[0],e[1]=o[1],e[2]=o[2],e[3]=n,s(e,e),e},e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},e.set=function(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e},e.add=function(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e},e.normalize=s;var c=Object(u.a)(),l=u.a.create(1,0,0),f=u.a.create(0,1,0);e.rotationTo=function(e,t,r){var i=u.a.dot(t,r);return i<-.999999?(u.a.cross(c,l,t),u.a.magnitude(c)<1e-6&&u.a.cross(c,f,t),u.a.normalize(c,c),n(e,c,Math.PI),e):i>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(u.a.cross(c,t,r),e[0]=c[0],e[1]=c[1],e[2]=c[2],e[3]=1+i,s(e,e))};var p=e(),m=e();e.sqlerp=function(e,t,r,n,a,o){return i(p,t,a,o),i(m,r,n,o),i(e,p,m,2*o*(1-o)),e};var h=a();e.setAxes=function(t,r,n,i){return h[0]=n[0],h[3]=n[1],h[6]=n[2],h[1]=i[0],h[4]=i[1],h[7]=i[2],h[2]=-r[0],h[5]=-r[1],h[8]=-r[2],s(t,e.fromMat3(t,h))},e.toString=function(e,t){return"["+e[0].toPrecision(t)+" "+e[1].toPrecision(t)+" "+e[2].toPrecision(t)+"  "+e[3].toPrecision(t)+"]"},e.Identity=r()}(f||(f={}));var p=f},function(e,t,r){"use strict";r.d(t,"a",(function(){return fe})),r.d(t,"b",(function(){return i.b})),r.d(t,"c",(function(){return i.c})),r.d(t,"d",(function(){return i.f}));var n=r(0),i=r(162),a=r(21),o=r(83),s=r(17);function u(e){for(;e.position<e.length;)switch(e.data.charCodeAt(e.position)){case 9:case 10:case 13:case 32:return void(e.tokenEnd=e.position);default:++e.position}e.tokenEnd=e.position}function c(e){return!(e.length-e.position<2)&&(39===e.data.charCodeAt(e.position+1)&&39===e.data.charCodeAt(e.position+2))}function l(e,t,r){var n,i=r-t,a=e.tokenStart-t,o=e.tokenEnd-e.tokenStart;if(o<i)return!1;for(n=t;n<r;++n)if(e.data.charCodeAt(n)!==e.data.charCodeAt(n+a))return!1;return i===o||46===e.data.charCodeAt(n+a)}function d(e){var t;for(t=e.tokenStart;t<e.tokenEnd;++t)if(46===e.data.charCodeAt(t))return t;return t}function f(e,t){return e.data.substring(e.tokenStart,t)}function p(e){return e.data.substring(e.tokenStart,e.tokenEnd)}function m(e){var t=function(e){for(var t=10;e.position<e.length;){var r=e.data.charCodeAt(e.position);switch(r){case 9:case 32:t=r,++e.position;break;case 10:13!==t&&++e.lineNumber,t=r,++e.position;break;case 13:t=r,++e.position,++e.lineNumber;break;default:return t}}return t}(e);if(e.position>=e.length)e.tokenType=6;else{e.tokenStart=e.position,e.tokenEnd=e.position,e.isEscaped=!1;var r=e.data.charCodeAt(e.position);switch(r){case 35:!function(e){for(;e.position<e.length;){var t=e.data.charCodeAt(e.position);if(10===t||13===t)return;++e.position}}(e),e.tokenType=5;break;case 39:if(c(e)){!function(e){for(e.position+=3;e.position<e.length;){if(39===e.data.charCodeAt(e.position)&&c(e))return e.tokenStart+=3,e.tokenEnd=e.position,e.isEscaped=!0,void(e.position+=3);++e.position}e.tokenEnd=e.position}(e),e.tokenType=3;break}case 34:!function(e,t){var r,n;for(++e.position;e.position<e.length;)if((n=e.data.charCodeAt(e.position))===t)switch(r=e.data.charCodeAt(e.position+1)){case 9:case 10:case 13:case 32:return e.tokenStart++,e.tokenEnd=e.position,e.isEscaped=!0,void++e.position;default:if(void 0===r)return e.tokenStart++,e.tokenEnd=e.position,e.isEscaped=!0,void++e.position;++e.position}else{if(10===n||13===n)return void(e.tokenEnd=e.position);++e.position}e.tokenEnd=e.position}(e,r),e.tokenType=3;break;case 59:10===t||13===t?function(e){for(var t,r=59,n=e.position+1;n<e.length;){if(59===(t=e.data.charCodeAt(n))&&(10===r||13===r)){for(e.position=n+1,e.tokenStart++,n--,t=e.data.charCodeAt(n);10===t||13===t;)n--,t=e.data.charCodeAt(n);return e.tokenEnd=n+1,void(e.isEscaped=!0)}(13===t||10===t&&13!==r)&&e.lineNumber++,r=t,++n}e.position=n}(e):u(e),e.tokenType=3;break;default:e.isImportGet?function(e){for(;e.position<e.length;)switch(e.data.charCodeAt(e.position)){case 93:return++e.position,e.tokenEnd=e.position,void(e.isImportGet=!1);default:++e.position}}(e):u(e),e.isEscaped?e.tokenType=3:95===e.data.charCodeAt(e.tokenStart)?(e.inSaveFrame&&function(e){return e.tokenEnd-e.tokenStart==11&&(105===e.data.charCodeAt(e.tokenStart+1)&&(109===e.data.charCodeAt(e.tokenStart+2)&&(112===e.data.charCodeAt(e.tokenStart+3)&&(111===e.data.charCodeAt(e.tokenStart+4)&&(114===e.data.charCodeAt(e.tokenStart+5)&&(116===e.data.charCodeAt(e.tokenStart+6)&&(46===e.data.charCodeAt(e.tokenStart+7)&&(103===e.data.charCodeAt(e.tokenStart+8)&&(101===e.data.charCodeAt(e.tokenStart+9)&&116===e.data.charCodeAt(e.tokenStart+10))))))))))}(e)&&(e.isImportGet=!0),e.tokenType=4):e.tokenEnd-e.tokenStart>=5&&95===e.data.charCodeAt(e.tokenStart+4)?!function(e){var t=e.data.charCodeAt(e.tokenStart);return(68===t||100===t)&&((65===(t=e.data.charCodeAt(e.tokenStart+1))||97===t)&&((84===(t=e.data.charCodeAt(e.tokenStart+2))||116===t)&&(65===(t=e.data.charCodeAt(e.tokenStart+3))||97===t)))}(e)?!function(e){var t=e.data.charCodeAt(e.tokenStart);return(83===t||115===t)&&((65===(t=e.data.charCodeAt(e.tokenStart+1))||97===t)&&((86===(t=e.data.charCodeAt(e.tokenStart+2))||118===t)&&(69===(t=e.data.charCodeAt(e.tokenStart+3))||101===t)))}(e)?!function(e){if(e.tokenEnd-e.tokenStart!=5)return!1;var t=e.data.charCodeAt(e.tokenStart);return(76===t||108===t)&&((79===(t=e.data.charCodeAt(e.tokenStart+1))||111===t)&&((79===(t=e.data.charCodeAt(e.tokenStart+2))||111===t)&&(80===(t=e.data.charCodeAt(e.tokenStart+3))||112===t)))}(e)?e.tokenType=3:e.tokenType=2:e.tokenType=1:e.tokenType=0:e.tokenType=3}}}function h(e){for(m(e);5===e.tokenType;)m(e)}function g(){return{categoryNames:[],categoryData:Object.create(null)}}function v(e,t){for(var r=Object.create(null),n=0,a=e;n<a.length;n++){var o=a[n],s=t[o];r[o]=i.b(s.name,s.rowCount,s.fieldNames,s.fields)}return r}function b(e,t,r){return i.a(e.categoryNames,v(e.categoryNames,e.categoryData),t,r)}function y(e,t,r,n,i){var a;if(t in e.categoryData){var o=e.categoryData[t];(a=o.fieldNames).push.apply(a,n),Object.assign(o.fields,i)}else e.categoryData[t]={name:t,rowCount:r,fieldNames:n,fields:i},e.categoryNames.push(t)}function _(e,t){for(var r=t.tokenizer,n=t.tokens,i=t.fieldCount,o=t.tokenCount,s=0;3===r.tokenType&&s<e;)a.a.add(n[o++%i],r.tokenStart,r.tokenEnd),h(r),s++;return t.tokenCount=o,s}function S(e,t){return e.update({message:"Parsing...",current:t.tokenizer.position,max:t.tokenizer.data.length})}function x(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,o,u,c,l,m,g,v,b,x,O;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(r=e.lineNumber,h(e),o=f(e,d(e)),u=function(e){var t;for(t=e.tokenStart;t<e.tokenEnd;++t)if(46===e.data.charCodeAt(t))return!1;return!0}(e),c=[];4===e.tokenType;)c[c.length]=u?p(e):p(e).substring(o.length+1),h(e);for(l="_atom_site"===o?e.data.length/100|0:32,m=[],g=c.length,O=0;O<g;O++)m[O]=a.a.create(e.data,l);return v={fieldCount:g,tokenCount:0,tokenizer:e,tokens:m},[4,Object(s.c)(e.runtimeCtx,1e6,v,_,S)];case 1:if(n.sent(),v.tokenCount%g!=0)return[2,{hasError:!0,errorLine:e.lineNumber,errorMessage:"The number of values for loop starting at line "+r+" is not a multiple of the number of columns."}];if(b=v.tokenCount/g|0,u)for(O=0;O<g;O++)x={"":i.c.ofTokens(m[O])},y(t,c[O].substr(1),b,[""],x);else{for(x=Object.create(null),O=0;O<g;O++)x[c[O]]=i.c.ofTokens(m[O]);y(t,o.substr(1),b,c,x)}return[2,{hasError:!1,errorLine:0,errorMessage:""}]}}))}))}function O(e,t){return o.a.error(t,e)}function w(e){return o.a.success(e)}function C(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,o,s,u,c,m,_,S,C,j;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:r=[],o=function(e,t){return{data:e,length:e.length,position:0,tokenStart:0,tokenEnd:0,tokenType:6,lineNumber:1,isEscaped:!1,isImportGet:!1,inSaveFrame:!1,runtimeCtx:t}}(e,t),s="",u=g(),c=[],m=g(),_=i.e(m.categoryNames,v(m.categoryNames,m.categoryData),""),S="",t.update({message:"Parsing...",current:0,max:e.length}),h(o),n.label=1;case 1:return 6===o.tokenType?[3,7]:0!==(C=o.tokenType)?[3,2]:o.inSaveFrame?[2,O(o.lineNumber,"Unexpected data block inside a save frame.")]:(u.categoryNames.length>0&&r.push(b(u,s,c)),s=e.substring(o.tokenStart+5,o.tokenEnd),u=g(),c=[],h(o),[3,6]);case 2:if(1!==C)return[3,3];if(o.tokenEnd-o.tokenStart==5)m.categoryNames.length>0&&(c[c.length]=(P=m,E=S,i.a(P.categoryNames,v(P.categoryNames,P.categoryData),E))),o.inSaveFrame=!1;else{if(o.inSaveFrame)return[2,O(o.lineNumber,"Save frames cannot be nested.")];o.inSaveFrame=!0,S=e.substring(o.tokenStart+5,o.tokenEnd),m=g()}return h(o),[3,6];case 3:return 2!==C?[3,5]:[4,x(o,o.inSaveFrame?m:u)];case 4:return(j=n.sent()).hasError?[2,O(j.errorLine,j.errorMessage)]:[3,6];case 5:if(4!==C)return console.log(o.tokenType,a.b.getTokenString(o)),[2,O(o.lineNumber,"Unexpected token. Expected data_, loop_, or data name.")];if((j=function(e,t){for(var r=e.tokenStart,n=d(e),a=f(e,n),o=Object.create(null),s=[],u=!0;u;){if(4!==e.tokenType||!l(e,r,n)){u=!1;break}var c=p(e).substring(a.length+1);if(h(e),3!==e.tokenType)return{hasError:!0,errorLine:e.lineNumber,errorMessage:"Expected value."};o[c]=i.c.ofTokens({data:e.data,indices:[e.tokenStart,e.tokenEnd],count:1}),s[s.length]=c,h(e)}return y(t,a.substr(1),1,s,o),{hasError:!1,errorLine:0,errorMessage:""}}(o,o.inSaveFrame?m:u)).hasError)return[2,O(j.errorLine,j.errorMessage)];n.label=6;case 6:return[3,1];case 7:return o.inSaveFrame?[2,O(o.lineNumber,"Unfinished save frame ("+_.header+").")]:((u.categoryNames.length>0||c.length>0)&&r.push(b(u,s,c)),[2,w(i.d(r))])}var P,E}))}))}function j(e){var t=this;return s.b.create("Parse CIF",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){return Object(n.__generator)(this,(function(t){switch(t.label){case 0:return[4,C(e,r)];case 1:return[2,t.sent()]}}))}))}))}var P=r(7),E=r(127),A=r(101);var D=r(364);function T(e){for(var t=Object.create(null),r=Object.create(null),n=0,i=e.columns;n<i.length;n++){var a=i[n];t[a.name]=a}return{rowCount:e.rowCount,name:e.name.substr(1),fieldNames:e.columns.map((function(e){return e.name})),getField:function(e){var n=t[e];if(n)return r[e]||(r[e]=function(e){var t=e.mask?Object(E.d)(e.mask):void 0,r=Object(E.d)(e.data),n=P.b.isTypedArray(r),i=n?t?function(e){return 0===t[e]?""+r[e]:""}:function(e){return""+r[e]}:t?function(e){return 0===t[e]?r[e]:""}:function(e){return r[e]},a=n?function(e){return r[e]}:function(e){var t=r[e];return Object(A.d)(t,0,t.length)},o=n?function(e){return r[e]}:function(e){var t=r[e];return Object(A.b)(t,0,t.length)},s=t?function(e){return t[e]}:function(e){return 0},u=r.length;return{__array:r,binaryEncoding:e.data.encoding,isDefined:!0,rowCount:u,str:i,int:a,float:o,valueKind:s,areValuesEqual:function(e,t){return r[e]===r[t]},toStringArray:function(e){return P.b.createAndFillArray(u,i,e)},toIntArray:n?function(e){return P.b.typedArrayWindow(r,e)}:function(e){return P.b.createAndFillArray(u,a,e)},toFloatArray:n?function(e){return P.b.typedArrayWindow(r,e)}:function(e){return P.b.createAndFillArray(u,o,e)}}}(n)),r[e]}}}function I(e){var t=this;return s.b.create("Parse BinaryCIF",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,r,a;return Object(n.__generator)(this,(function(n){t=[0,3];try{return r=Object(D.a)(e),function(e,t){for(var r=0;r<2;r++)if(e[r]>t[r])return!1;return!0}(t,r.version.match(/(\d)\.(\d)\.\d/).slice(1).map((function(e){return+e})))?(a=i.d(r.dataBlocks.map((function(e){for(var t=Object.create(null),r=0,n=e.categories;r<n.length;r++){var a=n[r];t[a.name.substr(1)]=T(a)}return i.a(e.categories.map((function(e){return e.name.substr(1)})),t,e.header)}))),[2,o.a.success(a)]):[2,o.a.error("Unsupported format version. Current "+r.version+", required "+t.join(".")+".")]}catch(e){return[2,o.a.error(""+e)]}return[2]}))}))}))}var M=r(152),k=r(59),B=P.a.Schema,V=B.str,R=B.float,L=B.List,N=B.Aliased,F=B.int,U=B.coord,z={chem_comp:{formula:V,formula_weight:R,id:V,mon_nstd_parent_comp_id:L(",",(function(e){return e})),name:V,one_letter_code:V,three_letter_code:V,type:N(V),pdbx_synonyms:L(";",(function(e){return e})),pdbx_type:V,pdbx_ambiguous_flag:V,pdbx_replaced_by:V,pdbx_replaces:V,pdbx_formal_charge:F,pdbx_model_coordinates_details:V,pdbx_model_coordinates_db_code:V,pdbx_ideal_coordinates_details:V,pdbx_ideal_coordinates_missing_flag:N(V),pdbx_model_coordinates_missing_flag:N(V),pdbx_initial_date:V,pdbx_modified_date:V,pdbx_release_status:N(V),pdbx_processing_site:N(V)},chem_comp_atom:{alt_atom_id:V,atom_id:V,charge:F,model_Cartn_x:U,model_Cartn_y:U,model_Cartn_z:U,comp_id:V,type_symbol:V,pdbx_align:F,pdbx_ordinal:F,pdbx_model_Cartn_x_ideal:U,pdbx_model_Cartn_y_ideal:U,pdbx_model_Cartn_z_ideal:U,pdbx_stereo_config:N(V),pdbx_aromatic_flag:N(V),pdbx_leaving_atom_flag:N(V)},chem_comp_bond:{atom_id_1:V,atom_id_2:V,comp_id:V,value_order:N(V),pdbx_ordinal:F,pdbx_stereo_config:N(V),pdbx_aromatic_flag:N(V)},pdbx_chem_comp_descriptor:{comp_id:V,descriptor:V,type:N(V),program:V,program_version:V},pdbx_chem_comp_identifier:{comp_id:V,identifier:V,type:N(V),program:V,program_version:V}},H=P.a.Schema,G=H.str,q=H.float,W=H.Aliased,X=H.int,Y={pdbx_reference_molecule:{prd_id:G,formula_weight:q,formula:G,type:W(G),type_evidence_code:G,class:W(G),class_evidence_code:G,name:G,represent_as:W(G),chem_comp_id:G,compound_details:G,description:G,representative_PDB_id_code:G,release_status:W(G),replaces:G,replaced_by:G},pdbx_reference_entity_list:{prd_id:G,ref_entity_id:G,type:W(G),details:G,component_id:X},pdbx_reference_entity_nonpoly:{prd_id:G,ref_entity_id:G,name:G,chem_comp_id:G},pdbx_reference_entity_link:{link_id:X,prd_id:G,details:G,ref_entity_id_1:G,ref_entity_id_2:G,entity_seq_num_1:X,entity_seq_num_2:X,comp_id_1:G,comp_id_2:G,atom_id_1:G,atom_id_2:G,value_order:W(G),component_1:X,component_2:X,link_class:W(G)},pdbx_reference_entity_poly_link:{link_id:X,prd_id:G,ref_entity_id:G,component_id:X,entity_seq_num_1:X,entity_seq_num_2:X,comp_id_1:G,comp_id_2:G,atom_id_1:G,atom_id_2:G,value_order:W(G)},pdbx_reference_entity_poly:{prd_id:G,ref_entity_id:G,type:W(G),db_code:G,db_name:G},pdbx_reference_entity_poly_seq:{prd_id:G,ref_entity_id:G,mon_id:G,parent_mon_id:G,num:X,observed:W(G),hetero:W(G)},pdbx_reference_entity_sequence:{prd_id:G,ref_entity_id:G,type:W(G),NRP_flag:W(G),one_letter_codes:G},pdbx_reference_entity_src_nat:{prd_id:G,ref_entity_id:G,ordinal:X,organism_scientific:G,taxid:G,db_code:G,db_name:G},pdbx_prd_audit:{prd_id:G,date:G,processing_site:W(G),action_type:W(G)}},Q=P.a.Schema,K=Q.str,Z={datablock:{id:K,description:K},dictionary:{title:K,datablock_id:K,version:K},dictionary_history:{version:K,update:K,revision:K},sub_category:{id:K,description:K},category_group_list:{id:K,parent_id:K,description:K},item_type_list:{code:K,primitive_code:K,construct:K,detail:K},item_units_list:{code:K,detail:K},item_units_conversion:{from_code:K,to_code:K,operator:K,factor:Q.float}},J=P.a.Schema,$=J.str,ee=J.int,te=J.float,re=J.Aliased,ne=J.Vector,ie=(re($),re($),re($),re($),ne(3),ne(3),{volume_data_3d_info:{name:$,axis_order:ne(3,ee),origin:ne(3),dimensions:ne(3),sample_rate:ee,sample_count:ne(3,ee),spacegroup_number:ee,spacegroup_cell_size:ne(3),spacegroup_cell_angles:ne(3),mean_source:te,mean_sampled:te,sigma_source:te,sigma_sampled:te,min_source:te,min_sampled:te,max_source:te,max_sampled:te},volume_data_3d:{values:te}}),ae=P.a.Schema,oe=ae.int,se=ae.float,ue=ae.str,ce=ae.Matrix,le={cell:{formula_units_Z:oe,volume:se,angle_alpha:se,angle_beta:se,angle_gamma:se,length_a:se,length_b:se,length_c:se},chemical:{melting_point:se,name_common:ue,name_systematic:ue},chemical_formula:{moiety:ue,sum:ue,weight:se},space_group:{crystal_system:ue,IT_number:oe,"name_H-M_full":ue},space_group_symop:{operation_xyz:ue},geom_bond:{atom_site_label_1:ue,atom_site_label_2:ue,distance:se,publ_flag:ue,site_symmetry_1:ue,site_symmetry_2:ue,valence:se},audit:{block_doi:ue},database_code:{COD:ue,CSD:ue,depnum_ccdc_archive:ue,depnum_ccdc_fiz:ue,ICSD:ue,MDF:ue,NBS:ue},atom_site:{adp_type:ue,calc_flag:ue,disorder_assembly:ue,disorder_group:ue,fract_x:se,fract_y:se,fract_z:se,label:ue,occupancy:se,refinement_flags:ue,site_symmetry_multiplicity:oe,type_symbol:ue,U_iso_or_equiv:se},atom_site_aniso:{label:ue,U_11:se,U:ce(3,3),U_11_su:se,U_su:ce(3,3),U_12:se,U_12_su:se,U_13:se,U_13_su:se,U_22:se,U_22_su:se,U_23:se,U_23_su:se,U_33:se,U_33_su:se},atom_type:{description:ue,symbol:ue},atom_type_scat:{dispersion_imag:se,dispersion_real:se,source:ue}},de={"atom_site_aniso.U":["atom_site_anisotrop_U"],"atom_site_aniso.U_su":["atom_site_aniso_U_esd","atom_site_anisotrop_U_esd"],"space_group.IT_number":["symmetry_Int_Tables_number"],"space_group.name_H-M_full":["symmetry_space_group_name_H-M"],"space_group_symop.operation_xyz":["symmetry_equiv_pos_as_xyz"],"geom_bond.atom_site_label_1":["geom_bond_atom_site_id_1"],"geom_bond.atom_site_label_2":["geom_bond_atom_site_id_2"],"geom_bond.distance":["geom_bond_dist"],"atom_site.adp_type":["atom_site_thermal_displace_type"],"atom_site.label":["atom_site_id"],"atom_site.site_symmetry_multiplicity":["atom_site_symmetry_multiplicity"],"atom_site_aniso.label":["atom_site_anisotrop_id"],"atom_site_aniso.U_11":["atom_site_anisotrop_U_11"],"atom_site_aniso.U_11_su":["atom_site_aniso_U_11_esd","atom_site_anisotrop_U_11_esd"],"atom_site_aniso.U_12":["atom_site_anisotrop_U_12"],"atom_site_aniso.U_12_su":["atom_site_aniso_U_12_esd","atom_site_anisotrop_U_12_esd"],"atom_site_aniso.U_13":["atom_site_anisotrop_U_13"],"atom_site_aniso.U_13_su":["atom_site_aniso_U_13_esd","atom_site_anisotrop_U_13_esd"],"atom_site_aniso.U_22":["atom_site_anisotrop_U_22"],"atom_site_aniso.U_22_su":["atom_site_aniso_U_22_esd","atom_site_anisotrop_U_22_esd"],"atom_site_aniso.U_23":["atom_site_anisotrop_U_23"],"atom_site_aniso.U_23_su":["atom_site_aniso_U_23_esd","atom_site_anisotrop_U_23_esd"],"atom_site_aniso.U_33":["atom_site_anisotrop_U_33"],"atom_site_aniso.U_33_su":["atom_site_aniso_U_33_esd","atom_site_anisotrop_U_33_esd"]},fe={parse:function(e){return"string"==typeof e?j(e):I(e)},parseText:j,parseBinary:I,toDatabaseCollection:M.b,toDatabase:M.a,schema:{mmCIF:function(e){return Object(M.a)(k.a,e)},CCD:function(e){return Object(M.a)(z,e)},BIRD:function(e){return Object(M.a)(Y,e)},dic:function(e){return Object(M.a)(Z,e)},cifCore:function(e){return Object(M.a)(le,e,de)},densityServer:function(e){return Object(M.a)(ie,e)}}}},function(e,t,r){"use strict";r.r(t),r.d(t,"PluginCommands",(function(){return i}));var n=r(98),i={State:{SetCurrentObject:Object(n.a)(),ApplyAction:Object(n.a)(),Update:Object(n.a)(),RemoveObject:Object(n.a)(),ToggleExpanded:Object(n.a)(),ToggleVisibility:Object(n.a)(),Snapshots:{Add:Object(n.a)(),Replace:Object(n.a)(),Move:Object(n.a)(),Remove:Object(n.a)(),Apply:Object(n.a)(),Clear:Object(n.a)(),Upload:Object(n.a)(),Fetch:Object(n.a)(),DownloadToFile:Object(n.a)(),OpenFile:Object(n.a)(),OpenUrl:Object(n.a)()}},Interactivity:{Object:{Highlight:Object(n.a)()},Structure:{Highlight:Object(n.a)(),Select:Object(n.a)()},ClearHighlights:Object(n.a)()},Layout:{Update:Object(n.a)()},Toast:{Show:Object(n.a)(),Hide:Object(n.a)()},Camera:{Reset:Object(n.a)(),SetSnapshot:Object(n.a)(),Focus:Object(n.a)()},Canvas3D:{SetSettings:Object(n.a)(),ResetSettings:Object(n.a)()}}},function(e,t,r){"use strict";r.d(t,"d",(function(){return n.a})),r.d(t,"a",(function(){return s.a})),r.d(t,"c",(function(){return i.a})),r.d(t,"g",(function(){return a.a})),r.d(t,"f",(function(){return o.a})),r.d(t,"e",(function(){return u.a})),r.d(t,"h",(function(){return c.a})),r.d(t,"i",(function(){return c.b})),r.d(t,"b",(function(){return H})),r.d(t,"k",(function(){return Z})),r.d(t,"j",(function(){return $}));var n=r(139),i=r(118),a=r(37),o=r(251),s=r(163),u=r(176),c=r(209),l=r(63),d=r(263),f=r(0),p=r(6),m=r(287),h=l.a.Field,g={name:"struct_conf",instance:function(e){var t=S(e,"helix");return{fields:y,source:[{data:t,rowCount:t.length}]}}},v={name:"struct_sheet_range",instance:function(e){var t=S(e,"sheet").sort(b);return{fields:_,source:[{data:t,rowCount:t.length}]}}};function b(e,t){var r=e.element,n=t.element;return r.sheet_id<n.sheet_id?-1:r.sheet_id===n.sheet_id?e.start.element-t.start.element:1}var y=Object(f.__spreadArrays)([h.str("conf_type_id",(function(e,t){return t[e].element.type_id})),h.str("id",(function(e,t,r){return""+t[e].element.type_id+(r+1)}))],Object(d.b)((function(e,t){return t[e].start}),{prefix:"beg"}),Object(d.b)((function(e,t){return t[e].end}),{prefix:"end"}),[h.str("pdbx_PDB_helix_class",(function(e,t){return t[e].element.helix_class})),h.str("details",(function(e,t){return t[e].element.details||""}),{valueKind:function(e,t){return t[e].element.details?0:2}}),h.int("pdbx_PDB_helix_length",(function(e,t){return t[e].length}))]),_=Object(f.__spreadArrays)([h.str("sheet_id",(function(e,t){return t[e].element.sheet_id})),h.index("id")],Object(d.b)((function(e,t){return t[e].start}),{prefix:"beg"}),Object(d.b)((function(e,t){return t[e].end}),{prefix:"end"}),[h.str("symmetry",(function(e,t){return""}),{valueKind:function(e,t){return 2}})]);function S(e,t){var r=m.a.Provider.get(e.firstModel);if(!r)return[];for(var i=r.key,o=r.elements,s=[],u=e.structures[0],c=0,l=u.units;c<l.length;c++){var d=l[c];if(a.a.isAtomic(d)&&d.conformation.operator.isIdentity)for(var f=d.model.atomicHierarchy.residueAtomSegments,h=p.Segmentation.transientSegments(f,d.elements),g=void 0,v=!0;h.hasNext;){v&&(g=h.move());var b=g.index,y=i[b],_=o[y];if(_.kind===t){for(var S=b;h.hasNext;)if(S=g.index,y!==i[(g=h.move()).index]){v=!1,s[s.length]={start:n.a.Location.create(u,d,f.offsets[b]),end:n.a.Location.create(u,d,f.offsets[S]),length:S-b+1,element:_};break}}else v=!0}}return s}var x=r(7),O=r(96),w=r(57),C=r(12),j=r(74),P=r(26);function E(e,t){if(j.a.is(e.sourceData))return e.sourceData.data.db[t]}function A(e){return O.a.unionMany.apply(O.a,e.map((function(e){return e.uniqueResidueNames})))}function D(e){if(0===e.length)return[];if(1===e.length)return e[0].entityIndices;for(var t=w.c.create(),r=0,n=e;r<n.length;r++)for(var i=0,a=n[r].entityIndices;i<a.length;i++){var o=a[i];w.c.add(t,o,o)}return Object(C.q)(t.array),t.array}function T(e,t){return{name:e,instance:function(r){var n=r.structures;if(t&&!t(n[0]))return l.a.Category.Empty;var i=n[0].model;if(!j.a.is(i.sourceData))return l.a.Category.Empty;var a=i.sourceData.data.db[e];return a&&a._rowCount?l.a.Category.ofTable(a):l.a.Category.Empty}}}function I(e,t,r){if(j.a.is(t.firstModel.sourceData)){var n=l.a.fields();if(e.isBinary)for(var i=0,a=r.fieldNames;i<a.length;i++){var o=M(d=a[i],r.getField(d));n.add(o)}else for(var s=function(e){var t=r.getField(e);n.str(e,(function(e){return t.str(e)}))},u=0,c=r.fieldNames;u<c.length;u++){var d;s(d=c[u])}var f=n.getFields();return{name:r.name,instance:function(){return{fields:f,source:[{data:void 0,rowCount:r.rowCount}]}}}}}function M(e,t){var r=Object(P.d)(t);return"str"===r["@type"]?{name:e,type:0,value:t.str,valueKind:t.valueKind}:"float"===r["@type"]?l.a.Field.float(e,t.float,{valueKind:t.valueKind,typedArray:Float64Array}):l.a.Field.int(e,t.int,{valueKind:t.valueKind,typedArray:Int32Array})}var k=l.a.Category,B={name:"chem_comp",instance:function(e){e.firstModel;var t=e.structures,r=e.cache,n=E(t[0].model,"chem_comp");if(!n)return k.Empty;var i=n.id,a=r.uniqueResidueNames||(r.uniqueResidueNames=A(t)),o=x.a.indicesOf(i,(function(e){return a.has(e)}));return k.ofTable(n,o)}},V={name:"pdbx_chem_comp_identifier",instance:function(e){var t=e.firstModel,r=e.structures,n=e.cache,i=E(t,"pdbx_chem_comp_identifier");if(!i)return k.Empty;var a=i.comp_id,o=n.uniqueResidueNames||(n.uniqueResidueNames=A(r)),s=x.a.indicesOf(a,(function(e){return o.has(e)}));return k.ofTable(i,s)}},R={name:"pdbx_nonpoly_scheme",instance:function(e){var t=e.firstModel,r=(e.structures,e.cache,E(t,"pdbx_nonpoly_scheme"));return r?k.ofTable(r):k.Empty}},L=l.a.Category,N=z("struct_asym"),F=z("entity_poly"),U=z("entity_poly_seq");function z(e){return{name:e,instance:function(t){var r=t.structures,n=t.cache;return function(e,t,r){var n=E(e[0].model,t);if(!n)return L.Empty;var i=n.entity_id,a=r.uniqueEntityIds||(r.uniqueEntityIds=function(e){if(0===e.length)return new Set;var t=e[0].model.entities.data.id;return new Set(D(e).map((function(e){return t.value(e)})))}(e)),o=x.a.indicesOf(i,(function(e){return a.has(e)}));return L.ofTable(n,o)}(r,e,n)}}}var H,G=r(66),q=r(333),W=l.a.Category;!function(e){e.create=function(e){var t=Array.isArray(e)?e:[e];return{structures:t,firstModel:t[0].model,cache:Object.create(null)}}}(H||(H={}));var X={name:"entity",instance:function(e){var t=e.structures,r=D(t);return W.ofTable(t[0].model.entities.data,r)}};function Y(e){return e.units.every((function(e){return e.conformation.operator.isIdentity}))}var Q,K=[T("entry"),T("exptl"),X,T("cell",Y),T("symmetry",Y),T("pdbx_struct_assembly",Y),T("pdbx_struct_assembly_gen",Y),T("pdbx_struct_oper_list",Y),g,v,N,F,U,T("pdbx_entity_branch"),T("pdbx_entity_branch_link"),T("pdbx_branch_scheme"),B,V,T("atom_sites"),R,d.a];!function(e){e.AtomSitePositionsFieldNames=new Set(["id","Cartn_x","Cartn_y","Cartn_z"])}(Q||(Q={}));var Z={onlyPositions:{includeCategory:function(e){return"atom_site"===e},includeField:function(e,t){return Q.AtomSitePositionsFieldNames.has(t)}}};function J(e,t,r){var n;if(!e.cifExport||0===e.cifExport.categories.length)return[];var i=e.cifExport.prefix,a=e.cifExport.categories,o=t;if(e.cifExport.context){var s=G.CustomPropertyDescriptor.getUUID(e);t.cache[s+"__ctx"]?o=t.cache[s+"__ctx"]:(o=e.cifExport.context(t)||t,t.cache[s+"__ctx"]=o)}for(var u=[],c=0,l=a;c<l.length;c++){var d=l[c];if(!(null===(n=null==r?void 0:r.skipCategoryNames)||void 0===n?void 0:n.has(d.name))){if(0!==d.name.indexOf(i))throw new Error("Custom category '"+d.name+"' name must start with prefix '"+i+".'");u.push([d,o])}}return u}function $(e,t,r){var n=(Array.isArray(t)?t[0]:t).models;if(1!==n.length)throw"Can't export stucture composed from multiple models.";var i=(null==r?void 0:r.exportCtx)||H.create(t);(null==r?void 0:r.copyAllCategories)&&j.a.is(n[0].sourceData)?function(e,t,r){for(var n=new Map,i=0,a=K;i<a.length;i++){var o=a[i];n.set(o.name,[o,t])}var s=Object(q.b)(t);s&&n.set(s[0].name,s);for(var u=r||{},c=0,l=t.firstModel.customProperties.all;c<l.length;c++)for(var d=l[c],f=0,p=J(d,t,u);f<p.length;f++){var m=p[f];n.set(m[0].name,m)}if(null==r?void 0:r.customProperties)for(var h=0,g=null==r?void 0:r.customProperties;h<g.length;h++){d=g[h];for(var v=0,b=J(d,t,u);v<b.length;v++){m=b[v];n.set(m[0].name,m)}}for(var y=0,_=t.structures;y<_.length;y++){var S=_[y];if(S.hasCustomProperties)for(var x=0,O=S.customPropertyDescriptors.all;x<O.length;x++){d=O[x];for(var w=0,C=J(d,t);w<C.length;w++){m=C[w];n.set(m[0].name,m)}}}for(var j=new Set,P=t.firstModel.sourceData.data,E=0,A=P.frame.categoryNames;E<A.length;E++){var D=A[E];if(j.add(D),n.has(D)){m=n.get(D);e.writeCategory(m[0],m[1],m[2])}else if(P.db[D]){o=T(D);e.writeCategory(o,t)}else{(o=I(e,t,P.frame.categories[D]))&&e.writeCategory(o)}}n.forEach((function(t,r){j.has(r)||e.writeCategory(t[0],t[1],t[2])}))}(e,i,r):function(e,t,r){for(var n,i=0,a=K;i<a.length;i++){var o=a[i];(null==r?void 0:r.skipCategoryNames)&&(null==r?void 0:r.skipCategoryNames.has(o.name))||e.writeCategory(o,t)}if(!(null===(n=null==r?void 0:r.skipCategoryNames)||void 0===n?void 0:n.has("atom_site"))&&e.isCategoryIncluded("atom_site")){var s=Object(q.b)(t);s&&e.writeCategory(s[0],s[1],s[2])}for(var u=r||{},c=0,l=t.firstModel.customProperties.all;c<l.length;c++)for(var d=l[c],f=0,p=J(d,t,u);f<p.length;f++){var m=p[f],h=(o=m[0],m[1]);e.writeCategory(o,h)}if(null==r?void 0:r.customProperties)for(var g=0,v=null==r?void 0:r.customProperties;g<v.length;g++){d=v[g];for(var b=0,y=J(d,t,u);b<y.length;b++){var _=y[b];o=_[0],h=_[1];e.writeCategory(o,h)}}for(var S=0,x=t.structures;S<x.length;S++){var O=x[S];if(O.hasCustomProperties)for(var w=0,C=O.customPropertyDescriptors.all;w<C.length;w++){d=C[w];for(var j=0,P=J(d,t,u);j<P.length;j++){var E=P[j];o=E[0],h=E[1];e.writeCategory(o,h)}}}}(e,i,r)}},function(e,t,r){"use strict";function n(e){for(var t=-1/0,r=0,n=e.length;r<n;++r)e[r]>t&&(t=e[r]);return t}function i(e){for(var t=1/0,r=0,n=e.length;r<n;++r)e[r]<t&&(t=e[r]);return t}function a(e){for(var t=1/0,r=-1/0,n=0,i=e.length;n<i;++n)e[n]<t&&(t=e[n]),e[n]>r&&(r=e[n]);return[t,r]}function o(e,t,r){void 0===t&&(t=1),void 0===r&&(r=0);for(var n=e.length,i=0,a=r;a<n;a+=t)i+=e[a];return i}function s(e,t,r){return void 0===t&&(t=1),void 0===r&&(r=0),o(e,t,r)/(e.length/t)}function u(e){for(var t=e.length,r=0,n=0;n<t;++n){var i=e[n];r+=i*i}return Math.sqrt(r/t)}function c(e,t){for(var r=0,n=t?Math.min(t,e.length):e.length;r<n;++r)e[r]=r;return e}function l(e,t){for(var r=0,n=e.length,i=!1;r<n;r++)if(e[r]===t){i=!0;break}return!!i&&(d(e,r),!0)}function d(e,t){for(var r=t,n=e.length-1;r<n;r++)e[r]=e[r+1];e.pop()}function f(e,t){return!(e.indexOf(t)>=0)&&(e.push(t),!0)}function p(e,t){var r=e.indexOf(t);if(r<0)return!1;for(var n=r,i=e.length-1;n<i;n++)e[n]=e[n+1];return e.pop(),!0}function m(e,t){if(!e||0===e.length)return!t||0===t.length;if(!t)return!1;var r=e.length;if(r!==t.length)return!1;for(var n=0;n<r;n++)if(e[n]!==t[n])return!1;return!0}function h(e){for(var t=0,r=e.length;t<r;t++)if(e[t]!==t)return!1;return!0}function g(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n][0]===t)return void(e[n][1]=r);e.push([t,r])}r.r(t),r.d(t,"arrayMax",(function(){return n})),r.d(t,"arrayMin",(function(){return i})),r.d(t,"arrayMinMax",(function(){return a})),r.d(t,"arraySum",(function(){return o})),r.d(t,"arrayMean",(function(){return s})),r.d(t,"arrayRms",(function(){return u})),r.d(t,"fillSerial",(function(){return c})),r.d(t,"arrayRemoveInPlace",(function(){return l})),r.d(t,"arrayRemoveAtInPlace",(function(){return d})),r.d(t,"arraySetAdd",(function(){return f})),r.d(t,"arraySetRemove",(function(){return p})),r.d(t,"arrayEqual",(function(){return m})),r.d(t,"arrayIsIdentity",(function(){return h})),r.d(t,"arrayMapUpsert",(function(){return g}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return p})),r.d(t,"a",(function(){return n}));var n,i=r(5),a=r(53),o=r(2),s=r(188),u=r(47),c=r(117),l=r(367),d=r(368),f=Object.keys({custom:{},auto:{},highest:{},higher:{},high:{},medium:{},low:{},lower:{},lowest:{}}),p=o.ParamDefinition.arrayToOptions(f);!function(e){e.Params={alpha:o.ParamDefinition.Numeric(1,{min:0,max:1,step:.01},{label:"Opacity",isEssential:!0,description:"How opaque/transparent the representation is rendered."}),quality:o.ParamDefinition.Select("auto",p,{isEssential:!0,description:"Visual/rendering quality of the representation."})},e.ShadingCategory={category:"Shading"},e.CustomQualityParamInfo={category:"Custom Quality",hideIf:function(e){return void 0!==e.quality&&"custom"!==e.quality}},e.createSimple=function(e,t,r){return void 0===e&&(e=u.a.grey),void 0===t&&(t=1),r||(r=Object(s.a)()),{transform:r,locationIterator:Object(a.a)(1,r.instanceCount.ref.value,1,(function(){return c.b}),!1,(function(){return!1})),theme:{color:Object(l.a)({},{value:e}),size:Object(d.a)({},{value:t})}}},e.createValues=function(e,t){return{alpha:i.e.create(e.alpha),uAlpha:i.e.create(e.alpha),uVertexCount:i.e.create(t.vertexCount),uGroupCount:i.e.create(t.groupCount),drawCount:i.e.create(t.drawCount)}},e.updateValues=function(e,t){i.e.updateIfChanged(e.alpha,t.alpha)},e.createRenderableState=function(e){void 0===e&&(e={});var t=void 0===e.alpha||1===e.alpha;return{disposed:!1,visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,opaque:t,writeDepth:t,noClip:!1}},e.updateRenderableState=function(e,t){e.opaque=t.alpha*e.alphaFactor>=1,e.writeDepth=e.opaque}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"StateTransforms",(function(){return V}));var n={};r.r(n),r.d(n,"CreateGroup",(function(){return d}));var i={};r.r(i),r.d(i,"VolumeFromCcp4",(function(){return D})),r.d(i,"VolumeFromDsn6",(function(){return T})),r.d(i,"VolumeFromCube",(function(){return I})),r.d(i,"VolumeFromDx",(function(){return M})),r.d(i,"AssignColorVolume",(function(){return B})),r.d(i,"VolumeFromDensityServerCif",(function(){return k}));var a,o=r(296),s=r(13),u=r(5),c=r(2),l=r(8),d=l.b.BuiltIn({name:"create-group",display:{name:"Group"},from:[],to:l.a.Group,params:{label:c.ParamDefinition.Text("Group"),description:c.ParamDefinition.Optional(c.ParamDefinition.Text(""))}})({apply:function(e){var t=e.params;return new l.a.Group({},t)},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return Object(u.l)(t,r)?s.StateTransformer.UpdateResult.Unchanged:(n.label=r.label,n.description=r.description,s.StateTransformer.UpdateResult.Updated)}}),f=r(324),p=r(0),m=r(26),h=r(1),g=r(17),v=r(9),b=r(44),y=r(374),_=r(199),S=r(29),x=r(66);function O(e,t){var r=this;return g.b.create("Create Volume",(function(n){return Object(p.__awaiter)(r,void 0,void 0,(function(){var r,n,i,o,s,u,c,l,d,f,m,g,O,w,C,j,P;return Object(p.__generator)(this,(function(p){return r=e.header,n=e.values,i=h.Vec3.create(r.xLength,r.yLength,r.zLength),t&&t.voxelSize&&h.Vec3.mul(i,i,t.voxelSize),o=h.Vec3.create(Object(b.c)(r.alpha),Object(b.c)(r.beta),Object(b.c)(r.gamma)),s=r.ISPG>65536?0:r.ISPG,u=v.f.create(s||"P 1",i,o),c=h.Vec3.create(r.MAPC-1,r.MAPR-1,r.MAPS-1),l=h.Tensor.convertToCanonicalAxisIndicesFastToSlow(c),d=[r.NX,r.NY,r.NZ],f=l([r.NC,r.NR,r.NS]),m=function(e){return 0===e.originX&&0===e.originY&&0===e.originZ?h.Vec3.create(e.NCSTART,e.NRSTART,e.NSSTART):h.Vec3.create(e.originX/(e.xLength/e.NX),e.originY/(e.yLength/e.NY),e.originZ/(e.zLength/e.NZ))}(r),(null==t?void 0:t.offset)&&h.Vec3.add(m,m,t.offset),g=l(m),O=h.Vec3.create(g[0]/d[0],g[1]/d[1],g[2]/d[2]),w=h.Vec3.create(f[0]/d[0],f[1]/d[1],f[2]/d[2]),C=h.Tensor.Space(f,h.Tensor.invertAxisOrder(c),function(e){var t=Object(y.a)(e);switch(t){case _.a.Float32:return Float32Array;case _.a.Int8:return Int8Array;case _.a.Int16:return Int16Array;case _.a.Uint16:return Uint16Array}throw Error(t+" is not a supported value format.")}(r)),j=h.Tensor.create(C,h.Tensor.Data1(n)),P=0===r.AMIN&&0===r.AMAX&&0===r.AMEAN&&0===r.ARMS,[2,{label:null==t?void 0:t.label,entryId:null==t?void 0:t.entryId,grid:{transform:{kind:"spacegroup",cell:u,fractionalBox:v.b.create(O,h.Vec3.add(h.Vec3.zero(),O,w))},cells:j,stats:{min:isNaN(r.AMIN)||P?Object(S.arrayMin)(n):r.AMIN,max:isNaN(r.AMAX)||P?Object(S.arrayMax)(n):r.AMAX,mean:isNaN(r.AMEAN)||P?Object(S.arrayMean)(n):r.AMEAN,sigma:isNaN(r.ARMS)||0===r.ARMS?Object(S.arrayRms)(n):r.ARMS}},sourceData:a.create(e),customProperties:new x.CustomProperties,_propertyData:Object.create(null)}]}))}))}))}!function(e){e.is=function(e){return"ccp4"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"ccp4",name:e.name,data:e}}}(a||(a={}));var w,C=r(312);function j(e,t){var r=this;return g.b.create("Create Volume",(function(n){return Object(p.__awaiter)(r,void 0,void 0,(function(){var r,n,i,a,o,s,u,c,l,d,f,m;return Object(p.__generator)(this,(function(p){return r=e.header,n=e.values,i=h.Vec3.create(r.xlen,r.ylen,r.zlen),t&&t.voxelSize&&h.Vec3.mul(i,i,t.voxelSize),a=h.Vec3.create(Object(b.c)(r.alpha),Object(b.c)(r.beta),Object(b.c)(r.gamma)),o=v.f.create("P 1",i,a),s=[r.xRate,r.yRate,r.zRate],u=[r.xExtent,r.yExtent,r.zExtent],c=[r.xStart,r.yStart,r.zStart],l=h.Vec3.create(c[0]/s[0],c[1]/s[1],c[2]/s[2]),d=h.Vec3.create(u[0]/s[0],u[1]/s[1],u[2]/s[2]),f=h.Tensor.Space(u,[0,1,2],Float32Array),m=h.Tensor.create(f,h.Tensor.Data1(n)),[2,{label:null==t?void 0:t.label,entryId:null==t?void 0:t.entryId,grid:{transform:{kind:"spacegroup",cell:o,fractionalBox:v.b.create(l,h.Vec3.add(h.Vec3.zero(),l,d))},cells:m,stats:{min:Object(S.arrayMin)(n),max:Object(S.arrayMax)(n),mean:Object(S.arrayMean)(n),sigma:void 0!==r.sigma?r.sigma:Object(S.arrayRms)(n)}},sourceData:w.create(e),customProperties:new x.CustomProperties,_propertyData:Object.create(null)}]}))}))}))}!function(e){e.is=function(e){return"dsn6"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"dsn6",name:e.name,data:e}}}(w||(w={}));var P,E=r(363);function A(e,t){var r=this;return g.b.create("Create Volume",(function(){return Object(p.__awaiter)(r,void 0,void 0,(function(){var r,n,i,a,o,s;return Object(p.__generator)(this,(function(u){return r=e.header,n=e.values,i=h.Tensor.Space(r.dim,[0,1,2],Float64Array),a=h.Tensor.create(i,h.Tensor.Data1(n)),o=h.Mat4.fromTranslation(Object(h.Mat4)(),r.min),s=h.Mat4.fromScaling(Object(h.Mat4)(),r.h),h.Mat4.mul(o,o,s),[2,{label:null==t?void 0:t.label,entryId:null==t?void 0:t.entryId,grid:{transform:{kind:"matrix",matrix:o},cells:a,stats:{min:Object(S.arrayMin)(n),max:Object(S.arrayMax)(n),mean:Object(S.arrayMean)(n),sigma:Object(S.arrayRms)(n)}},sourceData:P.create(e),customProperties:new x.CustomProperties,_propertyData:Object.create(null)}]}))}))}))}!function(e){e.is=function(e){return"dx"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"dx",name:e.name,data:e}}}(P||(P={}));var D=l.b.BuiltIn({name:"volume-from-ccp4",display:{name:"Volume from CCP4/MRC/MAP",description:"Create Volume from CCP4/MRC/MAP data"},from:l.a.Format.Ccp4,to:l.a.Volume.Data,params:function(e){return{voxelSize:c.ParamDefinition.Vec3(h.Vec3.create(1,1,1)),offset:c.ParamDefinition.Vec3(h.Vec3.create(0,0,0)),entryId:c.ParamDefinition.Text("")}}})({apply:function(e){var t=this,r=e.a,n=e.params;return g.b.create("Create volume from CCP4/MRC/MAP",(function(e){return Object(p.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(p.__generator)(this,(function(a){switch(a.label){case 0:return[4,O(r.data,Object(p.__assign)(Object(p.__assign)({},n),{label:r.data.name||r.label})).runInContext(e)];case 1:return t=a.sent(),i={label:t.label||"Volume",description:"Volume "+r.data.header.NX+"×"+r.data.header.NX+"×"+r.data.header.NX},[2,new l.a.Volume.Data(t,i)]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customProperties.dispose()}}),T=l.b.BuiltIn({name:"volume-from-dsn6",display:{name:"Volume from DSN6/BRIX",description:"Create Volume from DSN6/BRIX data"},from:l.a.Format.Dsn6,to:l.a.Volume.Data,params:function(e){return{voxelSize:c.ParamDefinition.Vec3(h.Vec3.create(1,1,1)),entryId:c.ParamDefinition.Text("")}}})({apply:function(e){var t=this,r=e.a,n=e.params;return g.b.create("Create volume from DSN6/BRIX",(function(e){return Object(p.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(p.__generator)(this,(function(a){switch(a.label){case 0:return[4,j(r.data,Object(p.__assign)(Object(p.__assign)({},n),{label:r.data.name||r.label})).runInContext(e)];case 1:return t=a.sent(),i={label:t.label||"Volume",description:"Volume "+r.data.header.xExtent+"×"+r.data.header.yExtent+"×"+r.data.header.zExtent},[2,new l.a.Volume.Data(t,i)]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customProperties.dispose()}}),I=l.b.BuiltIn({name:"volume-from-cube",display:{name:"Volume from Cube",description:"Create Volume from Cube data"},from:l.a.Format.Cube,to:l.a.Volume.Data,params:function(e){return{dataIndex:e?c.ParamDefinition.Select(0,e.data.header.dataSetIds.map((function(e,t){return[t,""+e]}))):c.ParamDefinition.Numeric(0),entryId:c.ParamDefinition.Text("")}}})({apply:function(e){var t=this,r=e.a,n=e.params;return g.b.create("Create volume from Cube",(function(e){return Object(p.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(p.__generator)(this,(function(a){switch(a.label){case 0:return[4,Object(E.b)(r.data,Object(p.__assign)(Object(p.__assign)({},n),{label:r.data.name||r.label})).runInContext(e)];case 1:return t=a.sent(),i={label:t.label||"Volume",description:"Volume "+r.data.header.dim[0]+"×"+r.data.header.dim[1]+"×"+r.data.header.dim[2]},[2,new l.a.Volume.Data(t,i)]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customProperties.dispose()}}),M=l.b.BuiltIn({name:"volume-from-dx",display:{name:"Parse DX",description:"Create volume from DX data."},from:l.a.Format.Dx,to:l.a.Volume.Data})({apply:function(e){var t=this,r=e.a;return g.b.create("Parse DX",(function(e){return Object(p.__awaiter)(t,void 0,void 0,(function(){var t,n;return Object(p.__generator)(this,(function(i){switch(i.label){case 0:return[4,A(r.data,{label:r.data.name||r.label}).runInContext(e)];case 1:return t=i.sent(),n={label:t.label||"Volume",description:"Volume "+r.data.header.dim[0]+"×"+r.data.header.dim[1]+"×"+r.data.header.dim[2]},[2,new l.a.Volume.Data(t,n)]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customProperties.dispose()}}),k=l.b.BuiltIn({name:"volume-from-density-server-cif",display:{name:"Volume from density-server CIF",description:"Identify and create all separate models in the specified CIF data block"},from:l.a.Format.Cif,to:l.a.Volume.Data,params:function(e){if(!e)return{blockHeader:c.ParamDefinition.Optional(c.ParamDefinition.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."})),entryId:c.ParamDefinition.Text("")};var t=e.data.blocks.slice(1);return{blockHeader:c.ParamDefinition.Optional(c.ParamDefinition.Select(t[0]&&t[0].header,t.map((function(e){return[e.header,e.header]})),{description:"Header of the block to parse"})),entryId:c.ParamDefinition.Text("")}}})({isApplicable:function(e){return e.data.blocks.length>0},apply:function(e){var t=this,r=e.a,n=e.params;return g.b.create("Parse density-server CIF",(function(e){return Object(p.__awaiter)(t,void 0,void 0,(function(){var t,i,a,o,s,u,c,d,f;return Object(p.__generator)(this,(function(p){switch(p.label){case 0:if(t=n.blockHeader||r.data.blocks[1].header,!(i=r.data.blocks.find((function(e){return e.header===t}))))throw new Error("Data block '"+[t]+"' not found.");return a=m.a.schema.densityServer(i),[4,Object(C.b)(a,{entryId:n.entryId}).runInContext(e)];case 1:return o=p.sent(),s=o.grid.cells.space.dimensions,u=s[0],c=s[1],d=s[2],f={label:a.volume_data_3d_info.name.value(0),description:"Volume "+u+"×"+c+"×"+d},[2,new l.a.Volume.Data(o,f)]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customProperties.dispose()}}),B=l.b.BuiltIn({name:"assign-color-volume",display:{name:"Assign Color Volume",description:"Assigns another volume to be available for coloring."},from:l.a.Volume.Data,to:l.a.Volume.Data,isDecorator:!0,params:function(e,t){if(!e)return{ref:c.ParamDefinition.Text()};var r=t.state.data.select(s.StateSelection.Generators.root.subtree().ofType(l.a.Volume.Data).filter((function(t){var r;return!!t.obj&&!(null===(r=t.obj)||void 0===r?void 0:r.data.colorVolume)&&t.obj!==e})));return 0===r.length?{ref:c.ParamDefinition.Text("",{isHidden:!0})}:{ref:c.ParamDefinition.Select(r[0].transform.ref,r.map((function(e){return[e.transform.ref,e.obj.label]})))}}})({apply:function(e){var t=this,r=e.a,n=e.params,i=e.dependencies;return g.b.create("Assign Color Volume",(function(e){return Object(p.__awaiter)(t,void 0,void 0,(function(){var e,t,a;return Object(p.__generator)(this,(function(o){if(!i||!i[n.ref])throw new Error("Dependency not available.");return e=i[n.ref].data,t=Object(p.__assign)(Object(p.__assign)({},r.data),{colorVolume:e}),a={label:r.label,description:"Volume + Colors"},[2,new l.a.Volume.Data(t,a)]}))}))}))}}),V={Data:o,Misc:n,Model:f,Volume:i,Representation:r(206)}},function(e,t,r){"use strict";r.d(t,"i",(function(){return i})),r.d(t,"h",(function(){return a})),r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return s})),r.d(t,"e",(function(){return u})),r.d(t,"c",(function(){return c})),r.d(t,"d",(function(){return l})),r.d(t,"f",(function(){return d})),r.d(t,"g",(function(){return f}));var n=r(22);r(6);function i(e,t){return e.model.atomicHierarchy.atoms.type_symbol.value(e.elements[t])}function a(e,t){return e.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.elements[t])}function o(e,t){return e.model.atomicHierarchy.atoms.label_atom_id.value(e.elements[t])}function s(e,t){return e.model.atomicHierarchy.atoms.label_alt_id.value(e.elements[t])}function u(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(e.elements[t])}function c(e,t,r){return function(e,t,r){for(var i=0,a=e.interUnitBonds.getEdgeIndices(r,t.id),o=0,s=a.length;o<s;++o){var u=e.interUnitBonds.edges[a[o]];n.BondType.isCovalent(u.props.flag)&&(i+=1)}return i}(e,t,r)+function(e,t){for(var r=0,i=e.bonds,a=i.offset,o=i.edgeProps.flags,s=a[t],u=a[t+1];s<u;++s)n.BondType.isCovalent(o[s])&&(r+=1);return r}(t,r)}function l(e,t,r,n){var a=0;return f(e,t,r,(function(e,t){i(e,t)===n&&(a+=1)})),a}function d(e,t,r,i,a){return t===i?function(e,t,r){var i=e.bonds,a=i.offset,o=i.b,s=i.edgeProps.flags;n.BondType.is;for(var u=a[t],c=a[t+1];u<c;++u)if(o[u]===r&&n.BondType.isCovalent(s[u]))return!0;return!1}(t,r,a):function(e,t,r,i,a){var o=e.interUnitBonds.getEdge(r,t.id,a,i.id);return o&&n.BondType.isCovalent(o.props.flag)}(e,t,r,i,a)}function f(e,t,r,i){!function(e,t,r,i){for(var a=e.interUnitBonds.getEdgeIndices(r,t.id),o=0,s=a.length;o<s;++o){var u=e.interUnitBonds.edges[a[o]],c=e.unitMap.get(u.unitB);n.BondType.isCovalent(u.props.flag)&&i(c,u.indexB)}}(e,t,r,i),function(e,t,r){for(var i=e.bonds,a=i.offset,o=i.b,s=i.edgeProps.flags,u=a[t],c=a[t+1];u<c;++u)n.BondType.isCovalent(s[u])&&r(e,o[u])}(t,r,i)}},function(e,t,r){"use strict";r.r(t),r.d(t,"PluginReactContext",(function(){return s})),r.d(t,"PluginUIComponent",(function(){return u})),r.d(t,"PurePluginUIComponent",(function(){return c})),r.d(t,"CollapsableControls",(function(){return l}));var n=r(0),i=r(3),a=r(18),o=r(15),s=i.createContext(void 0),u=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.subs=void 0,n.plugin=r,n.init&&n.init(),n}return Object(n.__extends)(t,e),t.prototype.subscribe=function(e,t){void 0===this.subs&&(this.subs=[]),this.subs.push(e.subscribe(t))},t.prototype.componentWillUnmount=function(){if(this.subs){for(var e=0,t=this.subs;e<t.length;e++){t[e].unsubscribe()}this.subs=void 0}},t.contextType=s,t}(i.Component),c=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.subs=void 0,n.plugin=r,n.init&&n.init(),n}return Object(n.__extends)(t,e),t.prototype.subscribe=function(e,t){void 0===this.subs&&(this.subs=[]),this.subs.push(e.subscribe(t))},t.prototype.componentWillUnmount=function(){if(this.subs){for(var e=0,t=this.subs;e<t.length;e++){t[e].unsubscribe()}this.subs=void 0}},t.contextType=s,t}(i.PureComponent),l=function(e){function t(t,r){var n=e.call(this,t,r)||this;n.toggleCollapsed=function(){n.setState({isCollapsed:!n.state.isCollapsed})};var i=n.defaultState();return void 0!==t.initiallyCollapsed&&(i.isCollapsed=t.initiallyCollapsed),void 0!==t.header&&(i.header=t.header),n.state=i,n}return Object(n.__extends)(t,e),t.prototype.componentDidUpdate=function(e){void 0!==this.props.initiallyCollapsed&&e.initiallyCollapsed!==this.props.initiallyCollapsed&&this.setState({isCollapsed:this.props.initiallyCollapsed})},t.prototype.render=function(){var e;if(this.state.isHidden)return null;var t=this.state.isCollapsed?"msp-transform-wrapper msp-transform-wrapper-collapsed":"msp-transform-wrapper";return i.createElement("div",{className:t},i.createElement("div",{className:"msp-transform-header"},i.createElement(a.Button,{icon:this.state.brand?void 0:this.state.isCollapsed?o.ArrowRightSvg:o.ArrowDropDownSvg,noOverflow:!0,onClick:this.toggleCollapsed,className:this.state.brand?"msp-transform-header-brand msp-transform-header-brand-"+this.state.brand.accent:void 0,title:"Click to "+(this.state.isCollapsed?"expand":"collapse")},i.createElement(o.Icon,{svg:null===(e=this.state.brand)||void 0===e?void 0:e.svg,inline:!0}),this.state.header,i.createElement("small",{style:{margin:"0 6px"}},this.state.isCollapsed?"":this.state.description))),!this.state.isCollapsed&&this.renderControls())},t}(u)},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(20),i=r(223),a=r(321),o=r(76),s=r(285),u=r(182),c=r(261),l=function(e){function t(r,n,i){var o=e.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,arguments.length){case 0:o.destination=a.a;break;case 1:if(!r){o.destination=a.a;break}if("object"==typeof r){r instanceof t?(o.syncErrorThrowable=r.syncErrorThrowable,o.destination=r,r.add(o)):(o.syncErrorThrowable=!0,o.destination=new d(o,r));break}default:o.syncErrorThrowable=!0,o.destination=new d(o,r,n,i)}return o}return n.a(t,e),t.prototype[s.a]=function(){return this},t.create=function(e,r,n){var i=new t(e,r,n);return i.syncErrorThrowable=!1,i},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this))},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},t.prototype._unsubscribeAndRecycle=function(){var e=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=e,this},t}(o.a),d=function(e){function t(t,r,n,o){var s,u=e.call(this)||this;u._parentSubscriber=t;var c=u;return Object(i.a)(r)?s=r:r&&(s=r.next,n=r.error,o=r.complete,r!==a.a&&(c=Object.create(r),Object(i.a)(c.unsubscribe)&&u.add(c.unsubscribe.bind(c)),c.unsubscribe=u.unsubscribe.bind(u))),u._context=c,u._next=s,u._error=n,u._complete=o,u}return n.a(t,e),t.prototype.next=function(e){if(!this.isStopped&&this._next){var t=this._parentSubscriber;u.a.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?this.__tryOrSetError(t,this._next,e)&&this.unsubscribe():this.__tryOrUnsub(this._next,e)}},t.prototype.error=function(e){if(!this.isStopped){var t=this._parentSubscriber,r=u.a.useDeprecatedSynchronousErrorHandling;if(this._error)r&&t.syncErrorThrowable?(this.__tryOrSetError(t,this._error,e),this.unsubscribe()):(this.__tryOrUnsub(this._error,e),this.unsubscribe());else if(t.syncErrorThrowable)r?(t.syncErrorValue=e,t.syncErrorThrown=!0):Object(c.a)(e),this.unsubscribe();else{if(this.unsubscribe(),r)throw e;Object(c.a)(e)}}},t.prototype.complete=function(){var e=this;if(!this.isStopped){var t=this._parentSubscriber;if(this._complete){var r=function(){return e._complete.call(e._context)};u.a.useDeprecatedSynchronousErrorHandling&&t.syncErrorThrowable?(this.__tryOrSetError(t,r),this.unsubscribe()):(this.__tryOrUnsub(r),this.unsubscribe())}else this.unsubscribe()}},t.prototype.__tryOrUnsub=function(e,t){try{e.call(this._context,t)}catch(e){if(this.unsubscribe(),u.a.useDeprecatedSynchronousErrorHandling)throw e;Object(c.a)(e)}},t.prototype.__tryOrSetError=function(e,t,r){if(!u.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{t.call(this._context,r)}catch(t){return u.a.useDeprecatedSynchronousErrorHandling?(e.syncErrorValue=t,e.syncErrorThrown=!0,!0):(Object(c.a)(t),!0)}return!1},t.prototype._unsubscribe=function(){var e=this._parentSubscriber;this._context=null,this._parentSubscriber=null,e.unsubscribe()},t}(l)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(1),a=r(12),o=r(38),s=r(82),u=r(91),c=Object(i.Vec3)(),l=Object(i.Mat3)(),d=Object(i.Vec3)(),f=Object(i.Vec3)(),p=Object(i.Vec3)(),m=Object(i.Vec3)(),h=i.Vec3.fromArray,g=i.Vec3.triangleNormal,v=i.Vec3.copy,b=i.Vec3.transformMat4,y=i.Vec3.transformMat3,_=i.Mat3.directionTransform,S=a.a.add3,x=a.a.add;!function(e){function t(e,t,r,n){var i=e.vertices,a=e.normals,o=e.indices,s=e.groups,u=e.currentGroup,l=i.elementCount;S(i,t[0],t[1],t[2]),S(i,r[0],r[1],r[2]),S(i,n[0],n[1],n[2]),g(c,t,r,n);for(var d=0;d<3;++d)S(a,c[0],c[1],c[2]),x(s,u);S(o,l,l+1,l+2)}e.createState=function(e,t,r){return void 0===e&&(e=2048),void 0===t&&(t=1024),{currentGroup:-1,vertices:a.a.create(Float32Array,3,t,r?r.vertexBuffer.ref.value:e),normals:a.a.create(Float32Array,3,t,r?r.normalBuffer.ref.value:e),indices:a.a.create(Uint32Array,3,3*t,r?r.indexBuffer.ref.value:3*e),groups:a.a.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e),mesh:r}},e.addTriangle=t,e.addTriangleStrip=function(e,r,n){h(p,r,3*n[0]),h(m,r,3*n[1]);for(var i=2,a=n.length;i<a;i+=2)v(d,p),v(f,m),h(p,r,3*n[i]),h(m,r,3*n[i+1]),t(e,d,f,p),t(e,f,m,p)},e.addTriangleFan=function(e,r,n){h(d,r,3*n[0]);for(var i=2,a=n.length;i<a;++i)h(f,r,3*n[i-1]),h(p,r,3*n[i]),t(e,d,p,f)},e.addPrimitive=function(e,t,r){for(var n=r.vertices,i=r.normals,a=r.indices,o=e.vertices,s=e.normals,u=e.indices,d=e.groups,f=e.currentGroup,p=o.elementCount,m=_(l,t),g=0,v=n.length;g<v;g+=3)b(c,h(c,n,g),t),S(o,c[0],c[1],c[2]),y(c,h(c,i,g),m),S(s,c[0],c[1],c[2]),x(d,f);for(g=0,v=a.length;g<v;g+=3)S(u,a[g]+p,a[g+1]+p,a[g+2]+p)},e.addPrimitiveFlipped=function(e,t,r){for(var n=r.vertices,i=r.normals,a=r.indices,o=e.vertices,s=e.normals,u=e.indices,d=e.groups,f=e.currentGroup,p=o.elementCount,m=_(l,t),g=0,v=n.length;g<v;g+=3)b(c,h(c,n,g),t),S(o,c[0],c[1],c[2]),y(c,h(c,i,g),m),S(s,-c[0],-c[1],-c[2]),x(d,f);for(g=0,v=a.length;g<v;g+=3)S(u,a[g+2]+p,a[g+1]+p,a[g]+p)},e.addCage=function(e,t,r,n,i,a){for(var o=r.vertices,c=r.edges,l={radiusTop:n,radiusBottom:n,radialSegments:a},p=0,m=c.length;p<m;p+=2)h(d,o,3*c[p]),h(f,o,3*c[p+1]),b(d,d,t),b(f,f,t),Object(s.a)(e,d,n,i),Object(s.a)(e,f,n,i),Object(u.a)(e,d,f,1,l)},e.getMesh=function(e){var t=e.vertices,r=e.normals,n=e.indices,i=e.groups,s=e.mesh,u=a.a.compact(t,!0),c=a.a.compact(n,!0),l=a.a.compact(r,!0),d=a.a.compact(i,!0);return o.a.create(u,c,l,d,e.vertices.elementCount,e.indices.elementCount,s)}}(n||(n={}))},function(e,t,r){"use strict";var n=r(147);r.d(t,"b",(function(){return n.a}));var i=r(227);r.d(t,"a",(function(){return i.a}))},function(e,t,r){"use strict";var n=r(0),i=r(134),a=r(192),o=r(9),s=r(163),u=r(5),c=r(209),l=r(6),d=r(12),f=r(4),p=r(88),m=r(22);var h=r(238),g=r(1),v=g.Vec3.zero();function b(e){var t=function(e){for(var t=e.conformation.invariantPosition,r=e.elements,n=new Float32Array(3*r.length),i=0,a=r.length;i<a;i++)t(r[i],v),g.Vec3.toArray(v,n,3*i);return n}(e);return h.a.ofPositions(t)}var y,_=r(203),S=r(133),x=function(){function e(){this.data=new Map}return e.prototype.get=function(e){var t=l.SortedArray.hashCode(e);if(this.data.has(t))for(var r=0,n=this.data.get(t);r<n.length;r++){var i=n[r],a=i[0],o=i[1];if(l.SortedArray.areEqual(e,a))return o}},e.prototype.set=function(e,t){var r=l.SortedArray.hashCode(e);if(this.data.has(r)){for(var n=this.data.get(r),i=0,a=n;i<a.length;i++){var o=a[i];if(l.SortedArray.areEqual(e,o[0]))return void(o[1]=t)}n.push([e,t])}else this.data.set(r,[[e,t]])},e.get=function(t){return t._dynamicPropertyData.ElementSetIntraBondCache||(t._dynamicPropertyData.ElementSetIntraBondCache=new e),t._dynamicPropertyData.ElementSetIntraBondCache},e}(),O=r(95);!function(e){function t(e){for(var t=[],r=0,n=e.length;r<n;r++)t.push(e[r].id);return Object(d.l)(t)}function r(e){var r={};return{elements:e[0].elements,units:e,get unitIndexMap(){return r.unitIndexMap||(r.unitIndexMap=function(e){for(var t=l.IntMap.Mutable(),r=0,n=e.length;r<n;r++)t.set(e[r].id,r);return t}(e)),r.unitIndexMap},hashCode:h(e[0]),transformHash:t(e)}}function h(e){return Object(d.i)(e.invariantId,l.SortedArray.hashCode(e.elements))}e.isAtomic=function(e){return 0===e.kind},e.isCoarse=function(e){return 1===e.kind||2===e.kind},e.isSpheres=function(e){return 1===e.kind},e.isGaussians=function(e){return 2===e.kind},e.create=function(e,t,r,n,a,o,s,u,c){switch(a){case 0:return new v(e,t,r,n,o,u,i.a.createMapping(s,o.atomicConformation,void 0),null!=c?c:y());case 1:return A(e,t,r,n,o,1,u,i.a.createMapping(s,o.coarseConformation.spheres,function(e){var t=e.coarseConformation.spheres.radius;return function(e){return t[e]}}(o)),null!=c?c:j());case 2:return A(e,t,r,n,o,2,u,i.a.createMapping(s,o.coarseConformation.gaussians,(function(e){return 0})),null!=c?c:j())}},e.SymmetryGroup=r,function(e){e.areInvariantElementsEqual=function(e,t){return e.hashCode===t.hashCode&&l.SortedArray.areEqual(e.elements,t.elements)},e.getUnitSymmetryGroupsIndexMap=function(e){for(var t=l.IntMap.Mutable(),r=0,n=e.length;r<n;++r)for(var i=e[r],a=0,o=i.units.length;a<o;++a)t.set(i.units[a].id,r);return t}}(r=e.SymmetryGroup||(e.SymmetryGroup={})),e.conformationId=function(t){return e.isAtomic(t)?t.model.atomicConformation.id:t.model.coarseConformation.id},e.hashUnit=h,function(e){e.is=u.a.has,e.create=u.a.create}(e.Traits||(e.Traits={}));var v=function(){function t(e,t,r,n,i,a,o,s){this.kind=0,this.objectPrimitive="atomistic",this.id=e,this.invariantId=t,this.chainGroupId=r,this.traits=n,this.model=i,this.elements=a,this.conformation=o,this.residueIndex=i.atomicHierarchy.residueAtomSegments.index,this.chainIndex=i.atomicHierarchy.chainAtomSegments.index,this.props=s}return t.prototype.getChild=function(e){return e.length===this.elements.length?this:new t(this.id,this.invariantId,this.chainGroupId,this.traits,this.model,e,this.conformation,y())},t.prototype.applyOperator=function(e,r,n){void 0===n&&(n=!1);var a=n?r:i.a.compose(this.conformation.operator,r);return new t(e,this.invariantId,this.chainGroupId,this.traits,this.model,this.elements,i.a.createMapping(a,this.model.atomicConformation,this.conformation.r),this.props)},t.prototype.remapModel=function(r,s){s||(s=Object(n.__assign)(Object(n.__assign)({},this.props),{bonds:D(this,this.props.bonds,r)}),e.isSameConformation(this,r)||(s.boundary=void 0,s.lookup3d=void 0,s.principalAxes=void 0));var u=this.conformation.operator,c=O.a.Provider.get(r);if(-1!==u.spgrOp&&c&&c!==O.a.Provider.get(this.model)){var l=u.hkl,d=l[0],f=l[1],p=l[2],m=c.spacegroup.cell.toFractional,h=g.Vec3.transformMat4(Object(g.Vec3)(),a.b.getCenter(r),m);u=o.e.getSymmetryOperatorRef(c.spacegroup,u.spgrOp,d,f,p,h)}var v=this.model.atomicConformation!==r.atomicConformation||u!==this.conformation.operator?i.a.createMapping(u,r.atomicConformation):this.conformation;return new t(this.id,this.invariantId,this.chainGroupId,this.traits,r,this.elements,v,s)},Object.defineProperty(t.prototype,"boundary",{get:function(){if(this.props.boundary)return this.props.boundary;var e=this.model.atomicConformation,t=e.x,r=e.y,n=e.z;return this.props.boundary=Object(_.a)({x:t,y:r,z:n,indices:this.elements}),this.props.boundary},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lookup3d",{get:function(){if(this.props.lookup3d)return this.props.lookup3d;var e=this.model.atomicConformation,t=e.x,r=e.y,n=e.z;return this.props.lookup3d=Object(o.c)({x:t,y:r,z:n,indices:this.elements},this.boundary),this.props.lookup3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"principalAxes",{get:function(){return this.props.principalAxes||(this.props.principalAxes=b(this)),this.props.principalAxes},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bonds",{get:function(){if(this.props.bonds)return this.props.bonds;var e=x.get(this.model),t=e.get(this.elements);return t||(t=Object(s.c)(this),e.set(this.elements,t)),this.props.bonds=t,this.props.bonds},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rings",{get:function(){return this.props.rings||(this.props.rings=c.b.create(this)),this.props.rings},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polymerElements",{get:function(){return this.props.polymerElements||(this.props.polymerElements=function(e){for(var t=[],r=e.elements,n=e.model,i=e.model.atomicHierarchy.residueAtomSegments,a=n.atomicHierarchy.derived.residue.traceElementIndex,o=p.a.transientSegments(e.model.atomicRanges.polymerRanges,r),s=l.Segmentation.transientSegments(i,r);o.hasNext;){var u=o.move();for(s.setSegment(u);s.hasNext;){var c=s.move(),d=c.start,f=c.end,m=c.index;if(l.OrderedSet.areIntersecting(l.Interval.ofRange(r[d],r[f-1]),r)){var h=a[m];t.push(-1===h?i.offsets[m]:h)}}}return l.SortedArray.ofSortedArray(t)}(this)),this.props.polymerElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gapElements",{get:function(){return this.props.gapElements||(this.props.gapElements=function(e){for(var t=[],r=e.elements,n=e.model,i=e.residueIndex,a=e.model.atomicHierarchy.residueAtomSegments,o=n.atomicHierarchy.derived.residue.traceElementIndex,s=p.a.transientSegments(e.model.atomicRanges.gapRanges,e.elements);s.hasNext;){var u=s.move(),c=i[r[u.start]],d=i[r[u.end-1]],f=o[c],m=o[d];t.push(-1===f?a.offsets[c]:f),t.push(-1===m?a.offsets[d]:m)}return l.SortedArray.ofSortedArray(t)}(this)),this.props.gapElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"nucleotideElements",{get:function(){return this.props.nucleotideElements||(this.props.nucleotideElements=function(e){for(var t=[],r=e.elements,n=e.model,i=n.atomicHierarchy,a=i.chainAtomSegments,o=i.residueAtomSegments,s=n.atomicHierarchy.derived.residue,u=s.moleculeType,c=s.traceElementIndex,d=l.Segmentation.transientSegments(a,r),f=l.Segmentation.transientSegments(o,r);d.hasNext;)for(f.setSegment(d.move());f.hasNext;){var p=f.move().index;if(Object(m.isNucleic)(u[p])){var h=c[p];t.push(-1===h?o.offsets[p]:h)}}return l.SortedArray.ofSortedArray(t)}(this)),this.props.nucleotideElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"proteinElements",{get:function(){return this.props.proteinElements||(this.props.proteinElements=function(e){for(var t=[],r=e.elements,n=e.model,i=n.atomicHierarchy,a=i.chainAtomSegments,o=i.residueAtomSegments,s=n.atomicHierarchy.derived.residue,u=s.moleculeType,c=s.traceElementIndex,d=l.Segmentation.transientSegments(a,r),f=l.Segmentation.transientSegments(o,r);d.hasNext;)for(f.setSegment(d.move());f.hasNext;){var p=f.move().index;if(Object(m.isProtein)(u[p])){var h=c[p];t.push(-1===h?o.offsets[p]:h)}}return l.SortedArray.ofSortedArray(t)}(this)),this.props.proteinElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"residueCount",{get:function(){if(void 0!==this.props.residueCount)return this.props.residueCount;for(var e=0,t=l.Segmentation.transientSegments(this.model.atomicHierarchy.residueAtomSegments,this.elements);t.hasNext;)t.move(),e+=1;return this.props.residueCount=e,this.props.residueCount},enumerable:!1,configurable:!0}),t.prototype.getResidueIndex=function(e){return this.residueIndex[this.elements[e]]},t}();function y(){return{}}e.Atomic=v;var w=function(){function t(e,t,r,n,i,a,o,s,u){this.kind=a,this.objectPrimitive=1===a?"sphere":"gaussian",this.id=e,this.invariantId=t,this.chainGroupId=r,this.traits=n,this.model=i,this.elements=o,this.conformation=s,this.coarseElements=1===a?i.coarseHierarchy.spheres:i.coarseHierarchy.gaussians,this.coarseConformation=1===a?i.coarseConformation.spheres:i.coarseConformation.gaussians,this.props=u}return t.prototype.getChild=function(e){return e.length===this.elements.length?this:A(this.id,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,e,this.conformation,j())},t.prototype.applyOperator=function(e,t,r){void 0===r&&(r=!1);var n=r?t:i.a.compose(this.conformation.operator,t);return A(e,this.invariantId,this.chainGroupId,this.traits,this.model,this.kind,this.elements,i.a.createMapping(n,this.getCoarseConformation(),this.conformation.r),this.props)},t.prototype.remapModel=function(r,a){var o=this.getCoarseConformation(),s=C(this.kind,r);a||(a=Object(n.__assign)({},this.props),e.isSameConformation(this,r)||(a.boundary=void 0,a.lookup3d=void 0,a.principalAxes=void 0));var u=o!==s?i.a.createMapping(this.conformation.operator,s):this.conformation;return new t(this.id,this.invariantId,this.chainGroupId,this.traits,r,this.kind,this.elements,u,a)},Object.defineProperty(t.prototype,"boundary",{get:function(){if(this.props.boundary)return this.props.boundary;var e=this.getCoarseConformation(),t=e.x,r=e.y,n=e.z;return this.props.boundary=Object(_.a)({x:t,y:r,z:n,indices:this.elements}),this.props.boundary},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lookup3d",{get:function(){if(this.props.lookup3d)return this.props.lookup3d;var e=this.getCoarseConformation(),t=e.x,r=e.y,n=e.z;return this.props.lookup3d=Object(o.c)({x:t,y:r,z:n,indices:this.elements},this.boundary),this.props.lookup3d},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"principalAxes",{get:function(){return this.props.principalAxes||(this.props.principalAxes=b(this)),this.props.principalAxes},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"polymerElements",{get:function(){return this.props.polymerElements||(this.props.polymerElements=function(e){for(var t=[],r=e.elements,n=e.model.coarseHierarchy,i=n.spheres,a=n.gaussians,o=f.Unit.isSpheres(e)?i.polymerRanges:a.polymerRanges,s=p.a.transientSegments(o,r);s.hasNext;)for(var u=s.move(),c=u.start,d=u.end,m=c;m<d;++m)t.push(r[m]);return l.SortedArray.ofSortedArray(t)}(this)),this.props.polymerElements},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"gapElements",{get:function(){return this.props.gapElements||(this.props.gapElements=function(e){for(var t=[],r=e.elements,n=e.model.coarseHierarchy,i=n.spheres,a=n.gaussians,o=f.Unit.isSpheres(e)?i.gapRanges:a.gapRanges,s=p.a.transientSegments(o,r);s.hasNext;){var u=s.move(),c=u.start,d=u.end;t.push(r[c],r[d-1])}return l.SortedArray.ofSortedArray(t)}(this)),this.props.gapElements},enumerable:!1,configurable:!0}),t.prototype.getCoarseConformation=function(){return C(this.kind,this.model)},t}();function C(e,t){return 1===e?t.coarseConformation.spheres:t.coarseConformation.gaussians}function j(){return{}}var P=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t}(w);e.Spheres=P;var E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t}(w);function A(e,t,r,n,i,a,o,s,u){return new w(e,t,r,n,i,a,o,s,u)}function D(e,t,r){var n;if(t){if(e.model.atomicConformation.id===r.atomicConformation.id)return t;var i=S.a.Provider.get(e.model);if(i){var a=S.a.Provider.get(r);return a&&i!==a?void 0:t}return(null===(n=t.props)||void 0===n?void 0:n.canRemap)||T(e,r)?t:void 0}}function T(e,t){var r=a.b.CoordinatesHistory.get(a.b.getRoot(t));if(r)return r.areEqual(e.elements,e.kind,t);for(var n=e.elements,i=e.conformation.coordinates,o=i.x,s=i.y,u=i.z,c=I(e.kind,t),l=c.x,d=c.y,f=c.z,p=0,m=n.length;p<m;p++){var h=n[p];if(o[h]!==l[h]||s[h]!==d[h]||u[h]!==f[h])return!1}return!0}function I(e,t){return 0===e?t.atomicConformation:1===e?t.coarseConformation.spheres:t.coarseConformation.gaussians}function M(e,t){return 0===e?t.atomicHierarchy:1===e?t.coarseHierarchy.spheres:t.coarseHierarchy.gaussians}e.Gaussians=E,e.areSameChainOperatorGroup=function(e,t){return e.chainGroupId===t.chainGroupId&&e.conformation.operator.name===t.conformation.operator.name},e.areOperatorsEqual=function(e,t){return g.Mat4.areEqual(e.conformation.operator.matrix,t.conformation.operator.matrix,1e-6)},e.areConformationsEqual=function(e,t){return!!l.SortedArray.areEqual(e.elements,t.elements)&&T(e,t.model)},e.isSameConformation=T,e.getModelConformationOfKind=I,e.getConformation=function(e){return I(e.kind,e.model)},e.getModelHierarchyOfKind=M,e.getHierarchy=function(e){return M(e.kind,e.model)}}(y||(y={}));t.a=y},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(5),o=r(1),s=r(9),u=r(122),c=r(124),l=r(53),d=r(115),f=r(12),p=r(2),m=r(52),h=r(30),g=r(129),v=r(130),b=r(136);!function(e){function t(e,t,r,i,o,c,l){return l?function(e,t,r,n,i,o,s){return s.vertexCount=i,s.triangleCount=o,a.e.update(s.vertexBuffer,e),a.e.update(s.indexBuffer,t),a.e.update(s.normalBuffer,r),a.e.update(s.groupBuffer,n),s}(e,t,r,i,o,c,l):function(e,t,r,i,o,c){var l,d=Object(s.g)(),f=-1,p=-1,h={kind:"mesh",vertexCount:o,triangleCount:c,vertexBuffer:a.e.create(e),indexBuffer:a.e.create(t),normalBuffer:a.e.create(r),groupBuffer:a.e.create(i),get boundingSphere(){var e=n(h);if(e!==f){var t=Object(m.a)(h.vertexBuffer.ref.value,h.vertexCount,1);s.g.copy(d,t),f=e}return d},get groupMapping(){return h.groupBuffer.ref.version!==p&&(l=Object(u.c)(h.groupBuffer.ref.value,h.vertexCount),p=h.groupBuffer.ref.version),l},setBoundingSphere:function(e){s.g.copy(d,e),f=n(h)}};return h}(e,t,r,i,o,c)}function r(e){return t(e?e.vertexBuffer.ref.value:new Float32Array(0),e?e.indexBuffer.ref.value:new Uint32Array(0),e?e.normalBuffer.ref.value:new Float32Array(0),e?e.groupBuffer.ref.value:new Float32Array(0),0,0,e)}function n(e){return Object(f.l)([e.vertexCount,e.triangleCount,e.vertexBuffer.ref.version,e.indexBuffer.ref.version,e.normalBuffer.ref.version,e.groupBuffer.ref.version])}e.create=t,e.createEmpty=r,e.computeNormals=function(e){var t=e.vertexCount,r=e.triangleCount,n=e.vertexBuffer.ref.value,i=e.indexBuffer.ref.value,o=e.normalBuffer.ref.value.length>=3*t?e.normalBuffer.ref.value:new Float32Array(3*t);o===e.normalBuffer.ref.value&&o.fill(0,0,3*t),Object(u.b)(n,i,o,t,r),a.e.update(e.normalBuffer,o)},e.checkForDuplicateVertices=function(e,t){void 0===t&&(t=3);for(var r=e.vertexBuffer.ref.value,n=new Map,i=function(e,t){return e[0].toFixed(t)+"|"+e[1].toFixed(t)+"|"+e[2].toFixed(t)},a=0,s=Object(o.Vec3)(),u=0,c=e.vertexCount;u<c;++u){o.Vec3.fromArray(s,r,3*u);var l=i(s,t),d=n.get(l);void 0!==d?(a+=1,n.set(l,d+1)):n.set(l,1)}return a};var y=Object(o.Mat3)();function _(e,t){var r=e.vertexCount,n=t.instanceCount.ref.value,i=Object(l.b)(),a=i.position,s=e.vertexBuffer.ref.value,u=t.aTransform.ref.value;return Object(l.a)(r,n,1,(function(e,t){return t<0?o.Vec3.fromArray(a,s,3*e):o.Vec3.transformMat4Offset(a,s,u,0,3*e,16*t),i}))}function S(e,t,r,n,u){var l=r.instanceCount,f=r.groupCount;if(l!==t.instanceCount.ref.value)throw new Error("instanceCount values in TransformData and LocationIterator differ");var p=_(e,t),y=Object(d.a)(r,p,n.color),S=Object(c.a)(l*f),x=Object(g.c)(),O=Object(v.c)(),w=Object(b.d)(),C={drawCount:3*e.triangleCount,vertexCount:e.vertexCount,groupCount:f,instanceCount:l},j=s.g.clone(e.boundingSphere),P=Object(m.b)(j,t.aTransform.ref.value,l);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({aPosition:e.vertexBuffer,aNormal:e.normalBuffer,aGroup:e.groupBuffer,elements:e.indexBuffer,boundingSphere:a.e.create(P),invariantBoundingSphere:a.e.create(j),uInvariantBoundingSphere:a.e.create(o.Vec4.ofSphere(j))},y),S),x),O),w),t),h.a.createValues(u,C)),{dDoubleSided:a.e.create(u.doubleSided),dFlatShaded:a.e.create(u.flatShaded),dFlipSided:a.e.create(u.flipSided),dIgnoreLight:a.e.create(u.ignoreLight),dXrayShaded:a.e.create(u.xrayShaded)})}function x(e,t){h.a.updateRenderableState(e,t),e.opaque=e.opaque&&!t.xrayShaded,e.writeDepth=e.opaque}e.transform=function(e,t){var r=e.vertexBuffer.ref.value;if(Object(u.e)(t,r,0,e.vertexCount),!o.Mat4.isTranslationAndUniformScaling(t)){var n=o.Mat3.directionTransform(y,t);Object(u.d)(n,e.normalBuffer.ref.value,0,e.vertexCount)}a.e.update(e.vertexBuffer,r)},e.uniformTriangleGroup=function(e,t){void 0===t&&(t=!0);var r=e.indexBuffer,n=e.vertexBuffer,i=e.groupBuffer,s=e.normalBuffer,u=e.triangleCount,c=e.vertexCount,l=r.ref.value,d=n.ref.value,p=i.ref.value,m=s.ref.value,h=f.a.create(Uint32Array,3,1024,u),g=f.a.create(Float32Array,3,1024,d);g.currentIndex=3*c,g.elementCount=c;var v=f.a.create(Float32Array,3,1024,m);v.currentIndex=3*c,v.elementCount=c;var b=f.a.create(Float32Array,1,1024,p);b.currentIndex=c,b.elementCount=c;var y=Object(o.Vec3)(),_=Object(o.Vec3)(),S=Object(o.Vec3)(),x=Object(o.Vec3)(),O=Object(o.Vec3)(),w=Object(o.Vec3)();function C(e){o.Vec3.fromArray(y,d,3*e),o.Vec3.fromArray(x,m,3*e),f.a.add3(g,y[0],y[1],y[2]),f.a.add3(v,x[0],x[1],x[2])}function j(e,t){o.Vec3.fromArray(y,d,3*e),o.Vec3.fromArray(_,d,3*t),o.Vec3.scale(y,o.Vec3.add(y,y,_),.5),o.Vec3.fromArray(x,m,3*e),o.Vec3.fromArray(O,m,3*t),o.Vec3.scale(x,o.Vec3.add(x,x,O),.5),f.a.add3(g,y[0],y[1],y[2]),f.a.add3(v,x[0],x[1],x[2])}function P(e,t,r){o.Vec3.fromArray(y,d,3*e),o.Vec3.fromArray(_,d,3*t),o.Vec3.fromArray(S,d,3*r),o.Vec3.scale(y,o.Vec3.add(y,o.Vec3.add(y,y,_),S),1/3),o.Vec3.fromArray(x,m,3*e),o.Vec3.fromArray(O,m,3*t),o.Vec3.fromArray(w,m,3*r),o.Vec3.scale(x,o.Vec3.add(x,o.Vec3.add(x,x,O),w),1/3),f.a.add3(g,y[0],y[1],y[2]),f.a.add3(v,x[0],x[1],x[2])}function E(e,t,r,n,i){++D,C(e),j(e,t),j(e,r),f.a.add3(h,A,A+1,A+2);for(var a=0;a<3;++a)f.a.add(b,n);A+=3,D+=2,C(t),C(r),j(e,t),j(e,r),f.a.add3(h,A,A+1,A+3),f.a.add3(h,A,A+3,A+2);for(a=0;a<4;++a)f.a.add(b,i);A+=4}var A=c,D=0;if(t)for(var T=0,I=u;T<I;++T){var M=l[3*T],k=l[3*T+1],B=l[3*T+2],V=p[M],R=p[k],L=p[B];if(V===R&&V===L)++D,f.a.add3(h,M,k,B);else if(V===R)E(B,M,k,L,V);else if(V===L)E(k,B,M,R,L);else if(R===L)E(M,k,B,V,R);else{D+=2,C(M),j(M,k),j(M,B),P(M,k,B),f.a.add3(h,A,A+1,A+3),f.a.add3(h,A,A+3,A+2);for(var N=0;N<4;++N)f.a.add(b,V);A+=4,D+=2,C(k),j(k,B),j(k,M),P(M,k,B),f.a.add3(h,A,A+1,A+3),f.a.add3(h,A,A+3,A+2);for(N=0;N<4;++N)f.a.add(b,R);A+=4,D+=2,C(B),j(B,k),j(B,M),P(M,k,B),f.a.add3(h,A+3,A+1,A),f.a.add3(h,A+2,A+3,A);for(N=0;N<4;++N)f.a.add(b,L);A+=4}}else for(T=0,I=u;T<I;++T){M=l[3*T],k=l[3*T+1],B=l[3*T+2],V=p[M],R=p[k],L=p[B];if(V!==R||V!==L){++D,C(M),C(k),C(B),f.a.add3(h,A,A+1,A+2);var F=R===L?R:V;for(N=0;N<3;++N)f.a.add(b,F);A+=3}else++D,f.a.add3(h,M,k,B)}var U=f.a.compact(h),z=f.a.compact(g),H=f.a.compact(v),G=f.a.compact(b);return e.vertexCount=A,e.triangleCount=D,a.e.update(n,z),a.e.update(i,G),a.e.update(r,U),a.e.update(s,H),e},e.Params=Object(i.__assign)(Object(i.__assign)({},h.a.Params),{doubleSided:p.ParamDefinition.Boolean(!1,h.a.CustomQualityParamInfo),flipSided:p.ParamDefinition.Boolean(!1,h.a.ShadingCategory),flatShaded:p.ParamDefinition.Boolean(!1,h.a.ShadingCategory),ignoreLight:p.ParamDefinition.Boolean(!1,h.a.ShadingCategory),xrayShaded:p.ParamDefinition.Boolean(!1,h.a.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:r,createValues:S,createValuesSimple:function(t,r,n,a,o){var s=h.a.createSimple(n,a,o),u=Object(i.__assign)(Object(i.__assign)({},p.ParamDefinition.getDefaultValues(e.Params)),r);return S(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){h.a.updateValues(e,t),a.e.updateIfChanged(e.dDoubleSided,t.doubleSided),a.e.updateIfChanged(e.dFlatShaded,t.flatShaded),a.e.updateIfChanged(e.dFlipSided,t.flipSided),a.e.updateIfChanged(e.dIgnoreLight,t.ignoreLight),a.e.updateIfChanged(e.dXrayShaded,t.xrayShaded)},updateBoundingSphere:function(e,t){var r=s.g.clone(t.boundingSphere),n=Object(m.b)(r,e.aTransform.ref.value,e.instanceCount.ref.value);s.g.equals(n,e.boundingSphere.ref.value)||a.e.update(e.boundingSphere,n);s.g.equals(r,e.invariantBoundingSphere.ref.value)||(a.e.update(e.invariantBoundingSphere,r),a.e.update(e.uInvariantBoundingSphere,o.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=h.a.createRenderableState(e);return x(t,e),t},updateRenderableState:x,createPositionIterator:_}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(57),a=r(28),o=r(159),s=r(6);!function(e){function t(e,t){return{kind:"singletons",source:e,structure:t}}function r(e,t){return{kind:"sequence",source:e,structures:t}}function n(e){return t(e,a.c.Empty)}function u(e){return"singletons"===e.kind}function c(e){return u(e)?0===e.structure.units.length:0===e.structures.length}function l(e){return c(e)?a.c.Empty:u(e)?e.structure:Object(o.e)(e.source,e.structures)}function d(e,i,a){return 0===i.length?n(e):a?t(e,Object(o.e)(e,i)):r(e,i)}e.Singletons=t,e.Sequence=r,e.Empty=n,e.isSingleton=u,e.isEmpty=c,e.structureCount=function(e){return u(e)?e.structure.elementCount:e.structures.length},e.unionStructure=l,e.toLociWithCurrentUnits=function(e){for(var t=[],r=e.source.unitMap,n=0,i=l(e).units;n<i.length;n++){var o=i[n];o===r.get(o.id)?t[t.length]={unit:o,indices:s.OrderedSet.ofBounds(0,o.elements.length)}:t[t.length]={unit:o,indices:s.OrderedSet.ofSortedArray(s.SortedArray.indicesOf(r.get(o.id).elements,o.elements))}}return a.d.Loci(e.source,t)},e.toLociWithSourceUnits=function(e){for(var t=[],r=e.source.unitMap,n=0,i=l(e).units;n<i.length;n++){var o=i[n],u=r.get(o.id);t[t.length]=u===o?{unit:u,indices:s.OrderedSet.ofBounds(0,u.elements.length)}:{unit:u,indices:s.OrderedSet.ofSortedArray(s.SortedArray.indicesOf(u.elements,o.elements))}}return a.d.Loci(e.source,t)};var f=function(){function e(e){this.source=e,this.structures=[],this.allSingletons=!0}return e.prototype.add=function(e){var t=e.elementCount;0!==t&&(this.structures[this.structures.length]=e,1!==t&&(this.allSingletons=!1))},e.prototype.getSelection=function(){return d(this.source,this.structures,this.allSingletons)},e}(),p=function(){function e(e){this.structure=e,this.structures=[],this.allSingletons=!0,this.uniqueSets=Object(i.a)(a.c.hashCode,a.c.areUnitIdsAndIndicesEqual)}return e.prototype.add=function(e){var t=e.elementCount;0!==t&&this.uniqueSets.add(e)&&(this.structures[this.structures.length]=e,1!==t&&(this.allSingletons=!1))},e.prototype.getSelection=function(){return d(this.structure,this.structures,this.allSingletons)},e}();e.LinearBuilder=function(e){return new f(e)},e.UniqueBuilder=function(e){return new p(e)},e.forEach=function(t,r){var n=0;if(e.isSingleton(t))for(var i=0,o=t.structure.units;i<o.length;i++)for(var u=o[i],c=u.elements,l=0,d=c.length;l<d;l++){r(a.c.create([u.getChild(s.SortedArray.ofSingleton(c[l]))],{parent:t.source}),n++)}else for(var f=0,p=t.structures;f<p.length;f++){r(p[f],n++)}},e.withInputStructure=function(e,n){return u(e)?t(n,e.structure):r(n,e.structures)}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return c}));var n=r(20),i=r(34),a=r(45),o=r(259),s=function(e){function t(t){var r=e.call(this)||this;return r.parent=t,r}return n.a(t,e),t.prototype._next=function(e){this.parent.notifyNext(e)},t.prototype._error=function(e){this.parent.notifyError(e),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(),this.unsubscribe()},t}(i.a),u=(i.a,function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.a(t,e),t.prototype.notifyNext=function(e){this.destination.next(e)},t.prototype.notifyError=function(e){this.destination.error(e)},t.prototype.notifyComplete=function(){this.destination.complete()},t}(i.a));i.a;function c(e,t){if(!t.closed){if(e instanceof a.a)return e.subscribe(t);var r;try{r=Object(o.a)(e)(t)}catch(e){t.error(e)}return r}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return S})),r.d(t,"a",(function(){return _}));var n,i=r(0),a=r(2),o=r(94),s=r(62),u=r(17),c=r(51),l=r(23),d=r(140),f=r(141),p=r(1),m=r(160),h=r(30),g=r(65),v=r(85);!function(e){e.getDetaultParams=function(e,t,r){return a.ParamDefinition.getDefaultValues(e.getParams(t,r))}}(n||(n={}));var b={label:"",description:"",factory:function(){return _.Empty},getParams:function(){return{}},defaultValues:{}};function y(e){return e.map((function(e){return[e.name,e.provider.label]}))}var _,S=function(){function e(){this._list=[],this._map=new Map,this._name=new Map}return Object.defineProperty(e.prototype,"default",{get:function(){return this._list[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"types",{get:function(){return y(this._list)},enumerable:!1,configurable:!0}),e.prototype.add=function(e){if(this._map.has(e.name))throw new Error(e.name+" already registered.");this._list.push({name:e.name,provider:e}),this._map.set(e.name,e),this._name.set(e,e.name)},e.prototype.getName=function(e){if(!this._name.has(e))throw new Error("'"+e.label+"' is not a registered represenatation provider.");return this._name.get(e)},e.prototype.remove=function(e){var t=e.name;this._list.splice(this._list.findIndex((function(e){return e.name===t})),1);var r=this._map.get(t);r&&(this._map.delete(t),this._name.delete(r))},e.prototype.get=function(e){return this._map.get(e)||b},Object.defineProperty(e.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),e.prototype.getApplicableList=function(e){return this._list.filter((function(t){return t.provider.isApplicable(e)}))},e.prototype.getApplicableTypes=function(e){return y(this.getApplicableList(e))},e}();!function(e){function t(){return{visible:!0,alphaFactor:1,pickable:!0,colorOnly:!1,syncManually:!1,transform:p.Mat4.identity(),overpaint:d.a.Empty,transparency:f.a.Empty,clipping:v.a.Empty,markerActions:c.b.All}}function r(e,t){void 0!==t.visible&&(e.visible=t.visible),void 0!==t.alphaFactor&&(e.alphaFactor=t.alphaFactor),void 0!==t.pickable&&(e.pickable=t.pickable),void 0!==t.colorOnly&&(e.colorOnly=t.colorOnly),void 0!==t.overpaint&&(e.overpaint=t.overpaint),void 0!==t.transparency&&(e.transparency=t.transparency),void 0!==t.clipping&&(e.clipping=t.clipping),void 0!==t.syncManually&&(e.syncManually=t.syncManually),void 0!==t.transform&&p.Mat4.copy(e.transform,t.transform),void 0!==t.markerActions&&(e.markerActions=t.markerActions)}!function(e){e.areEqual=function(e,t){return e.repr===t.repr&&l.Loci.areEqual(e.loci,t.loci)},e.isEmpty=function(e){return l.Loci.isEmpty(e.loci)},e.Empty={loci:l.EmptyLoci}}(e.Loci||(e.Loci={})),e.createState=t,e.updateState=r,e.StateBuilder={create:t,update:r},e.Empty={label:"",groupCount:0,renderObjects:[],props:{},params:{},updated:new s.a,state:t(),theme:o.a.createEmpty(),createOrUpdate:function(){return u.b.constant("",void 0)},setState:function(){},setTheme:function(){},getLoci:function(){return l.EmptyLoci},mark:function(){return!1},destroy:function(){}},e.createMulti=function(e,t,r,n,c){var d,f,p,h=this,g=0,v=new s.a,b=n.create(),y=o.a.createEmpty(),_={},S=Object.keys(c).map((function(e,n){_[n]=e;var i=c[e](t,r);return i.setState(b),i}));return{label:e,updated:v,get groupCount(){var e=0;if(f)for(var t=f.visuals,r=0,n=S.length;r<n;++r)t&&!t.includes(_[r])||(e+=S[r].groupCount);return e},get renderObjects(){var e=[];if(f)for(var t=f.visuals,r=0,n=S.length;r<n;++r)t&&!t.includes(_[r])||e.push.apply(e,S[r].renderObjects);return e},get props(){return f},get params(){return d},createOrUpdate:function(n,o){void 0===n&&(n={}),o&&o!==p&&(d=r(t,o),p=o,f||(f=a.ParamDefinition.getDefaultValues(d)));var s=Object(m.b)(Object.assign({},f,n),p);Object.assign(f,n,s);var c=f.visuals;return u.b.create("Creating or updating '"+e+"' representation",(function(e){return Object(i.__awaiter)(h,void 0,void 0,(function(){var t,r;return Object(i.__generator)(this,(function(n){switch(n.label){case 0:t=0,r=S.length,n.label=1;case 1:return t<r?c&&!c.includes(_[t])?[3,3]:[4,S[t].createOrUpdate(f,p).runInContext(e)]:[3,4];case 2:n.sent(),n.label=3;case 3:return++t,[3,1];case 4:return v.next(g++),[2]}}))}))}))},get state(){return b},get theme(){return y},getLoci:function(e){for(var t=f.visuals,r=0,n=S.length;r<n;++r)if(!t||t.includes(_[r])){var i=S[r].getLoci(e);if(!Object(l.isEmptyLoci)(i))return i}return l.EmptyLoci},mark:function(e,t){for(var r=!1,n=0,i=S.length;n<i;++n)r=S[n].mark(e,t)||r;return r},setState:function(e){n.update(b,e);for(var t=0,r=S.length;t<r;++t)S[t].setState(b)},setTheme:function(e){for(var t=0,r=S.length;t<r;++t)S[t].setTheme(e)},destroy:function(){for(var e=0,t=S.length;e<t;++e)S[e].destroy()}}},e.fromRenderObject=function(t,r){var n=this,c=0,d=new s.a,f=e.createState(),p=o.a.createEmpty(),v=a.ParamDefinition.clone(h.a.Params),b=a.ParamDefinition.getDefaultValues(h.a.Params);return{label:t,updated:d,get groupCount(){return r.values.uGroupCount.ref.value},get renderObjects(){return[r]},get props(){return b},get params(){return v},createOrUpdate:function(e){void 0===e&&(e={});var r=Object(m.b)(Object.assign({},b,e));return Object.assign(b,e,r),u.b.create("Updating '"+t+"' representation",(function(e){return Object(i.__awaiter)(n,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){return d.next(c++),[2]}))}))}))},get state(){return f},get theme(){return p},getLoci:function(){return l.EmptyLoci},mark:function(e,t){return!1},setState:function(t){void 0!==t.visible&&g.a.setVisibility(r,t.visible),void 0!==t.alphaFactor&&g.a.setAlphaFactor(r,t.alphaFactor),void 0!==t.pickable&&g.a.setPickable(r,t.pickable),void 0!==t.colorOnly&&g.a.setColorOnly(r,t.colorOnly),t.overpaint,t.transparency,void 0!==t.transform&&g.a.setTransform(r,t.transform),e.updateState(f,t)},setTheme:function(){},destroy:function(){}}}}(_||(_={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"g",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"d",(function(){return d})),r.d(t,"f",(function(){return f})),r.d(t,"c",(function(){return p})),r.d(t,"e",(function(){return m}));var n=r(0);function i(e,t){return void 0===t&&(t=" "),e.replace(/([a-z\xE0-\xFF])([A-Z\xC0\xDF])/g,"$1"+t+"$2")}function a(e){return u(i(e))}var o=function(e){return e.toUpperCase()};function s(e){return e?"string"==typeof e?e.toUpperCase():(""+e).toUpperCase():""}function u(e){return e.toLowerCase().replace(/^\w|\s\w/g,o)}function c(e){return e.replace(/_/g," ")}function l(e){return e.replace(/-/g," ")}function d(e){return u(i(c(l(e))))}function f(e,t,r,n){var i=n.length;if(i>r-t)return!1;for(var a=0;a<i;a++)if(e.charCodeAt(t+a)!==n.charCodeAt(a))return!1;return!0}function p(e,t){var r=Object.keys(t),i=Object.values(t);return(new(Function.bind.apply(Function,Object(n.__spreadArrays)([void 0],r,["return `"+e+"`;"])))).apply(void 0,i)}function m(e){return e.replace(/<\/?[^>]+>/g,"")}},function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return o}));var n=r(19);function i(e,t,r){return Object(n.d)("",e,t,r)}function a(e){!function e(t,r,i){if(Object(n.e)(i))return i.info.namespace=t,i.info.name=i.info.name||s(r),void(i.id=i.info.namespace+"."+i.info.name);for(var a=""+(i["@namespace"]||s(r)),o=t?t+"."+a:a,u=0,c=Object.keys(i);u<c.length;u++){var l=c[u];("object"==typeof i[l]||Object(n.e)(i[l]))&&e(o,l,i[l])}}("","",e)}function o(e){var t=[];return function e(t,r){if(Object(n.e)(t))return void r.push(t);for(var i=0,a=Object.keys(t);i<a.length;i++){var o=a[i];("object"==typeof t[o]||Object(n.e)(t[o]))&&e(t[o],r)}}(e,t),t}function s(e){var t=/([a-z])([A-Z])([a-z]|$)/g;return e.replace(t,(function(e,t,r,n){return t+"-"+r.toLocaleLowerCase()+n})).replace(t,(function(e,t,r,n){return t+"-"+r.toLocaleLowerCase()+n}))}},function(e,t,r){"use strict";r.d(t,"d",(function(){return n})),r.d(t,"c",(function(){return a})),r.d(t,"f",(function(){return o})),r.d(t,"e",(function(){return s})),r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return c}));var n=Math.PI/2,i=Math.PI/180;function a(e){return e*i}function o(e){return e/i}function s(e){return 0!==e&&0==(e&e-1)}function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=0,n=0,i=0,a=e.length;i<a;++i){var o=e[i],s=Math.abs(o);s>n&&(r=o,n=s)}return r}function c(e,t){return e*t}},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(310),i=r(34),a=r(285),o=r(321);var s=r(211),u=r(281),c=r(182),l=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(e,t,r){var n=this.operator,s=function(e,t,r){if(e){if(e instanceof i.a)return e;if(e[a.a])return e[a.a]()}return e||t||r?new i.a(e,t,r):new i.a(o.a)}(e,t,r);if(n?s.add(n.call(s,this.source)):s.add(this.source||c.a.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),c.a.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){c.a.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),Object(n.a)(e)?e.error(t):console.warn(t)}},e.prototype.forEach=function(e,t){var r=this;return new(t=d(t))((function(t,n){var i;i=r.subscribe((function(t){try{e(t)}catch(e){n(e),i&&i.unsubscribe()}}),n,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[s.a]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 0===e.length?this:Object(u.b)(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=d(e))((function(e,r){var n;t.subscribe((function(e){return n=e}),(function(e){return r(e)}),(function(){return e(n)}))}))},e.create=function(t){return new e(t)},e}();function d(e){if(e||(e=c.a.Promise||Promise),!e)throw new Error("no Promise impl found");return e}},function(e,t,r){"use strict";r.r(t),r.d(t,"Color",(function(){return a})),r.d(t,"ColorList",(function(){return o})),r.d(t,"ColorTable",(function(){return s})),r.d(t,"ColorMap",(function(){return u})),r.d(t,"getAdjustedColorMap",(function(){return c})),r.d(t,"ColorSwatch",(function(){return l}));var n=r(244),i=r(165);function a(e){return e}function o(e,t,r,n){return{label:e,description:r,list:n,type:t}}function s(e){return e}function u(e){return e}function c(e,t,r){var n={};for(var i in e){var o=e[i];o=a.saturate(o,t),o=a.darken(o,-r),n[i]=o}return n}function l(e){return e}!function(e){function t(e,t,r){return e<<16|t<<8|r}function r(e,t,r){return 255*e<<16|255*t<<8|255*r}e.toStyle=function(e){return"rgb("+(e>>16&255)+", "+(e>>8&255)+", "+(255&e)+")"},e.toHexString=function(e){return"0x"+("000000"+e.toString(16)).slice(-6)},e.toRgbString=function(t){return"RGB: "+e.toRgb(t).join(", ")},e.toRgb=function(e){return[e>>16&255,e>>8&255,255&e]},e.toRgbNormalized=function(e){return[(e>>16&255)/255,(e>>8&255)/255,(255&e)/255]},e.fromRgb=t,e.fromNormalizedRgb=r,e.fromArray=function(e,r){return t(e[r],e[r+1],e[r+2])},e.fromNormalizedArray=function(e,t){return r(e[t],e[t+1],e[t+2])},e.toArray=function(e,t,r){return t[r]=e>>16&255,t[r+1]=e>>8&255,t[r+2]=255&e,t},e.toArrayNormalized=function(e,t,r){return t[r]=(e>>16&255)/255,t[r+1]=(e>>8&255)/255,t[r+2]=(255&e)/255,t},e.toVec3=function(e,t){return e[0]=t>>16&255,e[1]=t>>8&255,e[2]=255&t,e},e.toVec3Normalized=function(e,t){return e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e},e.interpolate=function(e,t,r){var n=e>>16&255,i=e>>8&255,a=255&e;return n+((t>>16&255)-n)*r<<16|i+((t>>8&255)-i)*r<<8|a+((255&t)-a)*r};var a=[0,0,0];function o(e,t){return n.a.fromColor(a,e),n.a.toColor(n.a.saturate(a,a,t))}e.saturate=o,e.desaturate=function(e,t){return o(e,-t)};var s=[0,0,0];function u(e,t){return i.a.fromColor(s,e),i.a.toColor(i.a.darken(s,s,t))}function c(e){return e<.04045?.0773993808*e:Math.pow(.9478672986*e+.0521327014,2.4)}function l(e){return e<.0031308?12.92*e:1.055*Math.pow(e,.41666)-.055}e.darken=u,e.lighten=function(e,t){return u(e,-t)},e.sRGBToLinear=function(e){return r(c((e>>16&255)/255),c((e>>8&255)/255),c((255&e)/255))},e.linearToSRGB=function(e){return r(l((e>>16&255)/255),l((e>>8&255)/255),l((255&e)/255))}}(a||(a={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n,i=r(46),a=Object(i.ColorMap)({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflower:6591981,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,laserlemon:16777044,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrod:16448210,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,maroon2:8323072,maroon3:11546720,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,purple2:8323199,purple3:10494192,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});n=new Map,Object.keys(a).forEach((function(e){n.set(a[e],e)}))},function(e,t,r){"use strict";(function(e){var n;r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return a}));var i=void 0!==e&&"production"===(null===(n=e.env)||void 0===n?void 0:"production"),a=void 0!==e&&("*"===void e.env||"molstar"===void e.env)}).call(this,r(344))},function(e,t,r){"use strict";r.d(t,"g",(function(){return E})),r.d(t,"h",(function(){return A})),r.d(t,"k",(function(){return D})),r.d(t,"l",(function(){return T})),r.d(t,"a",(function(){return I})),r.d(t,"b",(function(){return M})),r.d(t,"i",(function(){return k})),r.d(t,"j",(function(){return B})),r.d(t,"e",(function(){return V})),r.d(t,"f",(function(){return R})),r.d(t,"c",(function(){return L})),r.d(t,"d",(function(){return N})),r.d(t,"m",(function(){return F})),r.d(t,"n",(function(){return U}));var n=r(0),i=r(4),a=r(65),o=r(125),s=r(94),u=r(50),c=r(121),l=r(23),d=r(6),f=r(160),p=r(202),m=r(124),h=r(5),g=r(132),v=r(115),b=r(38),y=r(135),_=r(270),S=r(166),x=r(269),O=r(80),w=(r(144),r(151)),C=r(191),j=r(86);function P(e,t){var r,n,b,y,_,S,x,O,w=e.defaultProps,C=e.createGeometry,j=e.createLocationIterator,P=e.getLoci,E=e.eachLocation,A=e.setUpdateState,D=e.mustRecreate,T=e.dispose,I=e.geometryUtils,M=I.createEmpty,k=I.updateValues,B=I.updateBoundingSphere,V=I.updateRenderableState,R=I.createPositionIterator,L=f.a.create(),N=Object.assign({},w),F=s.a.createEmpty();function U(e){if(L.createNew){if(x=j(n),!e)throw new Error("expected geometry to be given");r=function(e,t,r,n,i,a){var s=o.a.getUtils(t),l=s.createValues,d=s.createRenderableState,f=l(t,Object(u.c)(e),r,n,i),p=d(i);return Object(c.a)(t.kind,f,p,a)}(n.group,e,x,F,N,t),O=R(e,r.values)}else{if(!r)throw new Error("expected renderObject to be available");if(L.updateTransform){var i=(x=j(n)).instanceCount,a=x.groupCount;Object(m.a)(i*a,r.values)}if(L.updateMatrix&&Object(u.c)(n.group,r.values),L.createGeometry){if(!e)throw new Error("expected geometry to be given");h.e.updateIfChanged(r.values.drawCount,o.a.getDrawCount(e)),h.e.updateIfChanged(r.values.uVertexCount,o.a.getVertexCount(e))}(L.updateTransform||L.createGeometry)&&(B(r.values,e||S),O=R(e||S,r.values)),L.updateSize&&"uSize"in r.values&&Object(g.a)(x,F.size,r.values),L.updateColor&&Object(v.a)(x,O,F.color,r.values),k(r.values,N),V(r.state,N)}b=N,y=F,_=n,e&&(S=e)}function z(e,t,r){return function(e){return!!Object(l.isEveryLoci)(e)||(!(!i.Structure.isLoci(e)||!i.Structure.areRootsEquivalent(e.structure,_.structure))||!!(i.StructureElement.Loci.is(e)&&i.Structure.areRootsEquivalent(e.structure,_.structure)&&i.StructureElement.Loci.isWholeStructure(e)))}(e)?t(d.Interval.ofBounds(0,x.groupCount*x.instanceCount)):E(e,_,t,r)}return{get groupCount(){return x?x.count:0},get renderObject(){return x&&x.count?r:void 0},createOrUpdate:function(e,t,a,o){if(function(e,t,a){if(!a&&!_)throw new Error("missing structureGroup");if(N=t,F=e,n=a,f.a.reset(L),!r||!_)return L.createNew=!0,void(L.createGeometry=!0);A(L,N,b,F,y,n,_),i.Structure.areHierarchiesEqual(_.structure,n.structure)||(L.updateTransform=!0,L.updateColor=!0,L.updateSize=!0),p.a.areEqual(F.color,y.color)||(L.updateColor=!0),Object(h.g)(N.unitKinds,b.unitKinds)||(L.createGeometry=!0),n.group.transformHash!==_.group.transformHash&&(n.group.units.length!==_.group.units.length||L.updateColor?L.updateTransform=!0:L.updateMatrix=!0);var o=n.group.units[0],s=_.group.units[0];i.Unit.areOperatorsEqual(o,s)||(L.updateTransform=!0),i.Unit.areConformationsEqual(o,s)||(L.createGeometry=!0),L.updateTransform&&(L.updateMatrix=!0),L.updateSize&&!("uSize"in r.values)&&(L.createGeometry=!0),(L.createGeometry||L.updateTransform)&&(_.structure.hashCode!==n.structure.hashCode&&(L.updateColor=!0,L.updateSize=!0),F.color.granularity.startsWith("vertex")&&(L.updateColor=!0))}(t,a,o||_),L.createGeometry){var s=function(e,t,r,n,i,a){return Object(u.m)(i.unitKinds,t)?C(e,t,r,n,i,a):M(a)}(e,n.group.units[0],n.structure,F,N,S);return s instanceof Promise?s.then(U):U(s)}U()},getLoci:function(e){return r?P(e,_,r.id):l.EmptyLoci},mark:function(e,t){return a.a.mark(r,e,t,z)},setVisibility:function(e){a.a.setVisibility(r,e)},setAlphaFactor:function(e){a.a.setAlphaFactor(r,e)},setPickable:function(e){a.a.setPickable(r,e)},setColorOnly:function(e){a.a.setColorOnly(r,e)},setTransform:function(e,t){a.a.setTransform(r,e,t)},setOverpaint:function(e){a.a.setOverpaint(r,e,z,!0)},setTransparency:function(e){a.a.setTransparency(r,e,z,!0)},setClipping:function(e){a.a.setClipping(r,e,z,!0)},destroy:function(){null==T||T(S),r&&(r.state.disposed=!0,r=void 0)},mustRecreate:D}}var E=Object(n.__assign)(Object(n.__assign)({},j.d),j.e);function A(e,t){return P(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),y.a.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:b.a.Utils}),t)}var D=Object(n.__assign)(Object(n.__assign)({},j.g),j.e);function T(e,t){return P(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),y.a.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:_.a.Utils}),t)}var I=Object(n.__assign)(Object(n.__assign)({},j.a),j.e);function M(e,t){return P(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),y.a.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:S.a.Utils}),t)}var k=Object(n.__assign)(Object(n.__assign)({},j.f),j.e);function B(e,t){return P(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),y.a.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:x.a.Utils}),t)}var V=Object(n.__assign)(Object(n.__assign)({},j.c),j.e);function R(e,t){return P(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),y.a.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:O.a.Utils}),t)}Object(n.__assign)(Object(n.__assign)({},j.h),j.e);var L=Object(n.__assign)(Object(n.__assign)({},j.b),j.e);function N(e,t){return P(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),y.a.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:w.a.Utils}),t)}var F=Object(n.__assign)(Object(n.__assign)({},j.i),j.e);function U(e,t){return P(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),y.a.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:C.a.Utils}),t)}},function(e,t,r){"use strict";r.d(t,"g",(function(){return h})),r.d(t,"e",(function(){return g})),r.d(t,"f",(function(){return v})),r.d(t,"c",(function(){return b})),r.d(t,"b",(function(){return y})),r.d(t,"m",(function(){return _})),r.d(t,"l",(function(){return S})),r.d(t,"d",(function(){return x})),r.d(t,"a",(function(){return O})),r.d(t,"j",(function(){return j})),r.d(t,"h",(function(){return P})),r.d(t,"o",(function(){return A})),r.d(t,"n",(function(){return D})),r.d(t,"p",(function(){return T})),r.d(t,"k",(function(){return I})),r.d(t,"i",(function(){return M}));var n=r(0),i=r(4),a=r(1),o=r(188),s=r(6),u=r(23),c=r(290),l=r(120),d=r(29),f=r(2),p=r(203),m=r(9);function h(e,t,r){var n=t.elements,a=t.model;if(-1!==s.OrderedSet.indexOf(n,r)){for(var o=a.atomicHierarchy.residueAtomSegments,c=o.index,l=o.offsets,d=c[r],f=[],p=l[d],m=l[d+1];p<m;++p){var h=s.OrderedSet.indexOf(n,p);-1!==h&&f.push(h)}var g=s.OrderedSet.ofSortedArray(s.SortedArray.ofSortedArray(f));return i.StructureElement.Loci(e,[{unit:t,indices:g}])}return u.EmptyLoci}function g(e,t,r){var n=t.elements,a=t.model,o=a.atomicHierarchy.atoms.label_alt_id.value(r);return-1!==s.OrderedSet.indexOf(n,r)?v(e,t,a.atomicHierarchy.residueAtomSegments.index[r],o):i.StructureElement.Loci(e,[])}function v(e,t,r,n){for(var a=t.elements,o=t.model,u=o.atomicHierarchy.atoms.label_alt_id,c=o.atomicHierarchy.residueAtomSegments.offsets,l=[],d=c[r],f=c[r+1];d<f;++d){var p=s.OrderedSet.indexOf(a,d);if(-1!==p){var m=u.value(d);n!==m&&""!==m||l.push(p)}}var h=s.OrderedSet.ofSortedArray(s.SortedArray.ofSortedArray(l));return i.StructureElement.Loci(e,[{unit:t,indices:h}])}function b(e,t){for(var r=e.units,n=r.length,i=16*n,s=t&&t.aTransform.ref.value.length>=i?t.aTransform.ref.value:new Float32Array(i),u=0;u<n;u++)a.Mat4.toArray(r[u].conformation.operator.matrix,s,16*u);return Object(o.b)(s,n,t)}var y=f.ParamDefinition.objectToOptions({atomic:{},spheres:{},gaussians:{}});function _(e,t){for(var r=0,n=e.length;r<n;++r){if(i.Unit.isAtomic(t)&&"atomic"===e[r])return!0;if(i.Unit.isSpheres(t)&&"spheres"===e[r])return!0;if(i.Unit.isGaussians(t)&&"gaussians"===e[r])return!0}return!1}function S(e,t,r){void 0===r&&(r=5e8);var n=m.b.size(Object(a.Vec3)(),e);a.Vec3.ceil(n,n),n.sort((function(e,t){return t-e}));var i=Math.floor(Math.cbrt(r)*Math.cbrt(r)),o=n[0]*n[1];return{area:o,areaCells:Math.ceil(o/(t*t)),maxAreaCells:i}}function x(e,t,r){void 0===r&&(r=5e8);var i=S(e,t.resolution,r),a=i.area,o=i.areaCells,s=i.maxAreaCells,u=o>s?Math.sqrt(a/s):t.resolution;return Object(n.__assign)(Object(n.__assign)({},t),{resolution:u})}var O={ignoreHydrogens:f.ParamDefinition.Boolean(!1,{description:"Whether or not to include hydrogen atoms in the surface calculation."}),traceOnly:f.ParamDefinition.Boolean(!1,{description:"Whether or not to only use trace atoms in the surface calculation."}),includeParent:f.ParamDefinition.Boolean(!1,{description:"Include elements of the parent structure in surface calculation to get a surface patch of the current structure."})},w=(f.ParamDefinition.getDefaultValues(O),Object(a.Vec3)());function C(e,t,r,n){return a.Vec3.squaredDistance(a.Vec3.set(w,e,t,r),n)}function j(e,t,r){var n,a,o=r.ignoreHydrogens,u=r.traceOnly,l=r.includeParent,f=l?e.root.unitMap.get(t.id):t,m=function(e){switch(e.kind){case 0:return e.model.atomicConformation;case 1:return e.model.coarseConformation.spheres;case 2:return e.model.coarseConformation.gaussians}}(f),h=m.x,g=m.y,v=m.z,b=f.elements,y=t.boundary.sphere,_=y.center,S=y.radius,x=(S+7)*(S+7);if(o||u||l&&f!==t){for(var O=[],w=[],j=0,P=b.length;j<P;++j){var E=b[j];o&&A(f,E)||(u&&!T(f,E)||l&&C(h[E],g[E],v[E],_)>x||(O.push(E),w.push(j)))}n=s.SortedArray.ofSortedArray(O),a=w}else n=b,a=Object(d.fillSerial)(new Int32Array(n.length));l&&f!==t&&function(e,t,r){for(var n=0,i=t.length,a=0,o=r.length;a<o;++a){var u=s.SortedArray.indexOfInRange(t,r[a],n,i);-1===u?e[a]=-2:(e[a]=u,n=u)}}(a,t.elements,n);var D={indices:n,x:h,y:g,z:v,id:a},I=t===f?t.boundary:Object(p.a)(D),M=i.StructureElement.Location.create(e,f),k=Object(c.a)({},{scale:1});return{position:D,boundary:I,radius:function(e){return M.element=e,k.size(M)}}}function P(e,t,r){var n,a,o,u,l,f=i.StructureElement.Location.create(e),p=Object(c.a)({},{scale:1});if(t||r){for(var m=[],h=[],g=[],v=[],b=[],y=0,_=0,S=e.units.length;y<S;++y){var x=(M=e.units[y]).elements,O=M.conformation,w=O.x,C=O.y,j=O.z;f.unit=M;for(var P=0,E=x.length;P<E;++P){var D=x[P];t&&A(M,D)||(r&&!T(M,D)||(m.push(w(D)),h.push(C(D)),g.push(j(D)),f.element=D,v.push(p.size(f)),b.push(_+P)))}_+=x.length}n=m,a=h,o=g,u=v,l=b}else{var I=e.elementCount;for(m=new Float32Array(I),h=new Float32Array(I),g=new Float32Array(I),v=new Float32Array(I),y=0,_=0,S=e.units.length;y<S;++y){x=(M=e.units[y]).elements;var M,k=M.conformation;w=k.x,C=k.y,j=k.z;f.unit=M;for(P=0,E=x.length;P<E;++P){D=x[P];var B=_+P;m[B]=w(D),h[B]=C(D),g[B]=j(D),f.element=D,v[B]=p.size(f)}_+=x.length}n=m,a=h,o=g,u=v,l=Object(d.fillSerial)(new Uint32Array(I))}return{position:{indices:s.OrderedSet.ofRange(0,l.length),x:n,y:a,z:o,id:l},radius:function(e){return u[e]}}}var E=l.d.H;function A(e,t){return!i.Unit.isCoarse(e)&&e.model.atomicHierarchy.derived.atom.atomicNumber[t]===E}function D(e,t){return e[t]===E}function T(e,t){if(i.Unit.isCoarse(e))return!0;var r=e.model.atomicHierarchy.atoms.label_atom_id.value(t);return"CA"===r||"P"===r}function I(e){if(i.Unit.isAtomic(e))return 4;for(var t=0,r=e.elements,n=e.conformation.r,a=0,o=r.length;a<o;a++){var s=n(r[a]);s>t&&(t=s)}return t+1}function M(e){for(var t=0,r=0,n=e.unitSymmetryGroups;r<n.length;r++){var i=I(n[r].units[0]);i>t&&(t=i)}return t}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return u}));var n,i,a=r(6),o=r(214);function s(e,t,r){var i=e[t];switch(r){case n.Highlight:return i%2==0&&(e[t]=i+1,!0);case n.RemoveHighlight:return i%2!=0&&(e[t]=i-1,!0);case n.Select:return i<2&&(e[t]=i+2,!0);case n.Deselect:return e[t]=i%2,e[t]!==i;case n.Toggle:return e[t]=i>=2?i-2:i+2,!0;case n.Clear:return e[t]=0,0!==i}return!1}function u(e,t,r){var n=!1;if(a.Interval.is(t))for(var i=a.Interval.start(t),o=a.Interval.end(t);i<o;i++)n=s(e,i,r)||n;else for(i=0,o=t.length;i<o;i++)n=s(e,t[i],r)||n;return n}!function(e){e[e.None=0]="None",e[e.Highlight=1]="Highlight",e[e.RemoveHighlight=2]="RemoveHighlight",e[e.Select=4]="Select",e[e.Deselect=8]="Deselect",e[e.Toggle=16]="Toggle",e[e.Clear=32]="Clear"}(n||(n={})),function(e){e.is=o.a.has,e.All=n.Highlight|n.RemoveHighlight|n.Select|n.Deselect|n.Toggle|n.Clear,e.Highlighting=n.Highlight|n.RemoveHighlight|n.Clear,e.Selecting=n.Select|n.Deselect|n.Toggle|n.Clear}(i||(i={}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return o})),r.d(t,"d",(function(){return s})),r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return m}));var n=r(9),i=r(1),a=r(128);function o(e,t,r,n){var i=function(e,t){e=Math.max(e,2);var r=Math.sqrt(e),n=Math.ceil(r),i=(n+=(t-n%t)%t)>0?Math.ceil(e/n):0;return{width:n,height:i,length:n*i*t}}(e,t),a=i.length,o=i.width,s=i.height;return{array:n=n&&n.length>=a?n:new r(a),width:o,height:s}}function s(e,t){void 0===t&&(t=1);var r=e.array,n=e.width,i=e.height,a=r.length/(n*i),o=new Uint8ClampedArray(n*i*4);if(1===a)for(var s=0;s<i;++s)for(var u=0;u<n;++u)o[4*(s*n+u)+3]=r[s*n+u];else 4===a?o.set(r):console.warn("itemSize '"+a+"' not supported");return function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=!1);var n=document.createElement("canvas");n.width=e.width,n.height=e.height;var i=n.getContext("2d");if(!i)throw new Error("Could not create canvas 2d context");i.putImageData(e,0,0),n.toBlob((function(n){var i=window.URL.createObjectURL(n),a=document.createElement("img");a.src=i,a.style.width=e.width*t+"px",a.style.height=e.height*t+"px",r&&(a.style.imageRendering="pixelated"),a.style.position="absolute",a.style.top="0px",a.style.left="0px",a.style.border="solid grey",a.style.pointerEvents="none",document.body.appendChild(a)}),"image/png")}(new ImageData(o,n,i),t)}var u=Object(i.Vec3)(),c=new a.a("14"),l=new a.a("98");function d(e){return e>1e5?c:l}function f(e,t,r){var a=3*r,o=d(t);o.reset();for(var s=0,c=3*t;s<c;s+=a)i.Vec3.fromArray(u,e,s),o.includePosition(u);o.finishedIncludeStep();for(s=0,c=3*t;s<c;s+=a)i.Vec3.fromArray(u,e,s),o.radiusPosition(u);var l=o.getSphere();if(t<=98){var f=[];for(s=0,c=3*t;s<c;s+=a)f.push(i.Vec3.fromArray(Object(i.Vec3)(),e,s));n.g.setExtrema(l,f)}return l}var p=Object(i.Mat4)();function m(e,t,r){if(1===r){i.Mat4.fromArray(p,t,0);var a=n.g.clone(e);return i.Mat4.isIdentity(p)?a:n.g.transform(a,a,p)}var o=d(r);o.reset();var s=e.center,c=e.radius,l=e.extrema;if(l&&r<50){for(var f=0,m=r;f<m;++f)for(var h=0,g=l;h<g.length;h++){var v=g[h];i.Vec3.transformMat4Offset(u,v,t,0,0,16*f),o.includePosition(u)}o.finishedIncludeStep();for(f=0,m=r;f<m;++f)for(var b=0,y=l;b<y.length;b++){v=y[b];i.Vec3.transformMat4Offset(u,v,t,0,0,16*f),o.radiusPosition(u)}}else{for(f=0,m=r;f<m;++f)i.Vec3.transformMat4Offset(u,s,t,0,0,16*f),o.includePositionRadius(u,c);o.finishedIncludeStep();for(f=0,m=r;f<m;++f)i.Vec3.transformMat4Offset(u,s,t,0,0,16*f),o.radiusPositionRadius(u,c)}return o.getSphere()}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return o}));var n=r(1),i=r(117);function a(e,t,r,n,a,o){if(void 0===a&&(a=!1),void 0===o&&(o=function(){return!1}),e%r!=0)throw new Error("incompatible groupCount and stride");var s={location:i.b,index:0,groupIndex:0,instanceIndex:0,isSecondary:!1},u=s.groupIndex<e,c=!1,l=0,d=0,f=!1;return{get hasNext(){return u},get isNextNewInstance(){return c},groupCount:e,instanceCount:t,count:e*t,stride:r,nonInstanceable:a,move:function(){return u&&(s.groupIndex=l,s.instanceIndex=d,s.index=d*e+l,s.location=n(l,f?-1:d),s.isSecondary=o(l,f?-1:d),(l+=r)===e?(++d,c=!0,d<t&&(l=0)):c=!1,u=l<e),s},reset:function(){s.location=i.b,s.index=0,s.groupIndex=0,s.instanceIndex=0,s.isSecondary=!1,u=s.groupIndex<e,c=!1,l=0,d=0,f=!1},skipInstance:function(){u&&s.instanceIndex===d&&(++d,l=0,u=d<t)},voidInstances:function(){f=!0}}}function o(e){return{kind:"position-location",position:e?n.Vec3.clone(e):Object(n.Vec3)()}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i}));var n,i,a=r(5),o=r(6),s=r(125),u=r(1),c=r(9),l=r(201),d=r(369),f=r(370),p=r(188),m=r(121),h=r(53);!function(e){function t(e){var t=e.transforms.length,r=i.Location(e);return Object(h.a)(e.groupCount,t,1,(function(e,t){return r.group=e,r.instance=t,r}))}e.create=function(e,t,r,n,i,o,c){return{id:a.c.create22(),name:e,sourceData:t,geometry:r,transforms:c||[u.Mat4.identity()],get groupCount(){return s.a.getGroupCount(r)},getColor:n,getSize:i,getLabel:o}},e.getTheme=function(e){return{color:Object(f.a)({shape:e},{}),size:Object(d.a)({shape:e},{})}},e.groupIterator=t,e.createTransform=function(e,t){for(var r=t&&t.aTransform.ref.value.length>=16*e.length?t.aTransform.ref.value:new Float32Array(16*e.length),n=0,i=e.length;n<i;++n)u.Mat4.toArray(e[n],r,16*n);return Object(p.b)(r,e.length,t)},e.createRenderObject=function(r,n){var i=e.getTheme(r),a=s.a.getUtils(r.geometry),o=Object(m.c)(),u=t(r),c=e.createTransform(r.transforms),l=a.createValues(r.geometry,c,u,i,n),d=a.createRenderableState(n);return Object(m.a)(r.geometry.kind,l,d,o)},e.Loci=function(e){return{kind:"shape-loci",shape:e}},e.isLoci=function(e){return!!e&&"shape-loci"===e.kind},e.areLociEqual=function(e,t){return e.shape===t.shape},e.isLociEmpty=function(e){return 0===e.shape.groupCount}}(n||(n={})),function(e){function t(e){for(var t=0,r=0,n=e.groups;r<n.length;r++){var i=n[r];t+=o.OrderedSet.size(i.ids)}return t}e.Location=function(e,t,r){return void 0===t&&(t=0),void 0===r&&(r=0),{kind:"group-location",shape:e,group:t,instance:r}},e.isLocation=function(e){return!!e&&"group-location"===e.kind},e.Loci=function(e,t){return{kind:"group-loci",shape:e,groups:t}},e.isLoci=function(e){return!!e&&"group-loci"===e.kind},e.areLociEqual=function(e,t){if(e.shape!==t.shape)return!1;if(e.groups.length!==t.groups.length)return!1;for(var r=0,n=e.groups.length;r<n;++r){var i=e.groups[r],a=i.ids,s=i.instance,u=t.groups[r],c=u.ids;if(s!==u.instance)return!1;if(!o.OrderedSet.areEqual(a,c))return!1}return!0},e.isLociEmpty=function(e){return 0===t(e)},e.size=t;var r=new l.a,n=u.Vec3.zero();function i(e,t,i,a){for(var s=t.indices,c=t.offsets,l=function(e,t){o.OrderedSet.forEach(e,(function(e){for(var o=c[e],l=c[e+1];o<l;++o)u.Vec3.fromArray(n,i,3*s[o]),u.Vec3.transformMat4(n,n,a[t]),r.includeStep(n)}))},d=0,f=e;d<f.length;d++){var p=f[d];l(p.ids,p.instance)}}function a(e,t,i,a){for(var s=t.indices,c=t.offsets,l=function(e,t){o.OrderedSet.forEach(e,(function(e){for(var o=c[e],l=c[e+1];o<l;++o)u.Vec3.fromArray(n,i,3*s[o]),u.Vec3.transformMat4(n,n,a[t]),r.radiusStep(n)}))},d=0,f=e;d<f.length;d++){var p=f[d];l(p.ids,p.instance)}}e.getBoundingSphere=function(e,t){t||(t=Object(c.g)()),r.reset();var n=0,s=e.shape,l=s.geometry,d=s.transforms;if("mesh"===l.kind||"points"===l.kind){var f="mesh"===l.kind?l.vertexBuffer.ref.value:l.centerBuffer.ref.value;i(e.groups,l.groupMapping,f,d),r.finishedIncludeStep(),a(e.groups,l.groupMapping,f,d)}else if("lines"===l.kind){var p=l.startBuffer.ref.value,m=l.endBuffer.ref.value;i(e.groups,l.groupMapping,p,d),i(e.groups,l.groupMapping,m,d),r.finishedIncludeStep(),a(e.groups,l.groupMapping,p,d),a(e.groups,l.groupMapping,m,d)}else{if("spheres"!==l.kind&&"text"!==l.kind)return c.g.copy(t,l.boundingSphere);f=l.centerBuffer.ref.value;i(e.groups,l.groupMapping,f,d),r.finishedIncludeStep(),a(e.groups,l.groupMapping,f,d);for(var h=function(t,r){o.OrderedSet.forEach(t,(function(t){var i=e.shape.getSize(t,r);n<i&&(n=i)}))},g=0,v=e.groups;g<v.length;g++){var b=v[g];h(b.ids,b.instance)}}return u.Vec3.copy(t.center,r.center),t.radius=Math.sqrt(r.radiusSq),c.g.expand(t,t,n),t}}(i||(i={}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return s})),r.d(t,"b",(function(){return u}));var n=r(0),i=r(41),a=r(233);r.d(t,"a",(function(){return a.a}));r(92);var o=r(110);r.d(t,"d",(function(){return o.a}));r(49);var s={create:function(){return Object(n.__assign)(Object(n.__assign)({},i.a.createState()),{unitTransforms:null,unitTransformsVersion:-1})},update:function(e,t){i.a.updateState(e,t),void 0!==t.unitTransforms&&(e.unitTransforms=t.unitTransforms)}};function u(e){return e}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),i=r(3),a=r(18),o=r(15),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hide=function(){return t.props.onSelect(void 0)},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=i.createElement(u,{items:e.items,onSelect:e.onSelect,current:e.current,multiselect:this.props.multiselect,noOffset:this.props.noOffset,noAccent:this.props.noAccent});return i.createElement("div",{className:"msp-action-menu-options"+(e.header?"":" msp-action-menu-options-no-header")},e.header&&i.createElement(a.ControlGroup,{header:e.header,title:e.title,initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.hide,topRightIcon:o.CloseSvg},t),!e.header&&t)},t}(i.PureComponent);!function(e){function t(t,r){for(var n=r||{},i=n.label,a=n.value,o=n.category,s=n.selected,u=n.icon,c=n.addOn,l=n.description,d=void 0,f=[],p=0;p<t.length;p++){var m=t[p];if(!(null==r?void 0:r.filter)||r.filter(m)){var h=null==o?void 0:o(m),g=i?i(m):""+m,v=a?a(m):m,b=l?l(m):"string"==typeof m?m:void 0,y=void 0;h?(d||(d=new Map),(y=d.get(h))||(y=[e.Header(h,{description:h})],d.set(h,y),f.push(y))):y=f;var _=null==c?void 0:c(m);y.push({kind:"item",label:g,value:v,icon:u?u(m):void 0,selected:s?s(m):void 0,addOn:_,description:b})}}return f}e.Header=function(e,t){return t?Object(n.__assign)({kind:"header",label:e},t):{kind:"header",label:e}},e.Item=function(e,t,r){return Object(n.__assign)({kind:"item",label:e,value:t},r)},e.createItems=t;var r={value:function(e){return e[0]},label:function(e){return e[1]},category:function(e){return e[2]}};e.createItemsFromSelectOptions=function(e,i){return t(e,i?Object(n.__assign)(Object(n.__assign)({},r),i):r)},e.hasSelectedItem=function e(t){if(f(t))return!1;if(d(t))return!!t.selected;for(var r=0,n=t;r<n.length;r++){if(e(n[r]))return!0}return!1},e.findItem=function e(t,r){if(!f(t)){if(d(t))return t.value===r?t:void 0;for(var n=0,i=t;n<i.length;n++){var a=e(i[n],r);if(a)return a}}},e.getFirstItem=function e(t){if(!f(t)){if(d(t))return t;for(var r=0,n=t;r<n.length;r++){var i=e(n[r]);if(i)return i}}}}(s||(s={}));var u=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.state=t.createState(r.props),r.toggleExpanded=function(e){r.setState({isExpanded:!r.state.isExpanded}),e.currentTarget.blur()},r.selectAll=function(){var e=p(r.props.items,[]).filter((function(e){return!e.selected}));r.props.onSelect(e)},r.selectNone=function(){var e=p(r.props.items,[]).filter((function(e){return!!e.selected}));r.props.onSelect(e)},r}return Object(n.__extends)(t,e),t.createState=function(e,t){var r=l(e.items)&&f(e.items[0])?e.items[0]:void 0,n=!(null==r?void 0:r.isIndependent)&&(e.multiselect?s.hasSelectedItem(e.items):!!e.current&&!!s.findItem(e.items,e.current.value)||s.hasSelectedItem(e.items));return{header:r,hasCurrent:n,isExpanded:n||(null!=t?t:!!(null==r?void 0:r.initiallyExpanded))}},t.prototype.componentDidUpdate=function(e){if(this.props.items!==e.items||this.props.current!==e.current){var r=l(this.props.items)&&l(e.items)&&f(this.props.items[0])&&f(e.items[0])&&this.props.items[0].label===e.items[0].label?this.state.isExpanded:void 0;this.setState(t.createState(this.props,r))}},Object.defineProperty(t.prototype,"multiselectHeader",{get:function(){var e=this.state,t=e.header,r=e.hasCurrent;return i.createElement("div",{className:"msp-flex-row msp-control-group-header"},i.createElement(a.Button,{icon:this.state.isExpanded?o.ArrowDropDownSvg:o.ArrowRightSvg,flex:!0,noOverflow:!0,onClick:this.toggleExpanded,title:"Click to "+(this.state.isExpanded?"collapse":"expand")+"."+((null==t?void 0:t.description)?" "+(null==t?void 0:t.description):"")},r?i.createElement("b",null,null==t?void 0:t.label):null==t?void 0:t.label),i.createElement(a.Button,{icon:o.CheckSvg,flex:!0,onClick:this.selectAll,style:{flex:"0 0 50px",textAlign:"right"}},"All"),i.createElement(a.Button,{icon:o.CloseSvg,flex:!0,onClick:this.selectNone,style:{flex:"0 0 50px",textAlign:"right"}},"None"))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"basicHeader",{get:function(){var e=this.state,t=e.header,r=e.hasCurrent;return i.createElement("div",{className:"msp-control-group-header",style:{marginTop:"1px"}},i.createElement(a.Button,{noOverflow:!0,icon:this.state.isExpanded?o.ArrowDropDownSvg:o.ArrowRightSvg,onClick:this.toggleExpanded,title:"Click to "+(this.state.isExpanded?"collapse":"expand")+". "+((null==t?void 0:t.description)?null==t?void 0:t.description:"")},r?i.createElement("b",null,null==t?void 0:t.label):null==t?void 0:t.label))},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this,r=this.props,n=r.items,a=r.onSelect,o=r.current;if(f(n))return null;if(d(n))return i.createElement(c,{item:n,onSelect:a,current:o,multiselect:this.props.multiselect});var s=this.state.header;return i.createElement(i.Fragment,null,s&&(this.props.multiselect&&this.state.isExpanded?this.multiselectHeader:this.basicHeader),i.createElement("div",{className:this.props.noOffset?void 0:this.props.noAccent?"msp-control-offset":"msp-accent-offset"},(!s||this.state.isExpanded)&&n.map((function(r,n){return f(r)?null:d(r)?i.createElement(c,{key:n,item:r,onSelect:a,current:o,multiselect:e.props.multiselect}):i.createElement(t,{key:n,items:r,onSelect:a,current:o,multiselect:e.props.multiselect,noAccent:!0})}))))},t}(i.PureComponent),c=function(e){var t=e.item,r=e.onSelect,n=e.current,o=e.multiselect,s=n===t,u=t.addOn?{position:"relative"}:void 0;return i.createElement(a.Button,{icon:t.icon,noOverflow:!0,className:"msp-action-menu-button",onClick:function(e){return r(o?[t]:t,e)},disabled:t.disabled,style:u,title:t.description},s||t.selected?i.createElement("b",null,t.label):t.label,t.addOn)};function l(e){return!!e&&Array.isArray(e)}function d(e){return e&&"item"===e.kind}function f(e){return e&&"header"===e.kind}function p(e,t){if(f(e))return t;if(d(e))return t.push(e),t;for(var r=0,n=e;r<n.length;r++){p(n[r],t)}return t}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return s}));var n=function(){function e(e,t){this.getHash=e,this.areEqual=t,this.size=0,this.byHash=new Map}return e.prototype.add=function(e){var t=this.getHash(e);if(this.byHash.has(t)){for(var r=this.byHash.get(t),n=0,i=r.length;n<i;n++)if(this.areEqual(e,r[n]))return!1;return r[r.length]=e,this.size++,!0}return this.byHash.set(t,[e]),this.size++,!0},e.prototype.has=function(e){var t=this.getHash(e);if(!this.byHash.has(t))return!1;for(var r=this.byHash.get(t),n=0,i=r.length;n<i;n++)if(this.areEqual(e,r[n]))return!0;return!1},e}();function i(e,t){return new n(e,t)}function a(){return new u}function o(e){return{previous:null,next:null,inList:!0,value:e}}var s,u=function(){function e(){this.count=0,this.first=null,this.last=null}return e.prototype.addFirst=function(e){var t=o(e);return t.inList=!0,this.first&&(this.first.previous=t),t.next=this.first,this.first=t,this.count++,this.last||(this.last=t),t},e.prototype.addLast=function(e){var t=o(e);return null!==this.last&&(this.last.next=t),t.previous=this.last,this.last=t,null===this.first&&(this.first=t),t.inList=!0,this.count++,t},e.prototype.removeFirst=function(){var e=this.first;if(e)return this.remove(e),e.value},e.prototype.removeLast=function(){var e=this.last;if(e)return this.remove(e),e.value},e.prototype.remove=function(e){e.inList&&(e.inList=!1,null!==e.previous?e.previous.next=e.next:null===e.previous&&(this.first=e.next),null!==e.next?e.next.previous=e.previous:null===e.next&&(this.last=e.previous),e.next=null,e.previous=null,this.count--)},e.prototype.find=function(e){for(var t=this.first;null!==t;){if(t.value===e)return t;t=t.next}},e}();!function(e){e.create=function(){return{keys:new Set,array:[]}},e.add=function(e,t,r){var n=e.keys,i=e.array;return!n.has(t)&&(n.add(t),i[i.length]=r,!0)},e.has=function(e,t){return e.keys.has(t)}}(s||(s={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return o}));var n,i=r(99);!function(e){e.create=function(e){return{ref:e}},e.set=function(e,t){return e.ref=t,e}}(n||(n={}));var a,o,s=Object(i.a)(0,2147483647);!function(e){e.create=function(e,t){return{id:s(),version:0,value:e,metadata:t}},e.withValue=function(e,t){return{id:e.id,version:e.version+1,value:t,metadata:e.metadata}}}(a||(a={})),function(e){function t(e,t){return n.set(e,a.withValue(e.ref,t))}e.create=function(e,t){return n.create(a.create(e,t))},e.update=t,e.set=function(e,t){return n.set(e,t)},e.updateIfChanged=function(e,r){return e.ref.value!==r?t(e,r):e}}(o||(o={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return f}));var n=r(7).a.Schema,i=n.str,a=n.int,o=n.float,s=n.coord,u=n.Aliased,c=n.Matrix,l=n.Vector,d=n.List,f={atom_site:{auth_asym_id:i,auth_atom_id:i,auth_comp_id:i,auth_seq_id:a,B_iso_or_equiv:o,Cartn_x:s,Cartn_y:s,Cartn_z:s,group_PDB:u(i),id:a,label_alt_id:i,label_asym_id:i,label_atom_id:i,label_comp_id:i,label_entity_id:i,label_seq_id:a,occupancy:o,type_symbol:i,pdbx_PDB_ins_code:i,pdbx_PDB_model_num:a,pdbx_formal_charge:a,ihm_model_id:a},atom_site_anisotrop:{id:a,type_symbol:i,U:c(3,3),U_esd:c(3,3),pdbx_auth_seq_id:i,pdbx_auth_asym_id:i,pdbx_auth_atom_id:i,pdbx_auth_comp_id:i,pdbx_label_seq_id:a,pdbx_label_alt_id:i,pdbx_label_asym_id:i,pdbx_label_atom_id:i,pdbx_label_comp_id:i,pdbx_PDB_ins_code:i},atom_sites:{entry_id:i,fract_transf_matrix:c(3,3),fract_transf_vector:l(3)},audit_author:{name:i,pdbx_ordinal:a,identifier_ORCID:i},audit_conform:{dict_location:i,dict_name:i,dict_version:i},cell:{angle_alpha:o,angle_beta:o,angle_gamma:o,entry_id:i,length_a:o,length_b:o,length_c:o,Z_PDB:a,pdbx_unique_axis:i},chem_comp:{formula:i,formula_weight:o,id:i,mon_nstd_flag:u(i),name:i,type:u(i),pdbx_synonyms:d(";",(function(e){return e}))},chem_comp_bond:{atom_id_1:i,atom_id_2:i,comp_id:i,value_order:u(i),pdbx_ordinal:a,pdbx_stereo_config:u(i),pdbx_aromatic_flag:u(i)},citation:{book_publisher:i,country:i,id:i,journal_abbrev:i,journal_id_ASTM:i,journal_id_CSD:i,journal_id_ISSN:i,journal_volume:i,page_first:i,page_last:i,title:i,year:a,pdbx_database_id_DOI:i,pdbx_database_id_PubMed:a},citation_author:{citation_id:i,name:i,ordinal:a},database_2:{database_id:u(i),database_code:i},entity:{details:i,formula_weight:o,id:i,src_method:u(i),type:u(i),pdbx_description:d(",",(function(e){return e})),pdbx_number_of_molecules:a,pdbx_mutation:i,pdbx_fragment:i,pdbx_ec:d(",",(function(e){return e}))},entity_poly:{entity_id:i,nstd_linkage:u(i),nstd_monomer:u(i),type:u(i),pdbx_strand_id:d(",",(function(e){return e})),pdbx_seq_one_letter_code:i,pdbx_seq_one_letter_code_can:i,pdbx_target_identifier:i},entity_poly_seq:{entity_id:i,hetero:u(i),mon_id:i,num:a},entry:{id:i},exptl:{entry_id:i,method:u(i)},struct:{entry_id:i,title:i,pdbx_descriptor:i},struct_asym:{details:i,entity_id:i,id:i,pdbx_modified:i,pdbx_blank_PDB_chainid_flag:u(i)},struct_conf:{beg_label_asym_id:i,beg_label_comp_id:i,beg_label_seq_id:a,beg_auth_asym_id:i,beg_auth_comp_id:i,beg_auth_seq_id:a,conf_type_id:u(i),details:i,end_label_asym_id:i,end_label_comp_id:i,end_label_seq_id:a,end_auth_asym_id:i,end_auth_comp_id:i,end_auth_seq_id:a,id:i,pdbx_beg_PDB_ins_code:i,pdbx_end_PDB_ins_code:i,pdbx_PDB_helix_class:i,pdbx_PDB_helix_length:a,pdbx_PDB_helix_id:i},struct_conn:{conn_type_id:u(i),details:i,id:i,ptnr1_label_asym_id:i,ptnr1_label_atom_id:i,ptnr1_label_comp_id:i,ptnr1_label_seq_id:a,ptnr1_auth_asym_id:i,ptnr1_auth_comp_id:i,ptnr1_auth_seq_id:a,ptnr1_symmetry:i,ptnr2_label_asym_id:i,ptnr2_label_atom_id:i,ptnr2_label_comp_id:i,ptnr2_label_seq_id:a,ptnr2_auth_asym_id:i,ptnr2_auth_comp_id:i,ptnr2_auth_seq_id:a,ptnr2_symmetry:i,pdbx_ptnr1_PDB_ins_code:i,pdbx_ptnr1_label_alt_id:i,pdbx_ptnr1_standard_comp_id:i,pdbx_ptnr2_PDB_ins_code:i,pdbx_ptnr2_label_alt_id:i,pdbx_ptnr3_PDB_ins_code:i,pdbx_ptnr3_label_alt_id:i,pdbx_ptnr3_label_asym_id:i,pdbx_ptnr3_label_atom_id:i,pdbx_ptnr3_label_comp_id:i,pdbx_ptnr3_label_seq_id:a,pdbx_PDB_id:i,pdbx_dist_value:o,pdbx_value_order:u(i)},struct_conn_type:{criteria:i,id:u(i),reference:i},struct_keywords:{entry_id:i,text:d(",",(function(e){return e})),pdbx_keywords:i},struct_ncs_oper:{code:u(i),details:i,id:a,matrix:c(3,3),vector:l(3)},struct_sheet_range:{beg_label_asym_id:i,beg_label_comp_id:i,beg_label_seq_id:a,end_label_asym_id:i,end_label_comp_id:i,end_label_seq_id:a,beg_auth_asym_id:i,beg_auth_comp_id:i,beg_auth_seq_id:a,end_auth_asym_id:i,end_auth_comp_id:i,end_auth_seq_id:a,id:i,sheet_id:i,pdbx_beg_PDB_ins_code:i,pdbx_end_PDB_ins_code:i},struct_site:{details:i,id:i,pdbx_num_residues:a,pdbx_evidence_code:i,pdbx_auth_asym_id:i,pdbx_auth_comp_id:i,pdbx_auth_seq_id:i,pdbx_auth_ins_code:i},struct_site_gen:{details:i,id:i,label_alt_id:i,label_asym_id:i,label_atom_id:i,label_comp_id:i,label_seq_id:a,auth_asym_id:i,auth_comp_id:i,auth_seq_id:i,site_id:i,symmetry:i,pdbx_auth_ins_code:i,pdbx_num_res:a},symmetry:{entry_id:i,cell_setting:u(i),Int_Tables_number:a,space_group_name_Hall:i,"space_group_name_H-M":i},pdbx_database_status:{status_code:u(i),status_code_sf:u(i),status_code_mr:u(i),entry_id:i,recvd_initial_deposition_date:i,SG_entry:u(i),deposit_site:u(i),process_site:u(i),status_code_cs:u(i),methods_development_category:u(i),pdb_format_compatible:u(i)},pdbx_nonpoly_scheme:{asym_id:i,entity_id:i,mon_id:i,pdb_strand_id:i,ndb_seq_num:i,pdb_seq_num:i,auth_seq_num:i,pdb_mon_id:i,auth_mon_id:i,pdb_ins_code:i},pdbx_database_related:{db_name:i,details:i,db_id:i,content_type:u(i)},pdbx_entity_nonpoly:{entity_id:i,comp_id:i,name:i},pdbx_chem_comp_synonyms:{name:i,comp_id:i,provenance:u(i)},pdbx_chem_comp_identifier:{comp_id:i,identifier:i,type:u(i),program:i,program_version:i},pdbx_unobs_or_zero_occ_residues:{id:a,polymer_flag:u(i),occupancy_flag:u(a),PDB_model_num:a,auth_asym_id:i,auth_comp_id:i,auth_seq_id:i,PDB_ins_code:i,label_asym_id:i,label_comp_id:i,label_seq_id:a},pdbx_struct_mod_residue:{id:a,auth_asym_id:i,auth_comp_id:i,auth_seq_id:a,PDB_ins_code:i,label_asym_id:i,label_comp_id:i,label_seq_id:a,parent_comp_id:i,details:i},pdbx_struct_oper_list:{id:i,type:u(i),name:i,symmetry_operation:i,matrix:c(3,3),vector:l(3)},pdbx_struct_assembly:{method_details:i,oligomeric_details:i,oligomeric_count:a,details:i,id:i},pdbx_struct_assembly_gen:{asym_id_list:d(",",(function(e){return e})),assembly_id:i,oper_expression:i},pdbx_reference_entity_list:{prd_id:i,ref_entity_id:i,type:u(i),details:i,component_id:a},pdbx_reference_entity_link:{link_id:a,prd_id:i,details:i,ref_entity_id_1:i,ref_entity_id_2:i,entity_seq_num_1:a,entity_seq_num_2:a,comp_id_1:i,comp_id_2:i,atom_id_1:i,atom_id_2:i,value_order:u(i),component_1:a,component_2:a,link_class:u(i)},pdbx_reference_entity_poly_link:{link_id:a,prd_id:i,ref_entity_id:i,component_id:a,entity_seq_num_1:a,entity_seq_num_2:a,comp_id_1:i,comp_id_2:i,atom_id_1:i,atom_id_2:i,value_order:u(i)},pdbx_molecule:{prd_id:i,instance_id:a,asym_id:i},pdbx_molecule_features:{prd_id:i,class:u(i),type:u(i),name:i,details:i},entity_src_nat:{entity_id:i,pdbx_organism_scientific:i,pdbx_plasmid_name:i,pdbx_src_id:a,pdbx_beg_seq_num:a,pdbx_end_seq_num:a},entity_src_gen:{entity_id:i,pdbx_gene_src_gene:d(",",(function(e){return e})),pdbx_gene_src_scientific_name:i,plasmid_name:i,pdbx_src_id:a,pdbx_beg_seq_num:a,pdbx_end_seq_num:a},pdbx_entity_src_syn:{organism_scientific:i,entity_id:i,pdbx_src_id:a,pdbx_beg_seq_num:a,pdbx_end_seq_num:a},pdbx_entity_branch_descriptor:{entity_id:i,descriptor:i,type:u(i),program:i,program_version:i,ordinal:a},pdbx_entity_instance_feature:{details:i,feature_type:u(i),auth_asym_id:i,asym_id:i,auth_seq_num:i,seq_num:a,comp_id:i,auth_comp_id:i,ordinal:a},pdbx_entity_branch_list:{entity_id:i,hetero:u(i),comp_id:i,num:a},pdbx_entity_branch_link:{link_id:a,details:i,entity_id:i,entity_branch_list_num_1:a,entity_branch_list_num_2:a,comp_id_1:i,comp_id_2:i,atom_id_1:i,leaving_atom_id_1:i,atom_stereo_config_1:u(i),atom_id_2:i,leaving_atom_id_2:i,atom_stereo_config_2:u(i),value_order:u(i)},pdbx_entity_branch:{entity_id:i,type:u(i)},pdbx_branch_scheme:{entity_id:i,hetero:u(i),asym_id:i,mon_id:i,num:a,pdb_asym_id:i,pdb_seq_num:i,pdb_mon_id:i,auth_asym_id:i,auth_seq_num:i,auth_mon_id:i},pdbx_chem_comp_related:{comp_id:i,related_comp_id:i,relationship_type:u(i),details:i},ihm_starting_model_details:{starting_model_id:i,entity_id:i,entity_description:i,asym_id:i,entity_poly_segment_id:a,starting_model_source:u(i),starting_model_auth_asym_id:i,starting_model_sequence_offset:a,dataset_list_id:a},ihm_starting_comparative_models:{id:a,starting_model_id:i,starting_model_auth_asym_id:i,starting_model_seq_id_begin:a,starting_model_seq_id_end:a,template_auth_asym_id:i,template_seq_id_begin:a,template_seq_id_end:a,template_sequence_identity:o,template_sequence_identity_denominator:u(a),template_dataset_list_id:a,alignment_file_id:a},ihm_starting_model_seq_dif:{id:a,entity_id:i,asym_id:i,seq_id:a,comp_id:i,starting_model_id:i,db_asym_id:i,db_seq_id:a,db_comp_id:i,details:i},ihm_model_representation:{id:a,name:i,details:i},ihm_model_representation_details:{id:a,representation_id:a,entity_poly_segment_id:a,entity_id:i,entity_description:i,entity_asym_id:i,model_object_primitive:u(i),starting_model_id:i,model_mode:u(i),model_granularity:u(i),model_object_count:a},ihm_struct_assembly_details:{id:a,assembly_id:a,parent_assembly_id:a,entity_description:i,entity_id:i,asym_id:i,entity_poly_segment_id:a},ihm_struct_assembly:{id:a,name:i,description:i},ihm_modeling_protocol:{id:a,num_steps:a,protocol_name:i},ihm_modeling_protocol_details:{id:a,protocol_id:a,step_id:a,struct_assembly_id:a,dataset_group_id:a,struct_assembly_description:i,step_name:i,step_method:i,num_models_begin:a,num_models_end:a,multi_scale_flag:u(i),multi_state_flag:u(i),ordered_flag:u(i),script_file_id:a,software_id:a},ihm_multi_state_modeling:{state_id:a,state_group_id:a,population_fraction:o,population_fraction_sd:o,state_type:i,state_name:i,experiment_type:u(i),details:i},ihm_modeling_post_process:{id:a,protocol_id:a,analysis_id:a,step_id:a,type:u(i),feature:u(i),num_models_begin:a,num_models_end:a},ihm_ensemble_info:{ensemble_id:a,ensemble_name:i,post_process_id:a,model_group_id:a,ensemble_clustering_method:u(i),ensemble_clustering_feature:u(i),num_ensemble_models:a,num_ensemble_models_deposited:a,ensemble_precision_value:o,ensemble_file_id:a},ihm_model_list:{model_id:a,model_name:i,assembly_id:a,protocol_id:a,representation_id:a},ihm_model_group:{id:a,name:i,details:i},ihm_model_group_link:{model_id:a,group_id:a},ihm_model_representative:{id:a,model_group_id:a,model_id:a,selection_criteria:u(i)},ihm_dataset_list:{id:a,data_type:u(i),database_hosted:u(i)},ihm_dataset_group:{id:a,name:i,application:u(i),details:i},ihm_dataset_group_link:{dataset_list_id:a,group_id:a},ihm_related_datasets:{dataset_list_id_derived:a,dataset_list_id_primary:a},ihm_dataset_related_db_reference:{id:a,dataset_list_id:a,db_name:u(i),accession_code:i,version:i,details:i},ihm_external_reference_info:{reference_id:a,reference_provider:i,reference_type:u(i),reference:i,refers_to:u(i),associated_url:i},ihm_external_files:{id:a,reference_id:a,file_path:i,content_type:u(i),file_size_bytes:o,details:i},ihm_dataset_external_reference:{id:a,dataset_list_id:a,file_id:a},ihm_localization_density_files:{id:a,file_id:a,ensemble_id:a,entity_id:i,entity_poly_segment_id:a,asym_id:i},ihm_predicted_contact_restraint:{id:a,group_id:a,entity_id_1:i,entity_id_2:i,asym_id_1:i,asym_id_2:i,comp_id_1:i,comp_id_2:i,seq_id_1:a,seq_id_2:a,rep_atom_1:u(i),rep_atom_2:u(i),distance_lower_limit:o,distance_upper_limit:o,probability:o,restraint_type:u(i),model_granularity:u(i),dataset_list_id:a,software_id:a},ihm_cross_link_list:{id:a,group_id:a,entity_description_1:i,entity_description_2:i,entity_id_1:i,entity_id_2:i,comp_id_1:i,comp_id_2:i,seq_id_1:a,seq_id_2:a,linker_type:u(i),dataset_list_id:a},ihm_cross_link_restraint:{id:a,group_id:a,entity_id_1:i,entity_id_2:i,asym_id_1:i,asym_id_2:i,comp_id_1:i,comp_id_2:i,seq_id_1:a,seq_id_2:a,atom_id_1:i,atom_id_2:i,restraint_type:u(i),conditional_crosslink_flag:u(i),model_granularity:u(i),distance_threshold:o,psi:o,sigma_1:o,sigma_2:o},ihm_cross_link_result_parameters:{id:a,restraint_id:a,model_id:a,psi:o,sigma_1:o,sigma_2:o},ihm_2dem_class_average_restraint:{id:a,dataset_list_id:a,number_raw_micrographs:a,pixel_size_width:o,pixel_size_height:o,image_resolution:o,image_segment_flag:u(i),number_of_projections:a,struct_assembly_id:a,details:i},ihm_2dem_class_average_fitting:{id:a,restraint_id:a,model_id:a,cross_correlation_coefficient:o,rot_matrix:c(3,3),tr_vector:l(3)},ihm_3dem_restraint:{id:a,dataset_list_id:a,model_id:a,struct_assembly_id:a,fitting_method:i,number_of_gaussians:a,cross_correlation_coefficient:o},ihm_sas_restraint:{id:a,dataset_list_id:a,model_id:a,struct_assembly_id:a,profile_segment_flag:u(i),fitting_atom_type:i,fitting_method:i,fitting_state:u(i),radius_of_gyration:o,chi_value:o,details:i},ihm_starting_model_coord:{ordinal_id:a,starting_model_id:i,group_PDB:u(i),id:a,type_symbol:i,entity_id:i,atom_id:i,comp_id:i,seq_id:a,asym_id:i,Cartn_x:o,Cartn_y:o,Cartn_z:o,B_iso_or_equiv:o},ihm_sphere_obj_site:{id:a,entity_id:i,seq_id_begin:a,seq_id_end:a,asym_id:i,Cartn_x:o,Cartn_y:o,Cartn_z:o,object_radius:o,rmsf:o,model_id:a},ihm_gaussian_obj_site:{id:a,entity_id:i,seq_id_begin:a,seq_id_end:a,asym_id:i,mean_Cartn_x:o,mean_Cartn_y:o,mean_Cartn_z:o,weight:o,covariance_matrix:c(3,3),model_id:a},ihm_gaussian_obj_ensemble:{id:a,entity_id:i,seq_id_begin:a,seq_id_end:a,asym_id:i,mean_Cartn_x:o,mean_Cartn_y:o,mean_Cartn_z:o,weight:o,covariance_matrix:c(3,3),ensemble_id:a},ihm_feature_list:{feature_id:a,feature_type:u(i),entity_type:u(i)},ihm_poly_residue_feature:{ordinal_id:a,feature_id:a,entity_id:i,asym_id:i,comp_id_begin:i,comp_id_end:i,seq_id_begin:a,seq_id_end:a},ihm_derived_distance_restraint:{id:a,group_id:a,feature_id_1:a,feature_id_2:a,group_conditionality:u(i),random_exclusion_fraction:o,distance_upper_limit:o,restraint_type:u(i),dataset_list_id:a}}},function(e,t,r){"use strict";r.d(t,"q",(function(){return s})),r.d(t,"h",(function(){return u})),r.d(t,"k",(function(){return c})),r.d(t,"f",(function(){return l})),r.d(t,"p",(function(){return d})),r.d(t,"l",(function(){return f})),r.d(t,"m",(function(){return p})),r.d(t,"n",(function(){return m})),r.d(t,"o",(function(){return h})),r.d(t,"a",(function(){return g})),r.d(t,"g",(function(){return v})),r.d(t,"b",(function(){return b})),r.d(t,"c",(function(){return y})),r.d(t,"e",(function(){return _})),r.d(t,"j",(function(){return S})),r.d(t,"d",(function(){return x})),r.d(t,"i",(function(){return O}));var n=r(48),i=r(293),a=r(394),o=r(335);function s(e){return"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext}function u(e){if(s(e))return{drawArraysInstanced:e.drawArraysInstanced.bind(e),drawElementsInstanced:e.drawElementsInstanced.bind(e),vertexAttribDivisor:e.vertexAttribDivisor.bind(e),VERTEX_ATTRIB_ARRAY_DIVISOR:e.VERTEX_ATTRIB_ARRAY_DIVISOR};var t=e.getExtension("ANGLE_instanced_arrays");return null===t?null:{drawArraysInstanced:t.drawArraysInstancedANGLE.bind(t),drawElementsInstanced:t.drawElementsInstancedANGLE.bind(t),vertexAttribDivisor:t.vertexAttribDivisorANGLE.bind(t),VERTEX_ATTRIB_ARRAY_DIVISOR:t.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE}}function c(e){if(s(e))return{FRAGMENT_SHADER_DERIVATIVE_HINT:e.FRAGMENT_SHADER_DERIVATIVE_HINT};var t=e.getExtension("OES_standard_derivatives");return null===t?null:{FRAGMENT_SHADER_DERIVATIVE_HINT:t.FRAGMENT_SHADER_DERIVATIVE_HINT_OES}}function l(e){return s(e)?{}:e.getExtension("OES_element_index_uint")}function d(e){if(s(e))return{VERTEX_ARRAY_BINDING:e.VERTEX_ARRAY_BINDING,bindVertexArray:e.bindVertexArray.bind(e),createVertexArray:e.createVertexArray.bind(e),deleteVertexArray:e.deleteVertexArray.bind(e),isVertexArray:e.isVertexArray.bind(e)};var t=e.getExtension("OES_vertex_array_object");return null===t?null:{VERTEX_ARRAY_BINDING:t.VERTEX_ARRAY_BINDING_OES,bindVertexArray:t.bindVertexArrayOES.bind(t),createVertexArray:t.createVertexArrayOES.bind(t),deleteVertexArray:t.deleteVertexArrayOES.bind(t),isVertexArray:t.isVertexArrayOES.bind(t)}}function f(e){return s(e)?{}:e.getExtension("OES_texture_float")}function p(e){return e.getExtension("OES_texture_float_linear")}function m(e){if(s(e))return{HALF_FLOAT:e.HALF_FLOAT};var t=e.getExtension("OES_texture_half_float");return null===t?null:{HALF_FLOAT:t.HALF_FLOAT_OES}}function h(e){return e.getExtension("OES_texture_half_float_linear")}function g(e){if(s(e))return{MIN:e.MIN,MAX:e.MAX};var t=e.getExtension("EXT_blend_minmax");return null===t?null:{MIN:t.MIN_EXT,MAX:t.MAX_EXT}}function v(e){return s(e)?{}:e.getExtension("EXT_frag_depth")}function b(e){if(s(e))return null===e.getExtension("EXT_color_buffer_float")?null:(e.getExtension("EXT_float_blend"),{RGBA32F:e.RGBA32F});var t=e.getExtension("WEBGL_color_buffer_float");return null===t?(e.getExtension("OES_texture_float"),C(e,e.FLOAT)?{RGBA32F:34836}:null):(e.getExtension("EXT_float_blend"),{RGBA32F:t.RGBA32F_EXT})}function y(e){if(s(e))return null===e.getExtension("EXT_color_buffer_half_float")?null:(e.getExtension("EXT_float_blend"),{RGBA16F:e.RGBA16F});var t=e.getExtension("EXT_color_buffer_half_float");return null===t?(e.getExtension("OES_texture_half_float"),C(e,36193)?{RGBA16F:34842}:null):(e.getExtension("EXT_float_blend"),{RGBA16F:t.RGBA16F_EXT})}function _(e){if(s(e))return{drawBuffers:e.drawBuffers.bind(e),COLOR_ATTACHMENT0:e.COLOR_ATTACHMENT0,COLOR_ATTACHMENT1:e.COLOR_ATTACHMENT1,COLOR_ATTACHMENT2:e.COLOR_ATTACHMENT2,COLOR_ATTACHMENT3:e.COLOR_ATTACHMENT3,COLOR_ATTACHMENT4:e.COLOR_ATTACHMENT4,COLOR_ATTACHMENT5:e.COLOR_ATTACHMENT5,COLOR_ATTACHMENT6:e.COLOR_ATTACHMENT6,COLOR_ATTACHMENT7:e.COLOR_ATTACHMENT7,DRAW_BUFFER0:e.DRAW_BUFFER0,DRAW_BUFFER1:e.DRAW_BUFFER1,DRAW_BUFFER2:e.DRAW_BUFFER2,DRAW_BUFFER3:e.DRAW_BUFFER3,DRAW_BUFFER4:e.DRAW_BUFFER4,DRAW_BUFFER5:e.DRAW_BUFFER5,DRAW_BUFFER6:e.DRAW_BUFFER6,DRAW_BUFFER7:e.DRAW_BUFFER7,MAX_COLOR_ATTACHMENTS:e.MAX_COLOR_ATTACHMENTS,MAX_DRAW_BUFFERS:e.MAX_DRAW_BUFFERS};var t=e.getExtension("WEBGL_draw_buffers");return null===t?null:{drawBuffers:t.drawBuffersWEBGL.bind(t),COLOR_ATTACHMENT0:t.COLOR_ATTACHMENT0_WEBGL,COLOR_ATTACHMENT1:t.COLOR_ATTACHMENT1_WEBGL,COLOR_ATTACHMENT2:t.COLOR_ATTACHMENT2_WEBGL,COLOR_ATTACHMENT3:t.COLOR_ATTACHMENT3_WEBGL,COLOR_ATTACHMENT4:t.COLOR_ATTACHMENT4_WEBGL,COLOR_ATTACHMENT5:t.COLOR_ATTACHMENT5_WEBGL,COLOR_ATTACHMENT6:t.COLOR_ATTACHMENT6_WEBGL,COLOR_ATTACHMENT7:t.COLOR_ATTACHMENT7_WEBGL,DRAW_BUFFER0:t.DRAW_BUFFER0_WEBGL,DRAW_BUFFER1:t.DRAW_BUFFER1_WEBGL,DRAW_BUFFER2:t.DRAW_BUFFER2_WEBGL,DRAW_BUFFER3:t.DRAW_BUFFER3_WEBGL,DRAW_BUFFER4:t.DRAW_BUFFER4_WEBGL,DRAW_BUFFER5:t.DRAW_BUFFER5_WEBGL,DRAW_BUFFER6:t.DRAW_BUFFER6_WEBGL,DRAW_BUFFER7:t.DRAW_BUFFER7_WEBGL,MAX_COLOR_ATTACHMENTS:t.MAX_COLOR_ATTACHMENTS_WEBGL,MAX_DRAW_BUFFERS:t.MAX_DRAW_BUFFERS_WEBGL}}function S(e){return s(e)?{}:e.getExtension("EXT_shader_texture_lod")}function x(e){if(s(e))return{UNSIGNED_INT_24_8:e.UNSIGNED_INT_24_8};var t=e.getExtension("WEBGL_depth_texture");return null===t?null:{UNSIGNED_INT_24_8:t.UNSIGNED_INT_24_8_WEBGL}}function O(e){if(s(e))return{FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING,SRGB8_ALPHA8:e.SRGB8_ALPHA8,SRGB8:e.SRGB8,SRGB:e.SRGB};var t=e.getExtension("EXT_sRGB");return null===t?null:{FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:t.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT,SRGB8_ALPHA8:t.SRGB8_ALPHA8_EXT,SRGB8:t.SRGB_ALPHA_EXT,SRGB:t.SRGB_EXT}}var w=new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]);function C(e,t){var r=Object(o.b)(e,{type:"vert",source:"\nattribute vec4 aPosition;\n\nvoid main() {\n    gl_Position = aPosition;\n}"}),s=Object(o.b)(e,{type:"frag",source:"\nprecision mediump float;\nuniform vec4 uColor;\nuniform sampler2D uTexture;\n\nvoid main() {\n    gl_FragColor = texture2D(uTexture, vec2(0.5, 0.5)) * uColor;\n}"});if(!r||!s)return!1;var u=Object(a.b)(e);e.attachShader(u,r),e.attachShader(u,s),e.linkProgram(u),e.useProgram(u);var c=e.getAttribLocation(u,"aPosition"),l=e.getUniformLocation(u,"uColor");if(!l)return n.a&&console.log("error getting 'uColor' uniform location"),!1;var d=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,d),e.bufferData(e.ARRAY_BUFFER,w,e.STATIC_DRAW),e.enableVertexAttribArray(c),e.vertexAttribPointer(c,2,e.FLOAT,!1,0,0);var f=e.createTexture(),p=new Uint8Array([255,255,255,255]);e.bindTexture(e.TEXTURE_2D,f),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,p);var m=e.createTexture();e.bindTexture(e.TEXTURE_2D,m),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,t,null),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST);var h=e.createFramebuffer();if(e.bindFramebuffer(e.FRAMEBUFFER,h),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,m,0),e.checkFramebufferStatus(e.FRAMEBUFFER)!==e.FRAMEBUFFER_COMPLETE)return n.a&&console.log("error creating framebuffer for '"+t+"'"),!1;e.bindTexture(e.TEXTURE_2D,f),e.uniform4fv(l,[0,10,20,1]),e.drawArrays(e.TRIANGLES,0,6),e.bindTexture(e.TEXTURE_2D,m),e.bindFramebuffer(e.FRAMEBUFFER,null),e.clearColor(1,0,0,1),e.clear(e.COLOR_BUFFER_BIT),e.uniform4fv(l,[0,.1,.05,1]),e.drawArrays(e.TRIANGLES,0,6);var g=new Uint8Array(4);if(e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,g),0!==g[0]||g[1]<248||g[2]<248||g[3]<254)return n.a&&console.log("not able to actually render to '"+t+"' texture"),!1;if(t===e.FLOAT){e.bindFramebuffer(e.FRAMEBUFFER,h);var v=new Float32Array(4);e.readPixels(0,0,1,1,e.RGBA,e.FLOAT,v);var b=e.getError();if(b)return n.a&&console.log("error reading float pixels: '"+Object(i.c)(e,b)+"'"),!1}return!0}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(90),i=r(42);function a(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=""),a.create(e,t,r)}!function(e){function t(e){return e.triggers.map(r.format).join(" or ")}function r(e,t){return r.create(e,t)}e.create=function(e,t,r){return void 0===t&&(t=""),void 0===r&&(r=""),{triggers:e,action:t,description:r}},e.Empty={triggers:[],action:"",description:""},e.isEmpty=function(e){return 0===e.triggers.length||e.triggers.every((function(e){return void 0===e.buttons&&void 0===e.modifiers}))},e.match=function(e,t,n){return e.triggers.some((function(e){return r.match(e,t,n)}))},e.formatTriggers=t,e.format=function(e,r){void 0===r&&(r="");var n=e.description||Object(i.d)(r);return Object(i.c)(n,{triggers:"<i>"+t(e)+"</i>"})},e.Trigger=r,function(e){e.create=function(e,t){return{buttons:e,modifiers:t}},e.Empty={},e.match=function(e,t,r){var i=e.buttons,a=e.modifiers;return void 0!==i&&(i===t||n.a.has(i,t))&&(!a||n.b.areEqual(a,r))},e.format=function(e){var t=[],r=function(e){var t=[];void 0===e?t.push("any mouse button"):0===e?t.push("mouse hover"):(o.has(e,1)&&t.push("left mouse button"),o.has(e,2)&&t.push("right mouse button"),o.has(e,4)&&t.push("wheel/middle mouse button"),o.has(e,8)&&t.push("three fingers"));return t.join(" + ")}(e.buttons);r&&t.push(r);var n=function(e,t){var r=[];e?(e.alt&&r.push("alt key"),e.control&&r.push("control key"),e.meta&&r.push("meta/command key"),e.shift&&r.push("shift key"),t&&0===r.length&&r.push("no key")):t&&r.push("any key");return r.join(" + ")}(e.modifiers);return n&&t.push(n),t.join(" + ")}}(r=e.Trigger||(e.Trigger={}))}(a||(a={}));var o=n.a},function(e,t,r){"use strict";r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return d}));var n=r(20),i=r(45),a=r(34),o=r(76),s=r(215),u=r(362),c=r(285),l=function(e){function t(t){var r=e.call(this,t)||this;return r.destination=t,r}return n.a(t,e),t}(a.a),d=function(e){function t(){var t=e.call(this)||this;return t.observers=[],t.closed=!1,t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return n.a(t,e),t.prototype[c.a]=function(){return new l(this)},t.prototype.lift=function(e){var t=new f(this,this);return t.operator=e,t},t.prototype.next=function(e){if(this.closed)throw new s.a;if(!this.isStopped)for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].next(e)},t.prototype.error=function(e){if(this.closed)throw new s.a;this.hasError=!0,this.thrownError=e,this.isStopped=!0;for(var t=this.observers,r=t.length,n=t.slice(),i=0;i<r;i++)n[i].error(e);this.observers.length=0},t.prototype.complete=function(){if(this.closed)throw new s.a;this.isStopped=!0;for(var e=this.observers,t=e.length,r=e.slice(),n=0;n<t;n++)r[n].complete();this.observers.length=0},t.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},t.prototype._trySubscribe=function(t){if(this.closed)throw new s.a;return e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){if(this.closed)throw new s.a;return this.hasError?(e.error(this.thrownError),o.a.EMPTY):this.isStopped?(e.complete(),o.a.EMPTY):(this.observers.push(e),new u.a(this,e))},t.prototype.asObservable=function(){var e=new i.a;return e.source=this,e},t.create=function(e,t){return new f(e,t)},t}(i.a),f=function(e){function t(t,r){var n=e.call(this)||this;return n.destination=t,n.source=r,n}return n.a(t,e),t.prototype.next=function(e){var t=this.destination;t&&t.next&&t.next(e)},t.prototype.error=function(e){var t=this.destination;t&&t.error&&this.destination.error(e)},t.prototype.complete=function(){var e=this.destination;e&&e.complete&&this.destination.complete()},t.prototype._subscribe=function(e){return this.source?this.source.subscribe(e):o.a.EMPTY},t}(d)},function(e,t,r){"use strict";r.d(t,"a",(function(){return j}));var n,i,a,o,s=r(108),u=r(0),c=r(298),l=r(127);function d(e){return function(t,r){return r[e].value(t)}}function f(e){return function(t,r){return r[e].value(t).join(r[e].schema.separator)}}function p(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n){var i;return(i=n[e].schema.space).get.apply(i,Object(u.__spreadArrays)([n[e].value(r)],t))}}function m(e){return function(t,r){return r[e].valueKind(t)}}function h(e,t){var r=[],n=m(e);if(1===t.rank)for(var i=t.dimensions[0],a=0;a<i;a++){var o=e+"["+(a+1)+"]";r.push({name:o,type:2,value:p(e,a),valueKind:n})}else if(2===t.rank){i=t.dimensions[0];var s=t.dimensions[1];for(a=0;a<i;a++)for(var u=0;u<s;u++){var c=e+"["+(a+1)+"]["+(u+1)+"]";r.push({name:c,type:2,value:p(e,a,u),valueKind:n})}}else{if(3!==t.rank)throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.");var l=t.dimensions[0],d=t.dimensions[1],f=t.dimensions[2];for(a=0;a<l;a++)for(u=0;u<d;u++)for(var h=0;h<f;h++){var g=e+"["+(a+1)+"]["+(u+1)+"]["+(h+1)+"]";r.push({name:g,type:2,value:p(e,a,u,h),valueKind:n})}}return r}function g(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var i=n[r],a=e[i];if("int"===a.valueType)t.push({name:i,type:1,value:d(i),valueKind:m(i)});else if("float"===a.valueType)t.push({name:i,type:2,value:d(i),valueKind:m(i)});else if("str"===a.valueType)t.push({name:i,type:0,value:d(i),valueKind:m(i)});else if("list"===a.valueType)t.push({name:i,type:0,value:f(i),valueKind:m(i)});else{if("tensor"!==a.valueType)throw new Error("Unknown valueType "+a.valueType);t.push.apply(t,h(i,a.space))}}return t}!function(e){function t(e,t,r){return{name:e,type:1,value:t,valueKind:r&&r.valueKind,defaultFormat:r?{encoder:r.encoder,typedArray:r.typedArray}:void 0,shouldInclude:r&&r.shouldInclude}}e.str=function(e,t,r){return{name:e,type:0,value:t,valueKind:r&&r.valueKind,defaultFormat:r&&r.encoder?{encoder:r.encoder}:void 0,shouldInclude:r&&r.shouldInclude}},e.int=t,e.float=function(e,t,r){return{name:e,type:2,value:t,valueKind:r&&r.valueKind,defaultFormat:r?{encoder:r.encoder,typedArray:r.typedArray,digitCount:void 0!==r.digitCount?r.digitCount:void 0}:void 0,shouldInclude:r&&r.shouldInclude}},e.index=function(e){return t(e,(function(e,t,r){return r+1}),{typedArray:Int32Array,encoder:l.b.by(l.b.delta).and(l.b.runLength).and(l.b.integerPacking)})};var r=function(){function t(){this.fields=[]}return t.prototype.index=function(t){return this.fields.push(e.index(t)),this},t.prototype.str=function(t,r,n){return this.fields.push(e.str(t,r,n)),this},t.prototype.int=function(t,r,n){return this.fields.push(e.int(t,r,n)),this},t.prototype.vec=function(t,r,n){for(var i=0;i<r.length;i++)this.fields.push(e.int(t+"["+(i+1)+"]",r[i],n));return this},t.prototype.float=function(t,r,n){return this.fields.push(e.float(t,r,n)),this},t.prototype.many=function(e){for(var t=0;t<e.length;t++)this.fields.push(e[t]);return this},t.prototype.add=function(e){return this.fields.push(e),this},t.prototype.getFields=function(){return this.fields},t}();e.Builder=r,e.build=function(){return new r}}(n||(n={})),(a=i||(i={})).Empty={fields:[],source:[]},a.filterOf=function(e){for(var t=[],r=[],n=[],i=[],a=0,o=e.split(/[\r\n]+/);a<o.length;a++){var s=o[a];if(0!==(s=s.trim()).length){var u=/^!/.test(s);u&&(s=s.substr(1));var c=s.split(/\./),l=c[1],d=u?l?i:r:l?n:t;d[d.length]=s,l&&!t.includes(c[0])&&(t[t.length]=c[0])}}var f=n.map((function(e){return e.split(".")[0]}));return{includeCategory:function(e){return!r.includes(e)&&(t.length<=0||-1!==t.indexOf(e))},includeField:function(e,t){var r=e+"."+t;return!i.includes(r)&&(!f.includes(e)||n.includes(r))}}},a.DefaultFilter={includeCategory:function(e){return!0},includeField:function(e,t){return!0}},a.DefaultFormatter={getFormat:function(e,t){}},a.ofTable=function(e,t){return t?{fields:g(e._schema),source:[{data:e,rowCount:t.length,keys:function(){return c.a.Array(t)}}]}:{fields:g(e._schema),source:[{data:e,rowCount:e._rowCount}]}},function(e){function t(e,t,r){e.startDataBlock(t);for(var n=function(t){e.writeCategory({name:t,instance:function(){return i.ofTable(r[t])}})},a=0,o=r._tableNames;a<o.length;a++){n(o[a])}}e.writeDatabase=t,e.writeDatabaseCollection=function(e,r){for(var n=0,i=Object.keys(r);n<i.length;n++){var a=i[n];t(e,a,r[a])}}}(o||(o={}));r(7),r(6),r(12),r(57);function v(e){return e.fields.some((function(e){return!!e.shouldInclude}))?e.fields.filter((function(t){return!t.shouldInclude||e.source.some((function(e){return t.shouldInclude(e.data)}))})):e.fields}function b(e,t){var r=e.instance(t),n=r.source.filter((function(e){return e.rowCount>0}));return n.length?{instance:r,rowCount:n.reduce((function(e,t){return e+t.rowCount}),0),source:n.map((function(e){return{data:e.data,keys:function(){return e.keys?e.keys():c.a.Range(0,e.rowCount-1)},rowCount:e.rowCount}}))}:{instance:r,rowCount:0,source:[]}}var y=function(){function e(){this.builder=s.a.create(),this.encoded=!1,this.dataBlockCreated=!1,this.filter=i.DefaultFilter,this.formatter=i.DefaultFormatter,this.isBinary=!1,this.binaryEncodingProvider=void 0}return e.prototype.setFilter=function(e){this.filter=e||i.DefaultFilter},e.prototype.isCategoryIncluded=function(e){return this.filter.includeCategory(e)},e.prototype.setFormatter=function(e){this.formatter=e||i.DefaultFormatter},e.prototype.startDataBlock=function(e){this.dataBlockCreated=!0,s.a.write(this.builder,"data_"+(e||"").replace(/[ \n\t]/g,"").toUpperCase()+"\n#\n")},e.prototype.writeCategory=function(e,t,r){if(this.encoded)throw new Error("The writer contents have already been encoded, no more writing.");if(!this.dataBlockCreated)throw new Error("No data block created.");if((null==r?void 0:r.ignoreFilter)||this.filter.includeCategory(e.name)){var n=b(e,t),a=n.instance,o=n.rowCount,u=n.source;o&&(1===o?function(e,t,r,n,i,a){var o=v(t),u=r[0],c=u.data,l=o.reduce((function(t,r){return i.includeField(e.name,r.name)?Math.max(t,r.name.length):0}),0);if(0===l)return;l+=e.name.length+6;for(var d=u.keys().move(),f=S(e.name,t.fields,a),p=0;p<o.length;p++){var m=o[p];if(i.includeField(e.name,m.name))s.a.writePadRight(n,"_"+e.name+"."+m.name,l),_(n,c,d,m,f[p],0)||s.a.newline(n)}s.a.write(n,"#\n")}(e,a,u,this.builder,this.filter,this.formatter):function(e,t,r,n,a,o){var u=v(t),c=a===i.DefaultFilter?u:u.filter((function(t){return a.includeField(e.name,t.name)})),l=c.length;if(0===l)return;var d=S(e.name,c,o);x(n,"loop_");for(var f=0;f<l;f++)x(n,"_"+e.name+"."+c[f].name);for(var p=0,m=0;m<r.length;m++){var h=r[m],g=h.data;if(0!==h.rowCount)for(var b=h.keys();b.hasNext;){for(var y=b.move(),O=!1,w=0;w<l;w++)O=_(n,g,y,c[w],d[w],p);O||s.a.newline(n),p++}}s.a.write(n,"#\n")}(e,a,u,this.builder,this.filter,this.formatter))}},e.prototype.encode=function(){this.encoded=!0},e.prototype.writeTo=function(e){for(var t=s.a.getChunks(this.builder),r=0,n=t.length;r<n;r++)e.writeString(t[r])},e.prototype.getSize=function(){return s.a.getSize(this.builder)},e.prototype.getData=function(){return s.a.getString(this.builder)},e}();function _(e,t,r,n,i,a){var o,u=n.valueKind,c=u?u(r,t):0;if(0!==c)1===c?function(e){s.a.writeSafe(e,". ")}(e):function(e){s.a.writeSafe(e,"? ")}(e);else{var l=n.value(r,t,a),d=n.type;if(0===d)return"string"==typeof(o=l)&&o.indexOf("\n")>=0?(O(e,l),!0):function(e,t){if(!t)return s.a.writeSafe(e,". "),!1;for(var r=95===t.charCodeAt(0),n="'",i="' ",a=!1,o=!1,u=!1,c=0,l=t.length-1;c<l;c++){switch(t.charCodeAt(c)){case 9:a=!0;break;case 10:return O(e,t),!0;case 32:a=!0;break;case 34:if(o)return O(e,t),!0;u=!0,r=!0,n="'",i="' ";break;case 39:if(u)return O(e,t),!0;r=!0,o=!0,n='"',i='" '}}var d=t.charCodeAt(0);r||35!==d&&36!==d&&59!==d&&91!==d&&93!==d&&!a||(n="'",i="' ",r=!0);r?(s.a.writeSafe(e,n),s.a.writeSafe(e,t),s.a.writeSafe(e,i)):(s.a.writeSafe(e,t),s.a.writeSafe(e," "));return!1}(e,l);1===d?function(e,t){s.a.writeInteger(e,t),s.a.whitespace1(e)}(e,l):function(e,t,r){s.a.writeFloat(e,t,r),s.a.whitespace1(e)}(e,l,i)}return!1}function S(e,t,r){for(var n,i=[],a=0,o=t;a<o.length;a++){var s=o[a],u=r.getFormat(e,s.name);u&&void 0!==u.digitCount?i[i.length]=2===s.type?Math.pow(10,Math.max(0,Math.min(u.digitCount,15))):0:i[i.length]=2===s.type?Math.pow(10,(n=s).defaultFormat&&void 0!==n.defaultFormat.digitCount?Math.max(0,Math.min(n.defaultFormat.digitCount,16)):6):0}return i}function x(e,t){s.a.write(e,t),s.a.newline(e)}function O(e,t){s.a.writeSafe(e,"\n;"+t),s.a.writeSafe(e,"\n;\n")}var w=r(161);function C(e){var t=new ArrayBuffer(function e(t){var r=typeof t;if("string"===r){var n=Object(w.a)(t);if(n<32)return 1+n;if(n<256)return 2+n;if(n<65536)return 3+n;if(n<4294967296)return 5+n}if(t instanceof Uint8Array){var i=t.byteLength;if(i<256)return 2+i;if(i<65536)return 3+i;if(i<4294967296)return 5+i}if("number"===r){if(Math.floor(t)!==t)return 9;if(t>=0){if(t<128)return 1;if(t<256)return 2;if(t<65536)return 3;if(t<4294967296)return 5;throw new Error("Number too big 0x"+t.toString(16))}if(t>=-32)return 1;if(t>=-128)return 2;if(t>=-32768)return 3;if(t>=-2147483648)return 5;throw new Error("Number too small -0x"+t.toString(16).substr(1))}if("boolean"===r||null==t)return 1;if("object"===r){var a,o=0;if(Array.isArray(t)){a=t.length;for(var s=0;s<a;s++)o+=e(t[s])}else{var u=Object.keys(t);a=u.length;for(s=0;s<a;s++){var c=u[s];o+=e(c)+e(t[c])}}if(a<16)return 1+o;if(a<65536)return 3+o;if(a<4294967296)return 5+o;throw new Error("Array or object too long 0x"+a.toString(16))}throw new Error("Unknown type "+r)}(e)),r=new DataView(t),n=new Uint8Array(t);return function e(t,r,n,i){var a=typeof t;if("string"===a){var o=Object(w.a)(t);if(o<32)return r.setUint8(i,160|o),Object(w.c)(n,i+1,t),1+o;if(o<256)return r.setUint8(i,217),r.setUint8(i+1,o),Object(w.c)(n,i+2,t),2+o;if(o<65536)return r.setUint8(i,218),r.setUint16(i+1,o),Object(w.c)(n,i+3,t),3+o;if(o<4294967296)return r.setUint8(i,219),r.setUint32(i+1,o),Object(w.c)(n,i+5,t),5+o}if(t instanceof Uint8Array){var s=t.byteLength,u=new Uint8Array(r.buffer);if(s<256)return r.setUint8(i,196),r.setUint8(i+1,s),u.set(t,i+2),2+s;if(s<65536)return r.setUint8(i,197),r.setUint16(i+1,s),u.set(t,i+3),3+s;if(s<4294967296)return r.setUint8(i,198),r.setUint32(i+1,s),u.set(t,i+5),5+s}if("number"===a){if(!isFinite(t))throw new Error("Number not finite: "+t);if(Math.floor(t)!==t)return r.setUint8(i,203),r.setFloat64(i+1,t),9;if(t>=0){if(t<128)return r.setUint8(i,t),1;if(t<256)return r.setUint8(i,204),r.setUint8(i+1,t),2;if(t<65536)return r.setUint8(i,205),r.setUint16(i+1,t),3;if(t<4294967296)return r.setUint8(i,206),r.setUint32(i+1,t),5;throw new Error("Number too big 0x"+t.toString(16))}if(t>=-32)return r.setInt8(i,t),1;if(t>=-128)return r.setUint8(i,208),r.setInt8(i+1,t),2;if(t>=-32768)return r.setUint8(i,209),r.setInt16(i+1,t),3;if(t>=-2147483648)return r.setUint8(i,210),r.setInt32(i+1,t),5;throw new Error("Number too small -0x"+(-t).toString(16).substr(1))}if(null==t)return r.setUint8(i,192),1;if("boolean"===a)return r.setUint8(i,t?195:194),1;if("object"===a){var c,l=0,d=Array.isArray(t),f=void 0;if(d?c=t.length:(f=Object.keys(t),c=f.length),c<16?(r.setUint8(i,c|(d?144:128)),l=1):c<65536?(r.setUint8(i,d?220:222),r.setUint16(i+1,c),l=3):c<4294967296&&(r.setUint8(i,d?221:223),r.setUint32(i+1,c),l=5),d)for(var p=0;p<c;p++)l+=e(t[p],r,n,i+l);else{p=0;for(var m=f.length;p<m;p++){var h=f[p];l+=e(h,r,n,i+l),l+=e(t[h],r,n,i+l)}}return l}throw new Error("Unknown type "+a)}(e,r,n,0),n}var j,P=r(268),E=function(){function e(e,t,r){this.autoClassify=r,this.dataBlocks=[],this.filter=i.DefaultFilter,this.formatter=i.DefaultFormatter,this.isBinary=!0,this.binaryEncodingProvider=void 0,this.binaryEncodingProvider=t,this.data={encoder:e,version:l.c,dataBlocks:this.dataBlocks}}return e.prototype.setFilter=function(e){this.filter=e||i.DefaultFilter},e.prototype.isCategoryIncluded=function(e){return this.filter.includeCategory(e)},e.prototype.setFormatter=function(e){this.formatter=e||i.DefaultFormatter},e.prototype.startDataBlock=function(e){this.dataBlocks.push({header:(e||"").replace(/[ \n\t]/g,"").toUpperCase(),categories:[]})},e.prototype.writeCategory=function(e,t,r){if(!this.data)throw new Error("The writer contents have already been encoded, no more writing.");if(!this.dataBlocks.length)throw new Error("No data block created.");if((null==r?void 0:r.ignoreFilter)||this.filter.includeCategory(e.name)){var n=b(e,t),i=n.instance,a=n.rowCount,o=n.source;if(a){for(var s={name:"_"+e.name,columns:[],rowCount:a},u=0,c=v(i);u<c.length;u++){var l=c[u];if(this.filter.includeField(e.name,l.name)){var d=this.formatter.getFormat(e.name,l.name);s.columns.push(A(e.name,l,o,a,d,this.binaryEncodingProvider,this.autoClassify))}}s.columns.length&&this.dataBlocks[this.dataBlocks.length-1].categories.push(s)}}},e.prototype.encode=function(){this.encodedData||(this.encodedData=C(this.data),this.data=null,this.dataBlocks=null)},e.prototype.writeTo=function(e){e.writeBinary(this.encodedData)},e.prototype.getData=function(){return this.encode(),this.encodedData},e.prototype.getSize=function(){return this.encodedData.length},e}();function A(e,t,r,n,i,a,o){var s=function(e,t,r,n){for(var i=0===e.type,a=new t(r),o=new Uint8Array(r),s=e.valueKind,u=e.value,c=!0,l=0,d=0;d<n.length;d++)for(var f=n[d].data,p=n[d].keys();p.hasNext;){var m=p.move(),h=s?s(m,f):0;0!==h?(o[l]=h,i&&(a[l]=""),c=!1):(o[l]=0,a[l]=u(m,f,l)),l++}return{array:a,allPresent:c,mask:o}}(t,function(e,t){return t&&t.typedArray?t.typedArray:e.defaultFormat&&e.defaultFormat.typedArray?e.defaultFormat.typedArray:0===e.type?Array:1===e.type?Int32Array:Float64Array}(t,i),n,r),u=s.array,c=s.allPresent,d=s.mask,f=function(e,t,r,n){return r&&r.encoder?r.encoder:t.defaultFormat&&t.defaultFormat.encoder?t.defaultFormat.encoder:n?n.get(e,t.name):void 0}(e,t,i,a);f||(o?f=function(e,t){return 0===e?l.a.by(l.b.stringArray):1===e?Object(P.b)(t):Object(P.a)(t)}(t.type,u):f=0===t.type?l.a.by(l.b.stringArray):l.a.by(l.b.byteArray));var p=f.encode(u),m=void 0;if(!c){var h=l.a.by(l.b.runLength).and(l.b.byteArray).encode(d);m=h.data.length<d.length?h:l.a.by(l.b.byteArray).encode(d)}return{name:t.name,data:p,mask:m}}!function(e){e.Encoder=o,e.Category=i,e.Field=n,e.Encoding=l.b,e.createEncoder=function(e){var t=e||{},r=t.binary,n=void 0!==r&&r,i=t.encoderName;return n?new E(void 0===i?"mol*":i,e?e.binaryEncodingPovider:void 0,!!e&&!!e.binaryAutoClassifyEncoding):new y},e.fields=function(){return e.Field.build()};var t=e.Encoding;function r(e){var r=e.precision;if(void 0!==r){var n=Math.pow(10,r),i=t.by(t.fixedPoint(n));switch(e.encoding){case"pack":return i.and(t.integerPacking);case"rle":return i.and(t.runLength).and(t.integerPacking);case"delta":return i.and(t.delta).and(t.integerPacking);case"delta-rle":return i.and(t.delta).and(t.runLength).and(t.integerPacking)}}else switch(e.encoding){case"pack":return t.by(t.integerPacking);case"rle":return t.by(t.runLength).and(t.integerPacking);case"delta":return t.by(t.delta).and(t.integerPacking);case"delta-rle":return t.by(t.delta).and(t.runLength).and(t.integerPacking)}throw new Error("cannot be reached")}e.Encodings={deltaRLE:t.by(t.delta).and(t.runLength).and(t.integerPacking),fixedPoint2:t.by(t.fixedPoint(100)).and(t.delta).and(t.integerPacking),fixedPoint3:t.by(t.fixedPoint(1e3)).and(t.delta).and(t.integerPacking)},e.categoryInstance=function(e,t){return{fields:e,source:[t]}},e.createEncodingProviderFromCifFrame=function(e){return{get:function(t,r){var n=e.categories[t];if(n){var i=n.getField(r);return i&&i.binaryEncoding?l.a.fromEncoding(i.binaryEncoding):void 0}}}},e.createEncodingProviderFromJsonConfig=function(e){return{get:function(t,n){for(var i=0;i<e.length;i++){var a=e[i];if(a.categoryName===t&&a.columnName===n)return r(a)}}}}}(j||(j={}))},function(e,t,r){"use strict";r.d(t,"g",(function(){return f})),r.d(t,"f",(function(){return p})),r.d(t,"h",(function(){return m})),r.d(t,"a",(function(){return h})),r.d(t,"i",(function(){return g})),r.d(t,"d",(function(){return v})),r.d(t,"e",(function(){return b})),r.d(t,"b",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"j",(function(){return S}));var n=r(99),i=r(60),a=Object(n.a)(),o={apply_fog:"\nfloat viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\nfloat fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\nfloat fogAlpha = (1.0 - fogFactor) * gl_FragColor.a;\nfloat preFogAlpha = gl_FragColor.a;\nif (!uTransparentBackground) {\n    if (gl_FragColor.a < 1.0) {\n        // transparent objects are blended with background color\n        gl_FragColor.a = fogAlpha;\n    } else {\n        // mix opaque objects with background color\n        gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor, fogFactor);\n    }\n} else {\n    // pre-multiplied alpha expected for transparent background\n    gl_FragColor.rgb *= fogAlpha;\n    gl_FragColor.a = fogAlpha;\n}\n",apply_interior_color:"\nif (interior) {\n    if (uInteriorColorFlag) {\n        gl_FragColor.rgb = uInteriorColor;\n    } else {\n        gl_FragColor.rgb *= 1.0 - uInteriorDarkening;\n    }\n}\n",apply_light_color:"\n// inputs\n// - vec4 material\n// - vec3 vViewPosition\n// - vec3 normal\n// - float uMetalness\n// - float uRoughness\n// - float uReflectivity\n// - float uLightIntensity\n// - float uAmbientIntensity\n\n// outputs\n// - sets gl_FragColor\n\nvec4 color = material;\n\nReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0));\n\nPhysicalMaterial physicalMaterial;\nphysicalMaterial.diffuseColor = color.rgb * (1.0 - uMetalness);\nphysicalMaterial.specularRoughness = clamp(uRoughness, 0.04, 1.0);\nphysicalMaterial.specularColor = mix(vec3(0.16 * pow2(uReflectivity)), color.rgb, uMetalness);\n\nGeometricContext geometry;\ngeometry.position = -vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize(vViewPosition);\n\nIncidentLight directLight;\ndirectLight.direction = vec3(0.0, 0.0, -1.0);\ndirectLight.color = vec3(uLightIntensity);\n\nRE_Direct_Physical(directLight, geometry, physicalMaterial, reflectedLight);\n\nvec3 irradiance = vec3(uAmbientIntensity) * PI;\nRE_IndirectDiffuse_Physical(irradiance, geometry, physicalMaterial, reflectedLight);\n\nvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;\n\ngl_FragColor = vec4(outgoingLight, color.a);\n\n#ifdef dXrayShaded\n    gl_FragColor.a *= 1.0 - pow(abs(dot(normal, vec3(0, 0, 1))), uXrayEdgeFalloff);\n#endif\n",apply_marker_color:"\nfloat marker = floor(vMarker * 255.0 + 0.5); // rounding required to work on some cards on win\nif (marker > 0.1) {\n    if (intMod(marker, 2.0) > 0.1) {\n        gl_FragColor.rgb = mix(uHighlightColor, gl_FragColor.rgb, 0.3);\n        gl_FragColor.a = max(0.02, gl_FragColor.a); // for direct-volume rendering\n    } else {\n        gl_FragColor.rgb = mix(uSelectColor, gl_FragColor.rgb, 0.3);\n    }\n}\n",assign_clipping_varying:"\n#if dClipObjectCount != 0 && defined(dClipping)\n    vClipping = readFromTexture(tClipping, aInstance * float(uGroupCount) + group, uClippingTexDim).a;\n#endif\n",assign_color_varying:"\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_attribute)\n        vColor.rgb = aColor;\n    #elif defined(dColorType_instance)\n        vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n    #elif defined(dColorType_group)\n        vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n    #elif defined(dColorType_groupInstance)\n        vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n    #elif defined(dColorType_vertex)\n        vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n    #elif defined(dColorType_vertexInstance)\n        vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n    #endif\n\n    #ifdef dOverpaint\n        vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n    #endif\n#elif defined(dRenderVariant_pick)\n    #if defined(dRenderVariant_pickObject)\n        vColor = vec4(encodeFloatRGB(float(uObjectId)), 1.0);\n    #elif defined(dRenderVariant_pickInstance)\n        vColor = vec4(encodeFloatRGB(aInstance), 1.0);\n    #elif defined(dRenderVariant_pickGroup)\n        vColor = vec4(encodeFloatRGB(group), 1.0);\n    #endif\n#endif\n\n#ifdef dTransparency\n    vGroup = group;\n    vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n#endif\n",assign_group:"\n#ifdef dGeoTexture\n    float group = decodeFloatRGB(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n    float group = aGroup;\n#endif\n",assign_marker_varying:"\nvMarker = readFromTexture(tMarker, aInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n",assign_material_color:"\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_uniform)\n        vec4 material = vec4(uColor, uAlpha);\n    #elif defined(dColorType_varying)\n        vec4 material = vec4(vColor.rgb, uAlpha);\n    #endif\n\n    // mix material with overpaint\n    #if defined(dOverpaint)\n        material.rgb = mix(material.rgb, vOverpaint.rgb, vOverpaint.a);\n    #endif\n#elif defined(dRenderVariant_pick)\n    vec4 material = vColor;\n#elif defined(dRenderVariant_depth)\n    #ifdef enabledFragDepth\n        vec4 material = packDepthToRGBA(gl_FragDepthEXT);\n    #else\n        vec4 material = packDepthToRGBA(gl_FragCoord.z);\n    #endif\n#endif\n\n// apply screendoor transparency\n#if defined(dTransparency)\n    float ta = 1.0 - vTransparency;\n\n    #if defined(dRenderVariant_pick)\n        if (ta < uPickingAlphaThreshold)\n            discard; // ignore so the element below can be picked\n    #else\n        #if defined(dRenderVariant_colorBlended)\n            float at = 0.0;\n\n            // shift by view-offset during multi-sample rendering to allow for blending\n            vec2 coord = gl_FragCoord.xy + uViewOffset * 0.25;\n\n            const mat4 thresholdMatrix = mat4(\n                1.0 / 17.0,  9.0 / 17.0,  3.0 / 17.0, 11.0 / 17.0,\n                13.0 / 17.0,  5.0 / 17.0, 15.0 / 17.0,  7.0 / 17.0,\n                4.0 / 17.0, 12.0 / 17.0,  2.0 / 17.0, 10.0 / 17.0,\n                16.0 / 17.0,  8.0 / 17.0, 14.0 / 17.0,  6.0 / 17.0\n            );\n            int ci = int(intMod(coord.x, 4.0));\n            int ri = int(intMod(coord.y, 4.0));\n            #if __VERSION__ == 100\n                vec4 i = vec4(float(ci * 4 + ri));\n                vec4 v = thresholdMatrix[0] * vec4(equal(i, vec4(0.0, 1.0, 2.0, 3.0))) +\n                    thresholdMatrix[1] * vec4(equal(i, vec4(4.0, 5.0, 6.0, 7.0))) +\n                    thresholdMatrix[2] * vec4(equal(i, vec4(8.0, 9.0, 10.0, 11.0))) +\n                    thresholdMatrix[3] * vec4(equal(i, vec4(12.0, 13.0, 14.0, 15.0)));\n                at = v.x + v.y + v.z + v.w;\n            #else\n                at = thresholdMatrix[ci][ri];\n            #endif\n\n            if (ta < 0.99 && (ta < 0.01 || ta < at)) {\n                discard;\n            }\n        #elif defined(dRenderVariant_colorWboit)\n            material.a *= ta;\n        #endif\n    #endif\n#endif\n",assign_position:"\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeoTexture\n    vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n    vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\nvModelPosition = (model * position4).xyz; // for clipping in frag shader\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n",assign_size:"\n#if defined(dSizeType_uniform)\n    float size = uSize;\n#elif defined(dSizeType_attribute)\n    float size = aSize;\n#elif defined(dSizeType_instance)\n    float size = decodeFloatRGB(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n    float size = decodeFloatRGB(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n    float size = decodeFloatRGB(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n    size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;\n",check_picking_alpha:"\nfloat viewZ = depthToViewZ(uIsOrtho, fragmentDepth, uNear, uFar);\nfloat fogFactor = smoothstep(uFogNear, uFogFar, abs(viewZ));\nfloat alpha = (1.0 - fogFactor) * uAlpha;\nif (uAlpha < uPickingAlphaThreshold || alpha < 0.1)\n    discard; // ignore so the element below can be picked\n",clip_instance:"\n#if defined(dClipVariant_instance) && dClipObjectCount != 0\n    int flag = 0;\n    #if defined(dClipping)\n        flag = int(floor(vClipping * 255.0 + 0.5));\n    #endif\n\n    vec4 mCenter = uModel * aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0);\n    if (clipTest(vec4(mCenter.xyz, uInvariantBoundingSphere.w), flag))\n        // move out of [ -w, +w ] to 'discard' in vert shader\n        gl_Position.z = 2.0 * gl_Position.w;\n#endif\n",clip_pixel:"\n#if defined(dClipVariant_pixel) && dClipObjectCount != 0\n    #if defined(dClipping)\n        int clippingFlag = int(floor(vClipping * 255.0 + 0.5));\n    #else\n        int clippingFlag = 0;\n    #endif\n\n    if (clipTest(vec4(vModelPosition, 0.0), clippingFlag))\n        discard;\n#endif\n",color_frag_params:"\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_uniform)\n        uniform vec3 uColor;\n    #elif defined(dColorType_varying)\n        varying vec4 vColor;\n    #endif\n\n    #ifdef dOverpaint\n        varying vec4 vOverpaint;\n    #endif\n#elif defined(dRenderVariant_pick)\n    #if __VERSION__ == 100\n        varying vec4 vColor;\n    #else\n        flat in vec4 vColor;\n    #endif\n#endif\n\n#ifdef dTransparency\n    varying float vGroup;\n    varying float vTransparency;\n#endif\n",color_vert_params:"\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_uniform)\n        uniform vec3 uColor;\n    #elif defined(dColorType_attribute)\n        varying vec4 vColor;\n        attribute vec3 aColor;\n    #elif defined(dColorType_texture)\n        varying vec4 vColor;\n        uniform vec2 uColorTexDim;\n        uniform sampler2D tColor;\n    #endif\n\n    #ifdef dOverpaint\n        varying vec4 vOverpaint;\n        uniform vec2 uOverpaintTexDim;\n        uniform sampler2D tOverpaint;\n    #endif\n#elif defined(dRenderVariant_pick)\n    #if __VERSION__ == 100\n        varying vec4 vColor;\n    #else\n        flat out vec4 vColor;\n    #endif\n#endif\n\n#ifdef dTransparency\n    varying float vGroup;\n    varying float vTransparency;\n    uniform vec2 uTransparencyTexDim;\n    uniform sampler2D tTransparency;\n#endif\n",common_clip:"\n#if dClipObjectCount != 0\n    vec3 quaternionTransform(vec4 q, vec3 v) {\n        vec3 t = 2.0 * cross(q.xyz, v);\n        return v + q.w * t + cross(q.xyz, t);\n    }\n\n    vec4 computePlane(vec3 normal, vec3 inPoint) {\n        return vec4(normalize(normal), -dot(normal, inPoint));\n    }\n\n    float planeSD(vec4 plane, vec3 center) {\n        return -dot(plane.xyz, center - plane.xyz * -plane.w);\n    }\n\n    float sphereSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {\n        return (\n            length(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position) / size) - 1.0\n        ) * min(min(size.x, size.y), size.z);\n    }\n\n    float cubeSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {\n        vec3 d = abs(quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position)) - size;\n        return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, 0.0));\n    }\n\n    float cylinderSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {\n        vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n        vec2 d = abs(vec2(length(t.xz), t.y)) - size.xy;\n        return min(max(d.x, d.y), 0.0) + length(max(d, 0.0));\n    }\n\n    float infiniteConeSD(vec3 position, vec4 rotation, vec3 size, vec3 center) {\n        vec3 t = quaternionTransform(vec4(-rotation.x, -rotation.y, -rotation.z, rotation.w), center - position);\n\n        float q = length(t.xy);\n        return dot(size.xy, vec2(q, t.z));\n    }\n\n    float getSignedDistance(vec3 center, int type, vec3 position, vec4 rotation, vec3 scale) {\n        if (type == 1) {\n            vec3 normal = quaternionTransform(rotation, vec3(0.0, 1.0, 0.0));\n            vec4 plane = computePlane(normal, position);\n            return planeSD(plane, center);\n        } else if (type == 2) {\n            return sphereSD(position, rotation, scale * 0.5, center);\n        } else if (type == 3) {\n            return cubeSD(position, rotation, scale * 0.5, center);\n        } else if (type == 4) {\n            return cylinderSD(position, rotation, scale * 0.5, center);\n        } else if (type == 5) {\n            return infiniteConeSD(position, rotation, scale * 0.5, center);\n        } else {\n            return 0.1;\n        }\n    }\n\n    #if __VERSION__ == 100\n        // 8-bit\n        int bitwiseAnd(int a, int b) {\n            int d = 128;\n            int result = 0;\n            for (int i = 0; i < 8; ++i) {\n                if (d <= 0) break;\n                if (a >= d && b >= d) result += d;\n                if (a >= d) a -= d;\n                if (b >= d) b -= d;\n                d /= 2;\n            }\n            return result;\n        }\n\n        bool hasBit(int mask, int bit) {\n            return bitwiseAnd(mask, bit) == 0;\n        }\n    #else\n        bool hasBit(int mask, int bit) {\n            return (mask & bit) == 0;\n        }\n    #endif\n\n    // flag is a bit-flag for clip-objects to ignore (note, object ids start at 1 not 0)\n    bool clipTest(vec4 sphere, int flag) {\n        for (int i = 0; i < dClipObjectCount; ++i) {\n            if (flag == 0 || hasBit(flag, i + 1)) {\n                // TODO take sphere radius into account?\n                bool test = getSignedDistance(sphere.xyz, uClipObjectType[i], uClipObjectPosition[i], uClipObjectRotation[i], uClipObjectScale[i]) <= 0.0;\n                if ((!uClipObjectInvert[i] && test) || (uClipObjectInvert[i] && !test)) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n#endif\n",common_frag_params:"\nuniform int uObjectId;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\n#if dClipObjectCount != 0\n    uniform int uClipObjectType[dClipObjectCount];\n    uniform bool uClipObjectInvert[dClipObjectCount];\n    uniform vec3 uClipObjectPosition[dClipObjectCount];\n    uniform vec4 uClipObjectRotation[dClipObjectCount];\n    uniform vec3 uClipObjectScale[dClipObjectCount];\n\n    #if defined(dClipping)\n        #if __VERSION__ == 100\n            varying float vClipping;\n        #else\n            flat in float vClipping;\n        #endif\n    #endif\n#endif\n\nuniform vec3 uHighlightColor;\nuniform vec3 uSelectColor;\n#if __VERSION__ == 100\n    varying float vMarker;\n#else\n    flat in float vMarker;\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\nuniform vec2 uViewOffset;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\n\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\nbool interior;\n\nuniform float uXrayEdgeFalloff;\n\nuniform mat4 uProjection;\n",common_vert_params:"\nuniform mat4 uProjection, uModel, uView;\nuniform vec3 uCameraPosition;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\nuniform vec4 uInvariantBoundingSphere;\n\n#if dClipObjectCount != 0\n    uniform int uClipObjectType[dClipObjectCount];\n    uniform bool uClipObjectInvert[dClipObjectCount];\n    uniform vec3 uClipObjectPosition[dClipObjectCount];\n    uniform vec4 uClipObjectRotation[dClipObjectCount];\n    uniform vec3 uClipObjectScale[dClipObjectCount];\n\n    #if defined(dClipping)\n        uniform vec2 uClippingTexDim;\n        uniform sampler2D tClipping;\n        #if __VERSION__ == 100\n            varying float vClipping;\n        #else\n            flat out float vClipping;\n        #endif\n    #endif\n#endif\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n#if __VERSION__ == 100\n    varying float vMarker;\n#else\n    flat out float vMarker;\n#endif\n\nvarying vec3 vModelPosition;\nvarying vec3 vViewPosition;\n\n#if __VERSION__ == 100\n    attribute float aVertex;\n    #define VertexID int(aVertex)\n#else\n    // not using gl_VertexID but aVertex to ensure there is an active attribute with divisor 0\n    // since FF 85 this is not needed anymore but lets keep it for backwards compatibility\n    // https://bugzilla.mozilla.org/show_bug.cgi?id=1679693\n    // see also note in src/mol-gl/webgl/render-item.ts\n    attribute float aVertex;\n    #define VertexID int(aVertex)\n    // #define VertexID gl_VertexID\n#endif\n",common:"\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n    #define dRenderVariant_color\n#endif\n\n#if defined(dRenderVariant_pickObject) || defined(dRenderVariant_pickInstance) || defined(dRenderVariant_pickGroup)\n    #define dRenderVariant_pick\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n    #define dColorType_texture\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture)\n    #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nconst float maxFloat = 10000.0; // NOTE constant also set in TypeScript\nconst float floatLogFactor = 9.210440366976517; // log(maxFloat + 1.0);\nfloat encodeFloatLog(const in float value) { return log(value + 1.0) / floatLogFactor; }\nfloat decodeFloatLog(const in float value) { return exp(value * floatLogFactor) - 1.0; }\n\nvec3 encodeFloatRGB(in float value) {\n    value = clamp(value, 0.0, 16777216.0 - 1.0) + 1.0;\n    vec3 c = vec3(0.0);\n    c.b = mod(value, 256.0);\n    value = floor(value / 256.0);\n    c.g = mod(value, 256.0);\n    value = floor(value / 256.0);\n    c.r = mod(value, 256.0);\n    return c / 255.0;\n}\nfloat decodeFloatRGB(const in vec3 rgb) {\n    return (rgb.r * 256.0 * 256.0 * 255.0 + rgb.g * 256.0 * 255.0 + rgb.b * 255.0) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n    vec2 enc;\n    enc.xy = vec2(fract(v * 256.0), v);\n    enc.y -= enc.x * (1.0 / 256.0);\n    enc.xy *=  256.0 / 255.0;\n\n    return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n    return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n    vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n    p = invProjection * p;\n    return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0,  256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n    vec4 r = vec4(fract(v * PackFactors), v);\n    r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n    return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n    return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n    return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n    return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n    return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n    return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n    return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n    return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n    // transpose\n\n    float transpose(const in float m) {\n        return m;\n    }\n\n    mat2 transpose2(const in mat2 m) {\n        return mat2(\n            m[0][0], m[1][0],\n            m[0][1], m[1][1]\n        );\n    }\n\n    mat3 transpose3(const in mat3 m) {\n        return mat3(\n            m[0][0], m[1][0], m[2][0],\n            m[0][1], m[1][1], m[2][1],\n            m[0][2], m[1][2], m[2][2]\n        );\n    }\n\n    mat4 transpose4(const in mat4 m) {\n        return mat4(\n            m[0][0], m[1][0], m[2][0], m[3][0],\n            m[0][1], m[1][1], m[2][1], m[3][1],\n            m[0][2], m[1][2], m[2][2], m[3][2],\n            m[0][3], m[1][3], m[2][3], m[3][3]\n        );\n    }\n\n    // inverse\n\n    float inverse(const in float m) {\n        return 1.0 / m;\n    }\n\n    mat2 inverse2(const in mat2 m) {\n        return mat2(m[1][1],-m[0][1],\n                -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n    }\n\n    mat3 inverse3(const in mat3 m) {\n        float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n        float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n        float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n        float b01 = a22 * a11 - a12 * a21;\n        float b11 = -a22 * a10 + a12 * a20;\n        float b21 = a21 * a10 - a11 * a20;\n\n        float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n        return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n                    b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n                    b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n    }\n\n    mat4 inverse4(const in mat4 m) {\n        float\n            a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n            a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n            a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n            a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n            b00 = a00 * a11 - a01 * a10,\n            b01 = a00 * a12 - a02 * a10,\n            b02 = a00 * a13 - a03 * a10,\n            b03 = a01 * a12 - a02 * a11,\n            b04 = a01 * a13 - a03 * a11,\n            b05 = a02 * a13 - a03 * a12,\n            b06 = a20 * a31 - a21 * a30,\n            b07 = a20 * a32 - a22 * a30,\n            b08 = a20 * a33 - a23 * a30,\n            b09 = a21 * a32 - a22 * a31,\n            b10 = a21 * a33 - a23 * a31,\n            b11 = a22 * a33 - a23 * a32,\n\n            det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n        return mat4(\n            a11 * b11 - a12 * b10 + a13 * b09,\n            a02 * b10 - a01 * b11 - a03 * b09,\n            a31 * b05 - a32 * b04 + a33 * b03,\n            a22 * b04 - a21 * b05 - a23 * b03,\n            a12 * b08 - a10 * b11 - a13 * b07,\n            a00 * b11 - a02 * b08 + a03 * b07,\n            a32 * b02 - a30 * b05 - a33 * b01,\n            a20 * b05 - a22 * b02 + a23 * b01,\n            a10 * b10 - a11 * b08 + a13 * b06,\n            a01 * b08 - a00 * b10 - a03 * b06,\n            a30 * b04 - a31 * b02 + a33 * b00,\n            a21 * b02 - a20 * b04 - a23 * b00,\n            a11 * b07 - a10 * b09 - a12 * b06,\n            a00 * b09 - a01 * b07 + a02 * b06,\n            a31 * b01 - a30 * b03 - a32 * b00,\n            a20 * b03 - a21 * b01 + a22 * b00) / det;\n    }\n#else\n    #define transpose2(m) transpose(m)\n    #define transpose3(m) transpose(m)\n    #define transpose4(m) transpose(m)\n\n    #define inverse2(m) inverse(m)\n    #define inverse3(m) inverse(m)\n    #define inverse4(m) inverse(m)\n#endif\n",float_to_rgba:"\n    // floatToRgba adapted from https://github.com/equinor/glsl-float-to-rgba\n    // MIT License, Copyright (c) 2020 Equinor\n\n    float shiftRight (float v, float amt) {\n    v = floor(v) + 0.5;\n    return floor(v / exp2(amt));\n    }\n    float shiftLeft (float v, float amt) {\n        return floor(v * exp2(amt) + 0.5);\n    }\n    float maskLast (float v, float bits) {\n        return mod(v, shiftLeft(1.0, bits));\n    }\n    float extractBits (float num, float from, float to) {\n        from = floor(from + 0.5); to = floor(to + 0.5);\n        return maskLast(shiftRight(num, from), to - from);\n    }\n\n    vec4 floatToRgba(float texelFloat, bool littleEndian) {\n        if (texelFloat == 0.0) return vec4(0.0, 0.0, 0.0, 0.0);\n        float sign = texelFloat > 0.0 ? 0.0 : 1.0;\n        texelFloat = abs(texelFloat);\n        float exponent = floor(log2(texelFloat));\n        float biased_exponent = exponent + 127.0;\n        float fraction = ((texelFloat / exp2(exponent)) - 1.0) * 8388608.0;\n        float t = biased_exponent / 2.0;\n        float last_bit_of_biased_exponent = fract(t) * 2.0;\n        float remaining_bits_of_biased_exponent = floor(t);\n        float byte4 = extractBits(fraction, 0.0, 8.0) / 255.0;\n        float byte3 = extractBits(fraction, 8.0, 16.0) / 255.0;\n        float byte2 = (last_bit_of_biased_exponent * 128.0 + extractBits(fraction, 16.0, 23.0)) / 255.0;\n        float byte1 = (sign * 128.0 + remaining_bits_of_biased_exponent) / 255.0;\n        return (\n            littleEndian\n                ? vec4(byte4, byte3, byte2, byte1)\n                : vec4(byte1, byte2, byte3, byte4)\n        );\n    }\n",light_frag_params:"\nuniform float uLightIntensity;\nuniform float uAmbientIntensity;\nuniform float uReflectivity;\nuniform float uMetalness;\nuniform float uRoughness;\n\nstruct PhysicalMaterial {\n    vec3 diffuseColor;\n    float specularRoughness;\n    vec3 specularColor;\n};\n\nstruct IncidentLight {\n    vec3 color;\n    vec3 direction;\n};\n\nstruct ReflectedLight {\n    vec3 directDiffuse;\n    vec3 directSpecular;\n    vec3 indirectDiffuse;\n};\n\nstruct GeometricContext {\n    vec3 position;\n    vec3 normal;\n    vec3 viewDir;\n};\n\nvec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {\n    // Original approximation by Christophe Schlick '94\n    // float fresnel = pow( 1.0 - dotLH, 5.0 );\n    // Optimized variant (presented by Epic at SIGGRAPH '13)\n    // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n    float fresnel = exp2((-5.55473 * dotLH - 6.98316) * dotLH);\n    return (1.0 - specularColor) * fresnel + specularColor;\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n    float a2 = pow2(alpha);\n    // dotNL and dotNV are explicitly swapped. This is not a mistake.\n    float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n    float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n    return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney’s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n    float a2 = pow2(alpha);\n    float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n    return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\nvec3 BRDF_Diffuse_Lambert(const in vec3 diffuseColor) {\n    return RECIPROCAL_PI * diffuseColor;\n}\n\n// GGX Distribution, Schlick Fresnel, GGX-Smith Visibility\nvec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in GeometricContext geometry, const in vec3 specularColor, const in float roughness) {\n    float alpha = pow2(roughness); // UE4's roughness\n    vec3 halfDir = normalize(incidentLight.direction + geometry.viewDir);\n\n    float dotNL = saturate(dot(geometry.normal, incidentLight.direction));\n    float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n    float dotNH = saturate(dot(geometry.normal, halfDir));\n    float dotLH = saturate(dot(incidentLight.direction, halfDir));\n\n    vec3 F = F_Schlick(specularColor, dotLH);\n    float G = G_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n    float D = D_GGX(alpha, dotNH);\n    return F * (G * D);\n}\n\n// ref: https://www.unrealengine.com/blog/physically-based-shading-on-mobile - environmentBRDF for GGX on mobile\nvec3 BRDF_Specular_GGX_Environment(const in GeometricContext geometry, const in vec3 specularColor, const in float roughness) {\n    float dotNV = saturate(dot(geometry.normal, geometry.viewDir));\n    const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n    const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n    vec4 r = roughness * c0 + c1;\n    float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n    vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;\n    return specularColor * AB.x + AB.y;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n    float dotNL = saturate(dot(geometry.normal, directLight.direction));\n    vec3 irradiance = dotNL * directLight.color;\n    irradiance *= PI; // punctual light\n\n    reflectedLight.directSpecular += irradiance * BRDF_Specular_GGX(directLight, geometry, material.specularColor, material.specularRoughness);\n    reflectedLight.directDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n    reflectedLight.indirectDiffuse += irradiance * BRDF_Diffuse_Lambert(material.diffuseColor);\n}\n",matrix_scale:"\nfloat matrixScale(in mat4 m){\n    vec4 r = m[0];\n    return sqrt(r[0] * r[0] + r[1] * r[1] + r[2] * r[2]);\n}\n",normal_frag_params:"\nvarying vec3 vNormal;\n",read_from_texture:"\nvec4 readFromTexture(const in sampler2D tex, const in float i, const in vec2 dim) {\n    float x = intMod(i, dim.x);\n    float y = floor(intDiv(i, dim.x));\n    vec2 uv = (vec2(x, y) + 0.5) / dim;\n    return texture2D(tex, uv);\n}\n\nvec4 readFromTexture(const in sampler2D tex, const in int i, const in vec2 dim) {\n    int x = imod(i, int(dim.x));\n    int y = i / int(dim.x);\n    vec2 uv = (vec2(x, y) + 0.5) / dim;\n    return texture2D(tex, uv);\n}\n",rgba_to_float:'\n    // rgbaToFloat adapted from https://github.com/ihmeuw/glsl-rgba-to-float\n    // BSD 3-Clause License\n    //\n    // Copyright (c) 2019, Institute for Health Metrics and Evaluation All rights reserved.\n    // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n    //  - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n    //  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n    //  - Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n    //\n    // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,\n    // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\n    // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,\n    // OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,\n    // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n    // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n    // OF THE POSSIBILITY OF SUCH DAMAGE.\n\n    ivec4 floatsToBytes(vec4 inputFloats, bool littleEndian) {\n        ivec4 bytes = ivec4(inputFloats * 255.0);\n        return (\n            littleEndian\n                ? bytes.abgr\n                : bytes\n        );\n    }\n\n    // Break the four bytes down into an array of 32 bits.\n    void bytesToBits(const in ivec4 bytes, out bool bits[32]) {\n        for (int channelIndex = 0; channelIndex < 4; ++channelIndex) {\n            float acc = float(bytes[channelIndex]);\n            for (int indexInByte = 7; indexInByte >= 0; --indexInByte) {\n                float powerOfTwo = exp2(float(indexInByte));\n                bool bit = acc >= powerOfTwo;\n                bits[channelIndex * 8 + (7 - indexInByte)] = bit;\n                acc = mod(acc, powerOfTwo);\n            }\n        }\n    }\n\n    // Compute the exponent of the 32-bit float.\n    float getExponent(bool bits[32]) {\n        const int startIndex = 1;\n        const int bitStringLength = 8;\n        const int endBeforeIndex = startIndex + bitStringLength;\n        float acc = 0.0;\n        int pow2 = bitStringLength - 1;\n        for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n            acc += float(bits[bitIndex]) * exp2(float(pow2--));\n        }\n        return acc;\n    }\n\n    // Compute the mantissa of the 32-bit float.\n    float getMantissa(bool bits[32], bool subnormal) {\n        const int startIndex = 9;\n        const int bitStringLength = 23;\n        const int endBeforeIndex = startIndex + bitStringLength;\n        // Leading/implicit/hidden bit convention:\n        // If the number is not subnormal (with exponent 0), we add a leading 1 digit.\n        float acc = float(!subnormal) * exp2(float(bitStringLength));\n        int pow2 = bitStringLength - 1;\n        for (int bitIndex = startIndex; bitIndex < endBeforeIndex; ++bitIndex) {\n            acc += float(bits[bitIndex]) * exp2(float(pow2--));\n        }\n        return acc;\n    }\n\n    // Parse the float from its 32 bits.\n    float bitsToFloat(bool bits[32]) {\n        float signBit = float(bits[0]) * -2.0 + 1.0;\n        float exponent = getExponent(bits);\n        bool subnormal = abs(exponent - 0.0) < 0.01;\n        float mantissa = getMantissa(bits, subnormal);\n        float exponentBias = 127.0;\n        return signBit * mantissa * exp2(exponent - exponentBias - 23.0);\n    }\n\n    float rgbaToFloat(vec4 texelRGBA, bool littleEndian) {\n        ivec4 rgbaBytes = floatsToBytes(texelRGBA, littleEndian);\n        bool bits[32];\n        bytesToBits(rgbaBytes, bits);\n        return bitsToFloat(bits);\n    }\n',size_vert_params:"\n#if defined(dSizeType_uniform)\n    uniform float uSize;\n#elif defined(dSizeType_attribute)\n    attribute float aSize;\n#elif defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n    uniform vec2 uSizeTexDim;\n    uniform sampler2D tSize;\n#endif\n\nuniform float uSizeFactor;\n",texture3d_from_1d_trilinear:"\nvec4 texture3dFrom1dTrilinear(const in sampler2D tex, const in vec3 pos, const in vec3 gridDim, const in vec2 texDim, const in float offset) {\n    float gdYZ = gridDim.z * gridDim.y;\n    float gdZ = gridDim.z;\n    vec3 p0 = floor(pos * gridDim);\n    vec3 p1 = ceil(pos * gridDim);\n    vec3 pd = (pos * gridDim - p0) / (p1 - p0);\n    vec4 s000 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s100 = readFromTexture(tex, offset + p0.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s001 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s101 = readFromTexture(tex, offset + p1.z + p0.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s010 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s110 = readFromTexture(tex, offset + p0.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s011 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p0.x * gdYZ, texDim);\n    vec4 s111 = readFromTexture(tex, offset + p1.z + p1.y * gdZ + p1.x * gdYZ, texDim);\n    vec4 s00 = mix(s000, s100, pd.x);\n    vec4 s01 = mix(s001, s101, pd.x);\n    vec4 s10 = mix(s010, s110, pd.x);\n    vec4 s11 = mix(s011, s111, pd.x);\n    vec4 s0 = mix(s00, s10, pd.y);\n    vec4 s1 = mix(s01, s11, pd.y);\n    return mix(s0, s1, pd.z);\n}\n",texture3d_from_2d_linear:"\nvec4 texture3dFrom2dLinear(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice0 = floor(pos.z * gridDim.z);\n    float column0 = intMod(zSlice0 * gridDim.x, texDim.x) / gridDim.x;\n    float row0 = floor(intDiv(zSlice0 * gridDim.x, texDim.x));\n    vec2 coord0 = (vec2(column0 * gridDim.x, row0 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n    vec4 color0 = texture2D(tex, coord0);\n\n    float zSlice1 = zSlice0 + 1.0;\n    float column1 = intMod(zSlice1 * gridDim.x, texDim.x) / gridDim.x;\n    float row1 = floor(intDiv(zSlice1 * gridDim.x, texDim.x));\n    vec2 coord1 = (vec2(column1 * gridDim.x, row1 * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n    vec4 color1 = texture2D(tex, coord1);\n\n    float delta0 = abs((pos.z * gridDim.z) - zSlice0);\n    return mix(color0, color1, delta0);\n}\n",texture3d_from_2d_nearest:"\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n    float column = intMod(zSlice * gridDim.x, texDim.x) / gridDim.x;\n    float row = floor(intDiv(zSlice * gridDim.x, texDim.x));\n    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / texDim;\n    return texture2D(tex, coord);\n}\n",wboit_params:"\n#if defined(dRenderVariant_colorWboit)\n    #if !defined(dRenderMode_volume) && !defined(dRenderMode_isosurface)\n        uniform sampler2D tDepth;\n        uniform vec2 uDrawingBufferSize;\n\n        float getDepth(const in vec2 coords) {\n            // always packed due to merged depth from primitives and volumes\n            return unpackRGBAToDepth(texture2D(tDepth, coords));\n        }\n    #endif\n#endif\n\nuniform bool uRenderWboit;\n\nfloat calcDepth(const in vec3 pos) {\n    vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n    return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n",wboit_write:"\n#if defined(dRenderVariant_colorWboit)\n    if (!uRenderWboit) {\n        if (preFogAlpha < 1.0) {\n            discard;\n        }\n    } else if (uRenderWboit) {\n        // the 'fragmentDepth > 0.99' check is to handle precision issues with packed depth\n        if (preFogAlpha != 1.0 && !interior && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {\n            float alpha = gl_FragColor.a;\n            float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n            gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n            // extra alpha is to handle pre-multiplied alpha\n            #if !defined(dRenderMode_volume) && !defined(dRenderMode_isosurface)\n                gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);\n            #else\n                gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n            #endif\n        } else {\n            discard;\n        }\n    }\n#endif\n"},s=/^(?!\/\/)\s*#include\s+(\S+)/gim,u=/[ \t]*\/\/.*\n/g,c=/[ \t]*\/\*[\s\S]*?\*\//g,l=/\n{2,}/g;function d(e){return e.replace(s,(function(e,t){var r=o[t];if(!r)throw new Error("empty chunk, '"+t+"'");return r})).trim().replace(u,"\n").replace(c,"\n").replace(l,"\n")}function f(e,t,r,n,i){return void 0===n&&(n={}),void 0===i&&(i={}),{id:a(),name:e,vert:d(t),frag:d(r),extensions:n,outTypes:i}}var p=f("points","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform float uPixelRatio;\nuniform float uViewportHeight;\n\nattribute vec3 aPosition;\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nvoid main(){\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_position\n    #include assign_size\n\n    #ifdef dPointSizeAttenuation\n        gl_PointSize = size * uPixelRatio * ((uViewportHeight / 2.0) / -mvPosition.z) * 5.0;\n    #else\n        gl_PointSize = size * uPixelRatio;\n    #endif\n\n    gl_Position = uProjection * mvPosition;\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n#include wboit_params\n\n#ifdef dPointFilledCircle\n    uniform float uPointEdgeBleach;\n#endif\n\nconst vec2 center = vec2(0.5);\nconst float radius = 0.5;\n\nvoid main(){\n    #include clip_pixel\n\n    float fragmentDepth = gl_FragCoord.z;\n    bool interior = false;\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        gl_FragColor = material;\n\n        #ifdef dPointFilledCircle\n            float dist = distance(gl_PointCoord, center);\n            float alpha = 1.0 - smoothstep(radius - uPointEdgeBleach, radius, dist);\n            if (alpha < 0.0001) discard;\n            gl_FragColor.a *= alpha;\n        #endif\n\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n    #endif\n}\n",{drawBuffers:"optional"}),m=f("spheres",'\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\nuniform mat4 uInvProjection;\n\nattribute vec3 aPosition;\nattribute vec2 aMapping;\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\n#include matrix_scale\n\nconst mat4 D = mat4(\n    1.0, 0.0, 0.0, 0.0,\n    0.0, 1.0, 0.0, 0.0,\n    0.0, 0.0, 1.0, 0.0,\n    0.0, 0.0, 0.0, -1.0\n);\n\n/**\n * Compute point size and center using the technique described in:\n * "GPU-Based Ray-Casting of Quadratic Surfaces" http://dl.acm.org/citation.cfm?id=2386396\n * by Christian Sigg, Tim Weyrich, Mario Botsch, Markus Gross.\n */\nvoid quadraticProjection(const in float radius, const in vec3 position){\n    vec2 xbc, ybc;\n\n    mat4 T = mat4(\n        radius, 0.0, 0.0, 0.0,\n        0.0, radius, 0.0, 0.0,\n        0.0, 0.0, radius, 0.0,\n        position.x, position.y, position.z, 1.0\n    );\n\n    mat4 R = transpose4(uProjection * uModelView * aTransform * T);\n    float A = dot(R[3], D * R[3]);\n    float B = -2.0 * dot(R[0], D * R[3]);\n    float C = dot(R[0], D * R[0]);\n    xbc[0] = (-B - sqrt(B * B - 4.0 * A * C)) / (2.0 * A);\n    xbc[1] = (-B + sqrt(B * B - 4.0 * A * C)) / (2.0 * A);\n    float sx = abs(xbc[0] - xbc[1]) * 0.5;\n\n    A = dot(R[3], D * R[3]);\n    B = -2.0 * dot(R[1], D * R[3]);\n    C = dot(R[1], D * R[1]);\n    ybc[0] = (-B - sqrt(B * B - 4.0 * A * C)) / (2.0 * A);\n    ybc[1] = (-B + sqrt(B * B - 4.0 * A * C)) / (2.0 * A);\n    float sy = abs(ybc[0] - ybc[1]) * 0.5;\n\n    gl_Position.xy = vec2(0.5 * (xbc.x + xbc.y), 0.5 * (ybc.x + ybc.y));\n    gl_Position.xy -= aMapping * vec2(sx, sy);\n    gl_Position.xy *= gl_Position.w;\n}\n\n\nvoid main(void){\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    vRadius = size * matrixScale(uModelView);\n\n    vec4 position4 = vec4(aPosition, 1.0);\n    vec4 mvPosition = uModelView * aTransform * position4;\n    mvPosition.z -= vRadius; // avoid clipping, added again in fragment shader\n\n    gl_Position = uProjection * vec4(mvPosition.xyz, 1.0);\n    quadraticProjection(size, aPosition);\n\n    vRadiusSq = vRadius * vRadius;\n    vec4 vPoint4 = uInvProjection * gl_Position;\n    vPoint = vPoint4.xyz / vPoint4.w;\n    vPointViewPosition = -mvPosition.xyz / mvPosition.w;\n\n    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n    #include clip_instance\n}\n',"\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n#include wboit_params\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n    vec3 cameraSpherePos = -vPointViewPosition;\n    cameraSpherePos.z += vRadius;\n\n    vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n    vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n    vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n    float B = dot(rayDirection, cameraSphereDir);\n    float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n    if (det < 0.0){\n        discard;\n        return false;\n    }\n\n    float sqrtDet = sqrt(det);\n    float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n    float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n    cameraPos = rayDirection * negT + rayOrigin;\n\n\n    if (calcDepth(cameraPos) <= 0.0) {\n        cameraPos = rayDirection * posT + rayOrigin;\n        interior = true;\n    } else {\n        interior = false;\n    }\n\n    cameraNormal = normalize(cameraPos - cameraSpherePos);\n    cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n    return !interior;\n}\n\nvoid main(void){\n    #include clip_pixel\n\n    bool flag = Impostor(cameraPos, cameraNormal);\n    #ifndef dDoubleSided\n        if (interior)\n            discard;\n    #endif\n\n    vec3 vViewPosition = cameraPos;\n    gl_FragDepthEXT = calcDepth(vViewPosition);\n    if (!flag && gl_FragDepthEXT >= 0.0) {\n        gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);\n    }\n\n    // bugfix (mac only?)\n    if (gl_FragDepthEXT < 0.0) discard;\n    if (gl_FragDepthEXT > 1.0) discard;\n\n    float fragmentDepth = gl_FragDepthEXT;\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        #ifdef dIgnoreLight\n            gl_FragColor = material;\n        #else\n            vec3 normal = -cameraNormal;\n            #include apply_light_color\n        #endif\n\n        #include apply_interior_color\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n    #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"}),h=f("cylinders","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec3 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\nattribute float aScale;\nattribute float aCap;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform float uIsOrtho;\nuniform vec3 uCameraDir;\n\nvoid main() {\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    mat4 modelTransform = uModel * aTransform;\n\n    vTransform = aTransform;\n    vStart = (modelTransform * vec4(aStart, 1.0)).xyz;\n    vEnd = (modelTransform * vec4(aEnd, 1.0)).xyz;\n    vSize = size * aScale;\n    vCap = aCap;\n\n    vModelPosition = (vStart + vEnd) * 0.5;\n    vec3 camDir = -mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n    vec3 dir = vEnd - vStart;\n    // ensure cylinder 'dir' is pointing towards the camera\n    if(dot(camDir, dir) < 0.0) dir = -dir;\n\n    vec3 left = cross(camDir, dir);\n    vec3 up = cross(left, dir);\n    left = vSize * normalize(left);\n    up = vSize * normalize(up);\n\n    // move vertex in object-space from center to corner\n    vModelPosition += aMapping.x * dir + aMapping.y * left + aMapping.z * up;\n\n    vec4 mvPosition = uView * vec4(vModelPosition, 1.0);\n    vViewPosition = mvPosition.xyz;\n    gl_Position = uProjection * mvPosition;\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n#include wboit_params\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n    in vec3 rayOrigin, in vec3 rayDir,\n    in vec3 start, in vec3 end, in float radius,\n    out vec4 intersection, out bool interior\n){\n    vec3 ba = end - start;\n    vec3 oc = rayOrigin - start;\n\n    float baba = dot(ba, ba);\n    float bard = dot(ba, rayDir);\n    float baoc = dot(ba, oc);\n\n    float k2 = baba - bard*bard;\n    float k1 = baba * dot(oc, rayDir) - baoc * bard;\n    float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n    float h = k1 * k1 - k2 * k0;\n    if (h < 0.0) return false;\n\n    bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n    bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n    // body outside\n    h = sqrt(h);\n    float t = (-k1 - h) / k2;\n    float y = baoc + t * bard;\n    if (y > 0.0 && y < baba) {\n        interior = false;\n        intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n        return true;\n    }\n\n    if (topCap && y < 0.0) {\n        // top cap\n        t = -baoc / bard;\n        if (abs(k1 + k2 * t) < h) {\n            interior = false;\n            intersection = vec4(t, ba * sign(y) / baba);\n            return true;\n        }\n    } else if(bottomCap && y >= 0.0) {\n        // bottom cap\n        t = (baba - baoc) / bard;\n        if (abs(k1 + k2 * t) < h) {\n            interior = false;\n            intersection = vec4(t, ba * sign(y) / baba);\n            return true;\n        }\n    }\n\n    #ifdef dDoubleSided\n        // body inside\n        h = -h;\n        t = (-k1 - h) / k2;\n        y = baoc + t * bard;\n        if (y > 0.0 && y < baba) {\n            interior = true;\n            intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n            return true;\n        }\n\n        // TODO: handle inside caps???\n    #endif\n\n    return false;\n}\n\nvoid main() {\n    #include clip_pixel\n\n    vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n    vec4 intersection;\n    bool interior;\n    bool hit = CylinderImpostor(vModelPosition, rayDir, vStart, vEnd, vSize, intersection, interior);\n    if (!hit) discard;\n\n    vec3 vViewPosition = vModelPosition + intersection.x * rayDir;\n    vViewPosition = (uView * vec4(vViewPosition, 1.0)).xyz;\n    gl_FragDepthEXT = calcDepth(vViewPosition);\n\n    // bugfix (mac only?)\n    if (gl_FragDepthEXT < 0.0) discard;\n    if (gl_FragDepthEXT > 1.0) discard;\n\n    float fragmentDepth = gl_FragDepthEXT;\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        #ifdef dIgnoreLight\n            gl_FragColor = material;\n        #else\n            mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n            vec3 normal = normalize(normalMatrix * -normalize(intersection.yzw));\n            #include apply_light_color\n        #endif\n\n        #include apply_interior_color\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n    #endif\n}\n",{fragDepth:"required",drawBuffers:"optional"}),g=f("text","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform mat4 uModelView;\n\nattribute vec3 aPosition;\nattribute vec2 aMapping;\nattribute float aDepth;\nattribute vec2 aTexCoord;\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nuniform float uOffsetX;\nuniform float uOffsetY;\nuniform float uOffsetZ;\n\n// uniform bool ortho;\nuniform float uPixelRatio;\nuniform float uViewportHeight;\n\nvarying vec2 vTexCoord;\n\n#include matrix_scale\n\nvoid main(void){\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    vTexCoord = aTexCoord;\n\n    float scale = matrixScale(uModelView);\n\n    float offsetX = uOffsetX * scale;\n    float offsetY = uOffsetY * scale;\n    float offsetZ = (uOffsetZ + aDepth * 0.95) * scale;\n\n    vec4 position4 = vec4(aPosition, 1.0);\n    vec4 mvPosition = uModelView * aTransform * position4;\n\n    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n    // TODO\n    // #ifdef FIXED_SIZE\n    //     if (ortho) {\n    //         scale /= pixelRatio * ((uViewportHeight / 2.0) / -uCameraPosition.z) * 0.1;\n    //     } else {\n    //         scale /= pixelRatio * ((uViewportHeight / 2.0) / -mvPosition.z) * 0.1;\n    //     }\n    // #endif\n\n    vec4 mvCorner = vec4(mvPosition.xyz, 1.0);\n\n    if (vTexCoord.x == 10.0) { // indicates background plane\n        // move a bit to the back, taking distance to camera into account to avoid z-fighting\n        offsetZ -= 0.001 * distance(uCameraPosition, (uProjection * mvCorner).xyz);\n    }\n\n    mvCorner.xy += aMapping * size * scale;\n    mvCorner.x += offsetX;\n    mvCorner.y += offsetY;\n\n    // TODO\n    // if(ortho){\n    //     mvCorner.xyz += normalize(-uCameraPosition) * offsetZ;\n    // } else {\n    //     mvCorner.xyz += normalize(-mvCorner.xyz) * offsetZ;\n    // }\n    mvCorner.xyz += normalize(-mvCorner.xyz) * offsetZ;\n\n    gl_Position = uProjection * mvCorner;\n\n    vViewPosition = -mvCorner.xyz;\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n#include wboit_params\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n    gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n    #include clip_pixel\n\n    float fragmentDepth = gl_FragCoord.z;\n    bool interior = false;\n    #include assign_material_color\n\n    if (vTexCoord.x > 1.0) {\n        gl_FragColor = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n    } else {\n        // retrieve signed distance\n        float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n        // perform adaptive anti-aliasing of the edges\n        float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n        float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n        // gamma correction for linear attenuation\n        a = pow(a, 1.0 / gamma);\n\n        if (a < 0.5) discard;\n        material.a *= a;\n\n        // add border\n        float t = 0.5 + uBorderWidth;\n        if (uBorderWidth > 0.0 && sdf < t) {\n            material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n        }\n\n        gl_FragColor = material;\n    }\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n    #endif\n}\n",{standardDerivatives:"required",drawBuffers:"optional"}),v=f("lines","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include size_vert_params\n#include common_clip\n\nuniform float uPixelRatio;\nuniform float uViewportHeight;\n\nattribute mat4 aTransform;\nattribute float aInstance;\nattribute float aGroup;\n\nattribute vec2 aMapping;\nattribute vec3 aStart;\nattribute vec3 aEnd;\n\nvoid trimSegment(const in vec4 start, inout vec4 end) {\n    // trim end segment so it terminates between the camera plane and the near plane\n    // conservative estimate of the near plane\n    float a = uProjection[2][2];  // 3rd entry in 3rd column\n    float b = uProjection[3][2];  // 3rd entry in 4th column\n    float nearEstimate = -0.5 * b / a;\n    float alpha = (nearEstimate - start.z) / (end.z - start.z);\n    end.xyz = mix(start.xyz, end.xyz, alpha);\n}\n\nvoid main(){\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_size\n\n    mat4 modelView = uView * uModel * aTransform;\n\n    // camera space\n    vec4 start = modelView * vec4(aStart, 1.0);\n    vec4 end = modelView * vec4(aEnd, 1.0);\n\n    // assign position\n    vec4 position4 = vec4((aMapping.y < 0.5) ? aStart : aEnd, 1.0);\n    vec4 mvPosition = modelView * position4;\n    vViewPosition = mvPosition.xyz;\n\n    vModelPosition = (uModel * aTransform * position4).xyz; // for clipping in frag shader\n\n    // special case for perspective projection, and segments that terminate either in, or behind, the camera plane\n    // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space\n    // but we need to perform ndc-space calculations in the shader, so we must address this issue directly\n    // perhaps there is a more elegant solution -- WestLangley\n    bool perspective = (uProjection[2][3] == -1.0); // 4th entry in the 3rd column\n    if (perspective) {\n        if (start.z < 0.0 && end.z >= 0.0) {\n            trimSegment(start, end);\n        } else if (end.z < 0.0 && start.z >= 0.0) {\n            trimSegment(end, start);\n        }\n    }\n\n    // clip space\n    vec4 clipStart = uProjection * start;\n    vec4 clipEnd = uProjection * end;\n\n    // ndc space\n    vec2 ndcStart = clipStart.xy / clipStart.w;\n    vec2 ndcEnd = clipEnd.xy / clipEnd.w;\n\n    // direction\n    vec2 dir = ndcEnd - ndcStart;\n\n    // account for clip-space aspect ratio\n    dir.x *= uPixelRatio;\n    dir = normalize(dir);\n\n    // perpendicular to dir\n    vec2 offset = vec2(dir.y, - dir.x);\n\n    // undo aspect ratio adjustment\n    dir.x /= uPixelRatio;\n    offset.x /= uPixelRatio;\n\n    // sign flip\n    if (aMapping.x < 0.0) offset *= -1.0;\n\n    // calculate linewidth\n    float linewidth;\n    #ifdef dLineSizeAttenuation\n        linewidth = size * uPixelRatio * ((uViewportHeight / 2.0) / -start.z) * 5.0;\n    #else\n        linewidth = size * uPixelRatio;\n    #endif\n\n    // adjust for linewidth\n    offset *= linewidth;\n\n    // adjust for clip-space to screen-space conversion\n    offset /= uViewportHeight;\n\n    // select end\n    vec4 clip = (aMapping.y < 0.5) ? clipStart : clipEnd;\n\n    // back to clip space\n    offset *= clip.w;\n    clip.xy += offset;\n    gl_Position = clip;\n\n    #include clip_instance\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n#include wboit_params\n\nvoid main(){\n    #include clip_pixel\n\n    bool interior = false;\n    float fragmentDepth = gl_FragCoord.z;\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        gl_FragColor = material;\n\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n    #endif\n}\n",{drawBuffers:"optional"}),b=f("mesh","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n#include read_from_texture\n#include common_vert_params\n#include color_vert_params\n#include common_clip\n\n#ifdef dGeoTexture\n    uniform vec2 uGeoTexDim;\n    uniform sampler2D tPosition;\n    uniform sampler2D tGroup;\n    uniform sampler2D tNormal;\n#else\n    attribute vec3 aPosition;\n    attribute float aGroup;\n    attribute vec3 aNormal;\n#endif\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec3 vNormal;\n\nvoid main(){\n    #include assign_group\n    #include assign_color_varying\n    #include assign_marker_varying\n    #include assign_clipping_varying\n    #include assign_position\n    #include clip_instance\n\n    #ifdef dGeoTexture\n        vec3 normal = readFromTexture(tNormal, VertexID, uGeoTexDim).xyz;\n    #else\n        vec3 normal = aNormal;\n    #endif\n    mat3 normalMatrix = transpose3(inverse3(mat3(modelView)));\n    vec3 transformedNormal = normalize(normalMatrix * normalize(normal));\n    #if defined(dFlipSided) && !defined(dDoubleSided) // TODO checking dDoubleSided should not be required, ASR\n        transformedNormal = -transformedNormal;\n    #endif\n    vNormal = transformedNormal;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n#include wboit_params\n\nvoid main() {\n    #include clip_pixel\n\n    // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n    #if defined(enabledStandardDerivatives)\n        vec3 fdx = dFdx(vViewPosition);\n        vec3 fdy = dFdy(vViewPosition);\n        vec3 faceNormal = normalize(cross(fdx,fdy));\n        bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n    #else\n        bool frontFacing = dot(vNormal, vViewPosition) < 0.0;\n    #endif\n\n    #if defined(dFlipSided)\n        interior = frontFacing;\n    #else\n        interior = !frontFacing;\n    #endif\n\n    float fragmentDepth = gl_FragCoord.z;\n    #include assign_material_color\n\n    #if defined(dRenderVariant_pick)\n        #include check_picking_alpha\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_depth)\n        gl_FragColor = material;\n    #elif defined(dRenderVariant_color)\n        #ifdef dIgnoreLight\n            gl_FragColor = material;\n        #else\n            #if defined(dFlatShaded) && defined(enabledStandardDerivatives)\n                vec3 normal = -faceNormal;\n            #else\n                vec3 normal = -normalize(vNormal);\n                #ifdef dDoubleSided\n                    normal = normal * (float(frontFacing) * 2.0 - 1.0);\n                #endif\n            #endif\n            #include apply_light_color\n        #endif\n\n        #include apply_interior_color\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n    #endif\n}\n",{standardDerivatives:"optional",drawBuffers:"optional"}),y=f("direct-volume","\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform mat4 uModelView;\nuniform mat4 uProjection;\nuniform vec4 uInvariantBoundingSphere;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform vec3 uBboxMax;\nuniform vec3 uGridDim;\nuniform mat4 uTransform;\n\nuniform mat4 uUnitToCartn;\n\nvoid main() {\n    vec4 unitCoord = vec4(aPosition + vec3(0.5), 1.0);\n    vec4 mvPosition = uModelView * aTransform * uUnitToCartn * unitCoord;\n\n    vOrigPos = (aTransform * uUnitToCartn * unitCoord).xyz;\n    vInstance = aInstance;\n    vBoundingSphere = vec4(\n        (aTransform * vec4(uInvariantBoundingSphere.xyz, 1.0)).xyz,\n        uInvariantBoundingSphere.w\n    );\n    vTransform = aTransform;\n\n    gl_Position = uProjection * mvPosition;\n\n    // move z position to near clip plane (but not too close to get precision issues)\n    gl_Position.z = gl_Position.w - 0.01;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n    uniform int uClipObjectType[dClipObjectCount];\n    uniform bool uClipObjectInvert[dClipObjectCount];\n    uniform vec3 uClipObjectPosition[dClipObjectCount];\n    uniform vec4 uClipObjectRotation[dClipObjectCount];\n    uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec2 uIsoValue;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform vec3 uHighlightColor;\nuniform vec3 uSelectColor;\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\n\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\nbool interior;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n    // for webgl1 this is given as a 'define'\n    uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n    precision highp sampler2D;\n    uniform sampler2D tGridTex;\n    uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n    precision highp sampler3D;\n    uniform sampler3D tGridTex;\n#endif\n\n#if defined(dRenderVariant_color)\n    #if defined(dColorType_uniform)\n        uniform vec3 uColor;\n    #elif defined(dColorType_texture)\n        uniform vec2 uColorTexDim;\n        uniform sampler2D tColor;\n    #endif\n\n    #ifdef dOverpaint\n        varying vec4 vOverpaint;\n        uniform vec2 uOverpaintTexDim;\n        uniform sampler2D tOverpaint;\n    #endif\n#endif\n\n#if defined(dGridTexType_2d)\n    vec4 textureVal(vec3 pos) {\n        return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n    }\n    vec4 textureGroup(vec3 pos) {\n        return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n    }\n#elif defined(dGridTexType_3d)\n    vec4 textureVal(vec3 pos) {\n        return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n    }\n    vec4 textureGroup(vec3 pos) {\n        return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n    }\n#endif\n\n#include wboit_params\n\nvec4 transferFunction(float value) {\n    return texture2D(tTransferTex, vec2(value, 0.0));\n}\n\nfloat getDepth(const in vec2 coords) {\n    #ifdef depthTextureSupport\n        if (!uRenderWboit) {\n            // in case of opaque volumes (and depth texture support)\n            return texture2D(tDepth, coords).r;\n        } else {\n            return unpackRGBAToDepth(texture2D(tDepth, coords));\n        }\n    #else\n        return unpackRGBAToDepth(texture2D(tDepth, coords));\n    #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n    return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n    #if defined(dRenderVariant_color) && !defined(dIgnoreLight)\n        mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n    #endif\n    mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n    #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n        mat4 modelTransform = uModel * vTransform * uTransform;\n    #endif\n    mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n    vec3 scaleVol = vec3(1.0) / uGridDim;\n    vec3 pos = startLoc;\n    vec4 cell;\n    float prevValue = -1.0;\n    float value = 0.0;\n    vec4 src = vec4(0.0);\n    vec4 dst = vec4(0.0);\n    bool hit = false;\n    float fragmentDepth;\n\n    vec3 posMin = vec3(0.0);\n    vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n    vec3 unitPos;\n    vec3 isoPos;\n\n    vec3 nextPos;\n    float nextValue;\n\n    vec3 color = vec3(0.45, 0.55, 0.8);\n    vec3 gradient = vec3(1.0);\n    vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n    vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n    vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n    float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n    float maxDistSq = maxDist * maxDist;\n\n    for (int i = 0; i < uMaxSteps; ++i) {\n        // break when beyond bounding-sphere or far-plane\n        vec3 distVec = startLoc - pos;\n        if (dot(distVec, distVec) > maxDistSq) break;\n\n        unitPos = v3m4(pos, cartnToUnit);\n\n        // continue when outside of grid\n        if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n            unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n        ) {\n            if (hit) break;\n            prevValue = value;\n            pos += step;\n            continue;\n        }\n\n        cell = textureVal(unitPos);\n        value = cell.a; // current voxel value\n\n        if (uJumpLength > 0.0 && value < 0.01) {\n            nextPos = pos + rayDir * uJumpLength;\n            nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;\n            if (nextValue < 0.01) {\n                prevValue = nextValue;\n                pos = nextPos;\n                continue;\n            }\n        }\n\n        #if defined(dRenderMode_isosurface)\n            if (prevValue > 0.0 && ( // there was a prev Value\n                (prevValue < uIsoValue.x && value > uIsoValue.x) || // entering isosurface\n                (prevValue > uIsoValue.x && value < uIsoValue.x) // leaving isosurface\n            )) {\n                isoPos = v3m4(mix(pos - step, pos, ((prevValue - uIsoValue.x) / ((prevValue - uIsoValue.x) - (value - uIsoValue.x)))), cartnToUnit);\n\n                vec4 mvPosition = modelViewTransform * vec4(isoPos * uGridDim, 1.0);\n\n                #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n                    vec3 vModelPosition = v3m4(isoPos * uGridDim, modelTransform);\n                    if (clipTest(vec4(vModelPosition, 0.0), 0)) {\n                        prevValue = value;\n                        pos += step;\n                        continue;\n                    }\n                #endif\n\n                float depth = calcDepth(mvPosition.xyz);\n                if (depth > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n                    break;\n\n                #ifdef enabledFragDepth\n                    if (!hit) {\n                        gl_FragDepthEXT = depth;\n                    }\n                #endif\n\n                #if defined(dRenderVariant_pickObject)\n                    return vec4(encodeFloatRGB(float(uObjectId)), 1.0);\n                #elif defined(dRenderVariant_pickInstance)\n                    return vec4(encodeFloatRGB(vInstance), 1.0);\n                #elif defined(dRenderVariant_pickGroup)\n                    #ifdef dPackedGroup\n                        return vec4(textureGroup(floor(isoPos * uGridDim + 0.5) / uGridDim).rgb, 1.0);\n                    #else\n                        vec3 g = floor(isoPos * uGridDim + 0.5);\n                        return vec4(encodeFloatRGB(g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y), 1.0);\n                    #endif\n                #elif defined(dRenderVariant_depth)\n                    #ifdef enabledFragDepth\n                        return packDepthToRGBA(gl_FragDepthEXT);\n                    #else\n                        return packDepthToRGBA(depth);\n                    #endif\n                #elif defined(dRenderVariant_color)\n                    #ifdef dPackedGroup\n                        float group = decodeFloatRGB(textureGroup(floor(isoPos * uGridDim + 0.5) / uGridDim).rgb);\n                    #else\n                        vec3 g = floor(isoPos * uGridDim + 0.5);\n                        float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y;\n                    #endif\n\n                    #if defined(dColorType_uniform)\n                        color = uColor;\n                    #elif defined(dColorType_instance)\n                        color = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n                    #elif defined(dColorType_group)\n                        color = readFromTexture(tColor, group, uColorTexDim).rgb;\n                    #elif defined(dColorType_groupInstance)\n                        color = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n                    #elif defined(dColorType_vertex)\n                        color = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;\n                    #elif defined(dColorType_vertexInstance)\n                        color = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n                    #endif\n\n                    // handle flipping and negative isosurfaces\n                    #ifdef dFlipSided\n                        bool flipped = value < uIsoValue.y; // flipped\n                    #else\n                        bool flipped = value > uIsoValue.y;\n                    #endif\n                    interior = value < uIsoValue.x && flipped;\n                    #ifndef dDoubleSided\n                        if (interior) {\n                            prevValue = value;\n                            pos += step;\n                            continue;\n                        }\n                    #endif\n                    vec3 vViewPosition = mvPosition.xyz;\n                    vec4 material = vec4(color, uAlpha);\n\n                    #ifdef dIgnoreLight\n                        gl_FragColor = material;\n                    #else\n                        #if defined(dFlatShaded)\n                            // nearest grid point\n                            isoPos = floor(isoPos * uGridDim + 0.5) / uGridDim;\n                        #endif\n                        #ifdef dPackedGroup\n                            // compute gradient by central differences\n                            gradient.x = textureVal(isoPos - dx).a - textureVal(isoPos + dx).a;\n                            gradient.y = textureVal(isoPos - dy).a - textureVal(isoPos + dy).a;\n                            gradient.z = textureVal(isoPos - dz).a - textureVal(isoPos + dz).a;\n                        #else\n                            gradient = textureVal(isoPos).xyz * 2.0 - 1.0;\n                        #endif\n                        vec3 normal = -normalize(normalMatrix * normalize(gradient));\n                        normal = normal * (float(flipped) * 2.0 - 1.0);\n                        normal = normal * -(float(interior) * 2.0 - 1.0);\n                        #include apply_light_color\n                    #endif\n\n                    float vMarker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n                    #include apply_interior_color\n                    #include apply_marker_color\n\n                    preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n                    fragmentDepth = depth;\n                    #include apply_fog\n\n                    src = gl_FragColor;\n\n                    if (!uTransparentBackground) {\n                        // done in 'apply_fog' otherwise\n                        src.rgb *= src.a;\n                    }\n                    dst = (1.0 - dst.a) * src + dst; // standard blending\n                #endif\n\n                #ifdef dSingleLayer\n                    break;\n                #endif\n\n                hit = true;\n            }\n            prevValue = value;\n        #elif defined(dRenderMode_volume)\n            vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n            if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n                break;\n\n            #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n                vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n                if (clipTest(vec4(vModelPosition, 0.0), 0)) {\n                    prevValue = value;\n                    pos += step;\n                    continue;\n                }\n            #endif\n\n            #if defined(dRenderVariant_color)\n                vec3 vViewPosition = mvPosition.xyz;\n                vec4 material = transferFunction(value);\n\n                #ifdef dIgnoreLight\n                    gl_FragColor.rgb = material.rgb;\n                #else\n                    if (material.a >= 0.01) {\n                        #ifdef dPackedGroup\n                            // compute gradient by central differences\n                            gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n                            gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n                            gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n                        #else\n                            gradient = cell.xyz * 2.0 - 1.0;\n                        #endif\n                        vec3 normal = -normalize(normalMatrix * normalize(gradient));\n                        #include apply_light_color\n                    } else {\n                        gl_FragColor.rgb = material.rgb;\n                    }\n                #endif\n\n                gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n                #ifdef dPackedGroup\n                    float group = decodeFloatRGB(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n                #else\n                    vec3 g = floor(unitPos * uGridDim + 0.5);\n                    float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y;\n                #endif\n\n                float vMarker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n                #include apply_marker_color\n\n                preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n                fragmentDepth = calcDepth(mvPosition.xyz);\n                #include apply_fog\n\n                src = gl_FragColor;\n\n                if (!uTransparentBackground) {\n                    // done in 'apply_fog' otherwise\n                    src.rgb *= src.a;\n                }\n                dst = (1.0 - dst.a) * src + dst; // standard blending\n            #endif\n        #endif\n\n        // break if the color is opaque enough\n        if (dst.a > 0.95)\n            break;\n\n        pos += step;\n    }\n\n    #if defined(dRenderMode_isosurface) && defined(enabledFragDepth)\n        // ensure depth is written everywhere\n        if (!hit)\n            gl_FragDepthEXT = 1.0;\n    #endif\n\n    return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n    if (gl_FrontFacing)\n        discard;\n\n    #if defined(dRenderVariant_pick) || defined(dRenderVariant_depth)\n        #if defined(dRenderMode_volume)\n            // always ignore pick & depth for volume\n            discard;\n        #elif defined(dRenderMode_isosurface)\n            if (uAlpha < uPickingAlphaThreshold)\n                discard; // ignore so the element below can be picked\n        #endif\n    #endif\n\n    vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n    vec3 step = rayDir * uStepScale;\n\n    float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n    float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n    vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n    gl_FragColor = raymarch(start, step, rayDir);\n\n    #if defined(dRenderVariant_pick) || defined(dRenderVariant_depth)\n        // discard when nothing was hit\n        if (gl_FragColor == vec4(0.0))\n            discard;\n    #endif\n\n    #if defined(dRenderVariant_color)\n        #if defined(dRenderMode_isosurface) && defined(enabledFragDepth)\n            float fragmentDepth = gl_FragDepthEXT;\n        #else\n            float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n        #endif\n        float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n        interior = false;\n        #include wboit_write\n    #endif\n}\n",{fragDepth:"optional",drawBuffers:"optional"}),_=f("image","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_vert_params\n\nattribute vec3 aPosition;\nattribute vec2 aUv;\nattribute mat4 aTransform;\nattribute float aInstance;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\nvoid main() {\n    #include assign_position\n\n    vUv = aUv;\n    vInstance = aInstance;\n}\n","\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n#include wboit_params\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n    #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n    #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n        #if defined(dInterpolation_catmulrom)\n            const float B = 0.0;\n            const float C = 0.5;\n        #elif defined(dInterpolation_mitchell)\n            const float B = 0.333;\n            const float C = 0.333;\n        #endif\n\n        float cubicFilter(float x){\n            float f = x;\n            if (f < 0.0) {\n                f = -f;\n            }\n            if (f < 1.0) {\n                return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n                    (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n                    (6.0 - 2.0 * B)) / 6.0;\n            }else if (f >= 1.0 && f < 2.0){\n                return ((-B - 6.0 * C) * ( f * f * f)\n                    + (6.0 * B + 30.0 * C) * (f * f) +\n                    (-(12.0 * B) - 48.0 * C) * f +\n                    8.0 * B + 24.0 * C) / 6.0;\n            }else{\n                return 0.0;\n            }\n        }\n    #elif defined(dInterpolation_bspline)\n        float cubicFilter(float x) {\n            float f = x;\n            if (f < 0.0) {\n                f = -f;\n            }\n            if (f >= 0.0 && f <= 1.0){\n                return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n            } else if (f > 1.0 && f <= 2.0) {\n                return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n            }\n            return 1.0;\n        }\n    #endif\n\n    vec4 biCubic(sampler2D tex, vec2 texCoord) {\n        vec2 texelSize = 1.0 / uImageTexDim;\n        texCoord -= texelSize / 2.0;\n        vec4 nSum = vec4(0.0);\n        float nDenom = 0.0;\n        vec2 cell = fract(texCoord * uImageTexDim);\n        for (float m = -1.0; m <= 2.0; ++m) {\n            for (float n = -1.0; n <= 2.0; ++n) {\n                vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n                float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n                nSum += vecData * c;\n                nDenom += c;\n            }\n        }\n        return nSum / nDenom;\n    }\n#endif\n\nvoid main() {\n    #include clip_pixel\n\n    #if defined(dInterpolation_cubic)\n        vec4 imageData = biCubic(tImageTex, vUv);\n    #else\n        vec4 imageData = texture2D(tImageTex, vUv);\n    #endif\n    imageData.a = clamp(imageData.a, 0.0, 1.0);\n    if (imageData.a > 0.9) imageData.a = 1.0;\n\n    float fragmentDepth = gl_FragCoord.z;\n    bool interior = false;\n\n    #if defined(dRenderVariant_pick)\n        if (imageData.a < 0.3)\n            discard;\n\n        #if defined(dRenderVariant_pickObject)\n            gl_FragColor = vec4(encodeFloatRGB(float(uObjectId)), 1.0);\n        #elif defined(dRenderVariant_pickInstance)\n            gl_FragColor = vec4(encodeFloatRGB(vInstance), 1.0);\n        #elif defined(dRenderVariant_pickGroup)\n            gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n        #endif\n    #elif defined(dRenderVariant_depth)\n        if (imageData.a < 0.05)\n            discard;\n\n        gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n    #elif defined(dRenderVariant_color)\n        if (imageData.a < 0.05)\n            discard;\n\n        gl_FragColor = imageData;\n        gl_FragColor.a *= uAlpha;\n\n        float group = decodeFloatRGB(texture2D(tGroupTex, vUv).rgb);\n        float vMarker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n\n        #include apply_marker_color\n        #include apply_fog\n        #include wboit_write\n    #endif\n}\n",{drawBuffers:"optional"});function S(e,t,r,n){var o=function(e){if(void 0===e)return"";var t=[];for(var r in e){var n=e[r].ref.value;if(void 0!==n)if("string"==typeof n)t.push("#define "+r+"_"+n);else if("number"==typeof n)t.push("#define "+r+" "+n);else{if("boolean"!=typeof n)throw new Error("unknown define type");n&&t.push("#define "+r)}}return t.join("\n")+"\n"}(r),s=Object(i.q)(e)?"#version 300 es\n#define attribute in\n#define varying out\n#define texture2D texture\n":"",u=Object(i.q)(e)?function(e,t,r,n){var i=["#version 300 es","layout(location = 0) out highp "+(n[0]||"vec4")+" out_FragData0;"];if(r.standardDerivatives&&i.push("#define enabledStandardDerivatives"),r.fragDepth&&i.push("#define enabledFragDepth"),r.drawBuffers){i.push("#define requiredDrawBuffers");for(var a=1,o=e.getParameter(e.MAX_DRAW_BUFFERS);a<o;++a)i.push("layout(location = "+a+") out highp "+(n[a]||"vec4")+" out_FragData"+a+";")}return r.shaderTextureLod&&i.push("#define enabledShaderTextureLod"),i.push("\n#define varying in\n#define texture2D texture\n#define texture2DLodEXT textureLod\n\n#define gl_FragColor out_FragData0\n#define gl_FragDepthEXT gl_FragDepth\n\n#define depthTextureSupport\n"),i.join("\n")+"\n"}(e,0,n.extensions,n.outTypes):function(e,t){var r=[];if(t.standardDerivatives&&(r.push("#extension GL_OES_standard_derivatives : enable"),r.push("#define enabledStandardDerivatives")),t.fragDepth)if(e.fragDepth)r.push("#extension GL_EXT_frag_depth : enable"),r.push("#define enabledFragDepth");else if("required"===t.fragDepth)throw new Error("required 'GL_EXT_frag_depth' extension not available");if(t.drawBuffers)if(e.drawBuffers)r.push("#extension GL_EXT_draw_buffers : require"),r.push("#define requiredDrawBuffers"),r.push("#define gl_FragColor gl_FragData[0]");else if("required"===t.drawBuffers)throw new Error("required 'GL_EXT_draw_buffers' extension not available");if(t.shaderTextureLod)if(e.shaderTextureLod)r.push("#extension GL_EXT_shader_texture_lod : enable"),r.push("#define enabledShaderTextureLod");else if("required"===t.shaderTextureLod)throw new Error("required 'GL_EXT_shader_texture_lod' extension not available");return e.depthTexture&&r.push("#define depthTextureSupport"),r.join("\n")+"\n"}(t,n.extensions),c=Object(i.q)(e)?function(e){return e.replace(/gl_FragData\[([0-9]+)\]/g,"out_FragData$1")}(n.frag):n.frag;return{id:a(),name:n.name,vert:""+s+o+n.vert,frag:""+u+o+c,extensions:n.extensions,outTypes:n.outTypes}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(23),a=r(51),o=r(1),s=r(188),u=r(52),c=r(5),l=r(129),d=r(6),f=r(130),p=r(136);!function(e){e.setVisibility=function(e,t){e&&(e.state.visible=t)},e.setAlphaFactor=function(e,t){e&&(e.state.alphaFactor=t)},e.setPickable=function(e,t){e&&(e.state.pickable=t)},e.setColorOnly=function(e,t){e&&(e.state.colorOnly=t)},e.mark=function(e,t,r,n){if(!e)return!1;var o=e.values,s=o.tMarker,u=o.uGroupCount,l=o.instanceCount,f=u.ref.value*l.ref.value,p=s.ref.value.array,m=!1;return Object(i.isEveryLoci)(t)?m=Object(a.c)(p,d.Interval.ofLength(f),r):Object(i.isEmptyLoci)(t)||(m=n(t,(function(e){return Object(a.c)(p,e,r)}),!0)),m&&c.e.update(s,s.ref.value),m},e.setOverpaint=function(e,t,r,n){if(e){var i=e.values,a=i.tOverpaint,o=i.uGroupCount,s=i.instanceCount,u=o.ref.value*s.ref.value;Object(l.d)(t.layers.length?u:0,e.values);var f=a.ref.value.array;n&&Object(l.b)(f,0,u);for(var p=function(e,n){var i=t.layers[e],a=i.loci,o=i.color,s=i.clear;r(a,(function(e){var t=d.Interval.start(e),r=d.Interval.end(e);return s?Object(l.b)(f,t,r):Object(l.a)(f,t,r,o)}),!1)},m=0,h=t.layers.length;m<h;++m)p(m);c.e.update(a,a.ref.value)}},e.setTransparency=function(e,t,r,n){if(e){var i=e.values,a=i.tTransparency,o=i.transparencyAverage,s=i.uGroupCount,u=i.instanceCount,l=s.ref.value*u.ref.value;Object(f.d)(t.layers.length?l:0,e.values);var p=a.ref.value.array;n&&Object(f.b)(p,0,l);for(var m=function(e,n){var i=t.layers[e],a=i.loci,o=i.value;r(a,(function(e){var t=d.Interval.start(e),r=d.Interval.end(e);return Object(f.a)(p,t,r,o)}),!1)},h=0,g=t.layers.length;h<g;++h)m(h);c.e.update(a,a.ref.value),c.e.updateIfChanged(o,Object(f.e)(p,l))}},e.setClipping=function(e,t,r,n){if(e){var i=e.values,a=i.tClipping,o=i.uGroupCount,s=i.instanceCount,u=o.ref.value*s.ref.value;Object(p.c)(t.layers.length?u:0,e.values);var l=a.ref.value.array;n&&Object(p.b)(l,0,u);for(var f=function(e,n){var i=t.layers[e],a=i.loci,o=i.groups;r(a,(function(e){var t=d.Interval.start(e),r=d.Interval.end(e);return Object(p.a)(l,t,r,o)}),!1)},m=0,h=t.layers.length;m<h;++m)f(m);c.e.update(a,a.ref.value)}},e.setTransform=function(e,t,r){if(e&&(t||r)){var n=e.values;t&&(o.Mat4.copy(n.matrix.ref.value,t),c.e.update(n.matrix,n.matrix.ref.value)),r?(n.extraTransform.ref.value.set(r),c.e.update(n.extraTransform,n.extraTransform.ref.value)):null===r&&(Object(s.c)(n.extraTransform.ref.value,n.instanceCount.ref.value),c.e.update(n.extraTransform,n.extraTransform.ref.value)),Object(s.d)(n);var i=Object(u.b)(n.invariantBoundingSphere.ref.value,n.aTransform.ref.value,n.instanceCount.ref.value);c.e.update(n.boundingSphere,i)}}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"CustomPropertyDescriptor",(function(){return i})),r.d(t,"CustomProperties",(function(){return a}));var n=r(5);function i(e){return e}!function(e){e.getUUID=function(e){return e.__key||(e.__key=n.c.create22()),e.__key}}(i||(i={}));var a=function(){function e(){this._list=[],this._set=new Set,this._refs=new Map,this._assets=new Map}return Object.defineProperty(e.prototype,"all",{get:function(){return this._list},enumerable:!1,configurable:!0}),e.prototype.add=function(e){this._set.has(e)||(this._list.push(e),this._set.add(e))},e.prototype.reference=function(e,t){var r=this._refs.get(e)||0;r+=t?1:-1,this._refs.set(e,Math.max(r,0))},e.prototype.hasReference=function(e){return(this._refs.get(e)||0)>0},e.prototype.has=function(e){return this._set.has(e)},e.prototype.assets=function(e,t){var r=this._assets.get(e);if(r)for(var n=0,i=r;n<i.length;n++){i[n].dispose()}t?this._assets.set(e,t):this._assets.delete(e)},e.prototype.dispose=function(){this._assets.forEach((function(e){for(var t=0,r=e;t<r.length;t++){r[t].dispose()}}))},e}()},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return u}));var n=r(5),i=r(99),a=r(70),o=Object(i.a)();function s(e,t,r){return{id:o(),materialId:e.materialId,values:t,state:r,render:function(i,o){t.uAlpha&&t.alpha&&n.e.updateIfChanged(t.uAlpha,Object(a.a)(t.alpha.ref.value*r.alphaFactor,0,1)),e.render(i,o)},getProgram:function(t){return e.getProgram(t)},update:function(){return e.update()},dispose:function(){return e.destroy()}}}function u(e,t){return{id:o(),values:t,render:function(){return e.render("compute")},update:function(){return e.update()},dispose:function(){return e.destroy()}}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return v})),r.d(t,"a",(function(){return b}));var n=r(0),i=r(288),a=r(204),o=r(293),s=r(11),u=r(99),c=r(5),l=r(231),d=r(48),f=r(29),p=Object(u.a)();var m=Object.keys({colorBlended:"",colorWboit:"",pickObject:"",pickInstance:"",pickGroup:"",depth:""}),h=Object.keys({compute:""});function g(e,t,r,i,a){return r=Object(n.__assign)(Object(n.__assign)({},r),{dRenderVariant:c.e.create(t)}),void 0===a.dRenderVariant&&Object.defineProperty(a,"dRenderVariant",{value:Object(s.c)("string")}),e.resources.program(r,i,a)}function v(e,t,r,n,i,a){return y(e,t,r,n,i,a,m)}function b(e,t,r,n,i,a){return void 0===a&&(a=-1),y(e,t,r,n,i,a,h)}function y(e,t,r,n,u,m,h){var v=p(),b=e.stats,y=e.state,_=e.resources,S=e.extensions,x=S.instancedArrays,O=S.vertexArrayObject;if(u.uVertexCount){var w=u.uVertexCount.ref.value;u.aVertex=c.e.create(Object(f.fillSerial)(new Float32Array(w))),n.aVertex=Object(s.a)("float32",1,0)}for(var C=Object(s.m)(n,u),j=C.attributeValues,P=C.defineValues,E=C.textureValues,A=C.uniformValues,D=C.materialUniformValues,T=Object.entries(A),I=Object.entries(D),M=Object.entries(P),k=Object(s.l)(u),B=function(e,t){var r=e.gl;switch(t){case"points":return r.POINTS;case"lines":return r.LINES;case"line-strip":return r.LINE_STRIP;case"line-loop":return r.LINE_LOOP;case"triangles":return r.TRIANGLES;case"triangle-strip":return r.TRIANGLE_STRIP;case"triangle-fan":return r.TRIANGLE_FAN}}(e,t),V={},R=0,L=h;R<L.length;R++){var N=L[R];V[N]=g(e,N,P,r,n)}var F,U=Object(a.c)(e,n,E),z=Object(i.b)(e,n,j),H=u.elements;H&&H.ref.value&&(F=_.elements(H.ref.value));for(var G={},q=0,W=h;q<W.length;q++){N=W[q];G[N]=O?_.vertexArray(V[N],z,F):null}var X=u.drawCount.ref.value,Y=u.instanceCount.ref.value;b.drawCount+=X,b.instanceCount+=Y,b.instancedDrawCount+=Y*X;var Q={attributes:!1,defines:!1,elements:!1,textures:!1},K=!1,Z=-1;return{id:v,materialId:m,getProgram:function(e){return V[e]},render:function(t,r){if(0!==X&&0!==Y&&!e.isContextLost){var n=V[t];if(n.id===Z&&y.currentRenderItemId===v)n.setUniforms(T),r&&r.length>0?(n.bindTextures(r,0),n.bindTextures(U,r.length)):n.bindTextures(U,0);else{var i=G[t];n.id===y.currentProgramId&&n.id===Z&&-1!==m&&m===y.currentMaterialId||(n.id!==y.currentProgramId&&n.use(),n.setUniforms(I),y.currentMaterialId=m,Z=n.id),n.setUniforms(T),r&&r.length>0?(n.bindTextures(r,0),n.bindTextures(U,r.length)):n.bindTextures(U,0),i?(i.bind(),F&&F.bind()):(F&&F.bind(),n.bindAttributes(z)),y.currentRenderItemId=v}if(d.a)try{Object(l.a)(e.gl)}catch(e){throw new Error("Framebuffer error rendering item id "+v+": '"+e+"'")}if(F?x.drawElementsInstanced(B,X,F._dataType,0,Y):x.drawArraysInstanced(B,0,X,Y),d.a)try{Object(o.a)(e.gl)}catch(e){throw new Error("Draw error rendering item id "+v+": '"+e+"'")}}},update:function(){if(function(e){e.attributes=!1,e.defines=!1,e.elements=!1,e.textures=!1}(Q),u.aVertex){var t=u.uVertexCount.ref.value;u.aVertex.ref.value.length<t&&c.e.update(u.aVertex,Object(f.fillSerial)(new Float32Array(t)))}for(var i=0,a=M.length;i<a;++i){var o=M[i],s=o[0];(A=o[1]).ref.version!==k[s]&&(Q.defines=!0,k[s]=A.ref.version)}if(Q.defines)for(var l=0,d=h;l<d.length;l++){s=d[l];V[s].destroy(),V[s]=g(e,s,P,r,n)}u.drawCount.ref.version!==k.drawCount&&(b.drawCount+=u.drawCount.ref.value-X,b.instancedDrawCount+=Y*u.drawCount.ref.value-Y*X,X=u.drawCount.ref.value,k.drawCount=u.drawCount.ref.version),u.instanceCount.ref.version!==k.instanceCount&&(b.instanceCount+=u.instanceCount.ref.value-Y,b.instancedDrawCount+=u.instanceCount.ref.value*X-Y*X,Y=u.instanceCount.ref.value,k.instanceCount=u.instanceCount.ref.version);for(i=0,a=z.length;i<a;++i){var p=z[i],m=(s=p[0],p[1]);if((A=j[s]).ref.version!==k[s]){if(m.length>=A.ref.value.length)m.updateSubData(A.ref.value,0,m.length);else{m.destroy();var v=n[s],y=v.itemSize,S=v.divisor;z[i][1]=_.attribute(A.ref.value,y,S),Q.attributes=!0}k[s]=A.ref.version}}if(F&&u.elements.ref.version!==k.elements&&(F.length>=u.elements.ref.value.length?F.updateSubData(u.elements.ref.value,0,F.length):(F.destroy(),F=_.elements(u.elements.ref.value),Q.elements=!0),k.elements=u.elements.ref.version),Q.attributes||Q.defines||Q.elements)for(var x=0,w=h;x<w.length;x++){s=w[x];var C=G[s];C&&C.destroy(),G[s]=O?_.vertexArray(V[s],z,F):null}for(i=0,a=U.length;i<a;++i){var A,D=U[i],T=(s=D[0],D[1]);(A=E[s]).ref.version!==k[s]&&("texture"!==n[s].kind?(T.load(A.ref.value),k[s]=A.ref.version,Q.textures=!0):U[i][1]=A.ref.value)}return Q},destroy:function(){if(!K){for(var e=0,t=h;e<t.length;e++){var r=t[e];V[r].destroy();var i=G[r];i&&i.destroy()}U.forEach((function(e){var t=e[0],r=e[1];"texture"!==n[t].kind&&r.destroy()})),z.forEach((function(e){e[0];return e[1].destroy()})),F&&F.destroy(),b.drawCount-=X,b.instanceCount-=Y,b.instancedDrawCount-=Y*X,K=!0}}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i}));var n=1e-6;function i(e,t,r){return Math.abs(e-t)<=r}},function(e,t,r){"use strict";function n(e,t,r){return Math.max(t,Math.min(r,e))}function i(e,t,r){return e+(t-e)*r}function a(e,t,r,n,i,a){var o=(r-e)*a,s=(n-t)*a,u=i*i;return(2*t-2*r+o+s)*(i*u)+(-3*t+3*r-2*o-s)*u+o*i+t}function o(e,t,r,n){var i=1-n;return i*i*e+2*i*n*t+n*n*r}r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"d",(function(){return a})),r.d(t,"c",(function(){return o}))},function(e,t,r){"use strict";var n;!function(e){e.create=function(e,t,r){void 0===r&&(r=Float32Array);var n=e*t;return{data:new r(n),size:n,cols:e,rows:t}},e.get=function(e,t,r){return e.data[e.rows*r+t]},e.set=function(e,t,r,n){return e.data[e.rows*r+t]=n,e},e.add=function(e,t,r,n){return e.data[e.rows*r+t]+=n,e},e.makeZero=function(e){return e.data.fill(0),e},e.clone=function(e){return{data:e.data.slice(),size:e.size,cols:e.cols,rows:e.rows}},e.fromArray=function(e,t,r){return{data:e,size:t*r,cols:t,rows:r}},e.transpose=function(e,t){if(e.cols!==t.rows||e.rows!==t.cols)throw new Error("transpose: matrix dimensions incompatible");if(e.data===t.data)throw new Error("transpose: matrices share memory");for(var r=t.rows,n=t.cols,i=t.data,a=e.data,o=0,s=0,u=0;o<r;u+=1,s+=n,++o)for(var c=u,l=0;l<n;c+=r,l++)a[c]=i[s+l];return e},e.multiplyABt=function(e,t,r){for(var n=t.cols,i=t.rows,a=r.rows,o=t.data,s=r.data,u=e.data,c=0,l=0,d=0;c<i;l+=n,c++)for(var f=0,p=0;p<a;d++,p++){for(var m=0,h=l,g=0;g<n;h++,f++,g++)m+=o[h]*s[f];u[d]=m}return e},e.meanRows=function(e){for(var t=e.rows,r=e.cols,n=e.data,i=new Array(r),a=0;a<r;++a)i[a]=0;for(var o=0,s=0;o<t;++o)for(a=0;a<r;++a,++s)i[a]+=n[s];for(a=0;a<r;++a)i[a]/=t;return i},e.subRows=function(e,t){for(var r=e.rows,n=e.cols,i=e.data,a=0,o=0;a<r;++a)for(var s=0;s<n;++s,++o)i[o]-=t[s];return e}}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s})),r.d(t,"c",(function(){return u}));r(52);var n=r(5),i=r(11),a=r(1),o=new Float32Array([1,1,-1,1,-1,-1,-1,-1,1,-1,1,1]),s={drawCount:Object(i.k)("number"),instanceCount:Object(i.k)("number"),aPosition:Object(i.a)("float32",2,0),uQuadScale:Object(i.j)("v2")},u={drawCount:n.e.create(6),instanceCount:n.e.create(1),aPosition:n.e.create(o),uQuadScale:n.e.create(a.Vec2.create(1,1))}},function(e,t,r){"use strict";r.r(t),r.d(t,"ParameterControls",(function(){return P})),r.d(t,"ParameterMappingControl",(function(){return E})),r.d(t,"ParamHelp",(function(){return T})),r.d(t,"SimpleParam",(function(){return M})),r.d(t,"BoolControl",(function(){return k})),r.d(t,"LineGraphControl",(function(){return B})),r.d(t,"NumberInputControl",(function(){return V})),r.d(t,"NumberRangeControl",(function(){return R})),r.d(t,"TextControl",(function(){return L})),r.d(t,"PureSelectControl",(function(){return N})),r.d(t,"SelectControl",(function(){return F})),r.d(t,"ValueRefControl",(function(){return U})),r.d(t,"IntervalControl",(function(){return z})),r.d(t,"BoundedIntervalControl",(function(){return H})),r.d(t,"ColorControl",(function(){return G})),r.d(t,"ColorListControl",(function(){return Z})),r.d(t,"OffsetColorListControl",(function(){return J})),r.d(t,"Vec3Control",(function(){return $})),r.d(t,"Mat4Control",(function(){return ee})),r.d(t,"UrlControl",(function(){return te})),r.d(t,"FileControl",(function(){return re})),r.d(t,"FileListControl",(function(){return ne})),r.d(t,"MultiSelectControl",(function(){return ie})),r.d(t,"GroupControl",(function(){return ae})),r.d(t,"MappedControl",(function(){return oe})),r.d(t,"ObjectListControl",(function(){return ce})),r.d(t,"ConditionedControl",(function(){return le})),r.d(t,"ConvertedControl",(function(){return de})),r.d(t,"ScriptControl",(function(){return fe}));var n=r(0),i=r(3),a=r(1),o=r(24),s=r(100),u=r(154),c=r(179),l=r(2),d=r(42),f=r(33),p=r(56),m=r(18),h=r(46),g=Object(h.ColorSwatch)([["black",0],["gray",8421504],["white",16777215],["red",13840661],["orange",14840576],["yellow",16565248],["green",6863872],["cyan",1484197],["blue",40160],["purple",8086783],["magenta",16394495],["violet",8200583]]),v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!!t.props.param.isExpanded,lightness:0},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t.onClickSwatch=function(e){var r=Object(o.Color)(+(e.currentTarget.getAttribute("data-color")||"0"));r!==t.props.value&&(t.props.param.isExpanded||t.setState({isExpanded:!1}),t.update(r))},t.onR=function(e){var r=o.Color.toRgb(t.props.value),n=r[1],i=r[2],a=o.Color.fromRgb(e,n,i);a!==t.props.value&&t.update(a)},t.onG=function(e){var r=o.Color.toRgb(t.props.value),n=r[0],i=r[2],a=o.Color.fromRgb(n,e,i);a!==t.props.value&&t.update(a)},t.onB=function(e){var r=o.Color.toRgb(t.props.value),n=r[0],i=r[1],a=o.Color.fromRgb(n,i,e);a!==t.props.value&&t.update(a)},t.onLighten=function(){t.update(o.Color.lighten(t.props.value,.1))},t.onDarken=function(){t.update(o.Color.darken(t.props.value,.1))},t}return Object(n.__extends)(t,e),t.prototype.update=function(e){this.props.onChange({param:this.props.param,name:this.props.name,value:e})},t.prototype.swatch=function(){var e=this;return i.createElement("div",{className:"msp-combined-color-swatch"},g.map((function(t){return i.createElement(m.Button,{key:t[1],inline:!0,"data-color":t[1],onClick:e.onClickSwatch,style:{background:o.Color.toStyle(t[1])}})})))},t.prototype.render=function(){var e=this.props.param.label||Object(d.a)(this.props.name),t=o.Color.toRgb(this.props.value),r=t[0],n=t[1],a=t[2];return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{title:this.props.param.description,label:e,control:i.createElement(m.Button,{onClick:this.toggleExpanded,inline:!0,className:"msp-combined-color-button",style:{background:o.Color.toStyle(this.props.value)}})}),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},this.swatch(),i.createElement(m.ControlRow,{label:"RGB",className:"msp-control-label-short",control:i.createElement("div",{style:{display:"flex",textAlignLast:"center",left:"80px"}},i.createElement(m.TextInput,{onChange:this.onR,numeric:!0,value:r,delayMs:250,style:{order:1,flex:"1 1 auto",minWidth:0},className:"msp-form-control",onEnter:this.props.onEnter,blurOnEnter:!0,blurOnEscape:!0}),i.createElement(m.TextInput,{onChange:this.onG,numeric:!0,value:n,delayMs:250,style:{order:2,flex:"1 1 auto",minWidth:0},className:"msp-form-control",onEnter:this.props.onEnter,blurOnEnter:!0,blurOnEscape:!0}),i.createElement(m.TextInput,{onChange:this.onB,numeric:!0,value:a,delayMs:250,style:{order:3,flex:"1 1 auto",minWidth:0},className:"msp-form-control",onEnter:this.props.onEnter,blurOnEnter:!0,blurOnEscape:!0}))}),i.createElement("div",{style:{display:"flex",textAlignLast:"center"}},i.createElement(m.Button,{onClick:this.onLighten,style:{order:1,flex:"1 1 auto",minWidth:0},className:"msp-form-control"},"Lighten"),i.createElement(m.Button,{onClick:this.onDarken,style:{order:1,flex:"1 1 auto",minWidth:0},className:"msp-form-control"},"Darken"))))},t}(i.PureComponent),b=void 0;var y=function(){for(var e=new Map,t=0,r=g;t<r.length;t++){var n=r[t];e.set(n[1],n[0])}return e}();var _=r(15);var S=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props.legend,t=e.colors.map((function(e){return Array.isArray(e)?o.Color.toStyle(e[0])+" "+100*e[1]+"%":o.Color.toStyle(e)})).join(", ");return i.createElement("div",{className:"msp-scale-legend"},i.createElement("div",{style:{background:"linear-gradient(to right, "+t+")"}},i.createElement("span",{style:{float:"left"}},e.minLabel),i.createElement("span",{style:{float:"right"}},e.maxLabel)))},t}(i.PureComponent),x=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props.legend;return i.createElement("div",{className:"msp-table-legend"},e.table.map((function(e,t){var r=e[0],n=e[1];return i.createElement("div",{key:t},i.createElement("div",{className:"msp-table-legend-color",style:{backgroundColor:o.Color.toStyle(n)}}),i.createElement("div",{className:"msp-table-legend-text"},r))})))},t}(i.PureComponent),O=function(e){function t(t){var r=e.call(this,t)||this;return r.state={show:!1},r.handleHover=r.handleHover.bind(r),r.handleHoverOff=r.handleHoverOff.bind(r),r.deletePoint=r.deletePoint.bind(r),r}return Object(n.__extends)(t,e),t.prototype.handleHover=function(){this.setState({show:!0});var e=a.Vec2.create(this.props.nX,this.props.nY);this.props.onmouseover(e)},t.prototype.handleHoverOff=function(){this.setState({show:!1}),this.props.onmouseover(void 0)},t.prototype.deletePoint=function(){this.props.delete(this.props.id)},t.prototype.render=function(){return[i.createElement("circle",{r:"10",key:this.props.id+"circle",id:""+this.props.id,cx:this.props.x,cy:this.props.y,onClick:this.props.onclick,onDoubleClick:this.props.delete(this.props.id),onMouseEnter:this.handleHover,onMouseLeave:this.handleHoverOff,onMouseDown:this.props.onmousedown,fill:"black"})]},t}(i.Component),w=function(e){function t(t){var r=e.call(this,t)||this;r.handleKeyDown=function(e){},r.handleKeyUp=function(e){},r.handleClick=function(e){return function(e){}},r.handleMouseDown=function(e){return function(t){if(0!==e&&e!==r.state.points.length-1&&!r.state.canSelectMultiple){var n=r.normalizePoint(a.Vec2.create(r.state.points[e][0],r.state.points[e][1]));r.ghostPoints.push(document.createElementNS(r.namespace,"circle")),r.ghostPoints[0].setAttribute("r","10"),r.ghostPoints[0].setAttribute("fill","orange"),r.ghostPoints[0].setAttribute("cx",""+n[0]),r.ghostPoints[0].setAttribute("cy",""+n[1]),r.ghostPoints[0].setAttribute("style","display: none"),r.gElement.appendChild(r.ghostPoints[0]),r.updatedX=n[0],r.updatedY=n[1],r.selected=[e]}}},r.deletePoint=function(e){return function(t){if(0!==e&&e!==r.state.points.length-1){var n=r.state.points.filter((function(t,r){return r!==e}));n.sort((function(e,t){return e[0]===t[0]?0===e[0]?e[1]-t[1]:1===e[1]?t[1]-e[1]:e[1]-t[1]:e[0]-t[0]})),r.setState({points:n}),r.change(n),t.stopPropagation()}}},r.myRef=i.createRef(),r.state={points:[a.Vec2.create(0,0),a.Vec2.create(1,0)],copyPoint:void 0,canSelectMultiple:!1},r.height=400,r.width=600,r.padding=70,r.selected=void 0,r.ghostPoints=[],r.namespace="http://www.w3.org/2000/svg";for(var n=0,o=r.props.data;n<o.length;n++){var s=o[n];r.state.points.push(s)}return r.state.points.sort((function(e,t){return e[0]===t[0]?0===e[0]?e[1]-t[1]:1===e[1]?t[1]-e[1]:e[1]-t[1]:e[0]-t[0]})),r.handleDrag=r.handleDrag.bind(r),r.handleMultipleDrag=r.handleMultipleDrag.bind(r),r.handleDoubleClick=r.handleDoubleClick.bind(r),r.refCallBack=r.refCallBack.bind(r),r.handlePointUpdate=r.handlePointUpdate.bind(r),r.change=r.change.bind(r),r.handleKeyUp=r.handleKeyUp.bind(r),r.handleLeave=r.handleLeave.bind(r),r.handleEnter=r.handleEnter.bind(r),r}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.renderPoints(),t=this.renderLines();return[i.createElement("div",{key:"LineGraph"},i.createElement("svg",{className:"msp-canvas",ref:this.refCallBack,viewBox:"0 0 "+(this.width+this.padding)+" "+(this.height+this.padding),onMouseMove:this.handleDrag,onMouseUp:this.handlePointUpdate,onMouseLeave:this.handleLeave,onMouseEnter:this.handleEnter,tabIndex:0,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onDoubleClick:this.handleDoubleClick},i.createElement("g",{stroke:"black",fill:"black"},t,e),i.createElement("g",{className:"ghost-points",stroke:"black",fill:"black"}))),i.createElement("div",{key:"modal",id:"modal-root"})]},t.prototype.componentDidMount=function(){this.gElement=document.getElementsByClassName("ghost-points")[0]},t.prototype.change=function(e){var t=e.slice();t.shift(),t.pop(),this.props.onChange(t)},t.prototype.handleDrag=function(e){if(void 0!==this.selected){var t,r=this.myRef.createSVGPoint(),n=this.padding/2;r.x=e.clientX,r.y=e.clientY;var i=r.matrixTransform(this.myRef.getScreenCTM().inverse());t=a.Vec2.create(i.x,i.y),t=(i.x<n||i.x>this.width+n)&&(i.y>this.height+n||i.y<n)?a.Vec2.create(this.updatedX,this.updatedY):i.x<n?a.Vec2.create(n,i.y):i.x>this.width+n?a.Vec2.create(this.width+n,i.y):i.y>this.height+n?a.Vec2.create(i.x,this.height+n):i.y<n?a.Vec2.create(i.x,n):a.Vec2.create(i.x,i.y),this.updatedX=t[0],this.updatedY=t[1];var o=this.unNormalizePoint(t);this.ghostPoints[0].setAttribute("style","display: visible"),this.ghostPoints[0].setAttribute("cx",""+t[0]),this.ghostPoints[0].setAttribute("cy",""+t[1]),this.props.onDrag(o)}},t.prototype.handleMultipleDrag=function(){},t.prototype.handlePointUpdate=function(e){var t=this.selected;if(!this.state.canSelectMultiple)if(void 0!==t&&0!==t[0]&&t[0]!==this.state.points.length-1){this.selected=void 0;var r=this.unNormalizePoint(a.Vec2.create(this.updatedX,this.updatedY)),n=this.state.points.filter((function(e,r){return r!==t[0]}));n.push(r),n.sort((function(e,t){return e[0]===t[0]?0===e[0]?e[1]-t[1]:1===e[1]?t[1]-e[1]:e[1]-t[1]:e[0]-t[0]})),this.setState({points:n}),this.change(n),this.gElement.innerHTML="",this.ghostPoints=[],document.removeEventListener("mousemove",this.handleDrag,!0),document.removeEventListener("mouseup",this.handlePointUpdate,!0)}else this.setState({copyPoint:void 0})},t.prototype.handleDoubleClick=function(e){var t,r=this.myRef.createSVGPoint();r.x=e.clientX,r.y=e.clientY;var n=r.matrixTransform(this.myRef.getScreenCTM().inverse()),i=this.state.points,o=this.padding/2;n.x<o||n.x>this.width+o||n.y>this.height+o||n.y<this.padding/2||(t=this.unNormalizePoint(a.Vec2.create(n.x,n.y)),i.push(t),i.sort((function(e,t){return e[0]===t[0]?0===e[0]?e[1]-t[1]:1===e[1]?t[1]-e[1]:e[1]-t[1]:e[0]-t[0]})),this.setState({points:i}),this.change(i))},t.prototype.handleLeave=function(){void 0!==this.selected&&(document.addEventListener("mousemove",this.handleDrag,!0),document.addEventListener("mouseup",this.handlePointUpdate,!0))},t.prototype.handleEnter=function(){document.removeEventListener("mousemove",this.handleDrag,!0),document.removeEventListener("mouseup",this.handlePointUpdate,!0)},t.prototype.normalizePoint=function(e){var t=this.padding/2,r=this.width+t,n=this.height+t,i=e[0]*(r-t)+t,o=e[1]*(n-t)+t,s=this.height+this.padding-o;return a.Vec2.create(i,s)},t.prototype.unNormalizePoint=function(e){var t=this.padding/2,r=this.width+t,n=this.height+t,i=(e[0]-t)/(r-t),o=(this.height+this.padding-e[1]-t)/(n-t);return a.Vec2.create(i,o)},t.prototype.refCallBack=function(e){e&&(this.myRef=e)},t.prototype.renderPoints=function(){for(var e,t=[],r=0;r<this.state.points.length;r++)0!==r&&r!==this.state.points.length-1&&(e=this.normalizePoint(this.state.points[r]),t.push(i.createElement(O,{key:r,id:r,x:e[0],y:e[1],nX:this.state.points[r][0],nY:this.state.points[r][1],selected:!1,delete:this.deletePoint,onmouseover:this.props.onHover,onmousedown:this.handleMouseDown(r),onclick:this.handleClick(r)})));return t},t.prototype.renderLines=function(){for(var e,t,r,n,o,s,u=[],c=[],l=0,d=this.state.points;l<d.length;l++){var f=d[l];e=this.padding/2,t=this.width+e,r=this.height+e,n=f[0]*(t-e)+e,o=f[1]*(r-e)+e,s=this.height+this.padding-o,u.push(a.Vec2.create(n,s))}for(var p=u,m=p.length,h=0;h<m-1;h++){var g=p[h][0],v=p[h][1],b=p[h+1][0],y=p[h+1][1];c.push(i.createElement("line",{key:"lineOf"+h,x1:g,x2:b,y1:v,y2:y,stroke:"#cec9ba",strokeWidth:"5"}))}return c},t}(i.Component),C=r(336),j=r(119),P=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){var r,i,a;if(null===(a=(i=t.props).onChange)||void 0===a||a.call(i,e,t.props.values),t.props.onChangeValues){var o=Object(n.__assign)(Object(n.__assign)({},t.props.values),((r={})[e.name]=e.value,r));t.props.onChangeValues(o,t.props.values)}},t.paramGroups=Object(u.b)((function(e){return A(e)})),t}return Object(n.__extends)(t,e),t.prototype.renderGroup=function(e){var t;if(0===e.length)return null;for(var r=this.props.values,n=null,a=void 0,o=0,s=e;o<s.length;o++){var u=s[o],c=u[0],l=u[1],d=u[2];(null===(t=l.hideIf)||void 0===t?void 0:t.call(l,r))||(n||(n=[]),a=l.category,n.push(i.createElement(d,{param:l,key:c,onChange:this.onChange,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled,name:c,value:r[c]})))}return n?a?[i.createElement(m.ExpandGroup,{key:a,header:a},n)]:n:null},t.prototype.renderPart=function(e){for(var t=null,r=0,n=e;r<n.length;r++){var i=n[r],a=this.renderGroup(i);if(a){t||(t=[]);for(var o=0,s=a;o<s.length;o++){var u=s[o];t.push(u)}}}return t},t.prototype.render=function(){var e=this.paramGroups(this.props.params),t=this.renderPart(e.essentials),r=this.renderPart(e.advanced);return t&&r?i.createElement(i.Fragment,null,t,i.createElement(m.ExpandGroup,{header:"Advanced Options"},r)):t||r},t}(i.PureComponent),E=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.setSettings=function(e,r){var i,a=Object(n.__assign)(Object(n.__assign)({},r),((i={})[e.name]=e.value,i)),o=t.props.mapping.update(a,t.plugin);t.props.mapping.apply(o,t.plugin)},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e=this.props.mapping.getTarget(this.plugin),t=this.props.mapping.getValues(e,this.plugin),r=this.props.mapping.params(this.plugin);return i.createElement(P,{params:r,values:t,onChange:this.setSettings})},t}(f.PluginUIComponent);function A(e){function t(e,t,r){var n=D(t);if(n)if(t.category){r.map||(r.map=new Map);var i=r.map.get(t.category);i||(i=[],r.map.set(t.category,i),r.params.push(i)),i.push([e,t,n])}else r.params[0].push([e,t,n])}function r(e,t){var r=e[0],n=t[0];return r&&r[1].category?n&&n[1].category&&r[1].category<n[1].category?-1:1:-1}for(var n={params:[[]],map:void 0},i={params:[[]],map:void 0},a=0,o=Object.keys(e);a<o.length;a++){var s=o[a],u=e[s];u.isHidden||(u.isEssential?t(s,u,n):t(s,u,i))}return n.params.sort(r),i.params.sort(r),{essentials:n.params,advanced:i.params}}function D(e){switch(e.type){case"value":return;case"boolean":return k;case"number":return void 0!==e.min&&void 0!==e.max?R:V;case"converted":return de;case"conditioned":return le;case"multi-select":return ie;case"color":return v;case"color-list":return e.offsets?J:Z;case"vec3":return $;case"mat4":return ee;case"url":return te;case"file":return re;case"file-list":return ne;case"select":return F;case"value-ref":return U;case"data-ref":return;case"text":return L;case"interval":return void 0!==e.min&&void 0!==e.max?H:z;case"group":return ae;case"mapped":return oe;case"line-graph":return B;case"script":return fe;case"object-list":return ce;default:var t=e;return void console.warn(t+" has no associated UI component")}}var T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.legend,r=e.description,n=t&&function(e){switch(e.kind){case"scale-legend":return S;case"table-legend":return x;default:var t=e;return void console.warn(t+" has no associated UI component")}}(t);return i.createElement("div",{className:"msp-help-text"},i.createElement("div",null,i.createElement("div",{className:"msp-help-description"},i.createElement(_.Icon,{svg:_.HelpOutlineSvg,inline:!0}),r),n&&i.createElement("div",{className:"msp-help-legend"},i.createElement(n,{legend:t}))))},t}(i.PureComponent);function I(e){var t=e.props,r=e.state,n=e.control,a=e.toggleHelp,o=e.addOn,s=[];t.param.shortLabel&&s.push("msp-control-label-short"),t.param.twoColumns&&s.push("msp-control-col-2");var u=s.join(" "),c=t.param.label||Object(d.a)(t.name),l=t.param.help?t.param.help(t.value):{description:t.param.description,legend:t.param.legend},f=t.param.description,p=l.description||l.legend;return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{className:u,title:f,label:i.createElement(i.Fragment,null,c,p&&i.createElement("button",{className:"msp-help msp-btn-link msp-btn-icon msp-control-group-expander",onClick:a,title:f||(r.showHelp?"Hide":"Show")+" help",style:{background:"transparent",textAlign:"left",padding:"0"}},i.createElement(_.Icon,{svg:_.HelpOutlineSvg}))),control:n}),p&&r.showHelp&&i.createElement("div",{className:"msp-control-offset"},i.createElement(T,{legend:l.legend,description:l.description})),o)}var M=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showHelp:!1},t.toggleHelp=function(){return t.setState({showHelp:!t.state.showHelp})},t}return Object(n.__extends)(t,e),t.prototype.update=function(e){this.props.onChange({param:this.props.param,name:this.props.name,value:e})},t.prototype.renderAddOn=function(){return null},t.prototype.render=function(){return I({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderAddOn()})},t}(i.PureComponent),k=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onClick=function(e){t.update(!t.props.value),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){return i.createElement("button",{onClick:this.onClick,disabled:this.props.isDisabled},i.createElement(_.Icon,{svg:this.props.value?_.CheckSvg:_.ClearSvg}),this.props.value?"On":"Off")},t}(M),B=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1,isOverPoint:!1,message:t.props.param.defaultValue.length+" points"},t.onHover=function(e){t.setState({isOverPoint:!t.state.isOverPoint}),e?t.setState({message:"("+e[0].toFixed(2)+", "+e[1].toFixed(2)+")"}):t.setState({message:t.props.value.length+" points"})},t.onDrag=function(e){t.setState({message:"("+e[0].toFixed(2)+", "+e[1].toFixed(2)+")"})},t.onChange=function(e){t.props.onChange({name:t.props.name,param:t.props.param,value:e})},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props.param.label||Object(d.a)(this.props.name);return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{label:e,control:i.createElement("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled},""+this.state.message)}),i.createElement("div",{className:"msp-control-offset",style:{display:this.state.isExpanded?"block":"none"}},i.createElement(w,{data:this.props.param.defaultValue,onChange:this.onChange,onHover:this.onHover,onDrag:this.onDrag})))},t}(i.PureComponent),V=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={value:"0"},t.update=function(e){var r=Object(c.b)(t.props.param.step||.01);e=parseFloat(e.toFixed(r)),t.props.onChange({param:t.props.param,name:t.props.name,value:e})},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props.param.label||Object(d.a)(this.props.name),t=this.props.param.label||Object(d.a)(this.props.name),r=Object(c.b)(this.props.param.step||.01);return i.createElement(m.ControlRow,{title:this.props.param.description,label:t,control:i.createElement(m.TextInput,{numeric:!0,value:parseFloat(this.props.value.toFixed(r)),onEnter:this.props.onEnter,placeholder:e,isDisabled:this.props.isDisabled,onChange:this.update})})},t}(i.PureComponent),R=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){t.update(e)},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){var e=void 0===this.props.value?this.props.param.defaultValue:this.props.value;return i.createElement(C.a,{value:e,min:this.props.param.min,max:this.props.param.max,step:this.props.param.step,onChange:this.onChange,onChangeImmediate:this.props.param.immediateUpdate?this.onChange:void 0,disabled:this.props.isDisabled,onEnter:this.props.onEnter})},t}(M),L=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){var r=e.target.value;r!==t.props.value&&t.update(r)},t.onKeyPress=function(e){13!==e.keyCode&&13!==e.charCode&&"Enter"!==e.key||t.props.onEnter&&t.props.onEnter(),e.stopPropagation()},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){var e=this.props.param.label||Object(d.a)(this.props.name);return i.createElement("input",{type:"text",value:this.props.value||"",placeholder:e,onChange:this.onChange,onKeyPress:this.props.onEnter?this.onKeyPress:void 0,disabled:this.props.isDisabled})},t}(M),N=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){"number"==typeof t.props.param.defaultValue?t.update(parseInt(e.target.value,10)):t.update(e.target.value)},t}return Object(n.__extends)(t,e),t.prototype.update=function(e){this.props.onChange({param:this.props.param,name:this.props.name,value:e})},t.prototype.render=function(){var e=this,t=void 0!==this.props.value&&!this.props.param.options.some((function(t){return t[0]===e.props.value}));return i.createElement("select",{className:"msp-form-control",title:this.props.title,value:void 0!==this.props.value?this.props.value:this.props.param.defaultValue,onChange:this.onChange,disabled:this.props.isDisabled},t&&i.createElement("option",{key:this.props.value,value:this.props.value},"[Invalid] "+this.props.value),this.props.param.options.map((function(e){var t=e[0],r=e[1];return i.createElement("option",{key:t,value:t},r)})))},t}(i.PureComponent),F=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showHelp:!1,showOptions:!1},t.onSelect=function(e){e&&e.value!==t.props.value?t.setState({showOptions:!1},(function(){t.props.onChange({param:t.props.param,name:t.props.name,value:e.value})})):t.setState({showOptions:!1})},t.toggle=function(){return t.setState({showOptions:!t.state.showOptions})},t.cycle=function(){var e=t.props.param.options,r=e.findIndex((function(e){return e[0]===t.props.value})),n=r===e.length-1?0:r+1;t.props.onChange({param:t.props.param,name:t.props.name,value:e[n][0]})},t.items=Object(u.b)((function(e){return p.a.createItemsFromSelectOptions(e.options)})),t.toggleHelp=function(){return t.setState({showHelp:!t.state.showHelp})},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){var e,t=this.items(this.props.param),r=void 0!==this.props.value?p.a.findItem(t,this.props.value):void 0,n=r?r.label:void 0===this.props.value?((null===(e=p.a.getFirstItem(t))||void 0===e?void 0:e.label)||"")+" [Default]":"[Invalid] "+this.props.value,a=this.props.param.cycle?this.cycle:this.toggle,o=this.props.param.cycle?"center":"left",s=this.props.param.cycle?"on"===this.props.value?_.CheckSvg:"off"===this.props.value?_.ClearSvg:void 0:void 0;return i.createElement(m.ToggleButton,{disabled:this.props.isDisabled,style:{textAlign:o,overflow:"hidden",textOverflow:"ellipsis"},label:n,title:n,icon:s,toggle:a,isSelected:this.state.showOptions})},t.prototype.renderAddOn=function(){if(!this.state.showOptions)return null;var e=this.items(this.props.param),t=p.a.findItem(e,this.props.value);return i.createElement(p.a,{items:e,current:t,onSelect:this.onSelect})},t.prototype.render=function(){return I({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderAddOn()})},t}(i.PureComponent),U=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showHelp:!1,showOptions:!1},t.onSelect=function(e){e&&e.value!==t.props.value?t.setState({showOptions:!1},(function(){t.props.onChange({param:t.props.param,name:t.props.name,value:{ref:e.value}})})):t.setState({showOptions:!1})},t.toggle=function(){return t.setState({showOptions:!t.state.showOptions})},t.items=Object(u.b)((function(e){return p.a.createItemsFromSelectOptions(e.getOptions())})),t.toggleHelp=function(){return t.setState({showHelp:!t.state.showHelp})},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){var e,t=this.items(this.props.param),r=this.props.value.ref?p.a.findItem(t,this.props.value.ref):void 0,n=r?r.label:"[Ref] "+(null!==(e=this.props.value.ref)&&void 0!==e?e:"");return i.createElement(m.ToggleButton,{disabled:this.props.isDisabled,style:{textAlign:"left",overflow:"hidden",textOverflow:"ellipsis"},label:n,title:n,toggle:this.toggle,isSelected:this.state.showOptions})},t.prototype.renderAddOn=function(){if(!this.state.showOptions)return null;var e=this.items(this.props.param),t=p.a.findItem(e,this.props.value.ref);return i.createElement(p.a,{items:e,current:t,onSelect:this.onSelect})},t.prototype.render=function(){return I({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderAddOn()})},t}(i.PureComponent),z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.components={0:l.ParamDefinition.Numeric(0,{step:t.props.param.step},{label:"Min"}),1:l.ParamDefinition.Numeric(0,{step:t.props.param.step},{label:"Max"})},t.componentChange=function(e){var r=e.name,i=e.value,a=Object(n.__spreadArrays)(t.props.value);a[+r]=i,t.change(a)},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.render=function(){var e=this.props.value,t=this.props.param.label||Object(d.a)(this.props.name),r=Object(c.b)(this.props.param.step||.01),n="["+e[0].toFixed(r)+", "+e[1].toFixed(r)+"]";return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{label:t,control:i.createElement("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled},n)}),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},i.createElement(P,{params:this.components,values:e,onChange:this.componentChange,onEnter:this.props.onEnter})))},t}(i.PureComponent),H=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){t.update(e)},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){return i.createElement(C.b,{value:this.props.value,min:this.props.param.min,max:this.props.param.max,step:this.props.param.step,onChange:this.onChange,disabled:this.props.isDisabled,onEnter:this.props.onEnter})},t}(M),G=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){t.update(Object(o.Color)(parseInt(e.target.value)))},t}return Object(n.__extends)(t,e),t.prototype.stripStyle=function(){return{background:o.Color.toStyle(this.props.value),position:"absolute",bottom:"0",height:"4px",right:"0",left:"0"}},t.prototype.renderControl=function(){return i.createElement("div",{style:{position:"relative"}},i.createElement("select",{value:this.props.value,onChange:this.onChange},(e=this.props.value,y.has(e)?null:i.createElement("option",{key:o.Color.toHexString(e),value:e,style:{background:""+o.Color.toStyle(e)}},o.Color.toRgbString(e))),b||(b=i.createElement(i.Fragment,null,g.map((function(e){return i.createElement("option",{key:e[1],value:e[1],style:{background:""+o.Color.toStyle(e[1])}},Object(d.d)(e[0]))}))))),i.createElement("div",{style:this.stripStyle()}));var e},t}(M);function q(e,t){return void 0===t&&(t=!1),Array.isArray(e)?t?o.Color.toStyle(e[0])+" "+(100*e[1]).toFixed(2)+"%":o.Color.toStyle(e[0]):o.Color.toStyle(e)}var W,X=Object(u.a)((function(e){return"linear-gradient(to right, "+e.map((function(e){return q(e,!0)})).join(", ")+")"})),Y=Object(u.a)((function(e){for(var t=e.length,r=[q(e[0])+" "+1/t*100+"%"],n=1,i=t-1;n<i;++n)r.push(q(e[n])+" "+n/t*100+"%",q(e[n])+" "+(n+1)/t*100+"%");return r.push(q(e[t-1])+" "+(t-1)/t*100+"%"),"linear-gradient(to right, "+r.join(", ")+")"}));function Q(e,t){return void 0===t&&(t="0"),{background:(r=e.colors,n="set"===e.kind,n?Y(r):X(r)),position:"absolute",bottom:"0",height:"4px",right:t,left:"0"};var r,n}function K(){return W||(e=function(e){var t=Object(s.getColorListFromName)(e[0]);return i.createElement("div",{style:Q({kind:"qualitative"!==t.type?"interpolate":"set",colors:t.list})})},W={ColorPresets:{all:p.a.createItemsFromSelectOptions(s.ColorListOptions,{addOn:e}),scale:p.a.createItemsFromSelectOptions(s.ColorListOptionsScale,{addOn:e}),set:p.a.createItemsFromSelectOptions(s.ColorListOptionsSet,{addOn:e})},ColorsParam:l.ParamDefinition.ObjectList({color:l.ParamDefinition.Color(0)},(function(e){var t=e.color;return o.Color.toHexString(t).toUpperCase()})),OffsetColorsParam:l.ParamDefinition.ObjectList({color:l.ParamDefinition.Color(0),offset:l.ParamDefinition.Numeric(0,{min:0,max:1,step:.01})},(function(e){var t=e.color,r=e.offset;return o.Color.toHexString(t).toUpperCase()+" ["+r.toFixed(2)+"]"})),IsInterpolatedParam:l.ParamDefinition.Boolean(!1,{label:"Interpolated"})});var e}var Z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showHelp:!1,show:void 0},t.toggleEdit=function(){return t.setState({show:"edit"===t.state.show?void 0:"edit"})},t.togglePresets=function(){return t.setState({show:"presets"===t.state.show?void 0:"presets"})},t.selectPreset=function(e){if(e){t.setState({show:void 0});var r=Object(s.getColorListFromName)(e.value);t.update({kind:"qualitative"!==r.type?"interpolate":"set",colors:r.list})}},t.colorsChanged=function(e){var r=e.value;t.update({kind:t.props.value.kind,colors:r.map((function(e){return e.color}))})},t.isInterpolatedChanged=function(e){var r=e.value;t.update({kind:r?"interpolate":"set",colors:t.props.value.colors})},t.toggleHelp=function(){return t.setState({showHelp:!t.state.showHelp})},t}return Object(n.__extends)(t,e),t.prototype.update=function(e){this.props.onChange({param:this.props.param,name:this.props.name,value:e})},t.prototype.renderControl=function(){var e=this.props.value;return i.createElement(i.Fragment,null,i.createElement("button",{onClick:this.toggleEdit,style:{position:"relative",paddingRight:"33px"}},1===e.colors.length?"1 color":e.colors.length+" colors",i.createElement("div",{style:Q(e,"33px")})),i.createElement(m.IconButton,{svg:_.BookmarksOutlinedSvg,onClick:this.togglePresets,toggleState:"presets"===this.state.show,title:"Color Presets",style:{padding:0,position:"absolute",right:0,top:0,width:"32px"}}))},t.prototype.renderColors=function(){if(!this.state.show)return null;var e=K(),t=e.ColorPresets,r=e.ColorsParam,n=e.IsInterpolatedParam,a=t[this.props.param.presetKind];if("presets"===this.state.show)return i.createElement(p.a,{items:a,onSelect:this.selectPreset});var o=this.props.value.colors.map((function(e){return{color:e}}));return i.createElement("div",{className:"msp-control-offset"},i.createElement(ce,{name:"colors",param:r,value:o,onChange:this.colorsChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter}),i.createElement(k,{name:"isInterpolated",param:n,value:"interpolate"===this.props.value.kind,onChange:this.isInterpolatedChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter}))},t.prototype.render=function(){return I({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderColors()})},t}(i.PureComponent),J=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showHelp:!1,show:void 0},t.toggleEdit=function(){return t.setState({show:"edit"===t.state.show?void 0:"edit"})},t.togglePresets=function(){return t.setState({show:"presets"===t.state.show?void 0:"presets"})},t.selectPreset=function(e){if(e){t.setState({show:void 0});var r=Object(s.getColorListFromName)(e.value);t.update({kind:"qualitative"!==r.type?"interpolate":"set",colors:r.list})}},t.colorsChanged=function(e){var r=e.value.map((function(e){return[e.color,e.offset]}));r.sort((function(e,t){return e[1]-t[1]})),t.update({kind:t.props.value.kind,colors:r})},t.isInterpolatedChanged=function(e){var r=e.value;t.update({kind:r?"interpolate":"set",colors:t.props.value.colors})},t.toggleHelp=function(){return t.setState({showHelp:!t.state.showHelp})},t}return Object(n.__extends)(t,e),t.prototype.update=function(e){this.props.onChange({param:this.props.param,name:this.props.name,value:e})},t.prototype.renderControl=function(){var e=this.props.value;return i.createElement(i.Fragment,null,i.createElement("button",{onClick:this.toggleEdit,style:{position:"relative",paddingRight:"33px"}},1===e.colors.length?"1 color":e.colors.length+" colors",i.createElement("div",{style:Q(e,"33px")})),i.createElement(m.IconButton,{svg:_.BookmarksOutlinedSvg,onClick:this.togglePresets,toggleState:"presets"===this.state.show,title:"Color Presets",style:{padding:0,position:"absolute",right:0,top:0,width:"32px"}}))},t.prototype.renderColors=function(){if(!this.state.show)return null;var e=K(),t=e.ColorPresets,r=e.OffsetColorsParam,n=e.IsInterpolatedParam,a=t[this.props.param.presetKind];if("presets"===this.state.show)return i.createElement(p.a,{items:a,onSelect:this.selectPreset});var o=this.props.value.colors,s=o.map((function(e,t){return Array.isArray(e)?{color:e[0],offset:e[1]}:{color:e,offset:t/o.length}}));return s.sort((function(e,t){return e.offset-t.offset})),i.createElement("div",{className:"msp-control-offset"},i.createElement(ce,{name:"colors",param:r,value:s,onChange:this.colorsChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter}),i.createElement(k,{name:"isInterpolated",param:n,value:"interpolate"===this.props.value.kind,onChange:this.isInterpolatedChanged,isDisabled:this.props.isDisabled,onEnter:this.props.onEnter}))},t.prototype.render=function(){return I({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:this.renderColors()})},t}(i.PureComponent),$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.components={0:l.ParamDefinition.Numeric(0,{step:t.props.param.step},{label:t.props.param.fieldLabels&&t.props.param.fieldLabels.x||"X"}),1:l.ParamDefinition.Numeric(0,{step:t.props.param.step},{label:t.props.param.fieldLabels&&t.props.param.fieldLabels.y||"Y"}),2:l.ParamDefinition.Numeric(0,{step:t.props.param.step},{label:t.props.param.fieldLabels&&t.props.param.fieldLabels.z||"Z"})},t.componentChange=function(e){var r=e.name,n=e.value,i=a.Vec3.copy(a.Vec3.zero(),t.props.value);i[+r]=n,t.change(i)},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.render=function(){var e=this.props.value,t=this.props.param.label||Object(d.a)(this.props.name),r=Object(c.b)(this.props.param.step||.01),n="["+e[0].toFixed(r)+", "+e[1].toFixed(r)+", "+e[2].toFixed(r)+"]";return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{label:t,control:i.createElement("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled},n)}),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},i.createElement(P,{params:this.components,values:e,onChange:this.componentChange,onEnter:this.props.onEnter})))},t}(i.PureComponent),ee=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.components={json:l.ParamDefinition.Text(JSON.stringify(Object(a.Mat4)()),{description:"JSON array with 4x4 matrix in a column major (j * 4 + i indexing) format"})},t.componentChange=function(e){var r=e.name,n=e.value,i=a.Mat4.copy(Object(a.Mat4)(),t.props.value);"json"===r?a.Mat4.copy(i,JSON.parse(n)):i[+r]=n,t.change(i)},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.changeValue=function(e){var t=this;return function(r){var n=a.Mat4.copy(Object(a.Mat4)(),t.props.value);n[e]=r,t.change(n)}},Object.defineProperty(t.prototype,"grid",{get:function(){for(var e=this.props.value,t=[],r=0;r<4;r++){for(var n=[],o=0;o<4;o++)n.push(i.createElement(m.TextInput,{key:o,numeric:!0,delayMs:50,value:a.Mat4.getValue(e,r,o),onChange:this.changeValue(4*o+r),className:"msp-form-control",blurOnEnter:!0,isDisabled:this.props.isDisabled}));t.push(i.createElement("div",{className:"msp-flex-row",key:r},n))}return i.createElement("div",{className:"msp-parameter-matrix"},t)},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e={json:JSON.stringify(this.props.value)},t=this.props.param.label||Object(d.a)(this.props.name);return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{label:t,control:i.createElement("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled},"4×4 Matrix")}),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},this.grid,i.createElement(P,{params:this.components,values:e,onChange:this.componentChange,onEnter:this.props.onEnter})))},t}(i.PureComponent),te=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){var r=e.target.value;r!==j.Asset.getUrl(t.props.value||"")&&t.update(j.Asset.Url(r))},t.onKeyPress=function(e){13!==e.keyCode&&13!==e.charCode&&"Enter"!==e.key||t.props.onEnter&&t.props.onEnter(),e.stopPropagation()},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){var e=this.props.param.label||Object(d.a)(this.props.name);return i.createElement("input",{type:"text",value:j.Asset.getUrl(this.props.value||""),placeholder:e,onChange:this.onChange,onKeyPress:this.props.onEnter?this.onKeyPress:void 0,disabled:this.props.isDisabled})},t}(M),re=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showHelp:!1},t.onChangeFile=function(e){t.change(e.target.files[0])},t.toggleHelp=function(){return t.setState({showHelp:!t.state.showHelp})},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:j.Asset.File(e)})},t.prototype.renderControl=function(){var e=this.props.value;return i.createElement("div",{className:"msp-btn msp-btn-block msp-btn-action msp-loader-msp-btn-file",style:{marginTop:"1px"}},e?e.name:"Select a file..."," ",i.createElement("input",{disabled:this.props.isDisabled,onChange:this.onChangeFile,type:"file",multiple:!1,accept:this.props.param.accept}))},t.prototype.render=function(){return this.props.param.label?I({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:null}):this.renderControl()},t}(i.PureComponent),ne=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showHelp:!1},t.onChangeFileList=function(e){t.change(e.target.files)},t.toggleHelp=function(){return t.setState({showHelp:!t.state.showHelp})},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){var t=[];if(e)for(var r=0,n=e.length;r<n;++r)t.push(j.Asset.File(e[r]));this.props.onChange({name:this.props.name,param:this.props.param,value:t})},t.prototype.renderControl=function(){var e=this.props.value,t=[];if(e)for(var r=0,n=e;r<n.length;r++){var a=n[r];t.push(a.name)}var o=0===t.length?"Select files...":1===t.length?t[0]:t.length+" files selected";return i.createElement("div",{className:"msp-btn msp-btn-block msp-btn-action msp-loader-msp-btn-file",style:{marginTop:"1px"}},o," ",i.createElement("input",{disabled:this.props.isDisabled,onChange:this.onChangeFileList,type:"file",multiple:!0,accept:this.props.param.accept}))},t.prototype.render=function(){return this.props.param.label?I({props:this.props,state:this.state,control:this.renderControl(),toggleHelp:this.toggleHelp,addOn:null}):this.renderControl()},t}(i.PureComponent),ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.toggle=function(e){var t=this;return function(r){t.props.value.indexOf(e)<0?t.change(t.props.value.concat(e)):t.change(t.props.value.filter((function(t){return t!==e}))),r.currentTarget.blur()}},t.prototype.render=function(){var e=this,t=this.props.value,r=this.props.param.emptyValue,n=this.props.param.label||Object(d.a)(this.props.name);return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{label:n,control:i.createElement("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled},0===t.length&&r?r:t.length+" of "+this.props.param.options.length)}),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},this.props.param.options.map((function(r){var n=r[0],a=r[1],o=t.indexOf(n)>=0;return i.createElement(m.Button,{key:n,onClick:e.toggle(n),disabled:e.props.isDisabled,style:{marginTop:"1px"}},i.createElement("span",{style:{float:o?"left":"right"}},o?"✓ "+a:a+" ✗"))}))))},t}(i.PureComponent),ae=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!!t.props.param.isExpanded,showHelp:!1},t.onChangeParam=function(e){var r;t.change(Object(n.__assign)(Object(n.__assign)({},t.props.value),((r={})[e.name]=e.value,r)))},t.toggleExpanded=function(){return t.setState({isExpanded:!t.state.isExpanded})},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.pivoted=function(){var e=this.props.param.pivot,t=this.props.param.params,r=t[e],n=D(r),a=i.createElement(n,{name:e,param:r,value:this.props.value[e],onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled});if(!this.state.isExpanded)return i.createElement("div",{className:"msp-mapped-parameter-group"},a,i.createElement(m.IconButton,{svg:_.MoreHorizSvg,onClick:this.toggleExpanded,toggleState:this.state.isExpanded,title:"More Options"}));for(var o=Object.create(null),s=0,u=Object.keys(t);s<u.length;s++){var c=u[s];c!==e&&(o[c]=t[c])}return i.createElement("div",{className:"msp-mapped-parameter-group"},a,i.createElement(m.IconButton,{svg:_.MoreHorizSvg,onClick:this.toggleExpanded,toggleState:this.state.isExpanded,title:"More Options"}),i.createElement("div",{className:"msp-control-offset"},i.createElement(P,{params:o,onEnter:this.props.onEnter,values:this.props.value,onChange:this.onChangeParam,isDisabled:this.props.isDisabled})))},t.prototype.render=function(){var e=this.props.param.params;if(0===Object.keys(e).length)return null;if(this.props.param.pivot)return this.pivoted();var t=this.props.param.label||Object(d.a)(this.props.name),r=i.createElement(P,{params:e,onChange:this.onChangeParam,values:this.props.value,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled});return this.props.inMapped?i.createElement("div",{className:"msp-control-offset"},r):this.props.param.isFlat?r:i.createElement("div",{className:"msp-control-group-wrapper"},i.createElement("div",{className:"msp-control-group-header"},i.createElement("button",{className:"msp-btn msp-form-control msp-btn-block",onClick:this.toggleExpanded},i.createElement(_.Icon,{svg:this.state.isExpanded?_.ArrowDropDownSvg:_.ArrowRightSvg}),t)),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},r))},t}(i.PureComponent),oe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.valuesCache={},t.onChangeName=function(e){t.change({name:e.value,params:t.getValues(e.value)})},t.onChangeParam=function(e){t.setValues(t.props.value.name,e.value),t.change({name:t.props.value.name,params:e.value})},t.toggleExpanded=function(){return t.setState({isExpanded:!t.state.isExpanded})},t}return Object(n.__extends)(t,e),t.prototype.setValues=function(e,t){this.valuesCache[e]=t},t.prototype.getValues=function(e){return e in this.valuesCache?this.valuesCache[e]:this.props.param.map(e).defaultValue},t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.areParamsEmpty=function(e){for(var t=0,r=Object.keys(e);t<r.length;t++){if(!e[r[t]].isHidden)return!1}return!0},t.prototype.render=function(){var e=this,t=this.props.value||this.props.param.defaultValue,r=this.props.param.map(t.name),a=this.props.param.label||Object(d.a)(this.props.name),o=D(r),s=this.props.param.help,u=s?Object(n.__assign)(Object(n.__assign)({},this.props.param.select),{help:function(t){return s({name:t,params:e.getValues(t)})}}):this.props.param.select,c=i.createElement(F,{param:u,isDisabled:this.props.isDisabled,onChange:this.onChangeName,onEnter:this.props.onEnter,name:a,value:t.name});return o?"group"!==r.type||r.isFlat?i.createElement(i.Fragment,null,c,i.createElement(o,{param:r,value:t.params,name:t.name,onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled})):this.areParamsEmpty(r.params)?c:i.createElement("div",{className:"msp-mapped-parameter-group"},c,i.createElement(m.IconButton,{svg:_.MoreHorizSvg,onClick:this.toggleExpanded,toggleState:this.state.isExpanded,title:a+" Properties"}),this.state.isExpanded&&i.createElement(ae,{inMapped:!0,param:r,value:t.params,name:t.name,onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled})):c},t}(i.PureComponent),se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={current:t.props.value},t.onChangeParam=function(e){var r;t.setState({current:Object(n.__assign)(Object(n.__assign)({},t.state.current),(r={},r[e.name]=e.value,r))})},t.apply=function(){t.props.apply(t.state.current)},t}return Object(n.__extends)(t,e),t.prototype.componentDidUpdate=function(e){this.props.params===e.params&&this.props.value===e.value||this.setState({current:this.props.value})},t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement(P,{params:this.props.params,onChange:this.onChangeParam,values:this.state.current,onEnter:this.apply,isDisabled:this.props.isDisabled}),i.createElement("button",{className:"msp-btn msp-btn-block msp-form-control msp-control-top-offset",onClick:this.apply,disabled:this.props.isDisabled},this.props.isUpdate?"Update":"Add"))},t}(i.PureComponent),ue=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.update=function(e){t.props.actions.update(e,t.props.index)},t.moveUp=function(){t.props.actions.move(t.props.index,-1)},t.moveDown=function(){t.props.actions.move(t.props.index,1)},t.remove=function(){t.setState({isExpanded:!1}),t.props.actions.remove(t.props.index)},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-param-object-list-item"},i.createElement("button",{className:"msp-btn msp-btn-block msp-form-control",onClick:this.toggleExpanded},i.createElement("span",null,this.props.index+1+": "),this.props.param.getLabel(this.props.value)),i.createElement("div",null,i.createElement(m.IconButton,{svg:_.ArrowDownwardSvg,title:"Move Up",onClick:this.moveUp,small:!0}),i.createElement(m.IconButton,{svg:_.ArrowUpwardSvg,title:"Move Down",onClick:this.moveDown,small:!0}),i.createElement(m.IconButton,{svg:_.DeleteOutlinedSvg,title:"Remove",onClick:this.remove,small:!0}))),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},i.createElement(se,{params:this.props.param.element,apply:this.update,value:this.props.value,isUpdate:!0,isDisabled:this.props.isDisabled})))},t}(i.PureComponent),ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isExpanded:!1},t.add=function(e){t.change(Object(n.__spreadArrays)(t.props.value,[e]))},t.actions={update:function(e,r){var n=t.props.value.slice(0);n[r]=e,t.change(n)},move:function(e,r){var n=t.props.value;if(1!==n.length){var i=(e+r)%n.length;i<0&&(i+=n.length);var a=(n=n.slice(0))[e];n[e]=n[i],n[i]=a,t.change(n)}},remove:function(e){for(var r=t.props.value,n=[],i=0;i<r.length;i++)e!==i&&n.push(r[i]);t.change(n)}},t.toggleExpanded=function(e){t.setState({isExpanded:!t.state.isExpanded}),e.currentTarget.blur()},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.render=function(){var e=this,t=this.props.value,r=this.props.param.label||Object(d.a)(this.props.name),n=t.length+" item"+(1!==t.length?"s":"");return i.createElement(i.Fragment,null,i.createElement(m.ControlRow,{label:r,control:i.createElement("button",{onClick:this.toggleExpanded,disabled:this.props.isDisabled},n)}),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset"},this.props.value.map((function(t,r){return i.createElement(ue,{key:r,param:e.props.param,value:t,index:r,actions:e.actions,isDisabled:e.props.isDisabled})})),i.createElement(m.ControlGroup,{header:"New Item"},i.createElement(se,{params:this.props.param.element,apply:this.add,value:this.props.param.ctor(),isDisabled:this.props.isDisabled}))))},t}(i.PureComponent),le=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChangeCondition=function(e){t.change(t.props.param.conditionedValue(t.props.value,e.value))},t.onChangeParam=function(e){t.change(e.value)},t}return Object(n.__extends)(t,e),t.prototype.change=function(e){this.props.onChange({name:this.props.name,param:this.props.param,value:e})},t.prototype.render=function(){var e=this.props.value,t=this.props.param.conditionForValue(e),r=this.props.param.conditionParams[t],n=this.props.param.label||Object(d.a)(this.props.name),a=D(r),o=i.createElement(F,{param:this.props.param.select,isDisabled:this.props.isDisabled,onChange:this.onChangeCondition,onEnter:this.props.onEnter,name:n+" Kind",value:t});return a?i.createElement(i.Fragment,null,o,i.createElement(a,{param:r,value:e,name:n,onChange:this.onChangeParam,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled})):o},t}(i.PureComponent),de=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){t.props.onChange({name:t.props.name,param:t.props.param,value:t.props.param.toValue(e.value)})},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props.param.fromValue(this.props.value),t=D(this.props.param.converted);return t?i.createElement(t,{param:this.props.param.converted,value:e,name:this.props.name,onChange:this.onChange,onEnter:this.props.onEnter,isDisabled:this.props.isDisabled}):null},t}(i.PureComponent),fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){var r=e.target.value;r!==t.props.value.expression&&t.update({language:t.props.value.language,expression:r})},t.onKeyPress=function(e){13!==e.keyCode&&13!==e.charCode&&"Enter"!==e.key||t.props.onEnter&&t.props.onEnter(),e.stopPropagation()},t}return Object(n.__extends)(t,e),t.prototype.renderControl=function(){var e=this.props.param.label||Object(d.a)(this.props.name);return i.createElement("input",{type:"text",value:this.props.value.expression||"",placeholder:e,onChange:this.onChange,onKeyPress:this.props.onEnter?this.onKeyPress:void 0,disabled:this.props.isDisabled})},t}(M)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return m}));var n,i=r(17),a=r(26),o=r(175),s=r(95),u=r(287),c=r(7),l=r(218),d=r(332),f=r(219),p=r(273);function m(e){var t=n.fromFrame(e);return i.b.create("Create mmCIF Model",(function(e){return Object(o.a)(t.data.db,t,e)}))}s.a.Provider.formatRegistry.add("mmCIF",(function(e){if(n.is(e.sourceData))return s.a.fromData(e.sourceData.data.db)})),u.a.Provider.formatRegistry.add("mmCIF",(function(e){if(n.is(e.sourceData)){var t=e.sourceData.data.db,r=t.struct_conf,i=t.struct_sheet_range;return u.a.fromStruct(r,i,e.atomicHierarchy)}})),l.a.Provider.formatRegistry.add("mmCIF",(function(e){if(n.is(e.sourceData)){var t=e.sourceData.data.db.atom_site_anisotrop;return{data:c.d.ofColumns(l.a.Schema,t),elementToAnsiotrop:l.a.getElementToAnsiotrop(e.atomicConformation.atomId,t.id)}}}),(function(e){return!!n.is(e.sourceData)&&e.sourceData.data.db.atom_site_anisotrop.U.isDefined})),d.a.Provider.formatRegistry.add("mmCIF",(function(e){if(n.is(e.sourceData)){var t=e.sourceData.data.db.chem_comp_bond;if(0!==t._rowCount)return{data:t,entries:d.a.getEntriesFromChemCompBond(t)}}})),f.a.Provider.formatRegistry.add("mmCIF",(function(e){if(n.is(e.sourceData)){var t=e.sourceData.data.db.struct_conn;if(0!==t._rowCount){var r=f.a.getEntriesFromStructConn(t,e);return{data:t,byAtomIndex:f.a.getAtomIndexFromEntries(r),entries:r}}}})),p.a.Provider.formatRegistry.add("mmCIF",p.a.fromMmCif,p.a.hasData),function(e){e.is=function(e){return"mmCIF"===(null==e?void 0:e.kind)},e.fromFrame=function(e,t,r){return t||(t=a.a.schema.mmCIF(e)),{kind:"mmCIF",name:t._name,data:{db:t,frame:e,source:r}}}}(n||(n={}))},function(e,t,r){"use strict";(function(e){r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return i}));var n=function(){if("undefined"!=typeof window&&window.performance){var t=window.performance;return function(){return t.now()}}return void 0!==e&&"undefined"!==e.hrtime&&"function"==typeof e.hrtime?function(){var t=e.hrtime();return 1e3*t[0]+t[1]/1e6}:Date.now?function(){return Date.now()}:function(){return+new Date}}();function i(e,t){if(void 0===t&&(t=!0),isNaN(e))return"n/a";for(var r=Math.floor(e/36e5),n=Math.floor(e/6e4%60),i=Math.floor(e/1e3%60),a=Math.floor(e%1e3).toString();a.length<3;)a="0"+a;for(;!t&&a.length>1&&"0"===a[a.length-1];)a=a.substr(0,a.length-1);return r>0?r+"h"+n+"m"+i+"."+a+"s":n>0?n+"m"+i+"."+a+"s":i>0?i+"."+a+"s":e.toFixed(0)+"ms"}}).call(this,r(344))},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(104),i=r(309),a=r(223),o=r(286),s=function(){function e(e){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,e&&(this._ctorUnsubscribe=!0,this._unsubscribe=e)}var t;return e.prototype.unsubscribe=function(){var t;if(!this.closed){var r=this._parentOrParents,s=this._ctorUnsubscribe,c=this._unsubscribe,l=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,r instanceof e)r.remove(this);else if(null!==r)for(var d=0;d<r.length;++d){r[d].remove(this)}if(Object(a.a)(c)){s&&(this._unsubscribe=void 0);try{c.call(this)}catch(e){t=e instanceof o.a?u(e.errors):[e]}}if(Object(n.a)(l)){d=-1;for(var f=l.length;++d<f;){var p=l[d];if(Object(i.a)(p))try{p.unsubscribe()}catch(e){t=t||[],e instanceof o.a?t=t.concat(u(e.errors)):t.push(e)}}}if(t)throw new o.a(t)}},e.prototype.add=function(t){var r=t;if(!t)return e.EMPTY;switch(typeof t){case"function":r=new e(t);case"object":if(r===this||r.closed||"function"!=typeof r.unsubscribe)return r;if(this.closed)return r.unsubscribe(),r;if(!(r instanceof e)){var n=r;(r=new e)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+t+" added to Subscription.")}var i=r._parentOrParents;if(null===i)r._parentOrParents=this;else if(i instanceof e){if(i===this)return r;r._parentOrParents=[i,this]}else{if(-1!==i.indexOf(this))return r;i.push(this)}var a=this._subscriptions;return null===a?this._subscriptions=[r]:a.push(r),r},e.prototype.remove=function(e){var t=this._subscriptions;if(t){var r=t.indexOf(e);-1!==r&&t.splice(r,1)}},e.EMPTY=((t=new e).closed=!0,t),e}();function u(e){return e.reduce((function(e,t){return e.concat(t instanceof o.a?t.errors:t)}),[])}},function(e,t,r){"use strict";r.r(t),r.d(t,"DefaultLabelOptions",(function(){return d})),r.d(t,"lociLabel",(function(){return f})),r.d(t,"structureElementStatsLabel",(function(){return h})),r.d(t,"bondLabel",(function(){return g})),r.d(t,"bundleLabel",(function(){return v})),r.d(t,"_bundleLabel",(function(){return b})),r.d(t,"elementLabel",(function(){return y})),r.d(t,"distanceLabel",(function(){return S})),r.d(t,"angleLabel",(function(){return x})),r.d(t,"dihedralLabel",(function(){return O}));var n=r(0),i=r(4),a=r(23),o=r(6),s=r(42),u=r(1),c=r(44),l=r(36),d={granularity:"element",condensed:!1,reverse:!1,countsOnly:!1,hidePrefix:!1,htmlStyling:!0};function f(e,t){switch(void 0===t&&(t={}),e.kind){case"structure-loci":return e.structure.models.map((function(e){return e.entry})).filter((function(e){return!!e})).join(", ");case"element-loci":return h(i.StructureElement.Stats.ofLoci(e),t);case"bond-loci":var r=e.bonds[0];return r?g(r):"";case"shape-loci":return e.shape.name;case"group-loci":var n=e.groups[0];return n?e.shape.getLabel(o.OrderedSet.start(n.ids),n.instance):"";case"every-loci":return"Everything";case"empty-loci":return"Nothing";case"data-loci":return e.getLabel();case"volume-loci":return e.volume.label||"Volume";case"isosurface-loci":return[""+(e.volume.label||"Volume"),"Isosurface at "+l.b.IsoValue.toString(e.isoValue)].join(" | ");case"cell-loci":var a=o.OrderedSet.size(e.indices),s=o.OrderedSet.start(e.indices),u=l.b.IsoValue.absolute(e.volume.grid.cells.data[s]),c=l.b.IsoValue.toRelative(u,e.volume.grid.stats),d=[""+(e.volume.label||"Volume"),1===a?"Cell #"+s:a+" Cells"];return 1===a&&d.push(l.b.IsoValue.toString(u)+" ("+l.b.IsoValue.toString(c)+")"),d.join(" | ")}}function p(e,t){return 1===e?"1 "+t:e+" "+t+"s"}function m(e,t,r,n,i,a){return y(t,{granularity:r,hidePrefix:n,reverse:i,condensed:a})+" <small>[+ "+p(e-1,"other "+Object(s.b)(r))+"]</small>"}function h(e,t){void 0===t&&(t={});var r=Object(n.__assign)(Object(n.__assign)({},d),t),a=function(e,t,r,n,a){void 0===t&&(t=!1);void 0===r&&(r=!1);void 0===n&&(n=!1);void 0===a&&(a=!1);var o=e.structureCount,s=e.chainCount,u=e.residueCount,c=e.conformationCount,l=e.elementCount;if(t||1!==l||0!==u||0!==s){if(t||0!==l||1!==u||0!==s){if(t||0!==l||0!==u||1!==s){if(t){d=[];return o>0&&d.push(p(o,"Structure")),s>0&&d.push(p(s,"Chain")),u>0&&d.push(p(u,"Residue")),c>0&&d.push(p(c,"Conformation")),l>0&&d.push(p(l,"Element")),d.join("<small> + </small>")}var d=[];return o>0&&d.push(1===o?y(e.firstStructureLoc,{hidePrefix:r,condensed:n,granularity:"structure",reverse:a}):m(o,e.firstStructureLoc,"structure",r,a,n)),s>0&&(d.push(1===s?y(e.firstChainLoc,{condensed:n,granularity:"chain",hidePrefix:r,reverse:a}):m(s,e.firstChainLoc,"chain",r,a,n)),r=!0),u>0&&(d.push(1===u?y(e.firstResidueLoc,{condensed:n,granularity:"residue",hidePrefix:r,reverse:a}):m(u,e.firstResidueLoc,"residue",r,a,n)),r=!0),c>0&&(d.push(1===c?y(e.firstConformationLoc,{condensed:n,granularity:"conformation",hidePrefix:r,reverse:a}):m(c,e.firstConformationLoc,"conformation",r,a,n)),r=!0),l>0&&d.push(1===l?y(e.firstElementLoc,{condensed:n,granularity:"element",hidePrefix:r,reverse:a}):m(l,e.firstElementLoc,"element",r,a,n)),d.join("<small> + </small>")}var f=e.firstChainLoc.unit,h=i.Unit.isAtomic(f)&&1===function(e){var t=e.elements,r=e.model.atomicHierarchy,n=r.chainAtomSegments,i=r.residueAtomSegments,a=n.offsets[n.index[t[0]]],o=n.offsets[n.index[t[t.length-1]]+1]-1;return i.index[o]-i.index[a]+1}(f)||i.Unit.Traits.is(f.traits,1)?"residue":"chain";return y(e.firstChainLoc,{hidePrefix:r,condensed:n,granularity:h,reverse:a})}return y(e.firstResidueLoc,{hidePrefix:r,condensed:n,granularity:"residue",reverse:a})}return y(e.firstElementLoc,{hidePrefix:r,condensed:n,granularity:"element",reverse:a})}(e,r.countsOnly,r.hidePrefix,r.condensed,r.reverse);return r.htmlStyling?a:Object(s.e)(a)}function g(e,t){return void 0===t&&(t={}),v({loci:[i.StructureElement.Loci(e.aStructure,[{unit:e.aUnit,indices:o.OrderedSet.ofSingleton(e.aIndex)}]),i.StructureElement.Loci(e.bStructure,[{unit:e.bUnit,indices:o.OrderedSet.ofSingleton(e.bIndex)}])]},t)}function v(e,t){void 0===t&&(t={});var r=Object(n.__assign)(Object(n.__assign)({},d),t),i=b(e,r);return r.htmlStyling?i:Object(s.e)(i)}function b(e,t){for(var r=t.granularity,n=t.hidePrefix,a=t.reverse,s=t.condensed,u=!0,c=0,l=e.loci;c<l.length;c++){var d=l[c];if(!i.StructureElement.Loci.is(d)||1!==i.StructureElement.Loci.size(d)){u=!1;break}}if(u){var p=e.loci.map((function(e){var t=e.elements[0],r=t.unit,n=t.indices;return i.StructureElement.Location.create(e.structure,r,r.elements[o.OrderedSet.start(n)])})).map((function(e){return _(e,r,n,a||s)}));if(s)return p.map((function(e){return e[0].replace(/\[.*\]/g,"").trim()})).filter((function(e){return!!e})).join(" — ");for(var m=0,h=0,g=Math.min.apply(Math,p.map((function(e){return e.length})))-1;h<g;++h){for(var v=!0,b=1,y=p.length;b<y;++b)if(p[0][h]!==p[b][h]){v=!1;break}if(!v)break;m+=1}if(m>0){var S=[p[0].join(" | ")];for(b=1,y=p.length;b<y;++b)S.push(p[b].slice(m).filter((function(e){return!!e})).join(" | "));return S.join(" — ")}return p.map((function(e){return e.filter((function(e){return!!e})).join(" | ")})).filter((function(e){return!!e})).join("</br>")}return(p=e.loci.map((function(e){return f(e,t)}))).filter((function(e){return!!e})).join(s?" — ":"</br>")}function y(e,t){var r,i;void 0===t&&(t={});var a=Object(n.__assign)(Object(n.__assign)({},d),t),o=_(e,a.granularity,a.hidePrefix,a.reverse||a.condensed),u=a.condensed?null!==(i=null===(r=o[0])||void 0===r?void 0:r.replace(/\[.*\]/g,"").trim())&&void 0!==i?i:"":o.filter((function(e){return!!e})).join(" | ");return a.htmlStyling?u:Object(s.e)(u)}function _(e,t,r,n){void 0===t&&(t="element"),void 0===r&&(r=!1),void 0===n&&(n=!1);var a=[];if(!r){var o=e.unit.model.entry;o.length>30&&(o=o.substr(0,27)+"…"),a.push("<small>"+o+"</small>"),"structure"!==t&&(a.push("<small>Model "+e.unit.model.modelNum+"</small>"),a.push("<small>Instance "+e.unit.conformation.operator.name+"</small>"))}return i.Unit.isAtomic(e.unit)?a.push.apply(a,function(e,t,r){void 0===r&&(r=!1);var n=i.StructureElement.Location.residueIndex(e),a=i.StructureProperties.chain.label_asym_id(e),o=i.StructureProperties.chain.auth_asym_id(e),s=0===e.unit.model.atomicHierarchy.residues.label_seq_id.valueKind(n),u=i.StructureProperties.residue.label_seq_id(e),c=i.StructureProperties.residue.auth_seq_id(e),l=i.StructureProperties.residue.pdbx_PDB_ins_code(e),d=i.StructureProperties.atom.label_comp_id(e),f=i.StructureProperties.atom.label_atom_id(e),p=i.StructureProperties.atom.label_alt_id(e),m=i.StructureProperties.atom.occupancy(e),h=i.StructureProperties.residue.microheterogeneityCompIds(e),g="residue"===t&&h.length>1?"("+h.join("|")+")":d,v=[];switch(t){case"element":v.push("<b>"+f+"</b>"+(p?"%"+p:""));case"conformation":"conformation"===t&&p&&v.push("<small>Conformation</small> <b>"+p+"</b>");case"residue":var b=u!==c&&s?u:c;v.push("<b>"+g+" "+b+"</b>"+(b!==c?" <small>[auth</small> <b>"+c+"</b><small>]</small>":"")+"<b>"+(l||"")+"</b>");case"chain":a===o?v.push("<b>"+a+"</b>"):"chain"===t&&i.Unit.Traits.is(e.unit.traits,1)?v.push("<small>[auth</small> <b>"+o+"</b><small>]</small>"):v.push("<b>"+a+"</b> <small>[auth</small> <b>"+o+"</b><small>]</small>")}v.length>0&&1!==m&&!r&&(v[0]=v[0]+" <small>[occupancy</small> <b>"+Math.round(100*m)/100+"</b><small>]</small>");return v.reverse()}(e,t,n)):i.Unit.isCoarse(e.unit)?a.push.apply(a,function(e,t){var r=i.StructureProperties.coarse.asym_id(e),n=i.StructureProperties.coarse.seq_id_begin(e),a=i.StructureProperties.coarse.seq_id_end(e),o=[];switch(t){case"element":case"conformation":case"residue":if(n===a){var s=i.StructureProperties.coarse.entityKey(e),u=e.unit.model.sequence.byEntityKey[s].sequence.compId.value(n-1);o.push("<b>"+u+" "+n+"</b>")}else o.push("<b>"+n+"-"+a+"</b>");case"chain":o.push("<b>"+r+"</b>")}return o.reverse()}(e,t)):a.push("Unknown"),n?a.reverse():a}function S(e,t){void 0===t&&(t={});var r=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},d),{measureOnly:!1,unitLabel:"Å"}),t),i=e.loci.map((function(e){return a.Loci.getCenter(e)})),o=i[0],s=i[1],c=u.Vec3.distance(o,s).toFixed(2)+" "+r.unitLabel;if(r.measureOnly)return c;var l=v(e,r);return r.condensed?c+" | "+l:"Distance "+c+"</br>"+l}function x(e,t){void 0===t&&(t={});var r=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},d),{measureOnly:!1}),t),i=e.loci.map((function(e){return a.Loci.getCenter(e)})),o=i[0],s=i[1],l=i[2],f=u.Vec3.sub(Object(u.Vec3)(),o,s),p=u.Vec3.sub(Object(u.Vec3)(),l,s),m=Object(c.f)(u.Vec3.angle(f,p)).toFixed(2)+"°";if(r.measureOnly)return m;var h=v(e,r);return r.condensed?m+" | "+h:"Angle "+m+"</br>"+h}function O(e,t){void 0===t&&(t={});var r=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},d),{measureOnly:!1}),t),i=e.loci.map((function(e){return a.Loci.getCenter(e)})),o=i[0],s=i[1],l=i[2],f=i[3],p=Object(c.f)(u.Vec3.dihedralAngle(o,s,l,f)).toFixed(2)+"°";if(r.measureOnly)return p;var m=v(e,r);return r.condensed?p+" | "+m:"Dihedral "+p+"</br>"+m}},function(e,t,r){"use strict";r.r(t),r.d(t,"PluginConfigItem",(function(){return i})),r.d(t,"PluginConfig",(function(){return o})),r.d(t,"PluginConfigManager",(function(){return s}));var n=r(4),i=function(){function e(e,t){this.key=e,this.defaultValue=t}return e.prototype.toString=function(){return this.key},e.prototype.valueOf=function(){return this.key},e}();function a(e,t){return new i(e,t)}var o={item:a,General:{IsBusyTimeoutMs:a("plugin-config.is-busy-timeout",750),DisableAntialiasing:a("plugin-config.disable-antialiasing",!1),DisablePreserveDrawingBuffer:a("plugin-config.disable-preserve-drawing-buffer",!1),PixelScale:a("plugin-config.pixel-scale",1),PickScale:a("plugin-config.pick-scale",.25),EnableWboit:a("plugin-config.enable-wboit",!0)},State:{DefaultServer:a("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),CurrentServer:a("plugin-state.server","https://webchem.ncbr.muni.cz/molstar-state"),HistoryCapacity:a("history-capacity.server",5)},VolumeStreaming:{Enabled:a("volume-streaming.enabled",!0),DefaultServer:a("volume-streaming.server","https://ds.litemol.org"),CanStream:a("volume-streaming.can-stream",(function(e,t){return 1===e.models.length&&n.Model.probablyHasDensityMap(e.models[0])})),EmdbHeaderServer:a("volume-streaming.emdb-header-server","https://ftp.wwpdb.org/pub/emdb/structures")},Viewport:{ShowExpand:a("viewer.show-expand-button",!0),ShowControls:a("viewer.show-controls-button",!0),ShowSettings:a("viewer.show-settings-button",!0),ShowSelectionMode:a("viewer.show-selection-model-button",!0),ShowAnimation:a("viewer.show-animation-button",!0)},Download:{DefaultPdbProvider:a("download.default-pdb-provider","pdbe"),DefaultEmdbProvider:a("download.default-emdb-provider","pdbe")},Structure:{SizeThresholds:a("structure.size-thresholds",n.Structure.DefaultSizeThresholds),DefaultRepresentationPresetParams:a("structure.default-representation-preset-params",{})}},s=function(){function e(e){var t=this;this._config=new Map,e&&e.forEach((function(e){var r=e[0],n=e[1];return t._config.set(r,n)}))}return e.prototype.get=function(e){return this._config.has(e)?this._config.get(e):e.defaultValue},e.prototype.set=function(e,t){this._config.set(e,t)},e.prototype.delete=function(e){this._config.delete(e)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(8),o=r(13),s=r(17),u=r(2),c=r(5);!function(e){var t=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.__extends)(t,e),t}(a.a.Create({name:"Root",typeClass:"Root"}));e.Root=t;var r=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.__extends)(t,e),t}(a.a.Create({name:"Category",typeClass:"Object"}));e.Category=r;var n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.__extends)(t,e),t}(a.a.CreateBehavior({name:"Behavior"}));e.Behavior=n,e.Categories={common:"Common",representation:"Representation",interaction:"Interaction","custom-props":"Custom Properties",misc:"Miscellaneous"},e.CreateCategory=a.b.BuiltIn({name:"create-behavior-category",display:{name:"Behavior Category"},from:t,to:r,params:{label:u.ParamDefinition.Text("",{isHidden:!0})}})({apply:function(e){var t=e.params;return new r({},{label:t.label})}});var l=new Map;e.getCategoryId=function(e){return l.get(e.id)},e.create=function(e){var r=a.b.CreateBuiltIn({name:e.name,display:e.display,from:[t],to:[n],params:e.params,apply:function(t,r){var i=t.params,a=e.label?e.label(i):{label:e.display.name,description:e.display.description};return new n(new e.ctor(r,i),a)},update:function(e){var t=this,r=e.b,n=e.newParams;return s.b.create("Update Behavior",(function(){return Object(i.__awaiter)(t,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){switch(e.label){case 0:return r.data.update?[4,r.data.update(n)]:[2,o.StateTransformer.UpdateResult.Unchanged];case 1:return[2,e.sent()?o.StateTransformer.UpdateResult.Updated:o.StateTransformer.UpdateResult.Unchanged]}}))}))}))},canAutoUpdate:e.canAutoUpdate});return l.set(r.id,e.category),r},e.simpleCommandHandler=function(e,t){return function(){function r(e){this.ctx=e,this.sub=void 0}return r.prototype.register=function(){var r=this;this.sub=e.subscribe(this.ctx,(function(e){return t(e,r.ctx)}))},r.prototype.unregister=function(){this.sub&&this.sub.unsubscribe(),this.sub=void 0},r}()};var d=function(){function e(e,t){this.ctx=e,this.params=t,this.subs=[]}return e.prototype.subscribeCommand=function(e,t){this.subs.push(e.subscribe(this.ctx,t))},e.prototype.subscribeObservable=function(e,t){this.subs.push(e.subscribe(t))},e.prototype.track=function(e){this.subs.push(e)},e.prototype.unregister=function(){for(var e=0,t=this.subs;e<t.length;e++){t[e].unsubscribe()}this.subs=[]},e.prototype.update=function(e){return!Object(c.l)(e,this.params)&&(this.params=e,!0)},e}();e.Handler=d;var f=function(){function e(e,t){this.plugin=e,this.params=t,this.subs=[]}return e.prototype.subscribeCommand=function(e,t){this.subs.push(e.subscribe(this.plugin,t))},e.prototype.subscribeObservable=function(e,t){this.subs.push(e.subscribe(t))},e.prototype.unregister=function(){for(var e=0,t=this.subs;e<t.length;e++){t[e].unsubscribe()}this.subs=[]},e}();e.WithSubscribers=f}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(5),o=r(1),s=r(122),u=r(115),c=r(124),l=r(132),d=r(53),f=r(170),p=r(2),m=r(52),h=r(9),g=r(30),v=r(129),b=r(130),y=r(12),_=r(136);!function(e){function t(e,t,r,i,o,u,c){return c?function(e,t,r,n,i,o,s){o>s.lineCount&&(a.e.update(s.mappingBuffer,e),a.e.update(s.indexBuffer,t));return s.lineCount=o,a.e.update(s.groupBuffer,r),a.e.update(s.startBuffer,n),a.e.update(s.endBuffer,i),s}(e,t,r,i,o,u,c):function(e,t,r,i,o,u){var c,l=Object(h.g)(),d=-1,f=-1,p={kind:"lines",lineCount:u,mappingBuffer:a.e.create(e),indexBuffer:a.e.create(t),groupBuffer:a.e.create(r),startBuffer:a.e.create(i),endBuffer:a.e.create(o),get boundingSphere(){var e=n(p);if(e!==d){var t=Object(m.a)(p.startBuffer.ref.value,4*p.lineCount,4),r=Object(m.a)(p.endBuffer.ref.value,4*p.lineCount,4);h.g.expandBySphere(l,t,r),d=e}return l},get groupMapping(){return p.groupBuffer.ref.version!==f&&(c=Object(s.c)(p.groupBuffer.ref.value,p.lineCount,4),f=p.groupBuffer.ref.version),c},setBoundingSphere:function(e){h.g.copy(l,e),d=n(p)}};return p}(e,t,r,i,o,u)}function r(e){return t(e?e.mappingBuffer.ref.value:new Float32Array(0),e?e.indexBuffer.ref.value:new Uint32Array(0),e?e.groupBuffer.ref.value:new Float32Array(0),e?e.startBuffer.ref.value:new Float32Array(0),e?e.endBuffer.ref.value:new Float32Array(0),0,e)}function n(e){return Object(y.l)([e.lineCount,e.mappingBuffer.ref.version,e.indexBuffer.ref.version,e.groupBuffer.ref.version,e.startBuffer.ref.version,e.endBuffer.ref.version])}function S(e,t){var r=4*e.lineCount,n=t.instanceCount.ref.value,i=Object(d.b)(),a=i.position,s=e.startBuffer.ref.value,u=e.endBuffer.ref.value,c=t.aTransform.ref.value;return Object(d.a)(r,n,2,(function(e,t){var r=e%4==0?s:u;return t<0?o.Vec3.fromArray(a,r,3*e):o.Vec3.transformMat4Offset(a,r,c,0,3*e,16*t),i}))}function x(e,t,r,n,s){var d=r.instanceCount,f=r.groupCount,p=S(e,t),y=Object(u.a)(r,p,n.color),x=Object(l.a)(r,n.size),O=Object(c.a)(d*f),w=Object(v.c)(),C=Object(b.c)(),j=Object(_.d)(),P={drawCount:2*e.lineCount*3,vertexCount:4*e.lineCount,groupCount:f,instanceCount:d},E=h.g.clone(e.boundingSphere),A=Object(m.b)(E,t.aTransform.ref.value,d);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({aMapping:e.mappingBuffer,aGroup:e.groupBuffer,aStart:e.startBuffer,aEnd:e.endBuffer,elements:e.indexBuffer,boundingSphere:a.e.create(A),invariantBoundingSphere:a.e.create(E),uInvariantBoundingSphere:a.e.create(o.Vec4.ofSphere(E))},y),x),O),w),C),j),t),g.a.createValues(s,P)),{uSizeFactor:a.e.create(s.sizeFactor),dLineSizeAttenuation:a.e.create(s.lineSizeAttenuation),dDoubleSided:a.e.create(!0),dFlipSided:a.e.create(!1)})}e.create=t,e.createEmpty=r,e.fromMesh=function(e,t){for(var r=e.vertexBuffer.ref.value,n=e.indexBuffer.ref.value,i=e.groupBuffer.ref.value,a=f.a.create(3*e.triangleCount,e.triangleCount/10,t),o=0,s=3*e.triangleCount;o<s;o+=3){var u=n[o],c=n[o+1],l=n[o+2],d=r[3*u],p=r[3*u+1],m=r[3*u+2],h=r[3*c],g=r[3*c+1],v=r[3*c+2],b=r[3*l],y=r[3*l+1],_=r[3*l+2];a.add(d,p,m,h,g,v,i[u]),a.add(d,p,m,b,y,_,i[u]),a.add(h,g,v,b,y,_,i[c])}return a.getLines()},e.transform=function(e,t){var r=e.startBuffer.ref.value;Object(s.e)(t,r,0,4*e.lineCount),a.e.update(e.startBuffer,r);var n=e.endBuffer.ref.value;Object(s.e)(t,n,0,4*e.lineCount),a.e.update(e.endBuffer,n)},e.Params=Object(i.__assign)(Object(i.__assign)({},g.a.Params),{sizeFactor:p.ParamDefinition.Numeric(1.5,{min:0,max:10,step:.1}),lineSizeAttenuation:p.ParamDefinition.Boolean(!1)}),e.Utils={Params:e.Params,createEmpty:r,createValues:x,createValuesSimple:function(t,r,n,a,o){var s=g.a.createSimple(n,a,o),u=Object(i.__assign)(Object(i.__assign)({},p.ParamDefinition.getDefaultValues(e.Params)),r);return x(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){g.a.updateValues(e,t),a.e.updateIfChanged(e.uSizeFactor,t.sizeFactor),a.e.updateIfChanged(e.dLineSizeAttenuation,t.lineSizeAttenuation)},updateBoundingSphere:function(e,t){var r=h.g.clone(t.boundingSphere),n=Object(m.b)(r,e.aTransform.ref.value,e.instanceCount.ref.value);h.g.equals(n,e.boundingSphere.ref.value)||a.e.update(e.boundingSphere,n);h.g.equals(r,e.invariantBoundingSphere.ref.value)||(a.e.update(e.invariantBoundingSphere,r),a.e.update(e.uInvariantBoundingSphere,o.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:g.a.createRenderableState,updateRenderableState:g.a.updateRenderableState,createPositionIterator:S}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return a})),r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(7),i=r(101);function a(e){return function(t){return o(e,t)}}function o(e,t){var r=e.data,a=e.indices,o=e.count,u=t.valueType,c="str"===u?function(e){return r.substring(a[2*e],a[2*e+1])}:"int"===u?function(e){return Object(i.d)(r,a[2*e],a[2*e+1])||0}:function(e){return Object(i.b)(r,a[2*e],a[2*e+1])||0};return{schema:t,__array:void 0,isDefined:!0,rowCount:o,value:c,valueKind:function(e){return 0},toArray:function(e){return n.b.createAndFillArray(o,c,e)},areValuesEqual:s(e)}}function s(e){var t=e.data,r=e.indices;return function(e,n){var i=r[2*e],a=r[2*n],o=r[2*e+1]-i;if(o!==r[2*n+1]-a)return!1;for(var s=0;s<o;s++)if(t.charCodeAt(s+i)!==t.charCodeAt(s+a))return!1;return!0}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return c}));var n=r(1),i=r(35),a=r(272),o=new Map,s=n.Mat4.identity();function u(e){var t=o.get(e);return void 0===t&&(t=Object(a.a)(e),o.set(e,t)),t}function c(e,t,r,a){i.a.addPrimitive(e,function(e,t,r){return n.Mat4.scaleUniformly(e,n.Mat4.fromTranslation(e,t),r)}(s,t,r),u(a))}},function(e,t,r){"use strict";var n;r.d(t,"a",(function(){return n})),function(e){e.error=function(e,r){return void 0===r&&(r=-1),new t(e,r)},e.success=function(e,t){return void 0===t&&(t=[]),new r(e,t)};var t=function(){function e(e,t){this.message=e,this.line=t,this.isError=!0}return e.prototype.toString=function(){return this.line>=0?"[Line "+this.line+"] "+this.message:this.message},e}();e.Error=t;var r=function(e,t){this.result=e,this.warnings=t,this.isError=!1};e.Success=r}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(197),o=r(5);!function(e){function t(e,t,r,n){var i=n&&n.ref?n.ref:o.c.create22(),a=void 0;return n&&n.tags&&(0===(a="string"==typeof n.tags?[n.tags]:n.tags).length?a=void 0:a.sort()),{parent:e,transformer:t,state:(null==n?void 0:n.state)||{},tags:a,ref:i,dependsOn:n&&n.dependsOn,params:r,version:o.c.create22()}}function r(e,t){return!!e.tags&&e.tags.indexOf(t)>=0}function n(e){return e}e.RootRef="-=root=-",e.areStatesEqual=function(e,t){return!!e.isHidden!=!!t.isHidden||!!e.isCollapsed!=!!t.isCollapsed||!!e.isGhost!=!!t.isGhost||!!e.isLocked!=!!t.isLocked},e.isStateChange=function(e,t){return!!t&&(void 0!==t.isCollapsed&&e.isCollapsed!==t.isCollapsed||(void 0!==t.isHidden&&e.isHidden!==t.isHidden||(void 0!==t.isGhost&&e.isGhost!==t.isGhost||void 0!==t.isLocked&&e.isLocked!==t.isLocked)))},e.assignState=function(e,t){if(!t)return!1;for(var r=!1,n=0,i=Object.keys(t);n<i.length;n++){var a=i[n],o=t[a];!!o!=!!e[a]&&(r=!0,e[a]=o)}return r},e.syncState=function(e,t){if(!t)return!1;for(var r=!1,n=0,i=Object.keys(t);n<i.length;n++){!!(u=t[s=i[n]])!=!!e[s]&&(r=!0,e[s]=u)}for(var a=0,o=Object.keys(e);a<o.length;a++){var s,u;!!(u=t[s=o[a]])!=!!e[s]&&(r=!0,e[s]=u)}return r},e.create=t,e.withParams=function(e,t){return Object(i.__assign)(Object(i.__assign)({},e),{params:t,version:o.c.create22()})},e.withState=function(e,t){return t?Object(i.__assign)(Object(i.__assign)({},e),{state:Object(i.__assign)(Object(i.__assign)({},e.state),t)}):e},e.withTags=function(e,t){var r=void 0;return t&&(0===(r="string"==typeof t?[t]:t).length?r=void 0:r.sort()),Object(i.__assign)(Object(i.__assign)({},e),{tags:r,version:o.c.create22()})},e.withParent=function(e,t){return Object(i.__assign)(Object(i.__assign)({},e),{parent:t,version:o.c.create22()})},e.createRoot=function(r){return t(e.RootRef,a.a.ROOT,{},{ref:e.RootRef,state:r})},e.hasTag=r,e.hasTags=function(e,t){if(!e.tags)return"string"!=typeof t&&0===t.length;if("string"==typeof t)return r(e,t);for(var n=0,i=t;n<i.length;n++){var a=i[n];if(e.tags.indexOf(a)<0)return!1}return!0},e.toJSON=function(e){for(var t=e.transformer.definition.customSerialization?e.transformer.definition.customSerialization.toJSON:n,r=void 0,i=0,a=Object.keys(e.state);i<a.length;i++){var o=a[i];e.state[o]&&(r||(r={}),r[o]=!0)}return{parent:e.parent,transformer:e.transformer.id,params:e.params?t(e.params):void 0,state:r,tags:e.tags,ref:e.ref,dependsOn:e.dependsOn,version:e.version}},e.fromJSON=function(e){var t=a.a.get(e.transformer),r=t.definition.customSerialization?t.definition.customSerialization.fromJSON:n;return{parent:e.parent,transformer:t,params:e.params?r(e.params):void 0,state:e.state||{},tags:e.tags,ref:e.ref,dependsOn:e.dependsOn,version:e.version}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(23),i=r(4),a=r(126),o=r(214);function s(e){return{layers:e}}!function(e){function t(e){return 0===e.layers.length}e.Empty={layers:[]},function(e){function t(e){switch(e){case"one":return 1;case"two":return 2;case"three":return 4;case"four":return 8;case"five":return 16;case"six":return 32}}e.is=o.a.has,e.create=function(e){return o.a.create(e)},e.Names={one:1,two:2,three:4,four:8,five:16,six:32},e.isName=function(t){return t in e.Names},e.fromName=t,e.fromNames=function(e){for(var r=0,n=0,i=e.length;n<i;++n)r|=t(e[n]);return r},e.toNames=function(t){var r=[];return e.is(t,1)&&r.push("one"),e.is(t,2)&&r.push("two"),e.is(t,4)&&r.push("three"),e.is(t,8)&&r.push("four"),e.is(t,16)&&r.push("five"),e.is(t,32)&&r.push("six"),r}}(e.Groups||(e.Groups={})),e.Type={none:0,plane:1,sphere:2,cube:3,cylinder:4,infiniteCone:5},e.areEqual=function(e,t){if(0===e.layers.length&&0===t.layers.length)return!0;if(e.layers.length!==t.layers.length)return!1;for(var r=0,i=e.layers.length;r<i;++r){if(e.layers[r].groups!==t.layers[r].groups)return!1;if(!n.Loci.areEqual(e.layers[r].loci,t.layers[r].loci))return!1}return!0},e.isEmpty=t,e.remap=function(e,t){for(var r=[],n=0,a=e.layers;n<a.length;n++){var o=a[n],s=o.loci,u=o.groups;s=i.StructureElement.Loci.remap(s,t),i.StructureElement.Loci.isEmpty(s)||r.push({loci:s,groups:u})}return{layers:r}},e.merge=function(e){if(t(e))return e;for(var r=e.layers[0].loci.structure,n=new Map,a=i.StructureElement.Loci.none(r),o=0,s=e.layers.length;o<s;++o){var u=e.layers[s-o-1],c=u.loci,l=u.groups;c=i.StructureElement.Loci.subtract(c,a),a=i.StructureElement.Loci.union(c,a),i.StructureElement.Loci.isEmpty(c)||(n.has(l)&&(c=i.StructureElement.Loci.union(c,n.get(l))),n.set(l,c))}var d=[];return n.forEach((function(e,t){d.push({loci:e,groups:t})})),{layers:d}},e.filter=function(e,r){if(t(e))return e;for(var n=e.layers[0].loci.structure,a=[],o=0,s=e.layers;o<s.length;o++){var u=s[o],c=u.loci,l=u.groups,d=i.StructureElement.Loci.remap(c,r);c=i.StructureElement.Loci.remap(d,n),i.StructureElement.Loci.isEmpty(c)||a.push({loci:c,groups:l})}return{layers:a}},e.ofScript=function(e,t){for(var r=[],n=0,o=e.length;n<o;++n){var s=e[n],u=s.script,c=s.groups,l=a.Script.toLoci(u,t);i.StructureElement.Loci.isEmpty(l)||r.push({loci:l,groups:c})}return{layers:r}},e.ofBundle=function(e,t){for(var r=[],n=0,a=e.length;n<a;++n){var o=e[n],s=o.bundle,u=o.groups,c=i.StructureElement.Bundle.toLoci(s,t.root);r.push({loci:c,groups:u})}return{layers:r}},e.toBundle=function(e){for(var t=[],r=0,n=e.layers.length;r<n;++r){var a=e.layers[r],o=a.loci,s=a.groups,u=i.StructureElement.Bundle.fromLoci(o);t.push({bundle:u,groups:s})}return{layers:t}}}(s||(s={}))},function(e,t,r){"use strict";r.d(t,"j",(function(){return m})),r.d(t,"e",(function(){return h})),r.d(t,"d",(function(){return g})),r.d(t,"g",(function(){return v})),r.d(t,"a",(function(){return b})),r.d(t,"f",(function(){return y})),r.d(t,"c",(function(){return _})),r.d(t,"h",(function(){return S})),r.d(t,"b",(function(){return x})),r.d(t,"i",(function(){return O}));var n=r(0),i=r(151),a=r(80),o=r(38),s=r(269),u=r(270),c=r(166),l=r(144),d=r(191),f=r(2),p=r(50);function m(e){return f.ParamDefinition.MultiSelect(e,p.b,{description:"For which kinds of units/chains to show the representation visuals."})}var h={unitKinds:m(["atomic","spheres"])},g=Object(n.__assign)({},o.a.Params),v=Object(n.__assign)({},u.a.Params),b=Object(n.__assign)({},c.a.Params),y=Object(n.__assign)({},s.a.Params),_=Object(n.__assign)({},a.a.Params),S=Object(n.__assign)({},l.a.Params),x=Object(n.__assign)({},i.a.Params),O=Object(n.__assign)({},d.a.Params)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"d",(function(){return o})),r.d(t,"e",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return c}));var n=Object.prototype.hasOwnProperty;function i(e,t){for(var r=0,i=Object.keys(t);r<i.length;r++){var a=i[r];n.call(t,a)&&(void 0===e[a]&&(e[a]=t[a]))}return e}function a(e,t){for(var r=!1,i=0,a=Object.keys(t);i<a.length;i++){var o=a[i];if(n.call(t,o)&&t[o]!==e[o]){r=!0;break}}return r?Object.assign({},e,t):e}function o(e,t){if(!e)return!t;if(!t)return!1;var r=Object.keys(e);if(Object.keys(t).length!==r.length)return!1;for(var i=0,a=r;i<a.length;i++){var o=a[i];if(!n.call(e,o)||e[o]!==t[o])return!1}return!0}function s(e,t){for(var r=e,n=0;n<t.length;n++)if(t[n]&&(r=a(e,t[n]))!==e){for(var i=n+1;i<t.length;i++)r=Object.assign(r,t[i]);break}return r}function u(e){if(null===e||"object"!=typeof e)return e;if(e instanceof Array){for(var t=[],r=0,i=e.length;r<i;r++)t[r]=u(e[r]);return t}if("object"==typeof e&&!("prototype"in e)){t={};for(var a in e)n.call(e,a)&&(t[a]=u(e[a]));return t}throw new Error("Can't clone, type \""+typeof e+'" unsupported')}function c(e,t){if(e)for(var r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t(e[i],i)}}},function(e,t,r){"use strict";var n,i=r(6);!function(e){function t(e){return e[e.length-1]}function r(e){return e.length/2}function n(e,t){return e[2*t]}function a(e,t){return e[2*t+1]+1}function o(e,t){return e[2*t]}function s(e,t){return e[2*t+1]}function u(e,t){return c(e,t,0)}function c(e,n,a){if(o(e,a)>i.OrderedSet.max(n)||t(e)<i.OrderedSet.min(n))return-1;for(var u=a,c=r(e);u<c;++u){var l=i.Interval.ofRange(o(e,u),s(e,u));if(i.OrderedSet.areIntersecting(l,n))return u}return-1}e.ofSortedRanges=function(e){return i.SortedArray.ofSortedArray(e)},e.start=function(e){return e[0]},e.end=function(e){return e[e.length-1]+1},e.min=function(e){return e[0]},e.max=t,e.size=function(e){for(var t=0,r=0,n=e.length;r<n;r+=2)t+=e[r+1]-e[r]+1;return t},e.count=r,e.startAt=n,e.endAt=a,e.minAt=o,e.maxAt=s,e.areEqual=function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;++r)if(e[r]!==t[r])return!1;return!0},e.forEach=function(e,t){for(var r=0,n=0,i=e.length;n<i;n+=2)for(var a=e[n],o=e[n+1];a<=o;++a)t(a,r),++r},e.has=function(e,t){return-1!==u(e,t)},e.hasFrom=function(e,t,r){return-1!==c(e,t,r)},e.firstIntersectionIndex=u,e.firstIntersectionIndexFrom=c,e.transientSegments=function(e,t){return new l(e,t)};var l=function(){function e(e,t){this.ranges=e,this.set=t,this.value={index:0,start:0,end:0},this.curIndex=0,this.hasNext=!1,this.curIndex=u(e,t),this.hasNext=-1!==this.curIndex}return e.prototype.updateValue=function(){this.value.index=this.curIndex,this.value.start=i.OrderedSet.findPredecessorIndex(this.set,n(this.ranges,this.curIndex)),this.value.end=i.OrderedSet.findPredecessorIndex(this.set,a(this.ranges,this.curIndex))},e.prototype.move=function(){return this.hasNext&&(this.updateValue(),this.curIndex=c(this.ranges,this.set,this.curIndex+1),this.hasNext=-1!==this.curIndex),this.value},e}();e.Iterator=l}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return K})),r.d(t,"f",(function(){return Z})),r.d(t,"g",(function(){return J})),r.d(t,"b",(function(){return $})),r.d(t,"d",(function(){return ee}));var n,i=r(0),a=r(4),o=r(22),s=r(10),u=r(169),c=r(96),l=(r(31),r(258));function d(e,t,r){var o,s;return void 0===r&&(r={}),{label:e,expression:t,description:r.description||"",category:null!==(o=r.category)&&void 0!==o?o:n.Misc,isHidden:!!r.isHidden,priority:r.priority||0,referencesCurrent:!!r.referencesCurrent,get query(){return s||(s=Object(u.compile)(t)),s},ensureCustomProperties:r.ensureCustomProperties,getSelection:function(e,n,o){return Object(i.__awaiter)(this,void 0,void 0,(function(){var c,l;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return c=e.managers.structure.selection.getStructure(o),l=c?a.StructureSelection.Sequence(o,[c]):a.StructureSelection.Empty(o),r.ensureCustomProperties?[4,r.ensureCustomProperties({runtime:n,assetManager:e.managers.asset},o)]:[3,2];case 1:i.sent(),i.label=2;case 2:return s||(s=Object(u.compile)(t)),[2,s(new a.QueryContext(o,{currentSelection:l}))]}}))}))}}}!function(e){e.Type="Type",e.Structure="Structure Property",e.Atom="Atom Property",e.Bond="Bond Property",e.Residue="Residue Property",e.AminoAcid="Amino Acid",e.NucleicBase="Nucleic Base",e.Manipulate="Manipulate Selection",e.Validation="Validation",e.Misc="Miscellaneous",e.Internal="Internal"}(n||(n={}));var f=d("All",s.MolScriptBuilder.struct.generator.all(),{category:"",priority:1e3}),p=d("Current Selection",s.MolScriptBuilder.internal.generator.current(),{category:"",referencesCurrent:!0}),m=d("Polymer",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.logic.and([s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"polymer"]),s.MolScriptBuilder.core.str.match([s.MolScriptBuilder.re("(polypeptide|cyclic-pseudo-peptide|peptide-like|nucleotide|peptide nucleic acid)","i"),s.MolScriptBuilder.ammp("entitySubtype")])])})]),{category:n.Type}),h=d("Trace",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.combinator.merge([s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"polymer"]),"chain-test":s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set("sphere","gaussian"),s.MolScriptBuilder.ammp("objectPrimitive")])})]),s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"polymer"]),"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"atom-test":s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set("CA","P"),s.MolScriptBuilder.ammp("label_atom_id")])})])])]),{category:n.Structure}),g=s.MolScriptBuilder.core.logic.and([s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"polymer"]),s.MolScriptBuilder.core.str.match([s.MolScriptBuilder.re("(polypeptide|cyclic-pseudo-peptide|peptide-like)","i"),s.MolScriptBuilder.ammp("entitySubtype")])]),v=s.MolScriptBuilder.core.logic.and([s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"polymer"]),s.MolScriptBuilder.core.str.match([s.MolScriptBuilder.re("(nucleotide|peptide nucleic acid)","i"),s.MolScriptBuilder.ammp("entitySubtype")])]),b=s.MolScriptBuilder.core.str.match([s.MolScriptBuilder.re("non-polymer|(amino|carboxy) terminus|peptide-like","i"),s.MolScriptBuilder.ammp("chemCompType")]),y=d("Backbone",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.combinator.merge([s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":g,"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.core.logic.not([b]),"atom-test":s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,c.a.toArray(o.ProteinBackboneAtoms)),s.MolScriptBuilder.ammp("label_atom_id")])})]),s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":v,"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.core.logic.not([b]),"atom-test":s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,c.a.toArray(o.NucleicBackboneAtoms)),s.MolScriptBuilder.ammp("label_atom_id")])})])])]),{category:n.Structure}),_=d("Sidechain",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.combinator.merge([s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":g,"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.core.logic.not([b]),"atom-test":s.MolScriptBuilder.core.logic.or([s.MolScriptBuilder.core.logic.not([s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,c.a.toArray(o.ProteinBackboneAtoms)),s.MolScriptBuilder.ammp("label_atom_id")])])])})]),s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":v,"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.core.logic.not([b]),"atom-test":s.MolScriptBuilder.core.logic.or([s.MolScriptBuilder.core.logic.not([s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,c.a.toArray(o.NucleicBackboneAtoms)),s.MolScriptBuilder.ammp("label_atom_id")])])])})])])]),{category:n.Structure}),S=d("Sidechain with Trace",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.combinator.merge([s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":g,"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.core.logic.not([b]),"atom-test":s.MolScriptBuilder.core.logic.or([s.MolScriptBuilder.core.logic.not([s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,c.a.toArray(o.ProteinBackboneAtoms)),s.MolScriptBuilder.ammp("label_atom_id")])]),s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("label_atom_id"),"CA"]),s.MolScriptBuilder.core.logic.and([s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("auth_comp_id"),"PRO"]),s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("label_atom_id"),"N"])])])})]),s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":v,"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.core.logic.not([b]),"atom-test":s.MolScriptBuilder.core.logic.or([s.MolScriptBuilder.core.logic.not([s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,c.a.toArray(o.NucleicBackboneAtoms)),s.MolScriptBuilder.ammp("label_atom_id")])]),s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("label_atom_id"),"P"])])})])])]),{category:n.Structure}),x=d("Protein",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":g})]),{category:n.Type}),O=d("Nucleic",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":v})]),{category:n.Type}),w=d("Helix",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":g,"residue-test":s.MolScriptBuilder.core.flags.hasAny([s.MolScriptBuilder.ammp("secondaryStructureFlags"),s.MolScriptBuilder.core.type.bitflags([2])])})]),{category:n.Structure}),C=d("Beta Strand/Sheet",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":g,"residue-test":s.MolScriptBuilder.core.flags.hasAny([s.MolScriptBuilder.ammp("secondaryStructureFlags"),s.MolScriptBuilder.core.type.bitflags([4])])})]),{category:n.Structure}),j=d("Water",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"water"])})]),{category:n.Type}),P=d("Ion",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entitySubtype"),"ion"])})]),{category:n.Type}),E=d("Lipid",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entitySubtype"),"lipid"])})]),{category:n.Type}),A=d("Carbohydrate",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.logic.or([s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"branched"]),s.MolScriptBuilder.core.logic.and([s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"non-polymer"]),s.MolScriptBuilder.core.str.match([s.MolScriptBuilder.re("oligosaccharide","i"),s.MolScriptBuilder.ammp("entitySubtype")])])])})]),{category:n.Type}),D=d("Carbohydrate with Connected",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.includeConnected({0:A.expression,"layer-count":1,"as-whole-residues":!0})]),{category:n.Internal,isHidden:!0}),T=d("Connected to Carbohydrate",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.exceptBy({0:D.expression,by:A.expression})]),{category:n.Internal,isHidden:!0}),I=d("Ligand",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.combinator.merge([s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.logic.and([s.MolScriptBuilder.core.logic.or([s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"non-polymer"]),s.MolScriptBuilder.core.rel.neq([s.MolScriptBuilder.ammp("entityPrdId"),""])]),s.MolScriptBuilder.core.logic.not([s.MolScriptBuilder.core.str.match([s.MolScriptBuilder.re("(oligosaccharide|lipid|ion)","i"),s.MolScriptBuilder.ammp("entitySubtype")])])]),"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.core.logic.not([s.MolScriptBuilder.core.str.match([s.MolScriptBuilder.re("saccharide","i"),s.MolScriptBuilder.ammp("chemCompType")])])})]),s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"polymer"]),"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":b})])])]),{category:n.Type}),M=d("Ligand with Connected",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.exceptBy({0:s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.includeConnected({0:I.expression,"layer-count":1,"as-whole-residues":!0,"bond-test":s.MolScriptBuilder.core.flags.hasAny([s.MolScriptBuilder.struct.bondProperty.flags(),s.MolScriptBuilder.core.type.bitflags([3])])})]),by:A.expression})]),{category:n.Internal,isHidden:!0}),k=d("Connected to Ligand",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.exceptBy({0:M.expression,by:I.expression})]),{category:n.Internal,isHidden:!0}),B=d("Connected to Ligand or Carbohydrate",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.combinator.merge([T.expression,k.expression])]),{category:n.Internal,isHidden:!0}),V=d("Disulfide Bridges",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.wholeResidues([s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.bondedAtomicPairs({0:s.MolScriptBuilder.core.flags.hasAny([s.MolScriptBuilder.struct.bondProperty.flags(),s.MolScriptBuilder.core.type.bitflags([8])])})])])]),{category:n.Bond}),R=d("Non-standard Residues in Polymers",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("entityType"),"polymer"]),"chain-test":s.MolScriptBuilder.core.rel.eq([s.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":s.MolScriptBuilder.ammp("isNonStandard")})]),{category:n.Residue}),L=d("Coarse Elements",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"chain-test":s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set("sphere","gaussian"),s.MolScriptBuilder.ammp("objectPrimitive")])})]),{category:n.Type}),N=d("Rings in Residues",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.rings()]),{category:n.Residue}),F=d("Aromatic Rings in Residues",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.rings({"only-aromatic":!0})]),{category:n.Residue}),U=d("Surrounding Residues (5 Å) of Selection",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.exceptBy({0:s.MolScriptBuilder.struct.modifier.includeSurroundings({0:s.MolScriptBuilder.internal.generator.current(),radius:5,"as-whole-residues":!0}),by:s.MolScriptBuilder.internal.generator.current()})]),{description:"Select residues within 5 Å of the current selection.",category:n.Manipulate,referencesCurrent:!0}),z=d("Inverse / Complement of Selection",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.exceptBy({0:s.MolScriptBuilder.struct.generator.all(),by:s.MolScriptBuilder.internal.generator.current()})]),{description:"Select everything not in the current selection.",category:n.Manipulate,referencesCurrent:!0}),H=d("Residues Covalently Bonded to Selection",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.includeConnected({0:s.MolScriptBuilder.internal.generator.current(),"layer-count":1,"as-whole-residues":!0})]),{description:"Select residues covalently bonded to current selection.",category:n.Manipulate,referencesCurrent:!0}),G=d("Residues with Cov. or Metallic Bond to Selection",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.includeConnected({0:s.MolScriptBuilder.internal.generator.current(),"layer-count":1,"as-whole-residues":!0,"bond-test":s.MolScriptBuilder.core.flags.hasAny([s.MolScriptBuilder.struct.bondProperty.flags(),s.MolScriptBuilder.core.type.bitflags([3])])})]),{description:"Select residues with covalent or metallic bond to current selection.",category:n.Manipulate,referencesCurrent:!0}),q=d("Whole Residues of Selection",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.modifier.wholeResidues({0:s.MolScriptBuilder.internal.generator.current()})]),{description:"Expand current selection to whole residues.",category:n.Manipulate,referencesCurrent:!0}),W=[[["HIS"],"Histidine"],[["ARG"],"Arginine"],[["LYS"],"Lysine"],[["ILE"],"Isoleucine"],[["PHE"],"Phenylalanine"],[["LEU"],"Leucine"],[["TRP"],"Tryptophan"],[["ALA"],"Alanine"],[["MET"],"Methionine"],[["PRO"],"Proline"],[["CYS"],"Cysteine"],[["ASN"],"Asparagine"],[["VAL"],"Valine"],[["GLY"],"Glycine"],[["SER"],"Serine"],[["GLN"],"Glutamine"],[["TYR"],"Tyrosine"],[["ASP"],"Aspartic Acid"],[["GLU"],"Glutamic Acid"],[["THR"],"Threonine"],[["SEC"],"Selenocysteine"],[["PYL"],"Pyrrolysine"],[["UNK"],"Unknown"]].sort((function(e,t){return e[1]<t[1]?-1:e[1]>t[1]?1:0})),X=[[["A","DA"],"Adenosine"],[["C","DC"],"Cytidine"],[["T","DT"],"Thymidine"],[["G","DG"],"Guanosine"],[["I","DI"],"Inosine"],[["U","DU"],"Uridine"],[["N","DN"],"Unknown"]].sort((function(e,t){return e[1]<t[1]?-1:e[1]>t[1]?1:0}));function Y(e,t,r){var n=e[0],i=e[1];void 0===r&&(r=0);var a=1!==n.length||Q.has(n[0])?i+" ("+n.join(", ")+")":"["+n[0]+"] "+i;return d(a,s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"residue-test":s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,n),s.MolScriptBuilder.ammp("auth_comp_id")])})]),{category:t,priority:r,description:a})}var Q=c.a.unionMany(o.AminoAcidNamesL,o.RnaBaseNames,o.DnaBaseNames,o.WaterNames);function K(e){for(var t=new Set,r=0,n=e;r<n.length;r++){n[r].uniqueElementSymbols.forEach((function(e){return t.add(e)}))}var i=[];return t.forEach((function(e){var t,r,n,a,o,u=l.a[e]||e;i.push((r="Element Symbol",n=0,a=(t=[[e],u])[0],d(o=t[1]+" ("+a.join(", ")+")",s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"atom-test":s.MolScriptBuilder.core.set.has([s.MolScriptBuilder.set.apply(s.MolScriptBuilder,a),s.MolScriptBuilder.acp("elementSymbol")])})]),{category:r,priority:n,description:o})))})),i}function Z(e){for(var t=new Map,r=new Set,n=0,i=e;n<i.length;n++){var a=i[n];a.uniqueResidueNames.forEach((function(e){return r.add(e)}));for(var o=function(e){a.uniqueResidueNames.forEach((function(r){var n=e.properties.chemicalComponentMap.get(r);n&&t.set(r,n.name)}))},s=0,u=a.models;s<u.length;s++){o(u[s])}}var l=[];return c.a.difference(r,Q).forEach((function(e){var r=t.get(e)||e;l.push(Y([[e],r],"Ligand/Non-standard Residue",200))})),l}function J(e){for(var t=new Map,r=a.StructureElement.Location.create(),n=0,i=e;n<i.length;n++){var o=i[n];r.structure=o;for(var u=0,c=o.unitSymmetryGroups;u<c.length;u++){var l=c[u];r.unit=l.units[0],r.element=l.elements[0];var f=a.StructureProperties.entity.type(r);if("polymer"===f||"branched"===f){var p=a.StructureProperties.entity.pdbx_description(r);t.set(p.join(", "),p)}}}var m=[];return t.forEach((function(e,t){m.push(function(e,t,r){var n=e[0],i=e[1],a=""+i;return d(""+i,s.MolScriptBuilder.struct.modifier.union([s.MolScriptBuilder.struct.generator.atomGroups({"entity-test":s.MolScriptBuilder.core.list.equal([s.MolScriptBuilder.list.apply(s.MolScriptBuilder,n),s.MolScriptBuilder.ammp("entityDescription")])})]),{category:t,priority:r,description:a})}([e,t],"Polymer/Carbohydrate Entities",300))})),m}var $={all:f,current:p,polymer:m,trace:h,backbone:y,sidechain:_,sidechainWithTrace:S,protein:x,nucleic:O,helix:w,beta:C,water:j,ion:P,lipid:E,branched:A,branchedPlusConnected:D,branchedConnectedOnly:T,ligand:I,ligandPlusConnected:M,ligandConnectedOnly:k,connectedOnly:B,disulfideBridges:V,nonStandardPolymer:R,coarse:L,ring:N,aromaticRing:F,surroundings:U,complement:z,covalentlyBonded:H,covalentlyOrMetallicBonded:G,wholeResidues:q},ee=function(){function e(){var e,t;this.list=[],this.options=[],this.version=1,(e=this.list).push.apply(e,Object(i.__spreadArrays)(Object.values($),W.map((function(e){return Y(e,n.AminoAcid)})),X.map((function(e){return Y(e,n.NucleicBase)})))),(t=this.options).push.apply(t,this.list.map((function(e){return[e,e.label,e.category]})))}return e.prototype.add=function(e){this.list.push(e),this.options.push([e,e.label,e.category]),this.version+=1},e.prototype.remove=function(e){var t=this.list.indexOf(e);-1!==t&&(this.list.splice(t,1),this.options.splice(t,1),this.version+=1)},e}()},function(e,t,r){"use strict";r.d(t,"e",(function(){return s})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return d}));var n=r(0),i=r(62),a=r(1),o=r(5);function s(e){if("object"==typeof e){if("buttons"in e)return e.buttons;if("which"in e){var t=e.which;if(2===t)return 4;if(3===t)return 2;if(t>0)return 1<<t-1}}return 0}function u(e){if("object"==typeof e&&"button"in e){var t=e.button;if(1===t)return 4;if(2===t)return 2;if(t>=0)return 1<<t}return 0}function c(e){return{alt:"altKey"in e&&e.altKey,shift:"shiftKey"in e&&e.shiftKey,control:"ctrlKey"in e&&e.ctrlKey,meta:"metaKey"in e&&e.metaKey}}var l,d,f={noScroll:!0,noMiddleClickScroll:!0,noContextMenu:!0,noPinchZoom:!0,noTextSelect:!0,mask:function(e,t){return!0},pixelScale:1};function p(){return{drag:new i.a,interactionEnd:new i.a,click:new i.a,move:new i.a,wheel:new i.a,pinch:new i.a,resize:new i.a,leave:new i.a,enter:new i.a,modifiers:new i.a,key:new i.a}}!function(e){function t(e){return void 0===e&&(e={}),{shift:!!e.shift,alt:!!e.alt,control:!!e.control,meta:!!e.meta}}e.None=t(),e.areEqual=function(e,t){return e.shift===t.shift&&e.alt===t.alt&&e.control===t.control&&e.meta===t.meta},e.size=function(e){if(!e)return 0;var t=0;return e.shift&&t++,e.alt&&t++,e.control&&t++,e.meta&&t++,t},e.create=t}(l||(l={})),function(e){e.has=o.a.has,e.create=o.a.create}(d||(d={}));var m,h=["Backspace","Delete"];!function(e){e.create=function(e){void 0===e&&(e={});var t=Object(n.__assign)(Object(n.__assign)({},f),e),r=t.noScroll,i=t.noContextMenu;return Object(n.__assign)(Object(n.__assign)({noScroll:r,noContextMenu:i,width:0,height:0,pixelRatio:1},p()),{dispose:o.j})},e.fromElement=function(e,t){void 0===t&&(t={});var r=Object(n.__assign)(Object(n.__assign)({},f),t),i=r.noScroll,o=r.noMiddleClickScroll,c=r.noContextMenu,l=r.noPinchZoom,m=r.noTextSelect,g=r.mask,v=r.pixelScale,b=e.clientWidth*P(),y=e.clientHeight*P(),_=0,S=Object(a.Vec2)(),x=Object(a.Vec2)(),O=Object(a.Vec2)(),w=Object(a.Vec2)(),C=Object(a.Vec2)(),j={shift:!1,alt:!1,control:!1,meta:!1};function P(){return window.devicePixelRatio*v}function E(){return Object(n.__assign)({},j)}var A=0,D=!1,T=d.create(0),I=0,M=!1,k=p(),B=k.drag,V=k.interactionEnd,R=k.wheel,L=k.pinch,N=k.click,F=k.move,U=k.leave,z=k.enter,H=k.resize,G=k.modifiers,q=k.key;return e.addEventListener("contextmenu",W,!1),e.addEventListener("wheel",ce,!1),e.addEventListener("mousedown",ne,!1),window.addEventListener("mousemove",ie,!1),window.addEventListener("mouseup",ae,!1),e.addEventListener("mouseenter",le,!1),e.addEventListener("mouseleave",de,!1),e.addEventListener("touchstart",ee,!1),e.addEventListener("touchmove",re,!1),e.addEventListener("touchend",te,!1),window.addEventListener("blur",Y),window.addEventListener("keyup",K,!1),window.addEventListener("keydown",Q,!1),window.addEventListener("keypress",Z,!1),window.addEventListener("resize",fe,!1),Object(n.__assign)(Object(n.__assign)({get noScroll(){return i},set noScroll(e){i=e},get noContextMenu(){return c},set noContextMenu(e){c=e},get width(){return b},get height(){return y},get pixelRatio(){return P()}},k),{dispose:function(){if(D)return;D=!0,e.removeEventListener("contextmenu",W,!1),e.removeEventListener("wheel",ce,!1),e.removeEventListener("mousedown",ne,!1),window.removeEventListener("mousemove",ie,!1),window.removeEventListener("mouseup",ae,!1),e.removeEventListener("mouseenter",le,!1),e.removeEventListener("mouseleave",de,!1),e.removeEventListener("touchstart",ee,!1),e.removeEventListener("touchmove",re,!1),e.removeEventListener("touchend",te,!1),window.removeEventListener("blur",Y),window.removeEventListener("keyup",K,!1),window.removeEventListener("keydown",Q,!1),window.removeEventListener("keypress",Z,!1),window.removeEventListener("resize",fe,!1)}});function W(e){g(e.clientX,e.clientY)&&c&&e.preventDefault()}function X(e){j.alt=e.altKey,j.shift=e.shiftKey,j.control=e.ctrlKey,j.meta=e.metaKey}function Y(){(T||j.shift||j.alt||j.meta||j.control)&&(T=0,j.shift=j.alt=j.control=j.meta=!1)}function Q(e){var t=!1;!j.alt&&e.altKey&&(t=!0,j.alt=!0),!j.shift&&e.shiftKey&&(t=!0,j.shift=!0),!j.control&&e.ctrlKey&&(t=!0,j.control=!0),!j.meta&&e.metaKey&&(t=!0,j.meta=!0),t&&M&&G.next(E())}function K(e){var t=!1;j.alt&&!e.altKey&&(t=!0,j.alt=!1),j.shift&&!e.shiftKey&&(t=!0,j.shift=!1),j.control&&!e.ctrlKey&&(t=!0,j.control=!1),j.meta&&!e.metaKey&&(t=!0,j.meta=!1),t&&M&&G.next(E()),h.includes(e.key)&&Z(e)}function Z(e){q.next({key:e.key,modifiers:E()})}function J(e){var t=e.touches[0],r=e.touches[1];return{clientX:(t.clientX+r.clientX)/2,clientY:(t.clientY+r.clientY)/2,pageX:(t.pageX+r.pageX)/2,pageY:(t.pageY+r.pageY)/2}}function $(e){var t=e.touches[0].pageX-e.touches[1].pageX,r=e.touches[0].pageY-e.touches[1].pageY;return Math.sqrt(t*t+r*r)}function ee(e){if(1===e.touches.length)T=I=1,se(e.touches[0]);else if(2===e.touches.length){T=0,I=2,se(J(e));var t=$(e);_=t,L.next({distance:t,fraction:1,delta:0,isStart:!0,buttons:T,button:I,modifiers:E()})}else 3===e.touches.length&&(T=I=8,se(J(e)))}function te(e){oe()}function re(e){if(I=0,l&&(e.preventDefault(),e.stopPropagation(),e.originalEvent&&(e.originalEvent.preventDefault(),e.originalEvent.stopPropagation())),1===e.touches.length)T=1,ue(e.touches[0]);else if(2===e.touches.length){var t=$(e),r=_-t;Math.abs(r)<4?(T=2,ue(J(e))):(T=4,X(e),L.next({delta:r,fraction:_/t,distance:t,isStart:!1,buttons:T,button:I,modifiers:E()})),_=t}else 3===e.touches.length&&(T=8,ue(J(e)))}function ne(e){X(e),T=s(e),I=u(e),o&&4===T&&e.preventDefault,se(e)}function ie(e){X(e),T=s(e),I=0,ue(e)}function ae(e){X(e),T=s(e),I=u(e),function(e){if(A=0,!g(e.clientX,e.clientY))return;if(me(O,e),a.Vec2.distance(O,S)<4){var t=e.pageX,r=e.pageY,n=O[0],i=O[1];N.next({x:n,y:i,pageX:t,pageY:r,buttons:T,button:I,modifiers:E()})}}(e),oe()}function oe(){V.next()}function se(e){g(e.clientX,e.clientY)&&(me(x,e),a.Vec2.copy(S,x),pe(x)&&(A=1))}function ue(t){var r;me(O,t);var n,i=t.pageX,o=t.pageY,s=O[0],u=O[1],c=pe(O);if((F.next({x:s,y:u,pageX:i,pageY:o,buttons:T,button:I,modifiers:E(),inside:c}),0!==A)&&(m&&(null===(r=t.preventDefault)||void 0===r||r.call(t)),a.Vec2.div(w,a.Vec2.sub(w,O,x),((n=C)[0]=e.clientWidth,n[1]=e.clientHeight,n)),!(a.Vec2.magnitude(w)<a.EPSILON))){var l=1===A;if(!l||g(t.clientX,t.clientY)){var d=w[0],f=w[1];B.next({x:s,y:u,dx:d,dy:f,pageX:i,pageY:o,buttons:T,button:I,modifiers:E(),isStart:l}),a.Vec2.copy(x,O),A=2}}}function ce(e){if(g(e.clientX,e.clientY)){me(O,e);var t=e.pageX,r=e.pageY,n=O[0],a=O[1];i&&e.preventDefault();var o=1;switch(e.deltaMode){case 0:o=1;break;case 1:o=40;break;case 2:o=800}var s=(e.deltaX||0)*o,u=(e.deltaY||0)*o,c=(e.deltaZ||0)*o;T=I=4,(s||u||c)&&R.next({x:n,y:a,pageX:t,pageY:r,dx:s,dy:u,dz:c,buttons:T,button:I,modifiers:E()})}}function le(e){M=!0,z.next()}function de(e){M=!1,U.next()}function fe(e){H.next()}function pe(t){if(e instanceof Window||e instanceof Document||e===document.body)return!0;var r=e.getBoundingClientRect();return t[0]>=0&&t[1]>=0&&t[0]<r.width&&t[1]<r.height}function me(t,r){b=e.clientWidth*P(),y=e.clientHeight*P();var n=r.clientX||0,i=r.clientY||0,a=e.getBoundingClientRect();return t[0]=n-a.left,t[1]=i-a.top,t}}}(m||(m={})),t.c=m},function(e,t,r){"use strict";r.d(t,"a",(function(){return C})),r.d(t,"b",(function(){return j})),r.d(t,"c",(function(){return P}));var n=r(1),i=r(35),a=r(137),o=r(0),s={radiusTop:1,radiusBottom:1,height:1,radialSegments:8,heightSegments:1,topCap:!1,bottomCap:!1,thetaStart:0,thetaLength:2*Math.PI};var u=r(246),c=r(153),l=r(12),d=new Map,f=n.Vec3.create(0,1,0),p=Object(n.Vec3)(),m=Object(n.Vec3)(),h=Object(n.Vec3)(),g=Object(n.Mat4)(),v=Object(n.Mat4)(),b=Object(n.Vec3)(),y=Object(n.Mat4)(),_=Object(n.Vec3)(),S=Object(n.Vec3)();function x(e,t,r,i){return n.Vec3.setMagnitude(m,r,i/2),n.Vec3.add(h,t,m),n.Vec3.matchDirection(S,f,m),n.Mat4.fromScaling(y,n.Vec3.set(b,1,i,1)),n.Vec3.makeRotation(v,S,m),n.Mat4.mul(e,v,y),n.Mat4.setTranslation(e,h)}var O=new Int32Array(9);function w(e){var t=function(e){var t,r,n,i,a,o,u,c,d;return O[0]=Math.round(1e3*(null!==(t=e.radiusTop)&&void 0!==t?t:s.radiusTop)),O[1]=Math.round(1e3*(null!==(r=e.radiusBottom)&&void 0!==r?r:s.radiusBottom)),O[2]=Math.round(1e3*(null!==(n=e.height)&&void 0!==n?n:s.height)),O[3]=null!==(i=e.radialSegments)&&void 0!==i?i:s.radialSegments,O[4]=null!==(a=e.heightSegments)&&void 0!==a?a:s.heightSegments,O[5]=(null!==(o=e.topCap)&&void 0!==o?o:s.topCap)?1:0,O[6]=(null!==(u=e.bottomCap)&&void 0!==u?u:s.bottomCap)?1:0,O[7]=Math.round(1e3*(null!==(c=e.thetaStart)&&void 0!==c?c:s.thetaStart)),O[8]=Math.round(1e3*(null!==(d=e.thetaLength)&&void 0!==d?d:s.thetaLength)),Object(l.l)(O)}(e),r=d.get(t);if(void 0===r){if(e.radialSegments&&e.radialSegments<=4){var i=Math.max(3,e.radialSegments),f=Object(u.e)(Object(c.a)(i,!0,e.radiusTop),e);r=Object(a.c)(f,n.Mat4.rotX90)}else r=function(e){var t=Object(o.__assign)(Object(o.__assign)({},s),e),r=t.radiusTop,i=t.radiusBottom,a=t.height,u=t.radialSegments,c=t.heightSegments,l=t.topCap,d=t.bottomCap,f=t.thetaStart,p=t.thetaLength,m=[],h=[],g=[],v=0,b=[],y=a/2;return function(){for(var e=n.Vec3.zero(),t=(i-r)/a,o=0;o<=c;++o){for(var s=[],l=o/c,d=l*(i-r)+r,_=0;_<=u;++_){var S=_/u*p+f,x=Math.sin(S),O=Math.cos(S);h.push(d*x,-l*a+y,d*O),n.Vec3.normalize(e,n.Vec3.set(e,x,t,O)),g.push.apply(g,e),s.push(v++)}b.push(s)}for(_=0;_<u;++_)for(o=0;o<c;++o){var w=b[o][_],C=b[o+1][_],j=b[o+1][_+1],P=b[o][_+1];m.push(w,C,P),m.push(C,j,P)}}(),l&&r>0&&_(!0),d&&i>0&&_(!1),{vertices:new Float32Array(h),normals:new Float32Array(g),indices:new Uint32Array(m)};function _(e){for(var t=!0===e?r:i,n=!0===e?1:-1,a=v,o=1;o<=u;++o)h.push(0,y*n,0),g.push(0,n,0),++v;var s=v;for(o=0;o<=u;++o){var c=o/u*p+f,l=Math.cos(c),d=Math.sin(c);h.push(t*d,y*n,t*l),g.push(0,n,0),++v}for(o=0;o<u;++o){var b=a+o,_=s+o;!0===e?m.push(_,_+1,b):m.push(_+1,_,b)}}}(e);d.set(t,r)}return r}function C(e,t,r,a,o){var s=n.Vec3.distance(t,r)*a;n.Vec3.sub(p,r,t),x(g,t,p,s),i.a.addPrimitive(e,g,w(o))}function j(e,t,r,a,o,s){var u=n.Vec3.distance(t,r)*a,c=w(s);n.Vec3.sub(p,r,t),n.Vec3.add(_,t,o),x(g,_,p,u),i.a.addPrimitive(e,g,c),n.Vec3.sub(_,t,o),x(g,_,p,u),i.a.addPrimitive(e,g,c)}function P(e,t,r,a,o,s){var u=Math.floor(o/2),c=1/o;if(a<1){var l=a/2/o;a+=o%2==1?l:-l}var d=n.Vec3.distance(t,r)*a,f=w(s);n.Vec3.sub(p,r,t);for(var m=0;m<u;++m){var h=c*(2*m+1);n.Vec3.setMagnitude(p,p,d*h),n.Vec3.add(_,t,p),x(g,_,p,d*c),i.a.addPrimitive(e,g,f)}}},function(e,t,r){"use strict";r.d(t,"g",(function(){return P})),r.d(t,"h",(function(){return E})),r.d(t,"a",(function(){return A})),r.d(t,"b",(function(){return D})),r.d(t,"e",(function(){return T})),r.d(t,"f",(function(){return I})),r.d(t,"i",(function(){return M})),r.d(t,"j",(function(){return k})),r.d(t,"c",(function(){return B})),r.d(t,"d",(function(){return V})),r.d(t,"k",(function(){return R})),r.d(t,"l",(function(){return L}));var n=r(0),i=r(65),a=r(4),o=r(125),s=r(94),u=r(188),c=r(121),l=r(23),d=r(6),f=r(160),p=r(202),m=r(5),h=r(132),g=r(115),v=r(38),b=r(166),y=r(80),_=r(144),S=r(135),x=r(151),O=r(124),w=r(86),C=r(191);function j(e,t){var r,n,v,b,y,_,S,x,w=e.defaultProps,C=e.createGeometry,j=e.createLocationIterator,P=e.getLoci,E=e.eachLocation,A=e.setUpdateState,D=e.mustRecreate,T=e.dispose,I=e.geometryUtils,M=I.updateValues,k=I.updateBoundingSphere,B=I.updateRenderableState,V=I.createPositionIterator,R=f.a.create(),L=Object.assign({},w),N=s.a.createEmpty();function F(e){if(R.createNew){if(S=j(b),!e)throw new Error("expected geometry to be given");r=function(e,t,r,n,i,a){var s=o.a.getUtils(t),l=s.createValues,d=s.createRenderableState,f=l(t,Object(u.a)(),r,n,i),p=d(i);return Object(c.a)(t.kind,f,p,a)}(0,e,S,v,n,t),x=V(e,r.values)}else{if(!r)throw new Error("expected renderObject to be available");if(R.updateTransform){var i=(S=j(b)).instanceCount,a=S.groupCount;Object(O.a)(i*a,r.values)}if(R.createGeometry){if(!e)throw new Error("expected geometry to be given");m.e.updateIfChanged(r.values.drawCount,o.a.getDrawCount(e)),m.e.updateIfChanged(r.values.uVertexCount,o.a.getVertexCount(e))}(R.updateTransform||R.createGeometry)&&(k(r.values,e||_),x=V(_,r.values)),R.updateSize&&"uSize"in r.values&&Object(h.a)(S,v.size,r.values),R.updateColor&&Object(g.a)(S,x,v.color,r.values),M(r.values,n),B(r.state,n)}L=n,N=v,y=b,e&&(_=e)}function U(e,t,r){return function(e){return!!Object(l.isEveryLoci)(e)||(!(!a.Structure.isLoci(e)||!a.Structure.areRootsEquivalent(e.structure,y))||!!(a.StructureElement.Loci.is(e)&&a.Structure.areRootsEquivalent(e.structure,y)&&a.StructureElement.Loci.isWholeStructure(e)))}(e)?t(d.Interval.ofBounds(0,S.groupCount*S.instanceCount)):E(e,y,t,r)}return{get groupCount(){return S?S.count:0},get renderObject(){return S&&S.count?r:void 0},createOrUpdate:function(e,t,i,o){if(void 0===i&&(i={}),function(e,t,i){if(!i&&!y)throw new Error("missing structure");if(n=Object.assign({},L,t),v=e,b=i,f.a.reset(R),!r||!y)return R.createNew=!0,void(R.createGeometry=!0);A(R,n,L,v,N,b,y),a.Structure.areEquivalent(b,y)||(R.createGeometry=!0),a.Structure.areHierarchiesEqual(b,y)||(R.updateTransform=!0,R.createGeometry=!0),p.a.areEqual(e.color,N.color)||(R.updateColor=!0),Object(m.g)(n.unitKinds,L.unitKinds)||(R.createGeometry=!0),R.updateSize&&!("uSize"in r.values)&&(R.createGeometry=!0),R.createGeometry&&(R.updateColor=!0,R.updateSize=!0)}(t,i,o||y),R.createGeometry){var s=C(e,b,v,n,_);return s instanceof Promise?s.then(F):F(s)}F()},getLoci:function(e){return r?P(e,y,r.id):l.EmptyLoci},mark:function(e,t){return i.a.mark(r,e,t,U)},setVisibility:function(e){i.a.setVisibility(r,e)},setAlphaFactor:function(e){i.a.setAlphaFactor(r,e)},setPickable:function(e){i.a.setPickable(r,e)},setColorOnly:function(e){i.a.setColorOnly(r,e)},setTransform:function(e,t){i.a.setTransform(r,e,t)},setOverpaint:function(e){i.a.setOverpaint(r,e,U,!0)},setTransparency:function(e){i.a.setTransparency(r,e,U,!0)},setClipping:function(e){i.a.setClipping(r,e,U,!0)},destroy:function(){null==T||T(_),r&&(r.state.disposed=!0,r=void 0)},mustRecreate:D}}var P=Object(n.__assign)(Object(n.__assign)({},w.d),w.e);function E(e,t){return j(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),S.a.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:v.a.Utils}),t)}var A=Object(n.__assign)(Object(n.__assign)({},w.a),w.e);function D(e,t){return j(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),S.a.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:b.a.Utils}),t)}var T=Object(n.__assign)(Object(n.__assign)({},w.c),w.e);function I(e,t){return j(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),S.a.areEqual(i.size,a.size)||(t.updateSize=!0)},geometryUtils:y.a.Utils}),t)}var M=Object(n.__assign)(Object(n.__assign)({},w.h),w.e);function k(e,t){return j(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),S.a.areEqual(i.size,a.size)||(t.updateSize=!0),r.background!==n.background&&(t.createGeometry=!0),r.backgroundMargin!==n.backgroundMargin&&(t.createGeometry=!0),r.tether!==n.tether&&(t.createGeometry=!0),r.tetherLength!==n.tetherLength&&(t.createGeometry=!0),r.tetherBaseWidth!==n.tetherBaseWidth&&(t.createGeometry=!0),r.attachment!==n.attachment&&(t.createGeometry=!0),r.fontFamily!==n.fontFamily&&(t.createGeometry=!0),r.fontQuality!==n.fontQuality&&(t.createGeometry=!0),r.fontStyle!==n.fontStyle&&(t.createGeometry=!0),r.fontVariant!==n.fontVariant&&(t.createGeometry=!0),r.fontWeight!==n.fontWeight&&(t.createGeometry=!0)},geometryUtils:_.a.Utils}),t)}var B=Object(n.__assign)(Object(n.__assign)({},w.b),w.e);function V(e,t){return j(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),S.a.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:x.a.Utils}),t)}var R=Object(n.__assign)(Object(n.__assign)({},w.i),w.e);function L(e,t){return j(Object(n.__assign)(Object(n.__assign)({},e),{setUpdateState:function(t,r,n,i,a,o,s){e.setUpdateState(t,r,n,i,a,o,s),S.a.areEqual(i.size,a.size)||(t.createGeometry=!0)},geometryUtils:C.a.Utils}),t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(1);!function(e){function t(e,t,r){return{kind:"element-location",structure:e,unit:t,element:r||0}}e.create=t,e.clone=function(e){return t(e.structure,e.unit,e.element)},e.set=function(e,t,r,n){return t&&(e.structure=t),r&&(e.unit=r),void 0!==n&&(e.element=n),e},e.copy=function(e,t){return e.unit=t.unit,e.element=t.element,e},e.is=function(e){return!!e&&"element-location"===e.kind},e.areEqual=function(e,t){return e.unit===t.unit&&e.element===t.element};var r=i.Vec3.zero(),n=i.Vec3.zero();e.distance=function(e,t){return e.unit.conformation.position(e.element,r),t.unit.conformation.position(t.element,n),i.Vec3.distance(r,n)},e.residueIndex=function(e){return e.unit.model.atomicHierarchy.residueAtomSegments.index[e.element]},e.chainIndex=function(e){return e.unit.model.atomicHierarchy.chainAtomSegments.index[e.element]}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return l}));var n,i=r(0),a=r(202),o=r(135),s=r(2),u=r(87);function c(e){return e.map((function(e){return[e.name,e.provider.label,e.provider.category]}))}!function(e){function t(){return{color:a.a.Empty,size:o.a.Empty}}e.create=function(e,r,n,i){i=i||t();var a=n.colorTheme,o=n.sizeTheme;return i.color=e.colorThemeRegistry.create(a.name,r,a.params),i.size=e.sizeThemeRegistry.create(o.name,r,o.params),i},e.createEmpty=t,e.ensureDependencies=function(e,t,r,n){var a,o;return Object(i.__awaiter)(this,void 0,void 0,(function(){return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return[4,null===(a=t.colorThemeRegistry.get(n.colorTheme.name).ensureCustomProperties)||void 0===a?void 0:a.attach(e,r)];case 1:return i.sent(),[4,null===(o=t.sizeThemeRegistry.get(n.sizeTheme.name).ensureCustomProperties)||void 0===o?void 0:o.attach(e,r)];case 2:return i.sent(),[2]}}))}))},e.releaseDependencies=function(e,t,r){var n,i;null===(n=e.colorThemeRegistry.get(r.colorTheme.name).ensureCustomProperties)||void 0===n||n.detach(t),null===(i=e.sizeThemeRegistry.get(r.sizeTheme.name).ensureCustomProperties)||void 0===i||i.detach(t)}}(n||(n={}));var l=function(){function e(e,t){var r=this;this.emptyProvider=t,this._list=[],this._map=new Map,this._name=new Map,Object(u.c)(e,(function(e,t){if(e.name!==t)throw new Error("Fix build in themes to have matching names. "+e.name+" "+t);r.add(e)}))}return Object.defineProperty(e.prototype,"default",{get:function(){return this._list[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"types",{get:function(){return c(this._list)},enumerable:!1,configurable:!0}),e.prototype.sort=function(){this._list.sort((function(e,t){return e.provider.category===t.provider.category?e.provider.label<t.provider.label?-1:e.provider.label>t.provider.label?1:0:e.provider.category<t.provider.category?-1:1}))},e.prototype.add=function(e){if(this._map.has(e.name))throw new Error(e.name+" already registered.");var t=e.name;this._list.push({name:t,provider:e}),this._map.set(t,e),this._name.set(e,t),this.sort()},e.prototype.remove=function(e){this._list.splice(this._list.findIndex((function(t){return t.name===e.name})),1);var t=this._map.get(e.name);t&&(this._map.delete(e.name),this._name.delete(t))},e.prototype.has=function(e){return this._map.has(e.name)},e.prototype.get=function(e){return this._map.get(e)||this.emptyProvider},e.prototype.getName=function(e){if(!this._name.has(e))throw new Error("'"+e.label+"' is not a registered theme provider.");return this._name.get(e)},e.prototype.create=function(e,t,r){void 0===r&&(r={});var n=this.get(e);return n.factory(t,Object(i.__assign)(Object(i.__assign)({},s.ParamDefinition.getDefaultValues(n.getParams(t))),r))},e.prototype.getApplicableList=function(e){return this._list.filter((function(t){return t.provider.isApplicable(e)}))},e.prototype.getApplicableTypes=function(e){return c(this.getApplicableList(e))},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(59),i=r(9),a=r(1),o=r(134),s=r(299),u=r(4);function c(e,t,r){if(!e._rowCount)return[];for(var n=function(e){for(var t=e.id,r=e.matrix,n=e.vector,i=e._schema,o=new Map,s=0,u=e._rowCount;s<u;s++){var c=a.Tensor.toMat4(Object(a.Mat4)(),i.matrix.space,r.value(s)),l=a.Tensor.toVec3(Object(a.Vec3)(),i.vector.space,n.value(s));a.Mat4.setTranslation(c,l),a.Mat4.setValue(c,3,3,1),o.set(t.value(s),c)}return o}(r),i=[],o=0;o<e._rowCount;o++)i[i.length]=l(e,t,o,n);return i}function l(e,t,r,n){for(var i=e.id.value(r),a=e.details.value(r),c=[],l=t.assembly_id,m=t.oper_expression,h=t.asym_id_list,g=0,v=t._rowCount;g<v;g++)l.value(g)===i&&(c[c.length]={assemblyId:i,expression:m.value(g),asymIds:h.value(g)});return s.a.create(i,a,function(e,t){return function(){for(var r=[],n=0,i=0;i<e.length;i++){var a=e[i],s=d(p(a.expression)),c=f(t,s,n,a.assemblyId),l=u.Queries.generators.atoms({chainTest:u.Queries.pred.and(u.Queries.pred.eq((function(e){return u.StructureProperties.unit.operator_name(e.element)}),o.a.DefaultName),u.Queries.pred.inSet((function(e){return u.StructureProperties.chain.label_asym_id(e.element)}),a.asymIds))});r[r.length]={selector:l,operators:c},n+=c.length}return r}}(c,n))}function d(e){for(var t=[],r=[],n=0;n<e.length;n++)r[n]="";return function e(t,r,n,i){if(n<0)return void(r[r.length]=i.slice(0));for(var a=t[n],o=a.length,s=0;s<o;s++)i[n]=a[s],e(t,r,n-1,i)}(e,t,e.length-1,r),t}function f(e,t,r,n){for(var i=[],s=r,u=0,c=t;u<c.length;u++){for(var l=c[u],d=a.Mat4.identity(),f=0;f<l.length;f++)a.Mat4.mul(d,d,e.get(l[f]));s++,i[i.length]=o.a.create("ASM_"+s,d,{assembly:{id:n,operId:s,operList:l}})}return i}function p(e){for(var t,r=/\(?([^\(\)]+)\)?]*/g,n=[],i=[];t=r.exec(e);)n[n.length]=t[1];return n.forEach((function(e){var t=[];e.split(",").forEach((function(e){var r=e.indexOf("-");if(r>0)for(var n=parseInt(e.substring(0,r)),i=parseInt(e.substr(r+1)),a=n;a<=i;a++)t[t.length]=a.toString();else t[t.length]=e.trim()})),i[i.length]=t})),i}var m,h,g=r(157);function v(e){if(0!==e._rowCount){for(var t=e.id,r=e.matrix,o=e.vector,s=n.a.struct_ncs_oper.matrix.space,u=n.a.struct_ncs_oper.vector.space,c=[],l=0;l<e._rowCount;l++){var d=a.Tensor.toMat3(Object(a.Mat3)(),s,r.value(l)),f=a.Tensor.toVec3(Object(a.Vec3)(),u,o.value(l));if(i.h.checkIfRotationAndTranslation(d,f)&&("given"!==e.code.value(l)||a.Mat3.isIdentity(d)||a.Vec3.isZero(f))){var p=t.value(l);c[c.length]=i.h.ofRotationAndOffset("ncs_"+p,d,f,p)}}return c}}(h=m||(m={})).Descriptor={name:"model_symmetry"},h.Provider=g.a.create(h.Descriptor),h.fromData=function(e){var t=c(e.pdbx_struct_assembly,e.pdbx_struct_assembly_gen,e.pdbx_struct_oper_list),r=function(e,t){if(0===e._rowCount||0===t._rowCount)return i.e.ZeroP1;var r=function(e){var t=e.Int_Tables_number.value(0),r=e["space_group_name_H-M"].value(0);return e.Int_Tables_number.isDefined?e["space_group_name_H-M"].isDefined?r:t:r}(e),n=i.f.create(r,a.Vec3.create(t.length_a.value(0),t.length_b.value(0),t.length_c.value(0)),a.Vec3.scale(a.Vec3.zero(),a.Vec3.create(t.angle_alpha.value(0),t.angle_beta.value(0),t.angle_gamma.value(0)),Math.PI/180));return i.e.create(n)}(e.symmetry,e.cell);return{assemblies:t,spacegroup:r,isNonStandardCrystalFrame:(e.atom_sites._rowCount,!1),ncsOperators:v(e.struct_ncs_oper)}},h.fromCell=function(e,t){var r=i.f.create("P 1",e,t);return{assemblies:[],spacegroup:i.e.create(r),isNonStandardCrystalFrame:!1}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(348);!function(e){e.toArray=function(e){return Object(i.d)(e.values())},e.isSuperset=function(e,t){var r=!0;return t.forEach((function(t){e.has(t)||(r=!1)})),r},e.add=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];for(var n=0;n<t.length;n++)t[n].forEach((function(t){return e.add(t)}));return e},e.union=function(e,t){var r=new Set(e);return t.forEach((function(e){return r.add(e)})),r},e.unionMany=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)return new Set;1===e.length&&new Set(e[0]);for(var r=new Set(e[0]),n=1,i=e.length;n<i;n++)e[n].forEach((function(e){return r.add(e)}));return r},e.unionManyArrays=function(e){if(0===e.length)return new Set;for(var t=new Set(e[0]),r=1;r<e.length;r++)for(var n=0,i=e[r];n<i.length;n++){var a=i[n];t.add(a)}return t},e.intersection=function(e,t){var r=new Set;return t.forEach((function(t){e.has(t)&&r.add(t)})),r},e.areIntersecting=function(e,t){var r=!1;return t.forEach((function(t){e.has(t)&&(r=!0)})),r},e.intersectionSize=function(e,t){var r=0;return t.forEach((function(t){e.has(t)&&(r+=1)})),r},e.difference=function(e,t){var r=new Set(e);return t.forEach((function(e){return r.delete(e)})),r},e.differenceSize=function(e,t){var r=e.size;return e.forEach((function(e){t.has(e)&&(r-=1)})),r},e.areEqual=function(e,t){if(e.size!==t.size)return!1;var r=!0;return t.forEach((function(t){e.has(t)||(r=!1)})),r}}(n||(n={}))},function(e,t,r){"use strict";var n=r(107),i=r(25),a=r(70);function o(){return o.zero()}!function(e){function t(){var e=[.1,0,0];return e[0]=0,e}function r(e,r,n){var i=t();return i[0]=e,i[1]=r,i[2]=n,i}function o(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e}function s(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function u(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function c(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function l(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}function d(e,t){var r=t[0],n=t[1],i=t[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),e[0]=t[0]*a,e[1]=t[1]*a,e[2]=t[2]*a),e}function f(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function p(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2];return e[0]=i*u-a*s,e[1]=a*o-n*u,e[2]=n*s-i*o,e}e.zero=t,e.clone=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},e.hasNaN=function(e){return isNaN(e[0])||isNaN(e[1])||isNaN(e[2])},e.setNaN=function(e){return e[0]=NaN,e[1]=NaN,e[2]=NaN,e},e.fromObj=function(e){return r(e.x,e.y,e.z)},e.toObj=function(e){return{x:e[0],y:e[1],z:e[2]}},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t},e.create=r,e.ofArray=function(e){var r=t();return r[0]=e[0],r[1]=e[1],r[2]=e[2],r},e.set=function(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e},e.copy=o,e.add=s,e.sub=u,e.mul=function(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e},e.div=function(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e},e.scale=c,e.scaleAndAdd=function(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e},e.scaleAndSub=function(e,t,r,n){return e[0]=t[0]-r[0]*n,e[1]=t[1]-r[1]*n,e[2]=t[2]-r[2]*n,e},e.addScalar=function(e,t,r){return e[0]=t[0]+r,e[1]=t[1]+r,e[2]=t[2]+r,e},e.subScalar=function(e,t,r){return e[0]=t[0]-r,e[1]=t[1]-r,e[2]=t[2]-r,e},e.round=function(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e},e.ceil=function(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e},e.floor=function(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e},e.trunc=function(e,t){return e[0]=Math.trunc(t[0]),e[1]=Math.trunc(t[1]),e[2]=Math.trunc(t[2]),e},e.abs=function(e,t){return e[0]=Math.abs(t[0]),e[1]=Math.abs(t[1]),e[2]=Math.abs(t[2]),e},e.min=function(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e},e.max=function(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e},e.distance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)},e.squaredDistance=function(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i},e.magnitude=function(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)},e.squaredMagnitude=l,e.setMagnitude=function(t,r,n){return e.scale(t,e.normalize(t,r),n)},e.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},e.inverse=function(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e},e.normalize=d,e.dot=f,e.cross=p,e.lerp=function(e,t,r,n){var i=t[0],a=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=a+n*(r[1]-a),e[2]=o+n*(r[2]-o),e};var m=t();function h(e,t){var r=f(e,t)/Math.sqrt(l(e)*l(t));return Math.acos(Object(a.a)(r,-1,1))}e.slerp=function(t,r,n,i){var o=Object(a.a)(e.dot(r,n),-1,1),s=Math.acos(o)*i;return e.scaleAndAdd(m,n,r,-o),e.normalize(m,m),e.add(t,e.scale(t,r,Math.cos(s)),e.scale(m,m,Math.sin(s)))},e.hermite=function(e,t,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,u=o*(a-2)+a,c=o*(a-1),l=o*(3-2*a);return e[0]=t[0]*s+r[0]*u+n[0]*c+i[0]*l,e[1]=t[1]*s+r[1]*u+n[1]*c+i[1]*l,e[2]=t[2]*s+r[2]*u+n[2]*c+i[2]*l,e},e.bezier=function(e,t,r,n,i,a){var o=1-a,s=o*o,u=a*a,c=s*o,l=3*a*s,d=3*u*o,f=u*a;return e[0]=t[0]*c+r[0]*l+n[0]*d+i[0]*f,e[1]=t[1]*c+r[1]*l+n[1]*d+i[1]*f,e[2]=t[2]*c+r[2]*l+n[2]*d+i[2]*f,e},e.quadraticBezier=function(e,t,r,n,i){return e[0]=Object(a.c)(t[0],r[0],n[0],i),e[1]=Object(a.c)(t[1],r[1],n[1],i),e[2]=Object(a.c)(t[2],r[2],n[2],i),e},e.spline=function(e,t,r,n,i,o,s){return e[0]=Object(a.d)(t[0],r[0],n[0],i[0],o,s),e[1]=Object(a.d)(t[1],r[1],n[1],i[1],o,s),e[2]=Object(a.d)(t[2],r[2],n[2],i[2],o,s),e},e.random=function(e,t){var r=2*Math.random()*Math.PI,n=2*Math.random()-1,i=Math.sqrt(1-n*n)*t;return e[0]=Math.cos(r)*i,e[1]=Math.sin(r)*i,e[2]=n*t,e},e.transformMat4=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=1/(r[3]*n+r[7]*i+r[11]*a+r[15]||1);return e[0]=(r[0]*n+r[4]*i+r[8]*a+r[12])*o,e[1]=(r[1]*n+r[5]*i+r[9]*a+r[13])*o,e[2]=(r[2]*n+r[6]*i+r[10]*a+r[14])*o,e},e.transformMat4Offset=function(e,t,r,n,i,a){var o=t[0+i],s=t[1+i],u=t[2+i],c=1/(r[3+a]*o+r[7+a]*s+r[11+a]*u+r[15+a]||1);return e[0+n]=(r[0+a]*o+r[4+a]*s+r[8+a]*u+r[12+a])*c,e[1+n]=(r[1+a]*o+r[5+a]*s+r[9+a]*u+r[13+a])*c,e[2+n]=(r[2+a]*o+r[6+a]*s+r[10+a]*u+r[14+a])*c,e},e.transformMat3=function(e,t,r){var n=t[0],i=t[1],a=t[2];return e[0]=n*r[0]+i*r[3]+a*r[6],e[1]=n*r[1]+i*r[4]+a*r[7],e[2]=n*r[2]+i*r[5]+a*r[8],e},e.transformQuat=function(e,t,r){var n=t[0],i=t[1],a=t[2],o=r[0],s=r[1],u=r[2],c=r[3],l=c*n+s*a-u*i,d=c*i+u*n-o*a,f=c*a+o*i-s*n,p=-o*n-s*i-u*a;return e[0]=l*c+p*-o+d*-u-f*-s,e[1]=d*c+p*-s+f*-o-l*-u,e[2]=f*c+p*-u+l*-s-d*-o,e},e.angle=h;var g=t(),v=t(),b=t(),y=t(),_=t(),S=t(),x=t();e.dihedralAngle=function(e,t,r,n){u(g,e,t),u(v,r,t),u(b,t,r),u(y,n,r),p(_,g,v),p(S,b,y);var i=h(_,S);return p(x,_,S),f(v,x)>0?i:-i},e.exactEquals=function(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]},e.equals=function(e,t){var r=e[0],n=e[1],a=e[2],o=t[0],s=t[1],u=t[2];return Math.abs(r-o)<=i.a*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(n-s)<=i.a*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(a-u)<=i.a*Math.max(1,Math.abs(a),Math.abs(u))};var O=t();function w(e,t,r){return c(e,r,f(r,t)/l(r))}e.makeRotation=function(t,r,a){var o=h(r,a);if(Math.abs(o)<1e-4)return n.a.setIdentity(t);if(Math.abs(o-Math.PI)<i.a)return n.a.fromScaling(t,e.negUnit);var s=p(O,r,a);return n.a.fromRotation(t,o,s)},e.isZero=function(e){return 0===e[0]&&0===e[1]&&0===e[2]},e.projectPointOnVector=function(e,t,r,n){u(e,o(e,t),n);var i=f(r,e)/l(r);return s(e,c(e,o(e,r),i),n)},e.projectOnVector=w;var C=t();e.projectOnPlane=function(e,t,r){return w(C,t,r),u(e,t,C)},e.orthogonalize=function(e,t,r){return d(e,p(e,p(e,t,r),t))},e.matchDirection=function(t,r,n){return e.dot(r,n)>0?e.copy(t,r):e.negate(t,e.copy(t,r)),t};var j=t(),P=t();e.triangleNormal=function(e,t,r,n){return u(j,r,t),u(P,n,t),d(e,p(e,j,P))},e.toString=function(e,t){return"["+e[0].toPrecision(t)+" "+e[1].toPrecision(t)+" "+e[2].toPrecision(t)+"]"},e.origin=e.create(0,0,0),e.unit=e.create(1,1,1),e.negUnit=e.create(-1,-1,-1),e.unitX=e.create(1,0,0),e.unitY=e.create(0,1,0),e.unitZ=e.create(0,0,1)}(o||(o={})),t.a=o},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return o}));var n=r(0),i=r(5);function a(){var e=function(t,r){return t.commands.dispatch(e,r||{})};return e.subscribe=function(t,r){return t.commands.subscribe(e,r)},e.id=i.c.create22(),e}var o=function(){function e(){this.subs=new Map,this.disposing=!1}return e.prototype.subscribe=function(e,t){var r=this,n=this.subs.get(e.id);return n||(n=[],this.subs.set(e.id,n)),n.push(t),{unsubscribe:function(){var n=r.subs.get(e.id);if(n){var i=n.indexOf(t);if(!(i<0)){for(var a=i+1;a<n.length;a++)n[a-1]=n[a];n.pop()}}}}},e.prototype.dispatch=function(e,t){var r=this;return new Promise((function(n,i){r.disposing?i("disposed"):r.subs.get(e.id)?r.resolve({cmd:e,params:t,resolve:n,reject:i}):n()}))},e.prototype.dispose=function(){this.subs.clear()},e.prototype.resolve=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(!(t=this.subs.get(e.cmd.id)))return e.resolve(),[2];n.label=1;case 1:n.trys.push([1,6,,7]),r=0,i=t,n.label=2;case 2:return r<i.length?[4,(0,i[r])(e.params)]:[3,5];case 3:n.sent(),n.label=4;case 4:return r++,[3,2];case 5:return e.resolve(),[3,7];case 6:return a=n.sent(),e.reject(a),[3,7];case 7:return[2]}}))}))},e}()},function(e,t,r){"use strict";function n(e,t){void 0===e&&(e=0),void 0===t&&(t=Number.MAX_SAFE_INTEGER);var r=e;return function(){var e=r;return r=(r+1)%t,e}}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.r(t),r.d(t,"ColorLists",(function(){return a})),r.d(t,"ColorListNames",(function(){return o})),r.d(t,"ColorListOptions",(function(){return s})),r.d(t,"ColorListOptionsScale",(function(){return u})),r.d(t,"ColorListOptionsSet",(function(){return c})),r.d(t,"getColorListFromName",(function(){return l}));var n=r(46),i=r(42),a={"orange-red":Object(n.ColorList)("Orange-Red","sequential","Orange-Red, sequential color scheme from ColorBrewer 2.0",[16775148,16705736,16635038,16628612,16551257,15689032,14102559,11730944,8323072]),"purple-blue":Object(n.ColorList)("Purple-Blue","sequential","Purple-Blue, sequential color scheme from ColorBrewer 2.0",[16775163,15525874,13685222,10927579,7645647,3576e3,356528,285325,145496]),"blue-purple":Object(n.ColorList)("Blue-Purple","sequential","Blue-Purple, sequential color scheme from ColorBrewer 2.0",[16252157,14740724,12571622,10403034,9213638,9202609,8929693,8458108,5046347]),oranges:Object(n.ColorList)("Oranges","sequential","",[16774635,16705230,16634018,16625259,16616764,15821075,14239745,10892803,8333060]),"blue-green":Object(n.ColorList)("Blue-Green","sequential","",[16252157,15070713,13429990,10082505,6734500,4304502,2329413,27948,17435]),"yellow-orange-brown":Object(n.ColorList)("Yellow-Orange-Brown","sequential","",[16777189,16775100,16704401,16696399,16685353,15495188,13388802,10040324,6694150]),"yellow-green":Object(n.ColorList)("Yellow-Green","sequential","",[16777189,16252089,14282915,11394446,7915129,4303709,2327619,26679,17705]),reds:Object(n.ColorList)("Reds","sequential","",[16774640,16703698,16563105,16552562,16476746,15678252,13309981,10817301,6750221]),"red-purple":Object(n.ColorList)("Red-Purple","sequential","",[16775155,16638173,16565696,16424885,16214177,14496919,11403646,7995767,4784234]),greens:Object(n.ColorList)("Greens","sequential","",[16252149,15070688,13101504,10607003,7652470,4303709,2329413,27948,17435]),"yellow-green-blue":Object(n.ColorList)("Yellow-Green-Blue","sequential","",[16777177,15595697,13101492,8375739,4306628,1937856,2252456,2438292,531800]),purples:Object(n.ColorList)("Purples","sequential","",[16579581,15724021,14342891,12369372,10394312,8420794,6967715,5515151,4128893]),"green-blue":Object(n.ColorList)("Green-Blue","sequential","",[16252144,14742491,13429701,11066805,8113348,5157843,2854078,551084,540801]),greys:Object(n.ColorList)("Greys","sequential","",[16777215,15790320,14277081,12434877,9868950,7566195,5395026,2434341,0]),"yellow-orange-red":Object(n.ColorList)("Yellow-Orange-Red","sequential","",[16777164,16772512,16701814,16691788,16616764,16535082,14883356,12386342,8388646]),"purple-red":Object(n.ColorList)("Purple-Red","sequential","",[16250105,15196655,13941210,13210823,14640560,15149450,13505110,9961539,6750239]),blues:Object(n.ColorList)("Blues","sequential","",[16251903,14609399,13032431,10406625,7057110,4362950,2191797,545180,536683]),"purple-blue-green":Object(n.ColorList)("Purple-Blue-Green","sequential","",[16775163,15524592,13685222,10927579,6793679,3576e3,164234,93273,83510]),spectral:Object(n.ColorList)("Spectral","diverging","",[10355010,13975119,16018755,16625249,16703627,16777151,15136152,11263396,6734501,3311805,6180770]),"red-yellow-green":Object(n.ColorList)("Red-Yellow-Green","diverging","",[10813478,14102567,16018755,16625249,16703627,16777151,14282635,10934634,6733155,1742928,26679]),"red-blue":Object(n.ColorList)("Red-Blue","diverging","",[6750239,11671595,14049357,16033154,16636871,16250871,13755888,9618910,4428739,2188972,340065]),"pink-yellow-green":Object(n.ColorList)("Pink-Yellow-Green","diverging","",[9306450,12917629,14579630,15840986,16638191,16250871,15136208,12116358,8371265,5083681,2581529]),"purple-green":Object(n.ColorList)("Purple-Green","diverging","",[4194379,7744131,10055851,12756431,15193320,16250871,14282963,10935200,5942881,1800247,17435]),"red-yellow-blue":Object(n.ColorList)("Red-Yellow-Blue","diverging","Red-Yellow-Blue, diverging color scheme from ColorBrewer 2.0",[10813478,14102567,16018755,16625249,16703632,16777151,14742520,11262441,7646673,4552116,3225237]),"brown-white-green":Object(n.ColorList)("Brown-White-Green","diverging","",[5517317,9195786,12550445,14664317,16181443,16119285,13101797,8441281,3512207,91742,15408]),"red-grey":Object(n.ColorList)("Red-Grey","diverging","",[6750239,11671595,14049357,16033154,16636871,16777215,14737632,12237498,8882055,5066061,1710618]),"orange-purple":Object(n.ColorList)("Orange-Purple","diverging","",[8338184,11753478,14713364,16627811,16703670,16250871,14211819,11709394,8418220,5515144,2949195]),"set-2":Object(n.ColorList)("Set-2","qualitative","",[6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),accent:Object(n.ColorList)("Accent","qualitative","",[8374655,12496596,16629894,16777113,3697840,15729279,12540695,6710886]),"set-1":Object(n.ColorList)("Set-1","qualitative","",[14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329]),"set-3":Object(n.ColorList)("Set-3","qualitative","",[9294791,16777139,12499674,16482418,8434131,16626786,11787881,16567781,14277081,12353725,13429701,16772463]),"dark-2":Object(n.ColorList)("Dark-2","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886]),paired:Object(n.ColorList)("Paired","qualitative","",[10931939,2062516,11722634,3383340,16489113,14883356,16629615,16744192,13284054,6962586,16777113,11622696]),"pastel-2":Object(n.ColorList)("Pastel-2","qualitative","",[11789005,16633260,13358568,16042724,15136201,16773806,15852236,13421772]),"pastel-1":Object(n.ColorList)("Pastel-1","qualitative","",[16495790,11783651,13429701,14601188,16701862,16777164,15063229,16636652,15921906]),"many-distinct":Object(n.ColorList)("Many-Distinct","qualitative","",[1810039,14245634,7696563,15149450,6727198,15117058,10909213,6710886,14948892,3636920,5091146,9981603,16744192,16777011,10901032,16220607,10066329,6734501,16551266,9281739,15174339,10934356,16767279,15058068,11776947]),magma:Object(n.ColorList)("Magma","sequential","Perceptually uniform shades of black-red-white",[4329332,4853881,5378684,5903742,6363263,6888576,7413633,7938689,8463745,8988801,9513600,10038655,10563454,11088508,11613562,12138360,12728949,13254258,13714030,14239338,14699366,15094114,15489119,15753309,16017499,16216411,16350045,16483424,16551523,16619368,16621934,16689780,16692091,16694402,16696969,16633746,16636058,16638371,16575148,16577461,16514239]),inferno:Object(n.ColorList)("Inferno","sequential","Perceptually uniform shades of black-red-yellow",[4721514,5246316,5771373,6296430,6821486,7346542,7871597,8396651,8921450,9446504,9971557,10496610,10956127,11481435,12006486,12466258,12926285,13386056,13780802,14241085,14570295,14965297,15229227,15558693,15757342,15956248,16154897,16288267,16421638,16489734,16492043,16494612,16496926,16368426,16305463,16111429,15982678,15853928,15856253,16119953,16580260]),plasma:Object(n.ColorList)("Plasma","sequential","Perceptually uniform shades of blue-red-yellow",[1771148,2426257,3081365,3671193,4195228,4784799,5308834,5833124,6357158,6815911,7340200,7864744,8324007,8783782,9309348,9769377,10164126,10624154,11018902,11413393,11808141,12137352,12466307,12795519,13124730,13453685,13717361,14046573,14309992,14573668,14837344,15035483,15299159,15497299,15695438,15893834,16091974,16224833,16357693,16425017,16557877,16625457,16627245,16629289,16631334,16567845,16438820,16310052,16115494,15921190,15726625]),viridis:Object(n.ColorList)("Viridis","sequential","Perceptually uniform shades of blue-green-yellow",[4524123,4656994,4658793,4726127,4727668,4663929,4599933,4535937,4406404,4276870,4081800,3952010,3822475,3627148,3497356,3302029,3172237,3042446,2912654,2782862,2652814,2523022,2393229,2328973,2198924,2069132,2004874,2005897,2007175,2139525,2337154,2666111,3060348,3520376,4045684,4570991,5227369,5883748,6605661,7392854,8180303,8967495,9819967,10672695,11525166,12443174,13295646,14148121,15000344,15852828,16639780]),cividis:Object(n.ColorList)("Cividis","sequential","Perceptually uniform shades of blue-green-yellow, should look effectively identical to colorblind and non-colorblind users",[11367,12400,537456,1455727,2046574,2571629,3031404,3425388,3754092,4148075,4476779,4805227,5133932,5396844,5725549,5988462,6317166,6580079,6843249,7171698,7434867,7697781,7960951,8289656,8618104,8881272,9209976,9538679,9867127,10195830,10524533,10853235,11181938,11510640,11839343,12168045,12497002,12891240,13219941,13548642,13943134,14271834,14666326,14995025,15389516,15718470,16112703,16507190,16639799]),twilight:Object(n.ColorList)("Twilight","sequential","Perceptually uniform shades of white-blue-black-red-white, cyclic",[14670305,14211037,13554648,12766675,11847630,10993866,10139847,9351365,8628419,8036290,7509952,7048895,6718653,6519739,6386105,6252470,6184114,6181293,6112935,6044831,5976470,5777291,5447293,5052270,4592479,4067665,3674181,3281211,3150646,3543352,4067644,4657728,5379141,6166345,6953549,7741007,8463184,9120336,9777743,10304079,10830671,11291984,11687762,12083541,12348505,12613471,12878439,13077872,13211771,13411209,13545111,13809830,14074293,14338756,14537169,14735067,14801121]),turbo:Object(n.ColorList)("Turbo","sequential","Improved (smooth) rainbow colormap for visualization",[4866485,4872413,4354034,3770361,3120629,2667241,2475736,2611140,3073454,3928216,5109892,6487408,8126047,9829201,11531332,13167162,14605618,15780908,16693543,16753699,16748063,16741916,16146200,15026195,13644558,12198408,10818563,9833728]),rainbow:Object(n.ColorList)("Rainbow","sequential","",[3367393,3516485,16383744,15501073,12526114]),"red-white-blue":Object(n.ColorList)("Red-White-Blue","diverging","",[12526114,16777215,3367393])},o=Object.keys(a),s=o.map((function(e){return[e,a[e].label,Object(i.b)(a[e].type)]})),u=s.filter((function(e){return"diverging"===a[e[0]].type||"sequential"===a[e[0]].type})),c=s.filter((function(e){return"qualitative"===a[e[0]].type}));function l(e){return e in a?a[e]:(console.warn("unknown color list named '"+e+"'"),a["red-yellow-blue"])}},function(e,t,r){"use strict";function n(e,t,r){for(;t<r&&32===e.charCodeAt(t);)t++;return i(e,t,r)}function i(e,t,r){var n=t,i=0,a=1;for(45===e.charCodeAt(n)?(a=-1,++n):43===e.charCodeAt(n)&&++n;n<r;n++){var o=e.charCodeAt(n)-48;if(o>9||o<0)return a*i|0;i=10*i+o|0}return a*i}function a(e,t,r,n){return 43===t.charCodeAt(r)&&r++,e*Math.pow(10,i(t,r,n))}function o(e,t,r){for(;t<r&&32===e.charCodeAt(t);)t++;return s(e,t,r)}function s(e,t,r){var n=t,i=1,o=0,s=0,u=1;for(45===e.charCodeAt(n)?(i=-1,++n):43===e.charCodeAt(n)&&++n;n<r;){var c=e.charCodeAt(n)-48;if(!(c>=0&&c<10)){if(-2===c){for(++n;n<r;){if(!((c=e.charCodeAt(n)-48)>=0&&c<10))return 53===c||21===c?a(i*(o+s/u),e,n+1,r):i*(o+s/u);s=10*s+c,u*=10,++n}return i*(o+s/u)}if(53===c||21===c)return a(i*o,e,n+1,r);break}o=10*o+c,++n}return i*o}function u(e,t,r){return 43===e.charCodeAt(t)&&t++,function(e,t,r){for(45===e.charCodeAt(t)&&t++;t<r;t++){var n=e.charCodeAt(t)-48;if(n>9||n<0)return!1}return!0}(e,t,r)?2:3}function c(e){var t=0,r=e.length;if(45===e.charCodeAt(t)&&++t,46===e.charCodeAt(t)&&r-t==1)return 3;for(;t<r;){var n=e.charCodeAt(t)-48;if(!(n>=0&&n<10)){if(-2===n){++t;for(var i=!1;t<r;){if(!((n=e.charCodeAt(t)-48)>=0&&n<10))return 53===n||21===n?u(e,t+1,r):3;i=!0,++t}return i?1:0}if(53===n||21===n)return 0===t||1===t&&45===e.charCodeAt(0)?3:u(e,t+1,r);break}++t}return t===r?0:3}r.d(t,"e",(function(){return n})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return c}))},function(e,t,r){e.exports=function(){"use strict";var e=Array.prototype.slice;function t(e,t){t&&(e.prototype=Object.create(t.prototype)),e.prototype.constructor=e}function r(e){return o(e)?e:z(e)}function n(e){return s(e)?e:H(e)}function i(e){return u(e)?e:G(e)}function a(e){return o(e)&&!c(e)?e:q(e)}function o(e){return!(!e||!e[d])}function s(e){return!(!e||!e[f])}function u(e){return!(!e||!e[p])}function c(e){return s(e)||u(e)}function l(e){return!(!e||!e[m])}t(n,r),t(i,r),t(a,r),r.isIterable=o,r.isKeyed=s,r.isIndexed=u,r.isAssociative=c,r.isOrdered=l,r.Keyed=n,r.Indexed=i,r.Set=a;var d="@@__IMMUTABLE_ITERABLE__@@",f="@@__IMMUTABLE_KEYED__@@",p="@@__IMMUTABLE_INDEXED__@@",m="@@__IMMUTABLE_ORDERED__@@",h={},g={value:!1},v={value:!1};function b(e){return e.value=!1,e}function y(e){e&&(e.value=!0)}function _(){}function S(e,t){t=t||0;for(var r=Math.max(0,e.length-t),n=new Array(r),i=0;i<r;i++)n[i]=e[i+t];return n}function x(e){return void 0===e.size&&(e.size=e.__iterate(w)),e.size}function O(e,t){if("number"!=typeof t){var r=t>>>0;if(""+r!==t||4294967295===r)return NaN;t=r}return t<0?x(e)+t:t}function w(){return!0}function C(e,t,r){return(0===e||void 0!==r&&e<=-r)&&(void 0===t||void 0!==r&&t>=r)}function j(e,t){return E(e,t,0)}function P(e,t){return E(e,t,t)}function E(e,t,r){return void 0===e?r:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var A,D,T,I="function"==typeof Symbol&&Symbol.iterator,M=I||"@@iterator";function k(e){this.next=e}function B(e,t,r,n){var i=0===e?t:1===e?r:[t,r];return n?n.value=i:n={value:i,done:!1},n}function V(){return{value:void 0,done:!0}}function R(e){return!!F(e)}function L(e){return e&&"function"==typeof e.next}function N(e){var t=F(e);return t&&t.call(e)}function F(e){var t=e&&(I&&e[I]||e["@@iterator"]);if("function"==typeof t)return t}function U(e){return e&&"number"==typeof e.length}function z(e){return null==e?Z():o(e)?e.toSeq():function(e){var t=ee(e)||"object"==typeof e&&new X(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}(e)}function H(e){return null==e?Z().toKeyedSeq():o(e)?s(e)?e.toSeq():e.fromEntrySeq():J(e)}function G(e){return null==e?Z():o(e)?s(e)?e.entrySeq():e.toIndexedSeq():$(e)}function q(e){return(null==e?Z():o(e)?s(e)?e.entrySeq():e:$(e)).toSetSeq()}function W(e){this._array=e,this.size=e.length}function X(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function Y(e){this._iterable=e,this.size=e.length||e.size}function Q(e){this._iterator=e,this._iteratorCache=[]}function K(e){return!(!e||!e["@@__IMMUTABLE_SEQ__@@"])}function Z(){return A||(A=new W([]))}function J(e){var t=Array.isArray(e)?new W(e).fromEntrySeq():L(e)?new Q(e).fromEntrySeq():R(e)?new Y(e).fromEntrySeq():"object"==typeof e?new X(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function $(e){var t=ee(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function ee(e){return U(e)?new W(e):L(e)?new Q(e):R(e)?new Y(e):void 0}function te(e,t,r,n){var i=e._cache;if(i){for(var a=i.length-1,o=0;o<=a;o++){var s=i[r?a-o:o];if(!1===t(s[1],n?s[0]:o,e))return o+1}return o}return e.__iterateUncached(t,r)}function re(e,t,r,n){var i=e._cache;if(i){var a=i.length-1,o=0;return new k((function(){var e=i[r?a-o:o];return o++>a?{value:void 0,done:!0}:B(t,n?e[0]:o-1,e[1])}))}return e.__iteratorUncached(t,r)}function ne(e,t){return t?function e(t,r,n,i){return Array.isArray(r)?t.call(i,n,G(r).map((function(n,i){return e(t,n,i,r)}))):ae(r)?t.call(i,n,H(r).map((function(n,i){return e(t,n,i,r)}))):r}(t,e,"",{"":e}):ie(e)}function ie(e){return Array.isArray(e)?G(e).map(ie).toList():ae(e)?H(e).map(ie).toMap():e}function ae(e){return e&&(e.constructor===Object||void 0===e.constructor)}function oe(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function se(e,t){if(e===t)return!0;if(!o(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||s(e)!==s(t)||u(e)!==u(t)||l(e)!==l(t))return!1;if(0===e.size&&0===t.size)return!0;var r=!c(e);if(l(e)){var n=e.entries();return t.every((function(e,t){var i=n.next().value;return i&&oe(i[1],e)&&(r||oe(i[0],t))}))&&n.next().done}var i=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{i=!0;var a=e;e=t,t=a}var d=!0,f=t.__iterate((function(t,n){if(r?!e.has(t):i?!oe(t,e.get(n,h)):!oe(e.get(n,h),t))return d=!1,!1}));return d&&e.size===f}function ue(e,t){if(!(this instanceof ue))return new ue(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(D)return D;D=this}}function ce(e,t){if(!e)throw new Error(t)}function le(e,t,r){if(!(this instanceof le))return new le(e,t,r);if(ce(0!==r,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),r=void 0===r?1:Math.abs(r),t<e&&(r=-r),this._start=e,this._end=t,this._step=r,this.size=Math.max(0,Math.ceil((t-e)/r-1)+1),0===this.size){if(T)return T;T=this}}function de(){throw TypeError("Abstract")}function fe(){}function pe(){}function me(){}k.prototype.toString=function(){return"[Iterator]"},k.KEYS=0,k.VALUES=1,k.ENTRIES=2,k.prototype.inspect=k.prototype.toSource=function(){return this.toString()},k.prototype[M]=function(){return this},t(z,r),z.of=function(){return z(arguments)},z.prototype.toSeq=function(){return this},z.prototype.toString=function(){return this.__toString("Seq {","}")},z.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},z.prototype.__iterate=function(e,t){return te(this,e,t,!0)},z.prototype.__iterator=function(e,t){return re(this,e,t,!0)},t(H,z),H.prototype.toKeyedSeq=function(){return this},t(G,z),G.of=function(){return G(arguments)},G.prototype.toIndexedSeq=function(){return this},G.prototype.toString=function(){return this.__toString("Seq [","]")},G.prototype.__iterate=function(e,t){return te(this,e,t,!1)},G.prototype.__iterator=function(e,t){return re(this,e,t,!1)},t(q,z),q.of=function(){return q(arguments)},q.prototype.toSetSeq=function(){return this},z.isSeq=K,z.Keyed=H,z.Set=q,z.Indexed=G,z.prototype["@@__IMMUTABLE_SEQ__@@"]=!0,t(W,G),W.prototype.get=function(e,t){return this.has(e)?this._array[O(this,e)]:t},W.prototype.__iterate=function(e,t){for(var r=this._array,n=r.length-1,i=0;i<=n;i++)if(!1===e(r[t?n-i:i],i,this))return i+1;return i},W.prototype.__iterator=function(e,t){var r=this._array,n=r.length-1,i=0;return new k((function(){return i>n?{value:void 0,done:!0}:B(e,i,r[t?n-i++:i++])}))},t(X,H),X.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},X.prototype.has=function(e){return this._object.hasOwnProperty(e)},X.prototype.__iterate=function(e,t){for(var r=this._object,n=this._keys,i=n.length-1,a=0;a<=i;a++){var o=n[t?i-a:a];if(!1===e(r[o],o,this))return a+1}return a},X.prototype.__iterator=function(e,t){var r=this._object,n=this._keys,i=n.length-1,a=0;return new k((function(){var o=n[t?i-a:a];return a++>i?{value:void 0,done:!0}:B(e,o,r[o])}))},X.prototype[m]=!0,t(Y,G),Y.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var r=N(this._iterable),n=0;if(L(r))for(var i;!(i=r.next()).done&&!1!==e(i.value,n++,this););return n},Y.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=N(this._iterable);if(!L(r))return new k(V);var n=0;return new k((function(){var t=r.next();return t.done?t:B(e,n++,t.value)}))},t(Q,G),Q.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var r,n=this._iterator,i=this._iteratorCache,a=0;a<i.length;)if(!1===e(i[a],a++,this))return a;for(;!(r=n.next()).done;){var o=r.value;if(i[a]=o,!1===e(o,a++,this))break}return a},Q.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var r=this._iterator,n=this._iteratorCache,i=0;return new k((function(){if(i>=n.length){var t=r.next();if(t.done)return t;n[i]=t.value}return B(e,i,n[i++])}))},t(ue,G),ue.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},ue.prototype.get=function(e,t){return this.has(e)?this._value:t},ue.prototype.includes=function(e){return oe(this._value,e)},ue.prototype.slice=function(e,t){var r=this.size;return C(e,t,r)?this:new ue(this._value,P(t,r)-j(e,r))},ue.prototype.reverse=function(){return this},ue.prototype.indexOf=function(e){return oe(this._value,e)?0:-1},ue.prototype.lastIndexOf=function(e){return oe(this._value,e)?this.size:-1},ue.prototype.__iterate=function(e,t){for(var r=0;r<this.size;r++)if(!1===e(this._value,r,this))return r+1;return r},ue.prototype.__iterator=function(e,t){var r=this,n=0;return new k((function(){return n<r.size?B(e,n++,r._value):{value:void 0,done:!0}}))},ue.prototype.equals=function(e){return e instanceof ue?oe(this._value,e._value):se(e)},t(le,G),le.prototype.toString=function(){return 0===this.size?"Range []":"Range [ "+this._start+"..."+this._end+(1!==this._step?" by "+this._step:"")+" ]"},le.prototype.get=function(e,t){return this.has(e)?this._start+O(this,e)*this._step:t},le.prototype.includes=function(e){var t=(e-this._start)/this._step;return t>=0&&t<this.size&&t===Math.floor(t)},le.prototype.slice=function(e,t){return C(e,t,this.size)?this:(e=j(e,this.size),(t=P(t,this.size))<=e?new le(0,0):new le(this.get(e,this._end),this.get(t,this._end),this._step))},le.prototype.indexOf=function(e){var t=e-this._start;if(t%this._step==0){var r=t/this._step;if(r>=0&&r<this.size)return r}return-1},le.prototype.lastIndexOf=function(e){return this.indexOf(e)},le.prototype.__iterate=function(e,t){for(var r=this.size-1,n=this._step,i=t?this._start+r*n:this._start,a=0;a<=r;a++){if(!1===e(i,a,this))return a+1;i+=t?-n:n}return a},le.prototype.__iterator=function(e,t){var r=this.size-1,n=this._step,i=t?this._start+r*n:this._start,a=0;return new k((function(){var o=i;return i+=t?-n:n,a>r?{value:void 0,done:!0}:B(e,a++,o)}))},le.prototype.equals=function(e){return e instanceof le?this._start===e._start&&this._end===e._end&&this._step===e._step:se(this,e)},t(de,r),t(fe,de),t(pe,de),t(me,de),de.Keyed=fe,de.Indexed=pe,de.Set=me;var he="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var r=65535&(e|=0),n=65535&(t|=0);return r*n+((e>>>16)*n+r*(t>>>16)<<16>>>0)|0};function ge(e){return e>>>1&1073741824|3221225471&e}function ve(e){if(!1===e||null==e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null==e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!=e||e===1/0)return 0;var r=0|e;for(r!==e&&(r^=4294967295*e);e>4294967295;)r^=e/=4294967295;return ge(r)}if("string"===t)return e.length>Ce?function(e){var t=Ee[e];return void 0===t&&(t=be(e),Pe===je&&(Pe=0,Ee={}),Pe++,Ee[e]=t),t}(e):be(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return function(e){var t;if(xe&&void 0!==(t=ye.get(e)))return t;if(void 0!==(t=e[we]))return t;if(!Se){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[we]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}if(t=++Oe,1073741824&Oe&&(Oe=0),xe)ye.set(e,t);else{if(void 0!==_e&&!1===_e(e))throw new Error("Non-extensible objects are not allowed as keys.");if(Se)Object.defineProperty(e,we,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[we]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[we]=t}}return t}(e);if("function"==typeof e.toString)return be(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function be(e){for(var t=0,r=0;r<e.length;r++)t=31*t+e.charCodeAt(r)|0;return ge(t)}var ye,_e=Object.isExtensible,Se=function(){try{return Object.defineProperty({},"@",{}),!0}catch(e){return!1}}(),xe="function"==typeof WeakMap;xe&&(ye=new WeakMap);var Oe=0,we="__immutablehash__";"function"==typeof Symbol&&(we=Symbol(we));var Ce=16,je=255,Pe=0,Ee={};function Ae(e){ce(e!==1/0,"Cannot perform this action with an infinite size.")}function De(e){return null==e?Ge():Te(e)&&!l(e)?e:Ge().withMutations((function(t){var r=n(e);Ae(r.size),r.forEach((function(e,r){return t.set(r,e)}))}))}function Te(e){return!(!e||!e[Me])}t(De,fe),De.of=function(){var t=e.call(arguments,0);return Ge().withMutations((function(e){for(var r=0;r<t.length;r+=2){if(r+1>=t.length)throw new Error("Missing value for key: "+t[r]);e.set(t[r],t[r+1])}}))},De.prototype.toString=function(){return this.__toString("Map {","}")},De.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},De.prototype.set=function(e,t){return qe(this,e,t)},De.prototype.setIn=function(e,t){return this.updateIn(e,h,(function(){return t}))},De.prototype.remove=function(e){return qe(this,e,h)},De.prototype.deleteIn=function(e){return this.updateIn(e,(function(){return h}))},De.prototype.update=function(e,t,r){return 1===arguments.length?e(this):this.updateIn([e],t,r)},De.prototype.updateIn=function(e,t,r){r||(r=t,t=void 0);var n=function e(t,r,n,i){var a=t===h,o=r.next();if(o.done){var s=a?n:t,u=i(s);return u===s?t:u}ce(a||t&&t.set,"invalid keyPath");var c=o.value,l=a?h:t.get(c,h),d=e(l,r,n,i);return d===l?t:d===h?t.remove(c):(a?Ge():t).set(c,d)}(this,Qt(e),t,r);return n===h?void 0:n},De.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Ge()},De.prototype.merge=function(){return Qe(this,void 0,arguments)},De.prototype.mergeWith=function(t){var r=e.call(arguments,1);return Qe(this,t,r)},De.prototype.mergeIn=function(t){var r=e.call(arguments,1);return this.updateIn(t,Ge(),(function(e){return"function"==typeof e.merge?e.merge.apply(e,r):r[r.length-1]}))},De.prototype.mergeDeep=function(){return Qe(this,Ke,arguments)},De.prototype.mergeDeepWith=function(t){var r=e.call(arguments,1);return Qe(this,Ze(t),r)},De.prototype.mergeDeepIn=function(t){var r=e.call(arguments,1);return this.updateIn(t,Ge(),(function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,r):r[r.length-1]}))},De.prototype.sort=function(e){return St(Lt(this,e))},De.prototype.sortBy=function(e,t){return St(Lt(this,t,e))},De.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},De.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new _)},De.prototype.asImmutable=function(){return this.__ensureOwner()},De.prototype.wasAltered=function(){return this.__altered},De.prototype.__iterator=function(e,t){return new Fe(this,e,t)},De.prototype.__iterate=function(e,t){var r=this,n=0;return this._root&&this._root.iterate((function(t){return n++,e(t[1],t[0],r)}),t),n},De.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?He(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},De.isMap=Te;var Ie,Me="@@__IMMUTABLE_MAP__@@",ke=De.prototype;function Be(e,t){this.ownerID=e,this.entries=t}function Ve(e,t,r){this.ownerID=e,this.bitmap=t,this.nodes=r}function Re(e,t,r){this.ownerID=e,this.count=t,this.nodes=r}function Le(e,t,r){this.ownerID=e,this.keyHash=t,this.entries=r}function Ne(e,t,r){this.ownerID=e,this.keyHash=t,this.entry=r}function Fe(e,t,r){this._type=t,this._reverse=r,this._stack=e._root&&ze(e._root)}function Ue(e,t){return B(e,t[0],t[1])}function ze(e,t){return{node:e,index:0,__prev:t}}function He(e,t,r,n){var i=Object.create(ke);return i.size=e,i._root=t,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Ge(){return Ie||(Ie=He(0))}function qe(e,t,r){var n,i;if(e._root){var a=b(g),o=b(v);if(n=We(e._root,e.__ownerID,0,void 0,t,r,a,o),!o.value)return e;i=e.size+(a.value?r===h?-1:1:0)}else{if(r===h)return e;i=1,n=new Be(e.__ownerID,[[t,r]])}return e.__ownerID?(e.size=i,e._root=n,e.__hash=void 0,e.__altered=!0,e):n?He(i,n):Ge()}function We(e,t,r,n,i,a,o,s){return e?e.update(t,r,n,i,a,o,s):a===h?e:(y(s),y(o),new Ne(t,n,[i,a]))}function Xe(e){return e.constructor===Ne||e.constructor===Le}function Ye(e,t,r,n,i){if(e.keyHash===n)return new Le(t,n,[e.entry,i]);var a,o=31&(0===r?e.keyHash:e.keyHash>>>r),s=31&(0===r?n:n>>>r);return new Ve(t,1<<o|1<<s,o===s?[Ye(e,t,r+5,n,i)]:(a=new Ne(t,n,i),o<s?[e,a]:[a,e]))}function Qe(e,t,r){for(var i=[],a=0;a<r.length;a++){var s=r[a],u=n(s);o(s)||(u=u.map((function(e){return ne(e)}))),i.push(u)}return Je(e,t,i)}function Ke(e,t,r){return e&&e.mergeDeep&&o(t)?e.mergeDeep(t):oe(e,t)?e:t}function Ze(e){return function(t,r,n){if(t&&t.mergeDeepWith&&o(r))return t.mergeDeepWith(e,r);var i=e(t,r,n);return oe(t,i)?t:i}}function Je(e,t,r){return 0===(r=r.filter((function(e){return 0!==e.size}))).length?e:0!==e.size||e.__ownerID||1!==r.length?e.withMutations((function(e){for(var n=t?function(r,n){e.update(n,h,(function(e){return e===h?r:t(e,r,n)}))}:function(t,r){e.set(r,t)},i=0;i<r.length;i++)r[i].forEach(n)})):e.constructor(r[0])}function $e(e){return e=(e=(858993459&(e-=e>>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function et(e,t,r,n){var i=n?e:S(e);return i[t]=r,i}ke[Me]=!0,ke.delete=ke.remove,ke.removeIn=ke.deleteIn,Be.prototype.get=function(e,t,r,n){for(var i=this.entries,a=0,o=i.length;a<o;a++)if(oe(r,i[a][0]))return i[a][1];return n},Be.prototype.update=function(e,t,r,n,i,a,o){for(var s=i===h,u=this.entries,c=0,l=u.length;c<l&&!oe(n,u[c][0]);c++);var d=c<l;if(d?u[c][1]===i:s)return this;if(y(o),(s||!d)&&y(a),!s||1!==u.length){if(!d&&!s&&u.length>=tt)return function(e,t,r,n){e||(e=new _);for(var i=new Ne(e,ve(r),[r,n]),a=0;a<t.length;a++){var o=t[a];i=i.update(e,0,void 0,o[0],o[1])}return i}(e,u,n,i);var f=e&&e===this.ownerID,p=f?u:S(u);return d?s?c===l-1?p.pop():p[c]=p.pop():p[c]=[n,i]:p.push([n,i]),f?(this.entries=p,this):new Be(e,p)}},Ve.prototype.get=function(e,t,r,n){void 0===t&&(t=ve(r));var i=1<<(31&(0===e?t:t>>>e)),a=this.bitmap;return 0==(a&i)?n:this.nodes[$e(a&i-1)].get(e+5,t,r,n)},Ve.prototype.update=function(e,t,r,n,i,a,o){void 0===r&&(r=ve(n));var s=31&(0===t?r:r>>>t),u=1<<s,c=this.bitmap,l=0!=(c&u);if(!l&&i===h)return this;var d=$e(c&u-1),f=this.nodes,p=l?f[d]:void 0,m=We(p,e,t+5,r,n,i,a,o);if(m===p)return this;if(!l&&m&&f.length>=rt)return function(e,t,r,n,i){for(var a=0,o=new Array(32),s=0;0!==r;s++,r>>>=1)o[s]=1&r?t[a++]:void 0;return o[n]=i,new Re(e,a+1,o)}(e,f,c,s,m);if(l&&!m&&2===f.length&&Xe(f[1^d]))return f[1^d];if(l&&m&&1===f.length&&Xe(m))return m;var g=e&&e===this.ownerID,v=l?m?c:c^u:c|u,b=l?m?et(f,d,m,g):function(e,t,r){var n=e.length-1;if(r&&t===n)return e.pop(),e;for(var i=new Array(n),a=0,o=0;o<n;o++)o===t&&(a=1),i[o]=e[o+a];return i}(f,d,g):function(e,t,r,n){var i=e.length+1;if(n&&t+1===i)return e[t]=r,e;for(var a=new Array(i),o=0,s=0;s<i;s++)s===t?(a[s]=r,o=-1):a[s]=e[s+o];return a}(f,d,m,g);return g?(this.bitmap=v,this.nodes=b,this):new Ve(e,v,b)},Re.prototype.get=function(e,t,r,n){void 0===t&&(t=ve(r));var i=31&(0===e?t:t>>>e),a=this.nodes[i];return a?a.get(e+5,t,r,n):n},Re.prototype.update=function(e,t,r,n,i,a,o){void 0===r&&(r=ve(n));var s=31&(0===t?r:r>>>t),u=i===h,c=this.nodes,l=c[s];if(u&&!l)return this;var d=We(l,e,t+5,r,n,i,a,o);if(d===l)return this;var f=this.count;if(l){if(!d&&--f<nt)return function(e,t,r,n){for(var i=0,a=0,o=new Array(r),s=0,u=1,c=t.length;s<c;s++,u<<=1){var l=t[s];void 0!==l&&s!==n&&(i|=u,o[a++]=l)}return new Ve(e,i,o)}(e,c,f,s)}else f++;var p=e&&e===this.ownerID,m=et(c,s,d,p);return p?(this.count=f,this.nodes=m,this):new Re(e,f,m)},Le.prototype.get=function(e,t,r,n){for(var i=this.entries,a=0,o=i.length;a<o;a++)if(oe(r,i[a][0]))return i[a][1];return n},Le.prototype.update=function(e,t,r,n,i,a,o){void 0===r&&(r=ve(n));var s=i===h;if(r!==this.keyHash)return s?this:(y(o),y(a),Ye(this,e,t,r,[n,i]));for(var u=this.entries,c=0,l=u.length;c<l&&!oe(n,u[c][0]);c++);var d=c<l;if(d?u[c][1]===i:s)return this;if(y(o),(s||!d)&&y(a),s&&2===l)return new Ne(e,this.keyHash,u[1^c]);var f=e&&e===this.ownerID,p=f?u:S(u);return d?s?c===l-1?p.pop():p[c]=p.pop():p[c]=[n,i]:p.push([n,i]),f?(this.entries=p,this):new Le(e,this.keyHash,p)},Ne.prototype.get=function(e,t,r,n){return oe(r,this.entry[0])?this.entry[1]:n},Ne.prototype.update=function(e,t,r,n,i,a,o){var s=i===h,u=oe(n,this.entry[0]);return(u?i===this.entry[1]:s)?this:(y(o),s?void y(a):u?e&&e===this.ownerID?(this.entry[1]=i,this):new Ne(e,this.keyHash,[n,i]):(y(a),Ye(this,e,t,ve(n),[n,i])))},Be.prototype.iterate=Le.prototype.iterate=function(e,t){for(var r=this.entries,n=0,i=r.length-1;n<=i;n++)if(!1===e(r[t?i-n:n]))return!1},Ve.prototype.iterate=Re.prototype.iterate=function(e,t){for(var r=this.nodes,n=0,i=r.length-1;n<=i;n++){var a=r[t?i-n:n];if(a&&!1===a.iterate(e,t))return!1}},Ne.prototype.iterate=function(e,t){return e(this.entry)},t(Fe,k),Fe.prototype.next=function(){for(var e=this._type,t=this._stack;t;){var r,n=t.node,i=t.index++;if(n.entry){if(0===i)return Ue(e,n.entry)}else if(n.entries){if(i<=(r=n.entries.length-1))return Ue(e,n.entries[this._reverse?r-i:i])}else if(i<=(r=n.nodes.length-1)){var a=n.nodes[this._reverse?r-i:i];if(a){if(a.entry)return Ue(e,a.entry);t=this._stack=ze(a,t)}continue}t=this._stack=this._stack.__prev}return{value:void 0,done:!0}};var tt=8,rt=16,nt=8;function it(e){var t=mt();if(null==e)return t;if(at(e))return e;var r=i(e),n=r.size;return 0===n?t:(Ae(n),n>0&&n<32?pt(0,n,5,null,new ut(r.toArray())):t.withMutations((function(e){e.setSize(n),r.forEach((function(t,r){return e.set(r,t)}))})))}function at(e){return!(!e||!e[ot])}t(it,pe),it.of=function(){return this(arguments)},it.prototype.toString=function(){return this.__toString("List [","]")},it.prototype.get=function(e,t){if((e=O(this,e))>=0&&e<this.size){var r=vt(this,e+=this._origin);return r&&r.array[31&e]}return t},it.prototype.set=function(e,t){return function(e,t,r){if((t=O(e,t))!=t)return e;if(t>=e.size||t<0)return e.withMutations((function(e){t<0?bt(e,t).set(0,r):bt(e,0,t+1).set(t,r)}));t+=e._origin;var n=e._tail,i=e._root,a=b(v);return t>=_t(e._capacity)?n=ht(n,e.__ownerID,0,t,r,a):i=ht(i,e.__ownerID,e._level,t,r,a),a.value?e.__ownerID?(e._root=i,e._tail=n,e.__hash=void 0,e.__altered=!0,e):pt(e._origin,e._capacity,e._level,i,n):e}(this,e,t)},it.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},it.prototype.insert=function(e,t){return this.splice(e,0,t)},it.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):mt()},it.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations((function(r){bt(r,0,t+e.length);for(var n=0;n<e.length;n++)r.set(t+n,e[n])}))},it.prototype.pop=function(){return bt(this,0,-1)},it.prototype.unshift=function(){var e=arguments;return this.withMutations((function(t){bt(t,-e.length);for(var r=0;r<e.length;r++)t.set(r,e[r])}))},it.prototype.shift=function(){return bt(this,1)},it.prototype.merge=function(){return yt(this,void 0,arguments)},it.prototype.mergeWith=function(t){var r=e.call(arguments,1);return yt(this,t,r)},it.prototype.mergeDeep=function(){return yt(this,Ke,arguments)},it.prototype.mergeDeepWith=function(t){var r=e.call(arguments,1);return yt(this,Ze(t),r)},it.prototype.setSize=function(e){return bt(this,0,e)},it.prototype.slice=function(e,t){var r=this.size;return C(e,t,r)?this:bt(this,j(e,r),P(t,r))},it.prototype.__iterator=function(e,t){var r=0,n=ft(this,t);return new k((function(){var t=n();return t===dt?{value:void 0,done:!0}:B(e,r++,t)}))},it.prototype.__iterate=function(e,t){for(var r,n=0,i=ft(this,t);(r=i())!==dt&&!1!==e(r,n++,this););return n},it.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?pt(this._origin,this._capacity,this._level,this._root,this._tail,e,this.__hash):(this.__ownerID=e,this)},it.isList=at;var ot="@@__IMMUTABLE_LIST__@@",st=it.prototype;function ut(e,t){this.array=e,this.ownerID=t}st[ot]=!0,st.delete=st.remove,st.setIn=ke.setIn,st.deleteIn=st.removeIn=ke.removeIn,st.update=ke.update,st.updateIn=ke.updateIn,st.mergeIn=ke.mergeIn,st.mergeDeepIn=ke.mergeDeepIn,st.withMutations=ke.withMutations,st.asMutable=ke.asMutable,st.asImmutable=ke.asImmutable,st.wasAltered=ke.wasAltered,ut.prototype.removeBefore=function(e,t,r){if(r===t?1<<t:0===this.array.length)return this;var n=r>>>t&31;if(n>=this.array.length)return new ut([],e);var i,a=0===n;if(t>0){var o=this.array[n];if((i=o&&o.removeBefore(e,t-5,r))===o&&a)return this}if(a&&!i)return this;var s=gt(this,e);if(!a)for(var u=0;u<n;u++)s.array[u]=void 0;return i&&(s.array[n]=i),s},ut.prototype.removeAfter=function(e,t,r){if(r===(t?1<<t:0)||0===this.array.length)return this;var n,i=r-1>>>t&31;if(i>=this.array.length)return this;if(t>0){var a=this.array[i];if((n=a&&a.removeAfter(e,t-5,r))===a&&i===this.array.length-1)return this}var o=gt(this,e);return o.array.splice(i+1),n&&(o.array[i]=n),o};var ct,lt,dt={};function ft(e,t){var r=e._origin,n=e._capacity,i=_t(n),a=e._tail;return o(e._root,e._level,0);function o(e,s,u){return 0===s?function(e,o){var s=o===i?a&&a.array:e&&e.array,u=o>r?0:r-o,c=n-o;return c>32&&(c=32),function(){if(u===c)return dt;var e=t?--c:u++;return s&&s[e]}}(e,u):function(e,i,a){var s,u=e&&e.array,c=a>r?0:r-a>>i,l=1+(n-a>>i);return l>32&&(l=32),function(){for(;;){if(s){var e=s();if(e!==dt)return e;s=null}if(c===l)return dt;var r=t?--l:c++;s=o(u&&u[r],i-5,a+(r<<i))}}}(e,s,u)}}function pt(e,t,r,n,i,a,o){var s=Object.create(st);return s.size=t-e,s._origin=e,s._capacity=t,s._level=r,s._root=n,s._tail=i,s.__ownerID=a,s.__hash=o,s.__altered=!1,s}function mt(){return ct||(ct=pt(0,0,5))}function ht(e,t,r,n,i,a){var o,s=n>>>r&31,u=e&&s<e.array.length;if(!u&&void 0===i)return e;if(r>0){var c=e&&e.array[s],l=ht(c,t,r-5,n,i,a);return l===c?e:((o=gt(e,t)).array[s]=l,o)}return u&&e.array[s]===i?e:(y(a),o=gt(e,t),void 0===i&&s===o.array.length-1?o.array.pop():o.array[s]=i,o)}function gt(e,t){return t&&e&&t===e.ownerID?e:new ut(e?e.array.slice():[],t)}function vt(e,t){if(t>=_t(e._capacity))return e._tail;if(t<1<<e._level+5){for(var r=e._root,n=e._level;r&&n>0;)r=r.array[t>>>n&31],n-=5;return r}}function bt(e,t,r){void 0!==t&&(t|=0),void 0!==r&&(r|=0);var n=e.__ownerID||new _,i=e._origin,a=e._capacity,o=i+t,s=void 0===r?a:r<0?a+r:i+r;if(o===i&&s===a)return e;if(o>=s)return e.clear();for(var u=e._level,c=e._root,l=0;o+l<0;)c=new ut(c&&c.array.length?[void 0,c]:[],n),l+=1<<(u+=5);l&&(o+=l,i+=l,s+=l,a+=l);for(var d=_t(a),f=_t(s);f>=1<<u+5;)c=new ut(c&&c.array.length?[c]:[],n),u+=5;var p=e._tail,m=f<d?vt(e,s-1):f>d?new ut([],n):p;if(p&&f>d&&o<a&&p.array.length){for(var h=c=gt(c,n),g=u;g>5;g-=5){var v=d>>>g&31;h=h.array[v]=gt(h.array[v],n)}h.array[d>>>5&31]=p}if(s<a&&(m=m&&m.removeAfter(n,0,s)),o>=f)o-=f,s-=f,u=5,c=null,m=m&&m.removeBefore(n,0,o);else if(o>i||f<d){for(l=0;c;){var b=o>>>u&31;if(b!==f>>>u&31)break;b&&(l+=(1<<u)*b),u-=5,c=c.array[b]}c&&o>i&&(c=c.removeBefore(n,u,o-l)),c&&f<d&&(c=c.removeAfter(n,u,f-l)),l&&(o-=l,s-=l)}return e.__ownerID?(e.size=s-o,e._origin=o,e._capacity=s,e._level=u,e._root=c,e._tail=m,e.__hash=void 0,e.__altered=!0,e):pt(o,s,u,c,m)}function yt(e,t,r){for(var n=[],a=0,s=0;s<r.length;s++){var u=r[s],c=i(u);c.size>a&&(a=c.size),o(u)||(c=c.map((function(e){return ne(e)}))),n.push(c)}return a>e.size&&(e=e.setSize(a)),Je(e,t,n)}function _t(e){return e<32?0:e-1>>>5<<5}function St(e){return null==e?wt():xt(e)?e:wt().withMutations((function(t){var r=n(e);Ae(r.size),r.forEach((function(e,r){return t.set(r,e)}))}))}function xt(e){return Te(e)&&l(e)}function Ot(e,t,r,n){var i=Object.create(St.prototype);return i.size=e?e.size:0,i._map=e,i._list=t,i.__ownerID=r,i.__hash=n,i}function wt(){return lt||(lt=Ot(Ge(),mt()))}function Ct(e,t,r){var n,i,a=e._map,o=e._list,s=a.get(t),u=void 0!==s;if(r===h){if(!u)return e;o.size>=32&&o.size>=2*a.size?(n=(i=o.filter((function(e,t){return void 0!==e&&s!==t}))).toKeyedSeq().map((function(e){return e[0]})).flip().toMap(),e.__ownerID&&(n.__ownerID=i.__ownerID=e.__ownerID)):(n=a.remove(t),i=s===o.size-1?o.pop():o.set(s,void 0))}else if(u){if(r===o.get(s)[1])return e;n=a,i=o.set(s,[t,r])}else n=a.set(t,o.size),i=o.set(o.size,[t,r]);return e.__ownerID?(e.size=n.size,e._map=n,e._list=i,e.__hash=void 0,e):Ot(n,i)}function jt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Pt(e){this._iter=e,this.size=e.size}function Et(e){this._iter=e,this.size=e.size}function At(e){this._iter=e,this.size=e.size}function Dt(e){var t=Wt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=Xt,t.__iterateUncached=function(t,r){var n=this;return e.__iterate((function(e,r){return!1!==t(r,e,n)}),r)},t.__iteratorUncached=function(t,r){if(2===t){var n=e.__iterator(t,r);return new k((function(){var e=n.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e}))}return e.__iterator(1===t?0:1,r)},t}function Tt(e,t,r){var n=Wt(e);return n.size=e.size,n.has=function(t){return e.has(t)},n.get=function(n,i){var a=e.get(n,h);return a===h?i:t.call(r,a,n,e)},n.__iterateUncached=function(n,i){var a=this;return e.__iterate((function(e,i,o){return!1!==n(t.call(r,e,i,o),i,a)}),i)},n.__iteratorUncached=function(n,i){var a=e.__iterator(2,i);return new k((function(){var i=a.next();if(i.done)return i;var o=i.value,s=o[0];return B(n,s,t.call(r,o[1],s,e),i)}))},n}function It(e,t){var r=Wt(e);return r._iter=e,r.size=e.size,r.reverse=function(){return e},e.flip&&(r.flip=function(){var t=Dt(e);return t.reverse=function(){return e.flip()},t}),r.get=function(r,n){return e.get(t?r:-1-r,n)},r.has=function(r){return e.has(t?r:-1-r)},r.includes=function(t){return e.includes(t)},r.cacheResult=Xt,r.__iterate=function(t,r){var n=this;return e.__iterate((function(e,r){return t(e,r,n)}),!r)},r.__iterator=function(t,r){return e.__iterator(t,!r)},r}function Mt(e,t,r,n){var i=Wt(e);return n&&(i.has=function(n){var i=e.get(n,h);return i!==h&&!!t.call(r,i,n,e)},i.get=function(n,i){var a=e.get(n,h);return a!==h&&t.call(r,a,n,e)?a:i}),i.__iterateUncached=function(i,a){var o=this,s=0;return e.__iterate((function(e,a,u){if(t.call(r,e,a,u))return s++,i(e,n?a:s-1,o)}),a),s},i.__iteratorUncached=function(i,a){var o=e.__iterator(2,a),s=0;return new k((function(){for(;;){var a=o.next();if(a.done)return a;var u=a.value,c=u[0],l=u[1];if(t.call(r,l,c,e))return B(i,n?c:s++,l,a)}}))},i}function kt(e,t,r,n){var i=e.size;if(void 0!==t&&(t|=0),void 0!==r&&(r===1/0?r=i:r|=0),C(t,r,i))return e;var a=j(t,i),o=P(r,i);if(a!=a||o!=o)return kt(e.toSeq().cacheResult(),t,r,n);var s,u=o-a;u==u&&(s=u<0?0:u);var c=Wt(e);return c.size=0===s?s:e.size&&s||void 0,!n&&K(e)&&s>=0&&(c.get=function(t,r){return(t=O(this,t))>=0&&t<s?e.get(t+a,r):r}),c.__iterateUncached=function(t,r){var i=this;if(0===s)return 0;if(r)return this.cacheResult().__iterate(t,r);var o=0,u=!0,c=0;return e.__iterate((function(e,r){if(!u||!(u=o++<a))return c++,!1!==t(e,n?r:c-1,i)&&c!==s})),c},c.__iteratorUncached=function(t,r){if(0!==s&&r)return this.cacheResult().__iterator(t,r);var i=0!==s&&e.__iterator(t,r),o=0,u=0;return new k((function(){for(;o++<a;)i.next();if(++u>s)return{value:void 0,done:!0};var e=i.next();return n||1===t?e:B(t,u-1,0===t?void 0:e.value[1],e)}))},c}function Bt(e,t,r,n){var i=Wt(e);return i.__iterateUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterate(i,a);var s=!0,u=0;return e.__iterate((function(e,a,c){if(!s||!(s=t.call(r,e,a,c)))return u++,i(e,n?a:u-1,o)})),u},i.__iteratorUncached=function(i,a){var o=this;if(a)return this.cacheResult().__iterator(i,a);var s=e.__iterator(2,a),u=!0,c=0;return new k((function(){var e,a,l;do{if((e=s.next()).done)return n||1===i?e:B(i,c++,0===i?void 0:e.value[1],e);var d=e.value;a=d[0],l=d[1],u&&(u=t.call(r,l,a,o))}while(u);return 2===i?e:B(i,a,l,e)}))},i}function Vt(e,t){var r=s(e),i=[e].concat(t).map((function(e){return o(e)?r&&(e=n(e)):e=r?J(e):$(Array.isArray(e)?e:[e]),e})).filter((function(e){return 0!==e.size}));if(0===i.length)return e;if(1===i.length){var a=i[0];if(a===e||r&&s(a)||u(e)&&u(a))return a}var c=new W(i);return r?c=c.toKeyedSeq():u(e)||(c=c.toSetSeq()),(c=c.flatten(!0)).size=i.reduce((function(e,t){if(void 0!==e){var r=t.size;if(void 0!==r)return e+r}}),0),c}function Rt(e,t,r){var n=Wt(e);return n.__iterateUncached=function(n,i){var a=0,s=!1;return function e(u,c){var l=this;u.__iterate((function(i,u){return(!t||c<t)&&o(i)?e(i,c+1):!1===n(i,r?u:a++,l)&&(s=!0),!s}),i)}(e,0),a},n.__iteratorUncached=function(n,i){var a=e.__iterator(n,i),s=[],u=0;return new k((function(){for(;a;){var e=a.next();if(!1===e.done){var c=e.value;if(2===n&&(c=c[1]),t&&!(s.length<t)||!o(c))return r?e:B(n,u++,c,e);s.push(a),a=c.__iterator(n,i)}else a=s.pop()}return{value:void 0,done:!0}}))},n}function Lt(e,t,r){t||(t=Yt);var n=s(e),i=0,a=e.toSeq().map((function(t,n){return[n,t,i++,r?r(t,n,e):t]})).toArray();return a.sort((function(e,r){return t(e[3],r[3])||e[2]-r[2]})).forEach(n?function(e,t){a[t].length=2}:function(e,t){a[t]=e[1]}),n?H(a):u(e)?G(a):q(a)}function Nt(e,t,r){if(t||(t=Yt),r){var n=e.toSeq().map((function(t,n){return[t,r(t,n,e)]})).reduce((function(e,r){return Ft(t,e[1],r[1])?r:e}));return n&&n[0]}return e.reduce((function(e,r){return Ft(t,e,r)?r:e}))}function Ft(e,t,r){var n=e(r,t);return 0===n&&r!==t&&(null==r||r!=r)||n>0}function Ut(e,t,n){var i=Wt(e);return i.size=new W(n).map((function(e){return e.size})).min(),i.__iterate=function(e,t){for(var r,n=this.__iterator(1,t),i=0;!(r=n.next()).done&&!1!==e(r.value,i++,this););return i},i.__iteratorUncached=function(e,i){var a=n.map((function(e){return e=r(e),N(i?e.reverse():e)})),o=0,s=!1;return new k((function(){var r;return s||(r=a.map((function(e){return e.next()})),s=r.some((function(e){return e.done}))),s?{value:void 0,done:!0}:B(e,o++,t.apply(null,r.map((function(e){return e.value}))))}))},i}function zt(e,t){return K(e)?t:e.constructor(t)}function Ht(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Gt(e){return Ae(e.size),x(e)}function qt(e){return s(e)?n:u(e)?i:a}function Wt(e){return Object.create((s(e)?H:u(e)?G:q).prototype)}function Xt(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):z.prototype.cacheResult.call(this)}function Yt(e,t){return e>t?1:e<t?-1:0}function Qt(e){var t=N(e);if(!t){if(!U(e))throw new TypeError("Expected iterable or array-like: "+e);t=N(r(e))}return t}function Kt(e,t){var r,n=function(a){if(a instanceof n)return a;if(!(this instanceof n))return new n(a);if(!r){r=!0;var o=Object.keys(e);!function(e,t){try{t.forEach(er.bind(void 0,e))}catch(e){}}(i,o),i.size=o.length,i._name=t,i._keys=o,i._defaultValues=e}this._map=De(a)},i=n.prototype=Object.create(Zt);return i.constructor=n,n}t(St,De),St.of=function(){return this(arguments)},St.prototype.toString=function(){return this.__toString("OrderedMap {","}")},St.prototype.get=function(e,t){var r=this._map.get(e);return void 0!==r?this._list.get(r)[1]:t},St.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._map.clear(),this._list.clear(),this):wt()},St.prototype.set=function(e,t){return Ct(this,e,t)},St.prototype.remove=function(e){return Ct(this,e,h)},St.prototype.wasAltered=function(){return this._map.wasAltered()||this._list.wasAltered()},St.prototype.__iterate=function(e,t){var r=this;return this._list.__iterate((function(t){return t&&e(t[1],t[0],r)}),t)},St.prototype.__iterator=function(e,t){return this._list.fromEntrySeq().__iterator(e,t)},St.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e),r=this._list.__ensureOwner(e);return e?Ot(t,r,e,this.__hash):(this.__ownerID=e,this._map=t,this._list=r,this)},St.isOrderedMap=xt,St.prototype[m]=!0,St.prototype.delete=St.prototype.remove,t(jt,H),jt.prototype.get=function(e,t){return this._iter.get(e,t)},jt.prototype.has=function(e){return this._iter.has(e)},jt.prototype.valueSeq=function(){return this._iter.valueSeq()},jt.prototype.reverse=function(){var e=this,t=It(this,!0);return this._useKeys||(t.valueSeq=function(){return e._iter.toSeq().reverse()}),t},jt.prototype.map=function(e,t){var r=this,n=Tt(this,e,t);return this._useKeys||(n.valueSeq=function(){return r._iter.toSeq().map(e,t)}),n},jt.prototype.__iterate=function(e,t){var r,n=this;return this._iter.__iterate(this._useKeys?function(t,r){return e(t,r,n)}:(r=t?Gt(this):0,function(i){return e(i,t?--r:r++,n)}),t)},jt.prototype.__iterator=function(e,t){if(this._useKeys)return this._iter.__iterator(e,t);var r=this._iter.__iterator(1,t),n=t?Gt(this):0;return new k((function(){var i=r.next();return i.done?i:B(e,t?--n:n++,i.value,i)}))},jt.prototype[m]=!0,t(Pt,G),Pt.prototype.includes=function(e){return this._iter.includes(e)},Pt.prototype.__iterate=function(e,t){var r=this,n=0;return this._iter.__iterate((function(t){return e(t,n++,r)}),t)},Pt.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t),n=0;return new k((function(){var t=r.next();return t.done?t:B(e,n++,t.value,t)}))},t(Et,q),Et.prototype.has=function(e){return this._iter.includes(e)},Et.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){return e(t,t,r)}),t)},Et.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new k((function(){var t=r.next();return t.done?t:B(e,t.value,t.value,t)}))},t(At,H),At.prototype.entrySeq=function(){return this._iter.toSeq()},At.prototype.__iterate=function(e,t){var r=this;return this._iter.__iterate((function(t){if(t){Ht(t);var n=o(t);return e(n?t.get(1):t[1],n?t.get(0):t[0],r)}}),t)},At.prototype.__iterator=function(e,t){var r=this._iter.__iterator(1,t);return new k((function(){for(;;){var t=r.next();if(t.done)return t;var n=t.value;if(n){Ht(n);var i=o(n);return B(e,i?n.get(0):n[0],i?n.get(1):n[1],t)}}}))},Pt.prototype.cacheResult=jt.prototype.cacheResult=Et.prototype.cacheResult=At.prototype.cacheResult=Xt,t(Kt,fe),Kt.prototype.toString=function(){return this.__toString($t(this)+" {","}")},Kt.prototype.has=function(e){return this._defaultValues.hasOwnProperty(e)},Kt.prototype.get=function(e,t){if(!this.has(e))return t;var r=this._defaultValues[e];return this._map?this._map.get(e,r):r},Kt.prototype.clear=function(){if(this.__ownerID)return this._map&&this._map.clear(),this;var e=this.constructor;return e._empty||(e._empty=Jt(this,Ge()))},Kt.prototype.set=function(e,t){if(!this.has(e))throw new Error('Cannot set unknown key "'+e+'" on '+$t(this));if(this._map&&!this._map.has(e)&&t===this._defaultValues[e])return this;var r=this._map&&this._map.set(e,t);return this.__ownerID||r===this._map?this:Jt(this,r)},Kt.prototype.remove=function(e){if(!this.has(e))return this;var t=this._map&&this._map.remove(e);return this.__ownerID||t===this._map?this:Jt(this,t)},Kt.prototype.wasAltered=function(){return this._map.wasAltered()},Kt.prototype.__iterator=function(e,t){var r=this;return n(this._defaultValues).map((function(e,t){return r.get(t)})).__iterator(e,t)},Kt.prototype.__iterate=function(e,t){var r=this;return n(this._defaultValues).map((function(e,t){return r.get(t)})).__iterate(e,t)},Kt.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map&&this._map.__ensureOwner(e);return e?Jt(this,t,e):(this.__ownerID=e,this._map=t,this)};var Zt=Kt.prototype;function Jt(e,t,r){var n=Object.create(Object.getPrototypeOf(e));return n._map=t,n.__ownerID=r,n}function $t(e){return e._name||e.constructor.name||"Record"}function er(e,t){Object.defineProperty(e,t,{get:function(){return this.get(t)},set:function(e){ce(this.__ownerID,"Cannot set on an immutable record."),this.set(t,e)}})}function tr(e){return null==e?ur():rr(e)&&!l(e)?e:ur().withMutations((function(t){var r=a(e);Ae(r.size),r.forEach((function(e){return t.add(e)}))}))}function rr(e){return!(!e||!e[ir])}Zt.delete=Zt.remove,Zt.deleteIn=Zt.removeIn=ke.removeIn,Zt.merge=ke.merge,Zt.mergeWith=ke.mergeWith,Zt.mergeIn=ke.mergeIn,Zt.mergeDeep=ke.mergeDeep,Zt.mergeDeepWith=ke.mergeDeepWith,Zt.mergeDeepIn=ke.mergeDeepIn,Zt.setIn=ke.setIn,Zt.update=ke.update,Zt.updateIn=ke.updateIn,Zt.withMutations=ke.withMutations,Zt.asMutable=ke.asMutable,Zt.asImmutable=ke.asImmutable,t(tr,me),tr.of=function(){return this(arguments)},tr.fromKeys=function(e){return this(n(e).keySeq())},tr.prototype.toString=function(){return this.__toString("Set {","}")},tr.prototype.has=function(e){return this._map.has(e)},tr.prototype.add=function(e){return or(this,this._map.set(e,!0))},tr.prototype.remove=function(e){return or(this,this._map.remove(e))},tr.prototype.clear=function(){return or(this,this._map.clear())},tr.prototype.union=function(){var t=e.call(arguments,0);return 0===(t=t.filter((function(e){return 0!==e.size}))).length?this:0!==this.size||this.__ownerID||1!==t.length?this.withMutations((function(e){for(var r=0;r<t.length;r++)a(t[r]).forEach((function(t){return e.add(t)}))})):this.constructor(t[0])},tr.prototype.intersect=function(){var t=e.call(arguments,0);if(0===t.length)return this;t=t.map((function(e){return a(e)}));var r=this;return this.withMutations((function(e){r.forEach((function(r){t.every((function(e){return e.includes(r)}))||e.remove(r)}))}))},tr.prototype.subtract=function(){var t=e.call(arguments,0);if(0===t.length)return this;t=t.map((function(e){return a(e)}));var r=this;return this.withMutations((function(e){r.forEach((function(r){t.some((function(e){return e.includes(r)}))&&e.remove(r)}))}))},tr.prototype.merge=function(){return this.union.apply(this,arguments)},tr.prototype.mergeWith=function(t){var r=e.call(arguments,1);return this.union.apply(this,r)},tr.prototype.sort=function(e){return cr(Lt(this,e))},tr.prototype.sortBy=function(e,t){return cr(Lt(this,t,e))},tr.prototype.wasAltered=function(){return this._map.wasAltered()},tr.prototype.__iterate=function(e,t){var r=this;return this._map.__iterate((function(t,n){return e(n,n,r)}),t)},tr.prototype.__iterator=function(e,t){return this._map.map((function(e,t){return t})).__iterator(e,t)},tr.prototype.__ensureOwner=function(e){if(e===this.__ownerID)return this;var t=this._map.__ensureOwner(e);return e?this.__make(t,e):(this.__ownerID=e,this._map=t,this)},tr.isSet=rr;var nr,ir="@@__IMMUTABLE_SET__@@",ar=tr.prototype;function or(e,t){return e.__ownerID?(e.size=t.size,e._map=t,e):t===e._map?e:0===t.size?e.__empty():e.__make(t)}function sr(e,t){var r=Object.create(ar);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function ur(){return nr||(nr=sr(Ge()))}function cr(e){return null==e?mr():lr(e)?e:mr().withMutations((function(t){var r=a(e);Ae(r.size),r.forEach((function(e){return t.add(e)}))}))}function lr(e){return rr(e)&&l(e)}ar[ir]=!0,ar.delete=ar.remove,ar.mergeDeep=ar.merge,ar.mergeDeepWith=ar.mergeWith,ar.withMutations=ke.withMutations,ar.asMutable=ke.asMutable,ar.asImmutable=ke.asImmutable,ar.__empty=ur,ar.__make=sr,t(cr,tr),cr.of=function(){return this(arguments)},cr.fromKeys=function(e){return this(n(e).keySeq())},cr.prototype.toString=function(){return this.__toString("OrderedSet {","}")},cr.isOrderedSet=lr;var dr,fr=cr.prototype;function pr(e,t){var r=Object.create(fr);return r.size=e?e.size:0,r._map=e,r.__ownerID=t,r}function mr(){return dr||(dr=pr(wt()))}function hr(e){return null==e?Sr():gr(e)?e:Sr().unshiftAll(e)}function gr(e){return!(!e||!e[br])}fr[m]=!0,fr.__empty=mr,fr.__make=pr,t(hr,pe),hr.of=function(){return this(arguments)},hr.prototype.toString=function(){return this.__toString("Stack [","]")},hr.prototype.get=function(e,t){var r=this._head;for(e=O(this,e);r&&e--;)r=r.next;return r?r.value:t},hr.prototype.peek=function(){return this._head&&this._head.value},hr.prototype.push=function(){if(0===arguments.length)return this;for(var e=this.size+arguments.length,t=this._head,r=arguments.length-1;r>=0;r--)t={value:arguments[r],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):_r(e,t)},hr.prototype.pushAll=function(e){if(0===(e=i(e)).size)return this;Ae(e.size);var t=this.size,r=this._head;return e.reverse().forEach((function(e){t++,r={value:e,next:r}})),this.__ownerID?(this.size=t,this._head=r,this.__hash=void 0,this.__altered=!0,this):_r(t,r)},hr.prototype.pop=function(){return this.slice(1)},hr.prototype.unshift=function(){return this.push.apply(this,arguments)},hr.prototype.unshiftAll=function(e){return this.pushAll(e)},hr.prototype.shift=function(){return this.pop.apply(this,arguments)},hr.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Sr()},hr.prototype.slice=function(e,t){if(C(e,t,this.size))return this;var r=j(e,this.size);if(P(t,this.size)!==this.size)return pe.prototype.slice.call(this,e,t);for(var n=this.size-r,i=this._head;r--;)i=i.next;return this.__ownerID?(this.size=n,this._head=i,this.__hash=void 0,this.__altered=!0,this):_r(n,i)},hr.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?_r(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},hr.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var r=0,n=this._head;n&&!1!==e(n.value,r++,this);)n=n.next;return r},hr.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var r=0,n=this._head;return new k((function(){if(n){var t=n.value;return n=n.next,B(e,r++,t)}return{value:void 0,done:!0}}))},hr.isStack=gr;var vr,br="@@__IMMUTABLE_STACK__@@",yr=hr.prototype;function _r(e,t,r,n){var i=Object.create(yr);return i.size=e,i._head=t,i.__ownerID=r,i.__hash=n,i.__altered=!1,i}function Sr(){return vr||(vr=_r(0))}function xr(e,t){var r=function(r){e.prototype[r]=t[r]};return Object.keys(t).forEach(r),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(r),e}yr[br]=!0,yr.withMutations=ke.withMutations,yr.asMutable=ke.asMutable,yr.asImmutable=ke.asImmutable,yr.wasAltered=ke.wasAltered,r.Iterator=k,xr(r,{toArray:function(){Ae(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate((function(t,r){e[r]=t})),e},toIndexedSeq:function(){return new Pt(this)},toJS:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJS?e.toJS():e})).__toJS()},toJSON:function(){return this.toSeq().map((function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e})).__toJS()},toKeyedSeq:function(){return new jt(this,!0)},toMap:function(){return De(this.toKeyedSeq())},toObject:function(){Ae(this.size);var e={};return this.__iterate((function(t,r){e[r]=t})),e},toOrderedMap:function(){return St(this.toKeyedSeq())},toOrderedSet:function(){return cr(s(this)?this.valueSeq():this)},toSet:function(){return tr(s(this)?this.valueSeq():this)},toSetSeq:function(){return new Et(this)},toSeq:function(){return u(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return hr(s(this)?this.valueSeq():this)},toList:function(){return it(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){var t=e.call(arguments,0);return zt(this,Vt(this,t))},includes:function(e){return this.some((function(t){return oe(t,e)}))},entries:function(){return this.__iterator(2)},every:function(e,t){Ae(this.size);var r=!0;return this.__iterate((function(n,i,a){if(!e.call(t,n,i,a))return r=!1,!1})),r},filter:function(e,t){return zt(this,Mt(this,e,t,!0))},find:function(e,t,r){var n=this.findEntry(e,t);return n?n[1]:r},forEach:function(e,t){return Ae(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Ae(this.size),e=void 0!==e?""+e:",";var t="",r=!0;return this.__iterate((function(n){r?r=!1:t+=e,t+=null!=n?n.toString():""})),t},keys:function(){return this.__iterator(0)},map:function(e,t){return zt(this,Tt(this,e,t))},reduce:function(e,t,r){var n,i;return Ae(this.size),arguments.length<2?i=!0:n=t,this.__iterate((function(t,a,o){i?(i=!1,n=t):n=e.call(r,n,t,a,o)})),n},reduceRight:function(e,t,r){var n=this.toKeyedSeq().reverse();return n.reduce.apply(n,arguments)},reverse:function(){return zt(this,It(this,!0))},slice:function(e,t){return zt(this,kt(this,e,t,!0))},some:function(e,t){return!this.every(Pr(e),t)},sort:function(e){return zt(this,Lt(this,e))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(e,t){return x(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,r){var n=De().asMutable();return e.__iterate((function(i,a){n.update(t.call(r,i,a,e),0,(function(e){return e+1}))})),n.asImmutable()}(this,e,t)},equals:function(e){return se(this,e)},entrySeq:function(){var e=this;if(e._cache)return new W(e._cache);var t=e.toSeq().map(jr).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Pr(e),t)},findEntry:function(e,t,r){var n=r;return this.__iterate((function(r,i,a){if(e.call(t,r,i,a))return n=[i,r],!1})),n},findKey:function(e,t){var r=this.findEntry(e,t);return r&&r[0]},findLast:function(e,t,r){return this.toKeyedSeq().reverse().find(e,t,r)},findLastEntry:function(e,t,r){return this.toKeyedSeq().reverse().findEntry(e,t,r)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(w)},flatMap:function(e,t){return zt(this,function(e,t,r){var n=qt(e);return e.toSeq().map((function(i,a){return n(t.call(r,i,a,e))})).flatten(!0)}(this,e,t))},flatten:function(e){return zt(this,Rt(this,e,!0))},fromEntrySeq:function(){return new At(this)},get:function(e,t){return this.find((function(t,r){return oe(r,e)}),void 0,t)},getIn:function(e,t){for(var r,n=this,i=Qt(e);!(r=i.next()).done;){var a=r.value;if((n=n&&n.get?n.get(a,h):h)===h)return t}return n},groupBy:function(e,t){return function(e,t,r){var n=s(e),i=(l(e)?St():De()).asMutable();e.__iterate((function(a,o){i.update(t.call(r,a,o,e),(function(e){return(e=e||[]).push(n?[o,a]:a),e}))}));var a=qt(e);return i.map((function(t){return zt(e,a(t))}))}(this,e,t)},has:function(e){return this.get(e,h)!==h},hasIn:function(e){return this.getIn(e,h)!==h},isSubset:function(e){return e="function"==typeof e.includes?e:r(e),this.every((function(t){return e.includes(t)}))},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:r(e)).isSubset(this)},keyOf:function(e){return this.findKey((function(t){return oe(t,e)}))},keySeq:function(){return this.toSeq().map(Cr).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Nt(this,e)},maxBy:function(e,t){return Nt(this,t,e)},min:function(e){return Nt(this,e?Er(e):Tr)},minBy:function(e,t){return Nt(this,t?Er(t):Tr,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return zt(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return zt(this,Bt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Pr(e),t)},sortBy:function(e,t){return zt(this,Lt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return zt(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return zt(this,function(e,t,r){var n=Wt(e);return n.__iterateUncached=function(n,i){var a=this;if(i)return this.cacheResult().__iterate(n,i);var o=0;return e.__iterate((function(e,i,s){return t.call(r,e,i,s)&&++o&&n(e,i,a)})),o},n.__iteratorUncached=function(n,i){var a=this;if(i)return this.cacheResult().__iterator(n,i);var o=e.__iterator(2,i),s=!0;return new k((function(){if(!s)return{value:void 0,done:!0};var e=o.next();if(e.done)return e;var i=e.value,u=i[0],c=i[1];return t.call(r,c,u,a)?2===n?e:B(n,u,c,e):(s=!1,{value:void 0,done:!0})}))},n}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Pr(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=l(e),r=s(e),n=t?1:0;return function(e,t){return t=he(t,3432918353),t=he(t<<15|t>>>-15,461845907),t=he(t<<13|t>>>-13,5),t=he((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=ge((t=he(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(r?t?function(e,t){n=31*n+Ir(ve(e),ve(t))|0}:function(e,t){n=n+Ir(ve(e),ve(t))|0}:t?function(e){n=31*n+ve(e)|0}:function(e){n=n+ve(e)|0}),n)}(this))}});var Or=r.prototype;Or[d]=!0,Or[M]=Or.values,Or.__toJS=Or.toArray,Or.__toStringMapper=Ar,Or.inspect=Or.toSource=function(){return this.toString()},Or.chain=Or.flatMap,Or.contains=Or.includes,xr(n,{flip:function(){return zt(this,Dt(this))},mapEntries:function(e,t){var r=this,n=0;return zt(this,this.toSeq().map((function(i,a){return e.call(t,[a,i],n++,r)})).fromEntrySeq())},mapKeys:function(e,t){var r=this;return zt(this,this.toSeq().flip().map((function(n,i){return e.call(t,n,i,r)})).flip())}});var wr=n.prototype;function Cr(e,t){return t}function jr(e,t){return[t,e]}function Pr(e){return function(){return!e.apply(this,arguments)}}function Er(e){return function(){return-e.apply(this,arguments)}}function Ar(e){return"string"==typeof e?JSON.stringify(e):String(e)}function Dr(){return S(arguments)}function Tr(e,t){return e<t?1:e>t?-1:0}function Ir(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return wr[f]=!0,wr[M]=Or.entries,wr.__toJS=Or.toObject,wr.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+Ar(e)},xr(i,{toKeyedSeq:function(){return new jt(this,!1)},filter:function(e,t){return zt(this,Mt(this,e,t,!1))},findIndex:function(e,t){var r=this.findEntry(e,t);return r?r[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return zt(this,It(this,!1))},slice:function(e,t){return zt(this,kt(this,e,t,!1))},splice:function(e,t){var r=arguments.length;if(t=Math.max(0|t,0),0===r||2===r&&!t)return this;e=j(e,e<0?this.count():this.size);var n=this.slice(0,e);return zt(this,1===r?n:n.concat(S(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var r=this.findLastEntry(e,t);return r?r[0]:-1},first:function(){return this.get(0)},flatten:function(e){return zt(this,Rt(this,e,!1))},get:function(e,t){return(e=O(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find((function(t,r){return r===e}),void 0,t)},has:function(e){return(e=O(this,e))>=0&&(void 0!==this.size?this.size===1/0||e<this.size:-1!==this.indexOf(e))},interpose:function(e){return zt(this,function(e,t){var r=Wt(e);return r.size=e.size&&2*e.size-1,r.__iterateUncached=function(r,n){var i=this,a=0;return e.__iterate((function(e,n){return(!a||!1!==r(t,a++,i))&&!1!==r(e,a++,i)}),n),a},r.__iteratorUncached=function(r,n){var i,a=e.__iterator(1,n),o=0;return new k((function(){return(!i||o%2)&&(i=a.next()).done?i:o%2?B(r,o++,t):B(r,o++,i.value,i)}))},r}(this,e))},interleave:function(){var e=[this].concat(S(arguments)),t=Ut(this.toSeq(),G.of,e),r=t.flatten(!0);return t.size&&(r.size=t.size*e.length),zt(this,r)},keySeq:function(){return le(0,this.size)},last:function(){return this.get(-1)},skipWhile:function(e,t){return zt(this,Bt(this,e,t,!1))},zip:function(){var e=[this].concat(S(arguments));return zt(this,Ut(this,Dr,e))},zipWith:function(e){var t=S(arguments);return t[0]=this,zt(this,Ut(this,e,t))}}),i.prototype[p]=!0,i.prototype[m]=!0,xr(a,{get:function(e,t){return this.has(e)?e:t},includes:function(e){return this.has(e)},keySeq:function(){return this.valueSeq()}}),a.prototype.has=Or.includes,a.prototype.contains=a.prototype.includes,xr(H,n.prototype),xr(G,i.prototype),xr(q,a.prototype),xr(fe,n.prototype),xr(pe,i.prototype),xr(me,a.prototype),{Iterable:r,Seq:z,Collection:de,Map:De,OrderedMap:St,List:it,Stack:hr,Set:tr,OrderedSet:cr,Record:Kt,Range:le,Repeat:ue,is:oe,fromJS:ne}}()},function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return a}));var n=r(240),i=new(r(236).a)(n.a),a=i},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){return Array.isArray||function(e){return e&&"number"==typeof e.length}}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return s})),r.d(t,"c",(function(){return u}));var n=r(0),i=r(1);function a(){return a.zero()}!function(e){e.zero=function(){return{x:0,y:0,width:0,height:0}},e.create=function(e,t,r,n){return{x:e,y:t,width:r,height:n}},e.clone=function(e){return Object(n.__assign)({},e)},e.copy=function(e,t){return Object.assign(e,t)},e.set=function(e,t,r,n,i){return e.x=t,e.y=r,e.width=n,e.height=i,e},e.toVec4=function(e,t){return e[0]=t.x,e[1]=t.y,e[2]=t.width,e[3]=t.height,e},e.equals=function(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}}(a||(a={}));var o=Object(i.Vec4)();function s(e,t,r,n){var a=r.x,s=r.y,u=r.width,c=r.height;i.Vec4.set(o,t[0],t[1],t[2],1),i.Vec4.transformMat4(o,o,n);var l=o[3];return 0!==l&&(o[0]/=l,o[1]/=l,o[2]/=l),e[0]=a+u/2*o[0]+(0+u/2),e[1]=s+c/2*o[1]+(0+c/2),e[2]=.5*o[2]+.5,e[3]=0===l?0:1/l,e}function u(e,t,r,n){var a=r.x,o=r.y,s=r.width,u=r.height,c=t[0]-a,l=u-t[1]-1-o,d=t[2];return e[0]=2*c/s-1,e[1]=2*l/u-1,e[2]=2*d-1,i.Vec3.transformMat4(e,e,n)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0),i=r(2),a=r(208),o=r(212),s=r(66),u=Object(n.__assign)({},a.b),c=o.a.createProvider({label:"Interactions",descriptor:Object(s.CustomPropertyDescriptor)({name:"molstar_computed_interactions"}),type:"local",defaultParams:u,getParams:function(e){return u},isApplicable:function(e){return!0},obtain:function(e,t,r){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var o,s;return Object(n.__generator)(this,(function(c){switch(c.label){case 0:return o=Object(n.__assign)(Object(n.__assign)({},i.ParamDefinition.getDefaultValues(u)),r),s={},[4,Object(a.c)(e,t,o)];case 1:return[2,(s.value=c.sent(),s)]}}))}))}})},function(e,t,r){"use strict";var n=r(69),i=r(97),a=r(44);function o(){return o.zero()}!function(e){function t(){var e=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];return e[0]=0,e}function r(){var e=t();return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function o(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function s(e){for(var t=0;t<16;t++)e[t]=0;return e}e.zero=t,e.identity=r,e.setIdentity=o,e.setZero=s,e.ofRows=function(e){for(var r=t(),n=0;n<4;n++)for(var i=e[n],a=0;a<4;a++)r[4*a+n]=i[a];return r};var u=r();function c(e,t,r){for(var n=0;n<16;n++)if(Math.abs(e[n]-t[n])>r)return!1;return!0}function l(e,t,r,n){e[4*r+t]=n}function d(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],d=t[8],f=t[9],p=t[10],m=t[11],h=t[12],g=t[13],v=t[14],b=t[15],y=r[0],_=r[1],S=r[2],x=r[3];return e[0]=y*n+_*s+S*d+x*h,e[1]=y*i+_*u+S*f+x*g,e[2]=y*a+_*c+S*p+x*v,e[3]=y*o+_*l+S*m+x*b,y=r[4],_=r[5],S=r[6],x=r[7],e[4]=y*n+_*s+S*d+x*h,e[5]=y*i+_*u+S*f+x*g,e[6]=y*a+_*c+S*p+x*v,e[7]=y*o+_*l+S*m+x*b,y=r[8],_=r[9],S=r[10],x=r[11],e[8]=y*n+_*s+S*d+x*h,e[9]=y*i+_*u+S*f+x*g,e[10]=y*a+_*c+S*p+x*v,e[11]=y*o+_*l+S*m+x*b,y=r[12],_=r[13],S=r[14],x=r[15],e[12]=y*n+_*s+S*d+x*h,e[13]=y*i+_*u+S*f+x*g,e[14]=y*a+_*c+S*p+x*v,e[15]=y*o+_*l+S*m+x*b,e}e.isIdentity=function(e,t){return c(e,u,void 0===t?n.a:t)},e.hasNaN=function(e){for(var t=0;t<16;t++)if(isNaN(e[t]))return!0;return!1},e.areEqual=c,e.setValue=l,e.getValue=function(e,t,r){return e[4*r+t]},e.toArray=function(e,t,r){return t[r+0]=e[0],t[r+1]=e[1],t[r+2]=e[2],t[r+3]=e[3],t[r+4]=e[4],t[r+5]=e[5],t[r+6]=e[6],t[r+7]=e[7],t[r+8]=e[8],t[r+9]=e[9],t[r+10]=e[10],t[r+11]=e[11],t[r+12]=e[12],t[r+13]=e[13],t[r+14]=e[14],t[r+15]=e[15],t},e.fromArray=function(e,t,r){return e[0]=t[r+0],e[1]=t[r+1],e[2]=t[r+2],e[3]=t[r+3],e[4]=t[r+4],e[5]=t[r+5],e[6]=t[r+6],e[7]=t[r+7],e[8]=t[r+8],e[9]=t[r+9],e[10]=t[r+10],e[11]=t[r+11],e[12]=t[r+12],e[13]=t[r+13],e[14]=t[r+14],e[15]=t[r+15],e},e.fromBasis=function(t,r,n,i){return e.setZero(t),e.setValue(t,0,0,r[0]),e.setValue(t,1,0,r[1]),e.setValue(t,2,0,r[2]),e.setValue(t,0,1,n[0]),e.setValue(t,1,1,n[1]),e.setValue(t,2,1,n[2]),e.setValue(t,0,2,i[0]),e.setValue(t,1,2,i[1]),e.setValue(t,2,2,i[2]),e.setValue(t,3,3,1),t},e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.clone=function(t){return e.copy(e.zero(),t)},e.getTranslation=function(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e},e.getScaling=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[4],o=t[5],s=t[6],u=t[8],c=t[9],l=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(a*a+o*o+s*s),e[2]=Math.sqrt(u*u+c*c+l*l),e},e.getRotation=function(e,t){var r=t[0]+t[5]+t[10],n=0;return r>0?(n=2*Math.sqrt(r+1),e[3]=.25*n,e[0]=(t[6]-t[9])/n,e[1]=(t[8]-t[2])/n,e[2]=(t[1]-t[4])/n):t[0]>t[5]&&t[0]>t[10]?(n=2*Math.sqrt(1+t[0]-t[5]-t[10]),e[3]=(t[6]-t[9])/n,e[0]=.25*n,e[1]=(t[1]+t[4])/n,e[2]=(t[8]+t[2])/n):t[5]>t[10]?(n=2*Math.sqrt(1+t[5]-t[0]-t[10]),e[3]=(t[8]-t[2])/n,e[0]=(t[1]+t[4])/n,e[1]=.25*n,e[2]=(t[6]+t[9])/n):(n=2*Math.sqrt(1+t[10]-t[0]-t[5]),e[3]=(t[1]-t[4])/n,e[0]=(t[8]+t[2])/n,e[1]=(t[6]+t[9])/n,e[2]=.25*n),e},e.extractRotation=function(e,t){var r=1/Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),n=1/Math.sqrt(t[4]*t[4]+t[5]*t[5]+t[6]*t[6]),i=1/Math.sqrt(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]);return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=0,e[4]=t[4]*n,e[5]=t[5]*n,e[6]=t[6]*n,e[7]=0,e[8]=t[8]*i,e[9]=t[9]*i,e[10]=t[10]*i,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.transpose=function(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],a=t[6],o=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=a,e[11]=t[14],e[12]=i,e[13]=o,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e},e.invert=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],u=t[6],c=t[7],l=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14],v=t[15],b=r*s-n*o,y=r*u-i*o,_=r*c-a*o,S=n*u-i*s,x=n*c-a*s,O=i*c-a*u,w=l*h-d*m,C=l*g-f*m,j=l*v-p*m,P=d*g-f*h,E=d*v-p*h,A=f*v-p*g,D=b*A-y*E+_*P+S*j-x*C+O*w;return D?(D=1/D,e[0]=(s*A-u*E+c*P)*D,e[1]=(i*E-n*A-a*P)*D,e[2]=(h*O-g*x+v*S)*D,e[3]=(f*x-d*O-p*S)*D,e[4]=(u*j-o*A-c*C)*D,e[5]=(r*A-i*j+a*C)*D,e[6]=(g*_-m*O-v*y)*D,e[7]=(l*O-f*_+p*y)*D,e[8]=(o*E-s*j+c*w)*D,e[9]=(n*j-r*E-a*w)*D,e[10]=(m*x-h*_+v*b)*D,e[11]=(d*_-l*x-p*b)*D,e[12]=(s*C-o*P-u*w)*D,e[13]=(r*P-n*C+i*w)*D,e[14]=(h*y-m*S-g*b)*D,e[15]=(l*S-d*y+f*b)*D,e):(console.warn("non-invertible matrix.",t),e)},e.mul=d,e.mulOffset=function(e,t,r,n,i,a){var o=t[0+i],s=t[1+i],u=t[2+i],c=t[3+i],l=t[4+i],d=t[5+i],f=t[6+i],p=t[7+i],m=t[8+i],h=t[9+i],g=t[10+i],v=t[11+i],b=t[12+i],y=t[13+i],_=t[14+i],S=t[15+i],x=r[0+a],O=r[1+a],w=r[2+a],C=r[3+a];return e[0+n]=x*o+O*l+w*m+C*b,e[1+n]=x*s+O*d+w*h+C*y,e[2+n]=x*u+O*f+w*g+C*_,e[3+n]=x*c+O*p+w*v+C*S,x=r[4+a],O=r[5+a],w=r[6+a],C=r[7+a],e[4+n]=x*o+O*l+w*m+C*b,e[5+n]=x*s+O*d+w*h+C*y,e[6+n]=x*u+O*f+w*g+C*_,e[7+n]=x*c+O*p+w*v+C*S,x=r[8+a],O=r[9+a],w=r[10+a],C=r[11+a],e[8+n]=x*o+O*l+w*m+C*b,e[9+n]=x*s+O*d+w*h+C*y,e[10+n]=x*u+O*f+w*g+C*_,e[11+n]=x*c+O*p+w*v+C*S,x=r[12+a],O=r[13+a],w=r[14+a],C=r[15+a],e[12+n]=x*o+O*l+w*m+C*b,e[13+n]=x*s+O*d+w*h+C*y,e[14+n]=x*u+O*f+w*g+C*_,e[15+n]=x*c+O*p+w*v+C*S,e},e.mul3=function(e,t,r,n){return d(e,d(e,t,r),n)},e.translate=function(e,t,r){var n,i,a,o,s,u,c,l,d,f,p,m,h=r[0],g=r[1],v=r[2];return t===e?(e[12]=t[0]*h+t[4]*g+t[8]*v+t[12],e[13]=t[1]*h+t[5]*g+t[9]*v+t[13],e[14]=t[2]*h+t[6]*g+t[10]*v+t[14],e[15]=t[3]*h+t[7]*g+t[11]*v+t[15]):(n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],u=t[5],c=t[6],l=t[7],d=t[8],f=t[9],p=t[10],m=t[11],e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=u,e[6]=c,e[7]=l,e[8]=d,e[9]=f,e[10]=p,e[11]=m,e[12]=n*h+s*g+d*v+t[12],e[13]=i*h+u*g+f*v+t[13],e[14]=a*h+c*g+p*v+t[14],e[15]=o*h+l*g+m*v+t[15]),e},e.fromTranslation=function(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},e.setTranslation=function(e,t){return e[12]=t[0],e[13]=t[1],e[14]=t[2],e},e.setAxes=function(e,t,r,n){return e[0]=r[0],e[4]=r[1],e[8]=r[2],e[1]=n[0],e[5]=n[1],e[9]=n[2],e[2]=t[0],e[6]=t[1],e[10]=t[2],e},e.rotate=function(t,r,i,a){var o,s,u,c,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C,j,P,E,A,D=a[0],T=a[1],I=a[2],M=Math.sqrt(D*D+T*T+I*I);return Math.abs(M)<n.a?e.identity():(D*=M=1/M,T*=M,I*=M,o=Math.sin(i),u=1-(s=Math.cos(i)),c=r[0],l=r[1],d=r[2],f=r[3],p=r[4],m=r[5],h=r[6],g=r[7],v=r[8],b=r[9],y=r[10],_=r[11],S=D*D*u+s,x=T*D*u+I*o,O=I*D*u-T*o,w=D*T*u-I*o,C=T*T*u+s,j=I*T*u+D*o,P=D*I*u+T*o,E=T*I*u-D*o,A=I*I*u+s,t[0]=c*S+p*x+v*O,t[1]=l*S+m*x+b*O,t[2]=d*S+h*x+y*O,t[3]=f*S+g*x+_*O,t[4]=c*w+p*C+v*j,t[5]=l*w+m*C+b*j,t[6]=d*w+h*C+y*j,t[7]=f*w+g*C+_*j,t[8]=c*P+p*E+v*A,t[9]=l*P+m*E+b*A,t[10]=d*P+h*E+y*A,t[11]=f*P+g*E+_*A,r!==t&&(t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15]),t)},e.fromRotation=function(e,t,r){var i,a,s,u=r[0],c=r[1],l=r[2],d=Math.sqrt(u*u+c*c+l*l);return Math.abs(d)<n.a?o(e):(u*=d=1/d,c*=d,l*=d,i=Math.sin(t),s=1-(a=Math.cos(t)),e[0]=u*u*s+a,e[1]=c*u*s+l*i,e[2]=l*u*s-c*i,e[3]=0,e[4]=u*c*s-l*i,e[5]=c*c*s+a,e[6]=l*c*s+u*i,e[7]=0,e[8]=u*l*s+c*i,e[9]=c*l*s-u*i,e[10]=l*l*s+a,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)},e.scale=function(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.scaleUniformly=function(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},e.fromScaling=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.fromUniformScaling=function(e,t){return e[0]=t,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.fromMat3=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[4]=t[3],e[5]=t[4],e[6]=t[5],e[8]=t[6],e[9]=t[7],e[10]=t[8],e},e.makeTable=function(e){for(var t="",r=0;r<4;r++){for(var n=0;n<4;n++)t+=e[4*n+r].toString(),n<3&&(t+=" ");r<3&&(t+="\n")}return t},e.determinant=function(e){var t=e[0],r=e[1],n=e[2],i=e[3],a=e[4],o=e[5],s=e[6],u=e[7],c=e[8],l=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15];return(t*o-r*a)*(d*g-f*h)-(t*s-n*a)*(l*g-f*m)+(t*u-i*a)*(l*h-d*m)+(r*s-n*o)*(c*g-f*p)-(r*u-i*o)*(c*h-d*p)+(n*u-i*s)*(c*m-l*p)},e.isRotationAndTranslation=function(e,t){return function(e,t){var r=e[0],i=e[1],a=e[2],o=e[3],s=e[4],u=e[5],c=e[6],l=e[7],d=e[8],f=e[9],p=e[10],m=e[11],h=e[15];if(!(Object(n.b)(h,1,t)&&Object(n.b)(o,0,t)&&Object(n.b)(l,0,t)&&Object(n.b)(m,0,t)))return!1;var g=Math.abs(r*(u*p-c*f)-i*(s*p-c*d)+a*(s*f-u*d));if(!Object(n.b)(g,1,t))return!1;return!0}(e,void 0!==t?t:n.a)},e.isTranslationAndUniformScaling=function(e,t){return function(e,t){var r=e[0];return Object(n.b)(e[1],0,t)&&Object(n.b)(e[2],0,t)&&Object(n.b)(e[3],0,t)&&Object(n.b)(e[4],0,t)&&Object(n.b)(e[5],r,t)&&Object(n.b)(e[6],0,t)&&Object(n.b)(e[7],0,t)&&Object(n.b)(e[8],0,t)&&Object(n.b)(e[9],0,t)&&Object(n.b)(e[10],r,t)&&Object(n.b)(e[11],0,t)&&Object(n.b)(e[15],1,t)}(e,void 0!==t?t:n.a)},e.fromQuat=function(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=r+r,s=n+n,u=i+i,c=r*o,l=n*o,d=n*s,f=i*o,p=i*s,m=i*u,h=a*o,g=a*s,v=a*u;return e[0]=1-d-m,e[1]=l+v,e[2]=f-g,e[3]=0,e[4]=l-v,e[5]=1-c-m,e[6]=p+h,e[7]=0,e[8]=f+g,e[9]=p-h,e[10]=1-c-d,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},e.perspective=function(e,t,r,n,i,a,o){var s=2*a/(r-t),u=2*a/(n-i),c=(r+t)/(r-t),l=(n+i)/(n-i),d=-(o+a)/(o-a),f=-2*o*a/(o-a);return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=d,e[11]=-1,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e},e.ortho=function(e,t,r,n,i,a,o){var s=1/(r-t),u=1/(n-i),c=1/(o-a),l=(r+t)*s,d=(n+i)*u,f=(o+a)*c;return e[0]=2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=2*u,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=-2*c,e[11]=0,e[12]=-l,e[13]=-d,e[14]=-f,e[15]=1,e},e.lookAt=function(e,t,r,i){var a,s,u,c,l,d,f,p,m,h,g=t[0],v=t[1],b=t[2],y=i[0],_=i[1],S=i[2],x=r[0],O=r[1],w=r[2];return Math.abs(g-x)<n.a&&Math.abs(v-O)<n.a&&Math.abs(b-w)<n.a?o(e):(f=g-x,p=v-O,m=b-w,a=_*(m*=h=1/Math.sqrt(f*f+p*p+m*m))-S*(p*=h),s=S*(f*=h)-y*m,u=y*p-_*f,(h=Math.sqrt(a*a+s*s+u*u))?(a*=h=1/h,s*=h,u*=h):(a=0,s=0,u=0),c=p*u-m*s,l=m*a-f*u,d=f*s-p*a,(h=Math.sqrt(c*c+l*l+d*d))?(c*=h=1/h,l*=h,d*=h):(c=0,l=0,d=0),e[0]=a,e[1]=c,e[2]=f,e[3]=0,e[4]=s,e[5]=l,e[6]=p,e[7]=0,e[8]=u,e[9]=d,e[10]=m,e[11]=0,e[12]=-(a*g+s*v+u*b),e[13]=-(c*g+l*v+d*b),e[14]=-(f*g+p*v+m*b),e[15]=1,e)},e.targetTo=function(e,t,r,n){var i=t[0],a=t[1],o=t[2],s=n[0],u=n[1],c=n[2],l=i-r[0],d=a-r[1],f=o-r[2],p=l*l+d*d+f*f;p>0&&(l*=p=1/Math.sqrt(p),d*=p,f*=p);var m=u*f-c*d,h=c*l-s*f,g=s*d-u*l;return(p=m*m+h*h+g*g)>0&&(m*=p=1/Math.sqrt(p),h*=p,g*=p),e[0]=m,e[1]=h,e[2]=g,e[3]=0,e[4]=d*g-f*h,e[5]=f*m-l*g,e[6]=l*h-d*m,e[7]=0,e[8]=l,e[9]=d,e[10]=f,e[11]=0,e[12]=i,e[13]=a,e[14]=o,e[15]=1,e},e.fromPermutation=function(e,t){s(e);for(var r=0;r<4;r++){l(e,r,t[r],1)}return e},e.getMaxScaleOnAxis=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],n=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,n))};var f=i.a.create(1,0,0),p=i.a.create(0,1,0),m=i.a.create(0,0,1);e.rotX90=e.fromRotation(e(),Object(a.c)(90),f),e.rotX180=e.fromRotation(e(),Object(a.c)(180),f),e.rotY90=e.fromRotation(e(),Object(a.c)(90),p),e.rotY180=e.fromRotation(e(),Object(a.c)(180),p),e.rotY270=e.fromRotation(e(),Object(a.c)(270),p),e.rotZ90=e.fromRotation(e(),Object(a.c)(90),m),e.rotZ180=e.fromRotation(e(),Object(a.c)(180),m),e.rotXY90=e.mul(e(),e.rotX90,e.rotY90),e.rotZY90=e.mul(e(),e.rotZ90,e.rotY90),e.rotZYZ90=e.mul(e(),e.rotZY90,e.rotZ90),e.rotZ90X180=e.mul(e(),e.rotZ90,e.rotX180),e.rotY90Z180=e.mul(e(),e.rotY90,e.rotZ180),e.id=e.identity()}(o||(o={})),t.a=o},function(e,t,r){"use strict";var n;!function(e){e.create=function(e){return void 0===e&&(e=512),{current:[],offset:0,capacity:e,chunks:[]}},e.getString=function(e){return e.chunks.length?(e.offset>0&&(e.chunks[e.chunks.length]=e.current.length===e.offset?e.current.join(""):e.current.slice(0,e.offset).join("")),e.chunks.join("")):e.current.length===e.offset?e.current.join(""):e.current.splice(0,e.offset).join("")},e.getSize=function(e){for(var t=0,r=0,n=e.chunks;r<n.length;r++){t+=n[r].length}for(var i=0;i<e.offset;i++)t+=e.current[i].length;return t},e.getChunks=function(e){return e.offset>0&&(e.current.length===e.offset?e.chunks[e.chunks.length]=e.current.join(""):e.chunks[e.chunks.length]=e.current.slice(0,e.offset).join(""),e.offset=0),e.chunks};var t=[];function r(e,r){r>0&&n(e,t[r])}function n(e,t){e.offset===e.capacity&&(e.chunks[e.chunks.length]=e.current.join(""),e.offset=0),e.current[e.offset++]=t}!function(){for(var e="",r=0;r<512;r++)t[r]=e,e+=" "}(),e.newline=function(e){n(e,"\n")},e.whitespace=r,e.whitespace1=function(e){n(e," ")},e.write=function(e,t){t&&(e.offset===e.capacity&&(e.chunks[e.chunks.length]=e.current.join(""),e.offset=0),e.current[e.offset++]=t)},e.writeSafe=n,e.writePadLeft=function(e,t,i){t?(r(e,i-t.length),n(e,t)):r(e,i)},e.writePadRight=function(e,t,i){if(t){var a=i-t.length;n(e,t),r(e,a)}else r(e,i)},e.writeInteger=function(e,t){n(e,""+t)},e.writeIntegerAndSpace=function(e,t){n(e,t+" ")},e.writeIntegerPadLeft=function(e,t,i){var a=""+t;r(e,i-a.length),n(e,a)},e.writeIntegerPadRight=function(e,t,i){var a=""+t,o=i-a.length;n(e,a),r(e,o)},e.writeFloat=function(e,t,r){n(e,""+Math.round(r*t)/r)},e.writeFloatPadLeft=function(e,t,i,a){var o=""+Math.round(i*t)/i;r(e,a-o.length),n(e,o)},e.writeFloatPadRight=function(e,t,i,a){var o=""+Math.round(i*t)/i,s=a-o.length;n(e,o),r(e,s)}}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i}));var n,i,a=r(12),o=r(262),s=r(268),u=function(){function e(e){this.providers=e}return e.prototype.and=function(t){return new e(this.providers.concat([t]))},e.prototype.encode=function(e){for(var t=[],r=0,n=this.providers;r<n.length;r++){var i=(0,n[r])(e);if(!i.encodings.length)throw new Error("Encodings must be non-empty.");e=i.data;for(var a=0,o=i.encodings;a<o.length;a++){var s=o[a];t.push(s)}}if(!(e instanceof Uint8Array))throw new Error("The encoding must result in a Uint8Array. Fix your encoding chain.");return{encoding:t,data:e}},e}();!function(e){function t(e){return new u([e])}function r(e){switch(e.kind){case"ByteArray":return i.byteArray;case"FixedPoint":return i.fixedPoint(e.factor);case"IntervalQuantization":return i.intervalQuantizaiton(e.min,e.max,e.numSteps);case"RunLength":return i.runLength;case"Delta":return i.delta;case"IntegerPacking":return i.integerPacking;case"StringArray":return i.stringArray}}e.by=t,e.fromEncoding=function(e){for(var n=t(r(e[0])),i=1;i<e.length;i++)n=n.and(r(e[i]));return n}}(n||(n={})),function(e){var t,r;e.by=function(e){return new u([e])};var n=((t={})[2]=function(e,t,r){e.setInt16(2*t,r,!0)},t[5]=function(e,t,r){e.setUint16(2*t,r,!0)},t[3]=function(e,t,r){e.setInt32(4*t,r,!0)},t[6]=function(e,t,r){e.setUint32(4*t,r,!0)},t[32]=function(e,t,r){e.setFloat32(4*t,r,!0)},t[33]=function(e,t,r){e.setFloat64(8*t,r,!0)},t),i=((r={})[2]=2,r[5]=2,r[3]=4,r[6]=4,r[32]=4,r[33]=8,r);function c(e){var t=o.a.getDataType(e);if(1===t)return function(e){return{encodings:[{kind:"ByteArray",type:1}],data:new Uint8Array(e.buffer,e.byteOffset)}}(e);if(4===t)return function(e){return{encodings:[{kind:"ByteArray",type:4}],data:e}}(e);for(var r=new Uint8Array(e.length*i[t]),a=n[t],s=new DataView(r.buffer),u=0,c=e.length;u<c;u++)a(s,u,e[u]);return{encodings:[{kind:"ByteArray",type:t}],data:r}}function l(e,t){for(var r=-t-1,n=0,i=0,a=e.length;i<a;i++){var o=e[i];0===o?n+=1:o>0?(n+=Math.ceil(o/t),o%t==0&&(n+=1)):(n+=Math.ceil(o/r),o%r==0&&(n+=1))}return n}e.byteArray=c,e.fixedPoint=function(e){return function(t){return function(e,t){for(var r=o.a.getDataType(e),n=new Int32Array(e.length),i=0,a=e.length;i<a;i++)n[i]=Math.round(e[i]*t);return{encodings:[{kind:"FixedPoint",factor:t,srcType:r}],data:n}}(t,e)}},e.intervalQuantizaiton=function(e,t,r,n){return void 0===n&&(n=Int32Array),function(i){return function(e,t,r,n,i){var a=o.a.getDataType(e);if(!e.length)return{encodings:[{kind:"IntervalQuantization",min:t,max:r,numSteps:n,srcType:a}],data:new Int32Array(0)};if(r<t){var s=t;t=r,r=s}for(var u=(r-t)/(n-1),c=new i(e.length),l=0,d=e.length;l<d;l++){var f=e[l];c[l]=f<=t?0:f>=r?n-1:0|Math.round((f-t)/u)}return{encodings:[{kind:"IntervalQuantization",min:t,max:r,numSteps:n,srcType:a}],data:c}}(i,e,t,r,n)}},e.runLength=function(e){var t=o.a.getDataType(e);if(void 0===t&&(e=new Int32Array(e),t=3),!e.length)return{encodings:[{kind:"RunLength",srcType:t,srcSize:0}],data:new Int32Array(0)};for(var r=2,n=1,i=e.length;n<i;n++)e[n-1]!==e[n]&&(r+=2);var a=new Int32Array(r),s=0,u=1;for(n=1,i=e.length;n<i;n++)e[n-1]!==e[n]?(a[s]=e[n-1],a[s+1]=u,u=1,s+=2):++u;return a[s]=e[e.length-1],a[s+1]=u,{encodings:[{kind:"RunLength",srcType:t,srcSize:e.length}],data:a}},e.delta=function(e){if(!o.a.isSignedIntegerDataType(e))throw new Error("Only signed integer types can be encoded using delta encoding.");var t=o.a.getDataType(e);if(void 0===t&&(e=new Int32Array(e),t=3),!e.length)return{encodings:[{kind:"Delta",origin:0,srcType:t}],data:new e.constructor(0)};var r=new e.constructor(e.length),n=e[0];r[0]=e[0];for(var i=1,a=e.length;i<a;i++)r[i]=e[i]-e[i-1];return r[0]=0,{encodings:[{kind:"Delta",origin:n,srcType:t}],data:r}},e.integerPacking=function(e){var t=function(e){var t=function(e){for(var t=0,r=e.length;t<r;t++)if(e[t]<0)return!0;return!1}(e),r=l(e,t?127:255),n=l(e,t?32767:65535);return 4*e.length<2*n?{isSigned:t,size:e.length,bytesPerElement:4}:2*n<r?{isSigned:t,size:n,bytesPerElement:2}:{isSigned:t,size:r,bytesPerElement:1}}(e);return 4===t.bytesPerElement?c(e):function(e,t){for(var r=t.isSigned?1===t.bytesPerElement?127:32767:1===t.bytesPerElement?255:65535,n=-r-1,i=e.length,a=t.isSigned?1===t.bytesPerElement?new Int8Array(t.size):new Int16Array(t.size):1===t.bytesPerElement?new Uint8Array(t.size):new Uint16Array(t.size),o=0,s=0;s<i;s++){var u=e[s];if(u>=0)for(;u>=r;)a[o]=r,++o,u-=r;else for(;u<=n;)a[o]=n,++o,u-=n;a[o]=u,++o}var l=c(a);return{encodings:[{kind:"IntegerPacking",byteCount:t.bytesPerElement,isUnsigned:!t.isSigned,srcSize:i},l.encodings[0]],data:l.data}}(e,t)},e.stringArray=function(e){var t=Object.create(null),r=[],n=new Int32Array(e.length),i=a.a.create(Int32Array,1,Math.min(1024,e.length<32?e.length+1:Math.round(e.length/8)+1));a.a.add(i,0);for(var o=0,u=0,c=0,l=e;c<l.length;c++){var d=l[c];if(null!=d){var f=t[d];void 0===f&&(o+=d.length,r[f=r.length]=d,t[d]=f,a.a.add(i,o)),n[u++]=f}else n[u++]=-1}var p=a.a.compact(i),m=Object(s.b)(p).encode(p),h=Object(s.b)(n).encode(n);return{encodings:[{kind:"StringArray",dataEncoding:h.encoding,stringData:r.join(""),offsetEncoding:m.encoding,offsets:m.data}],data:h.data}}}(i||(i={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return b}));var n=r(0),i=r(2),a=r(55),o=r(4),s=r(62),u=r(121),c=r(94),l=r(17),d=r(23),f=r(51),p=r(140),m=r(141),h=r(1),g=r(6),v=r(85);function b(e,t,r,b){var y,_,S,x,O=0,w=t.webgl,C=new s.a,j=Object(u.c)(),P=[],E=a.c.create(),A=new Map,D=c.a.createEmpty();function T(e,t,r){var n=r.visible,i=r.alphaFactor,a=r.pickable,o=r.overpaint,s=r.transparency,u=r.clipping,c=r.transform,l=r.unitTransforms;void 0!==n&&e.setVisibility(n),void 0!==i&&e.setAlphaFactor(i),void 0!==a&&e.setPickable(a),void 0!==o&&e.setOverpaint(o),void 0!==s&&e.setTransparency(s),void 0!==u&&e.setClipping(u),void 0!==c&&e.setTransform(c),void 0!==l&&(l?e.setTransform(void 0,l.getSymmetryGroupTransforms(t)):e.setTransform(void 0,null))}return{label:e,get groupCount(){var e=0;return A.forEach((function(t){var r=t.visual;r.renderObject&&(e+=r.groupCount)})),e},get props(){return x},get params(){return S},get state(){return E},get theme(){return D},renderObjects:P,updated:C,createOrUpdate:function(e,a){var s=this;return void 0===e&&(e={}),a&&a!==y&&(S=r(t,a),x||(x=i.ParamDefinition.getDefaultValues(S))),x=Object.assign({},x,e),l.b.create("Creating or updating UnitsRepresentation",(function(e){return Object(n.__awaiter)(s,void 0,void 0,(function(){var r,i,s,u,c,l,d,p,m,h,v,S,I;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(y||a)return[3,1];throw new Error("missing structure");case 1:if(!a||y)return[3,8];_=a.unitSymmetryGroups,c=0,n.label=2;case 2:return c<_.length?(m=_[c],p=b(j,a,x,w),(h=p.createOrUpdate({webgl:w,runtime:e},D,x,{group:m,structure:a}))?[4,h]:[3,4]):[3,7];case 3:n.sent(),n.label=4;case 4:return T(p,m,E),A.set(m.hashCode,{visual:p,group:m}),e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:c,max:_.length})]:[3,6];case 5:n.sent(),n.label=6;case 6:return c++,[3,2];case 7:return[3,43];case 8:if(!a||o.Structure.areUnitIdsAndIndicesEqual(a,y))return[3,22];_=a.unitSymmetryGroups,r=A,A=new Map,c=0,n.label=9;case 9:return c<_.length?(m=_[c],(s=r.get(m.hashCode))?(p=s.visual,(null===(v=p.mustRecreate)||void 0===v?void 0:v.call(p,{group:m,structure:a},x,w))?(p.destroy(),p=b(j,a,x,w),(h=p.createOrUpdate({webgl:w,runtime:e},D,x,{group:m,structure:a}))?[4,h]:[3,11]):[3,12]):[3,15]):[3,21];case 10:n.sent(),n.label=11;case 11:return T(p,m,E),[3,14];case 12:return(h=p.createOrUpdate({webgl:w,runtime:e},D,x,{group:m,structure:a}))?[4,h]:[3,14];case 13:n.sent(),n.label=14;case 14:return A.set(m.hashCode,{visual:p,group:m}),r.delete(m.hashCode),p.renderObject&&(i=p.renderObject.values.tMarker.ref.value.array,Object(f.c)(i,g.Interval.ofBounds(0,i.length),f.a.RemoveHighlight)),[3,18];case 15:return p=b(j,a,x,w),(h=p.createOrUpdate({webgl:w,runtime:e},D,x,{group:m,structure:a}))?[4,h]:[3,17];case 16:n.sent(),n.label=17;case 17:T(p,m,E),A.set(m.hashCode,{visual:p,group:m}),n.label=18;case 18:return e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:c,max:_.length})]:[3,20];case 19:n.sent(),n.label=20;case 20:return c++,[3,9];case 21:return r.forEach((function(e){e.visual.destroy()})),[3,43];case 22:if(!a||a===y||!o.Structure.areUnitIdsAndIndicesEqual(a,y))return[3,34];_=a.unitSymmetryGroups,c=0,n.label=23;case 23:return c<_.length?(m=_[c],(s=A.get(m.hashCode))?(p=s.visual,(null===(S=p.mustRecreate)||void 0===S?void 0:S.call(p,{group:m,structure:a},x,t.webgl))?(p.destroy(),p=b(j,a,x,t.webgl),s.visual=p,(h=p.createOrUpdate({webgl:w,runtime:e},D,x,{group:m,structure:a}))?[4,h]:[3,25]):[3,26]):[3,29]):[3,33];case 24:n.sent(),n.label=25;case 25:return T(p,m,E),[3,28];case 26:return(h=p.createOrUpdate({webgl:w,runtime:e},D,x,{group:m,structure:a}))?[4,h]:[3,28];case 27:n.sent(),n.label=28;case 28:return s.group=m,[3,30];case 29:throw new Error("expected to find visual for hashCode "+m.hashCode);case 30:return e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:c,max:_.length})]:[3,32];case 31:n.sent(),n.label=32;case 32:return c++,[3,23];case 33:return[3,43];case 34:u=[],A.forEach((function(e){return u.push(e)})),c=0,l=u.length,n.label=35;case 35:return c<l?(d=u[c],p=d.visual,m=d.group,(null===(I=p.mustRecreate)||void 0===I?void 0:I.call(p,{group:m,structure:y},x,t.webgl))?(p.destroy(),p=b(j,y,x,w),u[c].visual=p,(h=p.createOrUpdate({webgl:w,runtime:e},D,x,{group:m,structure:y}))?[4,h]:[3,37]):[3,38]):[3,43];case 36:n.sent(),n.label=37;case 37:return T(p,m,E),[3,40];case 38:return(h=p.createOrUpdate({webgl:w,runtime:e},D,x))?[4,h]:[3,40];case 39:n.sent(),n.label=40;case 40:return e.shouldUpdate?[4,e.update({message:"Creating or updating UnitsVisual",current:c,max:l})]:[3,42];case 41:n.sent(),n.label=42;case 42:return++c,[3,35];case 43:return P.length=0,A.forEach((function(e){var t=e.visual;t.renderObject&&P.push(t.renderObject)})),a&&(y=a),C.next(O++),[2]}}))}))}))},setState:function(e){var t=e.visible,r=e.alphaFactor,n=e.pickable,i=e.overpaint,o=e.transparency,s=e.clipping,u=e.transform,c=e.unitTransforms,l=e.syncManually,d=e.markerActions,f={};t!==E.visible&&(f.visible=t),r!==E.alphaFactor&&(f.alphaFactor=r),n!==E.pickable&&(f.pickable=n),void 0===i||p.a.areEqual(i,E.overpaint)||y&&(f.overpaint=p.a.remap(i,y)),void 0===o||m.a.areEqual(o,E.transparency)||y&&(f.transparency=m.a.remap(o,y)),void 0===s||v.a.areEqual(s,E.clipping)||y&&(f.clipping=v.a.remap(s,y)),void 0===u||h.Mat4.areEqual(u,E.transform,h.EPSILON)||(f.transform=u),c===E.unitTransforms&&(null==c?void 0:c.version)===e.unitTransformsVersion||(f.unitTransforms=c,E.unitTransformsVersion=c?null==c?void 0:c.version:-1),l!==E.syncManually&&(f.syncManually=l),d!==E.markerActions&&(f.markerActions=d),A.forEach((function(e){return T(e.visual,e.group,f)})),a.c.update(E,f)},setTheme:function(e){D=e},getLoci:function(e){if(void 0===e)return o.Structure.Loci(y);var t=d.EmptyLoci;return A.forEach((function(r){var n=r.visual.getLoci(e);Object(d.isEmptyLoci)(n)||(t=n)})),t},mark:function(e,t){if(!y)return!1;if(!f.b.is(E.markerActions,t))return!1;if(o.Structure.isLoci(e)||o.StructureElement.Loci.is(e)||o.Bond.isLoci(e)){if(!o.Structure.areRootsEquivalent(e.structure,y))return!1;e=d.Loci.remap(e,y)}else if(!Object(d.isEveryLoci)(e)&&!Object(d.isDataLoci)(e))return!1;if(d.Loci.isEmpty(e))return!1;var r=!1;return A.forEach((function(n){var i=n.visual;r=i.mark(e,t)||r})),r},destroy:function(){A.forEach((function(e){return e.visual.destroy()})),A.clear()}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(59),i=r(7),a=r(366),o={entry:n.a.entry,struct:n.a.struct,struct_asym:n.a.struct_asym,ihm_model_list:n.a.ihm_model_list,ihm_model_group:n.a.ihm_model_group,ihm_model_group_link:n.a.ihm_model_group_link,entity:n.a.entity,entity_poly:n.a.entity_poly,entity_poly_seq:n.a.entity_poly_seq,pdbx_entity_branch:n.a.pdbx_entity_branch,chem_comp:a.a,pdbx_chem_comp_identifier:n.a.pdbx_chem_comp_identifier,atom_site:n.a.atom_site,ihm_sphere_obj_site:n.a.ihm_sphere_obj_site,ihm_gaussian_obj_site:n.a.ihm_gaussian_obj_site,pdbx_unobs_or_zero_occ_residues:n.a.pdbx_unobs_or_zero_occ_residues,pdbx_molecule:n.a.pdbx_molecule};function s(e){for(var t=Object.create(null),r=0,n=Object.keys(o);r<n.length;r++){var a=n[r];t[a]=a in e?e[a]:i.d.ofUndefinedColumns(o[a],0)}return t}},function(e,t,r){"use strict";r.d(t,"a",(function(){return y})),r.d(t,"b",(function(){return _})),r.d(t,"d",(function(){return T})),r.d(t,"c",(function(){return I})),r.d(t,"e",(function(){return M}));var n,i=r(1),a=r(2),o=r(38),s=r(35),u=r(91),c=r(30),l=r(80),d=r(170),f=r(166),p=r(12),m=Object(i.Vec3)(),h=Object(i.Vec3)(),g=Object(i.Vec3)(),v=p.a.add,b=p.a.add3;(n||(n={})).create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=p.a.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e),a=p.a.create(Float32Array,3,t,r?r.startBuffer.ref.value:e),o=p.a.create(Float32Array,3,t,r?r.endBuffer.ref.value:e),s=p.a.create(Float32Array,1,t,r?r.scaleBuffer.ref.value:e),u=p.a.create(Float32Array,1,t,r?r.capBuffer.ref.value:e),c=function(e,t,r,i,c,l,d,f,p,m){for(var h=0;h<6;++h)b(a,e,t,r),b(o,i,c,l),v(n,m),v(s,d),v(u,(f?1:0)+(p?2:0))},l=function(e,t,r,n,a,o,s){var u=i.Vec3.distance(e,t),l=Math.floor(r/2),d=1/r;i.Vec3.sub(g,t,e);for(var f=0;f<l;++f){var p=d*(2*f+1);i.Vec3.setMagnitude(g,g,u*p),i.Vec3.add(m,e,g),i.Vec3.setMagnitude(g,g,u*d*(2*(f+1))),i.Vec3.add(h,e,g),c(m[0],m[1],m[2],h[0],h[1],h[2],n,a,o,s)}};return{add:c,addFixedCountDashes:l,addFixedLengthDashes:function(e,t,r,n,a,o,s){var u=i.Vec3.distance(e,t);l(e,t,u/r,n,a,o,s)},getCylinders:function(){var e=n.elementCount/6,t=p.a.compact(n,!0),i=p.a.compact(a,!0),c=p.a.compact(o,!0),l=p.a.compact(s,!0),d=p.a.compact(u,!0),m=r&&e<=r.cylinderCount?r.mappingBuffer.ref.value:new Float32Array(18*e),h=r&&e<=r.cylinderCount?r.indexBuffer.ref.value:new Uint32Array(12*e);return(!r||e>r.cylinderCount)&&function(e,t,r){for(var n=0;n<e;++n){var i=18*n;t[i]=-1,t[i+1]=1,t[i+2]=-1,t[i+3]=-1,t[i+4]=-1,t[i+5]=-1,t[i+6]=1,t[i+7]=1,t[i+8]=-1,t[i+9]=1,t[i+10]=1,t[i+11]=1,t[i+12]=1,t[i+13]=-1,t[i+14]=-1,t[i+15]=1,t[i+16]=-1,t[i+17]=1}for(n=0;n<e;++n){var a=6*n,o=12*n;r[o]=a,r[o+1]=a+1,r[o+2]=a+2,r[o+3]=a+1,r[o+4]=a+4,r[o+5]=a+2,r[o+6]=a+2,r[o+7]=a+4,r[o+8]=a+3,r[o+9]=a+4,r[o+10]=a+5,r[o+11]=a+3}}(e,m,h),f.a.create(m,h,t,i,c,l,d,e,r)}}};var y={linkScale:a.ParamDefinition.Numeric(.4,{min:0,max:1,step:.1}),linkSpacing:a.ParamDefinition.Numeric(1,{min:0,max:2,step:.01}),linkCap:a.ParamDefinition.Boolean(!1),dashCount:a.ParamDefinition.Numeric(4,{min:2,max:10,step:2}),dashScale:a.ParamDefinition.Numeric(.8,{min:0,max:2,step:.1}),dashCap:a.ParamDefinition.Boolean(!0),radialSegments:a.ParamDefinition.Numeric(16,{min:2,max:56,step:2},c.a.CustomQualityParamInfo)},_=(a.ParamDefinition.getDefaultValues(y),{linkScale:a.ParamDefinition.Numeric(.5,{min:0,max:1,step:.1}),linkSpacing:a.ParamDefinition.Numeric(.1,{min:0,max:2,step:.01}),dashCount:a.ParamDefinition.Numeric(4,{min:2,max:10,step:2})}),S=(a.ParamDefinition.getDefaultValues(_),Object(i.Vec3)()),x=Object(i.Vec3)(),O=Object(i.Vec3)(),w=i.Vec3.create(0,1,0);function C(e,t,r,n){i.Vec3.normalize(x,i.Vec3.sub(x,t,r)),null!==n?i.Vec3.sub(O,t,n):i.Vec3.copy(O,t),i.Vec3.normalize(O,O);var a=i.Vec3.dot(x,O);return 1-Math.abs(a)<1e-5&&(i.Vec3.set(O,1,0,0),a=i.Vec3.dot(x,O),1-Math.abs(a)<1e-5&&(i.Vec3.set(O,0,1,0),a=i.Vec3.dot(x,O))),i.Vec3.setMagnitude(x,x,a),i.Vec3.sub(O,O,x),i.Vec3.normalize(e,O)}var j=i.Vec3.scale,P=i.Vec3.add,E=i.Vec3.sub,A=i.Vec3.setMagnitude,D=i.Vec3.dot;function T(e,t,r,n){var a=t.linkCount,c=t.referencePosition,l=t.position,d=t.style,f=t.radius,p=t.ignore;if(!a)return o.a.createEmpty(n);for(var m=r.linkScale,h=r.linkSpacing,g=r.radialSegments,v=r.linkCap,b=r.dashCount,y=r.dashScale,_=r.dashCap,x=2*g*a*2,O=s.a.createState(x,x/4,n),T=Object(i.Vec3)(),I=Object(i.Vec3)(),M=Object(i.Vec3)(),k={radiusTop:1,radiusBottom:1,radialSegments:g,topCap:v,bottomCap:v},B=b+1,V=0,R=a;V<R;++V)if(!p||!p(V)){l(T,I,V),E(S,I,T);var L=f(V),N=d?d(V):0,F=D(S,w)>0?[!1,v]:[v,!1],U=F[0],z=F[1];if(O.currentGroup=V,0===N)k.radiusTop=k.radiusBottom=L,k.topCap=U,k.bottomCap=z,Object(u.a)(O,T,I,.5,k);else if(1===N)k.radiusTop=k.radiusBottom=L*y,k.topCap=k.bottomCap=_,Object(u.c)(O,T,I,.5,B,k);else if(2===N||3===N){var H=2===N?2:3,G=L*(m/(.5*H)),q=(L-G)*h;C(M,T,I,c?c(V):null),A(M,M,q),k.radiusTop=k.radiusBottom=G,k.topCap=U,k.bottomCap=z,3===H&&Object(u.a)(O,T,I,.5,k),Object(u.b)(O,T,I,.5,M,k)}else 4===N&&(j(S,S,.475),P(T,T,S),E(I,I,S),k.radiusTop=k.radiusBottom=L,k.topCap=U,k.bottomCap=z,Object(u.a)(O,T,I,.5,k))}return s.a.getMesh(O)}function I(e,t,r,a){var o=t.linkCount,s=t.referencePosition,u=t.position,c=t.style,l=t.radius,d=t.ignore;if(!o)return f.a.createEmpty(a);for(var p=r.linkScale,m=r.linkSpacing,h=r.linkCap,g=r.dashCount,v=r.dashScale,b=r.dashCap,y=2*o,_=n.create(y,y/4,a),x=Object(i.Vec3)(),O=Object(i.Vec3)(),w=Object(i.Vec3)(),D=g%2==1?g:g+1,T=.5-.25/D,I=0,M=o;I<M;++I)if(!d||!d(I)){u(x,O,I);var k=l(I),B=c?c(I):0;if(0===B)j(O,P(O,x,O),.5),_.add(x[0],x[1],x[2],O[0],O[1],O[2],1,h,!1,I);else if(1===B)j(S,E(S,O,x),T),E(O,O,S),_.addFixedCountDashes(x,O,D,v,b,b,I);else if(2===B||3===B){j(O,P(O,x,O),.5);var V=2===B?2:3,R=p/(.5*V),L=(k-R*k)*m;C(w,x,O,s?s(I):null),A(w,w,L),3===V&&_.add(x[0],x[1],x[2],O[0],O[1],O[2],R,h,!1,I),_.add(x[0]+w[0],x[1]+w[1],x[2]+w[2],O[0]+w[0],O[1]+w[1],O[2]+w[2],R,h,!1,I),_.add(x[0]-w[0],x[1]-w[1],x[2]-w[2],O[0]-w[0],O[1]-w[1],O[2]-w[2],R,h,!1,I)}else 4===B&&(j(S,E(S,O,x),.475),P(x,x,S),E(O,O,S),_.add(x[0],x[1],x[2],O[0],O[1],O[2],1,h,!1,I))}return _.getCylinders()}function M(e,t,r,n){var a=t.linkCount,o=t.referencePosition,s=t.position,u=t.style,c=t.ignore;if(!a)return l.a.createEmpty(n);for(var f=r.linkScale,p=r.linkSpacing,m=r.dashCount,h=2*a,g=d.a.create(h,h/4,n),v=Object(i.Vec3)(),b=Object(i.Vec3)(),y=Object(i.Vec3)(),_=m%2==1?m:m+1,x=.5-.25/_,O=0,w=a;O<w;++O)if(!c||!c(O)){s(v,b,O);var D=u?u(O):0;if(0===D)j(b,P(b,v,b),.5),g.add(v[0],v[1],v[2],b[0],b[1],b[2],O);else if(1===D)j(S,E(S,b,v),x),E(b,b,S),g.addFixedCountDashes(v,b,_,O);else if(2===D||3===D){j(b,P(b,v,b),.5);var T=2===D?2:3,I=(1-f/(.5*T)*1)*p;C(y,v,b,o?o(O):null),A(y,y,I),3===T&&g.add(v[0],v[1],v[2],b[0],b[1],b[2],O),g.add(v[0]+y[0],v[1]+y[1],v[2]+y[2],b[0]+y[0],b[1]+y[1],b[2]+y[2],O),g.add(v[0]-y[0],v[1]-y[1],v[2]-y[2],b[0]-y[0],b[1]-y[1],b[2]-y[2],O)}else 4===D&&(j(S,E(S,b,v),.475),P(v,v,S),E(b,b,S),g.add(v[0],v[1],v[2],b[0],b[1],b[2],O))}return g.getLines()}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return s})),r.d(t,"c",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"e",(function(){return l})),r.d(t,"f",(function(){return f}));var n={forceCompute:!1,noCompute:!1},i={H:0,h:0,D:0,d:0,T:0,t:0,He:2,HE:2,he:2,Li:3,LI:3,li:3,Be:4,BE:4,be:4,B:5,b:5,C:6,c:6,N:7,n:7,O:8,o:8,F:9,f:9,Ne:10,NE:10,ne:10,Na:11,NA:11,na:11,Mg:12,MG:12,mg:12,Al:13,AL:13,al:13,Si:14,SI:14,si:14,P:15,p:15,S:16,s:16,Cl:17,CL:17,cl:17,Ar:18,AR:18,ar:18,K:19,k:19,Ca:20,CA:20,ca:20,Sc:21,SC:21,sc:21,Ti:22,TI:22,ti:22,V:23,v:23,Cr:24,CR:24,cr:24,Mn:25,MN:25,mn:25,Fe:26,FE:26,fe:26,Co:27,CO:27,co:27,Ni:28,NI:28,ni:28,Cu:29,CU:29,cu:29,Zn:30,ZN:30,zn:30,Ga:31,GA:31,ga:31,Ge:32,GE:32,ge:32,As:33,AS:33,as:33,Se:34,SE:34,se:34,Br:35,BR:35,br:35,Kr:36,KR:36,kr:36,Rb:37,RB:37,rb:37,Sr:38,SR:38,sr:38,Y:39,y:39,Zr:40,ZR:40,zr:40,Nb:41,NB:41,nb:41,Mo:42,MO:42,mo:42,Tc:43,TC:43,tc:43,Ru:44,RU:44,ru:44,Rh:45,RH:45,rh:45,Pd:46,PD:46,pd:46,Ag:47,AG:47,ag:47,Cd:48,CD:48,cd:48,In:49,IN:49,in:49,Sn:50,SN:50,sn:50,Sb:51,SB:51,sb:51,Te:52,TE:52,te:52,I:53,i:53,Xe:54,XE:54,xe:54,Cs:55,CS:55,cs:55,Ba:56,BA:56,ba:56,La:57,LA:57,la:57,Ce:58,CE:58,ce:58,Pr:59,PR:59,pr:59,Nd:60,ND:60,nd:60,Pm:61,PM:61,pm:61,Sm:62,SM:62,sm:62,Eu:63,EU:63,eu:63,Gd:64,GD:64,gd:64,Tb:65,TB:65,tb:65,Dy:66,DY:66,dy:66,Ho:67,HO:67,ho:67,Er:68,ER:68,er:68,Tm:69,TM:69,tm:69,Yb:70,YB:70,yb:70,Lu:71,LU:71,lu:71,Hf:72,HF:72,hf:72,Ta:73,TA:73,ta:73,W:74,w:74,Re:75,RE:75,re:75,Os:76,OS:76,os:76,Ir:77,IR:77,ir:77,Pt:78,PT:78,pt:78,Au:79,AU:79,au:79,Hg:80,HG:80,hg:80,Tl:81,TL:81,tl:81,Pb:82,PB:82,pb:82,Bi:83,BI:83,bi:83,Po:84,PO:84,po:84,At:85,AT:85,at:85,Rn:86,RN:86,rn:86,Fr:87,FR:87,fr:87,Ra:88,RA:88,ra:88,Ac:89,AC:89,ac:89,Th:90,TH:90,th:90,Pa:91,PA:91,pa:91,U:92,u:92,Np:93,NP:93,np:93,Pu:94,PU:94,pu:94,Am:95,AM:95,am:95,Cm:96,CM:96,cm:96,Bk:97,BK:97,bk:97,Cf:98,CF:98,cf:98,Es:99,ES:99,es:99,Fm:100,FM:100,fm:100,Md:101,MD:101,md:101,No:102,NO:102,no:102,Lr:103,LR:103,lr:103,Rf:104,RF:104,rf:104,Db:105,DB:105,db:105,Sg:106,SG:106,sg:106,Bh:107,BH:107,bh:107,Hs:108,HS:108,hs:108,Mt:109,MT:109,mt:109},a={0:1.42,1:1.42,3:2.7,4:2.7,6:1.75,7:1.6,8:1.52,11:2.7,12:2.7,13:2.7,14:1.9,15:2,16:1.9,17:1.8,19:2.7,20:2.7,21:2.7,22:2.7,23:2.7,24:2.7,25:2.7,26:2.7,27:2.7,28:2.7,29:2.7,30:2.7,31:2.7,33:2.68,37:2.7,38:2.7,39:2.7,40:2.7,41:2.7,42:2.7,43:2.7,44:2.7,45:2.7,46:2.7,47:2.7,48:2.7,49:2.7,50:2.7,55:2.7,56:2.7,57:2.7,58:2.7,59:2.7,60:2.7,61:2.7,62:2.7,63:2.7,64:2.7,65:2.7,66:2.7,67:2.7,68:2.7,69:2.7,70:2.7,71:2.7,72:2.7,73:2.7,74:2.7,75:2.7,76:2.7,77:2.7,78:2.7,79:2.7,80:2.7,81:2.7,82:2.7,83:2.7,87:2.7,88:2.7,89:2.7,90:2.7,91:2.7,92:2.7,93:2.7,94:2.7,95:2.7,96:2.7,97:2.7,98:2.7,99:2.7,100:2.7,101:2.7,102:2.7,103:2.7,104:2.7,105:2.7,106:2.7,107:2.7,108:2.7,109:2.88},o={0:.8,20:1.31,27:1.2,35:1.15,44:1.1,54:1,60:1.84,72:1.88,84:1.75,85:1.56,86:1.76,98:1.6,99:1.68,100:1.63,112:1.6,113:1.59,114:1.36,129:1.45,135:1.47,144:1.6,152:1.45,170:1.4,180:1.55,202:2.4,222:2.24,224:1.91,225:1.98,243:2.02,269:2,293:1.9,420:2.37,480:2.3,512:2.3,544:2.3,612:2.1,629:1.54,665:1,813:2.6,854:2.27,894:1.93,896:2.1,937:2.05,938:2.06,981:1.62,1258:2.68,1309:2.33,1484:1,1763:2.14,1823:2.48,1882:2.1,1944:1.72,2380:2.34,3367:2.44,3733:2.11,3819:2.6,3821:2.36,4736:2.75,5724:2.73,5959:2.63,6519:2.84,6750:2.87,8991:2.81},s=function(){for(var e=new Set,t=0,r=["LI","NA","K","RB","CS","FR","BE","MG","CA","SR","BA","RA","AL","GA","IN","SN","TL","PB","BI","SC","TI","V","CR","MN","FE","CO","NI","CU","ZN","Y","ZR","NB","MO","TC","RU","RH","PD","AG","CD","LA","HF","TA","W","RE","OS","IR","PT","AU","HG","AC","RF","DB","SG","BH","HS","MT","CE","PR","ND","PM","SM","EU","GD","TB","DY","HO","ER","TM","YB","LU","TH","PA","U","NP","PU","AM","CM","BK","CF","ES","FM","MD","NO","LR"];t<r.length;t++){var n=r[t];e.add(i[n])}return e}();function u(e){var t=i[e];return void 0===t?-1:t}function c(e,t){if(e<0||t<0)return-1;var r,n,i=o[(r=e,n=t,r<n?(r+n)*(r+n+1)/2+n:(r+n)*(r+n+1)/2+r)];return void 0===i?-1:i}function l(e){if(e<0)return 2.001;var t=a[e];return void 0===t?2.001:t}var d=i.H;function f(e){return e===d}},function(e,t,r){"use strict";r.d(t,"b",(function(){return _})),r.d(t,"a",(function(){return x}));var n=r(0),i=r(149),a=r(2),o=r(165),s=r(244),u=r(87),c=r(5),l=r(29),d={hue:a.ParamDefinition.Interval([1,360],{min:0,max:360,step:1}),chroma:a.ParamDefinition.Interval([40,70],{min:0,max:100,step:1}),luminance:a.ParamDefinition.Interval([15,85],{min:0,max:100,step:1}),clusteringStepCount:a.ParamDefinition.Numeric(50,{min:10,max:200,step:1},{isHidden:!0}),minSampleCount:a.ParamDefinition.Numeric(800,{min:100,max:5e3,step:100},{isHidden:!0})};function f(e,t){return Math.sqrt(Math.pow(Math.abs(e[0]-t[0]),2)+Math.pow(Math.abs(e[1]-t[1]),2)+Math.pow(Math.abs(e[2]-t[2]),2))}var p=[0,0,0],m=[0,0,0];function h(e,t){return o.a.toHcl(p,e),o.a.fromColor(m,o.a.toColor(e)),p[0]>=t.hue[0]&&p[0]<=t.hue[1]&&p[1]>=t.chroma[0]&&p[1]<=t.chroma[1]&&p[2]>=t.luminance[0]&&p[2]<=t.luminance[1]&&m[0]>=e[0]-2&&m[0]<=e[0]+2&&m[1]>=e[1]-2&&m[1]<=e[1]+2&&m[2]>=e[2]-2&&m[2]<=e[2]+2}function g(e,t){void 0===t&&(t={});var r=Object(n.__assign)(Object(n.__assign)({},a.ParamDefinition.getDefaultValues(d)),t);if(e<=0)return[];var i=function(e,t){for(var r=new Map,n=1.001*Math.cbrt(e),i=(t.hue[1]-t.hue[0])/n,a=(t.chroma[1]-t.chroma[0])/n,u=(t.luminance[1]-t.luminance[0])/n,c=t.hue[0];c<=t.hue[1];c+=i)for(var l=t.chroma[0];l<=t.chroma[1];l+=a)for(var d=t.luminance[0];d<=t.luminance[1];d+=u){var f=o.a.fromHcl(Object(o.a)(),s.a.create(c,l,d));h(f,t)&&r.set(f.toString(),f)}return Array.from(r.values())}(Math.max(r.minSampleCount,5*e),r);if(i.length<e)throw new Error("Not enough samples to generate distinct colors, increase sample count.");for(var p=[],m=[],g=Math.floor(i.length/e),v=0;v<i.length&&(p.push(i[v]),m.push([]),!(p.length>=e));v+=g);for(var b=1;b<=r.clusteringStepCount;++b){var y=Object(u.b)(m);for(v=0;v<i.length;++v){for(var _=Number.MAX_SAFE_INTEGER,S=0,x=0;x<p.length;x++){var O=f(i[v],p[x]);O<_&&(_=O,S=x)}y[S].push(i[v])}var w=Object(u.b)(p);for(v=0;v<y.length;++v){for(var C=y[v],j=C.length,P=[],E=[],A=[],D=0,T=C;D<T.length;D++){var I=T[D];P.push(I[0]),E.push(I[1]),A.push(I[2])}var M=Object(l.arraySum)(P)/j,k=Object(l.arraySum)(E)/j,B=Object(l.arraySum)(A)/j;p[v]=[M,k,B]}if(Object(c.g)(w,p))break}return function(e){for(var t=e.slice(0),r=[t.shift()];t.length>0;){for(var n=r[r.length-1],i=0,a=Number.MIN_SAFE_INTEGER,o=0;o<t.length;++o){var s=f(n,t[o]);s>a&&(a=s,i=o)}r.push(t.splice(i,1)[0])}return r}(p).map((function(e){return o.a.toColor(e)}))}var v=r(100),b=r(347),y={type:"generate",colorList:"red-yellow-blue"};function _(e){void 0===e&&(e={});var t=Object(n.__assign)(Object(n.__assign)({},y),e);return{palette:a.ParamDefinition.MappedStatic(t.type,{colors:a.ParamDefinition.Group({list:a.ParamDefinition.ColorList(t.colorList)},{isFlat:!0}),generate:a.ParamDefinition.Group(Object(n.__assign)(Object(n.__assign)({},d),{maxCount:a.ParamDefinition.Numeric(75,{min:1,max:250,step:1})}),{isFlat:!0})},{options:[["colors","Color List"],["generate","Generate Distinct"]]})}}a.ParamDefinition.getDefaultValues(_());var S={valueLabel:function(e){return""+(e+1)},minLabel:"Start",maxLabel:"End"};function x(e,t,r){var a,o,s;if(void 0===r&&(r={}),"colors"===t.palette.name&&"interpolate"===t.palette.params.list.kind){var u=t.palette.params.list,c=[0,e-1],l=Object(n.__assign)(Object(n.__assign)({},S),r),d=l.minLabel,f=l.maxLabel,p=u.colors;0===p.length&&(p=Object(v.getColorListFromName)(y.colorList).list);var m=b.a.create({listOrName:p,domain:c,minLabel:d,maxLabel:f});s=m.legend,o=m.color}else{var h;"colors"===t.palette.name?0===(h=t.palette.params.list.colors.map((function(e){return Array.isArray(e)?e[0]:e}))).length&&(h=Object(v.getColorListFromName)("dark-2").list.map((function(e){return Array.isArray(e)?e[0]:e}))):(e=Math.min(e,t.palette.params.maxCount),h=g(e,t.palette.params));for(var _=null!==(a=r.valueLabel)&&void 0!==a?a:S.valueLabel,x=h.length,O=[],w=0;w<e;++w){var C=w%x;void 0===O[C]?O[C]=[_(w),h[C]]:O[C][0]+=", "+_(w)}s=Object(i.b)(O),o=function(e){return h[e%x]}}return{color:o,legend:s}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(5),i=r(52),a=r(24),o=r(1),s=r(117),u=r(125);function c(e,t,r,c){switch(u.a.getGranularity(e,r.granularity)){case"uniform":return function(e,t,r){return function(e,t){return t?(n.e.update(t.uColor,a.Color.toVec3Normalized(t.uColor.ref.value,e)),n.e.updateIfChanged(t.dColorType,"uniform"),t):{uColor:n.e.create(a.Color.toVec3Normalized(Object(o.Vec3)(),e)),tColor:n.e.create({array:new Uint8Array(3),width:1,height:1}),uColorTexDim:n.e.create(o.Vec2.create(1,1)),dColorType:n.e.create("uniform")}}(t(s.b,!1),r)}(0,r.color,c);case"instance":return function(e,t,r){var n=e.instanceCount,o=Object(i.c)(Math.max(1,n),3,Uint8Array,r&&r.tColor.ref.value.array);e.reset();for(;e.hasNext;){var s=e.move(),u=s.location,c=s.isSecondary,d=s.instanceIndex;a.Color.toArray(t(u,c),o.array,3*d),e.skipInstance()}return l(o,"instance",r)}(e,r.color,c);case"group":return function(e,t,r){var n=e.groupCount,o=Object(i.c)(Math.max(1,n),3,Uint8Array,r&&r.tColor.ref.value.array);e.reset();for(;e.hasNext&&!e.isNextNewInstance;){var s=e.move(),u=s.location,c=s.isSecondary,d=s.groupIndex;a.Color.toArray(t(u,c),o.array,3*d)}return l(o,"group",r)}(e,r.color,c);case"groupInstance":return function(e,t,r){var n=e.groupCount,o=e.instanceCount*n,s=Object(i.c)(Math.max(1,o),3,Uint8Array,r&&r.tColor.ref.value.array);e.reset();for(;e.hasNext;){var u=e.move(),c=u.location,d=u.isSecondary,f=u.index;a.Color.toArray(t(c,d),s.array,3*f)}return l(s,"groupInstance",r)}(e,r.color,c);case"vertex":return function(e,t,r){var n=e.groupCount,o=e.stride,s=Object(i.c)(Math.max(1,n),3,Uint8Array,r&&r.tColor.ref.value.array);e.reset(),e.voidInstances();for(;e.hasNext&&!e.isNextNewInstance;)for(var u=e.move(),c=u.location,d=u.isSecondary,f=u.groupIndex,p=t(c,d),m=0;m<o;++m)a.Color.toArray(p,s.array,3*(f+m));return l(s,"vertex",r)}(t,r.color,c);case"vertexInstance":return function(e,t,r){var n=e.groupCount,o=e.instanceCount,s=e.stride,u=o*n,c=Object(i.c)(Math.max(1,u),3,Uint8Array,r&&r.tColor.ref.value.array);e.reset();for(;e.hasNext;)for(var d=e.move(),f=d.location,p=d.isSecondary,m=d.index,h=t(f,p),g=0;g<s;++g)a.Color.toArray(h,c.array,3*(m+g));return l(c,"vertexInstance",r)}(t,r.color,c)}}function l(e,t,r){return r?(n.e.update(r.tColor,e),n.e.update(r.uColorTexDim,o.Vec2.create(e.width,e.height)),n.e.updateIfChanged(r.dColorType,t),r):{uColor:n.e.create(Object(o.Vec3)()),tColor:n.e.create(e),uColorTexDim:n.e.create(o.Vec2.create(e.width,e.height)),dColorType:n.e.create(t)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u}));var n=r(0),i=r(87),a=r(186),o=r(29),s=function(){function e(){this.subs=void 0}return e.prototype.subscribe=function(e,t){var r=this;void 0===this.subs&&(this.subs=[]);var n=e.subscribe(t);return this.subs.push(n),{unsubscribe:function(){n&&r.subs&&Object(o.arraySetRemove)(r.subs,n)&&(n.unsubscribe(),n=void 0)}}},Object.defineProperty(e.prototype,"ev",{get:function(){return this._ev||(this._ev=a.RxEventHelper.create())},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){if(this._ev&&this._ev.dispose(),this.subs){for(var e=0,t=this.subs;e<t.length;e++){t[e].unsubscribe()}this.subs=void 0}},e}(),u=function(e){function t(t){var r=e.call(this)||this;return r._state=t,r}return Object(n.__extends)(t,e),t.prototype.updateState=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=this.state,n=Object(i.e)(r,e);return n!==r&&(this._state=n,!0)},Object.defineProperty(t.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),t}(s)},function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return i}));var n={kind:"null-location"};function i(e,t,r){return{kind:"data-location",tag:e,data:t,element:r}}},function(e,t,r){"use strict";var n,i=r(0),a=r(6),o=r(57),s=r(134),u=r(192),c=r(12),l=r(139),d=r(37),f=r(9),p=r(1);!function(e){e.add=function(e,t,r,n){e.indices[e.count]=r,e.units[e.count]=t,e.squaredDistances[e.count]=n,e.count++},e.create=function(){return{count:0,indices:[],units:[],squaredDistances:[]}},e.copy=function(e,t){for(var r=0;r<t.count;++r)e.indices[r]=t.indices[r],e.units[r]=t.units[r],e.squaredDistances[r]=t.squaredDistances[r];return e.count=t.count,e}}(n||(n={}));var m=function(){function e(e){this.structure=e,this.pivot=Object(p.Vec3)(),this.result=n.create();for(var t=e.units,r=e.boundary,i=t.length,o=new Float32Array(i),s=new Float32Array(i),u=new Float32Array(i),c=new Float32Array(i),l=Object(p.Vec3)(),d=0;d<i;d++){var m=t[d],h=m.boundary.sphere;p.Vec3.transformMat4(l,h.center,m.conformation.operator.matrix),o[d]=l[0],s[d]=l[1],u[d]=l[2],c[d]=h.radius}var g={x:o,y:s,z:u,radius:c,indices:a.OrderedSet.ofBounds(0,i)};this.unitLookup=Object(f.c)(g,r)}return e.prototype.findUnitIndices=function(e,t,r,n){return this.unitLookup.find(e,t,r,n)},e.prototype.find=function(e,t,r,i){f.d.reset(this.result);var a=this.structure.units,o=this.unitLookup.find(e,t,r,i);if(0===o.count)return this.result;for(var s=0,u=o.count;s<u;s++){var c=a[o.indices[s]];p.Vec3.set(this.pivot,e,t,r),c.conformation.operator.isIdentity||p.Vec3.transformMat4(this.pivot,this.pivot,c.conformation.operator.inverse);for(var l=c.lookup3d.find(this.pivot[0],this.pivot[1],this.pivot[2],i),d=0,m=l.count;d<m;d++)n.add(this.result,c,l.indices[d],l.squaredDistances[d])}return this.result},e.prototype.findIntoBuilder=function(e,t,r,n,i){var a=this.structure.units,o=this.unitLookup.find(e,t,r,n);if(0!==o.count)for(var s=0,u=o.count;s<u;s++){var c=a[o.indices[s]];p.Vec3.set(this.pivot,e,t,r),c.conformation.operator.isIdentity||p.Vec3.transformMat4(this.pivot,this.pivot,c.conformation.operator.inverse);var l=c.lookup3d.find(this.pivot[0],this.pivot[1],this.pivot[2],n);if(0!==l.count){var d=c.elements;i.beginUnit(c.id);for(var f=0,m=l.count;f<m;f++)i.addElement(d[l.indices[f]]);i.commitUnit()}}},e.prototype.findIntoBuilderWithRadius=function(e,t,r,n,i,a,o,s){var u=this.structure.units,c=this.unitLookup.find(e,t,r,a);if(0!==c.count)for(var d=l.a.Location.create(this.structure),f=n+i+a,m=0,h=c.count;m<h;m++){var g=u[c.indices[m]];p.Vec3.set(this.pivot,e,t,r),g.conformation.operator.isIdentity||p.Vec3.transformMat4(this.pivot,this.pivot,g.conformation.operator.inverse);var v=g.lookup3d.find(this.pivot[0],this.pivot[1],this.pivot[2],f);if(0!==v.count){var b=g.elements;d.unit=g,s.beginUnit(g.id);for(var y=0,_=v.count;y<_;y++){d.element=b[v.indices[y]];var S=o(d);Math.sqrt(v.squaredDistances[y])-n-S>a||s.addElement(b[v.indices[y]])}s.commitUnit()}}},e.prototype.check=function(e,t,r,n){var i=this.structure.units,a=this.unitLookup.find(e,t,r,n);if(0===a.count)return!1;for(var o=0,s=a.count;o<s;o++){var u=i[a.indices[o]];if(p.Vec3.set(this.pivot,e,t,r),u.conformation.operator.isIdentity||p.Vec3.transformMat4(this.pivot,this.pivot,u.conformation.operator.inverse),u.lookup3d.check(this.pivot[0],this.pivot[1],this.pivot[2],n))return!0}return!1},Object.defineProperty(e.prototype,"boundary",{get:function(){return this.structure.boundary},enumerable:!1,configurable:!0}),e}(),h=r(251),g=function(){function e(e,t){this.parent=e,this.isSorted=t,this.ids=[],this.unitMap=a.IntMap.Mutable(),this.parentId=-1,this.currentUnit=[],this.elementCount=0}return e.prototype.addToUnit=function(e,t){var r=this.unitMap.get(e);r?r[r.length]=t:(this.unitMap.set(e,[t]),this.ids[this.ids.length]=e),this.elementCount++},e.prototype.beginUnit=function(e){this.parentId=e,this.currentUnit=this.currentUnit.length>0?[]:this.currentUnit},e.prototype.addElement=function(e){this.currentUnit[this.currentUnit.length]=e,this.elementCount++},e.prototype.addElementRange=function(e,t,r){for(var n=t;n<r;n++)this.currentUnit[this.currentUnit.length]=e[n],this.elementCount++},e.prototype.commitUnit=function(){0!==this.currentUnit.length&&(this.ids[this.ids.length]=this.parentId,this.unitMap.set(this.parentId,this.currentUnit),this.parentId=-1)},e.prototype.setUnit=function(e,t){this.ids[this.ids.length]=e,this.unitMap.set(e,t),this.elementCount+=t.length},e.prototype._getStructure=function(e){if(this.isEmpty)return $.Empty;var t=[];Object(c.q)(this.ids);for(var r=h.a.UnitEquivalenceBuilder(),n=0,i=this.ids.length;n<i;n++){var o=this.ids[n],s=this.parent.unitMap.get(o),u=this.unitMap.get(o),l=!1;e&&(this.isSorted||Object(c.q)(u),u=a.SortedArray.deduplicate(a.SortedArray.ofSortedArray(this.currentUnit)),l=!0);var d=u.length;if(u.length!==s.elements.length){!this.isSorted&&!l&&d>1&&Object(c.q)(u);var f=s.getChild(a.SortedArray.ofSortedArray(u)),p=r.add(f.id,f);f!==p&&(f=p.applyOperator(f.id,f.conformation.operator,!0)),t[t.length]=f}else t[t.length]=s,r.add(s.id,s)}return $.create(t,{parent:this.parent})},e.prototype.getStructure=function(){return this._getStructure(!1)},e.prototype.getStructureDeduplicate=function(){return this._getStructure(!0)},e.prototype.setSingletonLocation=function(e){var t=this.ids[0];e.unit=this.parent.unitMap.get(t),e.element=this.unitMap.get(t)[0]},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.elementCount},enumerable:!1,configurable:!0}),e}(),v=r(163),b=r(176);function y(e,t){for(var r=1;t--;)r*=e--;return r}var _=function(){function e(e,t){var r,n;this.array=e,this.hasNext=!1,this.index=(1<<t)-1,this.size=(r=e.length,(n=t)>r?0:y(r,n)/y(n,n)),this.maxIndex=1<<e.length,this.value=new Array(t),this.hasNext=t>0&&t<=e.length}return e.prototype.move=function(){if(this.hasNext){for(var e=0,t=0,r=this.index;r;r>>>=1,e++)1&r&&(this.value[t++]=this.array[e]);this.index=function(e){var t=e&-e,r=e+t;return r|((r&-r)/t>>1)-1}(this.index),this.hasNext=this.index<this.maxIndex}return this.value},e}();function S(e,t){for(var r=[],n=new _(e,t);n.hasNext;)r.push(n.move().slice());return r}var x=r(145),O=r(238),w=r(29),C=r(22),j=r(150),P=[],E={links:P,terminalLinks:P,elements:P,partialElements:P,getElementIndices:function(){return P},getLinkIndices:function(){return P},getTerminalLinkIndices:function(){return P}},A=r(209),D=Object(C.ElementSymbol)("C"),T=Object(C.ElementSymbol)("O"),I=[A.a.elementFingerprint([D,D,D,T]),A.a.elementFingerprint([D,D,D,D,T]),A.a.elementFingerprint([D,D,D,D,D,T]),A.a.elementFingerprint([D,D,D,D,D,D,T])];function M(e,t){for(var r=-1,n=-1,i=-1,a=-1,o=e.elements,s=e.model.atomicHierarchy.atoms,u=s.type_symbol,c=s.label_atom_id,l=e.bonds,d=l.b,f=l.offset,p=0,m=t.length;p<m;++p){var h=o[t[p]];if(u.value(h)===D){for(var g=0,v=0,b=f[t[p]],y=f[t[p]+1];b<y;++b){var _=o[d[b]],S=u.value(_);S===T?++g:S===D&&++v}if(2===g){r=h;break}1===g&&1===v?n=h:c.value(h).startsWith("C1")?i=h:a=h}}return-1!==r?r:-1!==n?n:-1!==i?i:-1!==a?a:o[t[0]]}function k(e,t,r,n){var i=t.conformation.position;return p.Vec3.normalize(e,p.Vec3.sub(e,n,i(r,e))),e}function B(e,t){var r=e.elements;return e.model.atomicHierarchy.atoms.label_atom_id.value(r[t])}function V(e,t){if(t&&t.length){for(var r=e.unit,n=e.all,i=new Set,o=S(Object(w.fillSerial)(new Array(t.length)),2),s=0,u=o.length;s<u;++s){var c=o[s],l=n[t[c[0]]],d=n[t[c[1]]];a.SortedArray.areIntersecting(l,d)&&A.a.getAltId(r,l)===A.a.getAltId(r,d)&&(i.add(t[c[0]]),i.add(t[c[1]]))}if(i.size){var f=[];for(s=0,u=t.length;s<u;++s)i.has(t[s])||f.push(t[s]);return f}return t}}function R(e,t){return t.properties.saccharideComponentMap.get(e)}function L(e){if(0===e.models.reduce((function(e,t){return e+t.properties.saccharideComponentMap.size}),0))return E;var t=[],r=[],n=[],o=[],s=new Map;function u(e,t,r){return e+"|"+t+"|"+r}function l(e,t){s.has(e)?s.get(e).push(t):s.set(e,[t])}function f(e,t){p.Vec3.sub(n[e].geometry.direction,n[t].geometry.center,n[e].geometry.center),p.Vec3.normalize(n[e].geometry.direction,n[e].geometry.direction)}var m=p.Vec3.zero();function h(e,t,r){var i=r.conformation.position,a=n[e].geometry;p.Vec3.sub(a.direction,i(r.elements[t],m),a.center),p.Vec3.normalize(a.direction,a.direction)}for(var g=0,v=e.units.length;g<v;++g){var b=e.units[g];if(d.a.isAtomic(b))for(var y=b.model,_=b.rings,P=y.atomicHierarchy,D=P.chainAtomSegments,T=P.residueAtomSegments,L=P.atoms.label_comp_id,N=a.Segmentation.transientSegments(D,b.elements),F=a.Segmentation.transientSegments(T,b.elements),U=void 0;N.hasNext;)for(F.setSegment(N.move());F.hasNext;){var z=F.move().index,H=R(L.value(T.offsets[z]),y);if(H){U||(U=A.b.byFingerprintAndResidue(_,I));var G=V(_,U.get(z));if(G&&G.length){for(var q=[],W=0,X=G.length;W<X;++W){var Y=_.all[G[W]],Q=M(b,Y),K=O.a.calculateMomentsAxes(Object(j.c)(b,Y)),Z=p.Vec3.copy(p.Vec3.zero(),K.origin),J=p.Vec3.copy(p.Vec3.zero(),K.dirC),$=k(p.Vec3.zero(),b,Q,Z);p.Vec3.orthogonalize($,J,$);var ee=A.a.getAltId(b,Y),te=n.length;q.push(te),l(u(z,b.id,ee),te),ee&&l(u(z,b.id,""),te),n.push({geometry:{center:Z,normal:J,direction:$},component:H,ringIndex:G[W],altId:ee,unit:b,residueIndex:z})}var re=S(Object(w.fillSerial)(new Array(G.length)),2);for(W=0,X=re.length;W<X;++W){var ne=re[W],ie=_.all[G[ne[0]]],ae=_.all[G[ne[1]]];if(x.a.areVertexSetsConnected(b.bonds,ie,ae,3)){var oe=q[ne[0]],se=q[ne[1]];n[oe].altId===n[se].altId&&(f(oe,se),f(se,oe),t.push({carbohydrateIndexA:oe,carbohydrateIndexB:se}),t.push({carbohydrateIndexA:se,carbohydrateIndexB:oe}))}}}else o.push({unit:b,residueIndex:z,component:H})}}}function ue(e,t){return s.get(u(e.getResidueIndex(t),e.id,function(e,t){var r=e.elements;return e.model.atomicHierarchy.atoms.label_alt_id.value(r[t])}(e,t)))||[]}for(g=0,v=n.length;g<v;++g){var ce=n[g];for(b=ce.unit,W=g+1;W<v;++W){var le=n[W];if(b===le.unit&&ce.residueIndex!==le.residueIndex){var de=b.rings.all[ce.ringIndex],fe=b.rings.all[le.ringIndex];x.a.areVertexSetsConnected(b.bonds,de,fe,3)&&(f(g,W),f(W,g),t.push({carbohydrateIndexA:g,carbohydrateIndexB:W}),t.push({carbohydrateIndexA:W,carbohydrateIndexB:g}))}}}for(g=0,v=e.units.length;g<v;++g){b=e.units[g];d.a.isAtomic(b)&&e.interUnitBonds.getConnectedUnits(b.id).forEach((function(n){n.connectedIndices.forEach((function(i){n.getEdges(i).forEach((function(a){var o=a.props,s=a.indexB;if(C.BondType.isCovalent(o.flag)){var u=e.unitMap.get(n.unitA),c=e.unitMap.get(n.unitB),l=ue(u,i),d=ue(c,s);if(l.length>0&&d.length>0)for(var p=l.length,m=d.length,g=0,v=Math.max(p,m);g<v;++g){var b=l[Math.min(g,p-1)],y=d[Math.min(g,m-1)];((x=B(u,i)).startsWith("O1")||x.startsWith("C1"))&&f(b,y),t.push({carbohydrateIndexA:b,carbohydrateIndexB:y})}else if(0===d.length)for(var _=0,S=l;_<S.length;_++){var x;b=S[_];((x=B(u,i)).startsWith("O1")||x.startsWith("C1"))&&h(b,s,c),r.push({carbohydrateIndex:b,elementIndex:s,elementUnit:c,fromCarbohydrate:!0})}else if(0===l.length)for(var O=0,w=d;O<w.length;O++){y=w[O];r.push({carbohydrateIndex:y,elementIndex:i,elementUnit:u,fromCarbohydrate:!1})}}}))}))}))}return Object(i.__assign)({links:t,terminalLinks:r,elements:n,partialElements:o},function(e,t,r){function n(e,t){return Object(c.f)(e.id,t)}function i(e,t,r){var i=[],a=e.get(n(t,r));if(void 0!==a)for(var o=0,s=a;o<s.length;o++){var u=s[o];Object(w.arraySetAdd)(i,u)}return i}for(var a=new Map,o=0,s=e.length;o<s;++o)for(var u=e[o],l=u.unit,d=u.ringIndex,f=l.rings.all[d],p=0,m=f.length;p<m;++p){var h=n(l,l.elements[f[p]]);void 0===(P=a.get(h))?a.set(h,[o]):P.push(o)}var g=new Map;for(o=0,s=t.length;o<s;++o){var v=t[o],b=e[v.carbohydrateIndexA];for(l=b.unit,d=b.ringIndex,f=l.rings.all[d],p=0,m=f.length;p<m;++p){h=n(l,l.elements[f[p]]);void 0===(P=g.get(h))?g.set(h,[o]):P.push(o)}}var y=new Map;for(o=0,s=r.length;o<s;++o){var _=r[o],S=_.fromCarbohydrate,x=_.carbohydrateIndex,O=_.elementUnit,C=_.elementIndex;if(S){var j=e[x];for(l=j.unit,d=j.ringIndex,f=l.rings.all[d],p=0,m=f.length;p<m;++p){h=n(l,l.elements[f[p]]);void 0===(P=y.get(h))?y.set(h,[o]):P.push(o)}}else{var P;h=n(O,O.elements[C]);void 0===(P=y.get(h))?y.set(h,[o]):P.push(o)}}return{getElementIndices:function(e,t){return i(a,e,t)},getLinkIndices:function(e,t){return i(g,e,t)},getTerminalLinkIndices:function(e,t){return i(y,e,t)}}}(n,t,r))}var N=r(99),F=r(66),U=r(120),z=r(39),H=(r(203),r(212)),G=r(17),q=r(128),W=Object(f.g)(),X=new q.a("14"),Y=new q.a("98");function Q(e){var t=e.units,r=t.length>500?X:Y;r.reset();for(var n=0,i=t.length;n<i;n++){var a=(o=t[n]).boundary;(s=o.conformation.operator).isIdentity?r.includeSphere(a.sphere):(f.g.transform(W,a.sphere,s.matrix),r.includeSphere(W))}r.finishedIncludeStep();for(n=0,i=t.length;n<i;n++){var o,s;a=(o=t[n]).boundary;(s=o.conformation.operator).isIdentity?r.radiusSphere(a.sphere):(f.g.transform(W,a.sphere,s.matrix),r.radiusSphere(W))}return{box:r.getBox(),sphere:r.getSphere()}}var K=function(){function e(e,t){void 0===t&&(t={}),this._props={hashCode:-1,transformHash:-1,elementCount:-1,bondCount:-1,uniqueElementCount:-1,atomicResidueCount:-1,polymerResidueCount:-1,polymerUnitCount:-1,coordinateSystem:s.a.Default,label:""};var r=this.initUnits(e),n=r.unitMap,i=r.unitIndexMap;this.unitMap=n,this.unitIndexMap=i,this.units=e,t.parent&&(this._props.parent=t.parent.parent||t.parent),t.interUnitBonds&&(this._props.interUnitBonds=t.interUnitBonds),t.coordinateSystem?this._props.coordinateSystem=t.coordinateSystem:t.parent&&(this._props.coordinateSystem=t.parent.coordinateSystem),t.label?this._props.label=t.label:t.parent&&(this._props.label=t.parent.label),t.masterModel?this._props.masterModel=t.masterModel:t.parent&&(this._props.masterModel=t.parent.masterModel),t.representativeModel?this._props.representativeModel=t.representativeModel:t.parent&&(this._props.representativeModel=t.parent.representativeModel)}return e.prototype.subsetBuilder=function(e){return new g(this,e)},Object.defineProperty(e.prototype,"elementCount",{get:function(){return this._props.elementCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bondCount",{get:function(){return-1===this._props.bondCount&&(this._props.bondCount=this.interUnitBonds.edgeCount+v.a.getIntraUnitBondCount(this)),this._props.bondCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasCustomProperties",{get:function(){return!!this._props.customProps&&this._props.customProps.all.length>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"customPropertyDescriptors",{get:function(){return this._props.customProps||(this._props.customProps=new F.CustomProperties),this._props.customProps},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentPropertyData",{get:function(){return this._props.propertyData||(this._props.propertyData=Object.create(null)),this._props.propertyData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"inheritedPropertyData",{get:function(){return this.parent?this.parent.currentPropertyData:this.currentPropertyData},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polymerResidueCount",{get:function(){return-1===this._props.polymerResidueCount&&(this._props.polymerResidueCount=function(e){for(var t=e.units,r=0,n=0,i=t.length;n<i;n++)r+=t[n].polymerElements.length;return r}(this)),this._props.polymerResidueCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"polymerUnitCount",{get:function(){return-1===this._props.polymerUnitCount&&(this._props.polymerUnitCount=function(e){for(var t=e.units,r=0,n=0,i=t.length;n<i;n++)t[n].polymerElements.length>0&&(r+=1);return r}(this)),this._props.polymerUnitCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueElementCount",{get:function(){return-1===this._props.uniqueElementCount&&(this._props.uniqueElementCount=function(e){for(var t=e.unitSymmetryGroups,r=0,n=0,i=t.length;n<i;n++)r+=t[n].elements.length;return r}(this)),this._props.uniqueElementCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"atomicResidueCount",{get:function(){return-1===this._props.atomicResidueCount&&(this._props.atomicResidueCount=function(e){for(var t=e.units,r=0,n=0,i=t.length;n<i;n++){var a=t[n];if(d.a.isAtomic(a))for(var o=a.elements,s=a.residueIndex,u=-1,c=-1,l=0,f=o.length;l<f;++l)(u=s[o[l]])!==c&&(r+=1,c=u)}return r}(this)),this._props.atomicResidueCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCoarseGrained",{get:function(){var e=this.elementCount,t=this.polymerResidueCount;return!(!t||!e)&&e/t<2},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.units.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hashCode",{get:function(){return-1!==this._props.hashCode?this._props.hashCode:this.computeHash()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"transformHash",{get:function(){return-1!==this._props.transformHash||(this._props.transformHash=Object(c.l)(this.units.map((function(e){return e.id})))),this._props.transformHash},enumerable:!1,configurable:!0}),e.prototype.computeHash=function(){for(var e=23,t=0,r=this.units.length;t<r;t++){var n=this.units[t];e=31*(e=31*e+n.id|0)+a.SortedArray.hashCode(n.elements)|0}return e=31*e+this.elementCount|0,-1===(e=Object(c.h)(e))&&(e=0),this._props.hashCode=e,e},e.prototype.elementLocations=function(){return new e.ElementLocationIterator(this)},Object.defineProperty(e.prototype,"root",{get:function(){return this._props.parent||this},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this._props.parent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"coordinateSystem",{get:function(){return this._props.coordinateSystem},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"label",{get:function(){return this._props.label},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundary",{get:function(){return this._props.boundary||(this._props.boundary=Q(this)),this._props.boundary},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lookup3d",{get:function(){return this._props.lookup3d||(this._props.lookup3d=new m(this)),this._props.lookup3d},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"interUnitBonds",{get:function(){return this._props.interUnitBonds||(this._props.interUnitBonds=Object(v.b)(this)),this._props.interUnitBonds},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unitSymmetryGroups",{get:function(){return this._props.unitSymmetryGroups||(this._props.unitSymmetryGroups=h.a.computeTransformGroups(this)),this._props.unitSymmetryGroups},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unitSymmetryGroupsIndexMap",{get:function(){return this._props.unitSymmetryGroupsIndexMap||(this._props.unitSymmetryGroupsIndexMap=d.a.SymmetryGroup.getUnitSymmetryGroupsIndexMap(this.unitSymmetryGroups)),this._props.unitSymmetryGroupsIndexMap},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"unitsSortedByVolume",{get:function(){return this._props.unitsSortedByVolume||(this._props.unitsSortedByVolume=function(e){var t=e.unitSymmetryGroups,r=t.map((function(e,t){return[t,f.b.volume(e.units[0].lookup3d.boundary.box)]}));Object(c.p)(r,0,r.length,J,c.e);for(var n=[],i=0,a=r;i<a.length;i++)for(var o=a[i][0],s=0,u=t[o].units;s<u.length;s++){var l=u[s];n.push(l)}return n}(this)),this._props.unitsSortedByVolume},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"carbohydrates",{get:function(){return this._props.carbohydrates||(this._props.carbohydrates=L(this)),this._props.carbohydrates},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"models",{get:function(){return this._props.models||(this._props.models=function(e){for(var t=e.units,r=o.c.create(),n=0,i=t;n<i.length;n++){var a=i[n];o.c.add(r,a.model.id,a.model)}return r.array}(this)),this._props.models},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueResidueNames",{get:function(){return this._props.uniqueResidueNames||(this._props.uniqueResidueNames=function(e){for(var t=b.a.residue.microheterogeneityCompIds,r=new Set,n=l.a.Location.create(e),i=0,o=e.unitSymmetryGroups;i<o.length;i++){var s=o[i].units[0];if(d.a.isAtomic(s)){var u=a.Segmentation.transientSegments(s.model.atomicHierarchy.residueAtomSegments,s.elements);for(n.unit=s;u.hasNext;){var c=u.move();n.element=s.elements[c.start];for(var f=t(n),p=0,m=f;p<m.length;p++){var h=m[p];r.add(h)}}}}return r}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueElementSymbols",{get:function(){return this._props.uniqueElementSymbols||(this._props.uniqueElementSymbols=function(e){for(var t=b.a.atom.type_symbol,r=new Set,n=l.a.Location.create(e),i=0,a=e.unitSymmetryGroups;i<a.length;i++){var o=a[i].units[0];if(d.a.isAtomic(o)){n.unit=o;for(var s=0,u=o.elements.length;s<u;++s)n.element=o.elements[s],r.add(t(n))}}return r}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"entityIndices",{get:function(){return this._props.entityIndices||(this._props.entityIndices=function(e){for(var t=e.units,r=l.a.Location.create(e),n=o.c.create(),i=0,s=t;i<s.length;i++){var u=s[i],d=0===u.kind?b.a.entity.key:b.a.coarse.entityKey;r.unit=u;for(var f=u.elements,p=a.Segmentation.transientSegments(u.model.atomicHierarchy.chainAtomSegments,f);p.hasNext;){var m=p.move();r.element=f[m.start];var h=d(r);o.c.add(n,h,h)}}return Object(c.q)(n.array),n.array}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uniqueAtomicResidueIndices",{get:function(){return this._props.uniqueAtomicResidueIndices||(this._props.uniqueAtomicResidueIndices=function(e){for(var t=new Map,r=[],n=e.unitSymmetryGroups,i=0,s=n;i<s.length;i++){var u=s[i].units[0];if(d.a.isAtomic(u)){var l=void 0;t.has(u.model.id)?l=t.get(u.model.id):(l=o.c.create(),r.push(u.model.id),t.set(u.model.id,l));for(var f=a.Segmentation.transientSegments(u.model.atomicHierarchy.residueAtomSegments,u.elements);f.hasNext;){var p=f.move();o.c.add(l,p.index,p.index)}}}for(var m=new Map,h=0,g=r;h<g.length;h++){var v=g[h],b=t.get(v).array;Object(c.q)(b),m.set(v,b)}return m}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isAtomic",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(d.a.isAtomic(r))return!1}return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasAtomic",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(d.a.isAtomic(r))return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCoarse",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(d.a.isCoarse(r))return!1}return!0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasCoarse",{get:function(){for(var e=0,t=this.units;e<t.length;e++){var r=t[e];if(d.a.isCoarse(r))return!0}return!1},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"serialMapping",{get:function(){return this._props.serialMapping||(this._props.serialMapping=function(e){for(var t=e.units,r=e.elementCount,n=e.unitIndexMap,i=new Uint32Array(t.length),o=new Uint32Array(r),s=new Uint32Array(r),u=0,c=0,l=t.length;u<l;++u){i[u]=c;for(var d=t[u].elements,f=0,p=d.length;f<p;++f){var m=c+f;o[m]=u,s[m]=d[f]}c+=d.length}return{cumulativeUnitElementCount:i,unitIndices:o,elementIndices:s,getSerialIndex:function(e,t){return i[n.get(e.id)]+a.OrderedSet.indexOf(e.elements,t)}}}(this))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"model",{get:function(){if(this._props.model)return this._props.model;if(this._props.representativeModel)return this._props.representativeModel;if(this._props.masterModel)return this._props.masterModel;var e=this.models;if(e.length>1)throw new Error("The structure is based on multiple models and has neither a master- nor a representative-model.");return this._props.model=e[0],this._props.model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"masterModel",{get:function(){return this._props.masterModel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"representativeModel",{get:function(){return this._props.representativeModel},enumerable:!1,configurable:!0}),e.prototype.hasElement=function(e){return!!this.unitMap.has(e.unit.id)&&a.SortedArray.has(this.unitMap.get(e.unit.id).elements,e.element)},e.prototype.getModelIndex=function(e){return this.models.indexOf(e)},e.prototype.remapModel=function(t){for(var r=[],n=0,i=this.unitSymmetryGroups;n<i.length;n++){var a=i[n],o=a.units[0].remapModel(t);r.push(o);for(var s=1,u=a.units.length;s<u;++s){var c=a.units[s];r.push(c.remapModel(t,o.props))}}return e.create(r,{label:this.label,interUnitBonds:this._props.interUnitBonds})},e.prototype.initUnits=function(e){for(var t=a.IntMap.Mutable(),r=a.IntMap.Mutable(),n=0,i=!0,o=e.length>0?e[0].id:0,s=0,u=e.length;s<u;s++){var l=e[s];t.set(l.id,l),n+=l.elements.length,l.id<o&&(i=!1),o=l.id}i||Object(c.p)(e,0,e.length,Z,c.e);for(s=0,u=e.length;s<u;s++)r.set(e[s].id,s);return this._props.elementCount=n,{unitMap:t,unitIndexMap:r}},e}();function Z(e,t,r){return e[t].id-e[r].id}function J(e,t,r){var n=e[t][1]-e[r][1];return 0===n?e[t][0]-e[r][0]:n}!function(e){function t(e){return{kind:"structure-loci",structure:e}}function r(t,r){return new e(t,r)}e.Empty=new e([]),e.Loci=t,e.toStructureElementLoci=function(e){for(var t=[],r=0,n=e.units;r<n.length;r++){var i=n[r];t.push({unit:i,indices:a.Interval.ofBounds(0,i.elements.length)})}return l.a.Loci(e,t)},e.toSubStructureElementLoci=function(e,t){return z.a.toLociWithSourceUnits(z.a.Singletons(e,t))},e.isLoci=function(e){return!!e&&"structure-loci"===e.kind},e.areLociEqual=function(e,t){return e.structure===t.structure},e.isLociEmpty=function(e){return e.structure.isEmpty},e.remapLoci=function(e,r){return r===e.structure?e:t(r)},e.create=r,e.ofTrajectory=function(t,a){return Object(i.__awaiter)(this,void 0,void 0,(function(){var o,s,u,c,l,f,p,m,h,g,v,b,y;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if(0===t.frameCount)return[2,e.Empty];o=[],s=void 0,u=0,c=0,l=t.frameCount,i.label=1;case 1:return c<l?[4,G.b.resolveInContext(t.getFrameAtIndex(c),a)]:[3,4];case 2:for(f=i.sent(),s||(s=f),p=n(f),m=0,h=p.units.length;m<h;++m)g=p.units[m],v=g.invariantId+u,b=g.chainGroupId+u,y=d.a.create(o.length,v,b,g.traits,g.kind,g.model,g.conformation.operator,g.elements),o.push(y);u=o.length,i.label=3;case 3:return++c,[3,1];case 4:return[2,r(o,{representativeModel:s,label:s.label})]}}))}))};function n(e){for(var t=e.atomicHierarchy.chainAtomSegments,r=e.atomicHierarchy.index,n=e.atomicHierarchy.chains.auth_asym_id,i=e.atomicChainOperatorMappinng,u=new m({label:e.label}),c=0;c<t.count;c++){var l=i.get(c)||s.a.Default,d=t.offsets[c],p=(U.c.chainResidueCount(e.atomicHierarchy,c),t.offsets[c+1],t.offsets[c],!1);if(o(e,c))for(;c+1<t.count&&o(e,c+1);){if(i.get(c)!==i.get(c+1))break;p=!0,c++}else for(;c+1<t.count&&t.offsets[c+1]-t.offsets[c]==1&&t.offsets[c+2]-t.offsets[c+1]==1;){if(!0,r.getEntityFromChain(c)!==r.getEntityFromChain(c+1))break;if(n.value(c)!==n.value(c+1))break;if(i.get(c)!==i.get(c+1))break;p=!0,c++}var h=a.SortedArray.ofBounds(d,t.offsets[c+1]);u.addUnit(0,e,l,h,p?1:0)}var g=e.coarseHierarchy;return g.isDefined&&(g.spheres.count>0&&f(u,e,e.coarseHierarchy.spheres,1),g.gaussians.count>0&&f(u,e,e.coarseHierarchy.gaussians,2)),u.getStructure()}function o(e,t){var r=e.atomicHierarchy.index.getEntityFromChain(t);return"water"===e.entities.data.type.value(r)}function f(e,t,r,n){for(var i=r.chainElementSegments,o=0;o<i.count;o++){var u=a.SortedArray.ofBounds(i.offsets[o],i.offsets[o+1]);e.addUnit(n,t,s.a.Default,u,0)}}e.ofModel=n,e.transform=function(t,r){if(p.Mat4.isIdentity(r))return t;if(!p.Mat4.isRotationAndTranslation(r,s.a.RotationTranslationEpsilon))throw new Error("Only rotation/translation combination can be applied.");for(var n=[],i=0,a=t.units;i<a.length;i++){var o=a[i],u=o.conformation.operator,c=s.a.create(u.name,r,u);n.push(o.applyOperator(o.id,c))}var l=t.coordinateSystem,d=s.a.compose(s.a.create(l.name,r,l),l);return new e(n,{parent:t,coordinateSystem:d})};var m=function(){function e(e){void 0===e&&(e={}),this.props=e,this.units=[],this.invariantId=Object(N.a)(),this.chainGroupId=-1,this.inChainGroup=!1,this.p=Object(p.Vec3)(),this.singleElementUnits=new Map}return e.prototype.beginChainGroup=function(){this.chainGroupId++,this.inChainGroup=!0},e.prototype.endChainGroup=function(){this.inChainGroup=!1},e.prototype.addUnit=function(e,t,r,n,i,a){void 0===a&&(a=this.invariantId());var o=this.inChainGroup?this.chainGroupId:++this.chainGroupId,s=d.a.create(this.units.length,a,o,i,e,t,r,n);return this.add(s)},e.prototype.add=function(e){if(1===e.elements.length){e.conformation.position(e.elements[0],this.p);var t=[e.invariantId,this.p[0],this.p[1],this.p[2]].join("|");if(this.singleElementUnits.has(t))return this.singleElementUnits.get(t);this.singleElementUnits.set(t,e)}return this.units.push(e),e},e.prototype.addWithOperator=function(e,t,r){return void 0===r&&(r=!1),this.add(e.applyOperator(this.units.length,t,r))},e.prototype.getStructure=function(){return r(this.units,this.props)},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.units.length},enumerable:!1,configurable:!0}),e}();function g(e,t){if(e===t)return!0;if(e.elementCount!==t.elementCount)return!1;var r=e.units.length;if(r!==t.units.length)return!1;for(var n=0;n<r;n++)if(e.units[n].id!==t.units[n].id)return!1;return!0}function v(e,t){return e===t||e.hashCode===t.hashCode&&h.a.areTransformGroupsEquivalent(e.unitSymmetryGroups,t.unitSymmetryGroups)}e.StructureBuilder=m,e.Builder=function(e){return void 0===e&&(e={}),new m(e)},e.hashCode=function(e){return e.hashCode},e.conformationHash=function(e){return Object(c.m)(e.units.map((function(e){return d.a.conformationId(e)})).join("|"))},e.areUnitIdsEqual=g,e.areUnitIdsAndIndicesEqual=function(e,t){if(!g(e,t))return!1;for(var r=0,n=e.units.length;r<n;r++)if(!a.SortedArray.areEqual(e.units[r].elements,t.units[r].elements))return!1;return!0},e.areHierarchiesEqual=function(e,t){if(e.hashCode!==t.hashCode)return!1;var r=e.models.length;if(r!==t.models.length)return!1;for(var n=0;n<r;n++)if(!u.b.areHierarchiesEqual(e.models[n],t.models[n]))return!1;return!0},e.areEquivalent=v,e.areRootsEquivalent=function(e,t){return v(e.root,t.root)},e.areRootsEqual=function(e,t){return e.root===t.root};var b=function(){function e(e){this.structure=e,this.unitIndex=0,this.maxIdx=0,this.idx=-1,this.current=l.a.Location.create(e),this.hasNext=e.elementCount>0,this.hasNext&&(this.elements=e.units[0].elements,this.maxIdx=this.elements.length-1,this.current.unit=e.units[0])}return e.prototype.move=function(){return this.advance(),this.current.element=this.elements[this.idx],this.current},e.prototype.advance=function(){if(this.idx<this.maxIdx)return this.idx++,void(this.idx===this.maxIdx&&(this.hasNext=this.unitIndex+1<this.structure.units.length));this.idx=0,this.unitIndex++,this.unitIndex>=this.structure.units.length?this.hasNext=!1:(this.current.unit=this.structure.units[this.unitIndex],this.elements=this.current.unit.elements,this.maxIdx=this.elements.length-1,0===this.maxIdx&&(this.hasNext=this.unitIndex+1<this.structure.units.length))},e}();e.ElementLocationIterator=b;var y=Object(p.Vec3)();function _(e,t,r){for(var n=e.elements,i=e.conformation,a=i.position,o=i.r,s=y,u=Number.MAX_VALUE,c=0,l=n.length;c<l;c++){var d=n[c],f=p.Vec3.distance(t,a(d,s))-r-o(d);f<u&&(u=f)}return u}function S(e,t,r){for(var n=e.units,i=Number.MAX_VALUE,a=0,o=n.length;a<o;a++){var s=_(n[a],t,r);s<i&&(i=s)}return i}e.minDistanceToPoint=S;var x,O=Object(p.Vec3)();function w(e){return e.unitSymmetryGroups.filter((function(e){return e.units[0].polymerElements.length>0}))}e.distance=function(e,t){if(0===e.elementCount||0===t.elementCount)return 0;for(var r=e.units,n=Number.MAX_VALUE,i=0,a=r.length;i<a;i++)for(var o=r[i],s=o.elements,u=o.conformation,c=u.position,l=u.r,d=0,f=s.length;d<f;d++){var p=s[d],m=S(t,c(p,O),l(p));m<n&&(n=m)}return n},e.elementDescription=function(e){return 1===e.elementCount?"1 element":e.elementCount+" elements"},e.validUnitPair=function(e,t,r){return e.masterModel?t.model===r.model||t.model===e.masterModel||r.model===e.masterModel:t.model===r.model},e.eachUnitPair=function(e,t,r){var n=r.maxRadius,i=r.validUnit,a=r.validUnitPair;if(e.units.some((function(e){return i(e)})))for(var o=e.lookup3d,s=Object(p.Vec3)(),u=0,c=e.units;u<c.length;u++){var l=c[u];if(i(l)){var d=l.boundary.sphere;p.Vec3.transformMat4(s,d.center,l.conformation.operator.matrix);for(var f=o.findUnitIndices(s[0],s[1],s[2],d.radius+n),m=0;m<f.count;m++){var h=e.units[f.indices[m]];!i(h)||l.id>=h.id||!a(l,h)||(h.elements.length>=l.elements.length?t(l,h):t(h,l))}}}},e.DefaultSizeThresholds={smallResidueCount:10,mediumResidueCount:5e3,largeResidueCount:3e4,highSymmetryUnitCount:10,fiberResidueCount:15},function(e){e[e.Small=0]="Small",e[e.Medium=1]="Medium",e[e.Large=2]="Large",e[e.Huge=3]="Huge",e[e.Gigantic=4]="Gigantic"}(x=e.Size||(e.Size={})),e.getSize=function(t,r,n){void 0===r&&(r={}),void 0===n&&(n=1);var a=Object(i.__assign)(Object(i.__assign)({},e.DefaultSizeThresholds),r);return t.polymerResidueCount>=a.largeResidueCount*n?function(e,t){var r=w(e);return r.length>=1&&r[0].units.length>t.highSymmetryUnitCount}(t,a)?x.Huge:x.Gigantic:function(e,t){var r=w(e);return 1===r.length&&r[0].units.length>2&&r[0].units[0].polymerElements.length<t.fiberResidueCount}(t,a)||t.polymerResidueCount<a.smallResidueCount*n?x.Small:t.polymerResidueCount<a.mediumResidueCount*n?x.Medium:x.Large},e.Index=H.a.createSimple("index","root")}(K||(K={}));var $=t.a=K},function(e,t,r){"use strict";r.r(t),r.d(t,"AssetManager",(function(){return c})),r.d(t,"Asset",(function(){return n}));var n,i=r(0),a=r(200),o=r(12),s=r(183),u=r(17);!function(e){function t(e,t){return Object(i.__assign)({kind:"url",id:a.a.create22(),url:e},t)}e.Url=t,e.File=function(e){return{kind:"file",id:a.a.create22(),name:e.name,file:e}},e.isUrl=function(e){return"url"===(null==e?void 0:e.kind)},e.isFile=function(e){return"file"===(null==e?void 0:e.kind)},e.Wrapper=function(e,t,r){return{data:e,dispose:function(){r.release(t)}}},e.getUrl=function(e){return"string"==typeof e?e:e.url},e.getUrlAsset=function(e,r,n){return"string"==typeof r?e.tryFindUrl(r,n)||t(r,{body:n}):r}}(n||(n={}));var c=function(){function e(){this._assets=new Map}return Object.defineProperty(e.prototype,"assets",{get:function(){return Object(o.n)(this._assets.values())},enumerable:!1,configurable:!0}),e.prototype.tryFindUrl=function(e,t){for(var r=this.assets.values();;){var i=r.next();if(i.done)return;var a=i.value.asset;if(n.isUrl(a)&&a.url===e&&(a.body||"")===(t||""))return a}},e.prototype.set=function(e,t){this._assets.set(e.id,{asset:e,file:t,refCount:0})},e.prototype.resolve=function(e,t,r){var a=this;return void 0===r&&(r=!0),n.isUrl(e)?u.b.create("Download "+(e.title||e.url),(function(o){return Object(i.__awaiter)(a,void 0,void 0,(function(){var a,u,c,l,d,f,p,m,h;return Object(i.__generator)(this,(function(g){switch(g.label){case 0:return this._assets.has(e.id)?((a=this._assets.get(e.id)).refCount++,c=(u=n).Wrapper,[4,Object(s.c)(a.file,t).runInContext(o)]):[3,2];case 1:return[2,c.apply(u,[g.sent(),e,this])];case 2:return r?[3,4]:(d=(l=n).Wrapper,[4,Object(s.a)(Object(i.__assign)(Object(i.__assign)({},e),{type:t})).runInContext(o)]);case 3:return[2,d.apply(l,[g.sent(),e,this])];case 4:return[4,Object(s.a)(Object(i.__assign)(Object(i.__assign)({},e),{type:"binary"})).runInContext(o)];case 5:return f=g.sent(),p=new File([f],"raw-data"),this._assets.set(e.id,{asset:e,file:p,refCount:1}),h=(m=n).Wrapper,[4,Object(s.c)(p,t).runInContext(o)];case 6:return[2,h.apply(m,[g.sent(),e,this])]}}))}))})):u.b.create("Read "+e.name,(function(o){return Object(i.__awaiter)(a,void 0,void 0,(function(){var a,u,c,l,d;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return this._assets.has(e.id)?((a=this._assets.get(e.id)).refCount++,c=(u=n).Wrapper,[4,Object(s.c)(a.file,t).runInContext(o)]):[3,2];case 1:return[2,c.apply(u,[i.sent(),e,this])];case 2:if(!(e.file instanceof File))throw new Error("Cannot resolve file asset '"+e.name+"' ("+e.id+")");return r&&this._assets.set(e.id,{asset:e,file:e.file,refCount:1}),d=(l=n).Wrapper,[4,Object(s.c)(e.file,t).runInContext(o)];case 3:return[2,d.apply(l,[i.sent(),e,this])]}}))}))}))},e.prototype.release=function(e){var t=this._assets.get(e.id);t&&(t.refCount--,t.refCount<=0&&this._assets.delete(e.id))},e}()},function(e,t,r){"use strict";r.d(t,"e",(function(){return n.c})),r.d(t,"g",(function(){return n.e})),r.d(t,"f",(function(){return n.d})),r.d(t,"c",(function(){return n.a})),r.d(t,"d",(function(){return i.c})),r.d(t,"h",(function(){return i.d})),r.d(t,"b",(function(){return i.b})),r.d(t,"a",(function(){return i.a}));var n=r(313),i=r(314)},function(e,t,r){"use strict";r.d(t,"c",(function(){return S})),r.d(t,"a",(function(){return x})),r.d(t,"b",(function(){return O}));var n=r(99),i=r(0),a=r(67),o=r(68),s=r(11),u=r(64),c=r(5),l=Object(i.__assign)(Object(i.__assign)({},s.b),{aPosition:Object(s.a)("float32",3,0),elements:Object(s.d)("uint32"),uColor:Object(s.j)("v3"),uColorTexDim:Object(s.j)("v2"),tColor:Object(s.i)("image-uint8","rgb","ubyte","nearest"),dColorType:Object(s.c)("string",["uniform","attribute","instance","group","groupInstance","vertex","vertexInstance"]),uIsoValue:Object(s.j)("v2"),uBboxMin:Object(s.j)("v3"),uBboxMax:Object(s.j)("v3"),uBboxSize:Object(s.j)("v3"),uMaxSteps:Object(s.j)("i"),uStepScale:Object(s.j)("f"),uJumpLength:Object(s.j)("f"),uTransform:Object(s.j)("m4"),uGridDim:Object(s.j)("v3"),dRenderMode:Object(s.c)("string",["isosurface","volume"]),dSingleLayer:Object(s.c)("boolean"),tTransferTex:Object(s.i)("image-uint8","rgba","ubyte","linear"),uTransferScale:Object(s.j)("f"),dGridTexType:Object(s.c)("string",["2d","3d"]),uGridTexDim:Object(s.j)("v3"),tGridTex:Object(s.i)("texture","rgba","ubyte","linear"),uGridStats:Object(s.j)("v4"),uCellDim:Object(s.j)("v3"),uCartnToUnit:Object(s.j)("m4"),uUnitToCartn:Object(s.j)("m4"),dPackedGroup:Object(s.c)("boolean"),dDoubleSided:Object(s.c)("boolean"),dFlipSided:Object(s.c)("boolean"),dFlatShaded:Object(s.c)("boolean"),dIgnoreLight:Object(s.c)("boolean"),dXrayShaded:Object(s.c)("boolean")});var d=Object(i.__assign)(Object(i.__assign)({},s.b),{aGroup:Object(s.a)("float32",1,0),aPosition:Object(s.a)("float32",3,0),aNormal:Object(s.a)("float32",3,0),elements:Object(s.d)("uint32"),dFlatShaded:Object(s.c)("boolean"),dDoubleSided:Object(s.c)("boolean"),dFlipSided:Object(s.c)("boolean"),dIgnoreLight:Object(s.c)("boolean"),dXrayShaded:Object(s.c)("boolean")});var f=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.b),s.h),{aGroup:Object(s.a)("float32",1,0),aPosition:Object(s.a)("float32",3,0),dPointSizeAttenuation:Object(s.c)("boolean"),dPointFilledCircle:Object(s.c)("boolean"),uPointEdgeBleach:Object(s.j)("f")});var p=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.b),s.h),{aGroup:Object(s.a)("float32",1,0),aMapping:Object(s.a)("float32",2,0),aStart:Object(s.a)("float32",3,0),aEnd:Object(s.a)("float32",3,0),elements:Object(s.d)("uint32"),dLineSizeAttenuation:Object(s.c)("boolean"),dDoubleSided:Object(s.c)("boolean"),dFlipSided:Object(s.c)("boolean")});var m=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.b),s.h),{aGroup:Object(s.a)("float32",1,0),aPosition:Object(s.a)("float32",3,0),aMapping:Object(s.a)("float32",2,0),elements:Object(s.d)("uint32"),padding:Object(s.k)("number"),dDoubleSided:Object(s.c)("boolean"),dIgnoreLight:Object(s.c)("boolean"),dXrayShaded:Object(s.c)("boolean")});var h=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.b),s.h),{aGroup:Object(s.a)("float32",1,0),aPosition:Object(s.a)("float32",3,0),aMapping:Object(s.a)("float32",2,0),aDepth:Object(s.a)("float32",1,0),elements:Object(s.d)("uint32"),aTexCoord:Object(s.a)("float32",2,0),tFont:Object(s.i)("image-uint8","alpha","ubyte","linear"),padding:Object(s.k)("number"),uBorderWidth:Object(s.j)("f"),uBorderColor:Object(s.j)("v3"),uOffsetX:Object(s.j)("f"),uOffsetY:Object(s.j)("f"),uOffsetZ:Object(s.j)("f"),uBackgroundColor:Object(s.j)("v3"),uBackgroundOpacity:Object(s.j)("f")});var g=Object(i.__assign)(Object(i.__assign)({},s.b),{uGeoTexDim:Object(s.j)("v2"),tPosition:Object(s.i)("texture","rgb","float","nearest"),tGroup:Object(s.i)("texture","alpha","float","nearest"),tNormal:Object(s.i)("texture","rgb","float","nearest"),dFlatShaded:Object(s.c)("boolean"),dDoubleSided:Object(s.c)("boolean"),dFlipSided:Object(s.c)("boolean"),dIgnoreLight:Object(s.c)("boolean"),dXrayShaded:Object(s.c)("boolean"),dGeoTexture:Object(s.c)("boolean")});var v=r(226),b=Object(i.__assign)(Object(i.__assign)({},s.b),{aGroup:Object(s.a)("float32",1,0),aPosition:Object(s.a)("float32",3,0),aUv:Object(s.a)("float32",2,0),elements:Object(s.d)("uint32"),uImageTexDim:Object(s.j)("v2"),tImageTex:Object(s.i)("image-uint8","rgba","ubyte","nearest"),tGroupTex:Object(s.i)("image-uint8","rgba","ubyte","nearest"),dInterpolation:Object(s.c)("string",v.b)});var y=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.b),s.h),{aGroup:Object(s.a)("float32",1,0),aStart:Object(s.a)("float32",3,0),aEnd:Object(s.a)("float32",3,0),aMapping:Object(s.a)("float32",3,0),aScale:Object(s.a)("float32",1,0),aCap:Object(s.a)("float32",1,0),elements:Object(s.d)("uint32"),padding:Object(s.k)("number"),dDoubleSided:Object(s.c)("boolean"),dIgnoreLight:Object(s.c)("boolean"),dXrayShaded:Object(s.c)("boolean")});var _=Object(n.a)(0,2147483647),S=Object(n.a)(0,2147483647);function x(e,t,r,n){return{id:_(),type:e,values:t,state:r,materialId:n}}function O(e,t){switch(t.type){case"mesh":return function(e,t,r,n,l){var f=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),d),p={uObjectId:c.e.create(t)},m=u.e,h=Object(o.b)(e,"triangles",m,f,Object(i.__assign)(Object(i.__assign)({},r),p),l);return Object(a.b)(h,r,n)}(e,t.id,t.values,t.state,t.materialId);case"points":return function(e,t,r,n,l){var d=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),f),p={uObjectId:c.e.create(t)},m=u.f,h=Object(o.b)(e,"points",m,d,Object(i.__assign)(Object(i.__assign)({},r),p),l);return Object(a.b)(h,r,n)}(e,t.id,t.values,t.state,t.materialId);case"spheres":return function(e,t,r,n,l){var d=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),m),f={uObjectId:c.e.create(t)},p=u.h,h=Object(o.b)(e,"triangles",p,d,Object(i.__assign)(Object(i.__assign)({},r),f),l);return Object(a.b)(h,r,n)}(e,t.id,t.values,t.state,t.materialId);case"cylinders":return function(e,t,r,n,l){var d=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),y),f={uObjectId:c.e.create(t)},p=u.a,m=Object(o.b)(e,"triangles",p,d,Object(i.__assign)(Object(i.__assign)({},r),f),l);return Object(a.b)(m,r,n)}(e,t.id,t.values,t.state,t.materialId);case"text":return function(e,t,r,n,l){var d=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),h),f={uObjectId:c.e.create(t)},p=u.i,m=Object(o.b)(e,"triangles",p,d,Object(i.__assign)(Object(i.__assign)({},r),f),l);return Object(a.b)(m,r,n)}(e,t.id,t.values,t.state,t.materialId);case"lines":return function(e,t,r,n,l){var d=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),p),f={uObjectId:c.e.create(t)},m=u.d,h=Object(o.b)(e,"triangles",m,d,Object(i.__assign)(Object(i.__assign)({},r),f),l);return Object(a.b)(h,r,n)}(e,t.id,t.values,t.state,t.materialId);case"direct-volume":return function(e,t,r,n,d){var f=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),l);e.isWebGL2||(f.uMaxSteps=Object(s.c)("number"));var p={uObjectId:c.e.create(t)},m=u.b,h=Object(o.b)(e,"triangles",m,f,Object(i.__assign)(Object(i.__assign)({},r),p),d);return Object(a.b)(h,r,n)}(e,t.id,t.values,t.state,t.materialId);case"image":return function(e,t,r,n,l){var d=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),b),f={uObjectId:c.e.create(t)},p=u.c,m=Object(o.b)(e,"triangles",p,d,Object(i.__assign)(Object(i.__assign)({},r),f),l);return Object(a.b)(m,r,n)}(e,t.id,t.values,t.state,t.materialId);case"texture-mesh":return function(e,t,r,n,l){var d=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},s.f),s.e),s.g),g),f={uObjectId:c.e.create(t)},p=u.e,m=Object(o.b)(e,"triangles",p,d,Object(i.__assign)(Object(i.__assign)({},r),f),l);return Object(a.b)(m,r,n)}(e,t.id,t.values,t.state,t.materialId)}throw new Error("unsupported type")}},function(e,t,r){"use strict";r.d(t,"e",(function(){return s})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return h})),r.d(t,"c",(function(){return g}));var n=r(1),i=r(29);function a(e,t){for(var r=0,n=3*t;r<n;r+=3){var i=e[r],a=e[r+1],o=e[r+2],s=1/Math.sqrt(i*i+a*a+o*o);e[r]=i*s,e[r+1]=a*s,e[r+2]=o*s}return e}var o=Object(n.Vec3)();function s(e,t,r,i){for(var a=0,s=3*i;a<s;a+=3)n.Vec3.fromArray(o,t,r+a),n.Vec3.transformMat4(o,o,e),n.Vec3.toArray(o,t,r+a)}function u(e,t,r,i){for(var a=0,s=3*i;a<s;a+=3)n.Vec3.fromArray(o,t,r+a),n.Vec3.transformMat3(o,o,e),n.Vec3.toArray(o,t,r+a)}function c(e,t){for(var r=0,i=e.length;r<i;r+=3)n.Vec3.fromArray(o,e,r),n.Vec3.normalize(o,o),n.Vec3.scale(o,o,t),n.Vec3.toArray(o,e,r)}var l=Object(n.Vec3)(),d=Object(n.Vec3)(),f=Object(n.Vec3)(),p=Object(n.Vec3)(),m=Object(n.Vec3)();function h(e,t,r,i,o){for(var s=0,u=3*o;s<u;s+=3){var c=3*t[s],h=3*t[s+1],g=3*t[s+2];n.Vec3.fromArray(l,e,c),n.Vec3.fromArray(d,e,h),n.Vec3.fromArray(f,e,g),n.Vec3.sub(p,f,d),n.Vec3.sub(m,l,d),n.Vec3.cross(p,p,m),r[c]+=p[0],r[c+1]+=p[1],r[c+2]+=p[2],r[h]+=p[0],r[h+1]+=p[1],r[h+2]+=p[2],r[g]+=p[0],r[g+1]+=p[1],r[g+2]+=p[2]}return a(r,i)}function g(e,t,r){void 0===r&&(r=1);for(var n=Object(i.arrayMax)(e),a=new Int32Array(n+2),o=new Int32Array(t),s=new Int32Array(t),u=0,c=t*r;u<c;u+=r)++s[e[u]];var l=0;for(u=0;u<t;u++)a[u]=l,l+=s[u];a[t]=l;var d=new Int32Array(l);for(u=0,c=t*r;u<c;u+=r){var f=e[u];d[a[f]+o[f]]=u,++o[f]}return{indices:d,offsets:a}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(20),i=r(34);function a(e,t){return function(r){if("function"!=typeof e)throw new TypeError("argument is not a function. Are you looking for `mapTo()`?");return r.lift(new o(e,t))}}var o=function(){function e(e,t){this.project=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.project,this.thisArg))},e}(),s=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.project=r,i.count=0,i.thisArg=n||i,i}return n.a(t,e),t.prototype._next=function(e){var t;try{t=this.project.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(58),i=r(1),a=r(52);function o(e,t){var r=Object(a.c)(Math.max(1,e),1,Uint8Array,t&&t.tMarker.ref.value.array);return t?(n.b.update(t.tMarker,r),n.b.update(t.uMarkerTexDim,i.Vec2.create(r.width,r.height)),t):{tMarker:n.b.create(r),uMarkerTexDim:n.b.create(i.Vec2.create(r.width,r.height))}}new Uint8Array(1)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(38),a=r(269),o=r(144),s=r(80),u=r(151),c=r(270),l=r(29),d=r(191),f=r(226),p=r(166);!function(e){function t(e){switch(e.kind){case"mesh":return 3*e.triangleCount;case"points":return e.pointCount;case"spheres":return 2*e.sphereCount*3;case"cylinders":return 4*e.cylinderCount*3;case"text":return 2*e.charCount*3;case"lines":return 2*e.lineCount*3;case"direct-volume":return 36;case"image":return 6;case"texture-mesh":return e.vertexCount}}e.getDrawCount=t,e.getVertexCount=function(e){switch(e.kind){case"mesh":return e.vertexCount;case"points":return e.pointCount;case"spheres":return 4*e.sphereCount;case"cylinders":return 6*e.cylinderCount;case"text":return 4*e.charCount;case"lines":return 4*e.lineCount;case"direct-volume":var t=e.gridDimension.ref.value;return t[0]*t[1]*t[2];case"image":return 4;case"texture-mesh":return e.vertexCount}},e.getGroupCount=function(e){switch(e.kind){case"mesh":case"points":case"spheres":case"cylinders":case"text":case"lines":return 0===t(e)?0:Object(l.arrayMax)(e.groupBuffer.ref.value)+1;case"direct-volume":return 1;case"image":return Object(l.arrayMax)(e.groupTexture.ref.value.array)+1;case"texture-mesh":return e.groupCount}},e.getUtils=function(e){switch(e.kind){case"mesh":return i.a.Utils;case"points":return a.a.Utils;case"spheres":return c.a.Utils;case"cylinders":return p.a.Utils;case"text":return o.a.Utils;case"lines":return s.a.Utils;case"direct-volume":return u.a.Utils;case"image":return f.a.Utils;case"texture-mesh":return d.a.Utils}},e.getGranularity=function(e,t){return"instance"===t&&e.nonInstanceable?"group":t}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"Script",(function(){return D}));var n=r(0),i=r(57),a=r(142),o=r(19),s=r(14),u=r(16),c=r(225),l=r(10);function d(e){return Object.keys(e).filter((function(e){return!isNaN(e)})).map((function(e){return+e})).sort((function(e,t){return e-t})).map((function(t){return e[t]}))}function f(e,t,r){return e&&void 0!==e[t]?e[t]:r}function p(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return{kind:"alias",aliases:t,symbol:e}}function m(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];return e.info.namespace="molscript-macro",e.id="molscript-macro."+e.info.name,{kind:"macro",symbol:e,translate:t,aliases:Object(n.__spreadArrays)([e.info.name],r)}}function h(e){return"alias"===e.kind||"macro"===e.kind}var g=[["Core symbols",p(s.a.core.type.bool,"bool"),p(s.a.core.type.num,"num"),p(s.a.core.type.str,"str"),p(s.a.core.type.regex,"regex"),p(s.a.core.type.list,"list"),p(s.a.core.type.set,"set"),p(s.a.core.type.compositeKey,"composite-key"),p(s.a.core.logic.not,"not"),p(s.a.core.logic.and,"and"),p(s.a.core.logic.or,"or"),p(s.a.core.ctrl.if,"if"),p(s.a.core.ctrl.fn,"fn"),p(s.a.core.ctrl.eval,"eval"),p(s.a.core.math.add,"add","+"),p(s.a.core.math.sub,"sub","-"),p(s.a.core.math.mult,"mult","*"),p(s.a.core.math.div,"div","/"),p(s.a.core.math.pow,"pow","**"),p(s.a.core.math.mod,"mod"),p(s.a.core.math.min,"min"),p(s.a.core.math.max,"max"),p(s.a.core.math.floor,"floor"),p(s.a.core.math.ceil,"ceil"),p(s.a.core.math.roundInt,"round"),p(s.a.core.math.abs,"abs"),p(s.a.core.math.sqrt,"sqrt"),p(s.a.core.math.cbrt,"cbrt"),p(s.a.core.math.sin,"sin"),p(s.a.core.math.cos,"cos"),p(s.a.core.math.tan,"tan"),p(s.a.core.math.asin,"asin"),p(s.a.core.math.acos,"acos"),p(s.a.core.math.atan,"atan"),p(s.a.core.math.sinh,"sinh"),p(s.a.core.math.cosh,"cosh"),p(s.a.core.math.tanh,"tanh"),p(s.a.core.math.exp,"exp"),p(s.a.core.math.log,"log"),p(s.a.core.math.log10,"log10"),p(s.a.core.math.atan2,"atan2"),p(s.a.core.rel.eq,"eq","="),p(s.a.core.rel.neq,"neq","!="),p(s.a.core.rel.lt,"lt","<"),p(s.a.core.rel.lte,"lte","<="),p(s.a.core.rel.gr,"gr",">"),p(s.a.core.rel.gre,"gre",">="),p(s.a.core.rel.inRange,"in-range"),p(s.a.core.str.concat,"concat"),p(s.a.core.str.match,"regex.match"),p(s.a.core.list.getAt,"list.get"),p(s.a.core.set.has,"set.has"),p(s.a.core.set.isSubset,"set.subset")],["Structure",["Types",p(s.a.structureQuery.type.entityType,"ent-type"),p(s.a.structureQuery.type.authResidueId,"auth-resid"),p(s.a.structureQuery.type.labelResidueId,"label-resid"),p(s.a.structureQuery.type.ringFingerprint,"ringfp"),p(s.a.structureQuery.type.bondFlags,"bond-flags")],["Slots",p(s.a.structureQuery.slot.elementSetReduce,"atom.set.reduce.value")],["Generators",p(s.a.structureQuery.generator.atomGroups,"sel.atom.atom-groups"),p(s.a.structureQuery.generator.queryInSelection,"sel.atom.query-in-selection"),p(s.a.structureQuery.generator.rings,"sel.atom.rings"),p(s.a.structureQuery.generator.empty,"sel.atom.empty"),p(s.a.structureQuery.generator.all,"sel.atom.all"),p(s.a.structureQuery.generator.bondedAtomicPairs,"sel.atom.bonded-pairs"),m(Object(o.d)("sel.atom.atoms",o.b.Dictionary({0:Object(o.a)(u.a.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to each atom."})}),c.a.ElementSelection,"A selection of singleton atom sets."),(function(e){return l.MolScriptBuilder.struct.generator.atomGroups({"atom-test":f(e,0,!0)})})),m(Object(o.d)("sel.atom.res",o.b.Dictionary({0:Object(o.a)(u.a.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each residue."})}),c.a.ElementSelection,"A selection of atom sets grouped by residue."),(function(e){return l.MolScriptBuilder.struct.generator.atomGroups({"residue-test":f(e,0,!0),"group-by":l.MolScriptBuilder.ammp("residueKey")})})),m(Object(o.d)("sel.atom.chains",o.b.Dictionary({0:Object(o.a)(u.a.Bool,{isOptional:!0,defaultValue:!0,description:"Test applied to the 1st atom of each chain."})}),c.a.ElementSelection,"A selection of atom sets grouped by chain."),(function(e){return l.MolScriptBuilder.struct.generator.atomGroups({"chain-test":f(e,0,!0),"group-by":l.MolScriptBuilder.ammp("chainKey")})}))],["Modifiers",p(s.a.structureQuery.modifier.queryEach,"sel.atom.query-each"),p(s.a.structureQuery.modifier.intersectBy,"sel.atom.intersect-by"),p(s.a.structureQuery.modifier.exceptBy,"sel.atom.except-by"),p(s.a.structureQuery.modifier.unionBy,"sel.atom.union-by"),p(s.a.structureQuery.modifier.union,"sel.atom.union"),p(s.a.structureQuery.modifier.cluster,"sel.atom.cluster"),p(s.a.structureQuery.modifier.includeSurroundings,"sel.atom.include-surroundings"),p(s.a.structureQuery.modifier.includeConnected,"sel.atom.include-connected"),p(s.a.structureQuery.modifier.expandProperty,"sel.atom.expand-property")],["Filters",p(s.a.structureQuery.filter.pick,"sel.atom.pick"),p(s.a.structureQuery.filter.first,"sel.atom.first"),p(s.a.structureQuery.filter.withSameAtomProperties,"sel.atom.with-same-atom-properties"),p(s.a.structureQuery.filter.intersectedBy,"sel.atom.intersected-by"),p(s.a.structureQuery.filter.within,"sel.atom.within"),p(s.a.structureQuery.filter.isConnectedTo,"sel.atom.is-connected-to")],["Combinators",p(s.a.structureQuery.combinator.intersect,"sel.atom.intersect"),p(s.a.structureQuery.combinator.merge,"sel.atom.merge"),p(s.a.structureQuery.combinator.distanceCluster,"sel.atom.dist-cluster")],["Atom Set Properties",p(s.a.structureQuery.atomSet.atomCount,"atom.set.atom-count"),p(s.a.structureQuery.atomSet.countQuery,"atom.set.count-query"),p(s.a.structureQuery.atomSet.reduce,"atom.set.reduce"),p(s.a.structureQuery.atomSet.propertySet,"atom.set.property")],["Atom Properties",p(s.a.structureQuery.atomProperty.core.elementSymbol,"atom.el"),p(s.a.structureQuery.atomProperty.core.vdw,"atom.vdw"),p(s.a.structureQuery.atomProperty.core.mass,"atom.mass"),p(s.a.structureQuery.atomProperty.core.atomicNumber,"atom.atomic-number"),p(s.a.structureQuery.atomProperty.core.x,"atom.x"),p(s.a.structureQuery.atomProperty.core.y,"atom.y"),p(s.a.structureQuery.atomProperty.core.z,"atom.z"),p(s.a.structureQuery.atomProperty.core.sourceIndex,"atom.src-index"),p(s.a.structureQuery.atomProperty.core.operatorName,"atom.op-name"),p(s.a.structureQuery.atomProperty.core.modelIndex,"atom.model-index"),p(s.a.structureQuery.atomProperty.core.modelLabel,"atom.model-label"),p(s.a.structureQuery.atomProperty.core.atomKey,"atom.key"),p(s.a.structureQuery.atomProperty.core.bondCount,"atom.bond-count"),p(s.a.structureQuery.atomProperty.topology.connectedComponentKey,"atom.key.molecule"),p(s.a.structureQuery.atomProperty.macromolecular.authResidueId,"atom.auth-resid"),p(s.a.structureQuery.atomProperty.macromolecular.labelResidueId,"atom.label-resid"),p(s.a.structureQuery.atomProperty.macromolecular.residueKey,"atom.key.res"),p(s.a.structureQuery.atomProperty.macromolecular.chainKey,"atom.key.chain"),p(s.a.structureQuery.atomProperty.macromolecular.entityKey,"atom.key.entity"),p(s.a.structureQuery.atomProperty.macromolecular.isHet,"atom.is-het"),p(s.a.structureQuery.atomProperty.macromolecular.id,"atom.id"),p(s.a.structureQuery.atomProperty.macromolecular.label_atom_id,"atom.label_atom_id"),p(s.a.structureQuery.atomProperty.macromolecular.label_alt_id,"atom.label_alt_id","atom.altloc"),p(s.a.structureQuery.atomProperty.macromolecular.label_comp_id,"atom.label_comp_id"),p(s.a.structureQuery.atomProperty.macromolecular.label_asym_id,"atom.label_asym_id"),p(s.a.structureQuery.atomProperty.macromolecular.label_entity_id,"atom.label_entity_id"),p(s.a.structureQuery.atomProperty.macromolecular.label_seq_id,"atom.label_seq_id"),p(s.a.structureQuery.atomProperty.macromolecular.auth_atom_id,"atom.auth_atom_id","atom.name"),p(s.a.structureQuery.atomProperty.macromolecular.auth_comp_id,"atom.auth_comp_id","atom.resname"),p(s.a.structureQuery.atomProperty.macromolecular.auth_asym_id,"atom.auth_asym_id","atom.chain"),p(s.a.structureQuery.atomProperty.macromolecular.auth_seq_id,"atom.auth_seq_id","atom.resno"),p(s.a.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,"atom.pdbx_PDB_ins_code","atom.inscode"),p(s.a.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,"atom.pdbx_formal_charge"),p(s.a.structureQuery.atomProperty.macromolecular.occupancy,"atom.occupancy"),p(s.a.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,"atom.B_iso_or_equiv","atom.bfactor"),p(s.a.structureQuery.atomProperty.macromolecular.entityType,"atom.entity-type"),p(s.a.structureQuery.atomProperty.macromolecular.entitySubtype,"atom.entity-subtype"),p(s.a.structureQuery.atomProperty.macromolecular.entityPrdId,"atom.entity-prd-id"),p(s.a.structureQuery.atomProperty.macromolecular.entityDescription,"atom.entity-description"),p(s.a.structureQuery.atomProperty.macromolecular.objectPrimitive,"atom.object-primitive"),p(s.a.structureQuery.atomProperty.macromolecular.chemCompType,"atom.chem-comp-type"),p(s.a.structureQuery.atomProperty.macromolecular.secondaryStructureKey,"atom.key.sec-struct"),p(s.a.structureQuery.atomProperty.macromolecular.isModified,"atom.is-modified"),p(s.a.structureQuery.atomProperty.macromolecular.modifiedParentName,"atom.modified-parent")],["Bond Properties",p(s.a.structureQuery.bondProperty.order,"bond.order"),p(s.a.structureQuery.bondProperty.length,"bond.length"),p(s.a.structureQuery.bondProperty.atomA,"bond.atom-a"),p(s.a.structureQuery.bondProperty.atomB,"bond.atom-b"),m(Object(o.d)("bond.is",o.b.List(c.a.BondFlag),u.a.Bool,"Test if the current bond has at least one (or all if partial = false) of the specified flags: "+u.a.oneOfValues(c.a.BondFlag).join(", ")),(function(e){return l.MolScriptBuilder.core.flags.hasAny([l.MolScriptBuilder.struct.bondProperty.flags(),l.MolScriptBuilder.struct.type.bondFlags(d(e))])}))]]],v=[];!function e(t){for(var r=0,n=t;r<n.length;r++){var i=n[r];h(i)?v.push(i):i instanceof Array&&e(i)}}(g);var b=function(){for(var e=[],t=Object.create(null),r=i.c.create(),n=i.c.create(),a=0,o=v;a<o.length;a++){for(var s=o[a],c=0,l=s.aliases;c<l.length;c++){var d=l[c];if(e.push([d,s]),t[d])throw new Error("Alias '"+d+"' already in use.");t[d]=s}var f=s.symbol.args;if("dictionary"===f.kind)for(var p=0,m=Object.keys(f.map);p<m.length;p++){d=m[p];isNaN(d)&&i.c.add(r,d,d);var h=f.map[d];"oneof"===h.type.kind&&u.a.oneOfValues(h.type).forEach((function(e){return i.c.add(n,e,e)}))}else"oneof"===f.type.kind&&u.a.oneOfValues(f.type).forEach((function(e){return i.c.add(n,e,e)}))}return{symbolList:e,symbolMap:t,namedArgs:r.array,constants:n.array}}(),y=(b.constants,b.namedArgs,b.symbolMap);b.symbolList;function _(e){return function e(t){if(a.a.isLiteral(t))return t;if(a.a.isSymbol(t)){if(!y[t.name])return t;var r=y[t.name];if("alias"===r.kind)return a.a.Symbol(y[t.name].symbol.id);throw r.translate([])}var n=a.a.isSymbol(t.head)&&!!y[t.head.name]&&"macro"===y[t.head.name].kind,i=n?t.head:e(t.head),o=i!==t.head;if(!t.args)return n?e(t.head):o?a.a.Apply(i):t;var s,u=!1;if(a.a.isArgumentsArray(t.args)){s=[];for(var c=0,l=t.args.length;c<l;c++){(p=t.args[c])!==(m=e(p))&&(u=!0),s[s.length]=m}if(u||(s=t.args),!n&&!o&&!u)return t}else{s={};for(var d=0,f=Object.keys(t.args);d<f.length;d++){var p,m,h=f[d];(p=t.args[h])!==(m=e(p))&&(u=!0),s[h]=m}if(!n&&!o&&!u)return t;u||(s=t.args)}if(n){var g=y[t.head.name];return"macro"!==g.kind?a.a.Apply(i,s):g.translate(s)}return a.a.Apply(i,s)}(e)}var S,x=function(){function e(e){this._=e}return e.prototype.parse=function(t){var r=this.skip(e.eof)._(t,0);return r.status?{success:!0,value:r.value}:{success:!1,index:P(t,r.furthest),expected:r.expected}},e.prototype.tryParse=function(e){var t=this.parse(e);if(t.success)return t.value;var r,n,i,a=(n=e,"expected "+(1===(r=(i=t).expected).length?r[0]:"one of "+r.join(", "))+function(e,t){var r=t.index,n=r.offset;if(n===e.length)return", got the end of the input";var i=n>0?"'...":"'",a=e.length-n>12?"...'":"'";return" at line "+r.line+" column "+r.column+", got "+i+e.slice(n,n+12)+a}(n,i));throw new Error(a)},e.prototype.or=function(t){return e.alt(this,t)},e.prototype.trim=function(e){return this.wrap(e,e)},e.prototype.wrap=function(t,r){return O(1,"string"==typeof t?e.string(t):t,this,"string"==typeof r?e.string(r):r)},e.prototype.thru=function(e){return e(this)},e.prototype.then=function(e){return O(1,this,e)},e.prototype.many=function(){var t=this;return new e((function(e,r){for(var n=[],i=void 0;;){if(!(i=j(t._(e,r),i)).status)return j(w(r,n),i);if(r===i.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");r=i.index,n.push(i.value)}}))},e.prototype.times=function(t,r){var n=this,i=void 0===r?t:r;return new e((function(e,r){var a,o=[],s=void 0,u=void 0;for(a=0;a<t;a++){if(u=j(s=n._(e,r),u),!s.status)return u;r=s.index,o.push(s.value)}for(;a<i&&(u=j(s=n._(e,r),u),s.status);a+=1)r=s.index,o.push(s.value);return j(w(r,o),u)}))},e.prototype.result=function(e){return this.map((function(){return e}))},e.prototype.atMost=function(e){return this.times(0,e)},e.prototype.atLeast=function(t){return e.seq(this.times(t),this.many()).map((function(e){return Object(n.__spreadArrays)(e[0],e[1])}))},e.prototype.map=function(t){var r=this;return new e((function(e,n){var i=r._(e,n);return i.status?j(w(i.index,t(i.value)),i):i}))},e.prototype.skip=function(e){return O(0,this,e)},e.prototype.mark=function(){return e.seq(e.index,this,e.index).map((function(e){return{start:e[0],value:e[1],end:e[2]}}))},e.prototype.node=function(t){return e.seq(e.index,this,e.index).map((function(e){return{name:t,start:e[0],value:e[1],end:e[2]}}))},e.prototype.sepBy=function(t){return e.sepBy(this,t)},e.prototype.sepBy1=function(t){return e.sepBy1(this,t)},e.prototype.lookahead=function(t){return this.skip(e.lookahead(t))},e.prototype.notFollowedBy=function(t){return this.skip(e.notFollowedBy(t))},e.prototype.desc=function(t){var r=this;return new e((function(e,n){var i=r._(e,n);return i.status||(i.expected=[t]),i}))},e.prototype.fallback=function(t){return this.or(e.succeed(t))},e.prototype.ap=function(t){return e.seq(t,this).map((function(e){return(0,e[0])(e[1])}))},e.prototype.chain=function(t){var r=this;return new e((function(e,n){var i=r._(e,n);return i.status?j(t(i.value)._(e,i.index),i):i}))},e}();function O(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=t.length;return new x((function(r,i){for(var a,o,s=i,u=0;u<n;u++){if(!(a=j(t[u]._(r,s),a)).status)return a;e===u&&(o=a.value),s=a.index}return j(w(s,o),a)}))}function w(e,t){return{status:!0,index:e,value:t}}function C(e,t){return{status:!1,furthest:e,expected:[t]}}function j(e,t){if(!t||e.status||t.status||e.furthest>t.furthest)return e;var r=e.furthest===t.furthest?function(e,t){var r=e.length,n=t.length;if(0===r)return t;if(0===n)return e;for(var i=new Set,a=[],o=0;o<r;o++)i.has(e[o])||(a[a.length]=e[o],i.add(e[o]));for(o=0;o<n;o++)i.has(t[o])||(a[a.length]=t[o],i.add(t[o]));return a.sort(),a}(e.expected,t.expected):t.expected;return{status:e.status,furthest:t.furthest,expected:r}}function P(e,t){var r=e.slice(0,t).split("\n");return{offset:t,line:r.length,column:r[r.length-1].length+1}}!function(e){function t(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.length;return new e((function(e,r){for(var i,a=new Array(n),o=r,s=0;s<n;s++){if(!(i=j(t[s]._(e,o),i)).status)return i;a[s]=i.value,o=i.index}return j(w(o,a),i)}))}function r(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var n=t.length;return 0===n?u("zero alternates"):new e((function(e,r){for(var n,i=0;i<t.length;i++)if((n=j(t[i]._(e,r),n)).status)return n;return n}))}function i(e,r){return t(e,r.then(e).many()).map((function(e){return Object(n.__spreadArrays)([e[0]],e[1])}))}function a(t){var r="'"+t+"'";if(1===t.length){var n=t.charCodeAt(0);return new e((function(e,i){return e.charCodeAt(i)===n?w(i+1,t):C(i,r)}))}return new e((function(e,n){var i=n+t.length;return e.slice(n,i)===t?w(i,t):C(n,r)}))}function o(t,r){void 0===r&&(r=0);var n=function(e){return RegExp("^(?:"+e.source+")",function(e){var t=""+e;return t.slice(t.lastIndexOf("/")+1)}(e))}(t),i=""+t;return new e((function(e,t){var a=n.exec(e.slice(t));if(a){if(0<=r&&r<=a.length){var o=a[0],s=a[r];return w(t+o.length,s)}return C(t,"invalid match group (0 to "+a.length+") in "+i)}return C(t,i)}))}function s(t){return new e((function(e,r){return w(r,t)}))}function u(t){return new e((function(e,r){return C(r,t)}))}function c(t){return new e((function(e,r){var n=e.charAt(r);return r<e.length&&t(n)?w(r+1,n):C(r,"a character "+t)}))}e.seq=t,e.alt=r,e.sepBy=function(e,t){return i(e,t).or(s([]))},e.sepBy1=i,e.string=a,e.regexp=o,e.succeed=s,e.fail=u,e.lookahead=function t(r){if(r instanceof x)return new e((function(e,t){var n=r._(e,t);return n.status&&(n.index=t,n.value=null),n}));if("string"==typeof r)return t(a(r));if(r instanceof RegExp)return t(o(r));throw new Error("not a string, regexp, or parser: "+r)},e.notFollowedBy=function(t){return new e((function(e,r){var n=t._(e,r);return n.status?C(r,'not "'+e.slice(r,n.index)+'"'):w(r,null)}))},e.test=c,e.oneOf=function(e){return c((function(t){return e.indexOf(t)>=0}))},e.noneOf=function(e){return c((function(t){return e.indexOf(t)<0}))},e.range=function(e,t){return c((function(r){return e<=r&&r<=t})).desc(e+"-"+t)},e.takeWhile=function(t){return new e((function(e,r){for(var n=r;n<e.length&&t(e.charAt(n));)n++;return w(n,e.slice(r,n))}))},e.lazy=function(t){var r=new e((function(e,n){var i=t()._;return r._=i,i(e,n)}));return r},e.empty=function(){return u("empty")},e.index=new e((function(e,t){return w(t,P(e,t))})),e.anyChar=new e((function(e,t){return t>=e.length?C(t,"any character"):w(t+1,e.charAt(t))})),e.all=new e((function(e,t){return w(e.length,e.slice(t))})),e.eof=new e((function(e,t){return t<e.length?C(t,"EOF"):w(t,null)})),e.digit=o(/[0-9]/).desc("a digit"),e.digits=o(/[0-9]*/).desc("optional digits"),e.letter=o(/[a-z]/i).desc("a letter"),e.letters=o(/[a-z]*/i).desc("optional letters"),e.optWhitespace=o(/\s*/).desc("optional whitespace"),e.whitespace=o(/\s+/).desc("whitespace"),e.cr=a("\r"),e.lf=a("\n"),e.crlf=a("\r\n"),e.newline=r(e.crlf,e.lf,e.cr).desc("newline"),e.end=r(e.newline,e.eof)}(x||(x={})),function(e){var t;!function(e){e.str=function(e){return{kind:"string",value:e}},e.symb=function(e){return{kind:"symbol",value:e}},e.list=function(e,t){return{kind:"list",bracket:e,nodes:t}},e.comment=function(e){return{kind:"comment",value:e}}}(t||(t={}));var r=x.regexp(/[\n\r\s]*/),n=x.lazy((function(){return x.alt(i,p,o,s).trim(r)})),i=x.takeWhile((function(e){return"`"!==e})).trim("`").map(t.str),o=x.regexp(/[^()\[\]{};`,\n\r\s]+/).map(t.symb),s=x.regexp(/\s*;+([^\n\r]*)\n/,1).map(t.comment),u=n.many(),c=u.wrap("(",")").map((function(e){return t.list("(",e)})),d=u.wrap("[","]").map((function(e){return t.list("[",e)})),f=u.wrap("{","}").map((function(e){return t.list("{",e)})),p=x.alt(c,d,f),m=n.many();function h(e){switch(e.kind){case"string":return e.value;case"symbol":var t=e.value;if(t.length>1)switch(t.charAt(0)){case".":return l.MolScriptBuilder.atomName(t.substr(1));case"_":return l.MolScriptBuilder.struct.type.elementSymbol([t.substr(1)])}return"true"===t||"false"!==t&&(function(e){return/-?(0|[1-9][0-9]*)([.][0-9]+)?([eE][+-]?[0-9]+)?/.test(e)&&!isNaN(+e)}(t)?+t:a.a.Symbol(t));case"list":switch(e.bracket){case"[":return l.MolScriptBuilder.core.type.list(g(e.nodes).map(h));case"{":return l.MolScriptBuilder.core.type.set(g(e.nodes).map(h));case"(":var r=h(e.nodes[0]);return a.a.Apply(r,function(e){if(e.length<=1)return;if(!function(e){for(var t=1,r=e.length;t<r;t++){var n=e[t];if("symbol"===n.kind&&n.value.length>1&&":"===n.value.charAt(0))return!0}return!1}(e)){for(var t=[],r=1,n=e.length;r<n;r++){"comment"!==(s=e[r]).kind&&(t[t.length]=h(s))}return t}var i={},a=!0,o=0;for(r=1,n=e.length;r<n;r++){var s;if("comment"!==(s=e[r]).kind)if("symbol"===s.kind&&s.value.length>1&&":"===s.value.charAt(0)){var u=s.value.substr(1);for(++r;r<n&&"comment"===e[r].kind;)r++;if(r>=n)throw new Error("There must be a value foolowed a named arg ':"+u+"'.");i[u]=h(e[r]),isNaN(+u)&&(a=!1)}else i[o++]=h(s)}if(a){var c=Object.keys(i).map((function(e){return+e})).sort((function(e,t){return e-t})),l=!0;for(r=0,n=c.length;r<n;r++)if(c[r]!==r){l=!1;break}if(l){var d=[];for(r=0,n=c.length;r<n;r++)d[r]=i[r];return d}}return i}(e.nodes))}return 0;default:throw new Error("should not happen")}}function g(e){for(var t=!1,r=0,n=e.length;r<n;r++)if("comment"===e[r].kind){t=!0;break}return t?e.filter((function(e){return"comment"!==e.kind})):e}e.parse=function(e){for(var t=[],r=0,n=function(e){return m.tryParse(e)}(e);r<n.length;r++){var i=n[r];"comment"!==i.kind&&(t[t.length]=h(i))}return t}}(S||(S={}));var E=r(4),A=r(169);function D(e,t){return{expression:e,language:t}}!function(e){function t(e){switch(e.language){case"mol-script":var t=(r=e.expression,S.parse(r));if(0===t.length)throw new Error("No query");return _(t[0])}var r;throw new Error("unsupported script language")}function r(e){var r=t(e);return Object(A.compile)(r)}e.is=function(e){return!!e&&"string"==typeof e.expression&&!!e.language},e.areEqual=function(e,t){return e.language===t.language&&e.expression===t.expression},e.toExpression=t,e.toQuery=r,e.toLoci=function(e,t){var n=r(e)(new E.QueryContext(t));return E.StructureSelection.toLociWithSourceUnits(n)},e.getStructureSelection=function(e,t,r){var n="function"==typeof e?e(l.MolScriptBuilder):e;return Object(A.compile)(n)(new E.QueryContext(t,r))}}(D||(D={}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return c.b})),r.d(t,"a",(function(){return l.a})),r.d(t,"b",(function(){return l.b})),r.d(t,"d",(function(){return i}));var n=r(331);function i(e){for(var t=e.data,r=e.encoding.length-1;r>=0;r--)t=a(t,e.encoding[r]);return t}function a(e,t){switch(t.kind){case"ByteArray":switch(t.type){case 4:return e;case 1:return function(e){return new Int8Array(e.buffer,e.byteOffset)}(e);case 2:return function(e){return u(e,2,Int16Array)}(e);case 5:return function(e){return u(e,2,Uint16Array)}(e);case 3:return function(e){return u(e,4,Int32Array)}(e);case 6:return function(e){return u(e,4,Uint32Array)}(e);case 32:return function(e){return u(e,4,Float32Array)}(e);case 33:return function(e){return u(e,8,Float64Array)}(e);default:throw new Error("Unsupported ByteArray type.")}case"FixedPoint":return function(e,t){for(var r=e.length,n=s(t.srcType,r),i=1/t.factor,a=0;a<r;a++)n[a]=i*e[a];return n}(e,t);case"IntervalQuantization":return function(e,t){for(var r=e.length,n=s(t.srcType,r),i=(t.max-t.min)/(t.numSteps-1),a=t.min,o=0;o<r;o++)n[o]=a+i*e[o];return n}(e,t);case"RunLength":return function(e,t){for(var r=o(t.srcType,t.srcSize),n=0,i=0,a=e.length;i<a;i+=2)for(var s=e[i],u=e[i+1],c=0;c<u;++c)r[n++]=s;return r}(e,t);case"Delta":return function(e,t){var r=e.length,n=o(t.srcType,r);if(!r)return e;n[0]=e[0]+(0|t.origin);for(var i=1;i<r;++i)n[i]=e[i]+n[i-1];return n}(e,t);case"IntegerPacking":return function(e,t){return e.length===t.srcSize?e:t.isUnsigned?function(e,t){var r=1===t.byteCount?255:65535,n=e.length,i=new Int32Array(t.srcSize),a=0,o=0;for(;a<n;){for(var s=0,u=e[a];u===r;)s+=u,a++,u=e[a];s+=u,i[o]=s,a++,o++}return i}(e,t):function(e,t){var r=1===t.byteCount?127:32767,n=-r-1,i=e.length,a=new Int32Array(t.srcSize),o=0,s=0;for(;o<i;){for(var u=0,c=e[o];c===r||c===n;)u+=c,o++,c=e[o];u+=c,a[s]=u,o++,s++}return a}(e,t)}(e,t);case"StringArray":return function(e,t){var r=i({encoding:t.offsetEncoding,data:t.offsets}),n=i({encoding:t.dataEncoding,data:e}),a=t.stringData,o=new Array(r.length);o[0]="";for(var s=1,u=r.length;s<u;s++)o[s]=a.substring(r[s-1],r[s]);var c=0,l=new Array(n.length);for(s=0,u=n.length;s<u;s++)l[c++]=o[n[s]+1];return l}(e,t)}}function o(e,t){switch(e){case 1:return new Int8Array(t);case 2:return new Int16Array(t);case 3:return new Int32Array(t);case 4:return new Uint8Array(t);case 5:return new Uint16Array(t);case 6:return new Uint32Array(t);default:throw new Error("Unsupported integer data type.")}}function s(e,t){switch(e){case 32:return new Float32Array(t);case 33:return new Float64Array(t);default:throw new Error("Unsupported floating data type.")}}function u(e,t,r){return n.a?new r(e.buffer):new r(Object(n.b)(e,t))}var c=r(262),l=r(109);r(268)},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(0),i=r(25),a=r(201),o=r(9),s=r(254),u=function(){function e(e){this.minDist=[],this.maxDist=[],this.extrema=[],this.centroidHelper=new a.a,this.dir=function(e){var t;switch(e){case"6":t=Object(n.__spreadArrays)(c);break;case"14":t=Object(n.__spreadArrays)(c,l);break;case"26":t=Object(n.__spreadArrays)(c,l,d);break;case"98":t=Object(n.__spreadArrays)(c,l,d,f,p,m)}return t.map((function(e){var t=i.f.create(e[0],e[1],e[2]);return i.f.normalize(t,t)}))}(e),this.reset()}return e.prototype.computeExtrema=function(e,t){var r=i.f.dot(this.dir[e],t);r<this.minDist[e]&&(this.minDist[e]=r,i.f.copy(this.extrema[2*e],t)),r>this.maxDist[e]&&(this.maxDist[e]=r,i.f.copy(this.extrema[2*e+1],t))},e.prototype.computeSphereExtrema=function(e,t,r){var n=i.f.dot(this.dir[e],t);n-r<this.minDist[e]&&(this.minDist[e]=n-r,i.f.scaleAndSub(this.extrema[2*e],t,this.dir[e],r)),n+r>this.maxDist[e]&&(this.maxDist[e]=n+r,i.f.scaleAndAdd(this.extrema[2*e+1],t,this.dir[e],r))},e.prototype.includeSphere=function(e){if(o.g.hasExtrema(e)&&e.extrema.length>1)for(var t=0,r=e.extrema;t<r.length;t++){var n=r[t];this.includePosition(n)}else this.includePositionRadius(e.center,e.radius)},e.prototype.includePosition=function(e){for(var t=0,r=this.dir.length;t<r;++t)this.computeExtrema(t,e)},e.prototype.includePositionRadius=function(e,t){for(var r=0,n=this.dir.length;r<n;++r)this.computeSphereExtrema(r,e,t)},e.prototype.finishedIncludeStep=function(){for(var e=0;e<this.extrema.length;e++)this.centroidHelper.includeStep(this.extrema[e]);this.centroidHelper.finishedIncludeStep()},e.prototype.radiusSphere=function(e){if(o.g.hasExtrema(e)&&e.extrema.length>1)for(var t=0,r=e.extrema;t<r.length;t++){var n=r[t];this.radiusPosition(n)}else this.radiusPositionRadius(e.center,e.radius)},e.prototype.radiusPosition=function(e){this.centroidHelper.radiusStep(e)},e.prototype.radiusPositionRadius=function(e,t){this.centroidHelper.radiusSphereStep(e,t)},e.prototype.getSphere=function(e){return o.g.setExtrema(this.centroidHelper.getSphere(e),Object(n.__spreadArrays)(this.extrema))},e.prototype.getBox=function(e){return s.a.fromVec3Array(e||Object(s.a)(),this.extrema)},e.prototype.reset=function(){for(var e=0,t=this.dir.length;e<t;++e)this.minDist[e]=1/0,this.maxDist[e]=-1/0,this.extrema[2*e]=Object(i.f)(),this.extrema[2*e+1]=Object(i.f)();this.centroidHelper.reset()},e}();var c=[[1,0,0],[0,1,0],[0,0,1]],l=[[1,1,1],[-1,1,1],[-1,-1,1],[1,-1,1]],d=[[1,1,0],[1,-1,0],[1,0,1],[1,0,-1],[0,1,1],[0,1,-1]],f=[[0,1,2],[0,2,1],[1,0,2],[2,0,1],[1,2,0],[2,1,0],[0,1,-2],[0,2,-1],[1,0,-2],[2,0,-1],[1,-2,0],[2,-1,0]],p=[[1,1,2],[2,1,1],[1,2,1],[1,-1,2],[1,1,-2],[1,-1,-2],[2,-1,1],[2,1,-1],[2,-1,-1],[1,-2,1],[1,2,-1],[1,-2,-1]],m=[[2,2,1],[1,2,2],[2,1,2],[2,-2,1],[2,2,-1],[2,-2,-1],[1,-2,2],[1,2,-2],[1,-2,-2],[2,-1,2],[2,1,-2],[2,-1,-2]]},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"c",(function(){return d}));var n=r(58),i=r(1),a=r(52),o=r(24);function s(e,t,r,n){for(var i=t;i<r;++i)o.Color.toArray(n,e,4*i),e[4*i+3]=255;return!0}function u(e,t,r){return e.fill(0,4*t,4*r),!0}function c(e,t){var r=Object(a.c)(Math.max(1,e),4,Uint8Array,t&&t.tOverpaint.ref.value.array);return t?(n.b.update(t.tOverpaint,r),n.b.update(t.uOverpaintTexDim,i.Vec2.create(r.width,r.height)),n.b.updateIfChanged(t.dOverpaint,e>0),t):{tOverpaint:n.b.create(r),uOverpaintTexDim:n.b.create(i.Vec2.create(r.width,r.height)),dOverpaint:n.b.create(e>0)}}var l={array:new Uint8Array(4),width:1,height:1};function d(e){return e?(n.b.update(e.tOverpaint,l),n.b.update(e.uOverpaintTexDim,i.Vec2.create(1,1)),e):{tOverpaint:n.b.create(l),uOverpaintTexDim:n.b.create(i.Vec2.create(1,1)),dOverpaint:n.b.create(!1)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"e",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"c",(function(){return d}));var n=r(58),i=r(1),a=r(52);function o(e,t,r,n){for(var i=t;i<r;++i)e[i]=255*n;return!0}function s(e,t){for(var r=0,n=0;n<t;++n)r+=e[n];return r/(255*t)}function u(e,t,r){e.fill(0,t,r)}function c(e,t){var r=Object(a.c)(Math.max(1,e),1,Uint8Array,t&&t.tTransparency.ref.value.array);return t?(n.b.update(t.tTransparency,r),n.b.update(t.uTransparencyTexDim,i.Vec2.create(r.width,r.height)),n.b.updateIfChanged(t.dTransparency,e>0),n.b.updateIfChanged(t.transparencyAverage,s(r.array,e)),t):{tTransparency:n.b.create(r),uTransparencyTexDim:n.b.create(i.Vec2.create(r.width,r.height)),dTransparency:n.b.create(e>0),transparencyAverage:n.b.create(0)}}var l={array:new Uint8Array(1),width:1,height:1};function d(e){return e?(n.b.update(e.tTransparency,l),n.b.update(e.uTransparencyTexDim,i.Vec2.create(1,1)),e):{tTransparency:n.b.create(l),uTransparencyTexDim:n.b.create(i.Vec2.create(1,1)),dTransparency:n.b.create(!1),transparencyAverage:n.b.create(0)}}},function(e,t,r){"use strict";function n(e){return e&&"function"==typeof e.schedule}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return l})),r.d(t,"b",(function(){return d}));var n=r(0),i=r(5),a=r(1),o=r(52),s=r(117),u=r(125),c=r(180);function l(e,t,r){switch(u.a.getGranularity(e,t.granularity)){case"uniform":return function(e,t,r){return function(e,t){return t?(i.e.update(t.uSize,e),i.e.updateIfChanged(t.dSizeType,"uniform"),t):Object(n.__assign)(Object(n.__assign)({uSize:i.e.create(e)},{tSize:i.e.create(f),uSizeTexDim:i.e.create(a.Vec2.create(1,1))}),{dSizeType:i.e.create("uniform")})}(t(s.b),r)}(0,t.size,r);case"group":return function(e,t,r){var n=e.groupCount,i=Object(o.c)(Math.max(1,n),3,Uint8Array,r&&r.tSize.ref.value.array);e.reset();for(;e.hasNext&&!e.isNextNewInstance;){var a=e.move();Object(c.b)(100*t(a.location),i.array,3*a.groupIndex)}return p(i,"group",r)}(e,t.size,r);case"groupInstance":return function(e,t,r){var n=e.groupCount,i=e.instanceCount*n,a=Object(o.c)(Math.max(1,i),3,Uint8Array,r&&r.tSize.ref.value.array);e.reset();for(;e.hasNext;){var s=e.move();Object(c.b)(100*t(s.location),a.array,3*s.index)}return p(a,"groupInstance",r)}(e,t.size,r);case"instance":return function(e,t,r){var n=e.instanceCount,i=Object(o.c)(Math.max(1,n),3,Uint8Array,r&&r.tSize.ref.value.array);e.reset();for(;e.hasNext&&!e.isNextNewInstance;){var a=e.move();Object(c.b)(100*t(a.location),i.array,3*a.instanceIndex),e.skipInstance()}return p(i,"instance",r)}(e,t.size,r)}}function d(e){switch(e.dSizeType.ref.value){case"uniform":return e.uSize.ref.value;case"instance":case"group":case"groupInstance":for(var t=0,r=e.tSize.ref.value.array,n=0,i=r.length;n<i;n+=3){var a=Object(c.a)(r[n],r[n+1],r[n+2]);t<a&&(t=a)}return t/100}}var f={array:new Uint8Array(3),width:1,height:1};function p(e,t,r){return r?(i.e.update(r.tSize,e),i.e.update(r.uSizeTexDim,a.Vec2.create(e.width,e.height)),i.e.updateIfChanged(r.dSizeType,t),r):{uSize:i.e.create(0),tSize:i.e.create(e),uSizeTexDim:i.e.create(a.Vec2.create(e.width,e.height)),dSizeType:i.e.create(t)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(145),a=r(157);!function(e){e.Descriptor={name:"index_pair_bonds"},e.Provider=a.a.create(e.Descriptor),e.fromData=function(e){var t=e.pairs,r=e.count;return function(e,t,r,n){for(var a=new i.a.EdgeBuilder(n,e,t),o=new Int8Array(a.slotCount),s=new Array(a.slotCount),u=new Array(a.slotCount),c=0,l=a.edgeCount;c<l;c++)a.addNextEdge(),a.assignProperty(o,r.order?r.order[c]:1),a.assignProperty(s,r.distance?r.distance[c]:-1),a.assignProperty(u,r.flag?r.flag[c]:1);return a.createGraph({order:o,distance:s,flag:u})}(t.indexA.toArray(),t.indexB.toArray(),{order:t.order&&t.order.toArray(),distance:t.distance&&t.distance.toArray(),flag:t.flag&&t.flag.toArray()},r)}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(25),a=r(70),o=r(5);function s(e){return 0}function u(e){return function(t){return e[t]}}function c(e){return 0===e[3]&&0===e[7]&&0===e[11]&&1===e[15]}function l(e,t){var r=e.matrix,n=t.x,i=t.y,a=t.z,o=r[0],s=r[4],u=r[8],l=r[12];return c(r)?function(e){return o*n[e]+s*i[e]+u*a[e]+l}:function(e){var t=n[e],c=i[e],d=a[e],f=r[3]*t+r[7]*c+r[11]*d+r[15]||1;return(o*t+s*c+u*d+l)/f}}function d(e,t){var r=e.matrix,n=t.x,i=t.y,a=t.z,o=r[1],s=r[5],u=r[9],l=r[13];return c(r)?function(e){return o*n[e]+s*i[e]+u*a[e]+l}:function(e){var t=n[e],c=i[e],d=a[e],f=r[3]*t+r[7]*c+r[11]*d+r[15]||1;return(o*t+s*c+u*d+l)/f}}function f(e,t){var r=e.matrix,n=t.x,i=t.y,a=t.z,o=r[2],s=r[6],u=r[10],l=r[14];return c(r)?function(e){return o*n[e]+s*i[e]+u*a[e]+l}:function(e){var t=n[e],c=i[e],d=a[e],f=r[3]*t+r[7]*c+r[11]*d+r[15]||1;return(o*t+s*c+u*d+l)/f}}!function(e){function t(t,r,n){var a=n||{},s=a.assembly,u=a.ncsId,c=a.hkl,l=a.spgrOp,d=c?i.f.clone(c):i.f.zero();l=Object(o.h)(l,-1),u=u||-1;var f=function(e){if(!e)return"";if(e.assembly)return"_"+e.assembly.operId;if(void 0!==e.spgrOp&&void 0!==e.hkl&&-1!==e.spgrOp){var t=e.hkl,r=t[0],n=t[1],i=t[2];return"-"+(e.spgrOp+1)+"_"+(5+r)+(5+n)+(5+i)}if(-1!==e.ncsId)return"_"+e.ncsId;return""}(n);if(i.c.isIdentity(r))return{name:t,assembly:s,matrix:r,inverse:i.c.identity(),isIdentity:!0,hkl:d,spgrOp:l,ncsId:u,suffix:f};if(!i.c.isRotationAndTranslation(r,e.RotationTranslationEpsilon))throw new Error("Symmetry operator ("+t+") must be a composition of rotation and translation.");return{name:t,assembly:s,matrix:r,inverse:i.c.invert(i.c.zero(),r),isIdentity:!1,hkl:d,spgrOp:l,ncsId:u,suffix:f}}e.DefaultName="1_555",e.Default=t(e.DefaultName,i.c.identity()),e.RotationTranslationEpsilon=.005,e.create=t,e.checkIfRotationAndTranslation=function(t,r){for(var n=i.c.identity(),a=0;a<3;a++)for(var o=0;o<3;o++)i.c.setValue(n,a,o,i.b.getValue(t,a,o));return i.c.setTranslation(n,r),i.c.isRotationAndTranslation(n,e.RotationTranslationEpsilon)},e.ofRotationAndOffset=function(e,r,n,a){for(var o=i.c.identity(),s=0;s<3;s++)for(var u=0;u<3;u++)i.c.setValue(o,s,u,i.b.getValue(r,s,u));return i.c.setTranslation(o,n),t(e,o,{ncsId:a})};var r=i.d.identity(),n=i.d.zero(),p=i.d.zero(),m=i.f.zero();e.lerpFromIdentity=function(e,t,a){var o=t.inverse;if(t.isIdentity)return i.c.copy(e,o);var s=1-a;i.c.getRotation(n,o),i.d.slerp(n,r,n,s);var u=i.d.getAxisAngle(m,n);return i.c.fromRotation(e,u,m),i.c.setValue(e,0,3,s*i.c.getValue(o,0,3)),i.c.setValue(e,1,3,s*i.c.getValue(o,1,3)),i.c.setValue(e,2,3,s*i.c.getValue(o,2,3)),e},e.slerp=function(e,t,r,o){if(Math.abs(o)<=1e-5)return i.c.copy(e,t);if(Math.abs(o-1)<=1e-5)return i.c.copy(e,r);i.c.getRotation(n,t),i.c.getRotation(p,r),i.d.slerp(p,n,p,o);var s=i.d.getAxisAngle(m,p);return i.c.fromRotation(e,s,m),i.c.setValue(e,0,3,Object(a.b)(i.c.getValue(t,0,3),i.c.getValue(r,0,3),o)),i.c.setValue(e,1,3,Object(a.b)(i.c.getValue(t,1,3),i.c.getValue(r,1,3),o)),i.c.setValue(e,2,3,Object(a.b)(i.c.getValue(t,2,3),i.c.getValue(r,2,3),o)),e},e.compose=function(e,r){var n=i.c.mul(i.c.zero(),r.matrix,e.matrix);return t(r.name,n,r)},e.createMapping=function(t,r,n){var i=e.createCoordinateMapper(e.Default,r),a=t.isIdentity?i:e.createCoordinateMapper(t,r),o=function(e,t){return e.isIdentity?{x:u(t.x),y:u(t.y),z:u(t.z)}:{x:l(e,t),y:d(e,t),z:f(e,t)}}(t,r);return{operator:t,coordinates:r,invariantPosition:i,position:a,x:o.x,y:o.y,z:o.z,r:n||s}},e.createCoordinateMapper=function(e,t){return e.isIdentity?(n=(r=t).x,a=r.y,o=r.z,function(e,t){return t[0]=n[e],t[1]=a[e],t[2]=o[e],t}):function(e,t){var r=e.matrix,n=t.x,a=t.y,o=t.z;if(c(r))return function(e,t){var i=n[e],s=a[e],u=o[e];return t[0]=r[0]*i+r[4]*s+r[8]*u+r[12],t[1]=r[1]*i+r[5]*s+r[9]*u+r[13],t[2]=r[2]*i+r[6]*s+r[10]*u+r[14],t};return function(e,t){return t[0]=n[e],t[1]=a[e],t[2]=o[e],i.f.transformMat4(t,t,r),t}}(e,t);var r,n,a,o}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return f}));var n=r(368),i=r(94),a=r(290),o=r(5),s=r(369),u=r(4),c=r(2),l={bfactorFactor:c.ParamDefinition.Numeric(.1,{min:0,max:1,step:.01}),rmsfFactor:c.ParamDefinition.Numeric(.05,{min:0,max:1,step:.01}),baseSize:c.ParamDefinition.Numeric(.2,{min:0,max:2,step:.1})};function d(e,t,r){return u.Unit.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t)*r.bfactorFactor:u.Unit.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]*r.rmsfFactor:0}var f,p,m={name:"uncertainty",label:"Uncertainty/Disorder",category:"",factory:function e(t,r){return{factory:e,granularity:"group",size:function(e){var t=r.baseSize;return u.StructureElement.Location.is(e)?t+=d(e.unit,e.element,r):u.Bond.isLocation(e)&&(t+=d(e.aUnit,e.aUnit.elements[e.aIndex],r)),t},props:r,description:"Assigns a size reflecting the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique."}},getParams:function(e){return l},defaultValues:c.ParamDefinition.getDefaultValues(l),isApplicable:function(e){return!!e.structure&&e.structure.models.some((function(e){return e.atomicConformation.B_iso_or_equiv.isDefined||e.coarseHierarchy.isDefined}))}};(p=f||(f={})).EmptyFactory=function(){return p.Empty},p.Empty={factory:p.EmptyFactory,granularity:"uniform",size:function(){return 1},props:{}},p.areEqual=function(e,t){return e.factory===t.factory&&Object(o.g)(e.props,t.props)},p.EmptyProvider={name:"",label:"",category:"",factory:p.EmptyFactory,getParams:function(){return{}},defaultValues:{},isApplicable:function(){return!0}},p.createRegistry=function(){return new i.b(p.BuiltIn,p.EmptyProvider)},p.BuiltIn={physical:a.b,"shape-group":s.b,uncertainty:m,uniform:n.b}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s})),r.d(t,"c",(function(){return u})),r.d(t,"d",(function(){return l}));var n=r(58),i=r(1),a=r(52);function o(e,t,r,n){for(var i=t;i<r;++i)e[i]=n;return!0}function s(e,t,r){e.fill(0,t,r)}function u(e,t){var r=Object(a.c)(Math.max(1,e),1,Uint8Array,t&&t.tClipping.ref.value.array);return t?(n.b.update(t.tClipping,r),n.b.update(t.uClippingTexDim,i.Vec2.create(r.width,r.height)),n.b.updateIfChanged(t.dClipping,e>0),t):{dClipObjectCount:n.b.create(0),dClipVariant:n.b.create("instance"),tClipping:n.b.create(r),uClippingTexDim:n.b.create(i.Vec2.create(r.width,r.height)),dClipping:n.b.create(e>0)}}var c={array:new Uint8Array(1),width:1,height:1};function l(e){return e?(n.b.update(e.tClipping,c),n.b.update(e.uClippingTexDim,i.Vec2.create(1,1)),e):{dClipObjectCount:n.b.create(0),dClipVariant:n.b.create("instance"),tClipping:n.b.create(c),uClippingTexDim:n.b.create(i.Vec2.create(1,1)),dClipping:n.b.create(!1)}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return c})),r.d(t,"c",(function(){return f}));var n=r(1),i=Object(n.Vec3)(),a=Object(n.Vec3)(),o=Object(n.Vec3)();function s(e,t){for(var r=t.length,s=c(r/3),u=0;u<r;u+=3)n.Vec3.fromArray(i,e,3*t[u]),n.Vec3.fromArray(a,e,3*t[u+1]),n.Vec3.fromArray(o,e,3*t[u+2]),s.add(i,a,o);return s.getPrimitive()}var u=Object(n.Vec3)();function c(e,t){void 0===t&&(t=3*e);var r=new Float32Array(3*t),i=new Float32Array(3*t),a=new Uint32Array(3*e),o=0,s=0;return{add:function(e,t,c){n.Vec3.toArray(e,r,o),n.Vec3.toArray(t,r,o+3),n.Vec3.toArray(c,r,o+6),n.Vec3.triangleNormal(u,e,t,c);for(var l=0;l<3;++l)n.Vec3.toArray(u,i,o+3*l),a[s+l]=o/3+l;o+=9,s+=3},addQuad:function(e,t,c,l){n.Vec3.toArray(e,r,o),n.Vec3.toArray(t,r,o+3),n.Vec3.toArray(c,r,o+6),n.Vec3.toArray(l,r,o+9),n.Vec3.triangleNormal(u,e,t,c);for(var d=0;d<4;++d)n.Vec3.toArray(u,i,o+3*d);var f=o/3;a[s]=f,a[s+1]=f+1,a[s+2]=f+2,a[s+3]=f+2,a[s+4]=f+3,a[s+5]=f,o+=12,s+=6},getPrimitive:function(){return{vertices:r,normals:i,indices:a}}}}var l=Object(n.Vec3)(),d=Object(n.Mat3)();function f(e,t){for(var r=e.vertices,i=e.normals,a=n.Mat3.directionTransform(d,t),o=0,s=r.length;o<s;o+=3)n.Vec3.transformMat4(l,n.Vec3.fromArray(l,r,o),t),n.Vec3.toArray(l,r,o),n.Vec3.transformMat3(l,n.Vec3.fromArray(l,i,o),a),n.Vec3.toArray(l,i,o);return e}},function(e,t,r){"use strict";t.a="\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nvoid main(void) {\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n"},function(e,t,r){"use strict";var n={};r.r(n),r.d(n,"Location",(function(){return a.a})),r.d(n,"Loci",(function(){return o.a})),r.d(n,"Bundle",(function(){return s.a})),r.d(n,"Stats",(function(){return i})),r.d(n,"property",(function(){return d})),r.d(n,"atomicProperty",(function(){return p})),r.d(n,"coarseProperty",(function(){return m})),r.d(n,"residueIndex",(function(){return h})),r.d(n,"chainIndex",(function(){return g})),r.d(n,"entityIndex",(function(){return v}));var i,a=r(93),o=r(282),s=r(352),u=r(6),c=r(37);!function(e){function t(){return{elementCount:0,conformationCount:0,residueCount:0,chainCount:0,unitCount:0,structureCount:0,firstElementLoc:a.a.create(void 0),firstConformationLoc:a.a.create(void 0),firstResidueLoc:a.a.create(void 0),firstChainLoc:a.a.create(void 0),firstUnitLoc:a.a.create(void 0),firstStructureLoc:a.a.create(void 0)}}function r(e,t,r){var n=e.get(t)||0;e.set(t,n+r)}function n(e,t,n){var i=n.indices,o=n.unit,s=o.elements,l=u.OrderedSet.size(i),d=new Map,f=new Map;if(l>0&&a.a.set(e.firstElementLoc,t,o,s[u.OrderedSet.start(i)]),l===s.length)e.unitCount+=1,1===e.unitCount&&a.a.set(e.firstUnitLoc,t,o,s[u.OrderedSet.start(i)]);else if(1===l){if(c.a.Traits.is(o.traits,1))return;e.elementCount+=1,1===e.elementCount&&a.a.set(e.firstElementLoc,t,o,s[u.OrderedSet.start(i)])}else if(c.a.isAtomic(o))for(var p=o.model.atomicHierarchy.residueAtomSegments,m=p.index,h=p.offsets,g=o.model.atomicHierarchy.atoms.label_alt_id,v=0,b=function(){d.clear();var n=0,c=s[u.OrderedSet.getAt(i,v)],p=m[c];for(r(d,g.value(c),1),++v,++n;v<l;){var b=s[u.OrderedSet.getAt(i,v)];if(m[b]!==p)break;r(d,g.value(b),1),++v,++n}if(h[p+1]-h[p]===n)e.residueCount+=1,1===e.residueCount&&a.a.set(e.firstResidueLoc,t,o,h[p]);else{f.clear();for(var y=h[p],_=h[p+1];y<_;++y)r(f,g.value(y),1);f.get("")===d.get("")&&d.forEach((function(r,i){if(f.get(i)===r){if(""!==i&&(e.conformationCount+=1,1===e.conformationCount))for(var s=h[p],u=h[p+1];s<u;++s)if(i===g.value(s)){a.a.set(e.firstConformationLoc,t,o,s);break}n-=r}})),e.elementCount+=n}};v<l;)b();else e.elementCount+=l,1===e.elementCount&&a.a.set(e.firstElementLoc,t,o,s[u.OrderedSet.start(i)])}function i(e,t,r){var n=r.indices,i=r.unit,o=u.OrderedSet.size(n);if(0!==o){var s=i.elements;if(c.a.Traits.is(i.traits,1)){var l=c.a.isAtomic(i)?i.model.atomicHierarchy.chainAtomSegments:c.a.isSpheres(i)?i.model.coarseHierarchy.spheres.chainElementSegments:c.a.isGaussians(i)?i.model.coarseHierarchy.gaussians.chainElementSegments:void 0;if(l)for(var d=l.index,f=l.offsets,p=0;p<o;){var m=0,h=d[s[u.OrderedSet.getAt(n,p)]];for(++p,++m;p<o;){if(d[s[u.OrderedSet.getAt(n,p)]]!==h)break;++p,++m}f[h+1]-f[h]===m&&(e.chainCount+=1,1===e.chainCount&&a.a.set(e.firstChainLoc,t,i,f[h]))}else console.warn("StructureElement loci stats: unknown unit type")}else o===s.length&&(e.chainCount+=1,1===e.chainCount&&a.a.set(e.firstChainLoc,t,i,s[u.OrderedSet.start(n)]))}}function s(e,t,n,i,o){var s=n[i],l=c.a.isAtomic(s.unit)?s.unit.model.atomicHierarchy.chainAtomSegments:c.a.isSpheres(s.unit)?s.unit.model.coarseHierarchy.spheres.chainElementSegments:c.a.isGaussians(s.unit)?s.unit.model.coarseHierarchy.gaussians.chainElementSegments:void 0;if(l){for(var d=l.index,f=l.offsets,p=new Map,m=i;m<o;m++){var h=(s=n[m]).indices,g=s.unit;if(0!==(x=u.OrderedSet.size(h))){var v=g.elements;if(c.a.Traits.is(g.traits,1))for(var b=0;b<x;){var y=0,_=d[O=v[u.OrderedSet.getAt(h,b)]];for(++b,++y;b<x;){if(d[v[u.OrderedSet.getAt(h,b)]]!==_)break;++b,++y}r(p,_,y)}else r(p,d[O=v[u.OrderedSet.start(h)]],v.length)}}var S=-1;if(p.forEach((function(t,r){f[r+1]-f[r]===t&&(e.chainCount+=1,1===e.chainCount&&(S=r))})),!(S<0))for(m=i;m<o;m++){var x;h=(s=n[m]).indices,g=s.unit;if(0!==(x=u.OrderedSet.size(h)))for(v=g.elements,b=0;b<x;){var O;if((_=d[O=v[u.OrderedSet.getAt(h,b)]])===S)return void a.a.set(e.firstChainLoc,t,g,O)}}}else console.warn("StructureElement loci stats: unknown unit type")}e.create=t,e.ofLoci=function(e){var r=t();if(o.a.isEmpty(e))return r;var l=!1;if(o.a.isWholeStructure(e)){if(r.structureCount+=1,1===r.structureCount){var d=e.elements[0],f=d.unit,p=d.indices;a.a.set(r.firstStructureLoc,e.structure,f,f.elements[u.OrderedSet.min(p)])}}else for(var m=0,h=e.elements;m<h.length;m++){var g=h[m];n(r,e.structure,g),c.a.Traits.is(g.unit.traits,2)?l=!0:i(r,e.structure,g)}if(l)for(var v=0,b=e.elements.length;v<b;v++){g=e.elements[v];if(c.a.Traits.is(g.unit.traits,2)){for(var y=v;v<b&&c.a.areSameChainOperatorGroup(e.elements[v].unit,g.unit);)v++;var _=v;v--,_-y==1?i(r,e.structure,g):s(r,e.structure,e.elements,y,_)}}return r},e.add=function(e,t,r){return 1===t.elementCount&&0===r.elementCount?a.a.copy(e.firstElementLoc,t.firstElementLoc):0===t.elementCount&&1===r.elementCount&&a.a.copy(e.firstElementLoc,r.firstElementLoc),1===t.conformationCount&&0===r.conformationCount?a.a.copy(e.firstConformationLoc,t.firstConformationLoc):0===t.conformationCount&&1===r.conformationCount&&a.a.copy(e.firstConformationLoc,r.firstConformationLoc),1===t.residueCount&&0===r.residueCount?a.a.copy(e.firstResidueLoc,t.firstResidueLoc):0===t.residueCount&&1===r.residueCount&&a.a.copy(e.firstResidueLoc,r.firstResidueLoc),1===t.chainCount&&0===r.chainCount?a.a.copy(e.firstChainLoc,t.firstChainLoc):0===t.chainCount&&1===r.chainCount&&a.a.copy(e.firstChainLoc,r.firstChainLoc),1===t.unitCount&&0===r.unitCount?a.a.copy(e.firstUnitLoc,t.firstUnitLoc):0===t.unitCount&&1===r.unitCount&&a.a.copy(e.firstUnitLoc,r.firstUnitLoc),1===t.structureCount&&0===r.structureCount?a.a.copy(e.firstStructureLoc,t.firstStructureLoc):0===t.structureCount&&1===r.structureCount&&a.a.copy(e.firstStructureLoc,r.firstStructureLoc),e.elementCount=t.elementCount+r.elementCount,e.conformationCount=t.conformationCount+r.conformationCount,e.residueCount=t.residueCount+r.residueCount,e.chainCount=t.chainCount+r.chainCount,e.unitCount=t.unitCount+r.unitCount,e.structureCount=t.structureCount+r.structureCount,e}}(i||(i={}));var l=r(176);function d(e){return e}function f(e){throw new Error("Property only available for "+e+" models.")}function p(e){return function(t){return c.a.isAtomic(t.unit)?e(t):f("atomic")}}function m(e){return function(t){return c.a.isCoarse(t.unit)?e(t):f("coarse")}}function h(e){return c.a.isAtomic(e.unit)?e.unit.residueIndex[e.element]:-1}function g(e){return c.a.isAtomic(e.unit)?e.unit.chainIndex[e.element]:-1}function v(e){return l.a.entity.key(e)}t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(23),i=r(24),a=r(4),o=r(126);function s(e){return{layers:e}}!function(e){function t(e){return 0===e.layers.length}e.Empty={layers:[]},e.areEqual=function(e,t){if(0===e.layers.length&&0===t.layers.length)return!0;if(e.layers.length!==t.layers.length)return!1;for(var r=0,i=e.layers.length;r<i;++r){if(e.layers[r].clear!==t.layers[r].clear)return!1;if(e.layers[r].color!==t.layers[r].color)return!1;if(!n.Loci.areEqual(e.layers[r].loci,t.layers[r].loci))return!1}return!0},e.isEmpty=t,e.remap=function(e,t){for(var r=[],n=0,i=e.layers;n<i.length;n++){var o=i[n],s=o.loci,u=o.color,c=o.clear;s=a.StructureElement.Loci.remap(s,t),a.StructureElement.Loci.isEmpty(s)||r.push({loci:s,color:u,clear:c})}return{layers:r}},e.merge=function(e){if(t(e))return e;for(var r=e.layers[0].loci.structure,n=new Map,o=a.StructureElement.Loci.none(r),s=0,u=e.layers.length;s<u;++s){var c=e.layers[u-s-1],l=c.loci,d=c.color,f=c.clear;if(l=a.StructureElement.Loci.subtract(l,o),o=a.StructureElement.Loci.union(l,o),!a.StructureElement.Loci.isEmpty(l)){var p=f?-1:d;n.has(p)&&(l=a.StructureElement.Loci.union(l,n.get(p))),n.set(p,l)}}var m=[];return n.forEach((function(e,t){var r=-1===t,n=-1===t?Object(i.Color)(0):t;m.push({loci:e,color:n,clear:r})})),{layers:m}},e.filter=function(e,r){if(t(e))return e;for(var n=e.layers[0].loci.structure,i=[],o=0,s=e.layers;o<s.length;o++){var u=s[o],c=u.loci,l=u.color,d=u.clear,f=a.StructureElement.Loci.remap(c,r);c=a.StructureElement.Loci.remap(f,n),a.StructureElement.Loci.isEmpty(c)||i.push({loci:c,color:l,clear:d})}return{layers:i}},e.ofScript=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var s=e[n],u=s.script,c=s.color,l=s.clear,d=o.Script.toLoci(u,t);a.StructureElement.Loci.isEmpty(d)||r.push({loci:d,color:c,clear:l})}return{layers:r}},e.ofBundle=function(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var o=e[n],s=o.bundle,u=o.color,c=o.clear,l=a.StructureElement.Bundle.toLoci(s,t.root);r.push({loci:l,color:u,clear:c})}return{layers:r}},e.toBundle=function(e){for(var t=[],r=0,n=e.layers.length;r<n;++r){var i=e.layers[r],o=i.loci,s=i.color,u=i.clear,c=a.StructureElement.Bundle.fromLoci(o);t.push({bundle:c,color:s,clear:u})}return{layers:t}}}(s||(s={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(23),i=r(4),a=r(126);function o(e){return{layers:e}}!function(e){function t(e){return 0===e.layers.length}e.Empty={layers:[]},e.areEqual=function(e,t){if(0===e.layers.length&&0===t.layers.length)return!0;if(e.layers.length!==t.layers.length)return!1;for(var r=0,i=e.layers.length;r<i;++r){if(e.layers[r].value!==t.layers[r].value)return!1;if(!n.Loci.areEqual(e.layers[r].loci,t.layers[r].loci))return!1}return!0},e.isEmpty=t,e.remap=function(e,t){for(var r=[],n=0,a=e.layers;n<a.length;n++){var o=a[n],s=o.loci,u=o.value;s=i.StructureElement.Loci.remap(s,t),i.StructureElement.Loci.isEmpty(s)||r.push({loci:s,value:u})}return{layers:r}},e.merge=function(e){if(t(e))return e;for(var r=e.layers[0].loci.structure,n=new Map,a=i.StructureElement.Loci.none(r),o=0,s=e.layers.length;o<s;++o){var u=e.layers[s-o-1],c=u.loci,l=u.value;c=i.StructureElement.Loci.subtract(c,a),a=i.StructureElement.Loci.union(c,a),i.StructureElement.Loci.isEmpty(c)||(n.has(l)&&(c=i.StructureElement.Loci.union(c,n.get(l))),n.set(l,c))}var d=[];return n.forEach((function(e,t){d.push({loci:e,value:t})})),{layers:d}},e.filter=function(e,r){if(t(e))return e;for(var n=e.layers[0].loci.structure,a=[],o=0,s=e.layers;o<s.length;o++){var u=s[o],c=u.loci,l=u.value,d=i.StructureElement.Loci.remap(c,r);c=i.StructureElement.Loci.remap(d,n),i.StructureElement.Loci.isEmpty(c)||a.push({loci:c,value:l})}return{layers:a}},e.ofScript=function(e,t){for(var r=[],n=0,o=e.length;n<o;++n){var s=e[n],u=s.script,c=s.value,l=a.Script.toLoci(u,t);i.StructureElement.Loci.isEmpty(l)||r.push({loci:l,value:c})}return{layers:r}},e.ofBundle=function(e,t){for(var r=[],n=0,a=e.length;n<a;++n){var o=e[n],s=o.bundle,u=o.value,c=i.StructureElement.Bundle.toLoci(s,t.root);r.push({loci:c,value:u})}return{layers:r}},e.toBundle=function(e){for(var t=[],r=0,n=e.layers.length;r<n;++r){var a=e.layers[r],o=a.loci,s=a.value,u=i.StructureElement.Bundle.fromLoci(o);t.push({bundle:u,value:s})}return{layers:t}}}(o||(o={}))},function(e,t,r){"use strict";var n;!function(e){function t(e){return!!e&&!!e.head&&"object"==typeof e}function r(e){return!!e&&"string"==typeof e.name}e.Symbol=function(e){return{name:e}},e.Apply=function(e,t){return t?{head:e,args:t}:{head:e}},e.isArgumentsArray=function(e){return!!e&&Array.isArray(e)},e.isArgumentsMap=function(e){return!!e&&!Array.isArray(e)},e.isLiteral=function(e){return!t(e)&&!r(e)},e.isApply=t,e.isSymbol=r}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return a}));var n=r(45),i=new n.a((function(e){return e.complete()}));function a(e){return e?function(e){return new n.a((function(t){return e.schedule((function(){return t.complete()}))}))}(e):i}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(2),o=r(5),s=r(53),u=r(115),c=r(132),l=r(124),d=r(47),f=r(9),p=r(52),m=r(24),h=r(1),g=r(393),v=r(70),b=r(30),y=r(129),_=r(130),S=r(12),x=r(122),O=r(136);function w(e,t,r,n){for(var i=0,a=0,o=0,s=4*r;o<s;++o){var u=2*o,c=Math.abs(e[u]);c>i&&(i=c);var l=Math.abs(e[u+1]);l>i&&(i=l);var d=Math.abs(t[o]);d>a&&(a=d)}return Math.max(a,n+n*i)}!function(e){function t(e,t,r,i,a,s,u,c,l){return l?function(e,t,r,n,i,a,s,u,c){return c.charCount=u,o.e.update(c.fontTexture,e),o.e.update(c.centerBuffer,t),o.e.update(c.mappingBuffer,r),o.e.update(c.depthBuffer,n),o.e.update(c.indexBuffer,i),o.e.update(c.groupBuffer,a),o.e.update(c.tcoordBuffer,s),c}(e,t,r,i,a,s,u,c,l):function(e,t,r,i,a,s,u,c){var l,d=Object(f.g)(),m=-1,h=-1,g={kind:"text",charCount:c,fontTexture:o.e.create(e),centerBuffer:o.e.create(t),mappingBuffer:o.e.create(r),depthBuffer:o.e.create(i),indexBuffer:o.e.create(a),groupBuffer:o.e.create(s),tcoordBuffer:o.e.create(u),get boundingSphere(){var e=n(g);if(e!==m){var t=Object(p.a)(g.centerBuffer.ref.value,4*g.charCount,4);f.g.copy(d,t),m=e}return d},get groupMapping(){return g.groupBuffer.ref.version!==h&&(l=Object(x.c)(g.groupBuffer.ref.value,g.charCount,4),h=g.groupBuffer.ref.version),l},setBoundingSphere:function(e){f.g.copy(d,e),m=n(g)}};return g}(e,t,r,i,a,s,u,c)}function r(e){return t(e?e.fontTexture.ref.value:Object(p.c)(0,1,Uint8Array),e?e.centerBuffer.ref.value:new Float32Array(0),e?e.mappingBuffer.ref.value:new Float32Array(0),e?e.depthBuffer.ref.value:new Float32Array(0),e?e.indexBuffer.ref.value:new Uint32Array(0),e?e.groupBuffer.ref.value:new Float32Array(0),e?e.tcoordBuffer.ref.value:new Float32Array(0),0,e)}function n(e){return Object(S.l)([e.charCount,e.fontTexture.ref.version,e.centerBuffer.ref.version,e.mappingBuffer.ref.version,e.depthBuffer.ref.version,e.indexBuffer.ref.version,e.groupBuffer.ref.version,e.tcoordBuffer.ref.version])}function C(e,t){var r=4*e.charCount,n=t.instanceCount.ref.value,i=Object(s.b)(),a=i.position,o=e.centerBuffer.ref.value,u=t.aTransform.ref.value;return Object(s.a)(r,n,4,(function(e,t){return t<0?h.Vec3.fromArray(a,o,3*e):h.Vec3.transformMat4Offset(a,o,u,0,3*e,16*t),i}))}function j(e,t,r,n,a){var s=r.instanceCount,d=r.groupCount;if(s!==t.instanceCount.ref.value)throw new Error("instanceCount values in TransformData and LocationIterator differ");var g=C(e,t),S=Object(u.a)(r,g,n.color),x=Object(c.a)(r,n.size),j=Object(l.a)(s*d),P=Object(y.c)(),E=Object(_.c)(),A=Object(O.d)(),D={drawCount:2*e.charCount*3,vertexCount:4*e.charCount,groupCount:d,instanceCount:s},T=w(e.mappingBuffer.ref.value,e.depthBuffer.ref.value,e.charCount,Object(c.b)(x)),I=f.g.expand(Object(f.g)(),e.boundingSphere,T),M=Object(p.b)(I,t.aTransform.ref.value,s);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({aPosition:e.centerBuffer,aMapping:e.mappingBuffer,aDepth:e.depthBuffer,aGroup:e.groupBuffer,elements:e.indexBuffer,boundingSphere:o.e.create(M),invariantBoundingSphere:o.e.create(I),uInvariantBoundingSphere:o.e.create(h.Vec4.ofSphere(I))},S),x),j),P),E),A),t),{aTexCoord:e.tcoordBuffer,tFont:e.fontTexture,padding:o.e.create(T)}),b.a.createValues(a,D)),{uSizeFactor:o.e.create(a.sizeFactor),uBorderWidth:o.e.create(Object(v.a)(a.borderWidth/2,0,.5)),uBorderColor:o.e.create(m.Color.toArrayNormalized(a.borderColor,h.Vec3.zero(),0)),uOffsetX:o.e.create(a.offsetX),uOffsetY:o.e.create(a.offsetY),uOffsetZ:o.e.create(a.offsetZ),uBackgroundColor:o.e.create(m.Color.toArrayNormalized(a.backgroundColor,h.Vec3.zero(),0)),uBackgroundOpacity:o.e.create(a.backgroundOpacity)})}function P(e,t){b.a.updateRenderableState(e,t),e.pickable=!1,e.opaque=!1,e.writeDepth=!0}e.create=t,e.createEmpty=r,e.Params=Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},b.a.Params),g.a),{sizeFactor:a.ParamDefinition.Numeric(1,{min:0,max:10,step:.1}),borderWidth:a.ParamDefinition.Numeric(0,{min:0,max:.5,step:.01}),borderColor:a.ParamDefinition.Color(d.a.grey),offsetX:a.ParamDefinition.Numeric(0,{min:0,max:10,step:.1}),offsetY:a.ParamDefinition.Numeric(0,{min:0,max:10,step:.1}),offsetZ:a.ParamDefinition.Numeric(0,{min:0,max:10,step:.1}),background:a.ParamDefinition.Boolean(!1),backgroundMargin:a.ParamDefinition.Numeric(.2,{min:0,max:1,step:.01}),backgroundColor:a.ParamDefinition.Color(d.a.grey),backgroundOpacity:a.ParamDefinition.Numeric(1,{min:0,max:1,step:.01}),tether:a.ParamDefinition.Boolean(!1),tetherLength:a.ParamDefinition.Numeric(1,{min:0,max:5,step:.1}),tetherBaseWidth:a.ParamDefinition.Numeric(.3,{min:0,max:1,step:.01}),attachment:a.ParamDefinition.Select("middle-center",[["bottom-left","bottom-left"],["bottom-center","bottom-center"],["bottom-right","bottom-right"],["middle-left","middle-left"],["middle-center","middle-center"],["middle-right","middle-right"],["top-left","top-left"],["top-center","top-center"],["top-right","top-right"]])}),e.Utils={Params:e.Params,createEmpty:r,createValues:j,createValuesSimple:function(t,r,n,o,s){var u=b.a.createSimple(n,o,s),c=Object(i.__assign)(Object(i.__assign)({},a.ParamDefinition.getDefaultValues(e.Params)),r);return j(t,u.transform,u.locationIterator,u.theme,c)},updateValues:function(e,t){b.a.updateValues(e,t),o.e.updateIfChanged(e.uSizeFactor,t.sizeFactor),o.e.updateIfChanged(e.uBorderWidth,t.borderWidth),m.Color.fromNormalizedArray(e.uBorderColor.ref.value,0)!==t.borderColor&&(m.Color.toArrayNormalized(t.borderColor,e.uBorderColor.ref.value,0),o.e.update(e.uBorderColor,e.uBorderColor.ref.value));o.e.updateIfChanged(e.uOffsetX,t.offsetX),o.e.updateIfChanged(e.uOffsetY,t.offsetY),o.e.updateIfChanged(e.uOffsetZ,t.offsetZ),m.Color.fromNormalizedArray(e.uBackgroundColor.ref.value,0)!==t.backgroundColor&&(m.Color.toArrayNormalized(t.backgroundColor,e.uBackgroundColor.ref.value,0),o.e.update(e.uBackgroundColor,e.uBackgroundColor.ref.value));o.e.updateIfChanged(e.uBackgroundOpacity,t.backgroundOpacity)},updateBoundingSphere:function(e,t){var r=w(e.aMapping.ref.value,e.aDepth.ref.value,t.charCount,Object(c.b)(e)),n=f.g.expand(Object(f.g)(),t.boundingSphere,r),i=Object(p.b)(n,e.aTransform.ref.value,e.instanceCount.ref.value);f.g.equals(i,e.boundingSphere.ref.value)||o.e.update(e.boundingSphere,i);f.g.equals(n,e.invariantBoundingSphere.ref.value)||(o.e.update(e.invariantBoundingSphere,n),o.e.update(e.uInvariantBoundingSphere,h.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,n)));o.e.update(e.padding,r)},createRenderableState:function(e){var t=b.a.createRenderableState(e);return P(t,e),t},updateRenderableState:P,createPositionIterator:C}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(12),a=r(6);!function(e){e.areEqual=function(e,t){if(e===t)return!0;if(e.vertexCount!==t.vertexCount||e.edgeCount!==t.edgeCount)return!1;for(var r=e.a,n=e.b,i=e.offset,a=t.a,o=t.b,s=t.offset,u=0,c=e.a.length;u<c;u++)if(r[u]!==a[u])return!1;for(u=0,c=e.b.length;u<c;u++)if(n[u]!==o[u])return!1;for(u=0,c=e.offset.length;u<c;u++)if(i[u]!==s[u])return!1;for(var l=0,d=Object.keys(e.edgeProps);l<d.length;l++){var f=d[l],p=e.edgeProps[f],m=t.edgeProps[f];if(!m)return!1;for(u=0,c=p.length;u<c;u++)if(p[u]!==m[u])return!1}return!0};var t=function(){function e(e,t,r,n,i,a){this.offset=e,this.a=t,this.b=r,this.edgeCount=n,this.props=a,this.vertexCount=e.length-1,this.edgeProps=i||{}}return e.prototype.getEdgeIndex=function(e,t){var r,n;e<t?(r=e,n=t):(r=t,n=e);for(var i=this.offset[r],a=this.offset[r+1];i<a;i++)if(this.b[i]===n)return i;return-1},e.prototype.getDirectedEdgeIndex=function(e,t){for(var r=this.offset[e],n=this.offset[e+1];r<n;r++)if(this.b[r]===t)return r;return-1},e.prototype.getVertexEdgeCount=function(e){return this.offset[e+1]-this.offset[e]},e}();function r(e,r,n,i,a,o){return new t(e,r,n,i,a,o)}e.create=r;var n=function(){function e(e,t,r){this.vertexCount=e,this.xs=t,this.ys=r,this.current=0,this.curA=0,this.curB=0,this.edgeCount=t.length,this.offsets=new Int32Array(this.vertexCount+1),this.bucketFill=new Int32Array(this.vertexCount);for(var n=new Int32Array(this.vertexCount),i=0,a=this.xs.length;i<a;i++)n[this.xs[i]]++;for(i=0,a=this.ys.length;i<a;i++)n[this.ys[i]]++;var o=0;for(i=0;i<this.vertexCount;i++)this.offsets[i]=o,o+=n[i];this.offsets[this.vertexCount]=o,this.slotCount=o,this.a=new Int32Array(o),this.b=new Int32Array(o)}return e.prototype.createGraph=function(e,t){return r(this.offsets,this.a,this.b,this.edgeCount,e,t)},e.prototype.addNextEdge=function(){var e=this.xs[this.current],t=this.ys[this.current],r=this.offsets[e]+this.bucketFill[e],n=this.offsets[t]+this.bucketFill[t];this.a[r]=e,this.b[r]=t,this.bucketFill[e]++,this.a[n]=t,this.b[n]=e,this.bucketFill[t]++,this.current++,this.curA=r,this.curB=n},e.prototype.addAllEdges=function(){for(var e=0;e<this.edgeCount;e++)this.addNextEdge()},e.prototype.assignProperty=function(e,t){e[this.curA]=t,e[this.curB]=t},e}();e.EdgeBuilder=n;var o=function(){function e(e,t,r){this.vertexCount=e,this.xs=t,this.ys=r,this.current=0,this.curA=0,this.edgeCount=t.length,this.offsets=new Int32Array(this.vertexCount+1),this.bucketFill=new Int32Array(this.vertexCount);for(var n=new Int32Array(this.vertexCount),i=0,a=this.xs.length;i<a;i++)n[this.xs[i]]++;var o=0;for(i=0;i<this.vertexCount;i++)this.offsets[i]=o,o+=n[i];this.offsets[this.vertexCount]=o,this.slotCount=o,this.a=new Int32Array(o),this.b=new Int32Array(o)}return e.prototype.createGraph=function(e){return r(this.offsets,this.a,this.b,this.edgeCount,e)},e.prototype.addNextEdge=function(){var e=this.xs[this.current],t=this.ys[this.current],r=this.offsets[e]+this.bucketFill[e];this.a[r]=e,this.b[r]=t,this.bucketFill[e]++,this.current++,this.curA=r},e.prototype.addAllEdges=function(){for(var e=0;e<this.edgeCount;e++)this.addNextEdge()},e.prototype.assignProperty=function(e,t){e[this.curA]=t},e}();e.DirectedEdgeBuilder=o;var s=function(){function e(e){this.vertexCount=e,this.xs=[],this.ys=[],this.included=new Set}return e.prototype.addEdge=function(e,t){var r=e,n=t;e>t&&(r=t,n=e);var a=Object(i.f)(r,n);return!this.included.has(a)&&(this.included.add(a),this.xs[this.xs.length]=r,this.ys[this.ys.length]=n,!0)},e.prototype.getGraph=function(){return u(this.vertexCount,this.xs,this.ys)},e.prototype.getEdgeBuiler=function(){return new n(this.vertexCount,this.xs,this.ys)},e}();function u(t,r,n){var i=new e.EdgeBuilder(t,r,n);return i.addAllEdges(),i.createGraph({})}e.UniqueEdgeBuilder=s,e.fromVertexPairs=u,e.induceByVertices=function(e,t){for(var n=e.b,a=e.offset,o=e.vertexCount,s=e.edgeProps,u=new Int32Array(o),c=0,l=t.length;c<l;c++)u[t[c]]=c+1;var d=0;for(c=0;c<o;c++)if(0!==u[c])for(var f=a[c],p=a[c+1];f<p;f++)n[f]>c&&0!==u[n[f]]&&d++;var m=new Int32Array(t.length+1),h=new Int32Array(2*d),g=new Int32Array(2*d),v=new Int32Array(2*d),b=0,y=0;for(c=0;c<o;c++)if(0!==u[c]){var _=u[c]-1;for(f=a[c],p=a[c+1];f<p;f++){var S=u[n[f]];0!==S&&(g[b]=_,v[b]=S-1,h[b]=f,b++)}m[++y]=b}for(var x={},O=0,w=Object.keys(s);O<w.length;O++){var C=w[O];x[C]=Object(i.d)(s[C],h)}return r(m,g,v,d,x)},e.connectedComponents=function(e){var t=e.vertexCount;if(0===t)return{componentCount:0,componentIndex:new Int32Array(0)};if(0===e.edgeCount){for(var r=new Int32Array(t),n=0,i=t;n<i;n++)r[n]=n;return{componentCount:t,componentIndex:r}}var o=new Int32Array(t);for(n=0,i=t;n<i;n++)o[n]=-1;var s=0;o[0]=s;var u=e.offset,c=e.b,l=[0],d=Object(a.LinkedIndex)(t);for(d.remove(0);l.length>0;){for(var f=l.pop(),p=o[f],m=u[f],h=u[f+1];m<h;m++){var g=c[m];d.has(g)&&(d.remove(g),l.push(g),o[g]=p)}0===l.length&&d.head>=0&&(l.push(d.head),o[d.head]=++s,d.remove(d.head))}return{componentCount:t,componentIndex:o}},e.areVertexSetsConnected=function(e,t,r,n){if(a.SortedArray.areIntersecting(t,r))return!0;if(n<1)return!1;for(var i=new Set,o=0,s=t.length;o<s;++o)i.add(t[o]);return function e(t,r,n,i,o){for(var s=t.b,u=t.offset,c=[],l=0,d=r.length;l<d;++l)for(var f=r[l],p=u[f],m=u[f+1];p<m;++p){var h=s[p];if(!o.has(h)){if(a.SortedArray.has(n,h))return!0;o.add(h),c[c.length]=h}}return i>1&&e(t,c,n,i-1,o)}(e,t,r,n,i)}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),function(e,n){r.d(t,"Canvas3DParams",(function(){return B})),r.d(t,"DefaultCanvas3DParams",(function(){return V})),r.d(t,"Canvas3DContext",(function(){return i})),r.d(t,"Canvas3D",(function(){return R}));var i,a=r(0),o=r(245),s=r(75),u=r(1),c=r(90),l=r(404),d=r(405),f=r(105),p=r(293),m=r(41),h=r(271),g=r(23),v=r(172),b=r(2),y=r(339),_=r(96),S=r(414),x=r(174),O=r(228),w=r(376),C=r(415),j=r(9),P=r(48),E=r(242),A=r(158),D=r(340),T=r(276),I=r(416),M=r(417),k=r(5),B={camera:b.ParamDefinition.Group({mode:b.ParamDefinition.Select("perspective",b.ParamDefinition.arrayToOptions(["perspective","orthographic"]),{label:"Camera"}),helper:b.ParamDefinition.Group(E.b,{isFlat:!0}),stereo:b.ParamDefinition.MappedStatic("off",{on:b.ParamDefinition.Group(T.b),off:b.ParamDefinition.Group({})},{cycle:!0,hideIf:function(e){return"perspective"!==(null==e?void 0:e.mode)}}),manualReset:b.ParamDefinition.Boolean(!1,{isHidden:!0})},{pivot:"mode"}),cameraFog:b.ParamDefinition.MappedStatic("on",{on:b.ParamDefinition.Group({intensity:b.ParamDefinition.Numeric(15,{min:1,max:100,step:1})}),off:b.ParamDefinition.Group({})},{cycle:!0,description:"Show fog in the distance"}),cameraClipping:b.ParamDefinition.Group({radius:b.ParamDefinition.Numeric(100,{min:0,max:99,step:1},{label:"Clipping",description:"How much of the scene to show."}),far:b.ParamDefinition.Boolean(!0,{description:"Hide scene in the distance"})},{pivot:"radius"}),viewport:b.ParamDefinition.MappedStatic("canvas",{canvas:b.ParamDefinition.Group({}),custom:b.ParamDefinition.Group({x:b.ParamDefinition.Numeric(0),y:b.ParamDefinition.Numeric(0),width:b.ParamDefinition.Numeric(128),height:b.ParamDefinition.Numeric(128)})}),cameraResetDurationMs:b.ParamDefinition.Numeric(250,{min:0,max:1e3,step:1},{description:"The time it takes to reset the camera."}),transparentBackground:b.ParamDefinition.Boolean(!1),multiSample:b.ParamDefinition.Group(O.b),postprocessing:b.ParamDefinition.Group(x.b),renderer:b.ParamDefinition.Group(l.a),trackball:b.ParamDefinition.Group(d.b),debug:b.ParamDefinition.Group(y.b),handle:b.ParamDefinition.Group(D.b)},V=b.ParamDefinition.getDefaultValues(B);!function(e){var t={antialias:!0,preserveDrawingBuffer:!0,pixelScale:1,pickScale:.25,enableWboit:!0};e.fromCanvas=function(e,r){void 0===r&&(r={});var n=Object(a.__assign)(Object(a.__assign)({},t),r),i=n.antialias,u=n.preserveDrawingBuffer,l=n.pixelScale,d=Object(p.d)(e,{antialias:i,preserveDrawingBuffer:u,alpha:!0,depth:!0,premultipliedAlpha:!0});if(null===d)throw new Error("Could not create a WebGL rendering context");var f=c.c.fromElement(e,{pixelScale:l}),m=Object(p.b)(d,{pixelScale:l}),h=new M.a(m,r);if(P.a){var g=d.getExtension("WEBGL_lose_context");g&&e.addEventListener("mousedown",(function(e){m.isContextLost||e.shiftKey&&e.ctrlKey&&e.altKey&&(P.a&&console.log("lose context"),g.loseContext(),setTimeout((function(){m.isContextLost&&(P.a&&console.log("restore context"),g.restoreContext())}),1e3))}),!1)}var v=new o.a(0),b=function(e){m.setContextLost(),e.preventDefault(),P.a&&console.log("context lost"),v.next(Object(s.b)())},y=function(){m.isContextLost&&(m.handleContextRestored((function(){h.draw.reset()})),P.a&&console.log("context restored"))};return e.addEventListener("webglcontextlost",b,!1),e.addEventListener("webglcontextrestored",y,!1),{canvas:e,webgl:m,input:f,passes:h,attribs:n,contextLost:v,contextRestored:m.contextRestored,dispose:function(t){f.dispose(),e.removeEventListener("webglcontextlost",b,!1),e.removeEventListener("webglcontextrestored",y,!1),m.destroy(t)}}}}(i||(i={}));var R,L="undefined"!=typeof window?window.requestAnimationFrame:function(t){return e((function(){return t(Date.now())}))},N="undefined"!=typeof window?window.cancelAnimationFrame:function(e){return n(e)};!function(e){e.create=function(e,t){var r=e.webgl,n=e.input,i=e.passes,c=e.attribs;void 0===t&&(t={});var p=Object(a.__assign)(Object(a.__assign)({},V),t),b=new Map,y=new Map,x=new o.a(0),E=Object(s.b)(),D=new o.a(0),M=new o.a(0),B=r.gl,R=r.contextRestored,F=0,U=0,z=128,H=128;we();var G=h.a.create(r),q=new v.a({position:u.Vec3.create(0,0,100),mode:p.camera.mode,fog:"on"===p.cameraFog.name?p.cameraFog.params.intensity:0,clipFar:p.cameraClipping.far},{x:F,y:U,width:z,height:H},{pixelScale:c.pixelScale}),W=new T.a(q,p.camera.stereo.params),X=d.a.create(n,q,p.trackball),Y=l.b.create(r,p.renderer),Q=new I.a(r,G,p),K=new w.a(r,Y,G,Q,i.pick,{x:F,y:U,width:z,height:H}),Z=new S.a(me,ae,n,q),J=new O.a(i.multiSample),$=!1,ee=!1,te=void 0,re=void 0,ne=!1,ie=!0;function ae(e){var t=g.EmptyLoci,r=m.a.Empty;return e&&(t=Q.handle.getLoci(e),b.forEach((function(n,i){var a=i.getLoci(e);Object(g.isEmptyLoci)(a)||(Object(g.isEmptyLoci)(t)||console.warn("found another loci, this should not happen"),t=a,r=i)}))),{loci:t,repr:r}}var oe=!1,se=!1,ue=0;function ce(e){(function(e){if(r.isContextLost)return!1;var t=!1;if(ne&&(Oe(!1),ne=!1,t=!0),F>B.drawingBufferWidth||F+z<0||U>B.drawingBufferHeight||U+H<0)return!1;var n=!1;X.update(ue);var a=q.update(),o=J.update(e||a,p.multiSample);if(t||e||a||o){var s=q;"on"===p.camera.stereo.name&&(W.update(),s=W),O.c.isEnabled(p.multiSample)?J.render(Y,s,G,Q,!0,p.transparentBackground,p):i.draw.render(Y,s,G,Q,!0,p.transparentBackground,p.postprocessing),K.dirty=!0,n=!0}return n})(!!e||oe)&&ie&&D.next(Object(s.b)()-E),oe=!1,$=!1}function le(e){$||($=!0,oe=!!e)}var de=0;function fe(e,t){ue=e,he(null==t?void 0:t.isSynchronous),q.transition.tick(ue),(null==t?void 0:t.manualDraw)||(ce(!1),q.transition.inTransition||r.isContextLost||Z.tick(ue))}function pe(){fe(Object(s.b)()),de=L(pe)}function me(e,t){var n="on"===p.camera.stereo.name?W:q;return r.isContextLost?void 0:K.identify(e,t,n)}function he(e){void 0===e&&(e=!1),function(e){if(!G.needsCommit)return!0;if(j.g.copy(ge,G.boundingSphereVisible),!G.commit(e?void 0:250))return!1;Q.debug.isEnabled&&Q.debug.update();p.camera.manualReset||0!==x.value&&!function(){if(0===q.state.radiusMax)return!0;if(q.transition.inTransition||re)return!1;var e=!0;j.g.set(ve,q.state.target,q.state.radius);for(var t=0,r=G.renderables;t<r.length;t++){var n=r[t];if(n.state.visible){var i=n.values.boundingSphere.ref.value;if(i.radius){var a=u.Vec3.distance(ve.center,i.center);if((a>ve.radius||a>i.radius||i.radius>q.state.radiusMax)&&!j.g.includes(ge,i))return!0;j.g.overlaps(ve,i)&&(e=!1)}}}return e}()||(ee=!0);0===ge.radius&&(te=0);q.setState({radiusMax:G.boundingSphere.radius},0),x.next(b.size),P.a&&be();return!0}(e)&&(!function(){if(!ee)return;var e=G.boundingSphereVisible,t=e.center,r=e.radius;if(r>0){var n=void 0===te?p.cameraResetDurationMs:te,i=q.getFocus(t,r),o=re?Object(a.__assign)(Object(a.__assign)({},i),re):i;q.setState(Object(a.__assign)(Object(a.__assign)({},o),{radiusMax:G.boundingSphere.radius}),n)}te=void 0,re=void 0,ee=!1}(),se&&(Q.debug.isEnabled&&Q.debug.update(),ce(!0),se=!1),M.next(Object(s.b)()))}var ge=Object(j.g)(),ve=Object(j.g)();function be(){console.table(G.renderables.map((function(e){return{drawCount:e.values.drawCount.ref.value,instanceCount:e.values.instanceCount.ref.value,materialId:e.materialId,renderItemId:e.id}}))),console.log(r.stats);var e=r.resources.getByteCounts(),t=e.texture,n=e.attribute,i=e.elements;console.log({texture:(t/1024/1024).toFixed(3)+" MiB",attribute:(n/1024/1024).toFixed(3)+" MiB",elements:(i/1024/1024).toFixed(3)+" MiB"})}function ye(e){!function(e){if(y.has(e))return;y.set(e,e.updated.subscribe((function(t){e.state.syncManually||ye(e)})))}(e);var t=b.get(e),r=new Set;e.renderObjects.forEach((function(e){return r.add(e)})),t?_.a.areEqual(r,t)||(r.forEach((function(e){t.has(e)||G.add(e)})),t.forEach((function(e){r.has(e)||G.remove(e)}))):e.renderObjects.forEach((function(e){return G.add(e)})),b.set(e,r),G.update(e.renderObjects,!1),se=!0,P.a&&be()}function _e(){var e=G.boundingSphere.radius>0?100-Math.round(q.transition.target.radius/G.boundingSphere.radius*100):0;return{camera:{mode:q.state.mode,helper:Object(a.__assign)({},Q.camera.props),stereo:Object(a.__assign)({},p.camera.stereo),manualReset:!!p.camera.manualReset},cameraFog:q.state.fog>0?{name:"on",params:{intensity:q.state.fog}}:{name:"off",params:{}},cameraClipping:{far:q.state.clipFar,radius:e},cameraResetDurationMs:p.cameraResetDurationMs,transparentBackground:p.transparentBackground,viewport:p.viewport,postprocessing:Object(a.__assign)({},p.postprocessing),multiSample:Object(a.__assign)({},p.multiSample),renderer:Object(a.__assign)({},Y.props),trackball:Object(a.__assign)({},X.props),debug:Object(a.__assign)({},Q.debug.props),handle:Object(a.__assign)({},Q.handle.props)}}var Se=R.subscribe((function(){K.dirty=!0,ce(!0),ce(!0)})),xe=new o.a(0);function Oe(e){void 0===e&&(e=!0),i.updateSize(),we(),Ce(),e&&le(!0),xe.next(+new Date)}return{webgl:r,add:ye,remove:function(e){!function(e){var t=y.get(e);t&&(t.unsubscribe(),y.delete(e))}(e);var t=b.get(e);t&&(t.forEach((function(e){return G.remove(e)})),b.delete(e),se=!0,P.a&&be())},commit:he,update:function(e,t){if(e){if(!b.has(e))return;G.update(e.renderObjects,!!t)}else G.update(void 0,!!t);se=!0},clear:function(){y.forEach((function(e){return e.unsubscribe()})),y.clear(),b.clear(),G.clear(),Q.debug.clear(),le(!0),x.next(b.size)},syncVisibility:function(){0===q.state.radiusMax&&(ee=!0,te=0),G.syncVisibility()&&Q.debug.isEnabled&&Q.debug.update(),le(!0)},requestDraw:le,tick:fe,animate:function(){X.start(Object(s.b)()),0===de&&pe()},resetTime:function(e){E=e,X.start(e)},pause:function(){N(de),de=0},identify:me,mark:function(e,t){var r=e.repr,n=e.loci,i=!1;if(r?i=r.mark(n,t):(i=Q.handle.mark(n,t),b.forEach((function(e,r){i=r.mark(n,t)||i}))),i){G.update(void 0,!0),Q.handle.scene.update(void 0,!0);var a=K.dirty;ce(!0),K.dirty=a}},getLoci:ae,handleResize:Oe,requestResize:function(){ne=!0},requestCameraReset:function(e){te=null==e?void 0:e.durationMs,re=null==e?void 0:e.snapshot,ee=!0},camera:q,boundingSphere:G.boundingSphere,get notifyDidDraw(){return ie},set notifyDidDraw(e){ie=e},didDraw:D,commited:M,reprCount:x,resized:xe,setProps:function(e,t){var r,n,i;void 0===t&&(t=!1);var a="function"==typeof e?Object(A.b)(_e(),e):e,o=Object.create(null);if(a.camera&&void 0!==a.camera.mode&&a.camera.mode!==q.state.mode&&(o.mode=a.camera.mode),void 0!==a.cameraFog&&a.cameraFog.params){var s="on"===a.cameraFog.name?a.cameraFog.params.intensity:0;s!==q.state.fog&&(o.fog=s)}if(void 0!==a.cameraClipping&&(void 0!==a.cameraClipping.far&&a.cameraClipping.far!==q.state.clipFar&&(o.clipFar=a.cameraClipping.far),void 0!==a.cameraClipping.radius)){var u=G.boundingSphere.radius/100*(100-a.cameraClipping.radius);u>0&&u!==o.radius&&(o.radius=Math.max(u,.01))}(Object.keys(o).length>0&&q.setState(o),(null===(r=a.camera)||void 0===r?void 0:r.helper)&&Q.camera.setProps(a.camera.helper),void 0!==(null===(n=a.camera)||void 0===n?void 0:n.manualReset)&&(p.camera.manualReset=a.camera.manualReset),void 0!==(null===(i=a.camera)||void 0===i?void 0:i.stereo)&&Object.assign(p.camera.stereo,a.camera.stereo),void 0!==a.cameraResetDurationMs&&(p.cameraResetDurationMs=a.cameraResetDurationMs),void 0!==a.transparentBackground&&(p.transparentBackground=a.transparentBackground),void 0!==a.viewport)&&(p.viewport===a.viewport||p.viewport.name===a.viewport.name&&Object(k.k)(p.viewport.params,a.viewport.params)||(p.viewport=a.viewport,we(),Ce()));a.postprocessing&&Object.assign(p.postprocessing,a.postprocessing),a.multiSample&&Object.assign(p.multiSample,a.multiSample),a.renderer&&Y.setProps(a.renderer),a.trackball&&X.setProps(a.trackball),a.debug&&Q.debug.setProps(a.debug),a.handle&&Q.handle.setProps(a.handle),"orthographic"===o.mode&&(p.camera.stereo.name="off"),t||le(!0)},getImagePass:function(e){return void 0===e&&(e={}),new C.a(r,Y,G,q,Q,i.draw.wboitEnabled,e)},get props(){return _e()},get input(){return n},get stats(){return Y.stats},get interaction(){return Z.events},dispose:function(){Se.unsubscribe(),G.clear(),Q.debug.clear(),X.dispose(),Y.dispose(),Z.dispose()}};function we(){"canvas"===p.viewport.name?(F=0,U=0,z=B.drawingBufferWidth,H=B.drawingBufferHeight):(F=p.viewport.params.x*r.pixelRatio,U=p.viewport.params.y*r.pixelRatio,z=p.viewport.params.width*r.pixelRatio,H=p.viewport.params.height*r.pixelRatio)}function Ce(){K.setViewport(F,U,z,H),Y.setViewport(F,U,z,H),f.a.set(q.viewport,F,U,z,H),f.a.set(X.viewport,F,U,z,H)}}}(R||(R={}))}.call(this,r(345).setImmediate,r(345).clearImmediate)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(227),a=r(6),o=r(9),s=r(1),u=r(128),c=r(363),l=r(69),d=r(66),f=r(2),p=r(179);!function(e){e.is=function(e){var t,r,n,i;return(null===(i=null===(n=null===(r=null===(t=null==e?void 0:e.grid)||void 0===t?void 0:t.cells)||void 0===r?void 0:r.space)||void 0===n?void 0:n.dimensions)||void 0===i?void 0:i.length)&&(null==e?void 0:e.sourceData)&&(null==e?void 0:e.customProperties)&&(null==e?void 0:e._propertyData)},function(e){function t(t,r){return"absolute"===t.kind?t:{kind:"absolute",absoluteValue:e.calcAbsolute(r,t.relativeValue)}}e.areSame=function(e,r,n){return Object(l.b)(t(e,n).absoluteValue,t(r,n).absoluteValue,n.sigma/100)},e.absolute=function(e){return{kind:"absolute",absoluteValue:e}},e.relative=function(e){return{kind:"relative",relativeValue:e}},e.calcAbsolute=function(e,t){return t*e.sigma+e.mean},e.calcRelative=function(e,t){return 0===e.sigma?0:(t-e.mean)/e.sigma},e.toAbsolute=t,e.toRelative=function(t,r){return"relative"===t.kind?t:{kind:"relative",relativeValue:e.calcRelative(r,t.absoluteValue)}},e.toString=function(e){return"relative"===e.kind?e.relativeValue.toFixed(2)+" σ":""+e.absoluteValue.toPrecision(4)}}(e.IsoValue||(e.IsoValue={}));var t={min:-1,max:1,mean:0,sigma:.1};function r(r,n){var a=n||t,o=a.min,s=a.max,u=a.mean,c=a.sigma,l=(o-u)/c,d=(s-u)/c,m=r;return"absolute"===r.kind?r.absoluteValue<o?m=e.IsoValue.absolute(o):r.absoluteValue>s&&(m=e.IsoValue.absolute(s)):r.relativeValue<l?m=e.IsoValue.relative(l):r.relativeValue>d&&(m=e.IsoValue.relative(d)),f.ParamDefinition.Conditioned(m,{absolute:f.ParamDefinition.Converted((function(t){return e.IsoValue.toAbsolute(t,i.a.One.stats).absoluteValue}),(function(t){return e.IsoValue.absolute(t)}),f.ParamDefinition.Numeric(u,{min:o,max:s,step:Object(p.e)(c/100,2)})),relative:f.ParamDefinition.Converted((function(t){return e.IsoValue.toRelative(t,i.a.One.stats).relativeValue}),(function(t){return e.IsoValue.relative(t)}),f.ParamDefinition.Numeric(Math.min(1,d),{min:l,max:d,step:Object(p.e)(Math.round((s-o)/c)/100,2)}))},(function(e){return"absolute"===e.kind?"absolute":"relative"}),(function(t,r){return"absolute"===r?e.IsoValue.toAbsolute(t,a):e.IsoValue.toRelative(t,a)}),{isEssential:!0})}e.createIsoValueParam=r,e.IsoValueParam=r(e.IsoValue.relative(2)),e.One={label:"",grid:i.a.One,sourceData:{kind:"",name:"",data:{}},customProperties:new d.CustomProperties,_propertyData:Object.create(null)},e.areEquivalent=function(e,t){return i.a.areEquivalent(e.grid,t.grid)},e.isEmpty=function(e){return i.a.isEmpty(e.grid)},e.isOrbitals=function(e){return!!c.a.is(e.sourceData)&&e.sourceData.data.header.orbitals},e.Loci=function(e){return{kind:"volume-loci",volume:e}},e.isLoci=function(e){return!!e&&"volume-loci"===e.kind},e.areLociEqual=function(e,t){return e.volume===t.volume},e.isLociEmpty=function(e){return i.a.isEmpty(e.volume.grid)},e.getBoundingSphere=function(e,t){return i.a.getBoundingSphere(e.grid,t)},function(t){t.Loci=function(e,t){return{kind:"isosurface-loci",volume:e,isoValue:t}},t.isLoci=function(e){return!!e&&"isosurface-loci"===e.kind},t.areLociEqual=function(t,r){return t.volume===r.volume&&e.IsoValue.areSame(t.isoValue,r.isoValue,t.volume.grid.stats)},t.isLociEmpty=function(e){return 0===e.volume.grid.cells.data.length},t.getBoundingSphere=function(t,r,n){return e.getBoundingSphere(t,n)}}(e.Isosurface||(e.Isosurface={})),function(e){e.Loci=function(e,t){return{kind:"cell-loci",volume:e,indices:t}},e.isLoci=function(e){return!!e&&"cell-loci"===e.kind},e.areLociEqual=function(e,t){return e.volume===t.volume&&a.OrderedSet.areEqual(e.indices,t.indices)},e.isLociEmpty=function(e){return 0===a.OrderedSet.size(e.indices)};var t=new u.a("98"),r=Object(s.Vec3)();e.getBoundingSphere=function(e,n,u){t.reset();for(var c=i.a.getGridToCartesianTransform(e.grid),l=e.grid.cells.space.getCoords,d=0,f=a.OrderedSet.size(n);d<f;d++){l(a.OrderedSet.getAt(n,d),r),s.Vec3.transformMat4(r,r,c),t.includePosition(r)}for(t.finishedIncludeStep(),d=0,f=a.OrderedSet.size(n);d<f;d++){l(a.OrderedSet.getAt(n,d),r),s.Vec3.transformMat4(r,r,c),t.radiusPosition(r)}var p=t.getSphere(u);return o.g.expand(p,p,10*s.Mat4.getMaxScaleOnAxis(c))}}(e.Cell||(e.Cell={}))}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(45),i=r(259),a=r(360);function o(e,t){return t?Object(a.a)(e,t):e instanceof n.a?e:new n.a(Object(i.a)(e))}},function(e,t,r){"use strict";function n(e){return{kind:"table-legend",table:e}}function i(e,t,r){return{kind:"scale-legend",minLabel:e,maxLabel:t,colors:r}}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return i}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return s})),r.d(t,"c",(function(){return c}));var n=r(22),i=r(1);function a(e,t){switch(e.kind){case 0:return e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[t]];case 1:case 2:var r=function(e,t){var r=e.coarseElements.entityKey[t],n=e.model.sequence.byEntityKey[r].sequence,i=e.coarseElements.seq_id_begin.value(t);return n.compId.value(i-1)}(e,t),i=e.model.properties.chemicalComponentMap.get(r);if(i)return Object(n.getMoleculeType)(i.type,r)}return 0}var o=new Set;function s(e,t){var r=n.PolymerTypeAtomRoleId[e];if(void 0!==r){var i=r[t];if(void 0!==i)return i}return o}var u=i.Vec3.zero();function c(e,t){for(var r=e.conformation.position,n=new Float32Array(3*t.length),a=e.elements,o=0,s=t.length;o<s;++o)r(a[t[o]],u),i.Vec3.toArray(u,n,3*o);return n}},function(e,t,r){"use strict";r.d(t,"a",(function(){return S}));var n=r(0),i=r(12),a=r(53),o=r(52),s=r(9),u=r(1),c=r(5),l=r(2),d=r(256),f=r(30),p=r(115),m=r(124),h=r(129),g=r(130),v=r(70),b=r(24);function y(e){return e.map((function(e){return{x:e[0],alpha:e[1]}}))}function _(e,t,r){for(var i,a,o,s,u,l,d=Object(n.__spreadArrays)([{x:0,alpha:0},{x:0,alpha:0}],e,[{x:1,alpha:0},{x:1,alpha:0}]),f=b.ColorScale.create({domain:[0,1],listOrName:t}),p=r?r.ref.value.array:new Uint8Array(1024),m=0,h=e.length+1,g=0;g<h;++g){i=d[g+1].x,a=d[g+2].x,o=d[g].alpha,s=d[g+1].alpha,u=d[g+2].alpha,l=d[g+3].alpha;for(var y=Math.round(256*(a-i)),_=0;_<y;++_){var S=_/y;p[4*m+3]=Math.max(0,255*Object(v.d)(o,s,u,l,S,.5)),f.colorToArray(m/255,p,4*m),++m}}var x={array:p,width:256,height:1};return r?(c.e.update(r,x),r):c.e.create(x)}var S,x=r(136),O=r(36),w=r(47),C=Object(d.a)();!function(e){function t(e){return Object(i.l)([e.bboxSize.ref.version,e.gridDimension.ref.version,e.gridTexture.ref.version,e.transform.ref.version,e.gridStats.ref.version])}function r(e){return{}}function d(e){var t=e?O.b.createIsoValueParam(O.b.IsoValue.relative(2),e):O.b.IsoValueParam;return l.ParamDefinition.MappedStatic("volume",{isosurface:l.ParamDefinition.Group({isoValue:t,singleLayer:l.ParamDefinition.Boolean(!1,{isEssential:!0})},{isFlat:!0}),volume:l.ParamDefinition.Group({controlPoints:l.ParamDefinition.LineGraph([u.Vec2.create(.19,0),u.Vec2.create(.2,.05),u.Vec2.create(.25,.05),u.Vec2.create(.26,0),u.Vec2.create(.79,0),u.Vec2.create(.8,.05),u.Vec2.create(.85,.05),u.Vec2.create(.86,0)]),list:l.ParamDefinition.ColorList({kind:"interpolate",colors:[[w.a.white,0],[w.a.red,.25],[w.a.white,.5],[w.a.blue,.75],[w.a.white,1]]},{offsets:!0})},{isFlat:!0})},{isEssential:!0})}function v(e,t,r){var n=r[0],i=r[1],a=r[2],o=r[3],s=O.b.IsoValue.toAbsolute(t,{min:n,max:i,mean:a,sigma:o}).absoluteValue;return u.Vec2.set(e,(s-n)/(i-n),(0-n)/(i-n)),e}function b(e,t){return Math.ceil(u.Vec3.magnitude(e)*t)}function S(e,t){return Math.min.apply(Math,e)*(1/t)}function j(e){return 1/e}function P(t,r,i,a,l){var d=t.gridTexture,w=t.gridTextureDim,P=t.gridStats,E=t.bboxSize,A=t.bboxMin,D=t.bboxMax,T=t.gridDimension,I=t.transform,M=i.instanceCount,k=i.groupCount,B=e.Utils.createPositionIterator(t,r),V=Object(p.a)(i,B,a.color),R=Object(m.a)(M*k),L=Object(h.c)(),N=Object(g.c)(),F=Object(x.d)(),U=T.ref.value,z=U[0],H=U[1],G=U[2],q={drawCount:C.indices.length,vertexCount:z*H*G,groupCount:k,instanceCount:M},W=s.g.clone(t.boundingSphere),X=Object(o.b)(W,r.aTransform.ref.value,M),Y=_("volume"===l.renderMode.name?y(l.renderMode.params.controlPoints):[],"volume"===l.renderMode.name?l.renderMode.params.list.colors:[]),Q="isosurface"===l.renderMode.name?l.renderMode.params.isoValue:O.b.IsoValue.relative(2),K="isosurface"===l.renderMode.name&&l.renderMode.params.singleLayer;return Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},V),R),L),N),F),r),f.a.createValues(l,q)),{aPosition:c.e.create(C.vertices),elements:c.e.create(C.indices),boundingSphere:c.e.create(X),invariantBoundingSphere:c.e.create(W),uInvariantBoundingSphere:c.e.create(u.Vec4.ofSphere(W)),uIsoValue:c.e.create(v(Object(u.Vec2)(),Q,t.gridStats.ref.value)),uBboxMin:A,uBboxMax:D,uBboxSize:E,uMaxSteps:c.e.create(b(T.ref.value,l.stepsPerCell)),uStepScale:c.e.create(S(t.cellDim.ref.value,l.stepsPerCell)),uJumpLength:c.e.create(l.jumpLength),uTransform:I,uGridDim:T,dRenderMode:c.e.create(l.renderMode.name),tTransferTex:Y,uTransferScale:c.e.create(j(l.stepsPerCell)),dGridTexType:c.e.create(d.ref.value.getDepth()>0?"3d":"2d"),uGridTexDim:w,tGridTex:d,uGridStats:P,uCellDim:t.cellDim,uCartnToUnit:t.cartnToUnit,uUnitToCartn:t.unitToCartn,dPackedGroup:t.packedGroup,dSingleLayer:c.e.create(K),dDoubleSided:c.e.create(l.doubleSided),dFlatShaded:c.e.create(l.flatShaded),dFlipSided:c.e.create(l.flipSided),dIgnoreLight:c.e.create(l.ignoreLight),dXrayShaded:c.e.create(l.xrayShaded)})}e.create=function(e,r,n,i,a,o,l,d,f){return f?function(e,t,r,n,i,a,o,s,l){var d=a.getWidth(),f=a.getHeight(),p=a.getDepth();return c.e.update(l.gridDimension,t),c.e.update(l.gridTexture,a),c.e.update(l.gridTextureDim,u.Vec3.set(l.gridTextureDim.ref.value,d,f,p)),c.e.update(l.gridStats,u.Vec4.set(l.gridStats.ref.value,o.min,o.max,o.mean,o.sigma)),c.e.update(l.bboxMin,e.min),c.e.update(l.bboxMax,e.max),c.e.update(l.bboxSize,u.Vec3.sub(l.bboxSize.ref.value,e.max,e.min)),c.e.update(l.transform,r),c.e.update(l.cellDim,i),c.e.update(l.unitToCartn,n),c.e.update(l.cartnToUnit,u.Mat4.invert(Object(u.Mat4)(),n)),c.e.updateIfChanged(l.packedGroup,s),l}(e,r,n,i,a,o,l,d,f):function(e,r,n,i,a,o,l,d){var f=Object(s.g)(),p=-1,m=o.getWidth(),h=o.getHeight(),g=o.getDepth(),v={kind:"direct-volume",gridDimension:c.e.create(r),gridTexture:c.e.create(o),gridTextureDim:c.e.create(u.Vec3.create(m,h,g)),gridStats:c.e.create(u.Vec4.create(l.min,l.max,l.mean,l.sigma)),bboxMin:c.e.create(e.min),bboxMax:c.e.create(e.max),bboxSize:c.e.create(u.Vec3.sub(Object(u.Vec3)(),e.max,e.min)),transform:c.e.create(n),cellDim:c.e.create(a),unitToCartn:c.e.create(i),cartnToUnit:c.e.create(u.Mat4.invert(Object(u.Mat4)(),i)),get boundingSphere(){var e=t(v);if(e!==p){var r=function(e,t){return s.g.fromDimensionsAndTransform(Object(s.g)(),e,t)}(v.gridDimension.ref.value,v.transform.ref.value);s.g.copy(f,r),p=e}return f},packedGroup:c.e.create(d),setBoundingSphere:function(e){s.g.copy(f,e),p=t(v)}};return v}(e,r,n,i,a,o,l,d)},e.createEmpty=r,e.createRenderModeParam=d,e.Params=Object(n.__assign)(Object(n.__assign)({},f.a.Params),{doubleSided:l.ParamDefinition.Boolean(!1,f.a.CustomQualityParamInfo),flipSided:l.ParamDefinition.Boolean(!1,f.a.ShadingCategory),flatShaded:l.ParamDefinition.Boolean(!1,f.a.ShadingCategory),ignoreLight:l.ParamDefinition.Boolean(!1,f.a.ShadingCategory),xrayShaded:l.ParamDefinition.Boolean(!1,f.a.ShadingCategory),renderMode:d(),stepsPerCell:l.ParamDefinition.Numeric(5,{min:1,max:20,step:1}),jumpLength:l.ParamDefinition.Numeric(0,{min:0,max:20,step:.1})}),e.Utils={Params:e.Params,createEmpty:r,createValues:P,createValuesSimple:function(t,r,i,a,o){var s=f.a.createSimple(i,a,o),u=Object(n.__assign)(Object(n.__assign)({},l.ParamDefinition.getDefaultValues(e.Params)),r);return P(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){if(c.e.updateIfChanged(e.alpha,t.alpha),c.e.updateIfChanged(e.uAlpha,t.alpha),c.e.updateIfChanged(e.dDoubleSided,t.doubleSided),c.e.updateIfChanged(e.dFlatShaded,t.flatShaded),c.e.updateIfChanged(e.dFlipSided,t.flipSided),c.e.updateIfChanged(e.dIgnoreLight,t.ignoreLight),c.e.updateIfChanged(e.dXrayShaded,t.xrayShaded),c.e.updateIfChanged(e.dRenderMode,t.renderMode.name),"isosurface"===t.renderMode.name)c.e.updateIfChanged(e.uIsoValue,v(e.uIsoValue.ref.value,t.renderMode.params.isoValue,e.uGridStats.ref.value)),c.e.updateIfChanged(e.dSingleLayer,t.renderMode.params.singleLayer);else if("volume"===t.renderMode.name){_(y(t.renderMode.params.controlPoints),t.renderMode.params.list.colors,e.tTransferTex)}c.e.updateIfChanged(e.uMaxSteps,b(e.uGridDim.ref.value,t.stepsPerCell)),c.e.updateIfChanged(e.uStepScale,S(e.uCellDim.ref.value,t.stepsPerCell)),c.e.updateIfChanged(e.uTransferScale,j(t.stepsPerCell)),c.e.updateIfChanged(e.uJumpLength,t.jumpLength)},updateBoundingSphere:function(e,t){var r=s.g.clone(t.boundingSphere),n=Object(o.b)(r,e.aTransform.ref.value,e.instanceCount.ref.value);s.g.equals(n,e.boundingSphere.ref.value)||c.e.update(e.boundingSphere,n);s.g.equals(r,e.invariantBoundingSphere.ref.value)||(c.e.update(e.invariantBoundingSphere,r),c.e.update(e.uInvariantBoundingSphere,u.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=f.a.createRenderableState(e);return t.opaque=!1,t.writeDepth="isosurface"===e.renderMode.name,t},updateRenderableState:function(e,t){f.a.updateRenderableState(e,t),e.opaque=!1,e.writeDepth="isosurface"===t.renderMode.name},createPositionIterator:function(e,t){var r=e.transform.ref.value,n=e.gridDimension.ref.value,i=n[0],o=n[1],s=n[2],c=i*o*s,l=t.instanceCount.ref.value,d=Object(a.b)(),f=d.position,p=t.aTransform.ref.value;return Object(a.a)(c,l,1,(function(e,t){var n=Math.floor(e/s);return f[0]=Math.floor(n/o),f[1]=n%o,f[2]=e%s,u.Vec3.transformMat4(f,f,r),t>=0&&u.Vec3.transformMat4Offset(f,f,p,0,0,16*t),d}))}}}(S||(S={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return l})),r.d(t,"c",(function(){return d}));var n,i=r(0),a=r(7),o=r(1),s=r(5),u=r(162);function c(e,t,r){for(var n={},i=0,a=t.blocks;i<a.length;i++){var o=a[i];n[o.header]=l(e,o,r)}return n}function l(e,t,r){return function(e,t,r){for(var n=Object.create(null),i=0,o=Object.keys(e);i<o.length;i++){var s=o[i];n[s]=h(s,e[s],t,r)}return a.c.ofTables(t.header,e,n)}(e,t,r)}function d(e,t){return new p(t,e,!0)}function f(e,t,r,n){return{schema:e,__array:t.__array,isDefined:t.isDefined,rowCount:t.rowCount,value:r,valueKind:t.valueKind,areValuesEqual:t.areValuesEqual,toArray:n}}!function(e){function t(e){return e.replace(".","_").replace(/\[/,"_").replace(/(\[|\])/g,"")}e.canonical=t,e.equal=function(e,r){return t(e)===t(r)},e.create=function(e,r,n){void 0===n&&(n=!1);var i=e+(r?"."+r:"");return n?t(i):i}}(n||(n={}));var p=function(e,t,r){this._isDefined=r;var n=Object.keys(t);this._rowCount=e.rowCount,this._columns=n,this._schema=t;for(var i=Object.create(null),c=function(r){Object.defineProperty(l,r,{get:function(){if(i[r])return i[r];var n=t[r];if("list"===n.valueType)i[r]=function(e,t,r){var n=e.separator,i=e.itemParse,o=t.getField(r),u=o?function(e){return o.str(e).split(n).map((function(e){return i(e.trim())})).filter((function(e){return!!e}))}:function(e){return[]};return{schema:e,__array:void 0,isDefined:!!o,rowCount:t.rowCount,value:u,valueKind:o?o.valueKind:function(){return 1},areValuesEqual:function(e,t){return Object(s.f)(u(e),u(t))},toArray:function(e){return a.b.createAndFillArray(t.rowCount,u,e)}}}(n,e,r);else if("tensor"===n.valueType)i[r]=function(e,t,r){var n=e.space,i=t.fieldNames.includes(r+"[0]")||t.fieldNames.includes(r+"[0][0]")||t.fieldNames.includes(r+"[0][0][0]"),s=i?0:1,c=t.fieldNames.includes(r+"_1")||t.fieldNames.includes(r+"_11")||t.fieldNames.includes(r+"_111")?"underscore":"brackets",l=u.h(r,n.rank,i,c),d=t.getField(l(s,s,s))||a.a.Undefined(t.rowCount,e),f=function(e){return u.g(t,n,e,l)};return{schema:e,__array:void 0,isDefined:d.isDefined,rowCount:t.rowCount,value:f,valueKind:d.valueKind,areValuesEqual:function(e,t){return o.Tensor.areEqualExact(f(e),f(t))},toArray:function(e){return a.b.createAndFillArray(t.rowCount,f,e)}}}(n,e,r);else{var c=function(e){switch(e.valueType){case"str":return function(t,r,n){return f(e,t,t.str,t.toStringArray)};case"int":return function(t,r,n){return f(e,t,t.int,t.toIntArray)};case"float":return function(t,r,n){return f(e,t,t.float,t.toFloatArray)};case"list":throw new Error("Use createListColumn instead.");case"tensor":throw new Error("Use createTensorColumn instead.")}}(n),l=e.getField(r);i[r]=l?c(l,e,r):a.a.Undefined(e.rowCount,n)}return i[r]},enumerable:!0,configurable:!1})},l=this,d=0,p=n;d<p.length;d++)c(p[d])};function m(e,t,r,i){var a=n.create(t,e),o=n.canonical(a);if(o in r)return r[o];if(i&&a in i)for(var s=0,u=i[a];s<u.length;s++){var c=u[s],l=n.canonical(c);if(l in r)return r[l]}}function h(e,t,r,a){var o=r.categories[e];if(a){for(var s=function(e){for(var t=Object.create(null),r=0,i=Object.keys(e.categories);r<i.length;r++)for(var a=i[r],o=0,s=e.categories[a].fieldNames;o<s.length;o++){var u=s[o];t[n.create(a,u,!0)]=e.categories[a].getField(u)}return t}(r),c=Object.create(null),l=[],d=0,f=0,h=Object.keys(t);f<h.length;f++){var g=h[f],v=m(g,e,s,a);v&&(c[g]=v,l.push(g),d=v.rowCount)}o={rowCount:d,name:e,fieldNames:Object(i.__spreadArrays)(l),getField:function(e){return c[e]}}}return new p(o||u.b.empty(e),t,!!o)}},function(e,t,r){"use strict";function n(e,t,r){void 0===r&&(r=-1);for(var n=new Float32Array(3*e),i=-1===r?e<=4?Math.sqrt(2)/2:.6:r,a=t?1:0,o=0,s=e;o<s;++o){var u=(2*o+a)/e*Math.PI;n[3*o]=Math.cos(u)*i,n[3*o+1]=Math.sin(u)*i,n[3*o+2]=0}return n}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";function n(e){var t=void 0,r=void 0;return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(!t||t.length!==n.length)return t=n,r=e.apply(void 0,n);for(var a=0,o=n.length;a<o;a++)if(n[a]!==t[a])return t=n,r=e.apply(void 0,n);return r}}function i(e){var t=new Map;return function(r){if(t.has(r))return t.get(r);var n=e(r);return t.set(r,n),n}}r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return i}))},function(e,t,r){"use strict";r.d(t,"e",(function(){return o})),r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return u})),r.d(t,"c",(function(){return m})),r.d(t,"d",(function(){return h}));var n=r(44),i=r(1),a=r(32);function o(e){switch(e){case 0:return"Spherical";case 1:return"Terminal";case 2:return"Linear";case 3:return"Trigonal";case 4:return"Tetrahedral";case 5:return"Trigonal Bi-Pyramidal";case 6:return"Octahedral";case 7:return"Square Planar";case 8:return"Unknown"}}function s(e){switch(e){case 0:return 0;case 1:return 1;case 2:return 2;case 3:return 3;case 4:return 4;default:return 8}}var u=new Map([[2,Object(n.c)(180)],[3,Object(n.c)(120)],[4,Object(n.c)(109.4721)],[6,Object(n.c)(90)]]),c=Object(i.Vec3)(),l=Object(i.Vec3)(),d=Object(i.Vec3)(),f=Object(i.Vec3)(),p=Object(i.Vec3)();function m(e,t,r,n,o){var s=[];return t.conformation.position(t.elements[r],d),n.conformation.position(n.elements[o],f),i.Vec3.sub(c,f,d),Object(a.g)(e,t,r,(function(e,t){"H"!==Object(a.i)(e,t)&&(e.conformation.position(e.elements[t],p),i.Vec3.sub(l,p,d),s.push(i.Vec3.angle(c,l)))})),s}function h(e,t,r,n,o){t.conformation.position(t.elements[r],d),n.conformation.position(n.elements[o],f),i.Vec3.sub(c,f,d);var s,u,m=[Object(i.Vec3)(),Object(i.Vec3)()],h=0;if(Object(a.g)(e,t,r,(function(e,t){h>1||"H"!==Object(a.i)(e,t)&&(s=e,u=t,e.conformation.position(e.elements[t],p),i.Vec3.sub(m[h++],p,d))})),1===h&&s&&u&&Object(a.g)(e,s,u,(function(e,n){h>1||e===t&&n===r||"H"!==Object(a.i)(e,n)&&(e.conformation.position(e.elements[n],p),i.Vec3.sub(m[h++],p,d))})),2===h)return i.Vec3.cross(l,m[0],m[1]),Math.abs(Math.PI/2-i.Vec3.angle(l,c))}},function(e,t,r){"use strict";r.r(t),r.d(t,"Observable",(function(){return n.a})),r.d(t,"ConnectableObservable",(function(){return i.a})),r.d(t,"GroupedObservable",(function(){return a.a})),r.d(t,"observable",(function(){return o.a})),r.d(t,"Subject",(function(){return s.a})),r.d(t,"BehaviorSubject",(function(){return u.a})),r.d(t,"ReplaySubject",(function(){return c.a})),r.d(t,"AsyncSubject",(function(){return l.a})),r.d(t,"asap",(function(){return d.a})),r.d(t,"asapScheduler",(function(){return d.b})),r.d(t,"async",(function(){return f.a})),r.d(t,"asyncScheduler",(function(){return f.b})),r.d(t,"queue",(function(){return p.a})),r.d(t,"queueScheduler",(function(){return p.b})),r.d(t,"animationFrame",(function(){return y})),r.d(t,"animationFrameScheduler",(function(){return b})),r.d(t,"VirtualTimeScheduler",(function(){return _})),r.d(t,"VirtualAction",(function(){return S})),r.d(t,"Scheduler",(function(){return x.a})),r.d(t,"Subscription",(function(){return O.a})),r.d(t,"Subscriber",(function(){return w.a})),r.d(t,"Notification",(function(){return C.a})),r.d(t,"NotificationKind",(function(){return C.b})),r.d(t,"pipe",(function(){return j.a})),r.d(t,"noop",(function(){return P.a})),r.d(t,"identity",(function(){return E.a})),r.d(t,"isObservable",(function(){return A})),r.d(t,"ArgumentOutOfRangeError",(function(){return D.a})),r.d(t,"EmptyError",(function(){return T.a})),r.d(t,"ObjectUnsubscribedError",(function(){return I.a})),r.d(t,"UnsubscriptionError",(function(){return M.a})),r.d(t,"TimeoutError",(function(){return k.a})),r.d(t,"bindCallback",(function(){return N})),r.d(t,"bindNodeCallback",(function(){return z})),r.d(t,"combineLatest",(function(){return W.b})),r.d(t,"concat",(function(){return X.a})),r.d(t,"defer",(function(){return Y.a})),r.d(t,"empty",(function(){return Q.b})),r.d(t,"forkJoin",(function(){return J})),r.d(t,"from",(function(){return Z.a})),r.d(t,"fromEvent",(function(){return te})),r.d(t,"fromEventPattern",(function(){return re})),r.d(t,"generate",(function(){return ne})),r.d(t,"iif",(function(){return ae})),r.d(t,"interval",(function(){return se})),r.d(t,"merge",(function(){return ce.a})),r.d(t,"never",(function(){return de})),r.d(t,"of",(function(){return fe.a})),r.d(t,"onErrorResumeNext",(function(){return pe})),r.d(t,"pairs",(function(){return me})),r.d(t,"partition",(function(){return ye})),r.d(t,"race",(function(){return _e.a})),r.d(t,"range",(function(){return Se})),r.d(t,"throwError",(function(){return Oe.a})),r.d(t,"timer",(function(){return we.a})),r.d(t,"using",(function(){return Ce})),r.d(t,"zip",(function(){return je.b})),r.d(t,"scheduled",(function(){return Pe.a})),r.d(t,"EMPTY",(function(){return Q.a})),r.d(t,"NEVER",(function(){return le})),r.d(t,"config",(function(){return Ee.a}));var n=r(45),i=r(356),a=r(346),o=r(211),s=r(62),u=r(245),c=r(305),l=r(237),d=r(283),f=r(103),p=r(326),m=r(20),h=r(240),g=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return m.a(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t.scheduled||(t.scheduled=requestAnimationFrame((function(){return t.flush(null)}))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);0===t.actions.length&&(cancelAnimationFrame(r),t.scheduled=void 0)},t}(h.a),v=r(236),b=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return m.a(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,r=this.actions,n=-1,i=r.length;e=e||r.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<i&&(e=r.shift()));if(this.active=!1,t){for(;++n<i&&(e=r.shift());)e.unsubscribe();throw t}},t}(v.a))(g),y=b,_=function(e){function t(t,r){void 0===t&&(t=S),void 0===r&&(r=Number.POSITIVE_INFINITY);var n=e.call(this,t,(function(){return n.frame}))||this;return n.maxFrames=r,n.frame=0,n.index=-1,n}return m.a(t,e),t.prototype.flush=function(){for(var e,t,r=this.actions,n=this.maxFrames;(t=r[0])&&t.delay<=n&&(r.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=r.shift();)t.unsubscribe();throw e}},t.frameTimeFactor=10,t}(v.a),S=function(e){function t(t,r,n){void 0===n&&(n=t.index+=1);var i=e.call(this,t,r)||this;return i.scheduler=t,i.work=r,i.index=n,i.active=!0,i.index=t.index=n,i}return m.a(t,e),t.prototype.schedule=function(r,n){if(void 0===n&&(n=0),!this.id)return e.prototype.schedule.call(this,r,n);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(r,n)},t.prototype.requestAsyncId=function(e,r,n){void 0===n&&(n=0),this.delay=e.frame+n;var i=e.actions;return i.push(this),i.sort(t.sortActions),!0},t.prototype.recycleAsyncId=function(e,t,r){void 0===r&&(r=0)},t.prototype._execute=function(t,r){if(!0===this.active)return e.prototype._execute.call(this,t,r)},t.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},t}(h.a),x=r(328),O=r(76),w=r(34),C=r(196),j=r(281),P=r(207),E=r(187);function A(e){return!!e&&(e instanceof n.a||"function"==typeof e.lift&&"function"==typeof e.subscribe)}var D=r(222),T=r(230),I=r(215),M=r(286),k=r(359),B=r(123),V=r(310),R=r(104),L=r(131);function N(e,t,r){if(t){if(!Object(L.a)(t))return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return N(e,r).apply(void 0,n).pipe(Object(B.a)((function(e){return Object(R.a)(e)?t.apply(void 0,e):t(e)})))};r=t}return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var a,o=this,s={context:o,subject:a,callbackFunc:e,scheduler:r};return new n.a((function(n){if(r){var i={args:t,subscriber:n,params:s};return r.schedule(F,0,i)}if(!a){a=new l.a;try{e.apply(o,t.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];a.next(e.length<=1?e[0]:e),a.complete()}]))}catch(e){Object(V.a)(a)?a.error(e):console.warn(e)}}return a.subscribe(n)}))}}function F(e){var t=this,r=e.args,n=e.subscriber,i=e.params,a=i.callbackFunc,o=i.context,s=i.scheduler,u=i.subject;if(!u){u=i.subject=new l.a;try{a.apply(o,r.concat([function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.length<=1?e[0]:e;t.add(s.schedule(U,0,{value:n,subject:u}))}]))}catch(e){u.error(e)}}this.add(u.subscribe(n))}function U(e){var t=e.value,r=e.subject;r.next(t),r.complete()}function z(e,t,r){if(t){if(!Object(L.a)(t))return function(){for(var n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];return z(e,r).apply(void 0,n).pipe(Object(B.a)((function(e){return Object(R.a)(e)?t.apply(void 0,e):t(e)})))};r=t}return function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];var a={subject:void 0,args:t,callbackFunc:e,scheduler:r,context:this};return new n.a((function(n){var i=a.context,o=a.subject;if(r)return r.schedule(H,0,{params:a,subscriber:n,context:i});if(!o){o=a.subject=new l.a;try{e.apply(i,t.concat([function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.shift();r?o.error(r):(o.next(e.length<=1?e[0]:e),o.complete())}]))}catch(e){Object(V.a)(o)?o.error(e):console.warn(e)}}return o.subscribe(n)}))}}function H(e){var t=this,r=e.params,n=e.subscriber,i=e.context,a=r.callbackFunc,o=r.args,s=r.scheduler,u=r.subject;if(!u){u=r.subject=new l.a;try{a.apply(i,o.concat([function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];var n=e.shift();if(n)t.add(s.schedule(q,0,{err:n,subject:u}));else{var i=e.length<=1?e[0]:e;t.add(s.schedule(G,0,{value:i,subject:u}))}}]))}catch(e){this.add(s.schedule(q,0,{err:e,subject:u}))}}this.add(u.subscribe(n))}function G(e){var t=e.value,r=e.subject;r.next(t),r.complete()}function q(e){var t=e.err;e.subject.error(t)}var W=r(302),X=r(253),Y=r(306),Q=r(143),K=r(309),Z=r(148);function J(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){var r=e[0];if(Object(R.a)(r))return $(r,null);if(Object(K.a)(r)&&Object.getPrototypeOf(r)===Object.prototype){var n=Object.keys(r);return $(n.map((function(e){return r[e]})),n)}}if("function"==typeof e[e.length-1]){var i=e.pop();return $(e=1===e.length&&Object(R.a)(e[0])?e[0]:e,null).pipe(Object(B.a)((function(e){return i.apply(void 0,e)})))}return $(e,null)}function $(e,t){return new n.a((function(r){var n=e.length;if(0!==n)for(var i=new Array(n),a=0,o=0,s=function(s){var u=Object(Z.a)(e[s]),c=!1;r.add(u.subscribe({next:function(e){c||(c=!0,o++),i[s]=e},error:function(e){return r.error(e)},complete:function(){++a!==n&&c||(o===n&&r.next(t?t.reduce((function(e,t,r){return e[t]=i[r],e}),{}):i),r.complete())}}))},u=0;u<n;u++)s(u);else r.complete()}))}var ee=r(223);function te(e,t,r,i){return Object(ee.a)(r)&&(i=r,r=void 0),i?te(e,t,r).pipe(Object(B.a)((function(e){return Object(R.a)(e)?i.apply(void 0,e):i(e)}))):new n.a((function(n){!function e(t,r,n,i,a){var o;if(function(e){return e&&"function"==typeof e.addEventListener&&"function"==typeof e.removeEventListener}(t)){var s=t;t.addEventListener(r,n,a),o=function(){return s.removeEventListener(r,n,a)}}else if(function(e){return e&&"function"==typeof e.on&&"function"==typeof e.off}(t)){var u=t;t.on(r,n),o=function(){return u.off(r,n)}}else if(function(e){return e&&"function"==typeof e.addListener&&"function"==typeof e.removeListener}(t)){var c=t;t.addListener(r,n),o=function(){return c.removeListener(r,n)}}else{if(!t||!t.length)throw new TypeError("Invalid event target");for(var l=0,d=t.length;l<d;l++)e(t[l],r,n,i,a)}i.add(o)}(e,t,(function(e){arguments.length>1?n.next(Array.prototype.slice.call(arguments)):n.next(e)}),n,r)}))}function re(e,t,r){return r?re(e,t).pipe(Object(B.a)((function(e){return Object(R.a)(e)?r.apply(void 0,e):r(e)}))):new n.a((function(r){var n,i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return r.next(1===e.length?e[0]:e)};try{n=e(i)}catch(e){return void r.error(e)}if(Object(ee.a)(t))return function(){return t(i,n)}}))}function ne(e,t,r,i,a){var o,s;if(1==arguments.length){var u=e;s=u.initialState,t=u.condition,r=u.iterate,o=u.resultSelector||E.a,a=u.scheduler}else void 0===i||Object(L.a)(i)?(s=e,o=E.a,a=i):(s=e,o=i);return new n.a((function(e){var n=s;if(a)return a.schedule(ie,0,{subscriber:e,iterate:r,condition:t,resultSelector:o,state:n});for(;;){if(t){var i=void 0;try{i=t(n)}catch(t){return void e.error(t)}if(!i){e.complete();break}}var u=void 0;try{u=o(n)}catch(t){return void e.error(t)}if(e.next(u),e.closed)break;try{n=r(n)}catch(t){return void e.error(t)}}}))}function ie(e){var t=e.subscriber,r=e.condition;if(!t.closed){if(e.needIterate)try{e.state=e.iterate(e.state)}catch(e){return void t.error(e)}else e.needIterate=!0;if(r){var n=void 0;try{n=r(e.state)}catch(e){return void t.error(e)}if(!n)return void t.complete();if(t.closed)return}var i;try{i=e.resultSelector(e.state)}catch(e){return void t.error(e)}if(!t.closed&&(t.next(i),!t.closed))return this.schedule(e)}}function ae(e,t,r){return void 0===t&&(t=Q.a),void 0===r&&(r=Q.a),Object(Y.a)((function(){return e()?t:r}))}var oe=r(243);function se(e,t){return void 0===e&&(e=0),void 0===t&&(t=f.a),(!Object(oe.a)(e)||e<0)&&(e=0),t&&"function"==typeof t.schedule||(t=f.a),new n.a((function(r){return r.add(t.schedule(ue,e,{subscriber:r,counter:0,period:e})),r}))}function ue(e){var t=e.subscriber,r=e.counter,n=e.period;t.next(r),this.schedule({subscriber:t,counter:r+1,period:n},n)}var ce=r(247),le=new n.a(P.a);function de(){return le}var fe=r(265);function pe(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(0===e.length)return Q.a;var r=e[0],i=e.slice(1);return 1===e.length&&Object(R.a)(r)?pe.apply(void 0,r):new n.a((function(e){var t=function(){return e.add(pe.apply(void 0,i).subscribe(e))};return Object(Z.a)(r).subscribe({next:function(t){e.next(t)},error:t,complete:t})}))}function me(e,t){return t?new n.a((function(r){var n=Object.keys(e),i=new O.a;return i.add(t.schedule(he,0,{keys:n,index:0,subscriber:r,subscription:i,obj:e})),i})):new n.a((function(t){for(var r=Object.keys(e),n=0;n<r.length&&!t.closed;n++){var i=r[n];e.hasOwnProperty(i)&&t.next([i,e[i]])}t.complete()}))}function he(e){var t=e.keys,r=e.index,n=e.subscriber,i=e.subscription,a=e.obj;if(!n.closed)if(r<t.length){var o=t[r];n.next([o,a[o]]),i.add(this.schedule({keys:t,index:r+1,subscriber:n,subscription:i,obj:a}))}else n.complete()}var ge=r(389),ve=r(259),be=r(168);function ye(e,t,r){return[Object(be.a)(t,r)(new n.a(Object(ve.a)(e))),Object(be.a)(Object(ge.a)(t,r))(new n.a(Object(ve.a)(e)))]}var _e=r(358);function Se(e,t,r){return void 0===e&&(e=0),new n.a((function(n){void 0===t&&(t=e,e=0);var i=0,a=e;if(r)return r.schedule(xe,0,{index:i,count:t,start:e,subscriber:n});for(;;){if(i++>=t){n.complete();break}if(n.next(a++),n.closed)break}}))}function xe(e){var t=e.start,r=e.index,n=e.count,i=e.subscriber;r>=n?i.complete():(i.next(t),i.closed||(e.index=r+1,e.start=t+1,this.schedule(e)))}var Oe=r(303),we=r(354);function Ce(e,t){return new n.a((function(r){var n,i;try{n=e()}catch(e){return void r.error(e)}try{i=t(n)}catch(e){return void r.error(e)}var a=(i?Object(Z.a)(i):Q.a).subscribe(r);return function(){a.unsubscribe(),n&&n.unsubscribe()}}))}var je=r(307),Pe=r(360),Ee=r(182)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=function(){function e(){this.map=new Map,this.applicable=new Map}return e.prototype.add=function(e,t,r){this.map.set(e,t),r&&this.applicable.set(e,r)},e.prototype.remove=function(e){this.map.delete(e),this.applicable.delete(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.isApplicable=function(e){var t=this.applicable.get(e.sourceData.kind);return!t||t(e)},e}();!function(e){e.create=function(e){var t=e.name,r=new i;return{descriptor:e,formatRegistry:r,isApplicable:function(e){return r.isApplicable(e)},get:function(n){if(n._staticPropertyData[t])return n._staticPropertyData[t];if(!n.customProperties.has(e)){var i=r.get(n.sourceData.kind);if(i)return n._staticPropertyData[t]=i(n),n.customProperties.add(e),n._staticPropertyData[t]}},set:function(e,r){e._staticPropertyData[t]=r},delete:function(e){delete e._staticPropertyData[t]}}}}(n||(n={}))},function(e,t,r){"use strict";function n(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];throw Error("[Immer] minified error nr: "+e+(r.length?" "+r.map((function(e){return"'"+e+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function i(e){return!!e&&!!e[q]}function a(e){return!!e&&(function(e){if(!e||"object"!=typeof e)return!1;var t=Object.getPrototypeOf(e);if(null===t)return!0;var r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return"function"==typeof r&&Function.toString.call(r)===W}(e)||Array.isArray(e)||!!e[G]||!!e.constructor[G]||f(e)||p(e))}function o(e,t,r){void 0===r&&(r=!1),0===s(e)?(r?Object.keys:X)(e).forEach((function(n){r&&"symbol"==typeof n||t(n,e[n],e)})):e.forEach((function(r,n){return t(n,r,e)}))}function s(e){var t=e[q];return t?t.i>3?t.i-4:t.i:Array.isArray(e)?1:f(e)?2:p(e)?3:0}function u(e,t){return 2===s(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function c(e,t){return 2===s(e)?e.get(t):e[t]}function l(e,t,r){var n=s(e);2===n?e.set(t,r):3===n?(e.delete(t),e.add(r)):e[t]=r}function d(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function f(e){return F&&e instanceof Map}function p(e){return U&&e instanceof Set}function m(e){return e.o||e.t}function h(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=Y(e);delete t[q];for(var r=X(t),n=0;n<r.length;n++){var i=r[n],a=t[i];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(Object.getPrototypeOf(e),t)}function g(e,t){return void 0===t&&(t=!1),b(e)||i(e)||!a(e)||(s(e)>1&&(e.set=e.add=e.clear=e.delete=v),Object.freeze(e),t&&o(e,(function(e,t){return g(t,!0)}),!0)),e}function v(){n(2)}function b(e){return null==e||"object"!=typeof e||Object.isFrozen(e)}function y(e){var t=Q[e];return t||n(18,e),t}function _(){return L}function S(e,t){t&&(y("Patches"),e.u=[],e.s=[],e.v=t)}function x(e){O(e),e.p.forEach(C),e.p=null}function O(e){e===L&&(L=e.l)}function w(e){return L={p:[],l:L,h:e,m:!0,_:0}}function C(e){var t=e[q];0===t.i||1===t.i?t.j():t.g=!0}function j(e,t){t._=t.p.length;var r=t.p[0],i=void 0!==e&&e!==r;return t.h.O||y("ES5").S(t,e,i),i?(r[q].P&&(x(t),n(4)),a(e)&&(e=P(t,e),t.l||A(t,e)),t.u&&y("Patches").M(r[q],e,t.u,t.s)):e=P(t,r,[]),x(t),t.u&&t.v(t.u,t.s),e!==H?e:void 0}function P(e,t,r){if(b(t))return t;var n=t[q];if(!n)return o(t,(function(i,a){return E(e,n,t,i,a,r)}),!0),t;if(n.A!==e)return t;if(!n.P)return A(e,n.t,!0),n.t;if(!n.I){n.I=!0,n.A._--;var i=4===n.i||5===n.i?n.o=h(n.k):n.o;o(3===n.i?new Set(i):i,(function(t,a){return E(e,n,i,t,a,r)})),A(e,i,!1),r&&e.u&&y("Patches").R(n,r,e.u,e.s)}return n.o}function E(e,t,r,n,o,s){if(i(o)){var c=P(e,o,s&&t&&3!==t.i&&!u(t.D,n)?s.concat(n):void 0);if(l(r,n,c),!i(c))return;e.m=!1}if(a(o)&&!b(o)){if(!e.h.F&&e._<1)return;P(e,o),t&&t.A.l||A(e,o)}}function A(e,t,r){void 0===r&&(r=!1),e.h.F&&e.m&&g(t,r)}function D(e,t){var r=e[q];return(r?m(r):e)[t]}function T(e,t){if(t in e)for(var r=Object.getPrototypeOf(e);r;){var n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Object.getPrototypeOf(r)}}function I(e){e.P||(e.P=!0,e.l&&I(e.l))}function M(e){e.o||(e.o=h(e.t))}function k(e,t,r){var n=f(t)?y("MapSet").N(t,r):p(t)?y("MapSet").T(t,r):e.O?function(e,t){var r=Array.isArray(e),n={i:r?1:0,A:t?t.A:_(),P:!1,I:!1,D:{},l:t,t:e,k:null,o:null,j:null,C:!1},i=n,a=K;r&&(i=[n],a=Z);var o=Proxy.revocable(i,a),s=o.revoke,u=o.proxy;return n.k=u,n.j=s,u}(t,r):y("ES5").J(t,r);return(r?r.A:_()).p.push(n),n}function B(e){return i(e)||n(22,e),function e(t){if(!a(t))return t;var r,n=t[q],i=s(t);if(n){if(!n.P&&(n.i<4||!y("ES5").K(n)))return n.t;n.I=!0,r=V(t,i),n.I=!1}else r=V(t,i);return o(r,(function(t,i){n&&c(n.t,t)===i||l(r,t,e(i))})),3===i?new Set(r):r}(e)}function V(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return h(e)}r.d(t,"b",(function(){return $})),r.d(t,"c",(function(){return ee}));var R,L,N="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),F="undefined"!=typeof Map,U="undefined"!=typeof Set,z="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=N?Symbol.for("immer-nothing"):((R={})["immer-nothing"]=!0,R),G=N?Symbol.for("immer-draftable"):"__$immer_draftable",q=N?Symbol.for("immer-state"):"__$immer_state",W=("undefined"!=typeof Symbol&&Symbol.iterator,""+Object.prototype.constructor),X="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,Y=Object.getOwnPropertyDescriptors||function(e){var t={};return X(e).forEach((function(r){t[r]=Object.getOwnPropertyDescriptor(e,r)})),t},Q={},K={get:function(e,t){if(t===q)return e;var r=m(e);if(!u(r,t))return function(e,t,r){var n,i=T(t,r);return i?"value"in i?i.value:null===(n=i.get)||void 0===n?void 0:n.call(e.k):void 0}(e,r,t);var n=r[t];return e.I||!a(n)?n:n===D(e.t,t)?(M(e),e.o[t]=k(e.A.h,n,e)):n},has:function(e,t){return t in m(e)},ownKeys:function(e){return Reflect.ownKeys(m(e))},set:function(e,t,r){var n=T(m(e),t);if(null==n?void 0:n.set)return n.set.call(e.k,r),!0;if(!e.P){var i=D(m(e),t),a=null==i?void 0:i[q];if(a&&a.t===r)return e.o[t]=r,e.D[t]=!1,!0;if(d(r,i)&&(void 0!==r||u(e.t,t)))return!0;M(e),I(e)}return e.o[t]===r&&"number"!=typeof r||(e.o[t]=r,e.D[t]=!0,!0)},deleteProperty:function(e,t){return void 0!==D(e.t,t)||t in e.t?(e.D[t]=!1,M(e),I(e)):delete e.D[t],e.o&&delete e.o[t],!0},getOwnPropertyDescriptor:function(e,t){var r=m(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{writable:!0,configurable:1!==e.i||"length"!==t,enumerable:n.enumerable,value:r[t]}:n},defineProperty:function(){n(11)},getPrototypeOf:function(e){return Object.getPrototypeOf(e.t)},setPrototypeOf:function(){n(12)}},Z={};o(K,(function(e,t){Z[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),Z.deleteProperty=function(e,t){return K.deleteProperty.call(this,e[0],t)},Z.set=function(e,t,r){return K.set.call(this,e[0],t,r,e[0])};var J=new(function(){function e(e){var t=this;this.O=z,this.F=!0,this.produce=function(e,r,i){if("function"==typeof e&&"function"!=typeof r){var o=r;r=e;var s=t;return function(e){var t=this;void 0===e&&(e=o);for(var n=arguments.length,i=Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return s.produce(e,(function(e){var n;return(n=r).call.apply(n,[t,e].concat(i))}))}}var u;if("function"!=typeof r&&n(6),void 0!==i&&"function"!=typeof i&&n(7),a(e)){var c=w(t),l=k(t,e,void 0),d=!0;try{u=r(l),d=!1}finally{d?x(c):O(c)}return"undefined"!=typeof Promise&&u instanceof Promise?u.then((function(e){return S(c,i),j(e,c)}),(function(e){throw x(c),e})):(S(c,i),j(u,c))}if(!e||"object"!=typeof e){if((u=r(e))===H)return;return void 0===u&&(u=e),t.F&&g(u,!0),u}n(21,e)},this.produceWithPatches=function(e,r){return"function"==typeof e?function(r){for(var n=arguments.length,i=Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return t.produceWithPatches(r,(function(t){return e.apply(void 0,[t].concat(i))}))}:[t.produce(e,r,(function(e,t){n=e,i=t})),n,i];var n,i},"boolean"==typeof(null==e?void 0:e.useProxies)&&this.setUseProxies(e.useProxies),"boolean"==typeof(null==e?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze)}var t=e.prototype;return t.createDraft=function(e){a(e)||n(8),i(e)&&(e=B(e));var t=w(this),r=k(this,e,void 0);return r[q].C=!0,O(t),r},t.finishDraft=function(e,t){var r=(e&&e[q]).A;return S(r,t),j(void 0,r)},t.setAutoFreeze=function(e){this.F=e},t.setUseProxies=function(e){e&&!z&&n(20),this.O=e},t.applyPatches=function(e,t){var r;for(r=t.length-1;r>=0;r--){var n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}var a=y("Patches").$;return i(e)?a(e,t):this.produce(e,(function(e){return a(e,t.slice(r+1))}))},e}()),$=J.produce,ee=(J.produceWithPatches.bind(J),J.setAutoFreeze.bind(J));J.setUseProxies.bind(J),J.applyPatches.bind(J),J.createDraft.bind(J),J.finishDraft.bind(J);t.a=$},function(e,t,r){"use strict";r.d(t,"e",(function(){return a})),r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return c})),r.d(t,"d",(function(){return l}));var n=r(28),i=r(6);function a(e,t){if(0===t.length)return n.c.Empty;if(1===t.length)return t[0];for(var r=new Map,a=new Set,s=0,u=t;s<u.length;s++)for(var c=u[s].units,l=0,d=c.length;l<d;l++){var f=c[l];if(r.has(f.id)){if(a.has(f.id))continue;var p=i.SortedArray.union(r.get(f.id),f.elements);r.set(f.id,p),p.length===e.unitMap.get(f.id).elements.length&&a.add(f.id)}else r.set(f.id,f.elements),f.elements.length===e.unitMap.get(f.id).elements.length&&a.add(f.id)}var m=e.subsetBuilder(!0);return r.forEach(o,m),m.getStructure()}function o(e,t){this.setUnit(t,e)}function s(e,t){if(e===t)return!0;if(e.units.length!==t.units.length)return!1;for(var r=e.units,n=t.unitMap,a=0,o=r.length;a<o;a++){var s=r[a];if(!n.has(s.id))return!1;var u=n.get(s.id);if(!i.SortedArray.areEqual(s.elements,u.elements))return!1}return!0}function u(e,t){if(e===t)return!0;var r,n;e.units.length<t.units.length?(r=e,n=t):(r=t,n=e);for(var a=r.units,o=n.unitMap,s=0,u=a.length;s<u;s++){var c=a[s];if(o.has(c.id)){var l=o.get(c.id);if(i.SortedArray.areIntersecting(c.elements,l.elements))return!0}}return!1}function c(e,t){if(e===t)return e;if(!u(e,t))return n.c.Empty;var r,a;e.units.length<t.units.length?(r=e,a=t):(r=t,a=e);for(var o=r.units,s=a.unitMap,c=[],l=0,d=o.length;l<d;l++){var f=o[l];if(s.has(f.id)){var p=s.get(f.id);if(i.SortedArray.areIntersecting(f.elements,p.elements)){var m=i.SortedArray.intersect(f.elements,p.elements);c[c.length]=f.getChild(m)}}}return n.c.create(c,{parent:e.parent||t.parent})}function l(e,t){if(e===t)return n.c.Empty;if(!u(e,t))return e;for(var r=e.units,a=t.unitMap,o=[],s=0,c=r.length;s<c;s++){var l=r[s];if(a.has(l.id)){var d=a.get(l.id),f=i.SortedArray.subtract(l.elements,d.elements);f.length>0&&(o[o.length]=l.getChild(f))}else o[o.length]=l}return n.c.create(o,{parent:e.parent||t.parent})}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"c",(function(){return d})),r.d(t,"b",(function(){return f}));var n,i=r(0),a=r(5),o=r(4),s=r(9),u=r(95),c=r(36);!function(e){e.create=function(){return{updateTransform:!1,updateMatrix:!1,updateColor:!1,updateSize:!1,createGeometry:!1,createNew:!1,info:{}}},e.reset=function(e){e.updateTransform=!1,e.updateMatrix=!1,e.updateColor=!1,e.updateSize=!1,e.createGeometry=!1,e.createNew=!1}}(n||(n={}));var l={lowestElementCount:1e6,lowerElementCount:5e5,lowElementCount:1e5,mediumElementCount:2e4,highElementCount:2e3,coarseGrainedFactor:10,elementCountFactor:1};function d(e,t){void 0===t&&(t={});var r=Object(i.__assign)(Object(i.__assign)({},l),t),n=e.elementCount*r.elementCountFactor;return e.isCoarseGrained&&(n*=r.coarseGrainedFactor),n>r.lowestElementCount?"lowest":n>r.lowerElementCount?"lower":n>r.lowElementCount?"low":n>r.mediumElementCount?"medium":n>r.highElementCount?"high":"higher"}function f(e,t){var r=Object(a.h)(e.quality,"auto"),n=Object(a.h)(e.detail,1),i=Object(a.h)(e.radialSegments,12),l=Object(a.h)(e.linearSegments,8),f=Object(a.h)(e.resolution,2),p=Object(a.h)(e.doubleSided,!0),m=0;if("auto"===r)if(t instanceof o.Structure)r=d(t.root),m=function(e){if(1===e.root.models.length){var t=u.a.Provider.get(e.root.model);if(t&&"P 1"===t.spacegroup.name&&!s.f.isZero(t.spacegroup.cell))return t.spacegroup.cell.volume}return s.b.volume(e.root.boundary.box)}(t);else if(c.b.is(t)){var h=t.grid.cells.space.dimensions;r=(m=h[0]*h[1]*h[2])<1e7?"medium":"low"}switch(r){case"highest":n=3,i=36,l=18,f=.1,p=!0;break;case"higher":n=3,i=28,l=14,f=.3,p=!0;break;case"high":n=2,i=20,l=10,f=.5,p=!0;break;case"medium":n=1,i=12,l=8,f=.8,p=!0;break;case"low":n=0,i=8,l=3,f=1.3,p=!1;break;case"lower":n=0,i=4,l=2,f=3,p=!1;break;case"lowest":n=0,i=2,l=1,f=8,p=!1}return f=Math.max(f,m/5e8),f=Math.min(f,20),(void 0!==e.alpha&&e.alpha<1||e.xrayShaded)&&(p=!1),{detail:n,radialSegments:i,linearSegments:l,resolution:f,doubleSided:p}}},function(e,t,r){"use strict";function n(e,t,r){for(var n=0,i=r.length;n<i;n++){var a=r.charCodeAt(n);if(a<128)e[t++]=a>>>0&127|0;else if(a<2048)e[t++]=a>>>6&31|192,e[t++]=a>>>0&63|128;else if(a<65536)e[t++]=a>>>12&15|224,e[t++]=a>>>6&63|128,e[t++]=a>>>0&63|128;else{if(!(a<1114112))throw new Error("bad codepoint "+a);e[t++]=a>>>18&7|240,e[t++]=a>>>12&63|128,e[t++]=a>>>6&63|128,e[t++]=a>>>0&63|128}}}r.d(t,"c",(function(){return n})),r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return u}));var i=function(){for(var e=[],t=0;t<1024;t++)e[t]=String.fromCharCode(t);return e}();function a(e){throw new Error(e)}var o="undefined"!=typeof TextDecoder?new TextDecoder:void 0;function s(e,t,r){if(o){var n=t||r!==e.length?e.subarray(t,t+r):e;return o.decode(n)}return function(e,t,r){for(var n=i,o=void 0,s=[],u=0,c=t,l=t+r;c<l;c++){var d=e[c];0==(128&d)?s[u++]=n[d]:192==(224&d)?s[u++]=n[(15&d)<<6|63&e[++c]]:224==(240&d)?s[u++]=String.fromCharCode((15&d)<<12|(63&e[++c])<<6|(63&e[++c])<<0):240==(248&d)?s[u++]=String.fromCharCode((7&d)<<18|(63&e[++c])<<12|(63&e[++c])<<6|(63&e[++c])<<0):a("Invalid byte "+d.toString(16)),512===u&&((o=o||[])[o.length]=s.join(""),u=0)}return o?(u>0&&(o[o.length]=s.slice(0,u).join("")),o.join("")):s.slice(0,u).join("")}(e,t,r)}function u(e){for(var t=0,r=0,n=e.length;r<n;r++){var i=e.charCodeAt(r);i<128?t+=1:i<2048?t+=2:i<65536?t+=3:i<1114112?t+=4:a("bad codepoint "+i)}return t}},function(e,t,r){"use strict";r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return c})),r.d(t,"e",(function(){return l})),r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return n})),r.d(t,"h",(function(){return f})),r.d(t,"g",(function(){return p})),r.d(t,"f",(function(){return m}));var n,i=r(0),a=r(7),o=r(101),s=r(81);function u(e,t){return{name:t,blocks:e}}function c(e,t,r,n){return void 0===n&&(n=[]),{categoryNames:e,header:r,categories:t,saveFrames:n,getField:function(e){var r=e.split("."),n=r[0],i=r[1];return t[n].getField(i||"")}}}function l(e,t,r){return{categoryNames:e,header:r,categories:t}}function d(e,t,r,n){return{rowCount:t,name:e,fieldNames:Object(i.__spreadArrays)(r),getField:function(e){return n[e]}}}function f(e,t,r,n){var i=r?0:1;switch(t){case 1:return"brackets"===n?function(t){return e+"["+(t+i)+"]"}:function(t){return e+"_"+(t+i)};case 2:return"brackets"===n?function(t,r){return e+"["+(t+i)+"]["+(r+i)+"]"}:function(t,r){return e+"_"+(t+i)+(r+i)};case 3:return"brackets"===n?function(t,r,n){return e+"["+(t+i)+"]["+(r+i)+"]["+(n+i)+"]"}:function(t,r,n){return e+"_"+(t+i)+(r+i)+(n+i)};default:throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.")}}function p(e,t,r,n){var i=t.create();if(1===t.rank)for(var a=t.dimensions[0],o=0;o<a;o++){var s=e.getField(n(o));t.set(i,o,s?s.float(r):0)}else if(2===t.rank){a=t.dimensions[0];var u=t.dimensions[1];for(o=0;o<a;o++)for(var c=0;c<u;c++){s=e.getField(n(o,c));t.set(i,o,c,s?s.float(r):0)}}else{if(3!==t.rank)throw new Error("Tensors with rank > 3 or rank 0 are currently not supported.");var l=t.dimensions[0],d=t.dimensions[1],f=t.dimensions[2];for(o=0;o<l;o++)for(c=0;c<d;c++)for(var p=0;p<f;p++){s=e.getField(n(o,c,p));t.set(i,o,c,p,s?s.float(r):0)}}return i}function m(e){for(var t=0,r=!1,n=0,i=0,s=e.rowCount;i<s;i++){if(0===e.valueKind(i)){var u=Object(o.a)(e.str(i));if(0!==u){if(1!==u){r=!0;break}t++}}else n++}return r||n===e.rowCount?a.a.Schema.str:t>0?a.a.Schema.float:a.a.Schema.int}!function(e){function t(e,t){var r=Object.keys(t);return{rowCount:r.length>0?t[r[0]].rowCount:0,name:e,fieldNames:r,getField:function(e){return t[e]}}}e.empty=function(e){return{rowCount:0,name:e,fieldNames:[],getField:function(e){}}},e.ofFields=t,e.ofTable=function(e,r){for(var i={},a=0,o=r._columns;a<o.length;a++){var s=o[a];i[s]=n.ofColumn(r[s])}return t(e,i)}}(d||(d={})),function(e){function t(e){var t=e.length,r=function(t){var r=e[t];return r&&"."!==r&&"?"!==r?r:""},n=function(t){var r=e[t];return Object(o.d)(r,0,r.length)||0},i=function(t){var r=e[t];return Object(o.b)(r,0,r.length)||0};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:t,str:r,int:n,float:i,valueKind:function(t){var r=e[t],n=r.length;if(n>1)return 0;if(0===n)return 1;var i=r.charCodeAt(0);return 46===i?1:63===i?2:0},areValuesEqual:function(t,r){return e[t]===e[r]},toStringArray:function(n){return n?a.b.createAndFillArray(t,r,n):e},toIntArray:function(e){return a.b.createAndFillArray(t,n,e)},toFloatArray:function(e){return a.b.createAndFillArray(t,i,e)}}}function r(e){var t,r,n,i=e.rowCount,s=e.valueKind,u=e.areValuesEqual,c=e.isDefined;switch(e.schema.valueType){case"float":case"int":t=function(t){return""+e.value(t)},r=e.value,n=e.value;break;case"str":t=e.value,r=function(t){var r=e.value(t);return Object(o.d)(r,0,r.length)||0},n=function(t){var r=e.value(t);return Object(o.b)(r,0,r.length)||0};break;case"list":var l=e.schema.separator;t=function(t){return e.value(t).join(l)},r=function(e){return NaN},n=function(e){return NaN};break;default:throw new Error("unsupported valueType '"+e.schema.valueType+"'")}return{__array:void 0,binaryEncoding:void 0,isDefined:c,rowCount:i,str:t,int:r,float:n,valueKind:s,areValuesEqual:u,toStringArray:function(e){return a.b.createAndFillArray(i,t,e)},toIntArray:function(e){return a.b.createAndFillArray(i,r,e)},toFloatArray:function(e){return a.b.createAndFillArray(i,n,e)}}}e.ofString=function(e){return t([e])},e.ofStrings=t,e.ofNumbers=function(e){var t=e.length,r=function(t){return""+e[t]},n=function(t){return e[t]},i=function(r){return!r||r.array&&e instanceof r.array?e:a.b.createAndFillArray(t,n,r)};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:t,str:r,int:n,float:n,valueKind:function(e){return 0},areValuesEqual:function(t,r){return e[t]===e[r]},toStringArray:function(e){return a.b.createAndFillArray(t,r,e)},toIntArray:i,toFloatArray:i}},e.ofTokens=function(e){var t=e.data,r=e.indices,n=e.count,i=function(e){var n=t.substring(r[2*e],r[2*e+1]);return"."===n||"?"===n?"":n},u=function(e){return Object(o.d)(t,r[2*e],r[2*e+1])||0},c=function(e){return Object(o.b)(t,r[2*e],r[2*e+1])||0};return{__array:void 0,binaryEncoding:void 0,isDefined:!0,rowCount:n,str:i,int:u,float:c,valueKind:function(e){var n=r[2*e],i=r[2*e+1]-n;if(i>1)return 0;if(0===i)return 1;var a=t.charCodeAt(n);return 46===a?1:63===a?2:0},areValuesEqual:Object(s.b)(e),toStringArray:function(e){return a.b.createAndFillArray(n,i,e)},toIntArray:function(e){return a.b.createAndFillArray(n,u,e)},toFloatArray:function(e){return a.b.createAndFillArray(n,c,e)}}},e.ofColumn=r,e.ofUndefined=function(e,t){return r(a.a.Undefined(e,t))}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return P})),r.d(t,"b",(function(){return V})),r.d(t,"a",(function(){return I}));var n,i=r(28),a=r(22),o=r(6),s=r(201),u=r(0),c=r(145),l=r(37),d=r(255);(n||(n={})).Empty=c.a.create([],[],[],0,{flags:[],order:[]});var f,p,m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(u.__extends)(t,e),t.prototype.getBondFromLocation=function(e){return l.a.isAtomic(e.aUnit)&&l.a.isAtomic(e.bUnit)?this.getEdge(e.aIndex,e.aUnit.id,e.bIndex,e.bUnit.id):void 0},t.prototype.getBondIndexFromLocation=function(e){return l.a.isAtomic(e.aUnit)&&l.a.isAtomic(e.bUnit)?this.getEdgeIndex(e.aIndex,e.aUnit.id,e.bIndex,e.bUnit.id):-1},t}(d.a);f=m||(m={}),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(u.__extends)(t,e),t}(d.a.UnitPairEdges),f.UnitPairBonds=p;var h=r(113),g=r(315),v=r(133),b=r(332),y=r(219),_=r(1),S=r(69);function x(e,t,r,n,i,a){for(var o=new c.a.EdgeBuilder(i,e,t),s=new Uint16Array(o.slotCount),u=new Int8Array(o.slotCount),l=0,d=o.edgeCount;l<d;l++)o.addNextEdge(),o.assignProperty(s,n[l]),o.assignProperty(u,r[l]);return o.createGraph({flags:s,order:u},{canRemap:a})}var O=Object(_.Vec3)(),w=Object(_.Vec3)();function C(e,t,r){return e.conformation.position(t,O),e.conformation.position(r,w),_.Vec3.distance(O,w)}var j=new Set;function P(e,t){var r=Object(u.__assign)(Object(u.__assign)({},h.a),t);return r.noCompute?n.Empty:!r.forceCompute&&v.a.Provider.get(e.model)?function(e){for(var t=v.a.Provider.get(e.model),r=e.elements,n=e.model.atomicHierarchy.atoms.type_symbol,i=e.elements.length,a=t.edgeProps,s=[],u=[],c=[],l=[],d=0;d<i;d++)for(var f=r[d],p="H"===n.value(f),m=t.offset[f],h=t.offset[f+1];m<h;++m){var g=t.b[m];if(!(f>=g)){var b=o.SortedArray.indexOf(e.elements,g);if(!(b<0||p&&"H"===n.value(g))){var y=a.distance[m];(-1===y||void 0===y||Object(S.b)(C(e,f,g),y,.5))&&(s[s.length]=d,u[u.length]=b,l[l.length]=a.order[m],c[c.length]=a.flag[m])}}}return x(s,u,l,c,i,!1)}(e):function(e,t){for(var r=e.model.atomicConformation,n=r.x,i=r.y,a=r.z,s=e.elements.length,u=e.elements,c=e.residueIndex,l=e.chainIndex,d=e.model.atomicHierarchy.atoms,f=d.type_symbol,p=d.label_atom_id,m=d.label_alt_id,v=d.label_comp_id,_=e.model.atomicHierarchy.residues.label_seq_id,S=e.model.atomicHierarchy.index,O=e.model.sequence.byEntityKey,w=e.lookup3d,C=y.a.Provider.get(e.model),P=b.a.Provider.get(e.model),E=y.a.isExhaustive(e.model),A=[],D=[],T=[],I=[],M=-1,k=void 0,B=!0,V=!0,R=!0,L=j,N=0;N<s;N++){var F=u[N],U=f.value(F);!B||"H"===U&&"O"===U||(B=!1);var z=t.forceCompute?void 0:C&&C.byAtomIndex.get(F),H=!1;if(z)for(var G=0,q=z;G<q.length;G++){var W=q[G],X=W.partnerA,Y=W.partnerB;if(X.symmetry===Y.symmetry){var Q=X.atomIndex===F?Y:X;(fe=o.SortedArray.indexOf(e.elements,Q.atomIndex))<0||(A[A.length]=N,D[D.length]=fe,T[T.length]=W.flags,I[I.length]=W.order,H||L.clear(),H=!0,L.add(fe))}}if(!E){var K=c[F],Z=_.value(K),J=v.value(F);if(!t.forceCompute&&K!==M)if(P&&P.entries.has(J)){var $=O[S.getEntityFromChain(l[F])];k=$&&$.sequence.microHet.has(Z)?void 0:P.entries.get(J).map}else k=void 0;M=K;for(var ee=Object(h.c)(U),te=p.value(F),re=k?k.get(te):void 0,ne=w.find(n[F],i[F],a[F],4),ie=ne.indices,ae=ne.count,oe=ne.squaredDistances,se=Object(h.f)(ee),ue=Object(h.e)(ee),ce=m.value(F),le=h.b.has(ee),de=0;de<ae;de++){var fe=ie[de];if(!H||!L.has(fe)){var pe=u[fe];if(!(pe<=F)){var me=m.value(pe);if(!ce||!me||ce===me){var he=Object(h.c)(f.value(pe)),ge=Object(h.f)(he);if(!se||!ge){var ve=(le||h.b.has(he))&&!(se||ge),be=c[pe];if(K===be&&re){var ye=re.get(p.value(pe));if(ye){A[A.length]=N,D[D.length]=fe,I[I.length]=ye.order;var _e=ye.flags;ve&&(1|_e&&(_e^=1),_e|=2),T[T.length]=_e}}else{var Se=Math.sqrt(oe[de]);if(0!==Se){var xe=Object(h.d)(ee,he);if(Se<=(xe>0?xe:he<0?ue:(ue+Object(h.e)(he))/2)){A[A.length]=N,D[D.length]=fe,I[I.length]=Object(g.b)(J,te,p.value(pe)),T[T.length]=32|(ve?2:1);var Oe=_.value(be);Z===Oe&&(V=!1),Math.abs(Z-Oe)>1&&(R=!1)}}}}}}}}}}return x(A,D,I,T,s,B||V&&R)}(e,r)}var E=r(118),A=Object(_.Vec3)(),D=Object(_.Vec3)();function T(e,t,r,n){return e.conformation.position(t,A),r.conformation.position(n,D),_.Vec3.distance(A,D)}var I,M=Object(_.Mat4)(),k=Object(_.Vec3)();function B(e,t){var r=new d.a.Builder;if(t.noCompute)return new m(r.getMap());var n=1===e.models.length&&v.a.Provider.get(e.model);if(n){for(var i=n.edgeProps.distance,a=!1,s=0,u=i.length;s<u;++s)if(-1!==i[s]){a=!0;break}if(!a)return new m(r.getMap())}return E.a.eachUnitPair(e,(function(e,n){!function(e,t,r,n){var i=e.elements,a=e.residueIndex,s=e.model.atomicConformation,u=s.x,c=s.y,l=s.z,d=t.elements,f=t.residueIndex,p=e.elements.length,m=e.model.atomicHierarchy.atoms,b=m.type_symbol,x=m.label_alt_id,O=m.label_atom_id,w=m.label_comp_id,C=t.model.atomicHierarchy.atoms,j=C.type_symbol,P=C.label_alt_id,E=C.label_atom_id,A=C.label_comp_id,D=e.model.atomicHierarchy.residues.auth_seq_id,I=t.model.atomicHierarchy.residues.auth_seq_id,B=e.model.atomicConformation.occupancy,V=t.model.atomicConformation.occupancy,R=B.isDefined&&V.isDefined,L=e.model===t.model&&y.a.Provider.get(e.model),N=e.model===t.model&&v.a.Provider.get(e.model),F=e.model===t.model&&y.a.isExhaustive(e.model),U=_.Mat4.mul(M,t.conformation.operator.inverse,e.conformation.operator.matrix),z=!_.Mat4.isIdentity(U),H=t.boundary.sphere,G=H.center,q=H.radius,W=(q+4)*(q+4);n.startUnitPair(e.id,t.id);for(var X=0;X<p;X++){var Y=i[X];if(_.Vec3.set(k,u[Y],c[Y],l[Y]),z&&_.Vec3.transformMat4(k,k,U),!(_.Vec3.squaredDistance(k,G)>W))if(r.forceCompute||!N){var Q=r.forceCompute?void 0:L&&L.byAtomIndex.get(Y);if(Q&&Q.length){for(var K=!1,Z=0,J=Q;Z<J.length;Z++){var $=J[Z],ee=$.partnerA,te=$.partnerB,re=ee.atomIndex===Y?te:ee;(De=o.SortedArray.indexOf(t.elements,re.atomIndex))<0||(T(e,Y,t,re.atomIndex)>4||(n.add(X,De,{order:$.order,flag:$.flags}),K=!0))}if(K)continue}if(!F){var ne=B.value(Y),ie=t.lookup3d.find(k[0],k[1],k[2],4),ae=ie.indices,oe=ie.count,se=ie.squaredDistances;if(0!==oe)for(var ue=Object(h.c)(b.value(Y)),ce=Object(h.f)(ue),le=Object(h.e)(ue),de=x.value(Y),fe=h.b.has(ue),pe=O.value(Y),me=w.value(a[Y]),he=0;he<oe;he++){Te=d[De=ae[he]];var ge=P.value(Te);if((!de||!ge||de===ge)&&!(R&&V.value(Te)<1&&ne<1&&D.value(Y)===I.value(Te))){var ve=Object(h.c)(j.value(Te)),be=Object(h.f)(ve);if(!ce||!be){var ye=(fe||h.b.has(ve))&&!(ce||be),_e=Math.sqrt(se[he]);if(0!==_e){var Se=Object(h.d)(ue,ve);if(_e<=(Se>0?Se:ve<0?le:(le+Object(h.e)(ve))/2)){var xe=E.value(Te),Oe=A.value(f[Te]);n.add(X,De,{order:Object(g.a)(me,Oe,pe,xe),flag:32|(ye?2:1)})}}}}}}}else for(var we=N.edgeProps,Ce=we.order,je=we.distance,Pe=we.flag,Ee=N.offset[Y],Ae=N.offset[Y+1];Ee<Ae;++Ee){var De,Te=N.b[Ee];if(!((De=o.SortedArray.indexOf(t.elements,Te))<0)&&("H"!==b.value(Y)||"H"!==j.value(Te))){var Ie=je[Ee];-1!==Ie&&Object(S.b)(T(e,Y,t,Te),Ie,.5)&&n.add(X,De,{order:Ce[Ee],flag:Pe[Ee]})}}}n.finishUnitPair()}(e,n,t,r)}),{maxRadius:4,validUnit:function(e){return l.a.isAtomic(e)},validUnitPair:function(r,n){return t.validUnitPair(e,r,n)}}),new m(r.getMap())}function V(e,t){return B(e,Object(u.__assign)(Object(u.__assign)({},h.a),{validUnitPair:t&&t.validUnitPair||function(e,t,r){var n=t.model.atomicHierarchy.derived.residue.moleculeType,i=r.model.atomicHierarchy.derived.residue.moleculeType,a=!(l.a.isAtomic(t)&&2===n[t.residueIndex[t.elements[0]]]||l.a.isAtomic(r)&&2===i[r.residueIndex[r.elements[0]]]);return E.a.validUnitPair(e,t,r)&&a}}))}!function(e){function t(e,t,r,n,i,a){return{kind:"bond-location",aStructure:e,aUnit:t,aIndex:r,bStructure:n,bUnit:i,bIndex:a}}function r(e,t){return e.aStructure.label===t.aStructure.label&&e.bStructure.label===t.bStructure.label&&e.aIndex===t.aIndex&&e.bIndex===t.bIndex&&e.aUnit.id===t.aUnit.id&&e.bUnit.id===t.bUnit.id}function n(e,t){return{kind:"bond-loci",structure:e,bonds:t}}e.Location=t,e.isLocation=function(e){return!!e&&"bond-location"===e.kind},e.areLocationsEqual=r,e.Loci=n,e.isLoci=function(e){return!!e&&"bond-loci"===e.kind},e.areLociEqual=function(e,t){if(e.structure!==t.structure)return!1;if(e.bonds.length!==t.bonds.length)return!1;for(var n=0,i=e.bonds.length;n<i;++n)if(!r(e.bonds[n],t.bonds[n]))return!1;return!0},e.isLociEmpty=function(e){return 0===e.bonds.length},e.remapLoci=function(e,r){if(r===e.structure)return e;var i=[];return e.bonds.forEach((function(n){var a=r.unitMap.get(n.aUnit.id);if(a){var s=r.unitMap.get(n.bUnit.id);if(s){var u=n.aUnit.elements[n.aIndex],c=o.SortedArray.indexOf(a.elements,u);if(-1!==c){var l=n.bUnit.elements[n.bIndex],d=o.SortedArray.indexOf(s.elements,l);-1!==d&&i.push(t(e.structure,a,c,e.structure,s,d))}}}})),n(r,i)},e.toStructureElementLoci=function(e){for(var t=[],r=new Map,n=0,a=e.bonds;n<a.length;n++){var s=a[n],u=s.aIndex,c=s.aUnit,l=s.bIndex,d=s.bUnit;c===d?r.has(c.id)?r.get(c.id).push(u,l):r.set(c.id,[u,l]):(r.has(c.id)?r.get(c.id).push(u):r.set(c.id,[u]),r.has(d.id)?r.get(d.id).push(l):r.set(d.id,[l]))}return r.forEach((function(r,n){t.push({unit:e.structure.unitMap.get(n),indices:o.SortedArray.deduplicate(o.SortedArray.ofUnsortedArray(r))})})),i.d.Loci(e.structure,t)},e.getType=function(e,t){if(t.aUnit===t.bUnit){var r=t.aUnit.bonds,n=r.getEdgeIndex(t.aIndex,t.bIndex);return n<0?a.BondType.create(0):a.BondType.create(r.edgeProps.flags[n])}var i=e.interUnitBonds.getBondFromLocation(t);return i?a.BondType.create(i.props.flag):a.BondType.create(0)},e.getOrder=function(e,t){if(t.aUnit===t.bUnit){var r=t.aUnit.bonds,n=r.getEdgeIndex(t.aIndex,t.bIndex);return n<0?0:r.edgeProps.order[n]}var i=e.interUnitBonds.getBondFromLocation(t);return i?i.props.order:0},e.getIntraUnitBondCount=function(e){for(var t=0,r=0,n=e.units.length;r<n;++r){var a=e.units[r];i.g.isAtomic(a)&&(t+=a.bonds.edgeCount)}return t};var u=function(){function e(){this.current={},this.hasNext=!1}return e.prototype.move=function(){return this.advance(),this.current},e.prototype.setElement=function(e,t,r){this.structure=e,this.unit=t,this.index=r,this.interBondIndices=e.interUnitBonds.getEdgeIndices(r,t.id),this.interBondCount=this.interBondIndices.length,this.interBondIndex=0,this.intraBondEnd=t.bonds.offset[r+1],this.intraBondIndex=t.bonds.offset[r],this.hasNext=this.interBondIndex<this.interBondCount||this.intraBondIndex<this.intraBondEnd},e.prototype.advance=function(){if(this.intraBondIndex<this.intraBondEnd)this.current.otherUnit=this.unit,this.current.otherIndex=this.unit.bonds.b[this.intraBondIndex],this.current.type=this.unit.bonds.edgeProps.flags[this.intraBondIndex],this.current.order=this.unit.bonds.edgeProps.order[this.intraBondIndex],this.intraBondIndex+=1;else{if(!(this.interBondIndex<this.interBondCount))return void(this.hasNext=!1);var e=this.structure.interUnitBonds.edges[this.interBondIndex];this.current.otherUnit=this.structure.unitMap.get(e.unitA!==this.unit.id?e.unitA:e.unitB),this.current.otherIndex=e.indexA!==this.index?e.indexA:e.indexB,this.current.type=e.props.flag,this.current.order=e.props.order,this.interBondIndex+=1}this.hasNext=this.interBondIndex<this.interBondCount||this.intraBondIndex<this.intraBondEnd},e}();e.ElementBondIterator=u,e.getBoundingSphere=function(e,t){return s.a.fromPairProvider(e.bonds.length,(function(t,r,n){var i=e.bonds[t],a=i.aUnit,o=i.aIndex,s=i.bUnit,u=i.bIndex;a.conformation.position(a.elements[o],r),s.conformation.position(s.elements[u],n)}),t)}}(I||(I={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return O}));var n,i,a=r(0),o=r(2),s=r(8),u=r(36),c=r(9),l=r(1),d=r(24),f=r(79),p=r(57);(i=n||(n={})).create=function(e){return{entries:Object(p.b)(),capacity:Math.max(1,e)}},i.get=function(e,t){for(var r=e.entries.first;r;r=r.next)if(r.value.key===t)return e.entries.remove(r),e.entries.addLast(r.value),r.value.data},i.set=function(e,t,r){var n=void 0;if(e.entries.count>=e.capacity){var i=e.entries.first;n=i.value.data,e.entries.remove(i)}return e.entries.addLast(function(e,t){return{key:e,data:t}}(t,r)),n};var m=r(267),h=r(26),g=r(312),v=r(27),b=r(13),y=r(4),_=r(23),S=r(119),x=r(273),O=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(a.__extends)(t,e),t}(s.a.CreateBehavior({name:"Volume Streaming"}));!function(e){function t(e,t,r,n,i){var a,s,c,l;return void 0===i&&(i={}),o.ParamDefinition.Group({isoValue:u.b.createIsoValueParam(null!==(a=i.isoValue)&&void 0!==a?a:r,n),color:o.ParamDefinition.Color(null!==(s=i.color)&&void 0!==s?s:t),wireframe:o.ParamDefinition.Boolean(null!==(c=i.wireframe)&&void 0!==c&&c),opacity:o.ParamDefinition.Numeric(null!==(l=i.opacity)&&void 0!==l?l:.3,{min:0,max:1,step:.01})},{label:e,isExpanded:!0})}e.RootTag="volume-streaming-info";var r={byteOffset:0,rate:1,sampleCount:[1,1,1],valuesInfo:[{mean:0,min:-1,max:1,sigma:.1},{mean:0,min:-1,max:1,sigma:.1}]};function i(n){var i=n.entryData,a=n.defaultView,s=n.structure,f=n.channelParams,p=void 0===f?{}:f,m=i||{kind:"em",header:{sampling:[r],availablePrecisions:[{precision:0,maxVoxels:0}]},emDefaultContourLevel:u.b.IsoValue.relative(0)},h=s&&s.boundary.box||Object(c.b)();return{view:o.ParamDefinition.MappedStatic(a||("em"===m.kind?"cell":"selection-box"),{off:o.ParamDefinition.Group({}),box:o.ParamDefinition.Group({bottomLeft:o.ParamDefinition.Vec3(h.min),topRight:o.ParamDefinition.Vec3(h.max)},{description:"Static box defined by cartesian coords.",isFlat:!0}),"selection-box":o.ParamDefinition.Group({radius:o.ParamDefinition.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in Å within which the volume is shown."}),bottomLeft:o.ParamDefinition.Vec3(l.Vec3.create(0,0,0),{},{isHidden:!0}),topRight:o.ParamDefinition.Vec3(l.Vec3.create(0,0,0),{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0}),cell:o.ParamDefinition.Group({}),auto:o.ParamDefinition.Group({radius:o.ParamDefinition.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in Å within which the volume is shown."}),selectionDetailLevel:o.ParamDefinition.Select(Math.min(6,m.header.availablePrecisions.length-1),m.header.availablePrecisions.map((function(e,t){return[t,t+1+" [ "+(0|Math.pow(e.maxVoxels,1/3))+"^3 cells ]"]})),{label:"Selection Detail",description:"Determines the maximum number of voxels. Depending on the size of the volume options are in the range from 0 (0.52M voxels) to 6 (25.17M voxels)."}),isSelection:o.ParamDefinition.Boolean(!1,{isHidden:!0}),bottomLeft:o.ParamDefinition.Vec3(h.min,{},{isHidden:!0}),topRight:o.ParamDefinition.Vec3(h.max,{},{isHidden:!0})},{description:"Box around focused element.",isFlat:!0})},{options:e.ViewTypeOptions,description:'Controls what of the volume is displayed. "Off" hides the volume alltogether. "Bounded box" shows the volume inside the given box. "Around Interaction" shows the volume around the focused element/atom. "Whole Structure" shows the volume for the whole structure.'}),detailLevel:o.ParamDefinition.Select(Math.min(3,m.header.availablePrecisions.length-1),m.header.availablePrecisions.map((function(e,t){return[t,t+1+" [ "+(0|Math.pow(e.maxVoxels,1/3))+"^3 cells ]"]})),{description:"Determines the maximum number of voxels. Depending on the size of the volume options are in the range from 0 (0.52M voxels) to 6 (25.17M voxels)."}),channels:"em"===m.kind?o.ParamDefinition.Group({em:t("EM",Object(d.Color)(6524815),m.emDefaultContourLevel||u.b.IsoValue.relative(1),m.header.sampling[0].valuesInfo[0],p.em)},{isFlat:!0}):o.ParamDefinition.Group({"2fo-fc":t("2Fo-Fc",Object(d.Color)(3367602),u.b.IsoValue.relative(1.5),m.header.sampling[0].valuesInfo[0],p["2fo-fc"]),"fo-fc(+ve)":t("Fo-Fc(+ve)",Object(d.Color)(3390259),u.b.IsoValue.relative(3),m.header.sampling[0].valuesInfo[1],p["fo-fc(+ve)"]),"fo-fc(-ve)":t("Fo-Fc(-ve)",Object(d.Color)(12268339),u.b.IsoValue.relative(-3),m.header.sampling[0].valuesInfo[1],p["fo-fc(-ve)"])},{isFlat:!0})}}e.createParams=function(e){void 0===e&&(e={});var t=e.data,r=e.defaultView,n=e.channelParams,a=new Map;t&&t.entries.forEach((function(e){return a.set(e.dataId,e)}));var s=t?t.entries.map((function(e){return[e.dataId,e.dataId]})):[],u=t?t.entries[0].dataId:"";return{entry:o.ParamDefinition.Mapped(u,s,(function(e){return o.ParamDefinition.Group(i({entryData:a.get(e),defaultView:r,structure:t&&t.structure,channelParams:n}))}))}},e.createEntryParams=i,e.ViewTypeOptions=[["off","Off"],["box","Bounded Box"],["selection-box","Around Focus"],["cell","Whole Structure"],["auto","Auto"]],e.ChannelTypeOptions=[["em","em"],["2fo-fc","2fo-fc"],["fo-fc(+ve)","fo-fc(+ve)"],["fo-fc(-ve)","fo-fc(-ve)"]];var p=function(e){function t(t,r){var i=e.call(this,t,{})||this;return i.plugin=t,i.data=r,i.cache=n.create(25),i.params={},i.lastLoci=_.EmptyLoci,i.ref="",i.channels={},i._invTransform=Object(l.Mat4)(),i.infoMap=new Map,i.data.entries.forEach((function(e){return i.infoMap.set(e.dataId,e)})),i}return Object(a.__extends)(t,e),Object.defineProperty(t.prototype,"info",{get:function(){return this.infoMap.get(this.params.entry.name)},enumerable:!1,configurable:!0}),t.prototype.queryData=function(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,r,i,o,s,u,c,l,d;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return t=Object(m.a)(this.data.serverUrl,this.info.kind+"/"+this.info.dataId.toLowerCase()),e?(r=e.min,i=e.max,t+="/box/"+r.map((function(e){return Math.round(1e3*e)/1e3})).join(",")+"/"+i.map((function(e){return Math.round(1e3*e)/1e3})).join(",")):t+="/cell",o=this.params.entry.params.detailLevel,"auto"===this.params.entry.params.view.name&&this.params.entry.params.view.params.isSelection&&(o=this.params.entry.params.view.params.selectionDetailLevel),t+="?detail="+o,(s=n.get(this.cache,t))?[2,s.data]:(u=S.Asset.getUrlAsset(this.plugin.managers.asset,t),[4,this.plugin.runTask(this.plugin.managers.asset.resolve(u,"binary"))]);case 1:return c=a.sent(),[4,this.parseCif(c.data)];case 2:return(l=a.sent())?((d=n.set(this.cache,t,{data:l,asset:c}))&&d.asset.dispose(),[2,l]):[2]}}))}))},t.prototype.parseCif=function(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,r,n,i,o,s;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return[4,this.plugin.runTask(h.a.parseBinary(e))];case 1:if((t=a.sent()).isError)return this.plugin.log.error("VolumeStreaming, parsing CIF: "+t.toString()),[2];if(t.result.blocks.length<2)return this.plugin.log.error("VolumeStreaming: Invalid data."),[2];r={},n=1,a.label=2;case 2:return n<t.result.blocks.length?(i=t.result.blocks[n],o=h.a.schema.densityServer(i),[4,this.plugin.runTask(Object(g.b)(o))]):[3,5];case 3:s=a.sent(),r[i.header]=s,a.label=4;case 4:return n++,[3,2];case 5:return[2,r]}}))}))},t.prototype.updateSelectionBoxParams=function(e){if("selection-box"===this.params.entry.params.view.name){var t=this.plugin.state.data,r=Object(a.__assign)(Object(a.__assign)({},this.params),{entry:{name:this.params.entry.name,params:Object(a.__assign)(Object(a.__assign)({},this.params.entry.params),{view:{name:"selection-box",params:{radius:this.params.entry.params.view.params.radius,bottomLeft:e.min,topRight:e.max}}})}}),n=t.build().to(this.ref).update(r);v.PluginCommands.State.Update(this.plugin,{state:t,tree:n,options:{doNotUpdateCurrent:!0}})}},t.prototype.updateAutoParams=function(e,t){if("auto"===this.params.entry.params.view.name){var r=this.plugin.state.data,n=Object(a.__assign)(Object(a.__assign)({},this.params),{entry:{name:this.params.entry.name,params:Object(a.__assign)(Object(a.__assign)({},this.params.entry.params),{view:{name:"auto",params:{radius:this.params.entry.params.view.params.radius,selectionDetailLevel:this.params.entry.params.view.params.selectionDetailLevel,isSelection:t,bottomLeft:(null==e?void 0:e.min)||l.Vec3.zero(),topRight:(null==e?void 0:e.max)||l.Vec3.zero()}}})}}),i=r.build().to(this.ref).update(n);v.PluginCommands.State.Update(this.plugin,{state:r,tree:i,options:{doNotUpdateCurrent:!0}})}},t.prototype.getStructureRoot=function(){return this.plugin.state.data.select(b.StateSelection.Generators.byRef(this.ref).rootOfType(s.a.Molecule.Structure))[0]},t.prototype.register=function(e){var t=this;this.ref=e,this.subscribeObservable(this.plugin.state.events.object.removed,(function(e){s.a.Molecule.Structure.is(e.obj)&&y.StructureElement.Loci.is(t.lastLoci)&&t.lastLoci.structure===e.obj.data&&(t.lastLoci=_.EmptyLoci)})),this.subscribeObservable(this.plugin.state.events.object.updated,(function(e){s.a.Molecule.Structure.is(e.oldObj)&&y.StructureElement.Loci.is(t.lastLoci)&&t.lastLoci.structure===e.oldObj.data&&(t.lastLoci=_.EmptyLoci)})),this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,(function(e){if(t.plugin.state.data.tree.children.has(t.ref)){var r=e?e.loci:_.EmptyLoci;switch(t.params.entry.params.view.name){case"auto":t.updateAuto(r);break;case"selection-box":t.updateSelectionBox(r);break;default:t.lastLoci=r}}}))},t.prototype.unregister=function(){for(var e=this.cache.entries.first;e;)e.value.data.asset.dispose(),e=e.next},t.prototype.getBoxFromLoci=function(e){var t,r,n;if(_.Loci.isEmpty(e))return Object(c.b)();var i=this.plugin.helpers.substructureParent.get(e.structure,!0);if(!i)return Object(c.b)();var a=this.getStructureRoot();if(!a||(null===(t=a.obj)||void 0===t?void 0:t.data)!==(null===(r=i.obj)||void 0===r?void 0:r.data))return Object(c.b)();var o=x.a.get(null===(n=a.obj)||void 0===n?void 0:n.data.models[0]);o&&l.Mat4.invert(this._invTransform,o);var s=y.StructureElement.Loci.extendToWholeResidues(e),u=y.StructureElement.Loci.getBoundary(s,o&&!Number.isNaN(this._invTransform[0])?this._invTransform:void 0).box;return 1===y.StructureElement.Loci.size(s)&&c.b.expand(u,u,l.Vec3.create(1,1,1)),u},t.prototype.updateAuto=function(e){if(this.lastLoci=e,Object(_.isEmptyLoci)(e))this.updateAutoParams("x-ray"===this.info.kind?this.data.structure.boundary.box:void 0,!1);else{var t=this.getBoxFromLoci(e);this.updateAutoParams(t,!0)}},t.prototype.updateSelectionBox=function(e){if(_.Loci.areEqual(this.lastLoci,e))return this.lastLoci=_.EmptyLoci,void this.updateSelectionBoxParams(Object(c.b)());if(this.lastLoci=e,Object(_.isEmptyLoci)(e))this.updateSelectionBoxParams(Object(c.b)());else{var t=this.getBoxFromLoci(e);this.updateSelectionBoxParams(t)}},t.prototype.update=function(e){return Object(a.__awaiter)(this,void 0,void 0,(function(){var t,r,n,i,o,s,d;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:switch(t="selection-box"===e.entry.params.view.name&&this.params&&this.params.entry&&this.params.entry.params&&this.params.entry.params.view&&"selection-box"!==this.params.entry.params.view.name,this.params=e,r=void 0,n=!1,e.entry.params.view.name){case"off":n=!0;break;case"box":r=c.b.create(e.entry.params.view.params.bottomLeft,e.entry.params.view.params.topRight),n=c.b.volume(r)<1e-4;break;case"selection-box":r=t?this.getBoxFromLoci(this.lastLoci)||Object(c.b)():c.b.create(l.Vec3.clone(e.entry.params.view.params.bottomLeft),l.Vec3.clone(e.entry.params.view.params.topRight)),i=e.entry.params.view.params.radius,n=c.b.volume(r)<1e-4,c.b.expand(r,r,l.Vec3.create(i,i,i));break;case"cell":r="x-ray"===this.info.kind?this.data.structure.boundary.box:void 0;break;case"auto":(r=e.entry.params.view.params.isSelection||"x-ray"===this.info.kind?c.b.create(l.Vec3.clone(e.entry.params.view.params.bottomLeft),l.Vec3.clone(e.entry.params.view.params.topRight)):void 0)&&(n=c.b.volume(r)<1e-4,e.entry.params.view.params.isSelection&&(i=e.entry.params.view.params.radius,c.b.expand(r,r,l.Vec3.create(i,i,i))))}return n?(s={},[3,3]):[3,1];case 1:return[4,this.queryData(r)];case 2:s=a.sent(),a.label=3;case 3:return(o=s)?(d=e.entry.params.channels,"x-ray"===this.info.kind?(this.channels["2fo-fc"]=this.createChannel(o["2FO-FC"]||u.b.One,d["2fo-fc"],this.info.header.sampling[0].valuesInfo[0]),this.channels["fo-fc(+ve)"]=this.createChannel(o["FO-FC"]||u.b.One,d["fo-fc(+ve)"],this.info.header.sampling[0].valuesInfo[1]),this.channels["fo-fc(-ve)"]=this.createChannel(o["FO-FC"]||u.b.One,d["fo-fc(-ve)"],this.info.header.sampling[0].valuesInfo[1])):this.channels.em=this.createChannel(o.EM||u.b.One,d.em,this.info.header.sampling[0].valuesInfo[0]),[2,!0]):[2,!1]}}))}))},t.prototype.createChannel=function(e,t,r){var n=t;return{data:e,color:n.color,wireframe:n.wireframe,opacity:n.opacity,isoValue:"relative"===n.isoValue.kind?n.isoValue:u.b.IsoValue.toRelative(n.isoValue,r)}},t.prototype.getDescription=function(){return"selection-box"===this.params.entry.params.view.name?"Selection":"box"===this.params.entry.params.view.name?"Static Box":"cell"===this.params.entry.params.view.name?"Cell":""},t}(f.a.WithSubscribers);e.Behavior=p}(O||(O={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(46),i=r(244),a=r(44),o=r(70);function s(){return s.zero()}!function(e){function t(){var e=[.1,0,0];return e[0]=0,e}function r(e,t){var r=t[0],n=t[1],i=t[2],o=Math.sqrt(n*n+i*i),s=(Object(a.f)(Math.atan2(i,n))+360)%360;return 0===Math.round(1e4*o)&&(s=Number.NaN),e[0]=s,e[1]=o,e[2]=r,e}function s(e,t,r){return e[0]=t[0]-l*r,e[1]=t[1],e[2]=t[2],e}e.zero=t,e.create=function(e,r,n){var i=t();return i[0]=e,i[1]=r,i[2]=n,i},e.fromColor=function(e,t){var r=n.Color.toRgb(t),i=function(e,t,r){e=b(e),t=b(t),r=b(r);var n=y((.4124564*e+.3575761*t+.1804375*r)/d),i=y((.2126729*e+.7151522*t+.072175*r)/f),a=y((.0193339*e+.119192*t+.9503041*r)/p);return[n,i,a]}(r[0],r[1],r[2]),a=i[0],o=i[1],s=i[2],u=116*o-16;return e[0]=u<0?0:u,e[1]=500*(a-o),e[2]=200*(o-s),e},e.fromHcl=function(e,t){return i.a.toLab(e,t)},e.toColor=function(e){var t=(e[0]+16)/116,r=isNaN(e[1])?t:t+e[1]/500,i=isNaN(e[2])?t:t-e[2]/200;t=f*v(t);var a=g(3.2404542*(r=d*v(r))-1.5371385*t-.4985314*(i=p*v(i))),s=g(-.969266*r+1.8760108*t+.041556*i),u=g(.0556434*r-.2040259*t+1.0572252*i);return n.Color.fromRgb(Math.round(Object(o.a)(a,0,255)),Math.round(Object(o.a)(s,0,255)),Math.round(Object(o.a)(u,0,255)))},e.toHcl=r,e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},e.darken=s,e.lighten=function(e,t,r){return s(e,t,-r)};var u=[0,0,0];function c(e,t,n){return r(u,t),i.a.toLab(e,i.a.saturate(u,u,n))}e.saturate=c,e.desaturate=function(e,t,r){return c(e,t,-r)};var l=18,d=.95047,f=1,p=1.08883,m=.137931034,h=.12841855;function g(e){return 255*(e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function v(e){return e>.206896552?e*e*e:h*(e-m)}function b(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function y(e){return e>.008856452?Math.pow(e,1/3):e/h+m}}(s||(s={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(5),o=r(1),s=r(122),u=r(115),c=r(124),l=r(132),d=r(53),f=r(2),p=r(52),m=r(9),h=r(30),g=r(129),v=r(130),b=r(12),y=r(136);!function(e){function t(e,t,r,i,o,u,c,l,d){return d?function(e,t,r,n,i,o,s,u,c){u>c.cylinderCount&&(a.e.update(c.mappingBuffer,e),a.e.update(c.indexBuffer,t));return c.cylinderCount=u,a.e.update(c.groupBuffer,r),a.e.update(c.startBuffer,n),a.e.update(c.endBuffer,i),a.e.update(c.scaleBuffer,o),a.e.update(c.capBuffer,s),c}(e,t,r,i,o,u,c,l,d):function(e,t,r,i,o,u,c,l){var d,f=Object(m.g)(),h=-1,g=-1,v={kind:"cylinders",cylinderCount:l,mappingBuffer:a.e.create(e),indexBuffer:a.e.create(t),groupBuffer:a.e.create(r),startBuffer:a.e.create(i),endBuffer:a.e.create(o),scaleBuffer:a.e.create(u),capBuffer:a.e.create(c),get boundingSphere(){var e=n(v);if(e!==h){var t=Object(p.a)(v.startBuffer.ref.value,6*v.cylinderCount,6),r=Object(p.a)(v.endBuffer.ref.value,6*v.cylinderCount,6);m.g.expandBySphere(f,t,r),h=e}return f},get groupMapping(){return v.groupBuffer.ref.version!==g&&(d=Object(s.c)(v.groupBuffer.ref.value,v.cylinderCount,6),g=v.groupBuffer.ref.version),d},setBoundingSphere:function(e){m.g.copy(f,e),h=n(v)}};return v}(e,t,r,i,o,u,c,l)}function r(e){return t(e?e.mappingBuffer.ref.value:new Float32Array(0),e?e.indexBuffer.ref.value:new Uint32Array(0),e?e.groupBuffer.ref.value:new Float32Array(0),e?e.startBuffer.ref.value:new Float32Array(0),e?e.endBuffer.ref.value:new Float32Array(0),e?e.scaleBuffer.ref.value:new Float32Array(0),e?e.capBuffer.ref.value:new Float32Array(0),0,e)}function n(e){return Object(b.l)([e.cylinderCount,e.mappingBuffer.ref.version,e.indexBuffer.ref.version,e.groupBuffer.ref.version,e.startBuffer.ref.version,e.endBuffer.ref.version,e.scaleBuffer.ref.version,e.capBuffer.ref.version])}function _(e,t){var r=6*e.cylinderCount,n=t.instanceCount.ref.value,i=Object(d.b)(),a=i.position,s=e.startBuffer.ref.value,u=e.endBuffer.ref.value,c=t.aTransform.ref.value;return Object(d.a)(r,n,2,(function(e,t){var r=e%6==0?s:u;return t<0?o.Vec3.fromArray(a,r,3*e):o.Vec3.transformMat4Offset(a,r,c,0,3*e,16*t),i}))}function S(e,t,r,n,s){var d=r.instanceCount,f=r.groupCount,b=_(e,t),S=Object(u.a)(r,b,n.color),x=Object(l.a)(r,n.size),O=Object(c.a)(d*f),w=Object(g.c)(),C=Object(v.c)(),j=Object(y.d)(),P={drawCount:4*e.cylinderCount*3,vertexCount:6*e.cylinderCount,groupCount:f,instanceCount:d},E=Object(l.b)(x)*s.sizeFactor,A=m.g.clone(e.boundingSphere),D=Object(p.b)(A,t.aTransform.ref.value,d);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({aMapping:e.mappingBuffer,aGroup:e.groupBuffer,aStart:e.startBuffer,aEnd:e.endBuffer,aScale:e.scaleBuffer,aCap:e.capBuffer,elements:e.indexBuffer,boundingSphere:a.e.create(D),invariantBoundingSphere:a.e.create(A),uInvariantBoundingSphere:a.e.create(o.Vec4.ofSphere(A))},S),x),O),w),C),j),t),{padding:a.e.create(E)}),h.a.createValues(s,P)),{uSizeFactor:a.e.create(s.sizeFactor*s.sizeAspectRatio),dDoubleSided:a.e.create(s.doubleSided),dIgnoreLight:a.e.create(s.ignoreLight),dXrayShaded:a.e.create(s.xrayShaded)})}function x(e,t){h.a.updateRenderableState(e,t),e.opaque=e.opaque&&!t.xrayShaded,e.writeDepth=e.opaque}e.create=t,e.createEmpty=r,e.transform=function(e,t){var r=e.startBuffer.ref.value;Object(s.e)(t,r,0,6*e.cylinderCount),a.e.update(e.startBuffer,r);var n=e.endBuffer.ref.value;Object(s.e)(t,n,0,6*e.cylinderCount),a.e.update(e.endBuffer,n)},e.Params=Object(i.__assign)(Object(i.__assign)({},h.a.Params),{sizeFactor:f.ParamDefinition.Numeric(1,{min:0,max:10,step:.1}),sizeAspectRatio:f.ParamDefinition.Numeric(1,{min:0,max:3,step:.01}),doubleSided:f.ParamDefinition.Boolean(!1,h.a.CustomQualityParamInfo),ignoreLight:f.ParamDefinition.Boolean(!1,h.a.ShadingCategory),xrayShaded:f.ParamDefinition.Boolean(!1,h.a.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:r,createValues:S,createValuesSimple:function(t,r,n,a,o){var s=h.a.createSimple(n,a,o),u=Object(i.__assign)(Object(i.__assign)({},f.ParamDefinition.getDefaultValues(e.Params)),r);return S(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){h.a.updateValues(e,t),a.e.updateIfChanged(e.uSizeFactor,t.sizeFactor*t.sizeAspectRatio),a.e.updateIfChanged(e.dDoubleSided,t.doubleSided),a.e.updateIfChanged(e.dIgnoreLight,t.ignoreLight),a.e.updateIfChanged(e.dXrayShaded,t.xrayShaded)},updateBoundingSphere:function(e,t){var r=m.g.clone(t.boundingSphere),n=Object(p.b)(r,e.aTransform.ref.value,e.instanceCount.ref.value);m.g.equals(n,e.boundingSphere.ref.value)||a.e.update(e.boundingSphere,n);m.g.equals(r,e.invariantBoundingSphere.ref.value)||(a.e.update(e.invariantBoundingSphere,r),a.e.update(e.uInvariantBoundingSphere,o.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=h.a.createRenderableState(e);return x(t,e),t},updateRenderableState:x,createPositionIterator:_}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"createStructureRepresentationParams",(function(){return a})),r.d(t,"getStructureThemeTypes",(function(){return o})),r.d(t,"createStructureColorThemeParams",(function(){return s})),r.d(t,"createStructureSizeThemeParams",(function(){return u}));var n=r(4),i=r(2);function a(e,t,r){void 0===r&&(r={});var i=r;return"string"==typeof i.type||"string"==typeof i.color||"string"==typeof i.size?function(e,t,r){var n=r.type&&e.representation.structure.registry.get(r.type)||e.representation.structure.registry.default.provider,i=r.color&&e.representation.structure.themes.colorThemeRegistry.get(r.color)||e.representation.structure.themes.colorThemeRegistry.get(n.defaultColorTheme.name),a=r.size&&e.representation.structure.themes.sizeThemeRegistry.get(r.size)||e.representation.structure.themes.sizeThemeRegistry.get(n.defaultSizeTheme.name);return c(e,t,{type:n,typeParams:r.typeParams,color:i,colorParams:r.colorParams,size:a,sizeParams:r.sizeParams})}(e,t||n.Structure.Empty,r):c(e,t||n.Structure.Empty,r)}function o(e,t){var r=e.representation.structure.themes;return t?r.colorThemeRegistry.getApplicableTypes({structure:t}):r.colorThemeRegistry.types}function s(e,t,r,a,o){var s=e.representation.structure,u=s.registry,c=s.themes,l=u.get(r||u.default.name),d=c.colorThemeRegistry.get(a||l.defaultColorTheme.name),f=i.ParamDefinition.getDefaultValues(d.getParams({structure:t||n.Structure.Empty}));return d.name===l.defaultColorTheme.name&&Object.assign(f,l.defaultColorTheme.props),{name:d.name,params:Object.assign(f,o)}}function u(e,t,r,a,o){var s=e.representation.structure,u=s.registry,c=s.themes,l=u.get(r||u.default.name),d=c.sizeThemeRegistry.get(a||l.defaultSizeTheme.name),f=i.ParamDefinition.getDefaultValues(d.getParams({structure:t||n.Structure.Empty}));return d.name===l.defaultSizeTheme.name&&Object.assign(f,l.defaultSizeTheme.props),{name:d.name,params:Object.assign(f,o)}}function c(e,t,r){void 0===r&&(r={});var n=e.representation.structure.themes,a={structure:t},o=r.type||e.representation.structure.registry.default.provider,s=i.ParamDefinition.getDefaultValues(o.getParams(n,t)),u=Object.assign(s,r.typeParams),c=r.color||n.colorThemeRegistry.get(o.defaultColorTheme.name),l=i.ParamDefinition.getDefaultValues(c.getParams(a));c.name===o.defaultColorTheme.name&&Object.assign(l,o.defaultColorTheme.props);var d=Object.assign(l,r.colorParams),f=r.size||n.sizeThemeRegistry.get(o.defaultSizeTheme.name),p=i.ParamDefinition.getDefaultValues(f.getParams(a));f.name===o.defaultSizeTheme.name&&Object.assign(p,o.defaultSizeTheme.props);var m=Object.assign(p,r.sizeParams);return{type:{name:o.name,params:u},colorTheme:{name:c.name,params:d},sizeTheme:{name:f.name,params:m}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(20),i=r(34);function a(e,t){return function(r){return r.lift(new o(e,t))}}var o=function(){function e(e,t){this.predicate=e,this.thisArg=t}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.predicate,this.thisArg))},e}(),s=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.predicate=r,i.thisArg=n,i.count=0,i}return n.a(t,e),t.prototype._next=function(e){var t;try{t=this.predicate.call(this.thisArg,e,this.count++)}catch(e){return void this.destination.error(e)}t&&this.destination.next(e)},t}(i.a)},function(e,t,r){"use strict";r.r(t),r.d(t,"QueryRuntimeTable",(function(){return c})),r.d(t,"DefaultQueryRuntimeTable",(function(){return l})),r.d(t,"QueryCompilerCtx",(function(){return d})),r.d(t,"QueryCompiledSymbol",(function(){return n})),r.d(t,"CompiledQueryFn",(function(){return i})),r.d(t,"QueryRuntimeArguments",(function(){return a})),r.d(t,"QuerySymbolRuntime",(function(){return o})),r.d(t,"compile",(function(){return h}));var n,i,a,o,s=r(142),u=r(4),c=function(){function e(){this.map=new Map}return e.prototype.removeSymbol=function(e){this.map.delete(e.symbol.id)},e.prototype.addSymbol=function(e){this.map.has(e.symbol.id)&&console.warn("Symbol '"+e.symbol.id+"' already added. Call removeSymbol/removeCustomProps re-adding the symbol."),this.map.set(e.symbol.id,e)},e.prototype.addCustomProp=function(e){if(e.symbols)for(var t=0,r=Object.keys(e.symbols);t<r.length;t++){var n=r[t];this.addSymbol(e.symbols[n])}},e.prototype.removeCustomProp=function(e){if(e.symbols)for(var t=0,r=Object.keys(e.symbols);t<r.length;t++){var n=r[t];this.removeSymbol(e.symbols[n])}},e.prototype.getRuntime=function(e){return this.map.get(e)},e}(),l=new c,d=function(e){this.table=e,this.constQueryContext=new u.QueryContext(u.Structure.Empty)};!function(e){e.Const=function(e){return{kind:"const",value:e}},e.Dynamic=function(e){return{kind:"dynamic",runtime:e}}}(n||(n={})),function(e){e.Const=function(e){return{isConst:!0,fn:function(t){return e}}},e.Dynamic=function(e){return{isConst:!1,fn:e}}}(i||(i={})),function(e){e.forEachEval=function(e,t,r,n){if("number"==typeof e.length)for(var i=0,a=e.length;i<a;i++)r(e[i](t),i,n);else{i=0;for(var o=0,s=Object.keys(e);o<s.length;o++){r(e[s[o]](t),i++,n)}}return n}}(a||(a={})),function(e){e.Const=function(e,t){return new f(e,t,!0)},e.Dynamic=function(e,t){return new f(e,t,!1)}}(o||(o={}));var f=function(){function e(e,t,r){this.symbol=e,this.fn=t,this.isConst=r}return e.prototype.compile=function(e,t){var r,n=!1;if(t)if(s.a.isArgumentsArray(t)){r=[],n=!1;for(var a=0,o=t;a<o.length;a++){var u=m(e,o[a]);n=n&&u.isConst,r.push(u.fn)}}else{r=Object.create(null),n=!1;for(var c=0,l=Object.keys(t);c<l.length;c++){var d=l[c];u=m(e,t[d]);n=n&&u.isConst,r[d]=u.fn}}else r=void 0,n=!0;return this.isConst&&this.isConst&&n?i.Const(this.fn(e.constQueryContext,r)):i.Dynamic(p(this.fn,r))},e}();function p(e,t){return function(r){return e(r,t)}}function m(e,t){if(s.a.isLiteral(t))return i.Const(t);if(s.a.isSymbol(t)){var r=e.table.getRuntime(t.name);return r?r.compile(e):i.Const(t.name)}if(!s.a.isSymbol(t.head))throw new Error("Can only apply symbols.");var n=e.table.getRuntime(t.head.name);if(!n)throw new Error("Symbol '"+t.head.name+"' is not implemented.");return n.compile(e,t.args)}function h(e){return m(new d(l),e).fn}var g=r(14),v=r(22),b=r(96),y=r(42),_=r(120),S=r(12),x=r(274),O=r(29),w=o.Const,C=o.Dynamic,j=[w(g.a.core.type.bool,(function(e,t){return!!t[0](e)})),w(g.a.core.type.num,(function(e,t){return+t[0](e)})),w(g.a.core.type.str,(function(e,t){return""+t[0](e)})),w(g.a.core.type.list,(function(e,t){return a.forEachEval(t,e,(function(e,t,r){return r[t]=e}),[])})),w(g.a.core.type.set,(function(e,t){return a.forEachEval(t,e,(function(e,t,r){return r.add(e)}),new Set)})),w(g.a.core.type.regex,(function(e,t){return new RegExp(t[0](e),t[1]&&t[1](e)||"")})),w(g.a.core.type.bitflags,(function(e,t){return+t[0](e)})),w(g.a.core.type.compositeKey,(function(e,t){return a.forEachEval(t,e,(function(e,t,r){return r[t]=""+e}),[]).join("-")})),w(g.a.core.logic.not,(function(e,t){return!t[0](e)})),w(g.a.core.logic.and,(function(e,t){if("number"==typeof t.length){for(var r=0,n=t.length;r<n;r++)if(!t[r](e))return!1}else for(var i=0,a=Object.keys(t);i<a.length;i++){if(!t[a[i]](e))return!1}return!0})),w(g.a.core.logic.or,(function(e,t){if("number"==typeof t.length){for(var r=0,n=t.length;r<n;r++)if(t[r](e))return!0}else for(var i=0,a=Object.keys(t);i<a.length;i++){if(t[a[i]](e))return!0}return!1})),w(g.a.core.rel.eq,(function(e,t){return t[0](e)===t[1](e)})),w(g.a.core.rel.neq,(function(e,t){return t[0](e)!==t[1](e)})),w(g.a.core.rel.lt,(function(e,t){return t[0](e)<t[1](e)})),w(g.a.core.rel.lte,(function(e,t){return t[0](e)<=t[1](e)})),w(g.a.core.rel.gr,(function(e,t){return t[0](e)>t[1](e)})),w(g.a.core.rel.gre,(function(e,t){return t[0](e)>=t[1](e)})),w(g.a.core.rel.inRange,(function(e,t){var r=t[0](e);return r>=t[1](e)&&r<=t[2](e)})),w(g.a.core.math.add,(function(e,t){var r=0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r+=t[n](e);else for(var a=0,o=Object.keys(t);a<o.length;a++){r+=t[o[a]](e)}return r})),w(g.a.core.math.sub,(function(e,t){var r=0;if("number"==typeof t.length){if(1===t.length)return-t[0](e);r=t[0](e)||0;for(var n=1,i=t.length;n<i;n++)r-=t[n](e)}else{var a=Object.keys(t);if(1===a.length)return-t[a[0]](e);r=t[a[0]](e)||0;for(n=1,i=a.length;n<i;n++)r-=t[a[n]](e)}return r})),w(g.a.core.math.mult,(function(e,t){var r=1;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r*=t[n](e);else for(var a=0,o=Object.keys(t);a<o.length;a++){r*=t[o[a]](e)}return r})),w(g.a.core.math.div,(function(e,t){return t[0](e)/t[1](e)})),w(g.a.core.math.pow,(function(e,t){return Math.pow(t[0](e),t[1](e))})),w(g.a.core.math.mod,(function(e,t){return t[0](e)%t[1](e)})),w(g.a.core.math.min,(function(e,t){var r=Number.POSITIVE_INFINITY;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=Math.min(t[n](e),r);else for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];r=Math.min(t[s](e),r)}return r})),w(g.a.core.math.max,(function(e,t){var r=Number.NEGATIVE_INFINITY;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=Math.max(t[n](e),r);else for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];r=Math.max(t[s](e),r)}return r})),w(g.a.core.math.floor,(function(e,t){return Math.floor(t[0](e))})),w(g.a.core.math.ceil,(function(e,t){return Math.ceil(t[0](e))})),w(g.a.core.math.roundInt,(function(e,t){return Math.round(t[0](e))})),w(g.a.core.math.abs,(function(e,t){return Math.abs(t[0](e))})),w(g.a.core.math.sqrt,(function(e,t){return Math.sqrt(t[0](e))})),w(g.a.core.math.cbrt,(function(e,t){return Math.cbrt(t[0](e))})),w(g.a.core.math.sin,(function(e,t){return Math.sin(t[0](e))})),w(g.a.core.math.cos,(function(e,t){return Math.cos(t[0](e))})),w(g.a.core.math.tan,(function(e,t){return Math.tan(t[0](e))})),w(g.a.core.math.asin,(function(e,t){return Math.asin(t[0](e))})),w(g.a.core.math.acos,(function(e,t){return Math.acos(t[0](e))})),w(g.a.core.math.atan,(function(e,t){return Math.atan(t[0](e))})),w(g.a.core.math.sinh,(function(e,t){return Math.sinh(t[0](e))})),w(g.a.core.math.cosh,(function(e,t){return Math.cosh(t[0](e))})),w(g.a.core.math.tanh,(function(e,t){return Math.tanh(t[0](e))})),w(g.a.core.math.exp,(function(e,t){return Math.exp(t[0](e))})),w(g.a.core.math.log,(function(e,t){return Math.log(t[0](e))})),w(g.a.core.math.log10,(function(e,t){return Math.log10(t[0](e))})),w(g.a.core.math.atan2,(function(e,t){return Math.atan2(t[0](e),t[1](e))})),w(g.a.core.str.match,(function(e,t){return t[0](e).test(t[1](e))})),w(g.a.core.str.concat,(function(e,t){var r=[];if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r.push(t[n](e).toString());else for(var a=0,o=Object.keys(t);a<o.length;a++){var s=o[a];r.push(t[s](e).toString())}return r.join("")})),w(g.a.core.list.getAt,(function(e,t){return t[0](e)[t[1](e)]})),w(g.a.core.list.equal,(function(e,t){return Object(O.arrayEqual)(t[0](e),t[1](e))})),w(g.a.core.set.has,(function(e,t){return t[0](e).has(t[1](e))})),w(g.a.core.set.isSubset,(function(e,t){return b.a.isSuperset(t[1](e),t[0](e))})),w(g.a.core.flags.hasAny,(function(e,t){var r=t[1](e),n=t[0](e);return r?0!=(n&r):!!n})),w(g.a.core.flags.hasAll,(function(e,t){var r=t[1](e),n=t[0](e);return r?(n&r)===r:!n})),w(g.a.structureQuery.type.elementSymbol,(function(e,t){return Object(v.ElementSymbol)(t[0](e))})),w(g.a.structureQuery.type.atomName,(function(e,t){return Object(y.g)(t[0](e))})),w(g.a.structureQuery.type.bondFlags,(function(e,t){var r=0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=E(r,t[n](e));else for(var a=0,o=Object.keys(t);a<o.length;a++){r=E(r,t[o[a]](e))}return r})),w(g.a.structureQuery.type.ringFingerprint,(function(e,t){return u.UnitRing.elementFingerprint(function(e,t){var r=[];if(!t)return r;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r.push(t[n](e));else{var a=Object.keys(t);for(n=1,i=a.length;n<i;n++)r.push(t[a[n]](e))}return r}(e,t))})),w(g.a.structureQuery.type.secondaryStructureFlags,(function(e,t){var r=0;if("number"==typeof t.length)for(var n=0,i=t.length;n<i;n++)r=A(r,t[n](e));else for(var a=0,o=Object.keys(t);a<o.length;a++){r=A(r,t[o[a]](e))}return r})),C(g.a.structureQuery.filter.pick,(function(e,t){return u.Queries.filters.pick(t[0],t.test)(e)})),C(g.a.structureQuery.filter.first,(function(e,t){return u.Queries.filters.first(t[0])(e)})),C(g.a.structureQuery.filter.withSameAtomProperties,(function(e,t){return u.Queries.filters.withSameAtomProperties(t[0],t.source,t.property)(e)})),C(g.a.structureQuery.filter.intersectedBy,(function(e,t){return u.Queries.filters.areIntersectedBy(t[0],t.by)(e)})),C(g.a.structureQuery.filter.within,(function(e,t){return u.Queries.filters.within({query:t[0],target:t.target,minRadius:t["min-radius"],maxRadius:t["max-radius"],elementRadius:t["atom-radius"],invert:t.invert})(e)})),C(g.a.structureQuery.filter.isConnectedTo,(function(e,t){return u.Queries.filters.isConnectedTo({query:t[0],target:t.target,disjunct:t.disjunct,invert:t.invert,bondTest:t["bond-test"]})(e)})),C(g.a.structureQuery.generator.atomGroups,(function(e,t){return u.Queries.generators.atoms({entityTest:t["entity-test"],chainTest:t["chain-test"],residueTest:t["residue-test"],atomTest:t["atom-test"],groupBy:t["group-by"]})(e)})),C(g.a.structureQuery.generator.all,(function(e){return u.Queries.generators.all(e)})),C(g.a.structureQuery.generator.empty,(function(e){return u.Queries.generators.none(e)})),C(g.a.structureQuery.generator.bondedAtomicPairs,(function(e,t){return u.Queries.generators.bondedAtomicPairs(t&&t[0])(e)})),C(g.a.structureQuery.generator.rings,(function(e,t){var r,n;return u.Queries.generators.rings(null===(r=null==t?void 0:t.fingerprint)||void 0===r?void 0:r.call(t,e),null===(n=null==t?void 0:t["only-aromatic"])||void 0===n?void 0:n.call(t,e))(e)})),C(g.a.structureQuery.modifier.includeSurroundings,(function(e,t){return u.Queries.modifiers.includeSurroundings(t[0],{radius:t.radius(e),wholeResidues:!(!t["as-whole-residues"]||!t["as-whole-residues"](e)),elementRadius:t["atom-radius"]})(e)})),C(g.a.structureQuery.modifier.wholeResidues,(function(e,t){return u.Queries.modifiers.wholeResidues(t[0])(e)})),C(g.a.structureQuery.modifier.union,(function(e,t){return u.Queries.modifiers.union(t[0])(e)})),C(g.a.structureQuery.modifier.expandProperty,(function(e,t){return u.Queries.modifiers.expandProperty(t[0],t.property)(e)})),C(g.a.structureQuery.modifier.exceptBy,(function(e,t){return u.Queries.modifiers.exceptBy(t[0],t.by)(e)})),C(g.a.structureQuery.modifier.includeConnected,(function(e,t){return u.Queries.modifiers.includeConnected({query:t[0],bondTest:t["bond-test"],wholeResidues:!(!t["as-whole-residues"]||!t["as-whole-residues"](e)),layerCount:t["layer-count"]&&t["layer-count"](e)||1})(e)})),C(g.a.structureQuery.combinator.merge,(function(e,t){return u.Queries.combinators.merge(t)(e)})),C(g.a.structureQuery.atomProperty.core.elementSymbol,P(u.StructureProperties.atom.type_symbol)),C(g.a.structureQuery.atomProperty.core.vdw,(function(e,t){return Object(_.h)(u.StructureProperties.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))})),C(g.a.structureQuery.atomProperty.core.mass,(function(e,t){return Object(_.b)(u.StructureProperties.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))})),C(g.a.structureQuery.atomProperty.core.atomicNumber,(function(e,t){return Object(_.a)(u.StructureProperties.atom.type_symbol(t&&t[0]&&t[0](e)||e.element))})),C(g.a.structureQuery.atomProperty.core.x,P(u.StructureProperties.atom.x)),C(g.a.structureQuery.atomProperty.core.y,P(u.StructureProperties.atom.y)),C(g.a.structureQuery.atomProperty.core.z,P(u.StructureProperties.atom.z)),C(g.a.structureQuery.atomProperty.core.sourceIndex,P(u.StructureProperties.atom.sourceIndex)),C(g.a.structureQuery.atomProperty.core.operatorName,P(u.StructureProperties.unit.operator_name)),C(g.a.structureQuery.atomProperty.core.modelIndex,P(u.StructureProperties.unit.model_index)),C(g.a.structureQuery.atomProperty.core.modelLabel,P(u.StructureProperties.unit.model_label)),C(g.a.structureQuery.atomProperty.core.atomKey,(function(e,t){var r=t&&t[0]&&t[0](e)||e.element;return Object(S.f)(r.unit.id,r.element)})),C(g.a.structureQuery.atomProperty.macromolecular.residueKey,(function(e,t){return u.StructureElement.residueIndex(t&&t[0]&&t[0](e)||e.element)})),C(g.a.structureQuery.atomProperty.macromolecular.chainKey,(function(e,t){return u.StructureElement.chainIndex(t&&t[0]&&t[0](e)||e.element)})),C(g.a.structureQuery.atomProperty.macromolecular.entityKey,(function(e,t){return u.StructureElement.entityIndex(t&&t[0]&&t[0](e)||e.element)})),C(g.a.structureQuery.atomProperty.macromolecular.id,P(u.StructureProperties.atom.id)),C(g.a.structureQuery.atomProperty.macromolecular.isHet,(function(e,t){return"ATOM"!==u.StructureProperties.residue.group_PDB(t&&t[0]&&t[0](e)||e.element)})),C(g.a.structureQuery.atomProperty.macromolecular.label_atom_id,P(u.StructureProperties.atom.label_atom_id)),C(g.a.structureQuery.atomProperty.macromolecular.label_alt_id,P(u.StructureProperties.atom.label_alt_id)),C(g.a.structureQuery.atomProperty.macromolecular.label_comp_id,P(u.StructureProperties.atom.label_comp_id)),C(g.a.structureQuery.atomProperty.macromolecular.label_seq_id,P(u.StructureProperties.residue.label_seq_id)),C(g.a.structureQuery.atomProperty.macromolecular.label_asym_id,P(u.StructureProperties.chain.label_asym_id)),C(g.a.structureQuery.atomProperty.macromolecular.label_entity_id,P(u.StructureProperties.entity.id)),C(g.a.structureQuery.atomProperty.macromolecular.auth_atom_id,P(u.StructureProperties.atom.auth_atom_id)),C(g.a.structureQuery.atomProperty.macromolecular.auth_comp_id,P(u.StructureProperties.atom.auth_comp_id)),C(g.a.structureQuery.atomProperty.macromolecular.auth_seq_id,P(u.StructureProperties.residue.auth_seq_id)),C(g.a.structureQuery.atomProperty.macromolecular.auth_asym_id,P(u.StructureProperties.chain.auth_asym_id)),C(g.a.structureQuery.atomProperty.macromolecular.pdbx_PDB_ins_code,P(u.StructureProperties.residue.pdbx_PDB_ins_code)),C(g.a.structureQuery.atomProperty.macromolecular.pdbx_formal_charge,P(u.StructureProperties.atom.pdbx_formal_charge)),C(g.a.structureQuery.atomProperty.macromolecular.occupancy,P(u.StructureProperties.atom.occupancy)),C(g.a.structureQuery.atomProperty.macromolecular.B_iso_or_equiv,P(u.StructureProperties.atom.B_iso_or_equiv)),C(g.a.structureQuery.atomProperty.macromolecular.entityType,P(u.StructureProperties.entity.type)),C(g.a.structureQuery.atomProperty.macromolecular.entitySubtype,P(u.StructureProperties.entity.subtype)),C(g.a.structureQuery.atomProperty.macromolecular.entityPrdId,P(u.StructureProperties.entity.prd_id)),C(g.a.structureQuery.atomProperty.macromolecular.entityDescription,P(u.StructureProperties.entity.pdbx_description)),C(g.a.structureQuery.atomProperty.macromolecular.objectPrimitive,P(u.StructureProperties.unit.object_primitive)),C(g.a.structureQuery.atomProperty.macromolecular.isNonStandard,P(u.StructureProperties.residue.isNonStandard)),C(g.a.structureQuery.atomProperty.macromolecular.secondaryStructureKey,P(u.StructureProperties.residue.secondary_structure_key)),C(g.a.structureQuery.atomProperty.macromolecular.secondaryStructureFlags,P(u.StructureProperties.residue.secondary_structure_type)),C(g.a.structureQuery.atomProperty.macromolecular.chemCompType,P(u.StructureProperties.residue.chem_comp_type)),C(g.a.structureQuery.bondProperty.order,(function(e,t){return e.atomicBond.order})),C(g.a.structureQuery.bondProperty.flags,(function(e,t){return e.atomicBond.type})),C(g.a.structureQuery.bondProperty.atomA,(function(e,t){return e.atomicBond.a})),C(g.a.structureQuery.bondProperty.atomB,(function(e,t){return e.atomicBond.b})),C(g.a.structureQuery.bondProperty.length,(function(e,t){return e.atomicBond.length})),C(g.a.internal.generator.bundleElement,(function(e,t){return Object(x.bundleElementImpl)(t.groupedUnits(e),t.ranges(e),t.set(e))})),C(g.a.internal.generator.bundle,(function(e,t){return Object(x.bundleGenerator)(t.elements(e))(e)})),C(g.a.internal.generator.current,(function(e,t){return e.tryGetCurrentSelection()}))];function P(e){return function(t,r){return e(r&&r[0]&&r[0](t)||t.element)}}function E(e,t){return e|(v.BondType.isName(t)?v.BondType.fromName(t):0)}function A(e,t){switch(t.toLowerCase()){case"helix":return 2|e;case"alpha":return 4098|e;case"pi":return 32770|e;case"310":return 2050|e;case"beta":return 4|e;case"strand":return 4194308|e;case"sheet":return 8388612|e;case"turn":return 16|e;case"bend":return 8|e;case"coil":return 536870912|e;default:return e}}!function(){for(var e=0,t=j;e<t.length;e++){var r=t[e];l.addSymbol(r)}}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(12),a=r(80),o=r(1),s=Object(o.Vec3)(),u=Object(o.Vec3)(),c=Object(o.Vec3)(),l=i.a.add,d=i.a.add3;!function(e){e.create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=i.a.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e),f=i.a.create(Float32Array,3,t,r?r.startBuffer.ref.value:e),p=i.a.create(Float32Array,3,t,r?r.endBuffer.ref.value:e),m=function(e,t,r,i,a,o,s){for(var u=0;u<4;++u)d(f,e,t,r),d(p,i,a,o),l(n,s)},h=function(e,t,r,n){var i=o.Vec3.distance(e,t),a=Math.floor(r/2),l=1/r;o.Vec3.sub(c,t,e);for(var d=0;d<a;++d){var f=l*(2*d+1);o.Vec3.setMagnitude(c,c,i*f),o.Vec3.add(s,e,c),o.Vec3.setMagnitude(c,c,i*l*(2*(d+1))),o.Vec3.add(u,e,c),m(s[0],s[1],s[2],u[0],u[1],u[2],n)}};return{add:m,addVec:function(e,t,r){for(var i=0;i<4;++i)d(f,e[0],e[1],e[2]),d(p,t[0],t[1],t[2]),l(n,r)},addFixedCountDashes:h,addFixedLengthDashes:function(e,t,r,n){var i=o.Vec3.distance(e,t);h(e,t,i/r,n)},addCage:function(e,t,r){for(var n=t.vertices,i=t.edges,a=0,c=i.length;a<c;a+=2)o.Vec3.fromArray(s,n,3*i[a]),o.Vec3.fromArray(u,n,3*i[a+1]),o.Vec3.transformMat4(s,s,e),o.Vec3.transformMat4(u,u,e),m(s[0],s[1],s[2],u[0],u[1],u[2],r)},getLines:function(){var e=n.elementCount/4,t=i.a.compact(n,!0),o=i.a.compact(f,!0),s=i.a.compact(p,!0),u=r&&e<=r.lineCount?r.mappingBuffer.ref.value:new Float32Array(8*e),c=r&&e<=r.lineCount?r.indexBuffer.ref.value:new Uint32Array(6*e);return(!r||e>r.lineCount)&&function(e,t,r){for(var n=0;n<e;++n){var i=8*n;t[i]=-1,t[i+1]=-1,t[i+2]=1,t[i+3]=-1,t[i+4]=-1,t[i+5]=1,t[i+6]=1,t[i+7]=1}for(n=0;n<e;++n){var a=4*n,o=6*n;r[o]=a,r[o+1]=a+1,r[o+2]=a+2,r[o+3]=a+1,r[o+4]=a+3,r[o+5]=a+2}}(e,u,c),a.a.create(u,c,t,o,s,e,r)}}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return n}));var n,i=r(5),a=r(7);function o(e,t){return{value:e,unit:t}}!function(e){function t(e,t){for(var r=new Float32Array(e.length),n=0,i=e.length;n<i;n++)r[n]=e[t[n]];return r}e.create=function(e,t,r){var n=!!e[0].cell,a=!!e[0].velocities,o=!!e[0].forces;return{id:i.c.create22(),frames:e,hasCell:n,hasVelocities:a,hasForces:o,deltaTime:t,timeOffset:r}},e.getAtomicConformation=function(e,t){return{id:i.c.create22(),atomId:t,occupancy:a.a.ofConst(1,e.elementCount,a.a.Schema.int),B_iso_or_equiv:a.a.ofConst(0,e.elementCount,a.a.Schema.float),xyzDefined:!0,x:e.x,y:e.y,z:e.z}},e.getAtomicConformationReordered=function(e,r,n){return{id:i.c.create22(),atomId:r,occupancy:a.a.ofConst(1,e.elementCount,a.a.Schema.int),B_iso_or_equiv:a.a.ofConst(0,e.elementCount,a.a.Schema.float),xyzDefined:!0,x:t(e.x,n),y:t(e.y,n),z:t(e.z,n)}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n,i,a=r(1),o=r(105),s=r(70),u=function(){function e(t){this.camera=t,this.t=0,this.func=e.defaultTransition,this.start=0,this.inTransition=!1,this.durationMs=0,this._source=d.createDefaultSnapshot(),this._target=d.createDefaultSnapshot(),this._current=d.createDefaultSnapshot()}return Object.defineProperty(e.prototype,"source",{get:function(){return this._source},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._target},enumerable:!1,configurable:!0}),e.prototype.apply=function(t,r,n){void 0===r&&(r=0),(!this.inTransition||r>0)&&d.copySnapshot(this._source,this.camera.state),this.inTransition||d.copySnapshot(this._target,this.camera.state),d.copySnapshot(this._target,t),this._target.radius>this._target.radiusMax&&(this._target.radius=this._target.radiusMax),!this.inTransition&&r<=0||void 0!==t.mode&&t.mode!==this.camera.state.mode?this.finish(this._target):(this.inTransition=!0,this.func=n||e.defaultTransition,(!this.inTransition||r>0)&&(this.start=this.t,this.durationMs=r))},e.prototype.tick=function(e){this.t=e,this.update()},e.prototype.finish=function(e){d.copySnapshot(this.camera.state,e),this.inTransition=!1},e.prototype.update=function(){if(this.inTransition){var e=Math.min((this.t-this.start)/this.durationMs,1);1!==e?(this.func(this._current,e,this._source,this._target),d.copySnapshot(this.camera.state,this._current)):this.finish(this._target)}},e}();n=u||(u={}),i=a.Quat.identity(),n.defaultTransition=function(e,t,r,n){d.copySnapshot(e,n),a.Quat.slerp(i,a.Quat.Identity,a.Quat.rotationTo(i,r.up,n.up),t),a.Vec3.transformQuat(e.up,r.up,i),a.Vec3.lerp(e.target,r.target,n.target,t),a.Vec3.lerp(e.position,r.position,n.position,t),e.radius=Object(s.b)(r.radius,n.radius,t),e.radiusMax=Object(s.b)(r.radiusMax,n.radiusMax,t),e.fov=Object(s.b)(r.fov,n.fov,t),e.fog=Object(s.b)(r.fog,n.fog,t)};var c,l=r(245),d=function(){function e(t,r,n){void 0===r&&(r=o.a.create(0,0,128,128)),void 0===n&&(n={}),this.view=a.Mat4.identity(),this.projection=a.Mat4.identity(),this.projectionView=a.Mat4.identity(),this.inverseProjectionView=a.Mat4.identity(),this.state=e.createDefaultSnapshot(),this.viewOffset=e.ViewOffset(),this.near=1,this.far=1e4,this.fogNear=5e3,this.fogFar=1e4,this.zoom=1,this.transition=new u(this),this.stateChanged=new l.a(this.state),this.prevProjection=a.Mat4.identity(),this.prevView=a.Mat4.identity(),this.deltaDirection=Object(a.Vec3)(),this.newPosition=Object(a.Vec3)(),this.viewport=r,this.pixelScale=n.pixelScale||1,e.copySnapshot(this.state,t)}return Object.defineProperty(e.prototype,"pixelRatio",{get:function(){return("undefined"!=typeof window?window.devicePixelRatio:1)*this.pixelScale},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this.state.position},set:function(e){a.Vec3.copy(this.state.position,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"up",{get:function(){return this.state.up},set:function(e){a.Vec3.copy(this.state.up,e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this.state.target},set:function(e){a.Vec3.copy(this.state.target,e)},enumerable:!1,configurable:!0}),e.prototype.update=function(){var e=this.state;if(0===e.radiusMax)return!1;var t=2*Math.tan(e.fov/2)*a.Vec3.distance(e.position,e.target);switch(this.zoom=this.viewport.height/t,function(e){var t=e.state,r=t.radius,n=t.radiusMax,i=t.mode,o=t.fog,s=t.clipFar;r<.01&&(r=.01);var u=s?r:n,c=a.Vec3.distance(e.position,e.target),l=c-r,d=c+u,f=c-u*(-(50-o)/50),p=d;"perspective"===i?(l=Math.max(Math.min(n,5),l),d=Math.max(5,d)):(l=Math.max(0,l),d=Math.max(0,d));l===d&&(d=l+.01);e.near=l,e.far=2*d,e.fogNear=f,e.fogFar=p}(this),this.state.mode){case"orthographic":!function(e){var t=e.viewport,r=e.zoom,n=e.near,i=e.far,o=e.viewOffset,s=-t.width/2,u=t.width/2,c=t.height/2,l=-t.height/2,d=(u-s)/(2*r),f=(c-l)/(2*r),p=(u+s)/2,m=(c+l)/2,h=p-d,g=p+d,v=m+f,b=m-f;if(o.enabled){var y=r/(o.width/o.fullWidth),_=r/(o.height/o.fullHeight),S=(u-s)/o.width,x=(c-l)/o.height;h+=S*(o.offsetX/y),g=h+S*(o.width/y),v-=x*(o.offsetY/_),b=v-x*(o.height/_)}a.Mat4.ortho(e.projection,h,g,v,b,n,i),a.Mat4.lookAt(e.view,e.position,e.target,e.up)}(this);break;case"perspective":!function(e){var t=e.viewport.width/e.viewport.height,r=e.near,n=e.far,i=e.viewOffset,o=r*Math.tan(.5*e.state.fov),s=2*o,u=t*s,c=-.5*u;i.enabled&&(c+=i.offsetX*u/i.fullWidth,o-=i.offsetY*s/i.fullHeight,u*=i.width/i.fullWidth,s*=i.height/i.fullHeight);a.Mat4.perspective(e.projection,c,c+u,o,o-s,r,n),a.Mat4.lookAt(e.view,e.position,e.target,e.up)}(this);break;default:throw new Error("unknown camera mode")}var r=!a.Mat4.areEqual(this.projection,this.prevProjection,a.EPSILON)||!a.Mat4.areEqual(this.view,this.prevView,a.EPSILON);return r&&(a.Mat4.mul(this.projectionView,this.projection,this.view),a.Mat4.invert(this.inverseProjectionView,this.projectionView),a.Mat4.copy(this.prevView,this.view),a.Mat4.copy(this.prevProjection,this.projection)),r},e.prototype.setState=function(e,t){this.transition.apply(e,t),this.stateChanged.next(e)},e.prototype.getSnapshot=function(){return e.copySnapshot(e.createDefaultSnapshot(),this.state)},e.prototype.getTargetDistance=function(t){return e.targetDistance(t,this.state.fov,this.viewport.width,this.viewport.height)},e.prototype.getFocus=function(t,r,n,i){var o=Math.max(r,.01),s=this.getTargetDistance(o);a.Vec3.sub(this.deltaDirection,this.target,this.position),i&&a.Vec3.matchDirection(this.deltaDirection,i,this.deltaDirection),a.Vec3.setMagnitude(this.deltaDirection,this.deltaDirection,s),a.Vec3.sub(this.newPosition,t,this.deltaDirection);var u=e.copySnapshot(e.createDefaultSnapshot(),this.state);return u.target=a.Vec3.clone(t),u.radius=o,u.position=a.Vec3.clone(this.newPosition),n&&a.Vec3.matchDirection(u.up,n,u.up),u},e.prototype.focus=function(e,t,r,n,i){t>0&&this.setState(this.getFocus(e,t,n,i),r)},e.prototype.project=function(e,t){return Object(o.b)(e,t,this.viewport,this.projectionView)},e.prototype.unproject=function(e,t){return Object(o.c)(e,t,this.viewport,this.inverseProjectionView)},e}();(c=d||(d={})).ViewOffset=function(){return{enabled:!1,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}},c.setViewOffset=function(e,t,r,n,i,a,o){e.fullWidth=t,e.fullHeight=r,e.offsetX=n,e.offsetY=i,e.width=a,e.height=o},c.copyViewOffset=function(e,t){e.enabled=t.enabled,e.fullWidth=t.fullWidth,e.fullHeight=t.fullHeight,e.offsetX=t.offsetX,e.offsetY=t.offsetY,e.width=t.width,e.height=t.height},c.targetDistance=function(e,t,r,n){var i=Math.max(e,.01),a=n<r?1:r/n;return Math.abs(i/a/Math.sin(t/2))},c.createDefaultSnapshot=function(){return{mode:"perspective",fov:Math.PI/4,position:a.Vec3.create(0,0,100),up:a.Vec3.create(0,1,0),target:a.Vec3.create(0,0,0),radius:0,radiusMax:0,fog:50,clipFar:!0}},c.copySnapshot=function(e,t){return t?(void 0!==t.mode&&(e.mode=t.mode),void 0!==t.fov&&(e.fov=t.fov),void 0!==t.position&&a.Vec3.copy(e.position,t.position),void 0!==t.up&&a.Vec3.copy(e.up,t.up),void 0!==t.target&&a.Vec3.copy(e.target,t.target),void 0!==t.radius&&(e.radius=t.radius),void 0!==t.radiusMax&&(e.radiusMax=t.radiusMax),void 0!==t.fog&&(e.fog=t.fog),void 0!==t.clipFar&&(e.clipFar=t.clipFar),e):e}},function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return ce})),r.d(t,"d",(function(){return u.a})),r.d(t,"c",(function(){return s}));var n={};r.r(n),r.d(n,"none",(function(){return S})),r.d(n,"all",(function(){return x})),r.d(n,"residues",(function(){return O})),r.d(n,"chains",(function(){return w})),r.d(n,"atoms",(function(){return P})),r.d(n,"rings",(function(){return A})),r.d(n,"querySelection",(function(){return D})),r.d(n,"bondedAtomicPairs",(function(){return T}));var i={};r.r(i),r.d(i,"wholeResidues",(function(){return V})),r.d(i,"includeSurroundings",(function(){return U})),r.d(i,"querySelection",(function(){return z})),r.d(i,"intersectBy",(function(){return H})),r.d(i,"exceptBy",(function(){return G})),r.d(i,"union",(function(){return q})),r.d(i,"expandProperty",(function(){return W})),r.d(i,"includeConnected",(function(){return X}));var a={};r.r(a),r.d(a,"pick",(function(){return ee})),r.d(a,"first",(function(){return te})),r.d(a,"getCurrentStructureProperties",(function(){return re})),r.d(a,"withSameAtomProperties",(function(){return ne})),r.d(a,"areIntersectedBy",(function(){return ie})),r.d(a,"within",(function(){return ae})),r.d(a,"isConnectedTo",(function(){return oe}));var o={};r.r(o),r.d(o,"merge",(function(){return se})),r.d(o,"intersect",(function(){return ue}));var s,u=r(39),c=r(28),l=r(75),d=r(274),f=function(){function e(e,t){this.currentElementStack=[],this.currentAtomicBondStack=[],this.currentStructureStack=[],this.inputStructureStack=[],this.timeCreated=Object(l.b)(),this.element=c.d.Location.create(void 0),this.currentStructure=void 0,this.atomicBond=new p,this.currentSelection=void 0,this.inputStructure=e,this.timeoutMs=t&&t.timeoutMs||0,this.currentSelection=t&&t.currentSelection}return e.prototype.pushCurrentElement=function(){return this.currentElementStack[this.currentElementStack.length]=this.element,this.element=c.d.Location.create(void 0),this.element},e.prototype.popCurrentElement=function(){this.element=this.currentElementStack.pop()},e.prototype.pushCurrentBond=function(){return this.atomicBond&&this.currentAtomicBondStack.push(this.atomicBond),this.atomicBond=new p,this.atomicBond},e.prototype.popCurrentBond=function(){this.currentAtomicBondStack.length>0?this.atomicBond=this.currentAtomicBondStack.pop():this.atomicBond=void 0},e.prototype.pushCurrentStructure=function(){this.currentStructure&&this.currentStructureStack.push(this.currentStructure)},e.prototype.popCurrentStructure=function(){this.currentStructureStack.length?this.currentStructure=this.currentStructureStack.pop():this.currentStructure=void 0},e.prototype.pushInputStructure=function(e){this.inputStructureStack.push(this.inputStructure),this.inputStructure=e},e.prototype.popInputStructure=function(){if(0===this.inputStructureStack.length)throw new Error("Must push before pop.");this.inputStructure=this.inputStructureStack.pop()},e.prototype.throwIfTimedOut=function(){if(0!==this.timeoutMs&&Object(l.b)()-this.timeCreated>this.timeoutMs)throw new Error("The query took too long to execute (> "+this.timeoutMs/1e3+"s).")},e.prototype.tryGetCurrentSelection=function(){if(!this.currentSelection)throw new Error("The current selection is not assigned.");return this.currentSelection},e}(),p=function(){function e(){this.a=c.d.Location.create(void 0),this.aIndex=0,this.b=c.d.Location.create(void 0),this.bIndex=0,this.type=0,this.order=0,this.testFn=d.defaultBondTest}return e.prototype.setStructure=function(e){this.a.structure=e,this.b.structure=e},e.prototype.setTestFn=function(e){this.testFn=e||d.defaultBondTest},e.prototype.test=function(e,t){return!!this.testFn(e)||!!t&&(this.swap(),this.testFn(e))},e.prototype.swap=function(){var e=this.aIndex;this.aIndex=this.bIndex,this.bIndex=e;var t=this.a.unit;this.a.unit=this.b.unit,this.b.unit=t;var r=this.a.element;this.a.element=this.b.element,this.b.element=r},Object.defineProperty(e.prototype,"length",{get:function(){return c.d.Location.distance(this.a,this.b)},enumerable:!1,configurable:!0}),e}();(s||(s={})).run=function(e,t,r){return e(new f(t,r))};var m=r(0),h=r(57),g=r(6),v=r(118),b=r(159),y=function(){function e(e){this.source=e,this.set=Object(h.a)(c.c.hashCode,c.c.areUnitIdsAndIndicesEqual),this.structures=[],this.allSingletons=!0}return e.prototype.add=function(e){e.elementCount&&(1!==e.elementCount&&(this.allSingletons=!1),this.set.add(e)&&(this.structures[this.structures.length]=e))},e.prototype.getSelection=function(){return this.allSingletons?u.a.Singletons(this.source,Object(b.e)(this.source,this.structures)):u.a.Sequence(this.source,this.structures)},e}(),_=function(){function e(e){this.source=e,this.builders=[],this.builderMap=new Map}return e.prototype.add=function(e,t,r){var n=this.builderMap.get(e);n||(n=this.source.subsetBuilder(!0),this.builders[this.builders.length]=n,this.builderMap.set(e,n)),n.addToUnit(t,r)},e.prototype.allSingletons=function(){for(var e=0,t=this.builders.length;e<t;e++)if(this.builders[e].elementCount>1)return!1;return!0},e.prototype.singletonSelection=function(){for(var e=this.source.subsetBuilder(!0),t=c.d.Location.create(this.source),r=0,n=this.builders.length;r<n;r++)this.builders[r].setSingletonLocation(t),e.addToUnit(t.unit.id,t.element);return u.a.Singletons(this.source,e.getStructure())},e.prototype.fullSelection=function(){for(var e=new Array(this.builders.length),t=0,r=this.builders.length;t<r;t++)e[t]=this.builders[t].getStructure();return u.a.Sequence(this.source,e)},e.prototype.getSelection=function(){return 0===this.builders.length?u.a.Empty(this.source):this.allSingletons()?this.singletonSelection():this.fullSelection()},e}(),S=function(e){return u.a.Sequence(e.inputStructure,[])},x=function(e){return u.a.Singletons(e.inputStructure,e.inputStructure)};function O(e){return P(Object(m.__assign)(Object(m.__assign)({},e),{groupBy:function(e){return c.e.residue.key(e.element)}}))}function w(e){return P(Object(m.__assign)(Object(m.__assign)({},e),{groupBy:function(e){return c.e.chain.key(e.element)}}))}function C(e){return!0}function j(e){return 0}function P(e){if(!(e&&(e.atomTest||e.residueTest||e.chainTest||e.entityTest||e.unitTest||e.groupBy)))return x;if(e.atomTest&&!e.residueTest&&!e.chainTest&&!e.entityTest&&!e.unitTest&&!e.groupBy)return t=e.atomTest,function(e){var r=e.inputStructure,n=r.units,i=e.pushCurrentElement(),a=r.subsetBuilder(!0);i.structure=r;for(var o=0,s=n;o<s.length;o++){var c=s[o];i.unit=c;var l=c.elements;a.beginUnit(c.id);for(var d=0,f=l.length;d<f;d++)i.element=l[d],t(e)&&a.addElement(i.element);a.commitUnit(),e.throwIfTimedOut()}return e.popCurrentElement(),u.a.Singletons(r,a.getStructure())};var t,r={unitTest:e.unitTest||C,entityTest:e.entityTest||C,chainTest:e.chainTest||C,residueTest:e.residueTest||C,atomTest:e.atomTest||C,groupBy:e.groupBy||j};return e.groupBy?function(e){var t=e.unitTest,r=e.entityTest,n=e.chainTest,i=e.residueTest,a=e.atomTest,o=e.groupBy;return function(e){var s=e.inputStructure,u=s.units,c=e.pushCurrentElement(),l=new _(s);c.structure=s;for(var d=0,f=u;d<f.length;d++){var p=f[d];if(c.unit=p,t(e)){var m=p.elements,h=p.model;if(0===p.kind)for(var v=g.Segmentation.transientSegments(h.atomicHierarchy.chainAtomSegments,m),b=g.Segmentation.transientSegments(h.atomicHierarchy.residueAtomSegments,m);v.hasNext;){var y=v.move();if(c.element=m[y.start],r(e)&&n(e))for(b.setSegment(y);b.hasNext;){var S=b.move();if(c.element=m[S.start],i(e))for(var x=S.start,O=S.end;x<O;x++)c.element=m[x],a(e)&&l.add(o(e),p.id,c.element)}}else{var w=h.coarseHierarchy.spheres.chainElementSegments;for(v=g.Segmentation.transientSegments(w,m);v.hasNext;){y=v.move();if(c.element=m[y.start],r(e)&&n(e))for(x=y.start,O=y.end;x<O;x++)c.element=m[x],i(e)&&l.add(o(e),p.id,c.element)}}e.throwIfTimedOut()}}return e.popCurrentElement(),l.getSelection()}}(r):function(e){var t=e.unitTest,r=e.entityTest,n=e.chainTest,i=e.residueTest,a=e.atomTest;return function(e){var o=e.inputStructure,s=o.units,c=e.pushCurrentElement(),l=o.subsetBuilder(!0),d=i===C&&a===C,f=a===C;c.structure=o;for(var p=0,m=s;p<m.length;p++){var h=m[p];if(c.unit=h,t(e)){var v=h.elements,b=h.model;if(l.beginUnit(h.id),0===h.kind)for(var y=g.Segmentation.transientSegments(h.model.atomicHierarchy.chainAtomSegments,v),_=g.Segmentation.transientSegments(h.model.atomicHierarchy.residueAtomSegments,v);y.hasNext;){var S=y.move();if(c.element=v[S.start],r(e)&&n(e))if(d)l.addElementRange(v,S.start,S.end);else for(_.setSegment(S);_.hasNext;){var x=_.move();if(c.element=v[x.start],i(e))if(f)l.addElementRange(v,x.start,x.end);else for(var O=x.start,w=x.end;O<w;O++)c.element=v[O],a(e)&&l.addElement(c.element)}}else{var j=b.coarseHierarchy.spheres.chainElementSegments;for(y=g.Segmentation.transientSegments(j,v);y.hasNext;){S=y.move();if(c.element=v[S.start],r(e)&&n(e))if(d)l.addElementRange(v,S.start,S.end);else for(O=S.start,w=S.end;O<w;O++)c.element=v[O],i(e)&&l.addElement(c.element)}}l.commitUnit(),e.throwIfTimedOut()}}return e.popCurrentElement(),u.a.Singletons(o,l.getStructure())}}(r)}function E(e,t,r){for(var n=new Int32Array(t.length),i=0,a=t.length;i<a;i++)n[i]=e.elements[t[i]];return v.a.create([e.getChild(g.SortedArray.ofSortedArray(n))],{parent:r})}function A(e,t){return function(r){var n=r.inputStructure.units,i=u.a.LinearBuilder(r.inputStructure);if(e&&0!==e.length){for(var a=h.c.create(),o=0;o<e.length;o++)h.c.add(a,e[o],e[o]);for(var s=0,l=n;s<l.length;s++){_=l[s];if(c.g.isAtomic(_))for(var d=_.rings,f=0,p=a.array;f<p.length;f++){var m=p[f];if(d.byFingerprint.has(m))for(var g=0,v=d.byFingerprint.get(m);g<v.length;g++){O=v[g];t&&!d.aromaticRings.includes(O)||i.add(E(_,d.all[O],r.inputStructure))}}}}else for(var b=0,y=n;b<y.length;b++){var _=y[b];if(c.g.isAtomic(_))if(t)for(var S=0,x=_.rings.aromaticRings;S<x.length;S++){var O=x[S];i.add(E(_,_.rings.all[O],r.inputStructure))}else for(var w=0,C=_.rings.all;w<C.length;w++){var O=C[w];i.add(E(_,O,r.inputStructure))}}return i.getSelection()}}function D(e,t,r){return void 0===r&&(r=!1),function(n){var i=e(n);if(0===u.a.structureCount(i))return i;var a=r?Object(b.d)(n.inputStructure,u.a.unionStructure(i)):u.a.unionStructure(i);if(0===a.elementCount)return u.a.Empty(n.inputStructure);n.throwIfTimedOut(),n.pushInputStructure(a);var o=t(n);return n.popInputStructure(),u.a.withInputStructure(o,n.inputStructure)}}function T(e){return function(t){var r=t.inputStructure,n=r.interUnitBonds,i=u.a.UniqueBuilder(t.inputStructure);t.pushCurrentBond();var a=t.atomicBond;a.setTestFn(e),a.setStructure(r);for(var o=0,s=r.units;o<s.length;o++){var c=s[o];if(0===c.kind){var l=c.bonds,d=l.offset,f=l.b,p=l.edgeProps,m=p.flags,h=p.order;a.a.unit=c,a.b.unit=c;for(var g=0,v=c.elements.length;g<v;g++){a.aIndex=g,a.a.element=c.elements[g];for(var b=d[g],y=d[g+1];b<y;b++){if(a.bIndex=f[b],a.b.element=c.elements[f[b]],a.type=m[b],a.order=h[b],a.test(t,!1))(x=r.subsetBuilder(!1)).beginUnit(c.id),x.addElement(a.a.element),x.addElement(a.b.element),x.commitUnit(),i.add(x.getStructure())}}}}for(var _=0,S=n.edges;_<S.length;_++){var x,O=S[_];if(a.a.unit=r.unitMap.get(O.unitA),a.a.element=a.a.unit.elements[O.indexA],a.aIndex=O.indexA,a.b.unit=r.unitMap.get(O.unitA),a.b.element=a.b.unit.elements[O.indexB],a.bIndex=O.indexB,a.order=O.props.order,a.type=O.props.flag,a.test(t,!1))(x=r.subsetBuilder(!1)).addToUnit(a.a.unit.id,a.a.element),x.addToUnit(a.b.unit.id,a.b.element),i.add(x.getStructure())}return t.popCurrentBond(),i.getSelection()}}var I=r(12),M=r(251),k=function(){function e(e){this.parent=e,this.ids=[],this.unitMap=g.IntMap.Mutable(),this.parentId=-1,this.currentUnit=h.c.create(),this.elementCount=0}return e.prototype.addToUnit=function(e,t){var r=this.unitMap.get(e);if(r)h.c.add(r,t,t)&&this.elementCount++;else{var n=h.c.create();h.c.add(n,t,t),this.unitMap.set(e,n),this.ids[this.ids.length]=e,this.elementCount++}},e.prototype.has=function(e,t){var r=this.unitMap.get(e);return!!r&&h.c.has(r,t)},e.prototype.beginUnit=function(e){this.parentId=e,this.unitMap.has(e)?this.currentUnit=this.unitMap.get(e):this.currentUnit=this.currentUnit.array.length>0?h.c.create():this.currentUnit},e.prototype.addElement=function(e){h.c.add(this.currentUnit,e,e)&&this.elementCount++},e.prototype.commitUnit=function(){0===this.currentUnit.array.length||this.unitMap.has(this.parentId)||(this.ids[this.ids.length]=this.parentId,this.unitMap.set(this.parentId,this.currentUnit),this.parentId=-1)},e.prototype.getStructure=function(){if(this.isEmpty)return v.a.Empty;var e=[];Object(I.q)(this.ids);for(var t=M.a.UnitEquivalenceBuilder(),r=0,n=this.ids.length;r<n;r++){var i=this.ids[r],a=this.parent.unitMap.get(i),o=this.unitMap.get(i).array,s=o.length;if(o.length!==a.elements.length){s>1&&Object(I.q)(o);var u=a.getChild(g.SortedArray.ofSortedArray(o)),c=t.add(u.id,u);u!==c&&(u=c.applyOperator(u.id,u.conformation.operator,!0)),e[e.length]=u}else e[e.length]=a,t.add(a.id,a)}return v.a.create(e,{parent:this.parent})},Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.elementCount},enumerable:!1,configurable:!0}),e}();function B(e,t,r){for(var n=t.subsetBuilder(!0),i=0,a=r.units;i<a.length;i++){var o=a[i];if(0===o.kind){var s=o.model.atomicHierarchy.residueAtomSegments,u=t.unitMap.get(o.id).elements,c=o.elements;n.beginUnit(o.id);for(var l=g.Segmentation.transientSegments(s,c);l.hasNext;)for(var d=l.move().index,f=s.offsets[d],p=s.offsets[d+1];f<p;f++)g.SortedArray.has(u,f)&&n.addElement(f);n.commitUnit(),e.throwIfTimedOut()}else n.setUnit(o.id,o.elements)}return n.getStructure()}function V(e){return function(t){var r=e(t);if(u.a.isSingleton(r))return u.a.Singletons(t.inputStructure,B(t,t.inputStructure,r.structure));for(var n=new y(t.inputStructure),i=0,a=r.structures;i<a.length;i++){var o=a[i];n.add(B(t,t.inputStructure,o))}return n.getSelection()}}function R(e,t,r,n){for(var i=new k(t),a=t.lookup3d,o=n.radius,s=0,u=r.units;s<u.length;s++){for(var c=u[s],l=c.conformation,d=l.x,f=l.y,p=l.z,m=c.elements,h=0,g=m.length;h<g;h++){var v=m[h];a.findIntoBuilder(d(v),f(v),p(v),o,i)}e.throwIfTimedOut()}return n.wholeResidues?B(e,t,i.getStructure()):i.getStructure()}function L(e,t,r,n){var i=new k(t),a=t.lookup3d,o=n.elementRadius,s=n.elementRadiusClosure,u=n.sourceMaxRadius,c=n.radius;e.pushCurrentElement(),e.element.structure=r;for(var l=0,d=r.units;l<d.length;l++){var f=d[l];e.element.unit=f;for(var p=f.conformation,m=p.x,h=p.y,g=p.z,v=f.elements,b=0,y=v.length;b<y;b++){var _=v[b];e.element.element=_;var S=o(e);a.findIntoBuilderWithRadius(m(_),h(_),g(_),S,u,c,s,i)}e.throwIfTimedOut()}return e.popCurrentElement(),n.wholeResidues?B(e,t,i.getStructure()):i.getStructure()}function N(e,t){return function(r){return e.element.structure=r.structure,e.element.unit=r.unit,e.element.element=r.element,t(e)}}function F(e,t){var r=0;e.element.structure=e.inputStructure;for(var n=0,i=e.inputStructure.units;n<i.length;n++){var a=i[n];e.element.unit=a;for(var o=a.elements,s=0,u=o.length;s<u;s++){var c=o[s];e.element.element=c;var l=t(e);l>r&&(r=l)}}return e.throwIfTimedOut(),r}function U(e,t){return function(r){var n=e(r);if(t.elementRadius){var i=Object(m.__assign)(Object(m.__assign)({},t),{elementRadius:t.elementRadius,elementRadiusClosure:N(r,t.elementRadius),sourceMaxRadius:F(r,t.elementRadius)});if(u.a.isSingleton(n)){var a=L(r,r.inputStructure,n.structure,i);return u.a.Singletons(r.inputStructure,a)}for(var o=new y(r.inputStructure),s=0,c=n.structures;s<c.length;s++){var l=c[s];o.add(L(r,r.inputStructure,l,i))}return o.getSelection()}if(u.a.isSingleton(n)){a=R(r,r.inputStructure,n.structure,t);return u.a.Singletons(r.inputStructure,a)}o=new y(r.inputStructure);for(var d=0,f=n.structures;d<f.length;d++){l=f[d];o.add(R(r,r.inputStructure,l,t))}return o.getSelection()}}function z(e,t){return function(r){var n=e(r);if(0===u.a.structureCount(n))return n;var i=u.a.UniqueBuilder(r.inputStructure),a=function(e){return i.add(e)};return u.a.forEach(n,(function(e,n){r.pushInputStructure(e),u.a.forEach(t(r),a),r.popInputStructure(),n%10==0&&r.throwIfTimedOut()})),i.getSelection()}}function H(e,t){return function(r){var n=e(r);if(0===u.a.structureCount(n))return n;var i=t(r);if(0===u.a.structureCount(i))return u.a.Empty(r.inputStructure);var a=u.a.unionStructure(i),o=u.a.UniqueBuilder(r.inputStructure);return u.a.forEach(n,(function(e,t){var n=Object(b.c)(a,e);0!==n.elementCount&&o.add(n),t%50==0&&r.throwIfTimedOut()})),o.getSelection()}}function G(e,t){return function(r){var n=e(r);if(0===u.a.structureCount(n))return n;var i=t(r);if(0===u.a.structureCount(i))return n;var a=u.a.unionStructure(i),o=u.a.UniqueBuilder(r.inputStructure);return u.a.forEach(n,(function(e,t){var n=Object(b.d)(e,a);0!==n.elementCount&&o.add(n),t%50==0&&r.throwIfTimedOut()})),o.getSelection()}}function q(e){return function(t){var r=u.a.LinearBuilder(t.inputStructure);return r.add(u.a.unionStructure(e(t))),r.getSelection()}}function W(e,t){return function(r){var n=e(r),i=new Map,a=[];r.pushCurrentElement(),u.a.forEach(n,(function(e,n){r.element.structure=e;for(var o=0,s=e.units;o<s.length;o++){var u=s[o];r.element.unit=u;for(var c=u.elements,l=0,d=c.length;l<d;l++){r.element.element=c[l];var f=t(r),p=void 0;i.has(f)?p=i.get(f):(p=h.c.create(),i.set(f,p)),h.c.add(p,n,n)}}a[n]=r.inputStructure.subsetBuilder(!0),n%10==0&&r.throwIfTimedOut()})),r.element.structure=r.inputStructure;for(var o=0,s=r.inputStructure.units;o<s.length;o++){var c=s[o];r.element.unit=c;for(var l=c.elements,d=0,f=l.length;d<f;d++){r.element.element=l[d];var p=t(r);if(i.has(p))for(var m=i.get(p).array,g=0,v=m.length;g<v;g++)a[m[g]].addToUnit(c.id,l[d])}}r.popCurrentElement();for(var b=u.a.UniqueBuilder(r.inputStructure),y=0,_=a;y<_.length;y++){var S=_[y];b.add(S.getStructure())}return b.getSelection()}}function X(e){var t=e.query,r=e.layerCount,n=e.wholeResidues,i=e.bondTest,a=Math.max(r,0);return function(e){var r=u.a.UniqueBuilder(e.inputStructure),o=t(e);return e.pushCurrentBond(),e.atomicBond.setTestFn(i),u.a.forEach(o,(function(t,i){for(var o=t,s=0;s<a;s++)o=Y(e,n,o);r.add(o),i%10==0&&e.throwIfTimedOut()})),e.popCurrentBond(),r.getSelection()}}function Y(e,t,r){var n=function(e,t){for(var r=e.inputStructure,n=r.interUnitBonds,i=new k(r),a=e.atomicBond,o=0,s=t.units;o<s.length;o++){var u=s[o];if(0===u.kind){var c=r.unitMap.get(u.id),l=c.bonds,d=l.offset,f=l.b,p=l.edgeProps,m=p.flags,h=p.order;a.setStructure(r),a.a.unit=c,a.b.unit=c;for(M=0,B=u.elements.length;M<B;M++){i.addToUnit(u.id,u.elements[M]);for(var v=g.SortedArray.indexOf(c.elements,u.elements[M]),b=d[v],y=d[v+1];b<y;b++){var _=f[b],S=c.elements[_];g.SortedArray.has(u.elements,S)||i.has(u.id,S)||(a.aIndex=v,a.a.element=u.elements[M],a.bIndex=_,a.b.element=S,a.type=m[b],a.order=h[b],a.test(e,!0)&&i.addToUnit(u.id,S))}}for(var x=0,O=n.getConnectedUnits(c.id);x<O.length;x++)for(var w=O[x],C=t.unitMap.get(w.unitB),j=r.unitMap.get(w.unitB),P=0,E=w.connectedIndices;P<E.length;P++){var A=E[P];if(g.SortedArray.has(u.elements,c.elements[A]))for(var D=0,T=w.getEdges(A);D<T.length;D++){var I=T[D];S=j.elements[I.indexB];C&&g.SortedArray.has(C.elements,S)||i.has(w.unitB,S)||(a.a.unit=c,a.aIndex=A,a.a.element=c.elements[A],a.b.unit=j,a.bIndex=I.indexB,a.b.element=S,a.type=I.props.flag,a.order=I.props.order,a.test(e,!0)&&i.addToUnit(w.unitB,S))}}}else{i.beginUnit(u.id);for(var M=0,B=u.elements.length;M<B;M++)i.addElement(u.elements[M]);i.commitUnit()}}return i.getStructure()}(e,r);return t?B(e,e.inputStructure,n):n}var Q,K,Z,J=r(96),$=r(1);function ee(e,t){return function(r){var n=e(r),i=u.a.LinearBuilder(r.inputStructure);return r.pushCurrentElement(),u.a.forEach(n,(function(e,n){r.currentStructure=e,t(r)&&i.add(e),n%100&&r.throwIfTimedOut()})),r.popCurrentStructure(),i.getSelection()}}function te(e){return function(t){var r=e(t),n=u.a.LinearBuilder(t.inputStructure);if("singletons"===r.kind){if(r.structure.elementCount>0){var i=r.structure.units[0],a=v.a.create([i.getChild(g.SortedArray.ofSingleton(i.elements[0]))],{parent:t.inputStructure});n.add(a)}}else r.structures.length>0&&n.add(r.structures[0]);return n.getSelection()}}function re(e,t,r){var n=e.currentStructure.units,i=e.pushCurrentElement();i.structure=e.currentStructure;for(var a=0,o=n;a<o.length;a++){var s=o[a];i.unit=s;var u=s.elements,l=void 0;if(l=c.g.isAtomic(s)?t.atomic:t.coarse){for(var d=0,f=u.length;d<f;d++)i.element=u[d],r.add(l(e));e.throwIfTimedOut()}}return e.popCurrentElement(),r}function ne(e,t,r){return function(n){var i=e(n),a=function(e,t,r){var n=new Set,i=t(e);return e.pushCurrentElement(),u.a.forEach(i,(function(t,i){e.currentStructure=t,re(e,r,n),i%10&&e.throwIfTimedOut()})),e.popCurrentElement(),n}(n,t,r),o=u.a.LinearBuilder(n.inputStructure);return n.pushCurrentStructure(),u.a.forEach(i,(function(e,t){n.currentStructure=e;var i=re(n,r,new Set);J.a.isSuperset(i,a)&&o.add(e),t%10&&n.throwIfTimedOut()})),n.popCurrentStructure(),o.getSelection()}}function ie(e,t){return function(r){var n=u.a.unionStructure(t(r)),i=u.a.LinearBuilder(r.inputStructure);return u.a.forEach(e(r),(function(e,t){Object(b.b)(n,e)&&i.add(e),t%10&&r.throwIfTimedOut()})),i.getSelection()}}function ae(e){return function(t){var r={queryCtx:t,selection:e.query(t),target:e.target(t),maxRadius:e.maxRadius,minRadius:e.minRadius?Math.max(0,e.minRadius):0,elementRadius:e.elementRadius,invert:!!e.invert};return 0===r.minRadius&&void 0===e.minRadius?function(e){var t=e.queryCtx,r=e.selection,n=e.target,i=e.maxRadius,a=e.invert,o=u.a.unionStructure(n).lookup3d,s=u.a.LinearBuilder(t.inputStructure),c=$.Vec3.zero();return u.a.forEach(r,(function(e,r){for(var n=e.units,u=!1,l=0,d=n.length;l<d;l++){for(var f=n[l],p=f.elements,m=f.conformation,h=m.position,g=m.r,v=0,b=p.length;v<b;v++){var y=p[v];if(h(y,c),o.check(c[0],c[1],c[2],i+g(y))){u=!0;break}}if(u)break}a&&(u=!u),u&&s.add(e),r%10==0&&t.throwIfTimedOut()})),s.getSelection()}(r):0===r.minRadius?function(e){var t=e.queryCtx,r=e.selection,n=e.target,i=e.maxRadius,a=e.invert,o=e.elementRadius,s=u.a.unionStructure(n),c=u.a.LinearBuilder(t.inputStructure);return t.pushCurrentElement(),u.a.forEach(r,(function(e,r){var n=function(e,t,r,n,i){return 0===t.elementCount||0===r.elementCount||(t.elementCount<=r.elementCount?K.check(e,t,r,n,i):K.check(e,r,t,n,i))}(t,s,e,i,o);a&&(n=!n),n&&c.add(e),r%10==0&&t.throwIfTimedOut()})),t.popCurrentElement(),c.getSelection()}(r):function(e){var t=e.queryCtx,r=e.selection,n=e.target,i=e.minRadius,a=e.maxRadius,o=e.invert,s=e.elementRadius,c=u.a.unionStructure(n),l=u.a.LinearBuilder(t.inputStructure);return t.pushCurrentElement(),u.a.forEach(r,(function(e,r){var n=function(e,t,r,n,i,a){return 0===t.elementCount||0===r.elementCount||(t.elementCount<=r.elementCount?Q.check(e,t,r,n,i,a):Q.check(e,r,t,n,i,a))}(t,c,e,i,a,s);o&&(n=!n),n&&l.add(e),r%10==0&&t.throwIfTimedOut()})),t.popCurrentElement(),l.getSelection()}(r)}}function oe(e){var t=e.query,r=e.target,n=e.disjunct,i=e.invert,a=e.bondTest;return function(e){var o=r(e);if(u.a.isEmpty(o))return o;var s=t(e);if(u.a.isEmpty(s))return s;var l={queryCtx:e,input:e.inputStructure,disjunct:n,target:u.a.unionStructure(o)},d=u.a.LinearBuilder(e.inputStructure);return e.pushCurrentBond(),e.atomicBond.setTestFn(a),u.a.forEach(s,(function(t,r){!function(e,t){var r=e.queryCtx,n=e.input,i=e.target,a=e.disjunct,o=r.atomicBond,s=n.interUnitBonds;o.setStructure(n);for(var u=0,l=t.units;u<l.length;u++){var d=l[u];if(c.g.isAtomic(d))for(var f=n.unitMap.get(d.id),p=f.bonds,m=p.offset,h=p.b,v=p.edgeProps,b=v.flags,y=v.order,_=s.getConnectedUnits(d.id),S=_.length,x=d.elements,O=f.elements,w=0,C=x.length;w<C;w++){var j=g.SortedArray.indexOf(O,x[w]);o.a.unit=f,o.b.unit=f;for(var P=m[j],E=m[j+1];P<E;P++)if(o.b.element=f.elements[h[P]],(!a||!g.SortedArray.has(d.elements,o.b.element))&&i.hasElement(o.b)&&(o.aIndex=j,o.a.element=x[w],o.bIndex=h[P],o.type=b[P],o.order=y[P],o.test(r,!0)))return!0;for(var A=0;A<S;A++)for(var D=_[A],T=t.unitMap.get(D.unitB),I=T.elements,M=D.getEdges(j),k=0,B=M.length;k<B;k++){var V=M[k];if(o.b.unit=T,o.b.element=I[V.indexB],i.hasElement(o.b)&&(!a||!t.hasElement(o.b))&&(o.a.unit=f,o.aIndex=j,o.a.element=x[w],o.bIndex=V.indexB,o.type=V.props.flag,o.order=V.props.order,o.test(r,!0)))return!0}}}return!1}(l,t)?i&&d.add(t):d.add(t),r%5==0&&e.throwIfTimedOut()})),e.popCurrentBond(),d.getSelection()}}function se(e){return 0===e.length?S:1===e.length?e[0]:function(t){for(var r=u.a.UniqueBuilder(t.inputStructure),n=function(n){u.a.forEach(e[n](t),(function(e,i){r.add(e),n%100&&t.throwIfTimedOut()}))},i=0;i<e.length;i++)n(i);return r.getSelection()}}function ue(e){return 0===e.length?S:1===e.length?e[0]:function(t){for(var r=[],n=0;n<e.length;n++)r.push(e[n](t));var i=0,a=u.a.structureCount(r[0]);for(n=1;n<r.length;n++){var o=u.a.structureCount(r[n]);o<a&&(i=n,a=o)}t.throwIfTimedOut();var s=Object(h.a)((function(e){return e.hashCode}),c.c.areUnitIdsAndIndicesEqual);u.a.forEach(r[i],(function(e){return s.add(e)}));for(var l=u.a.UniqueBuilder(t.inputStructure),d=0;d<r.length;d++)d!==i&&(u.a.forEach(r[d],(function(e){s.has(e)&&l.add(e)})),t.throwIfTimedOut());return l.getSelection()}}!function(e){var t=$.Vec3.zero();function r(e,r,n,i,a,o,s){var u=r.elements,c=r.conformation.position,l=t;e.element.unit=r;for(var d=!1,f=0,p=u.length;f<p;f++){var m=u[f];e.element.element=m;var h=Math.max(0,$.Vec3.distance(n,c(m,l))-i-s(e));if(h<a)return 0;h<o&&(d=!0)}return d?1:2}function n(e,t,n,i,a,o,s){for(var u=t.units,c=!1,l=0,d=u.length;l<d;l++){var f=r(e,u[l],n,i,a,o,s);if(0===f)return 0;1===f&&(c=!0)}return c?1:2}e.toPoint=n;var i=$.Vec3.zero();e.check=function(e,t,r,a,o,s){if(0===t.elementCount||0===r.elementCount)return 0;var u=t.units,c=!1;e.element.structure=t;for(var l=0,d=u.length;l<d;l++){var f=u[l],p=f.elements,m=f.conformation.position;e.element.unit=f;for(var h=0,g=p.length;h<g;h++){var v=p[h];e.element.element=v;var b=n(e,r,m(v,i),s(e),a,o,s);if(0===b)return 0;1===b&&(c=!0)}}return c}}(Q||(Q={})),function(e){var t=$.Vec3.zero();function r(e,r,n,i,a,o){var s=r.elements,u=r.conformation.position,c=t;e.element.unit=r;for(var l=0,d=s.length;l<d;l++){var f=s[l];if(e.element.element=f,Math.max(0,$.Vec3.distance(n,u(f,c))-i-o(e))<=a)return!0}return!1}function n(e,t,n,i,a,o){for(var s=t.units,u=0,c=s.length;u<c;u++)if(r(e,s[u],n,i,a,o))return!0;return!1}e.toPoint=n;var i=$.Vec3.zero();e.check=function(e,t,r,a,o){if(0===t.elementCount||0===r.elementCount)return 0;var s=t.units;e.element.structure=t;for(var u=0,c=s.length;u<c;u++){var l=s[u];e.element.unit=l;for(var d=l.elements,f=l.conformation.position,p=0,m=d.length;p<m;p++){var h=d[p];if(e.element.element=h,n(e,r,f(h,i),o(e),a,o))return!0}}return!1}}(K||(K={})),function(e){function t(e){return!0}function r(e){return!1}e.eq=function(e,t){return function(r){return e(r)===t}},e.lt=function(e,t){return function(r){return e(r)<t}},e.lte=function(e,t){return function(r){return e(r)<=t}},e.gt=function(e,t){return function(r){return e(r)>t}},e.gte=function(e,t){return function(r){return e(r)>=t}},e.inSet=function(e,t){if((a=t)&&a.has)return function(r){return t.has(e(r))};if(0===t.length)return r;for(var n=new Set,i=0;i<t.length;i++)n.add(t[i]);return function(t){return n.has(e(t))};var a},e.and=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];switch(e.length){case 0:return t;case 1:return e[0];case 2:var n=e[0],i=e[1];return function(e){return n(e)&&i(e)};case 3:var a=e[0],o=e[1],s=e[2];return function(e){return a(e)&&o(e)&&s(e)};case 4:var u=e[0],c=e[1],l=e[2],d=e[3];return function(e){return u(e)&&c(e)&&l(e)&&d(e)};case 5:var f=e[0],p=e[1],m=e[2],h=e[3],g=e[4];return function(e){return f(e)&&p(e)&&m(e)&&h(e)&&g(e)};case 6:var v=e[0],b=e[1],y=e[2],_=e[3],S=e[4],x=e[5];return function(e){return v(e)&&b(e)&&y(e)&&_(e)&&S(e)&&x(e)};default:var O=e.length;return function(t){for(var r=0;r<O;r++)if(!e[r])return!1;return!0}}},e.or=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];switch(e.length){case 0:return r;case 1:return e[0];case 2:var n=e[0],i=e[1];return function(e){return n(e)||i(e)};case 3:var a=e[0],o=e[1],s=e[2];return function(e){return a(e)||o(e)||s(e)};case 4:var u=e[0],c=e[1],l=e[2],d=e[3];return function(e){return u(e)||c(e)||l(e)||d(e)};case 5:var f=e[0],p=e[1],m=e[2],h=e[3],g=e[4];return function(e){return f(e)||p(e)||m(e)||h(e)||g(e)};case 6:var v=e[0],b=e[1],y=e[2],_=e[3],S=e[4],x=e[5];return function(e){return v(e)||b(e)||y(e)||_(e)||S(e)||x(e)};default:var O=e.length;return function(t){for(var r=0;r<O;r++)if(e[r])return!0;return!1}}}}(Z||(Z={}));var ce={generators:n,filters:a,modifiers:i,combinators:o,pred:Z,internal:d}},function(e,t,r){"use strict";r.d(t,"b",(function(){return k})),r.d(t,"c",(function(){return B})),r.d(t,"a",(function(){return V}));var n=r(0),i=r(72),a=r(11),o=r(64),s=r(5),u=r(68),c=r(67),l=r(1),d=r(2),f=r(138),p=r(24),m={edgeThresholdMin:d.ParamDefinition.Numeric(.0312,{min:.0312,max:.0833,step:1e-4},{description:"Trims the algorithm from processing darks."}),edgeThresholdMax:d.ParamDefinition.Numeric(.063,{min:.063,max:.333,step:.001},{description:"The minimum amount of local contrast required to apply algorithm."}),iterations:d.ParamDefinition.Numeric(12,{min:0,max:16,step:1},{description:"Number of edge exploration steps."}),subpixelQuality:d.ParamDefinition.Numeric(.3,{min:0,max:1,step:.01},{description:"Choose the amount of sub-pixel aliasing removal."})},h=function(){function e(e,t){var r,a,o,d,f,p,m;this.webgl=e,this.renderable=(r=e,o=(a=t).getWidth(),d=a.getHeight(),f=Object(n.__assign)(Object(n.__assign)({},i.c),{tColor:s.e.create(a),uTexSizeInv:s.e.create(l.Vec2.create(1/o,1/d)),dEdgeThresholdMin:s.e.create(.0312),dEdgeThresholdMax:s.e.create(.125),dIterations:s.e.create(12),dSubpixelQuality:s.e.create(.3)}),p=Object(n.__assign)({},g),m=Object(u.a)(r,"triangles",v,p,f),Object(c.a)(m,f))}return e.prototype.updateState=function(e){var t=this.webgl,r=t.gl,n=t.state;n.enable(r.SCISSOR_TEST),n.disable(r.BLEND),n.disable(r.DEPTH_TEST),n.depthMask(!1);var i=e.x,a=e.y,o=e.width,s=e.height;r.viewport(i,a,o,s),r.scissor(i,a,o,s),n.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT)},e.prototype.setSize=function(e,t){s.e.update(this.renderable.values.uTexSizeInv,l.Vec2.set(this.renderable.values.uTexSizeInv.ref.value,1/e,1/t))},e.prototype.update=function(e,t){var r=this.renderable.values,n=t.edgeThresholdMin,i=t.edgeThresholdMax,a=t.iterations,o=t.subpixelQuality,u=!1;r.tColor.ref.value!==e&&(s.e.update(this.renderable.values.tColor,e),u=!0),r.dEdgeThresholdMin.ref.value!==n&&(u=!0),s.e.updateIfChanged(r.dEdgeThresholdMin,n),r.dEdgeThresholdMax.ref.value!==i&&(u=!0),s.e.updateIfChanged(r.dEdgeThresholdMax,i),r.dIterations.ref.value!==a&&(u=!0),s.e.updateIfChanged(r.dIterations,a),r.dSubpixelQuality.ref.value!==o&&(u=!0),s.e.updateIfChanged(r.dSubpixelQuality,o),u&&this.renderable.update()},e.prototype.render=function(e,t){t?t.bind():this.webgl.unbindFramebuffer(),this.updateState(e),this.renderable.render()},e}(),g=Object(n.__assign)(Object(n.__assign)({},i.b),{tColor:Object(a.i)("texture","rgba","ubyte","linear"),uTexSizeInv:Object(a.j)("v2"),dEdgeThresholdMin:Object(a.c)("number"),dEdgeThresholdMax:Object(a.c)("number"),dIterations:Object(a.c)("number"),dSubpixelQuality:Object(a.c)("number")}),v=Object(o.g)("fxaa",f.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\n// adapted from https://github.com/kosua20/Rendu\n// MIT License Copyright (c) 2017 Simon Rodriguez\n\n#define QUALITY(q) ((q) < 5 ? 1.0 : ((q) > 5 ? ((q) < 10 ? 2.0 : ((q) < 11 ? 4.0 : 8.0)) : 1.5))\n\nfloat rgb2luma(vec3 rgb){\n    return sqrt(dot(rgb, vec3(0.299, 0.587, 0.114)));\n}\n\nfloat sampleLuma(vec2 uv) {\n    return rgb2luma(texture2D(tColor, uv).rgb);\n}\n\nfloat sampleLuma(vec2 uv, float uOffset, float vOffset) {\n    uv += uTexSizeInv * vec2(uOffset, vOffset);\n    return sampleLuma(uv);\n}\n\nvoid main(void) {\n    vec2 coords = gl_FragCoord.xy * uTexSizeInv;\n    vec2 inverseScreenSize = uTexSizeInv;\n\n    vec4 colorCenter = texture2D(tColor, coords);\n\n    // Luma at the current fragment\n    float lumaCenter = rgb2luma(colorCenter.rgb);\n\n    // Luma at the four direct neighbours of the current fragment.\n    float lumaDown = sampleLuma(coords, 0.0, -1.0);\n    float lumaUp = sampleLuma(coords, 0.0, 1.0);\n    float lumaLeft = sampleLuma(coords, -1.0, 0.0);\n    float lumaRight = sampleLuma(coords, 1.0, 0.0);\n\n    // Find the maximum and minimum luma around the current fragment.\n    float lumaMin = min(lumaCenter, min(min(lumaDown, lumaUp), min(lumaLeft, lumaRight)));\n    float lumaMax = max(lumaCenter, max(max(lumaDown, lumaUp), max(lumaLeft, lumaRight)));\n\n    // Compute the delta.\n    float lumaRange = lumaMax - lumaMin;\n\n    // If the luma variation is lower that a threshold (or if we are in a really dark area),\n    // we are not on an edge, don't perform any AA.\n    if (lumaRange < max(dEdgeThresholdMin, lumaMax * dEdgeThresholdMax)) {\n        gl_FragColor = colorCenter;\n        return;\n    }\n\n    // Query the 4 remaining corners lumas.\n    float lumaDownLeft = sampleLuma(coords, -1.0, -1.0);\n    float lumaUpRight = sampleLuma(coords, 1.0, 1.0);\n    float lumaUpLeft = sampleLuma(coords, -1.0, 1.0);\n    float lumaDownRight = sampleLuma(coords, 1.0, -1.0);\n\n    // Combine the four edges lumas (using intermediary variables for future computations\n    // with the same values).\n    float lumaDownUp = lumaDown + lumaUp;\n    float lumaLeftRight = lumaLeft + lumaRight;\n\n    // Same for corners\n    float lumaLeftCorners = lumaDownLeft + lumaUpLeft;\n    float lumaDownCorners = lumaDownLeft + lumaDownRight;\n    float lumaRightCorners = lumaDownRight + lumaUpRight;\n    float lumaUpCorners = lumaUpRight + lumaUpLeft;\n\n    // Compute an estimation of the gradient along the horizontal and vertical axis.\n    float edgeHorizontal = abs(-2.0 * lumaLeft + lumaLeftCorners) + abs(-2.0 * lumaCenter + lumaDownUp) * 2.0 + abs(-2.0 * lumaRight + lumaRightCorners);\n    float edgeVertical = abs(-2.0 * lumaUp + lumaUpCorners) + abs(-2.0 * lumaCenter + lumaLeftRight) * 2.0 + abs(-2.0 * lumaDown + lumaDownCorners);\n\n    // Is the local edge horizontal or vertical ?\n    bool isHorizontal = (edgeHorizontal >= edgeVertical);\n\n    // Choose the step size (one pixel) accordingly.\n    float stepLength = isHorizontal ? inverseScreenSize.y : inverseScreenSize.x;\n\n    // Select the two neighboring texels lumas in the opposite direction to the local edge.\n    float luma1 = isHorizontal ? lumaDown : lumaLeft;\n    float luma2 = isHorizontal ? lumaUp : lumaRight;\n    // Compute gradients in this direction.\n    float gradient1 = luma1 - lumaCenter;\n    float gradient2 = luma2 - lumaCenter;\n\n    // Which direction is the steepest ?\n    bool is1Steepest = abs(gradient1) >= abs(gradient2);\n\n    // Gradient in the corresponding direction, normalized.\n    float gradientScaled = 0.25 * max(abs(gradient1), abs(gradient2));\n\n    // Average luma in the correct direction.\n    float lumaLocalAverage = 0.0;\n    if(is1Steepest){\n        // Switch the direction\n        stepLength = -stepLength;\n        lumaLocalAverage = 0.5 * (luma1 + lumaCenter);\n    } else {\n        lumaLocalAverage = 0.5 * (luma2 + lumaCenter);\n    }\n\n    // Shift UV in the correct direction by half a pixel.\n    vec2 currentUv = coords;\n    if(isHorizontal){\n        currentUv.y += stepLength * 0.5;\n    } else {\n        currentUv.x += stepLength * 0.5;\n    }\n\n    // Compute offset (for each iteration step) in the right direction.\n    vec2 offset = isHorizontal ? vec2(inverseScreenSize.x, 0.0) : vec2(0.0, inverseScreenSize.y);\n    // Compute UVs to explore on each side of the edge, orthogonally.\n    // The QUALITY allows us to step faster.\n    vec2 uv1 = currentUv - offset * QUALITY(0);\n    vec2 uv2 = currentUv + offset * QUALITY(0);\n\n    // Read the lumas at both current extremities of the exploration segment,\n    // and compute the delta wrt to the local average luma.\n    float lumaEnd1 = sampleLuma(uv1);\n    float lumaEnd2 = sampleLuma(uv2);\n    lumaEnd1 -= lumaLocalAverage;\n    lumaEnd2 -= lumaLocalAverage;\n\n    // If the luma deltas at the current extremities is larger than the local gradient,\n    // we have reached the side of the edge.\n    bool reached1 = abs(lumaEnd1) >= gradientScaled;\n    bool reached2 = abs(lumaEnd2) >= gradientScaled;\n    bool reachedBoth = reached1 && reached2;\n\n    // If the side is not reached, we continue to explore in this direction.\n    if(!reached1){\n        uv1 -= offset * QUALITY(1);\n    }\n    if(!reached2){\n        uv2 += offset * QUALITY(1);\n    }\n\n    // If both sides have not been reached, continue to explore.\n    if(!reachedBoth){\n        for(int i = 2; i < dIterations; i++){\n            // If needed, read luma in 1st direction, compute delta.\n            if(!reached1){\n                lumaEnd1 = sampleLuma(uv1);\n                lumaEnd1 = lumaEnd1 - lumaLocalAverage;\n            }\n            // If needed, read luma in opposite direction, compute delta.\n            if(!reached2){\n                lumaEnd2 = sampleLuma(uv2);\n                lumaEnd2 = lumaEnd2 - lumaLocalAverage;\n            }\n            // If the luma deltas at the current extremities is larger than the local gradient,\n            // we have reached the side of the edge.\n            reached1 = abs(lumaEnd1) >= gradientScaled;\n            reached2 = abs(lumaEnd2) >= gradientScaled;\n            reachedBoth = reached1 && reached2;\n\n            // If the side is not reached, we continue to explore in this direction,\n            // with a variable quality.\n            if(!reached1){\n                uv1 -= offset * QUALITY(i);\n            }\n            if(!reached2){\n                uv2 += offset * QUALITY(i);\n            }\n\n            // If both sides have been reached, stop the exploration.\n            if(reachedBoth){\n                break;\n            }\n        }\n    }\n\n    // Compute the distances to each side edge of the edge (!).\n    float distance1 = isHorizontal ? (coords.x - uv1.x) : (coords.y - uv1.y);\n    float distance2 = isHorizontal ? (uv2.x - coords.x) : (uv2.y - coords.y);\n\n    // In which direction is the side of the edge closer ?\n    bool isDirection1 = distance1 < distance2;\n    float distanceFinal = min(distance1, distance2);\n\n    // Thickness of the edge.\n    float edgeThickness = (distance1 + distance2);\n\n    // Is the luma at center smaller than the local average ?\n    bool isLumaCenterSmaller = lumaCenter < lumaLocalAverage;\n\n    // If the luma at center is smaller than at its neighbour,\n    // the delta luma at each end should be positive (same variation).\n    bool correctVariation1 = (lumaEnd1 < 0.0) != isLumaCenterSmaller;\n    bool correctVariation2 = (lumaEnd2 < 0.0) != isLumaCenterSmaller;\n\n    // Only keep the result in the direction of the closer side of the edge.\n    bool correctVariation = isDirection1 ? correctVariation1 : correctVariation2;\n\n    // UV offset: read in the direction of the closest side of the edge.\n    float pixelOffset = - distanceFinal / edgeThickness + 0.5;\n\n    // If the luma variation is incorrect, do not offset.\n    float finalOffset = correctVariation ? pixelOffset : 0.0;\n\n    // Sub-pixel shifting\n    // Full weighted average of the luma over the 3x3 neighborhood.\n    float lumaAverage = (1.0 / 12.0) * (2.0 * (lumaDownUp + lumaLeftRight) + lumaLeftCorners + lumaRightCorners);\n    // Ratio of the delta between the global average and the center luma,\n    // over the luma range in the 3x3 neighborhood.\n    float subPixelOffset1 = clamp(abs(lumaAverage - lumaCenter) / lumaRange, 0.0, 1.0);\n    float subPixelOffset2 = (-2.0 * subPixelOffset1 + 3.0) * subPixelOffset1 * subPixelOffset1;\n    // Compute a sub-pixel offset based on this delta.\n    float subPixelOffsetFinal = subPixelOffset2 * subPixelOffset2 * float(dSubpixelQuality);\n\n    // Pick the biggest of the two offsets.\n    finalOffset = max(finalOffset, subPixelOffsetFinal);\n\n    // Compute the final UV coordinates.\n    vec2 finalUv = coords;\n    if(isHorizontal){\n        finalUv.y += finalOffset * stepLength;\n    } else {\n        finalUv.x += finalOffset * stepLength;\n    }\n\n    // Read the color at the new UV coordinates, and use it.\n    gl_FragColor = texture2D(tColor, finalUv);\n}\n");var b=r(204),y=r(105),_=r(48),S={edgeThreshold:d.ParamDefinition.Numeric(.1,{min:.05,max:.15,step:.01}),maxSearchSteps:d.ParamDefinition.Numeric(16,{min:0,max:32,step:1})},x=function(){function e(e,t){if(this.webgl=e,this._supported=!1,void 0!==typeof HTMLImageElement){var r=t.getWidth(),a=t.getHeight();this.edgesTarget=e.createRenderTarget(r,a,!1,"uint8","linear"),this.weightsTarget=e.createRenderTarget(r,a,!1,"uint8","linear"),this.edgesRenderable=function(e,t){var r=t.getWidth(),a=t.getHeight(),o=Object(n.__assign)(Object(n.__assign)({},i.c),{tColor:s.e.create(t),uTexSizeInv:s.e.create(l.Vec2.create(1/r,1/a)),uViewport:s.e.create(Object(l.Vec4)()),dEdgeThreshold:s.e.create(.1)}),d=Object(n.__assign)({},O),f=Object(u.a)(e,"triangles",w,d,o);return Object(c.a)(f,o)}(e,t),this.weightsRenderable=function(e,t){var r=t.getWidth(),a=t.getHeight(),o=Object(b.b)(e.gl,e.extensions,"image-uint8","rgb","ubyte","linear"),d=Object(b.b)(e.gl,e.extensions,"image-uint8","rgba","ubyte","nearest"),f=Object(n.__assign)(Object(n.__assign)({},i.c),{tEdges:s.e.create(t),tArea:s.e.create(o),tSearch:s.e.create(d),uTexSizeInv:s.e.create(l.Vec2.create(1/r,1/a)),uViewport:s.e.create(Object(l.Vec4)()),dMaxSearchSteps:s.e.create(8)});Object(b.d)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAIwCAIAAACOVPcQAACBeklEQVR42u39W4xlWXrnh/3WWvuciIzMrKxrV8/0rWbY0+SQFKcb4owIkSIFCjY9AC1BT/LYBozRi+EX+cV+8IMsYAaCwRcBwjzMiw2jAWtgwC8WR5Q8mDFHZLNHTarZGrLJJllt1W2qKrsumZWZcTvn7L3W54e1vrXX3vuciLPPORFR1XE2EomorB0nVuz//r71re/y/1eMvb4Cb3N11xV/PP/2v4UBAwJG/7H8urx6/25/Gf8O5hypMQ0EEEQwAqLfoN/Z+97f/SW+/NvcgQk4sGBJK6H7N4PFVL+K+e0N11yNfkKvwUdwdlUAXPHHL38oa15f/i/46Ih6SuMSPmLAYAwyRKn7dfMGH97jaMFBYCJUgotIC2YAdu+LyW9vvubxAP8kAL8H/koAuOKP3+q6+xGnd5kdYCeECnGIJViwGJMAkQKfDvB3WZxjLKGh8VSCCzhwEWBpMc5/kBbjawT4HnwJfhr+pPBIu7uu+OOTo9vsmtQcniMBGkKFd4jDWMSCRUpLjJYNJkM+IRzQ+PQvIeAMTrBS2LEiaiR9b/5PuT6Ap/AcfAFO4Y3dA3DFH7/VS+M8k4baEAQfMI4QfbVDDGIRg7GKaIY52qAjTAgTvGBAPGIIghOCYAUrGFNgzA7Q3QhgCwfwAnwe5vDejgG44o/fbm1C5ZlYQvQDARPAIQGxCWBM+wWl37ZQESb4gImexGMDouhGLx1Cst0Saa4b4AqO4Hk4gxo+3DHAV/nx27p3JziPM2pVgoiia5MdEzCGULprIN7gEEeQ5IQxEBBBQnxhsDb5auGmAAYcHMA9eAAz8PBol8/xij9+C4Djlim4gJjWcwZBhCBgMIIYxGAVIkH3ZtcBuLdtRFMWsPGoY9rN+HoBji9VBYdwD2ZQg4cnO7OSq/z4rU5KKdwVbFAjNojCQzTlCLPFSxtamwh2jMUcEgg2Wm/6XgErIBhBckQtGN3CzbVacERgCnfgLswhnvqf7QyAq/z4rRZm1YglYE3affGITaZsdIe2FmMIpnOCap25I6jt2kCwCW0D1uAD9sZctNGXcQIHCkINDQgc78aCr+zjtw3BU/ijdpw3zhCwcaONwBvdeS2YZKkJNJsMPf2JKEvC28RXxxI0ASJyzQCjCEQrO4Q7sFArEzjZhaFc4cdv+/JFdKULM4px0DfUBI2hIsy06BqLhGTQEVdbfAIZXYMPesq6VoCHICzUyjwInO4Y411//LYLs6TDa9wvg2CC2rElgAnpTBziThxaL22MYhzfkghz6GAs2VHbbdM91VZu1MEEpupMMwKyVTb5ij9+u4VJG/5EgEMMmFF01cFai3isRbKbzb+YaU/MQbAm2XSMoUPAmvZzbuKYRIFApbtlrfFuUGd6vq2hXNnH78ZLh/iFhsQG3T4D1ib7k5CC6vY0DCbtrohgLEIClXiGtl10zc0CnEGIhhatLBva7NP58Tvw0qE8yWhARLQ8h4+AhQSP+I4F5xoU+VilGRJs6wnS7ruti/4KvAY/CfdgqjsMy4pf8fodQO8/gnuX3f/3xi3om1/h7THr+co3x93PP9+FBUfbNUjcjEmhcrkT+8K7ml7V10Jo05mpIEFy1NmCJWx9SIKKt+EjAL4Ez8EBVOB6havuT/rByPvHXK+9zUcfcbb254+9fydJknYnRr1oGfdaiAgpxu1Rx/Rek8KISftx3L+DfsLWAANn8Hvw0/AFeAGO9DFV3c6D+CcWbL8Dj9e7f+T1k8AZv/d7+PXWM/Z+VvdCrIvuAKO09RpEEQJM0Ci6+B4xhTWr4cZNOvhktabw0ta0rSJmqz3Yw5/AKXwenod7cAhTmBSPKf6JBdvH8IP17h95pXqw50/+BFnj88fev4NchyaK47OPhhtI8RFSvAfDSNh0Ck0p2gLxGkib5NJj/JWCr90EWQJvwBzO4AHcgztwAFN1evHPUVGwfXON+0debT1YeGON9Yy9/63X+OguiwmhIhQhD7l4sMqlG3D86Suc3qWZ4rWjI1X7u0Ytw6x3rIMeIOPDprfe2XzNgyj6PahhBjO4C3e6puDgXrdg+/5l948vF3bqwZetZ+z9Rx9zdIY5pInPK4Nk0t+l52xdK2B45Qd87nM8fsD5EfUhIcJcERw4RdqqH7Yde5V7m1vhNmtedkz6EDzUMF/2jJYWbC+4fzzA/Y+/8PPH3j9dcBAPIRP8JLXd5BpAu03aziOL3VVHZzz3CXWDPWd+SH2AnxIqQoTZpo9Ckc6HIrFbAbzNmlcg8Ag8NFDDAhbJvTBZXbC94P7t68EXfv6o+21gUtPETU7bbkLxvNKRFG2+KXzvtObonPP4rBvsgmaKj404DlshFole1Glfh02fE7bYR7dZ82oTewIBGn1Md6CG6YUF26X376oevOLzx95vhUmgblI6LBZwTCDY7vMq0op5WVXgsObOXJ+1x3qaBl9j1FeLxbhU9w1F+Wiba6s1X/TBz1LnUfuYDi4r2C69f1f14BWfP+p+W2GFKuC9phcELMYRRLur9DEZTUdEH+iEqWdaM7X4WOoPGI+ZYD2+wcQ+y+ioHUZ9dTDbArzxmi/bJI9BND0Ynd6lBdve/butBw8+f/T9D3ABa3AG8W3VPX4hBin+bj8dMMmSpp5pg7fJ6xrBFE2WQQEWnV8Qg3FbAWzYfM1rREEnmvkN2o1+acG2d/9u68GDzx91v3mAjb1zkpqT21OipPKO0b9TO5W0nTdOmAQm0TObts3aBKgwARtoPDiCT0gHgwnbArzxmtcLc08HgF1asN0C4Ms/fvD5I+7PhfqyXE/b7RbbrGyRQRT9ARZcwAUmgdoz0ehJ9Fn7QAhUjhDAQSw0bV3T3WbNa59jzmiP6GsWbGXDX2ytjy8+f9T97fiBPq9YeLdBmyuizZHaqXITnXiMUEEVcJ7K4j3BFPurtB4bixW8wTpweL8DC95szWMOqucFYGsWbGU7p3TxxxefP+r+oTVktxY0v5hbq3KiOKYnY8ddJVSBxuMMVffNbxwIOERShst73HZ78DZrHpmJmH3K6sGz0fe3UUj0eyRrSCGTTc+rjVNoGzNSv05srAxUBh8IhqChiQgVNIIBH3AVPnrsnXQZbLTm8ammv8eVXn/vWpaTem5IXRlt+U/LA21zhSb9cye6jcOfCnOwhIAYXAMVTUNV0QhVha9xjgA27ODJbLbmitt3tRN80lqG6N/khgot4ZVlOyO4WNg3OIMzhIZQpUEHieg2im6F91hB3I2tubql6BYNN9Hj5S7G0G2tahslBWKDnOiIvuAEDzakDQKDNFQT6gbn8E2y4BBubM230YIpBnDbMa+y3dx0n1S0BtuG62lCCXwcY0F72T1VRR3t2ONcsmDjbmzNt9RFs2LO2hQNyb022JisaI8rAWuw4HI3FuAIhZdOGIcdjLJvvObqlpqvWTJnnQbyi/1M9O8UxWhBs//H42I0q1Yb/XPGONzcmm+ri172mHKvZBpHkJaNJz6v9jxqiklDj3U4CA2ugpAaYMWqNXsdXbmJNd9egCnJEsphXNM+MnK3m0FCJ5S1kmJpa3DgPVbnQnPGWIDspW9ozbcO4K/9LkfaQO2KHuqlfFXSbdNzcEcwoqNEFE9zcIXu9/6n/ym/BC/C3aJLzEKPuYVlbFnfhZ8kcWxV3dbv4bKl28566wD+8C53aw49lTABp9PWbsB+knfc/Li3eVizf5vv/xmvnPKg5ihwKEwlrcHqucuVcVOxEv8aH37E3ZqpZypUulrHEtIWKUr+txHg+ojZDGlwnqmkGlzcVi1dLiNSJiHjfbRNOPwKpx9TVdTn3K05DBx4psIk4Ei8aCkJahRgffk4YnEXe07T4H2RR1u27E6wfQsBDofUgjFUFnwC2AiVtA+05J2zpiDK2Oa0c5fmAecN1iJzmpqFZxqYBCYhFTCsUNEmUnIcZ6aEA5rQVhEywG6w7HSW02XfOoBlQmjwulOFQAg66SvJblrTEX1YtJ3uG15T/BH1OfOQeuR8g/c0gdpT5fx2SKbs9EfHTKdM8A1GaJRHLVIwhcGyydZsbifAFVKl5EMKNU2Hryo+06BeTgqnxzYjThVySDikbtJPieco75lYfKAJOMEZBTjoITuWHXXZVhcUDIS2hpiXHV9Ku4u44bN5OYLDOkJo8w+xJSMbhBRHEdEs9JZUCkQrPMAvaHyLkxgkEHxiNkx/x2YB0mGsQ8EUWj/stW5YLhtS5SMu+/YBbNPDCkGTUybN8krRLBGPlZkVOA0j+a1+rkyQKWGaPHPLZOkJhioQYnVZ2hS3zVxMtgC46KuRwbJNd9nV2PHgb36F194ecf/Yeu2vAFe5nm/bRBFrnY4BauE8ERmZRFUn0k8hbftiVYSKMEme2dJCJSCGYAlNqh87bXOPdUkGy24P6d1ll21MBqqx48Fvv8ZHH8HZFY7j/uAq1xMJUFqCSUlJPmNbIiNsmwuMs/q9CMtsZsFO6SprzCS1Z7QL8xCQClEelpjTduDMsmWD8S1PT152BtvmIGvUeDA/yRn83u/x0/4qxoPHjx+PXY9pqX9bgMvh/Nz9kpP4pOe1/fYf3axUiMdHLlPpZCNjgtNFAhcHEDxTumNONhHrBduW+vOyY++70WWnPXj98eA4kOt/mj/5E05l9+O4o8ePx67HFqyC+qSSnyselqjZGaVK2TadbFLPWAQ4NBhHqDCCV7OTpo34AlSSylPtIdd2AJZlyzYQrDJ5lcWGNceD80CunPLGGzsfD+7wRb95NevJI5docQ3tgCyr5bGnyaPRlmwNsFELViOOx9loebGNq2moDOKpHLVP5al2cymWHbkfzGXL7kfRl44H9wZy33tvt+PB/Xnf93e+nh5ZlU18wCiRUa9m7kib9LYuOk+hudQNbxwm0AQqbfloimaB2lM5fChex+ylMwuTbfmXQtmWlenZljbdXTLuOxjI/fDDHY4Hjx8/Hrse0zXfPFxbUN1kKqSCCSk50m0Ajtx3ub9XHBKHXESb8iO6E+qGytF4nO0OG3SXzbJlhxBnKtKyl0NwybjvYCD30aMdjgePHz8eu56SVTBbgxJMliQ3Oauwg0QHxXE2Ez/EIReLdQj42Gzb4CLS0YJD9xUx7bsi0vJi5mUbW1QzL0h0PFk17rtiIPfJk52MB48fPx67npJJwyrBa2RCCQRTbGZSPCxTPOiND4G2pYyOQ4h4jINIJh5wFU1NFZt+IsZ59LSnDqBjZ2awbOku+yInunLcd8VA7rNnOxkPHj9+PGY9B0MWJJNozOJmlglvDMXDEozdhQWbgs/U6oBanGzLrdSNNnZFjOkmbi5bNt1lX7JLLhn3vXAg9/h4y/Hg8ePHI9dzQMEkWCgdRfYykYKnkP7D4rIujsujaKPBsB54vE2TS00ccvFY/Tth7JXeq1hz+qgVy04sAJawTsvOknHfCwdyT062HA8eP348Zj0vdoXF4pilKa2BROed+9fyw9rWRXeTFXESMOanvDZfJuJaSXouQdMdDJZtekZcLLvEeK04d8m474UDuaenW44Hjx8/Xns9YYqZpszGWB3AN/4VHw+k7WSFtJ3Qicuqb/NlVmgXWsxh570xg2UwxUw3WfO6B5nOuO8aA7lnZxuPB48fPx6znm1i4bsfcbaptF3zNT78eFPtwi1OaCNOqp1x3zUGcs/PN++AGD1+fMXrSVm2baTtPhPahbPhA71wIHd2bXzRa69nG+3CraTtPivahV/55tXWg8fyRY/9AdsY8VbSdp8V7cKrrgdfM//z6ILQFtJ2nxHtwmuoB4/kf74+gLeRtvvMaBdeSz34+vifx0YG20jbfTa0C6+tHrwe//NmOG0L8EbSdp8R7cLrrQe/996O+ai3ujQOskpTNULa7jOjXXj99eCd8lHvoFiwsbTdZ0a78PrrwTvlo966pLuRtB2fFe3Cm6oHP9kNH/W2FryxtN1nTLvwRurBO+Kj3pWXHidtx2dFu/Bm68Fb81HvykuPlrb7LGkX3mw9eGs+6h1Y8MbSdjegXcguQLjmevDpTQLMxtJ2N6NdyBZu9AbrwVvwUW+LbteULUpCdqm0HTelXbhNPe8G68Gb8lFvVfYfSNuxvrTdTWoXbozAzdaDZzfkorOj1oxVxlIMlpSIlpLrt8D4hrQL17z+c3h6hU/wv4Q/utps4+bm+6P/hIcf0JwQ5oQGPBL0eKPTYEXTW+eL/2DKn73J9BTXYANG57hz1cEMviVf/4tf5b/6C5pTQkMIWoAq7hTpOJjtAM4pxKu5vg5vXeUrtI09/Mo/5H+4z+Mp5xULh7cEm2QbRP2tFIKR7WM3fPf/jZ3SWCqLM2l4NxID5zB72HQXv3jj/8mLR5xXNA5v8EbFQEz7PpRfl1+MB/hlAN65qgDn3wTgH13hK7T59bmP+NIx1SHHU84nLOITt3iVz8mNO+lPrjGAnBFqmioNn1mTyk1ta47R6d4MrX7tjrnjYUpdUbv2rVr6YpVfsGG58AG8Ah9eyUN8CX4WfgV+G8LVWPDGb+Zd4cU584CtqSbMKxauxTg+dyn/LkVgA+IR8KHtejeFKRtTmLLpxN6mYVLjYxwXf5x2VofiZcp/lwKk4wGOpYDnoIZPdg/AAbwMfx0+ge9dgZvYjuqKe4HnGnykYo5TvJbG0Vj12JagRhwKa44H95ShkZa5RyLGGdfYvG7aw1TsF6iapPAS29mNS3NmsTQZCmgTzFwgL3upCTgtBTRwvGMAKrgLn4evwin8+afJRcff+8izUGUM63GOOuAs3tJkw7J4kyoNreqrpO6cYLQeFUd7TTpr5YOTLc9RUUogUOVJQ1GYJaFLAW0oTmKyYS46ZooP4S4EON3xQ5zC8/CX4CnM4c1PE8ApexpoYuzqlP3d4S3OJP8ZDK7cKWNaTlqmgDiiHwl1YsE41w1zT4iRTm3DBqxvOUsbMKKDa/EHxagtnta072ejc3DOIh5ojvh8l3tk1JF/AV6FU6jh3U8HwEazLgdCLYSQ+MYiAI2ltomkzttUb0gGHdSUUgsIYjTzLG3mObX4FBRaYtpDVNZrih9TgTeYOBxsEnN1gOCTM8Bsw/ieMc75w9kuAT6A+/AiHGvN/+Gn4KRkiuzpNNDYhDGFndWRpE6SVfm8U5bxnSgVV2jrg6JCKmneqey8VMFgq2+AM/i4L4RUbfSi27lNXZ7R7W9RTcq/q9fk4Xw3AMQd4I5ifAZz8FcVtm9SAom/dyN4lczJQW/kC42ZrHgcCoIf1oVMKkVItmMBi9cOeNHGLqOZk+QqQmrbc5YmYgxELUUN35z2iohstgfLIFmcMV7s4CFmI74L9+EFmGsi+tGnAOD4Yk9gIpo01Y4cA43BWGygMdr4YZekG3OBIUXXNukvJS8tqa06e+lSDCtnqqMFu6hWHXCF+WaYt64m9QBmNxi7Ioy7D+fa1yHw+FMAcPt7SysFLtoG4PXAk7JOA3aAxBRqUiAdU9Yp5lK3HLSRFtOim0sa8euEt08xvKjYjzeJ2GU7YawexrnKI9tmobInjFXCewpwriY9+RR4aaezFhMhGCppKwom0ChrgFlKzyPKkGlTW1YQrE9HJqu8hKGgMc6hVi5QRq0PZxNfrYNgE64utmRv6KKHRpxf6VDUaOvNP5jCEx5q185My/7RKz69UQu2im5k4/eownpxZxNLwiZ1AZTO2ZjWjkU9uaB2HFn6Q3u0JcsSx/qV9hTEApRzeBLDJQXxYmTnq7bdLa3+uqFrxLJ5w1TehnNHx5ECvCh2g2c3hHH5YsfdaSKddztfjQ6imKFGSyFwlLzxEGPp6r5IevVjk1AMx3wMqi1NxDVjLBiPs9tbsCkIY5we5/ML22zrCScFxnNtzsr9Wcc3CnD+pYO+4VXXiDE0oc/vQQ/fDK3oPESJMYXNmJa/DuloJZkcTpcYE8lIH8Dz8DJMiynNC86Mb2lNaaqP/+L7f2fcE/yP7/Lde8xfgSOdMxvOixZf/9p3+M4hT1+F+zApxg9XfUvYjc8qX2lfOOpK2gNRtB4flpFu9FTKCp2XJRgXnX6olp1zyYjTKJSkGmLE2NjUr1bxFM4AeAAHBUFIeSLqXR+NvH/M9fOnfHzOD2vCSyQJKzfgsCh+yi/Mmc35F2fUrw7miW33W9hBD1vpuUojFphIyvg7aTeoymDkIkeW3XLHmguMzbIAJejN6B5MDrhipE2y6SoFRO/AK/AcHHZHNIfiWrEe/C6cr3f/yOvrQKB+zMM55/GQdLDsR+ifr5Fiuu+/y+M78LzOE5dsNuXC3PYvYWd8NXvphLSkJIasrlD2/HOqQ+RjcRdjKTGWYhhVUm4yxlyiGPuMsZR7sMCHUBeTuNWA7if+ifXgc/hovftHXs/DV+Fvwe+f8shzMiMcweFgBly3//vwJfg5AN4450fn1Hd1Rm1aBLu22Dy3y3H2+OqMemkbGZ4jozcDjJf6596xOLpC0eMTHbKnxLxH27uZ/bMTGs2jOaMOY4m87CfQwF0dw53oa1k80JRuz/XgS+8fX3N9Af4qPIMfzKgCp4H5TDGe9GGeFPzSsZz80SlPTxXjgwJmC45njzgt2vbQ4b4OAdUK4/vWhO8d8v6EE8fMUsfakXbPpFJeLs2ubM/qdm/la3WP91uWhxXHjoWhyRUq2iJ/+5mA73zwIIo+LoZ/SgvIRjAd1IMvvn98PfgOvAJfhhm8scAKVWDuaRaK8aQ9f7vuPDH6Bj47ZXau7rqYJ66mTDwEDU6lLbCjCK0qTXyl5mnDoeNRxanj3FJbaksTk0faXxHxLrssgPkWB9LnA/MFleXcJozzjwsUvUG0X/QCve51qkMDXp9mtcyOy3rwBfdvVJK7D6/ACSzg3RoruIq5UDeESfEmVclDxnniU82vxMLtceD0hGZWzBNPMM/jSPne2OVatiTKUpY5vY7gc0LdUAWeWM5tH+O2I66AOWw9xT2BuyRVLGdoDHUsVRXOo/c+ZdRXvFfnxWyIV4upFLCl9eAL7h8Zv0QH8Ry8pA2cHzQpGesctVA37ZtklBTgHjyvdSeKY/RZw/kJMk0Y25cSNRWSigQtlULPTw+kzuJPeYEkXjQRpoGZobYsLF79pyd1dMRHInbgFTZqNLhDqiIsTNpoex2WLcy0/X6rHcdMMQvFSd5dWA++4P7xv89deACnmr36uGlL69bRCL6BSZsS6c0TU2TKK5gtWCzgAOOwQcurqk9j8whvziZSMLcq5hbuwBEsYjopUBkqw1yYBGpLA97SRElEmx5MCInBY5vgLk94iKqSWmhIGmkJ4Bi9m4L645J68LyY4wsFYBfUg5feP/6gWWm58IEmKQM89hq7KsZNaKtP5TxxrUZZVkNmMJtjbKrGxLNEbHPJxhqy7lAmbC32ZqeF6lTaknRWcYaFpfLUBh/rwaQycCCJmW15Kstv6jRHyJFry2C1ahkkIW0LO75s61+owxK1y3XqweX9m5YLM2DPFeOjn/iiqCKJ+yKXF8t5Yl/kNsqaSCryxPq5xWTFIaP8KSW0RYxqupaUf0RcTNSSdJZGcKYdYA6kdtrtmyBckfKXwqk0pHpUHlwWaffjNRBYFPUDWa8e3Lt/o0R0CdisKDM89cX0pvRHEfM8ca4t0s2Xx4kgo91MPQJ/0c9MQYq0co8MBh7bz1fio0UUHLR4aAIOvOmoYO6kwlEVODSSTliWtOtH6sPkrtctF9ZtJ9GIerBskvhdVS5cFNv9s1BU0AbdUgdK4FG+dRnjFmDTzniRMdZO1QhzMK355vigbdkpz9P6qjUGE5J2qAcXmwJ20cZUiAD0z+pGMx6xkzJkmEf40Hr4qZfVg2XzF9YOyoV5BjzVkUJngKf8lgNYwKECEHrCNDrWZzMlflS3yBhr/InyoUgBc/lKT4pxVrrC6g1YwcceK3BmNxZcAtz3j5EIpqguh9H6wc011YN75cKDLpFDxuwkrPQmUwW4KTbj9mZTwBwLq4aQMUZbHm1rylJ46dzR0dua2n3RYCWZsiHROeywyJGR7mXKlpryyCiouY56sFkBWEnkEB/raeh/Sw4162KeuAxMQpEkzy5alMY5wamMsWKKrtW2WpEWNnReZWONKWjrdsKZarpFjqCslq773PLmEhM448Pc3+FKr1+94vv/rfw4tEcu+lKTBe4kZSdijBrykwv9vbCMPcLQTygBjzVckSLPRVGslqdunwJ4oegtFOYb4SwxNgWLCmD7T9kVjTv5YDgpo0XBmN34Z/rEHp0sgyz7lngsrm4lvMm2Mr1zNOJYJ5cuxuQxwMGJq/TP5emlb8fsQBZviK4t8hFL+zbhtlpwaRSxQRWfeETjuauPsdGxsBVdO7nmP4xvzSoT29pRl7kGqz+k26B3Oy0YNV+SXbbQas1ctC/GarskRdFpKczVAF1ZXnLcpaMuzVe6lZ2g/1ndcvOVgRG3sdUAY1bKD6achijMPdMxV4muKVorSpiDHituH7rSTs7n/4y5DhRXo4FVBN4vO/zbAcxhENzGbHCzU/98Mcx5e7a31kWjw9FCe/zNeYyQjZsWb1uc7U33pN4Mji6hCLhivqfa9Ss6xLg031AgfesA/l99m9fgvnaF9JoE6bYKmkGNK3aPbHB96w3+DnxFm4hs0drLsk7U8kf/N/CvwQNtllna0rjq61sH8L80HAuvwH1tvBy2ChqWSCaYTaGN19sTvlfzFD6n+iKTbvtayfrfe9ueWh6GJFoxLdr7V72a5ZpvHcCPDzma0wTO4EgbLyedxstO81n57LYBOBzyfsOhUKsW1J1BB5vr/tz8RyqOFylQP9Tvst2JALsC5lsH8PyQ40DV4ANzYa4dedNiKNR1s+x2wwbR7q4/4cTxqEk4LWDebfisuo36JXLiWFjOtLrlNWh3K1rRS4xvHcDNlFnNmWBBAl5SWaL3oPOfnvbr5pdjVnEaeBJSYjuLEkyLLsWhKccadmOphZkOPgVdalj2QpSmfOsADhMWE2ZBu4+EEJI4wKTAuCoC4xwQbWXBltpxbjkXJtKxxabo9e7tyhlgb6gNlSbUpMh+l/FaqzVwewGu8BW1Zx7pTpQDJUjb8tsUTW6+GDXbMn3mLbXlXJiGdggxFAoUrtPS3wE4Nk02UZG2OOzlk7fRs7i95QCLo3E0jtrjnM7SR3uS1p4qtS2nJ5OwtQVHgOvArLBFijZUV9QtSl8dAY5d0E0hM0w3HS2DpIeB6m/A1+HfhJcGUq4sOxH+x3f5+VO+Ds9rYNI7zPXOYWPrtf8bYMx6fuOAX5jzNR0PdsuON+X1f7EERxMJJoU6GkTEWBvVolVlb5lh3tKCg6Wx1IbaMDdJ+9sUCc5KC46hKGCk3IVOS4TCqdBNfUs7Kd4iXf2RjnT/LLysJy3XDcHLh/vde3x8DoGvwgsa67vBk91G5Pe/HbOe7xwym0NXbtiuuDkGO2IJDh9oQvJ4cY4vdoqLDuoH9Zl2F/ofsekn8lkuhIlhQcffUtSjytFyp++p6NiE7Rqx/lodgKVoceEp/CP4FfjrquZaTtj2AvH5K/ywpn7M34K/SsoYDAdIN448I1/0/wveW289T1/lX5xBzc8N5IaHr0XMOQdHsIkDuJFifj20pBm5jzwUv9e2FhwRsvhAbalCIuIw3bhJihY3p6nTFFIZgiSYjfTf3aXuOjmeGn4bPoGvwl+CFzTRczBIuHBEeImHc37/lGfwZR0cXzVDOvaKfNHvwe+suZ771K/y/XcBlsoN996JpBhoE2toYxOznNEOS5TJc6Id5GEXLjrWo+LEWGNpPDU4WAwsIRROu+1vM+0oW37z/MBN9kqHnSArwPfgFJ7Cq/Ai3Ie7g7ncmI09v8sjzw9mzOAEXoIHxURueaAce5V80f/DOuuZwHM8vsMb5wBzOFWM7wymTXPAEvm4vcFpZ2ut0VZRjkiP2MlmLd6DIpbGSiHOjdnUHN90hRYmhTnmvhzp1iKDNj+b7t5hi79lWGwQ+HN9RsfFMy0FXbEwhfuczKgCbyxYwBmcFhhvo/7a44v+i3XWcwDP86PzpGQYdWh7csP5dBvZ1jNzdxC8pBGuxqSW5vw40nBpj5JhMwvOzN0RWqERHMr4Lv1kWX84xLR830G3j6yqZ1a8UstTlW+qJPOZ+sZ7xZPKTJLhiNOAFd6tk+jrTH31ncLOxid8+nzRb128HhUcru/y0Wn6iT254YPC6FtVSIMoW2sk727AhvTtrWKZTvgsmckfXYZWeNRXx/3YQ2OUxLDrbHtN11IwrgXT6c8dATDwLniYwxzO4RzuQqTKSC5gAofMZ1QBK3zQ4JWobFbcvJm87FK+6JXrKahLn54m3p+McXzzYtP8VF/QpJuh1OwieElEoI1pRxPS09FBrkq2tWCU59+HdhNtTIqKm8EBrw2RTOEDpG3IKo2Y7mFdLm3ZeVjYwVw11o/oznceMve4CgMfNym/utA/d/ILMR7gpXzRy9eDsgLcgbs8O2Va1L0zzIdwGGemTBuwROHeoMShkUc7P+ISY3KH5ZZeWqO8mFTxQYeXTNuzvvK5FGPdQfuu00DwYFY9dyhctEt+OJDdnucfpmyhzUJzfsJjr29l8S0bXBfwRS9ZT26tmMIdZucch5ZboMz3Nio3nIOsYHCGoDT4kUA9MiXEp9Xsui1S8th/kbWIrMBxDGLodWUQIWcvnXy+9M23xPiSMOiRPqM+YMXkUN3gXFrZJwXGzUaMpJfyRS9ZT0lPe8TpScuRlbMHeUmlaKDoNuy62iWNTWNFYjoxFzuJs8oR+RhRx7O4SVNSXpa0ZJQ0K1LAHDQ+D9IepkMXpcsq5EVCvClBUIzDhDoyKwDw1Lc59GbTeORivugw1IcuaEOaGWdNm+Ps5fQ7/tm0DjMegq3yM3vb5j12qUId5UZD2oxDSEWOZMSqFl/W+5oynWDa/aI04tJRQ2eTXusg86SQVu/nwSYwpW6wLjlqIzwLuxGIvoAvul0PS+ZNz0/akp/pniO/8JDnGyaCkzbhl6YcqmK/69prxPqtpx2+Km9al9sjL+rwMgHw4jE/C8/HQ3m1vBuL1fldbzd8mOueVJ92syqdEY4KJjSCde3mcRw2TA6szxedn+zwhZMps0XrqEsiUjnC1hw0TELC2Ek7uAAdzcheXv1BYLagspxpzSAoZZUsIzIq35MnFQ9DOrlNB30jq3L4pkhccKUAA8/ocvN1Rzx9QyOtERs4CVsJRK/DF71kPYrxYsGsm6RMh4cps5g1DOmM54Ly1ii0Hd3Y/BMk8VWFgBVmhqrkJCPBHAolwZaWzLR9Vb7bcWdX9NyUYE+uB2BKfuaeBUcjDljbYVY4DdtsVWvzRZdWnyUzDpjNl1Du3aloAjVJTNDpcIOVVhrHFF66lLfJL1zJr9PQ2nFJSBaKoDe+sAvLufZVHVzYh7W0h/c6AAZ+7Tvj6q9j68G/cTCS/3n1vLKHZwNi+P+pS0WkZNMBMUl+LDLuiE4omZy71r3UFMwNJV+VJ/GC5ixVUkBStsT4gGKh0Gm4Oy3qvq7Lbmq24nPdDuDR9deR11XzP4vFu3TYzfnIyiSVmgizUYGqkIXNdKTY9pgb9D2Ix5t0+NHkVzCdU03suWkkVZAoCONCn0T35gAeW38de43mf97sMOpSvj4aa1KYUm58USI7Wxxes03bAZdRzk6UtbzMaCQ6IxO0dy7X+XsjoD16hpsBeGz9dfzHj+R/Hp8nCxZRqkEDTaCKCSywjiaoMJ1TITE9eg7Jqnq8HL6gDwiZb0u0V0Rr/rmvqjxKuaLCX7ZWXTvAY+uvm3z8CP7nzVpngqrJpZKwWnCUjIviYVlirlGOzPLI3SMVyp/elvBUjjDkNhrtufFFErQ8pmdSlbK16toBHlt/HV8uHMX/vEGALkV3RJREiSlopxwdMXOZPLZ+ix+kAHpMKIk8UtE1ygtquttwxNhphrIZ1IBzjGF3IIGxGcBj6q8bHJBG8T9vdsoWrTFEuebEZuVxhhClH6P5Zo89OG9fwHNjtNQTpD0TG9PJLEYqvEY6Rlxy+ZZGfL0Aj62/bnQCXp//eeM4KzfQVJbgMQbUjlMFIm6TpcfWlZje7NBSV6IsEVmumWIbjiloUzQX9OzYdo8L1wjw2PrrpimONfmfNyzKklrgnEkSzT5QWYQW40YShyzqsRmMXbvVxKtGuYyMKaU1ugenLDm5Ily4iT14fP11Mx+xJv+zZ3MvnfdFqxU3a1W/FTB4m3Qfsyc1XUcdVhDeUDZXSFHHLQj/Y5jtC7ZqM0CXGwB4bP11i3LhOvzPGygYtiUBiwQV/4wFO0majijGsafHyRLu0yG6q35cL1rOpVxr2s5cM2jJYMCdc10Aj6q/blRpWJ//+dmm5psMl0KA2+AFRx9jMe2WbC4jQxnikd4DU8TwUjRVacgdlhmr3bpddzuJ9zXqr2xnxJfzP29RexdtjDVZqzkqa6PyvcojGrfkXiJ8SEtml/nYskicv0ivlxbqjemwUjMw5evdg8fUX9nOiC/lf94Q2i7MURk9nW1MSj5j8eAyV6y5CN2S6qbnw3vdA1Iwq+XOSCl663udN3IzLnrt+us25cI1+Z83SXQUldqQq0b5XOT17bGpLd6ssN1VMPf8c+jG8L3NeCnMdF+Ra3fRa9dft39/LuZ/3vwHoHrqGmQFafmiQw6eyzMxS05K4bL9uA+SKUQzCnSDkqOGokXyJvbgJ/BHI+qvY69//4rl20NsmK2ou2dTsyIALv/91/8n3P2Aao71WFGi8KKv1fRC5+J67Q/507/E/SOshqN5TsmYIjVt+kcjAx98iz/4SaojbIV1rexE7/C29HcYD/DX4a0rBOF5VTu7omsb11L/AWcVlcVZHSsqGuXLLp9ha8I//w3Mv+T4Ew7nTBsmgapoCrNFObIcN4pf/Ob/mrvHTGqqgAupL8qWjWPS9m/31jAe4DjA+4+uCoQoT/zOzlrNd3qd4SdphFxsUvYwGWbTWtISc3wNOWH+kHBMfc6kpmpwPgHWwqaSUG2ZWWheYOGQGaHB+eQ/kn6b3pOgLV+ODSn94wDvr8Bvb70/LLuiPPEr8OGVWfDmr45PZyccEmsVXZGe1pRNX9SU5+AVQkNTIVPCHF/jGmyDC9j4R9LfWcQvfiETmgMMUCMN1uNCakkweZsowdYobiMSlnKA93u7NzTXlSfe+SVbfnPQXmg9LpYAQxpwEtONyEyaueWM4FPjjyjG3uOaFmBTWDNgBXGEiQpsaWhnAqIijB07Dlsy3fUGeP989xbWkyf+FF2SNEtT1E0f4DYYVlxFlbaSMPIRMk/3iMU5pME2SIWJvjckciebkQuIRRyhUvkHg/iUljG5kzVog5hV7vIlCuBrmlhvgPfNHQM8lCf+FEGsYbMIBC0qC9a0uuy2wLXVbLBaP5kjHokCRxapkQyzI4QEcwgYHRZBp+XEFTqXFuNVzMtjXLJgX4gAid24Hjwc4N3dtVSe+NNiwTrzH4WVUOlDobUqr1FuAgYllc8pmzoVrELRHSIW8ViPxNy4xwjBpyR55I6J220qQTZYR4guvUICJiSpr9gFFle4RcF/OMB7BRiX8sSfhpNSO3lvEZCQfLUVTKT78Ek1LRLhWN+yLyTnp8qWUZ46b6vxdRGXfHVqx3eI75YaLa4iNNiK4NOW7wPW6lhbSOF9/M9qw8e/aoB3d156qTzxp8pXx5BKAsYSTOIIiPkp68GmTq7sZtvyzBQaRLNxIZ+paozHWoLFeExIhRBrWitHCAHrCF7/thhD8JhYz84wg93QRV88wLuLY8zF8sQ36qF1J455bOlgnELfshKVxYOXKVuKx0jaj22sczTQqPqtV/XDgpswmGTWWMSDw3ssyUunLLrVPGjYRsH5ggHeHSWiV8kT33ycFSfMgkoOK8apCye0J6VW6GOYvffgU9RWsukEi2kUV2nl4dOYUzRik9p7bcA4ggdJ53LxKcEe17B1R8eqAd7dOepV8sTXf5lhejoL85hUdhDdknPtKHFhljOT+bdq0hxbm35p2nc8+Ja1Iw+tJykgp0EWuAAZYwMVwac5KzYMslhvgHdHRrxKnvhTYcfKsxTxtTETkjHO7rr3zjoV25lAQHrqpV7bTiy2aXMmUhTBnKS91jhtR3GEoF0oLnWhWNnYgtcc4N0FxlcgT7yz3TgNIKkscx9jtV1ZKpWW+Ub1tc1eOv5ucdgpx+FJy9pgbLE7xDyXb/f+hLHVGeitHOi6A7ybo3sF8sS7w7cgdk0nJaOn3hLj3uyD0Zp5pazFIUXUpuTTU18d1EPkDoX8SkmWTnVIozEdbTcZjoqxhNHf1JrSS/AcvHjZ/SMHhL/7i5z+POsTUh/8BvNfYMTA8n+yU/MlTZxSJDRStqvEuLQKWwDctMTQogUDyQRoTQG5Kc6oQRE1yV1jCA7ri7jdZyK0sYTRjCR0Hnnd+y7nHxNgTULqw+8wj0mQKxpYvhjm9uSUxg+TTy7s2GtLUGcywhXSKZN275GsqlclX90J6bRI1aouxmgL7Q0Nen5ziM80SqMIo8cSOo+8XplT/5DHNWsSUr/6lLN/QQ3rDyzLruEW5enpf7KqZoShEduuSFOV7DLX7Ye+GmXb6/hnNNqKsVXuMDFpb9Y9eH3C6NGEzuOuI3gpMH/I6e+zDiH1fXi15t3vA1czsLws0TGEtmPEJdiiFPwlwKbgLHAFk4P6ZyPdymYYHGE0dutsChQBl2JcBFlrEkY/N5bQeXQ18gjunuMfMfsBlxJSx3niO485fwO4fGD5T/+3fPQqkneWVdwnw/3bMPkW9Wbqg+iC765Zk+xcT98ibKZc2EdgHcLoF8cSOo/Oc8fS+OyEULF4g4sJqXVcmfMfsc7A8v1/yfGXmL9I6Fn5pRwZhsPv0TxFNlAfZCvG+Oohi82UC5f/2IsJo0cTOm9YrDoKhFPEUr/LBYTUNht9zelHXDqwfPCIw4owp3mOcIQcLttWXFe3VZ/j5H3cIc0G6oPbCR+6Y2xF2EC5cGUm6wKC5tGEzhsWqw5hNidUiKX5gFWE1GXh4/Qplw4sVzOmx9QxU78g3EF6wnZlEN4FzJ1QPSLEZz1KfXC7vd8ssGdIbNUYpVx4UapyFUHzJoTOo1McSkeNn1M5MDQfs4qQuhhX5vQZFw8suwWTcyYTgioISk2YdmkhehG4PkE7w51inyAGGaU+uCXADabGzJR1fn3lwkty0asIo8cROm9Vy1g0yDxxtPvHDAmpu+PKnM8Ix1wwsGw91YJqhteaWgjYBmmQiebmSpwKKzE19hx7jkzSWOm66oPbzZ8Yj6kxVSpYjVAuvLzYMCRo3oTQecOOjjgi3NQ4l9K5/hOGhNTdcWVOTrlgYNkEXINbpCkBRyqhp+LdRB3g0OU6rMfW2HPCFFMV9nSp+uB2woepdbLBuJQyaw/ZFysXrlXwHxI0b0LovEkiOpXGA1Ijagf+KUNC6rKNa9bQnLFqYNkEnMc1uJrg2u64ELPBHpkgWbmwKpJoDhMwNbbGzAp7Yg31wS2T5rGtzit59PrKhesWG550CZpHEzpv2NGRaxlNjbMqpmEIzygJqQfjypycs2pg2cS2RY9r8HUqkqdEgKTWtWTKoRvOBPDYBltja2SO0RGjy9UHtxwRjA11ujbKF+ti5cIR9eCnxUg6owidtyoU5tK4NLji5Q3HCtiyF2IqLGYsHViOXTXOYxucDqG0HyttqYAKqYo3KTY1ekyDXRAm2AWh9JmsVh/ccg9WJ2E8YjG201sPq5ULxxX8n3XLXuMInbft2mk80rRGjCGctJ8/GFdmEQ9Ug4FlE1ll1Y7jtiraqm5Fe04VV8lvSVBL8hiPrfFVd8+7QH3Qbu2ipTVi8cvSGivc9cj8yvH11YMHdNSERtuOslM97feYFOPKzGcsI4zW0YGAbTAOaxCnxdfiYUmVWslxiIblCeAYr9VYR1gM7GmoPrilunSxxeT3DN/2eBQ9H11+nk1adn6VK71+5+Jfct4/el10/7KBZfNryUunWSCPxPECk1rdOv1WVSrQmpC+Tl46YD3ikQYcpunSQgzVB2VHFhxHVGKDgMEY5GLlQnP7FMDzw7IacAWnO6sBr12u+XanW2AO0wQ8pknnFhsL7KYIqhkEPmEXFkwaN5KQphbkUmG72wgw7WSm9RiL9QT925hkjiVIIhphFS9HKI6/8QAjlpXqg9W2C0apyaVDwKQwrwLY3j6ADR13ZyUNByQXHQu6RY09Hu6zMqXRaNZGS/KEJs0cJEe9VH1QdvBSJv9h09eiRmy0V2uJcqHcShcdvbSNg5fxkenkVprXM9rDVnX24/y9MVtncvbKY706anNl3ASll9a43UiacVquXGhvq4s2FP62NGKfQLIQYu9q1WmdMfmUrDGt8eDS0cXozH/fjmUH6Jruvm50hBDSaEU/2Ru2LEN/dl006TSc/g7tfJERxGMsgDUEr104pfWH9lQaN+M4KWQjwZbVc2rZVNHsyHal23wZtIs2JJqtIc/WLXXRFCpJkfE9jvWlfFbsNQ9pP5ZBS0zKh4R0aMFj1IjTcTnvi0Zz2rt7NdvQb2mgbju1plsH8MmbnEk7KbK0b+wC2iy3aX3szW8xeZvDwET6hWZYwqTXSSG+wMETKum0Dq/q+x62gt2ua2ppAo309TRk9TPazfV3qL9H8z7uhGqGqxNVg/FKx0HBl9OVUORn8Q8Jx9gFttGQUDr3tzcXX9xGgN0EpzN9mdZ3GATtPhL+CjxFDmkeEU6x56kqZRusLzALXVqkCN7zMEcqwjmywDQ6OhyUe0Xao1Qpyncrg6wKp9XfWDsaZplElvQ/b3sdweeghorwBDlHzgk1JmMc/wiERICVy2VJFdMjFuLQSp3S0W3+sngt2njwNgLssFGVQdJ0tu0KH4ky1LW4yrbkuaA6Iy9oz/qEMMXMMDWyIHhsAyFZc2peV9hc7kiKvfULxCl9iddfRK1f8kk9qvbdOoBtOg7ZkOZ5MsGrSHsokgLXUp9y88smniwWyuFSIRVmjplga3yD8Uij5QS1ZiM4U3Qw5QlSm2bXjFe6jzzBFtpg+/YBbLAWG7OPynNjlCw65fukGNdkJRf7yM1fOxVzbxOJVocFoYIaGwH22mIQkrvu1E2nGuebxIgW9U9TSiukPGU+Lt++c3DJPKhyhEEbXCQLUpae2exiKy6tMPe9mDRBFCEMTWrtwxN8qvuGnt6MoihKWS5NSyBhbH8StXoAz8PLOrRgLtOT/+4vcu+7vDLnqNvztOq7fmd8sMmY9Xzn1zj8Dq8+XVdu2Nv0IIySgEdQo3xVHps3Q5i3fLFsV4aiqzAiBhbgMDEd1uh8qZZ+lwhjkgokkOIv4xNJmyncdfUUzgB4oFMBtiu71Xumpz/P+cfUP+SlwFExwWW62r7b+LSPxqxn/gvMZ5z9C16t15UbNlq+jbGJtco7p8wbYlL4alSyfWdeuu0j7JA3JFNuVAwtst7F7FhWBbPFNKIUORndWtLraFLmMu7KFVDDOzqkeaiN33YAW/r76wR4XDN/yN1z7hejPau06EddkS/6XThfcz1fI/4K736fO48vlxt2PXJYFaeUkFS8U15XE3428xdtn2kc8GQlf1vkIaNRRnOMvLTWrZbElEHeLWi1o0dlKPAh1MVgbbVquPJ5+Cr8LU5/H/+I2QlHIU2ClXM9G8v7Rr7oc/hozfUUgsPnb3D+I+7WF8kNO92GY0SNvuxiE+2Bt8prVJTkzE64sfOstxuwfxUUoyk8VjcTlsqe2qITSFoSj6Epd4KsT6BZOWmtgE3hBfir8IzZDwgV4ZTZvD8VvPHERo8v+vL1DASHTz/i9OlKueHDjK5Rnx/JB1Vb1ioXdBra16dmt7dgik10yA/FwJSVY6XjA3oy4SqM2frqDPPSRMex9qs3XQtoWxMj7/Er8GWYsXgjaVz4OYumP2+9kbxvny/6kvWsEBw+fcb5bInc8APdhpOSs01tEqIkoiZjbAqKMruLbJYddHuHFRIyJcbdEdbl2sVLaySygunutBg96Y2/JjKRCdyHV+AEFtTvIpbKIXOamknYSiB6KV/0JetZITgcjjk5ZdaskBtWO86UF0ap6ozGXJk2WNiRUlCPFir66lzdm/SLSuK7EUdPz8f1z29Skq6F1fXg8+5UVR6bszncP4Tn4KUkkdJ8UFCY1zR1i8RmL/qQL3rlei4THG7OODlnKko4oI01kd3CaM08Ia18kC3GNoVaO9iDh+hWxSyTXFABXoau7Q6q9OxYg/OVEMw6jdbtSrJ9cBcewGmaZmg+bvkUnUUaGr+ZfnMH45Ivevl61hMcXsxYLFTu1hTm2zViCp7u0o5l+2PSUh9bDj6FgYypufBDhqK2+oXkiuHFHR3zfj+9PtA8oR0xnqX8qn+sx3bFODSbbF0X8EUvWQ8jBIcjo5bRmLOljDNtcqNtOe756h3l0VhKa9hDd2l1eqmsnh0MNMT/Cqnx6BInumhLT8luljzQ53RiJeA/0dxe5NK0o2fA1+GLXr6eNQWHNUOJssQaTRlGpLHKL9fD+IrQzTOMZS9fNQD4AnRNVxvTdjC+fJdcDDWQcyB00B0t9BDwTxXgaAfzDZ/DBXzRnfWMFRwuNqocOmX6OKNkY63h5n/fFcB28McVHqnXZVI27K0i4rDLNE9lDKV/rT+udVbD8dFFu2GGZ8mOt0kAXcoX3ZkIWVtw+MNf5NjR2FbivROHmhV1/pj2egv/fMGIOWTIWrV3Av8N9imV9IWml36H6cUjqEWNv9aNc+veb2sH46PRaHSuMBxvtW+twxctq0z+QsHhux8Q7rCY4Ct8lqsx7c6Sy0dl5T89rIeEuZKoVctIk1hNpfavER6yyH1Vvm3MbsUHy4ab4hWr/OZPcsRBphnaV65/ZcdYPNNwsjN/djlf9NqCw9U5ExCPcdhKxUgLSmfROpLp4WSUr8ojdwbncbvCf+a/YzRaEc6QOvXcGO256TXc5Lab9POvB+AWY7PigWYjzhifbovuunzRawsO24ZqQQAqguBtmpmPB7ysXJfyDDaV/aPGillgz1MdQg4u5MYaEtBNNHFjkRlSpd65lp4hd2AVPTfbV7FGpyIOfmNc/XVsPfg7vzaS/3nkvLL593ANLvMuRMGpQIhiF7kUEW9QDpAUbTWYBcbp4WpacHHY1aacqQyjGZS9HI3yCBT9kUZJhVOD+zUDvEH9ddR11fzPcTDQ5TlgB0KwqdXSavk9BC0pKp0WmcuowSw07VXmXC5guzSa4p0UvRw2lbDiYUx0ExJJRzWzi6Gm8cnEkfXXsdcG/M/jAJa0+bmCgdmQ9CYlNlSYZOKixmRsgiFxkrmW4l3KdFKv1DM8tk6WxPYJZhUUzcd8Kdtgrw/gkfXXDT7+avmfVak32qhtkg6NVdUS5wgkru1YzIkSduTW1FDwVWV3JQVJVuieTc0y4iDpFwc7/BvSalvKdQM8sv662cevz/+8sQVnjVAT0W2wLllw1JiMhJRxgDjCjLQsOzSFSgZqx7lAW1JW0e03yAD3asC+GD3NbQhbe+mN5GXH1F83KDOM4n/e5JIuH4NpdQARrFPBVptUNcjj4cVMcFSRTE2NpR1LEYbYMmfWpXgP9KejaPsLUhuvLCsVXznAG9dfx9SR1ud/3hZdCLHb1GMdPqRJgqDmm76mHbvOXDtiO2QPUcKo/TWkQ0i2JFXpBoo7vij1i1Lp3ADAo+qvG3V0rM//vFnnTE4hxd5Ka/Cor5YEdsLVJyKtDgVoHgtW11pWSjolPNMnrlrVj9Fv2Qn60twMwKPqr+N/wvr8z5tZcDsDrv06tkqyzESM85Ycv6XBWA2birlNCXrI6VbD2lx2L0vQO0QVTVVLH4SE67fgsfVXv8n7sz7/85Z7cMtbE6f088wSaR4kCkCm10s6pKbJhfqiUNGLq+0gLWC6eUAZFPnLjwqtKd8EwGvWX59t7iPW4X/eAN1svgRVSY990YZg06BD1ohLMtyFTI4pKTJsS9xREq9EOaPWiO2gpms7397x6nQJkbh+Fz2q/rqRROX6/M8bJrqlVW4l6JEptKeUFuMYUbtCQ7CIttpGc6MY93x1r1vgAnRXvY5cvwWPqb9uWQm+lP95QxdNMeWhOq1x0Db55C7GcUv2ZUuN6n8iKzsvOxibC//Yfs9Na8r2Rlz02vXXDT57FP/zJi66/EJSmsJKa8QxnoqW3VLQ+jZVUtJwJ8PNX1NQCwfNgdhhHD9on7PdRdrdGPF28rJr1F+3LBdeyv+8yYfLoMYet1vX4upNAjVvwOUWnlNXJXlkzk5Il6kqeoiL0C07qno+/CYBXq/+utlnsz7/Mzvy0tmI4zm4ag23PRN3t/CWryoUVJGm+5+K8RJ0V8Hc88/XHUX/HfiAq7t+BH+x6v8t438enWmdJwFA6ZINriLGKv/95f8lT9/FnyA1NMVEvQyaXuu+gz36f/DD73E4pwqpLcvm/o0Vle78n//+L/NPvoefp1pTJye6e4A/D082FERa5/opeH9zpvh13cNm19/4v/LDe5xMWTi8I0Ta0qKlK27AS/v3/r+/x/2GO9K2c7kVMonDpq7//jc5PKCxeNPpFVzaRr01wF8C4Pu76hXuX18H4LduTr79guuFD3n5BHfI+ZRFhY8w29TYhbbLi/bvBdqKE4fUgg1pBKnV3FEaCWOWyA+m3WpORZr/j+9TKJtW8yBTF2/ZEODI9/QavHkVdGFp/Pjn4Q+u5hXapsP5sOH+OXXA1LiKuqJxiMNbhTkbdJTCy4llEt6NnqRT4dhg1V3nbdrm6dYMecA1yTOL4PWTE9L5VzPFlLBCvlG58AhehnN4uHsAYinyJ+AZ/NkVvELbfOBUuOO5syBIEtiqHU1k9XeISX5bsimrkUUhnGDxourN8SgUsCZVtKyGbyGzHXdjOhsAvOAswSRyIBddRdEZWP6GZhNK/yjwew9ehBo+3jEADu7Ay2n8mDc+TS7awUHg0OMzR0LABhqLD4hJEh/BEGyBdGlSJoXYXtr+3HS4ijzVpgi0paWXtdruGTknXBz+11qT1Q2inxaTzQCO46P3lfLpyS4fou2PH/PupwZgCxNhGlj4IvUuWEsTkqMWm6i4xCSMc9N1RDQoCVcuGItJ/MRWefais+3synowi/dESgJjkilnWnBTGvRWmaw8oR15257t7CHmCf8HOn7cwI8+NQBXMBEmAa8PMRemrNCEhLGEhDQKcGZWS319BX9PFBEwGTbRBhLbDcaV3drFcDqk5kCTd2JF1Wp0HraqBx8U0wwBTnbpCadwBA/gTH/CDrcCs93LV8E0YlmmcyQRQnjBa8JESmGUfIjK/7fkaDJpmD2QptFNVJU1bbtIAjjWQizepOKptRjbzR9Kag6xZmMLLjHOtcLT3Tx9o/0EcTT1XN3E45u24AiwEypDJXihKjQxjLprEwcmRKclaDNZCVqr/V8mYWyFADbusiY5hvgFoU2vio49RgJLn5OsReRFN6tabeetiiy0V7KFHT3HyZLx491u95sn4K1QQSPKM9hNT0wMVvAWbzDSVdrKw4zRjZMyJIHkfq1VAVCDl/bUhNKlGq0zGr05+YAceXVPCttVk0oqjVwMPt+BBefx4yPtGVkUsqY3CHDPiCM5ngupUwCdbkpd8kbPrCWHhkmtIKLEetF2499eS1jZlIPGYnlcPXeM2KD9vLS0bW3ktYNqUllpKLn5ZrsxlIzxvDu5eHxzGLctkZLEY4PgSOg2IUVVcUONzUDBEpRaMoXNmUc0tFZrTZquiLyKxrSm3DvIW9Fil+AkhXu5PhEPx9mUNwqypDvZWdKlhIJQY7vn2OsnmBeOWnYZ0m1iwbbw1U60by5om47iHRV6fOgzjMf/DAZrlP40Z7syxpLK0lJ0gqaAK1c2KQKu7tabTXkLFz0sCftuwX++MyNeNn68k5Buq23YQhUh0SNTJa1ioQ0p4nUG2y0XilF1JqODqdImloPS4Bp111DEWT0jJjVv95uX9BBV7eB3bUWcu0acSVM23YZdd8R8UbQUxJ9wdu3oMuhdt929ME+mh6JXJ8di2RxbTi6TbrDquqV4aUKR2iwT6aZbyOwEXN3DUsWr8Hn4EhwNyHuXHh7/pdaUjtR7vnDh/d8c9xD/s5f501eQ1+CuDiCvGhk1AN/4Tf74RfxPwD3toLarR0zNtsnPzmS64KIRk861dMWCU8ArasG9T9H0ZBpsDGnjtAOM2+/LuIb2iIUGXNgl5ZmKD/Tw8TlaAuihaFP5yrw18v4x1898zIdP+DDAX1bM3GAMvPgRP/cJn3zCW013nrhHkrITyvYuwOUkcHuKlRSW5C6rzIdY4ppnF7J8aAJbQepgbJYBjCY9usGXDKQxq7RZfh9eg5d1UHMVATRaD/4BHK93/1iAgYZ/+jqPn8Dn4UExmWrpa3+ZOK6MvM3bjwfzxNWA2dhs8+51XHSPJiaAhGSpWevEs5xHLXcEGFXYiCONySH3fPWq93JIsBiSWvWyc3CAN+EcXoT7rCSANloPPoa31rt/5PUA/gp8Q/jDD3hyrjzlR8VkanfOvB1XPubt17vzxAfdSVbD1pzAnfgyF3ycadOTOTXhpEUoLC1HZyNGW3dtmjeXgr2r56JNmRwdNNWaQVBddd6rh4MhviEB9EFRD/7RGvePvCbwAL4Mx/D6M541hHO4D3e7g6PafdcZVw689z7NGTwo5om7A8sPhccT6qKcl9NJl9aM/9kX+e59Hh1yPqGuCCZxuITcsmNaJ5F7d0q6J3H48TO1/+M57085q2icdu2U+W36Ldllz9Agiv4YGljoEN908EzvDOrBF98/vtJwCC/BF2AG75xxEmjmMIcjxbjoaxqOK3/4hPOZzhMPBpYPG44CM0dTVm1LjLtUWWVz1Bcf8tEx0zs8O2A2YVHRxKYOiy/aOVoAaMu0i7ubu43njjmd4ibMHU1sIDHaQNKrZND/FZYdk54oCXetjq7E7IVl9eAL7t+oHnwXXtLx44czzoRFHBztYVwtH1d+NOMkupZ5MTM+gUmq90X+Bh9zjRlmaQ+m7YMqUL/veemcecAtOJ0yq1JnVlN27di2E0+Klp1tAJ4KRw1eMI7aJjsO3R8kPSI3fUFXnIOfdQe86sIIVtWDL7h//Ok6vj8vwDk08NEcI8zz7OhBy+WwalzZeZ4+0XniRfst9pAJqQHDGLzVQ2pheZnnv1OWhwO43/AgcvAEXEVVpa4db9sGvNK8wjaENHkfFQ4Ci5i7dqnQlPoLQrHXZDvO3BIXZbJOBrOaEbML6sFL798I4FhKihjHMsPjBUZYCMFr6nvaArxqXPn4lCa+cHfSa2cP27g3Z3ziYTRrcbQNGLQmGF3F3cBdzzzX7AILx0IB9rbwn9kx2G1FW3Inic+ZLIsVvKR8Zwfj0l1fkqo8LWY1M3IX14OX3r9RKTIO+d9XzAI8qRPGPn/4NC2n6o4rN8XJ82TOIvuVA8zLKUHRFgBCetlDZlqR1gLKjS39xoE7Bt8UvA6BxuEDjU3tFsEijgA+615tmZkXKqiEENrh41iLDDZNq4pKTWR3LZfnos81LOuNa15cD956vLMsJd1rqYp51gDUQqMYm2XsxnUhD2jg1DM7SeuJxxgrmpfISSXVIJIS5qJJSvJPEQ49DQTVIbYWJ9QWa/E2+c/oPK1drmC7WSfJRNKBO5Yjvcp7Gc3dmmI/Xh1kDTEuiSnWqQf37h+fTMhGnDf6dsS8SQfQWlqqwXXGlc/PEZ/SC5mtzIV0nAshlQdM/LvUtYutrEZ/Y+EAFtq1k28zQhOwLr1AIeANzhF8t9qzTdZf2qRKO6MWE9ohBYwibbOmrFtNmg3mcS+tB28xv2uKd/agYCvOP+GkSc+0lr7RXzyufL7QbkUpjLjEWFLqOIkAGu2B0tNlO9Eau2W1qcOUvVRgKzypKIQZ5KI3q0MLzqTNRYqiZOqmtqloIRlmkBHVpHmRYV6/HixbO6UC47KOFJnoMrVyr7wYz+SlW6GUaghYbY1I6kkxA2W1fSJokUdSh2LQ1GAimRGm0MT+uu57H5l7QgOWxERpO9moLRPgTtquWCfFlGlIjQaRly9odmzMOWY+IBO5tB4sW/0+VWGUh32qYk79EidWKrjWuiLpiVNGFWFRJVktyeXWmbgBBzVl8anPuXyNJlBJOlKLTgAbi/EYHVHxWiDaVR06GnHQNpJcWcK2jJtiCfG2sEHLzuI66sGrMK47nPIInPnu799935aOK2cvmvubrE38ZzZjrELCmXM2hM7UcpXD2oC3+ECVp7xtIuxptJ0jUr3sBmBS47TVxlvJ1Sqb/E0uLdvLj0lLr29ypdd/eMX3f6lrxGlKwKQxEGvw0qHbkbwrF3uHKwVENbIV2wZ13kNEF6zD+x24aLNMfDTCbDPnEikZFyTNttxWBXDaBuM8KtI2rmaMdUY7cXcUPstqTGvBGSrFWIpNMfbdea990bvAOC1YX0qbc6smDS1mPxSJoW4fwEXvjMmhlijDRq6qale6aJEuFGoppYDoBELQzLBuh/mZNx7jkinv0EtnUp50lO9hbNK57lZaMAWuWR5Yo9/kYwcYI0t4gWM47Umnl3YmpeBPqSyNp3K7s2DSAS/39KRuEN2bS4xvowV3dFRMx/VFcp2Yp8w2nTO9hCXtHG1kF1L4KlrJr2wKfyq77R7MKpFKzWlY9UkhYxyHWW6nBWPaudvEAl3CGcNpSXPZ6R9BbBtIl6cHL3gIBi+42CYXqCx1gfGWe7Ap0h3luyXdt1MKy4YUT9xSF01G16YEdWsouW9mgDHd3veyA97H+Ya47ZmEbqMY72oPztCGvK0onL44AvgC49saZKkWRz4veWljE1FHjbRJaWv6ZKKtl875h4CziFCZhG5rx7tefsl0aRT1bMHZjm8dwL/6u7wCRysaQblQoG5yAQN5zpatMNY/+yf8z+GLcH/Qn0iX2W2oEfXP4GvwQHuIL9AYGnaO3zqAX6946nkgqZNnUhx43DIdQtMFeOPrgy/y3Yd85HlJWwjLFkU3kFwq28xPnuPhMWeS+tDLV9Otllq7pQCf3uXJDN9wFDiUTgefHaiYbdfi3b3u8+iY6TnzhgehI1LTe8lcd7s1wJSzKbahCRxKKztTLXstGAiu3a6rPuQs5pk9TWAan5f0BZmGf7Ylxzzk/A7PAs4QPPPAHeFQ2hbFHszlgZuKZsJcUmbDC40sEU403cEjczstOEypa+YxevL4QBC8oRYqWdK6b7sK25tfE+oDZgtOQ2Jg8T41HGcBE6fTWHn4JtHcu9S7uYgU5KSCkl/mcnq+5/YBXOEr6lCUCwOTOM1taOI8mSxx1NsCXBEmLKbMAg5MkwbLmpBaFOPrNSlO2HnLiEqW3tHEwd8AeiQLmn+2gxjC3k6AxREqvKcJbTEzlpLiw4rNZK6oJdidbMMGX9FULKr0AkW+2qDEPBNNm5QAt2Ik2nftNWHetubosHLo2nG4vQA7GkcVCgVCgaDixHqo9UUn1A6OshapaNR/LPRYFV8siT1cCtJE0k/3WtaNSuUZYKPnsVIW0xXWnMUxq5+En4Kvw/MqQmVXnAXj9Z+9zM98zM/Agy7F/qqj2Nh67b8HjFnPP3iBn/tkpdzwEJX/whIcQUXOaikeliCRGUk7tiwF0rItwMEhjkZ309hikFoRAmLTpEXWuHS6y+am/KB/fM50aLEhGnSMwkpxzOov4H0AvgovwJ1iGzDLtJn/9BU+fAINfwUe6FHSLhu83viV/+/HrOePX+STT2B9uWGbrMHHLldRBlhS/CJQmcRxJFqZica01XixAZsYiH1uolZxLrR/SgxVIJjkpQP4PE9sE59LKLr7kltSBogS5tyszzH8Fvw8/AS8rNOg0xUS9fIaHwb+6et8Q/gyvKRjf5OusOzGx8evA/BP4IP11uN/grca5O0lcsPLJ5YjwI4QkJBOHa0WdMZYGxPbh2W2nR9v3WxEWqgp/G3+6VZbRLSAAZ3BhdhAaUL33VUSw9yjEsvbaQ9u4A/gGXwZXoEHOuU1GSj2chf+Mo+f8IcfcAxfIKVmyunRbYQVnoevwgfw3TXXcw++xNuP4fhyueEUNttEduRVaDttddoP0eSxLe2LENk6itYxlrxBNBYrNNKSQmeaLcm9c8UsaB5WyO6675yyQIAWSDpBVoA/gxmcwEvwoDv0m58UE7gHn+fJOa8/Ywan8EKRfjsopF83eCglX/Sfr7OeaRoQfvt1CGvIDccH5BCvw1sWIzRGC/66t0VTcLZQZtm6PlAasbOJ9iwWtUo7biktTSIPxnR24jxP1ZKaqq+2RcXM9OrBAm/AAs7hDJ5bNmGb+KIfwCs8a3jnjBrOFeMjHSCdbKr+2uOLfnOd9eiA8Hvvwwq54VbP2OqwkB48Ytc4YEOiH2vTXqodabfWEOzso4qxdbqD5L6tbtNPECqbhnA708DZH4QOJUXqScmUlks7Ot6FBuZw3n2mEbaUX7kDzxHOOQk8nKWMzAzu6ZZ8sOFw4RK+6PcuXo9tB4SbMz58ApfKDXf3szjNIIbGpD5TKTRxGkEMLjLl+K3wlWXBsCUxIDU+jbOiysESqAy1MGUJpXgwbTWzNOVEziIXZrJ+VIztl1PUBxTSo0dwn2bOmfDRPD3TRTGlfbCJvO9KvuhL1hMHhB9wPuPRLGHcdOWG2xc0U+5bQtAJT0nRTewXL1pgk2+rZAdeWmz3jxAqfNQQdzTlbF8uJ5ecEIWvTkevAHpwz7w78QujlD/Lr491bD8/1vhM2yrUQRrWXNQY4fGilfctMWYjL72UL/qS9eiA8EmN88nbNdour+PBbbAjOjIa4iBhfFg6rxeKdEGcL6p3EWR1Qq2Qkhs2DrnkRnmN9tG2EAqmgPw6hoL7Oza7B+3SCrR9tRftko+Lsf2F/mkTndN2LmzuMcKTuj/mX2+4Va3ki16+nnJY+S7MefpkidxwnV+4wkXH8TKnX0tsYzYp29DOOoSW1nf7nTh2akYiWmcJOuTidSaqESrTYpwjJJNVGQr+rLI7WsqerHW6Kp/oM2pKuV7T1QY9gjqlZp41/WfKpl56FV/0kvXQFRyeQ83xaTu5E8p5dNP3dUF34ihyI3GSpeCsywSh22ZJdWto9winhqifb7VRvgktxp13vyjrS0EjvrRfZ62uyqddSWaWYlwTPAtJZ2oZ3j/Sgi/mi+6vpzesfAcWNA0n8xVyw90GVFGuZjTXEQy+6GfLGLMLL523f5E0OmxVjDoOuRiH91RKU+vtoCtH7TgmvBLvtFXWLW15H9GTdVw8ow4IlRLeHECN9ym1e9K0I+Cbnhgv4Yu+aD2HaQJ80XDqOzSGAV4+4yCqBxrsJAX6ZTIoX36QnvzhhzzMfFW2dZVLOJfo0zbce5OvwXMFaZ81mOnlTVXpDZsQNuoYWveketKb5+6JOOsgX+NTm7H49fUTlx+WLuWL7qxnOFh4BxpmJx0p2gDzA/BUARuS6phR+pUsY7MMboAHx5xNsSVfVZcYSwqCKrqon7zM+8ecCkeS4nm3rINuaWvVNnMRI1IRpxTqx8PZUZ0Br/UEduo3B3hNvmgZfs9gQPj8vIOxd2kndir3awvJ6BLvoUuOfFWNYB0LR1OQJoUySKb9IlOBx74q1+ADC2G6rOdmFdJcD8BkfualA+BdjOOzP9uUhGUEX/TwhZsUduwRr8wNuXKurCixLBgpQI0mDbJr9dIqUuV+92ngkJZ7xduCk2yZKbfWrH1VBiTg9VdzsgRjW3CVXCvAwDd+c1z9dWw9+B+8MJL/eY15ZQ/HqvTwVdsZn5WQsgRRnMaWaecu3jFvMBEmgg+FJFZsnSl0zjB9OqPYaBD7qmoVyImFvzi41usesV0julaAR9dfR15Xzv9sEruRDyk1nb+QaLU67T885GTls6YgcY+UiMa25M/pwGrbCfzkvR3e0jjtuaFtnwuagHTSb5y7boBH119HXhvwP487jJLsLJ4XnUkHX5sLbS61dpiAXRoZSCrFJ+EjpeU3puVfitngYNo6PJrAigKktmwjyQdZpfq30mmtulaAx9Zfx15Xzv+cyeuiBFUs9zq8Kq+XB9a4PVvph3GV4E3y8HENJrN55H1X2p8VyqSKwVusJDKzXOZzplWdzBUFK9e+B4+uv468xvI/b5xtSAkBHQaPvtqWzllVvEOxPbuiE6+j2pvjcKsbvI7txnRErgfH7LdXqjq0IokKzga14GzQ23SSbCQvO6r+Or7SMIr/efOkkqSdMnj9mBx2DRsiY29Uj6+qK9ZrssCKaptR6HKURdwUYeUWA2kPzVKQO8ku2nU3Anhs/XWkBx3F/7wJtCTTTIKftthue1ty9xvNYLY/zo5KSbIuKbXpbEdSyeRyYdAIwKY2neyoc3+k1XUaufYga3T9daMUx/r8z1s10ITknIO0kuoMt+TB8jK0lpayqqjsJ2qtXAYwBU932zinimgmd6mTRDnQfr88q36NAI+tv24E8Pr8zxtasBqx0+xHH9HhlrwsxxNUfKOHQaZBITNf0uccj8GXiVmXAuPEAKSdN/4GLHhs/XWj92dN/uetNuBMnVR+XWDc25JLjo5Mg5IZIq226tmCsip2zZliL213YrTlL2hcFjpCduyim3M7/eB16q/blQsv5X/esDRbtJeabLIosWy3ycavwLhtxdWzbMmHiBTiVjJo6lCLjXZsi7p9PEPnsq6X6wd4bP11i0rD5fzPm/0A6brrIsllenZs0lCJlU4abakR59enZKrKe3BZihbTxlyZ2zl1+g0wvgmA166/bhwDrcn/7Ddz0eWZuJvfSESug6NzZsox3Z04FIxz0mUjMwVOOVTq1CQ0AhdbBGVdjG/CgsfUX7esJl3K/7ytWHRv683praW/8iDOCqWLLhpljDY1ZpzK75QiaZoOTpLKl60auHS/97oBXrv+umU9+FL+5+NtLFgjqVLCdbmj7pY5zPCPLOHNCwXGOcLquOhi8CmCWvbcuO73XmMUPab+ug3A6/A/78Bwe0bcS2+tgHn4J5pyS2WbOck0F51Vq3LcjhLvZ67p1ABbaL2H67bg78BfjKi/jr3+T/ABV3ilLmNXTI2SpvxWBtt6/Z//D0z/FXaGbSBgylzlsEGp+5//xrd4/ae4d8DUUjlslfIYS3t06HZpvfQtvv0N7AHWqtjP2pW08QD/FLy//da38vo8PNlKHf5y37Dxdfe/oj4kVIgFq3koLReSR76W/bx//n9k8jonZxzWTANVwEniDsg87sOSd/z7//PvMp3jQiptGVWFX2caezzAXwfgtzYUvbr0iozs32c3Uge7varH+CNE6cvEYmzbPZ9hMaYDdjK4V2iecf6EcEbdUDVUARda2KzO/JtCuDbNQB/iTeL0EG1JSO1jbXS+nLxtPMDPw1fh5+EPrgSEKE/8Gry5A73ui87AmxwdatyMEBCPNOCSKUeRZ2P6Myb5MRvgCHmA9ywsMifU+AYXcB6Xa5GibUC5TSyerxyh0j6QgLVpdyhfArRTTLqQjwe4HOD9s92D4Ap54odXAPBWLAwB02igG5Kkc+piN4lvODIFGAZgT+EO4Si1s7fjSR7vcQETUkRm9O+MXyo9OYhfe4xt9STQ2pcZRLayCV90b4D3jR0DYAfyxJ+eywg2IL7NTMXna7S/RpQ63JhWEM8U41ZyQGjwsVS0QBrEKLu8xwZsbi4wLcCT+OGidPIOCe1PiSc9Qt+go+vYqB7cG+B9d8cAD+WJPz0Am2gxXgU9IneOqDpAAXOsOltVuMzpdakJXrdPCzXiNVUpCeOos5cxnpQT39G+XVLhs1osQVvJKPZyNq8HDwd4d7pNDuWJPxVX7MSzqUDU6gfadKiNlUFTzLeFHHDlzO4kpa7aiKhBPGKwOqxsBAmYkOIpipyXcQSPlRTf+Tii0U3EJGaZsDER2qoB3h2hu0qe+NNwUooYU8y5mILbJe6OuX+2FTKy7bieTDAemaQyQ0CPthljSWO+xmFDIYiESjM5xKd6Ik5lvLq5GrQ3aCMLvmCA9wowLuWJb9xF59hVVP6O0CrBi3ZjZSNOvRy+I6klNVRJYRBaEzdN+imiUXQ8iVF8fsp+W4JXw7WISW7fDh7lptWkCwZ4d7QTXyBPfJMYK7SijjFppGnlIVJBJBYj7eUwtiP1IBXGI1XCsjNpbjENVpSAJ2hq2LTywEly3hUYazt31J8w2+aiLx3g3fohXixPfOMYm6zCGs9LVo9MoW3MCJE7R5u/WsOIjrqBoHUO0bJE9vxBpbhsd3+Nb4/vtPCZ4oZYCitNeYuC/8UDvDvy0qvkiW/cgqNqRyzqSZa/s0mqNGjtKOoTm14zZpUauiQgVfqtQiZjq7Q27JNaSK5ExRcrGCXO1FJYh6jR6CFqK7bZdQZ4t8g0rSlPfP1RdBtqaa9diqtzJkQ9duSryi2brQXbxDwbRUpFMBHjRj8+Nt7GDKgvph9okW7LX47gu0SpGnnFQ1S1lYldOsC7hYteR574ZuKs7Ei1lBsfdz7IZoxzzCVmmVqaSySzQbBVAWDek+N4jh9E/4VqZrJjPwiv9BC1XcvOWgO8275CVyBPvAtTVlDJfZkaZGU7NpqBogAj/xEHkeAuJihWYCxGN6e8+9JtSegFXF1TrhhLGP1fak3pebgPz192/8gB4d/6WT7+GdYnpH7hH/DJzzFiYPn/vjW0SgNpTNuPIZoAEZv8tlGw4+RLxy+ZjnKa5NdFoC7UaW0aduoYse6+bXg1DLg6UfRYwmhGEjqPvF75U558SANrElK/+MdpXvmqBpaXOa/MTZaa1DOcSiLaw9j0NNNst3c+63c7EKTpkvKHzu6bPbP0RkuHAVcbRY8ijP46MIbQeeT1mhA+5PV/inyDdQipf8LTvMXbwvoDy7IruDNVZKTfV4CTSRUYdybUCnGU7KUTDxLgCknqUm5aAW6/1p6eMsOYsphLzsHrE0Y/P5bQedx1F/4yPHnMB3/IOoTU9+BL8PhtjuFKBpZXnYNJxTuv+2XqolKR2UQgHhS5novuxVySJhBNRF3SoKK1XZbbXjVwWNyOjlqWJjrWJIy+P5bQedyldNScP+HZ61xKSK3jyrz+NiHG1hcOLL/+P+PDF2gOkekKGiNWKgJ+8Z/x8Iv4DdQHzcpZyF4v19I27w9/yPGDFQvmEpKtqv/TLiWMfn4sofMm9eAH8Ao0zzh7h4sJqYtxZd5/D7hkYPneDzl5idlzNHcIB0jVlQ+8ULzw/nc5/ojzl2juE0apD7LRnJxe04dMz2iOCFNtGFpTuXA5AhcTRo8mdN4kz30nVjEC4YTZQy4gpC7GlTlrePKhGsKKgeXpCYeO0MAd/GH7yKQUlXPLOasOH3FnSphjHuDvEu4gB8g66oNbtr6eMbFIA4fIBJkgayoXriw2XEDQPJrQeROAlY6aeYOcMf+IVYTU3XFlZufMHinGywaW3YLpObVBAsbjF4QJMsVUSayjk4voPsHJOQfPWDhCgDnmDl6XIRerD24HsGtw86RMHOLvVSHrKBdeVE26gKB5NKHzaIwLOmrqBWJYZDLhASG16c0Tn+CdRhWDgWXnqRZUTnPIHuMJTfLVpkoYy5CzylHVTGZMTwkGAo2HBlkQplrJX6U+uF1wZz2uwS1SQ12IqWaPuO4baZaEFBdukksJmkcTOm+YJSvoqPFzxFA/YUhIvWxcmSdPWTWwbAKVp6rxTtPFUZfKIwpzm4IoMfaYQLWgmlG5FME2gdBgm+J7J+rtS/XBbaVLsR7bpPQnpMFlo2doWaVceHk9+MkyguZNCJ1He+kuHTWyQAzNM5YSUg/GlTk9ZunAsg1qELVOhUSAK0LABIJHLKbqaEbHZLL1VA3VgqoiOKXYiS+HRyaEKgsfIqX64HYWbLRXy/qWoylIV9gudL1OWBNgBgTNmxA6b4txDT4gi3Ri7xFSLxtXpmmYnzAcWDZgY8d503LFogz5sbonDgkKcxGsWsE1OI+rcQtlgBBCSOKD1mtqYpIU8cTvBmAT0yZe+zUzeY92fYjTtGipXLhuR0ePoHk0ofNWBX+lo8Z7pAZDk8mEw5L7dVyZZoE/pTewbI6SNbiAL5xeygW4xPRuLCGbhcO4RIeTMFYHEJkYyEO9HmJfXMDEj/LaH781wHHZEtqSQ/69UnGpzH7LKIAZEDSPJnTesJTUa+rwTepI9dLJEawYV+ZkRn9g+QirD8vF8Mq0jFQ29js6kCS3E1+jZIhgPNanHdHFqFvPJLHqFwQqbIA4jhDxcNsOCCQLDomaL/dr5lyJaJU6FxPFjO3JOh3kVMcROo8u+C+jo05GjMF3P3/FuDLn5x2M04xXULPwaS6hBYki+MrMdZJSgPHlcB7nCR5bJ9Kr5ACUn9jk5kivdd8tk95SOGrtqu9lr2IhK65ZtEl7ZKrp7DrqwZfRUSN1el7+7NJxZbywOC8neNKTch5vsTEMNsoCCqHBCqIPRjIPkm0BjvFODGtto99rCl+d3wmHkW0FPdpZtC7MMcVtGFQjJLX5bdQ2+x9ypdc313uj8xlsrfuLgWXz1cRhZvJYX0iNVBRcVcmCXZs6aEf3RQF2WI/TcCbKmGU3IOoDJGDdDub0+hYckt6PlGu2BcxmhbTdj/klhccLGJMcqRjMJP1jW2ETqLSWJ/29MAoORluJ+6LPffBZbi5gqi5h6catQpmOT7/OFf5UorRpLzCqcMltBLhwd1are3kztrSzXO0LUbXRQcdLh/RdSZ+swRm819REDrtqzC4es6Gw4JCKlSnjYVpo0xeq33PrADbFLL3RuCmObVmPN+24kfa+AojDuM4umKe2QwCf6EN906HwjujaitDs5o0s1y+k3lgbT2W2i7FJdnwbLXhJUBq/9liTctSmFC/0OqUinb0QddTWamtjbHRFuWJJ6NpqZ8vO3fZJ37Db+2GkaPYLGHs7XTTdiFQJ68SkVJFVmY6McR5UycflNCsccHFaV9FNbR4NttLxw4pQ7wJd066Z0ohVbzihaxHVExd/ay04oxUKWt+AsdiQ9OUyZ2krzN19IZIwafSTFgIBnMV73ADj7V/K8u1MaY2sJp2HWm0f41tqwajEvdHWOJs510MaAqN4aoSiPCXtN2KSi46dUxHdaMquar82O1x5jqhDGvqmoE9LfxcY3zqA7/x3HA67r9ZG4O6Cuxu12/+TP+eLP+I+HErqDDCDVmBDO4larujNe7x8om2rMug0MX0rL1+IWwdwfR+p1TNTyNmVJ85ljWzbWuGv8/C7HD/izjkHNZNYlhZcUOKVzKFUxsxxN/kax+8zPWPSFKw80rJr9Tizyj3o1gEsdwgWGoxPezDdZ1TSENE1dLdNvuKL+I84nxKesZgxXVA1VA1OcL49dFlpFV5yJMhzyCmNQ+a4BqusPJ2bB+xo8V9u3x48VVIEPS/mc3DvAbXyoYr6VgDfh5do5hhHOCXMqBZUPhWYbWZECwVJljLgMUWOCB4MUuMaxGNUQDVI50TQ+S3kFgIcu2qKkNSHVoM0SHsgoZxP2d5HH8B9woOk4x5bPkKtAHucZsdykjxuIpbUrSILgrT8G7G5oCW+K0990o7E3T6AdW4TilH5kDjds+H64kS0mz24grtwlzDHBJqI8YJQExotPvoC4JBq0lEjjQkyBZ8oH2LnRsQ4Hu1QsgDTJbO8fQDnllitkxuVskoiKbRF9VwzMDvxHAdwB7mD9yCplhHFEyUWHx3WtwCbSMMTCUCcEmSGlg4gTXkHpZXWQ7kpznK3EmCHiXInqndkQjunG5kxTKEeGye7jWz9cyMR2mGiFQ15ENRBTbCp+Gh86vAyASdgmJq2MC6hoADQ3GosP0QHbnMHjyBQvQqfhy/BUbeHd5WY/G/9LK/8Ka8Jd7UFeNWEZvzPb458Dn8DGLOe3/wGL/4xP+HXlRt+M1PE2iLhR8t+lfgxsuh7AfO2AOf+owWhSZRYQbd622hbpKWKuU+XuvNzP0OseRDa+mObgDHJUSc/pKx31QdKffQ5OIJpt8GWjlgTwMc/w5MPCR/yl1XC2a2Yut54SvOtMev55Of45BOat9aWG27p2ZVORRvnEk1hqWMVUmqa7S2YtvlIpspuF1pt0syuZS2NV14mUidCSfzQzg+KqvIYCMljIx2YK2AO34fX4GWdu5xcIAb8MzTw+j/lyWM+Dw/gjs4GD6ehNgA48kX/AI7XXM/XAN4WHr+9ntywqoCakCqmKP0rmQrJJEErG2Upg1JObr01lKQy4jskWalKYfJ/EDLMpjNSHFEUAde2fltaDgmrNaWQ9+AAb8I5vKjz3L1n1LriB/BXkG/wwR9y/oRX4LlioHA4LzP2inzRx/DWmutRweFjeP3tNeSGlaE1Fde0OS11yOpmbIp2u/jF1n2RRZviJM0yBT3IZl2HWImKjQOxIyeU325b/qWyU9Moj1o07tS0G7qJDoGHg5m8yeCxMoEH8GU45tnrNM84D2l297DQ9t1YP7jki/7RmutRweEA77/HWXOh3HCxkRgldDQkAjNTMl2Iloc1qN5JfJeeTlyTRzxURTdn1Ixv2uKjs12AbdEWlBtmVdk2k7FFwj07PCZ9XAwW3dG+8xKzNFr4EnwBZpy9Qzhh3jDXebBpYcpuo4fQ44u+fD1dweEnHzI7v0xuuOALRUV8rXpFyfSTQYkhd7IHm07jpyhlkCmI0ALYqPTpUxXS+z4jgDj1Pflvmz5ecuItpIBxyTHpSTGWd9g1ApfD/bvwUhL4nT1EzqgX7cxfCcNmb3mPL/qi9SwTHJ49oj5ZLjccbTG3pRmlYi6JCG0mQrAt1+i2UXTZ2dv9IlQpN5naMYtviaXlTrFpoMsl3bOAFEa8sqPj2WCMrx3Yjx99qFwO59Aw/wgx+HlqNz8oZvA3exRDvuhL1jMQHPaOJ0+XyA3fp1OfM3qObEVdhxjvynxNMXQV4+GJyvOEFqeQBaIbbO7i63rpxCltdZShPFxkjM2FPVkn3TG+Rp9pO3l2RzFegGfxGDHIAh8SteR0C4HopXzRF61nheDw6TFN05Ebvq8M3VKKpGjjO6r7nhudTEGMtYM92HTDaR1FDMXJ1eThsbKfywyoWwrzRSXkc51flG3vIid62h29bIcFbTGhfV+faaB+ohj7dPN0C2e2lC96+XouFByen9AsunLDJZ9z7NExiUc0OuoYW6UZkIyx2YUR2z6/TiRjyKMx5GbbjLHvHuf7YmtKghf34LJfx63Yg8vrvN2zC7lY0x0tvKezo4HmGYDU+Gab6dFL+KI761lDcNifcjLrrr9LWZJctG1FfU1uwhoQE22ObjdfkSzY63CbU5hzs21WeTddH2BaL11Gi7lVdlxP1nkxqhnKhVY6knS3EPgVGg1JpN5cP/hivujOelhXcPj8HC/LyI6MkteVjlolBdMmF3a3DbsuAYhL44dxzthWSN065xxUd55Lmf0wRbOYOqH09/o9WbO2VtFdaMb4qBgtFJoT1SqoN8wPXMoXLb3p1PUEhxfnnLzGzBI0Ku7FxrKsNJj/8bn/H8fPIVOd3rfrklUB/DOeO+nkghgSPzrlPxluCMtOnDL4Yml6dK1r3vsgMxgtPOrMFUZbEUbTdIzii5beq72G4PD0DKnwjmBULUVFmy8t+k7fZ3pKc0Q4UC6jpVRqS9Umv8bxw35flZVOU1X7qkjnhZlsMbk24qQ6Hz7QcuL6sDC0iHHki96Uh2UdvmgZnjIvExy2TeJdMDZNSbdZyAHe/Yd1xsQhHiKzjh7GxQ4yqMPaywPkjMamvqrYpmO7Knad+ZQC5msCuAPWUoxrxVhrGv7a+KLXFhyONdTMrZ7ke23qiO40ZJUyzgYyX5XyL0mV7NiUzEs9mjtbMN0dERqwyAJpigad0B3/zRV7s4PIfXSu6YV/MK7+OrYe/JvfGMn/PHJe2fyUdtnFrKRNpXV0Y2559aWPt/G4BlvjTMtXlVIWCnNyA3YQBDmYIodFz41PvXPSa6rq9lWZawZ4dP115HXV/M/tnFkkrBOdzg6aP4pID+MZnTJ1SuuB6iZlyiox4HT2y3YBtkUKWooacBQUDTpjwaDt5poBHl1/HXltwP887lKKXxNUEyPqpGTyA699UqY/lt9yGdlUKra0fFWS+36iylVWrAyd7Uw0CZM0z7xKTOduznLIjG2Hx8cDPLb+OvK6Bv7n1DYci4CxUuRxrjBc0bb4vD3rN5Zz36ntLb83eVJIB8LiIzCmn6SMPjlX+yNlTjvIGjs+QzHPf60Aj62/jrzG8j9vYMFtm1VoRWCJdmw7z9N0t+c8cxZpPeK4aTRicS25QhrVtUp7U578chk4q04Wx4YoQSjFryUlpcQ1AbxZ/XVMknIU//OGl7Q6z9Zpxi0+3yFhSkjUDpnCIUhLWVX23KQ+L9vKvFKI0ZWFQgkDLvBoylrHNVmaw10zwCPrr5tlodfnf94EWnQ0lFRWy8pW9LbkLsyUVDc2NSTHGDtnD1uMtchjbCeb1mpxFP0YbcClhzdLu6lfO8Bj6q+bdT2sz/+8SZCV7VIxtt0DUn9L7r4cLYWDSXnseEpOGFuty0qbOVlS7NNzs5FOGJUqQpl2Q64/yBpZf90sxbE+//PGdZ02HSipCbmD6NItmQ4Lk5XUrGpDMkhbMm2ZVheNYV+VbUWTcv99+2NyX1VoafSuC+AN6q9bFIMv5X/eagNWXZxEa9JjlMwNWb00akGUkSoepp1/yRuuqHGbUn3UdBSTxBU6SEVklzWRUkPndVvw2PrrpjvxOvzPmwHc0hpmq82npi7GRro8dXp0KXnUQmhZbRL7NEVp1uuZmO45vuzKsHrktS3GLWXODVjw+vXXLYx4Hf7njRPd0i3aoAGX6W29GnaV5YdyDj9TFkakje7GHYzDoObfddHtOSpoi2SmzJHrB3hM/XUDDEbxP2/oosszcRlehWXUvzHv4TpBVktHqwenFo8uLVmy4DKLa5d3RtLrmrM3aMFr1183E4sewf+85VWeg1c5ag276NZrM9IJVNcmLEvDNaV62aq+14IAOGFsBt973Ra8Xv11YzXwNfmft7Jg2oS+XOyoC8/cwzi66Dhmgk38kUmP1CUiYWOX1bpD2zWXt2FCp7uq8703APAa9dfNdscR/M/bZLIyouVxqJfeWvG9Je+JVckHQ9+CI9NWxz+blX/KYYvO5n2tAP/vrlZ7+8/h9y+9qeB/Hnt967e5mevX10rALDWK//FaAT5MXdBXdP0C/BAes792c40H+AiAp1e1oH8HgH94g/Lttx1gp63op1eyoM/Bvw5/G/7xFbqJPcCXnmBiwDPb/YKO4FX4OjyCb289db2/Noqicw4i7N6TVtoz8tNwDH+8x/i6Ae7lmaQVENzJFb3Di/BFeAwz+Is9SjeQySpPqbLFlNmyz47z5a/AF+AYFvDmHqibSXTEzoT4Gc3OALaqAP4KPFUJ6n+1x+rGAM6Zd78bgJ0a8QN4GU614vxwD9e1Amy6CcskNrczLx1JIp6HE5UZD/DBHrFr2oNlgG4Odv226BodoryjGJ9q2T/AR3vQrsOCS0ctXZi3ruLlhpFDJYl4HmYtjQCP9rhdn4suySLKDt6wLcC52h8xPlcjju1fn+yhuw4LZsAGUuo2b4Fx2UwQu77uqRHXGtg92aN3tQCbFexc0uk93vhTXbct6y7MulLycoUljx8ngDMBg1tvJjAazpEmOtxlzclvj1vQf1Tx7QlPDpGpqgtdSKz/d9/hdy1vTfFHSmC9dGDZbLiezz7Ac801HirGZsWjydfZyPvHXL/Y8Mjzg8BxTZiuwKz4Eb8sBE9zznszmjvFwHKPIWUnwhqfVRcd4Ck0K6ate48m1oOfrX3/yOtvAsJ8zsPAM89sjnddmuLuDPjX9Bu/L7x7xpMzFk6nWtyQfPg278Gn4Aekz2ZgOmU9eJ37R14vwE/BL8G3aibCiWMWWDQ0ZtkPMnlcGeAu/Ag+8ZyecU5BPuy2ILD+sQqyZhAKmn7XZd+jIMTN9eBL7x95xVLSX4On8EcNlXDqmBlqS13jG4LpmGbkF/0CnOi3H8ETOIXzmnmtb0a16Tzxj1sUvQCBiXZGDtmB3KAefPH94xcUa/6vwRn80GOFyjEXFpba4A1e8KQfFF+259tx5XS4egYn8fQsLGrqGrHbztr+uByTahWuL1NUGbDpsnrwBfePPwHHIf9X4RnM4Z2ABWdxUBlqQ2PwhuDxoS0vvqB1JzS0P4h2nA/QgTrsJFn+Y3AOjs9JFC07CGWX1oNX3T/yHOzgDjwPn1PM3g9Jk9lZrMEpxnlPmBbjyo2+KFXRU52TJM/2ALcY57RUzjObbjqxVw++4P6RAOf58pcVsw9Daje3htriYrpDOonre3CudSe6bfkTEgHBHuDiyu5MCsc7BHhYDx7ePxLjqigXZsw+ijMHFhuwBmtoTPtOxOrTvYJDnC75dnUbhfwu/ZW9AgYd+peL68HD+0emKquiXHhWjJg/UrkJYzuiaL3E9aI/ytrCvAd4GcYZMCkSQxfUg3v3j8c4e90j5ZTPdvmJJGHnOCI2nHS8081X013pHuBlV1gB2MX1YNmWLHqqGN/TWmG0y6clJWthxNUl48q38Bi8vtMKyzzpFdSDhxZ5WBA5ZLt8Jv3895DduBlgbPYAj8C4B8hO68FDkoh5lydC4FiWvBOVqjYdqjiLv92t8yPDjrDaiHdUD15qkSURSGmXJwOMSxWAXYwr3zaAufJ66l+94vv3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/wHuD9tQd4f+0B3l97gPfXHuD9tQd4f+0B3l97gG8LwP8G/AL8O/A5OCq0Ys2KIdv/qOIXG/4mvFAMF16gZD+2Xvu/B8as5+8bfllWyg0zaNO5bfXj6vfhhwD86/Aq3NfRS9t9WPnhfnvCIw/CT8GLcFTMnpntdF/z9V+PWc/vWoIH+FL3Znv57PitcdGP4R/C34avw5fgRVUInCwbsn1yyA8C8zm/BH8NXoXnVE6wVPjdeCI38kX/3+Ct9dbz1pTmHFRu+Hm4O9Ch3clr99negxfwj+ER/DR8EV6B5+DuQOnTgUw5rnkY+FbNU3gNXh0o/JYTuWOvyBf9FvzX663HH/HejO8LwAl8Hl5YLTd8q7sqA3wbjuExfAFegQdwfyDoSkWY8swzEf6o4Qyewefg+cHNbqMQruSL/u/WWc+E5g7vnnEXgDmcDeSGb/F4cBcCgT+GGRzDU3hZYburAt9TEtHgbM6JoxJ+6NMzzTcf6c2bycv2+KK/f+l6LBzw5IwfqZJhA3M472pWT/ajKxnjv4AFnMEpnBTPND6s2J7qHbPAqcMK74T2mZ4VGB9uJA465It+/eL1WKhYOD7xHOkr1ajK7d0C4+ke4Hy9qXZwpgLr+Znm/uNFw8xQOSy8H9IzjUrd9+BIfenYaylf9FsXr8fBAadnPIEDna8IBcwlxnuA0/Wv6GAWPd7dDIKjMdSWueAsBj4M7TOd06qBbwDwKr7oleuxMOEcTuEZTHWvDYUO7aHqAe0Bbq+HEFRzOz7WVoTDQkVds7A4sIIxfCQdCefFRoIOF/NFL1mPab/nvOakSL/Q1aFtNpUb/nFOVX6gzyg/1nISyDfUhsokIzaBR9Kxm80s5mK+6P56il1jXic7nhQxsxSm3OwBHl4fFdLqi64nDQZvqE2at7cWAp/IVvrN6/BFL1mPhYrGMBfOi4PyjuSGf6wBBh7p/FZTghCNWGgMzlBbrNJoPJX2mW5mwZfyRffXo7OFi5pZcS4qZUrlViptrXtw+GQoyhDPS+ANjcGBNRiLCQDPZPMHuiZfdFpPSTcQwwKYdRNqpkjm7AFeeT0pJzALgo7g8YYGrMHS0iocy+YTm2vyRUvvpXCIpQ5pe666TJrcygnScUf/p0NDs/iAI/nqDHC8TmQT8x3NF91l76oDdQGwu61Z6E0ABv7uO1dbf/37Zlv+Zw/Pbh8f1s4Avur6657/+YYBvur6657/+YYBvur6657/+YYBvur6657/+aYBvuL6657/+VMA8FXWX/f8zzcN8BXXX/f8zzcNMFdbf93zP38KLPiK6697/uebtuArrr/u+Z9vGmCusP6653/+1FjwVdZf9/zPN7oHX339dc//fNMu+irrr3v+50+Bi+Zq6697/uebA/jz8Pudf9ht/fWv517J/XUzAP8C/BAeX9WCDrUpZ3/dEMBxgPcfbtTVvsYV5Yn32u03B3Ac4P3b8I+vxNBKeeL9dRMAlwO83959qGO78sT769oB7g3w/vGVYFzKE++v6wV4OMD7F7tckFkmT7y/rhHgpQO8b+4Y46XyxPvrugBeNcB7BRiX8sT767oAvmCA9woAHsoT76+rBJjLBnh3txOvkifeX1dswZcO8G6N7sXyxPvr6i340gHe3TnqVfLE++uKAb50gHcXLnrX8sR7gNdPRqwzwLu7Y/FO5Yn3AK9jXCMGeHdgxDuVJ75VAI8ljP7PAb3/RfjcZfePHBB+79dpfpH1CanN30d+mT1h9GqAxxJGM5LQeeQ1+Tb+EQJrElLb38VHQ94TRq900aMIo8cSOo+8Dp8QfsB8zpqE1NO3OI9Zrj1h9EV78PqE0WMJnUdeU6E+Jjyk/hbrEFIfeWbvId8H9oTRFwdZaxJGvziW0Hn0gqYB/wyZ0PwRlxJST+BOw9m77Amj14ii1yGM/txYQudN0qDzGe4EqfA/5GJCagsHcPaEPWH0esekSwmjRxM6b5JEcZ4ww50ilvAOFxBSx4yLW+A/YU8YvfY5+ALC6NGEzhtmyZoFZoarwBLeZxUhtY4rc3bKnjB6TKJjFUHzJoTOozF2YBpsjcyxDgzhQ1YRUse8+J4wenwmaylB82hC5w0zoRXUNXaRBmSMQUqiWSWkLsaVqc/ZE0aPTFUuJWgeTei8SfLZQeMxNaZSIzbII4aE1Nmr13P2hNHjc9E9guYNCZ032YlNwESMLcZiLQHkE4aE1BFg0yAR4z1h9AiAGRA0jyZ03tyIxWMajMPWBIsxYJCnlITU5ShiHYdZ94TR4wCmSxg9jtB5KyPGYzymAYexWEMwAPIsAdYdV6aObmNPGD0aYLoEzaMJnTc0Ygs+YDw0GAtqxBjkuP38bMRWCHn73xNGjz75P73WenCEJnhwyVe3AEe8TtKdJcYhBl97wuhNAObK66lvD/9J9NS75v17wuitAN5fe4D31x7g/bUHeH/tAd5fe4D3AO+vPcD7aw/w/toDvL/2AO+vPcD7aw/w/toDvAd4f/24ABzZ8o+KLsSLS+Pv/TqTb3P4hKlQrTGh+fbIBT0Axqznnb+L/V2mb3HkN5Mb/nEHeK7d4IcDld6lmDW/iH9E+AH1MdOw/Jlu2T1xNmY98sv4wHnD7D3uNHu54WUuOsBTbQuvBsPT/UfzNxGYzwkP8c+Yz3C+r/i6DcyRL/rZ+utRwWH5PmfvcvYEt9jLDS/bg0/B64DWKrQM8AL8FPwS9beQCe6EMKNZYJol37jBMy35otdaz0Bw2H/C2Smc7+WGB0HWDELBmOByA3r5QONo4V+DpzR/hFS4U8wMW1PXNB4TOqYz9urxRV++ntWCw/U59Ty9ebdWbrgfRS9AYKKN63ZokZVygr8GZ/gfIhZXIXPsAlNjPOLBby5c1eOLvmQ9lwkOy5x6QV1j5TYqpS05JtUgUHUp5toHGsVfn4NX4RnMCe+AxTpwmApTYxqMxwfCeJGjpXzRF61nbcHhUBPqWze9svwcHJ+S6NPscKrEjug78Dx8Lj3T8D4YxGIdxmJcwhi34fzZUr7olevZCw5vkOhoClq5zBPZAnygD/Tl9EzDh6kl3VhsHYcDEb+hCtJSvuiV69kLDm+WycrOTArHmB5/VYyP6jOVjwgGawk2zQOaTcc1L+aLXrKeveDwZqlKrw8U9Y1p66uK8dEzdYwBeUQAY7DbyYNezBfdWQ97weEtAKYQg2xJIkuveAT3dYeLGH+ShrWNwZgN0b2YL7qznr3g8JYAo5bQBziPjx7BPZ0d9RCQp4UZbnFdzBddor4XHN4KYMrB2qHFRIzzcLAHQZ5the5ovui94PCWAPefaYnxIdzRwdHCbuR4B+tbiy96Lzi8E4D7z7S0mEPd+eqO3cT53Z0Y8SV80XvB4Z0ADJi/f7X113f+7p7/+UYBvur6657/+YYBvur6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+aYBvuL6657/+VMA8FXWX/f8z58OgK+y/rrnf75RgLna+uue//lTA/CV1V/3/M837aKvvv6653++UQvmauuve/7nTwfAV1N/3fM/fzr24Cuuv+75nz8FFnxl9dc9//MOr/8/glixwRuUfM4AAAAASUVORK5CYII=",f.tArea,o),Object(b.d)("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEIAAAAhCAAAAABIXyLAAAAAOElEQVRIx2NgGAWjYBSMglEwEICREYRgFBZBqDCSLA2MGPUIVQETE9iNUAqLR5gIeoQKRgwXjwAAGn4AtaFeYLEAAAAASUVORK5CYII=",f.tSearch,d);var p=Object(n.__assign)({},C),m=Object(u.a)(e,"triangles",j,p,f);return Object(c.a)(m,f)}(e,this.edgesTarget.texture),this.blendRenderable=function(e,t,r){var a=t.getWidth(),o=t.getHeight(),d=Object(n.__assign)(Object(n.__assign)({},i.c),{tColor:s.e.create(t),tWeights:s.e.create(r),uTexSizeInv:s.e.create(l.Vec2.create(1/a,1/o)),uViewport:s.e.create(Object(l.Vec4)())}),f=Object(n.__assign)({},P),p=Object(u.a)(e,"triangles",E,f,d);return Object(c.a)(p,d)}(e,t,this.weightsTarget.texture),this._supported=!0}else _.a&&console.log('Missing "HTMLImageElement" required for "SMAA"')}return Object.defineProperty(e.prototype,"supported",{get:function(){return this._supported},enumerable:!1,configurable:!0}),e.prototype.updateState=function(e){var t=this.webgl,r=t.gl,n=t.state;n.enable(r.SCISSOR_TEST),n.disable(r.BLEND),n.disable(r.DEPTH_TEST),n.depthMask(!1);var i=e.x,a=e.y,o=e.width,u=e.height;r.viewport(i,a,o,u),r.scissor(i,a,o,u),n.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT),s.e.update(this.edgesRenderable.values.uViewport,y.a.toVec4(this.edgesRenderable.values.uViewport.ref.value,e)),s.e.update(this.weightsRenderable.values.uViewport,y.a.toVec4(this.weightsRenderable.values.uViewport.ref.value,e)),s.e.update(this.blendRenderable.values.uViewport,y.a.toVec4(this.blendRenderable.values.uViewport.ref.value,e))},e.prototype.setSize=function(e,t){var r=this.edgesTarget.getWidth(),n=this.edgesTarget.getHeight();e===r&&t===n||(this.edgesTarget.setSize(e,t),this.weightsTarget.setSize(e,t),s.e.update(this.edgesRenderable.values.uTexSizeInv,l.Vec2.set(this.edgesRenderable.values.uTexSizeInv.ref.value,1/e,1/t)),s.e.update(this.weightsRenderable.values.uTexSizeInv,l.Vec2.set(this.weightsRenderable.values.uTexSizeInv.ref.value,1/e,1/t)),s.e.update(this.blendRenderable.values.uTexSizeInv,l.Vec2.set(this.blendRenderable.values.uTexSizeInv.ref.value,1/e,1/t)))},e.prototype.update=function(e,t){var r=!1;this.edgesRenderable.values.tColor.ref.value!==e&&(s.e.update(this.edgesRenderable.values.tColor,e),r=!0),this.edgesRenderable.values.dEdgeThreshold.ref.value!==t.edgeThreshold&&(s.e.update(this.edgesRenderable.values.dEdgeThreshold,t.edgeThreshold),r=!0),r&&this.edgesRenderable.update(),this.weightsRenderable.values.dMaxSearchSteps.ref.value!==t.maxSearchSteps&&(s.e.update(this.weightsRenderable.values.dMaxSearchSteps,t.maxSearchSteps),this.weightsRenderable.update()),this.blendRenderable.values.tColor.ref.value!==e&&(s.e.update(this.blendRenderable.values.tColor,e),this.blendRenderable.update())},e.prototype.render=function(e,t){this.edgesTarget.bind(),this.updateState(e),this.edgesRenderable.render(),this.weightsTarget.bind(),this.updateState(e),this.weightsRenderable.render(),t?t.bind():this.webgl.unbindFramebuffer(),this.updateState(e),this.blendRenderable.render()},e}(),O=Object(n.__assign)(Object(n.__assign)({},i.b),{tColor:Object(a.i)("texture","rgba","ubyte","linear"),uTexSizeInv:Object(a.j)("v2"),uViewport:Object(a.j)("v4"),dEdgeThreshold:Object(a.c)("number")}),w=Object(o.g)("smaa-edges","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvoid SMAAEdgeDetectionVS(vec2 texCoord) {\n    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n    vOffset[2] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-2.0, 0.0, 0.0, 2.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n    vec2 scale = uViewport.zw * uTexSizeInv;\n    vec2 shift = uViewport.xy * uTexSizeInv;\n    vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n    SMAAEdgeDetectionVS(vUv);\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\n\nvec4 SMAAColorEdgeDetectionPS(vec2 texcoord, vec4 offset[3], sampler2D colorTex) {\n    vec2 threshold = vec2(dEdgeThreshold, dEdgeThreshold);\n\n    // Calculate color deltas:\n    vec4 delta;\n    vec3 C = texture2D(colorTex, texcoord).rgb;\n\n    vec3 Cleft = texture2D(colorTex, offset[0].xy).rgb;\n    vec3 t = abs(C - Cleft);\n    delta.x = max(max(t.r, t.g), t.b);\n\n    vec3 Ctop = texture2D(colorTex, offset[0].zw).rgb;\n    t = abs(C - Ctop);\n    delta.y = max(max(t.r, t.g), t.b);\n\n    // We do the usual threshold:\n    vec2 edges = step(threshold, delta.xy);\n\n    // Then discard if there is no edge:\n    if (dot(edges, vec2(1.0, 1.0 )) == 0.0)\n        discard;\n\n    // Calculate right and bottom deltas:\n    vec3 Cright = texture2D(colorTex, offset[1].xy).rgb;\n    t = abs( C - Cright );\n    delta.z = max(max(t.r, t.g), t.b);\n\n    vec3 Cbottom  = texture2D(colorTex, offset[1].zw).rgb;\n    t = abs(C - Cbottom);\n    delta.w = max(max(t.r, t.g), t.b);\n\n    // Calculate the maximum delta in the direct neighborhood:\n    float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w );\n\n    // Calculate left-left and top-top deltas:\n    vec3 Cleftleft  = texture2D(colorTex, offset[2].xy).rgb;\n    t = abs( C - Cleftleft );\n    delta.z = max(max(t.r, t.g), t.b);\n\n    vec3 Ctoptop = texture2D(colorTex, offset[2].zw).rgb;\n    t = abs(C - Ctoptop);\n    delta.w = max(max(t.r, t.g), t.b);\n\n    // Calculate the final maximum delta:\n    maxDelta = max(max(maxDelta, delta.z), delta.w);\n\n    // Local contrast adaptation in action:\n    edges.xy *= step(0.5 * maxDelta, delta.xy);\n\n    return vec4(edges, 0.0, 0.0);\n}\n\nvoid main() {\n    gl_FragColor = SMAAColorEdgeDetectionPS(vUv, vOffset, tColor);\n}\n");var C=Object(n.__assign)(Object(n.__assign)({},i.b),{tEdges:Object(a.i)("texture","rgba","ubyte","linear"),tArea:Object(a.i)("texture","rgb","ubyte","linear"),tSearch:Object(a.i)("texture","rgba","ubyte","nearest"),uTexSizeInv:Object(a.j)("v2"),uViewport:Object(a.j)("v4"),dMaxSearchSteps:Object(a.c)("number")}),j=Object(o.g)("smaa-weights","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\nvoid SMAABlendingWeightCalculationVS(vec2 texCoord) {\n    vPixCoord = texCoord / uTexSizeInv;\n\n    // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):\n    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.25, 0.125, 1.25, 0.125); // WebGL port note: Changed sign in Y and W components\n    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-0.125, 0.25, -0.125, -1.25); // WebGL port note: Changed sign in Y and W components\n\n    // And these for the searches, they indicate the ends of the loops:\n    vOffset[2] = vec4(vOffset[0].xz, vOffset[1].yw) + vec4(-2.0, 2.0, -2.0, 2.0) * uTexSizeInv.xxyy * float(dMaxSearchSteps);\n}\n\nvoid main() {\n    vec2 scale = uViewport.zw * uTexSizeInv;\n    vec2 shift = uViewport.xy * uTexSizeInv;\n    vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n    SMAABlendingWeightCalculationVS(vUv);\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#define SMAASampleLevelZeroOffset(tex, coord, offset) texture2D(tex, coord + float(offset) * uTexSizeInv, 0.0)\n\n#define SMAA_AREATEX_MAX_DISTANCE 16\n#define SMAA_AREATEX_PIXEL_SIZE (1.0 / vec2(160.0, 560.0))\n#define SMAA_AREATEX_SUBTEX_SIZE (1.0 / 7.0)\n\nuniform sampler2D tEdges;\nuniform sampler2D tArea;\nuniform sampler2D tSearch;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[3];\nvarying vec2 vPixCoord;\n\n#if __VERSION__ == 100\n    vec2 round(vec2 x) {\n        return sign(x) * floor(abs(x) + 0.5);\n    }\n#endif\n\nfloat SMAASearchLength(sampler2D searchTex, vec2 e, float bias, float scale) {\n    // Not required if searchTex accesses are set to point:\n    // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);\n    // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +\n    //     e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;\n    e.r = bias + e.r * scale;\n    return 255.0 * texture2D(searchTex, e, 0.0).r;\n}\n\nfloat SMAASearchXLeft(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    /**\n     * @PSEUDO_GATHER4\n     * This texCoord has been offset by (-0.25, -0.125) in the vertex shader to\n     * sample between edge, thus fetching four edges in a row.\n     * Sampling with different offsets in each direction allows to disambiguate\n     * which edges are active from the four fetched ones.\n     */\n    vec2 e = vec2(0.0, 1.0);\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D( edgesTex, texCoord, 0.0).rg;\n        texCoord -= vec2(2.0, 0.0) * uTexSizeInv;\n        if (!(texCoord.x > end && e.g > 0.8281 && e.r == 0.0)) break;\n    }\n\n    // We correct the previous (-0.25, -0.125) offset we applied:\n    texCoord.x += 0.25 * uTexSizeInv.x;\n\n    // The searches are bias by 1, so adjust the coords accordingly:\n    texCoord.x += uTexSizeInv.x;\n\n    // Disambiguate the length added by the last step:\n    texCoord.x += 2.0 * uTexSizeInv.x; // Undo last step\n    texCoord.x -= uTexSizeInv.x * SMAASearchLength(searchTex, e, 0.0, 0.5);\n\n    return texCoord.x;\n}\n\nfloat SMAASearchXRight(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    vec2 e = vec2( 0.0, 1.0 );\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D(edgesTex, texCoord, 0.0).rg;\n        texCoord += vec2(2.0, 0.0) * uTexSizeInv;\n        if (!(texCoord.x < end && e.g > 0.8281 && e.r == 0.0)) break;\n    }\n\n    texCoord.x -= 0.25 * uTexSizeInv.x;\n    texCoord.x -= uTexSizeInv.x;\n    texCoord.x -= 2.0 * uTexSizeInv.x;\n    texCoord.x += uTexSizeInv.x * SMAASearchLength( searchTex, e, 0.5, 0.5 );\n\n    return texCoord.x;\n}\n\nfloat SMAASearchYUp(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    vec2 e = vec2( 1.0, 0.0 );\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D(edgesTex, texCoord, 0.0).rg;\n        texCoord += vec2(0.0, 2.0) * uTexSizeInv; // WebGL port note: Changed sign\n        if (!(texCoord.y > end && e.r > 0.8281 && e.g == 0.0)) break;\n    }\n\n    texCoord.y -= 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y -= uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y -= 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y += uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5); // WebGL port note: Changed sign\n\n    return texCoord.y;\n}\n\nfloat SMAASearchYDown(sampler2D edgesTex, sampler2D searchTex, vec2 texCoord, float end) {\n    vec2 e = vec2( 1.0, 0.0 );\n\n    for (int i = 0; i < dMaxSearchSteps; i++) { // WebGL port note: Changed while to for\n        e = texture2D(edgesTex, texCoord, 0.0).rg;\n        texCoord -= vec2( 0.0, 2.0 ) * uTexSizeInv; // WebGL port note: Changed sign\n        if (!(texCoord.y < end && e.r > 0.8281 && e.g == 0.0)) break;\n    }\n\n    texCoord.y += 0.25 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y += uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y += 2.0 * uTexSizeInv.y; // WebGL port note: Changed sign\n    texCoord.y -= uTexSizeInv.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5); // WebGL port note: Changed sign\n\n    return texCoord.y;\n}\n\nvec2 SMAAArea(sampler2D areaTex, vec2 dist, float e1, float e2, float offset) {\n    // Rounding prevents precision errors of bilinear filtering:\n    vec2 texCoord = float(SMAA_AREATEX_MAX_DISTANCE) * round(4.0 * vec2(e1, e2)) + dist;\n\n    // We do a scale and bias for mapping to texel space:\n    texCoord = SMAA_AREATEX_PIXEL_SIZE * texCoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);\n\n    // Move to proper place, according to the subpixel offset:\n    texCoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;\n\n    return texture2D(areaTex, texCoord, 0.0).rg;\n}\n\nvec4 SMAABlendingWeightCalculationPS(vec2 texCoord, vec2 pixCoord, vec4 offset[3], sampler2D edgesTex, sampler2D areaTex, sampler2D searchTex, ivec4 subsampleIndices) {\n    vec4 weights = vec4(0.0, 0.0, 0.0, 0.0);\n\n    vec2 e = texture2D(edgesTex, texCoord).rg;\n\n    if (e.g > 0.0) { // Edge at north\n        vec2 d;\n\n        // Find the distance to the left:\n        vec2 coords;\n        coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x );\n        coords.y = offset[1].y; // offset[1].y = texCoord.y - 0.25 * uTexSizeInv.y (@CROSSING_OFFSET)\n        d.x = coords.x;\n\n        // Now fetch the left crossing edges, two at a time using bilinear\n        // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to\n        // discern what value each edge has:\n        float e1 = texture2D(edgesTex, coords, 0.0).r;\n\n        // Find the distance to the right:\n        coords.x = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);\n        d.y = coords.x;\n\n        // We want the distances to be in pixel units (doing this here allow to\n        // better interleave arithmetic and memory accesses):\n        d = d / uTexSizeInv.x - pixCoord.x;\n\n        // SMAAArea below needs a sqrt, as the areas texture is compressed\n        // quadratically:\n        vec2 sqrt_d = sqrt(abs(d));\n\n        // Fetch the right crossing edges:\n        coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n        float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(1, 0)).r;\n\n        // Ok, we know how this pattern looks like, now it is time for getting\n        // the actual area:\n        weights.rg = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.y));\n    }\n\n    if (e.r > 0.0) { // Edge at west\n        vec2 d;\n\n        // Find the distance to the top:\n        vec2 coords;\n\n        coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z );\n        coords.x = offset[0].x; // offset[1].x = texCoord.x - 0.25 * uTexSizeInv.x;\n        d.x = coords.y;\n\n        // Fetch the top crossing edges:\n        float e1 = texture2D(edgesTex, coords, 0.0).g;\n\n        // Find the distance to the bottom:\n        coords.y = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);\n        d.y = coords.y;\n\n        // We want the distances to be in pixel units:\n        d = d / uTexSizeInv.y - pixCoord.y;\n\n        // SMAAArea below needs a sqrt, as the areas texture is compressed\n        // quadratically:\n        vec2 sqrt_d = sqrt(abs(d));\n\n        // Fetch the bottom crossing edges:\n        coords.y -= 1.0 * uTexSizeInv.y; // WebGL port note: Added\n        float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, ivec2(0, 1)).g;\n\n        // Get the area for this direction:\n        weights.ba = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.x));\n    }\n\n    return weights;\n}\n\nvoid main() {\n    gl_FragColor = SMAABlendingWeightCalculationPS(vUv, vPixCoord, vOffset, tEdges, tArea, tSearch, ivec4(0.0));\n}\n");var P=Object(n.__assign)(Object(n.__assign)({},i.b),{tColor:Object(a.i)("texture","rgba","ubyte","linear"),tWeights:Object(a.i)("texture","rgba","ubyte","linear"),uTexSizeInv:Object(a.j)("v2"),uViewport:Object(a.j)("v4")}),E=Object(o.g)("smaa-blend","\nprecision highp float;\n\nattribute vec2 aPosition;\nuniform vec2 uQuadScale;\n\nuniform vec2 uTexSizeInv;\nuniform vec4 uViewport;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvoid SMAANeighborhoodBlendingVS(vec2 texCoord) {\n    vOffset[0] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(-1.0, 0.0, 0.0, 1.0); // WebGL port note: Changed sign in W component\n    vOffset[1] = texCoord.xyxy + uTexSizeInv.xyxy * vec4(1.0, 0.0, 0.0, -1.0); // WebGL port note: Changed sign in W component\n}\n\nvoid main() {\n    vec2 scale = uViewport.zw * uTexSizeInv;\n    vec2 shift = uViewport.xy * uTexSizeInv;\n    vUv = (aPosition + 1.0) * 0.5 * scale + shift;\n    SMAANeighborhoodBlendingVS(vUv);\n    vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;\n    gl_Position = vec4(position, 0.0, 1.0);\n}\n","\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tWeights;\nuniform sampler2D tColor;\nuniform vec2 uTexSizeInv;\n\nvarying vec2 vUv;\nvarying vec4 vOffset[2];\n\nvec4 SMAANeighborhoodBlendingPS(vec2 texCoord, vec4 offset[2], sampler2D colorTex, sampler2D blendTex) {\n    // Fetch the blending weights for current pixel:\n    vec4 a;\n    a.xz = texture2D(blendTex, texCoord).xz;\n    a.y = texture2D(blendTex, offset[1].zw).g;\n    a.w = texture2D(blendTex, offset[1].xy).a;\n\n    // Is there any blending weight with a value greater than 0.0?\n    if (dot(a, vec4(1.0, 1.0, 1.0, 1.0)) < 1e-5) {\n        return texture2D(colorTex, texCoord, 0.0);\n    } else {\n        // Up to 4 lines can be crossing a pixel (one through each edge). We\n        // favor blending by choosing the line with the maximum weight for each\n        // direction:\n        vec2 offset;\n        offset.x = a.a > a.b ? a.a : -a.b; // left vs. right\n        offset.y = a.g > a.r ? -a.g : a.r; // top vs. bottom // WebGL port note: Changed signs\n\n        // Then we go in the direction that has the maximum weight:\n        if (abs(offset.x) > abs(offset.y)) { // horizontal vs. vertical\n            offset.y = 0.0;\n        } else {\n            offset.x = 0.0;\n        }\n\n        // Fetch the opposite color and lerp by hand:\n        vec4 C = texture2D(colorTex, texCoord, 0.0);\n        texCoord += sign(offset) * uTexSizeInv;\n        vec4 Cop = texture2D(colorTex, texCoord, 0.0);\n        float s = abs(offset.x) > abs(offset.y) ? abs(offset.x) : abs(offset.y);\n\n        // WebGL port note: Added gamma correction\n        C.xyz = pow(C.xyz, vec3(2.2));\n        Cop.xyz = pow(Cop.xyz, vec3(2.2));\n        vec4 mixed = mix(C, Cop, s);\n        mixed.xyz = pow(mixed.xyz, vec3(1.0 / 2.2));\n\n        return mixed;\n    }\n}\n\nvoid main() {\n    gl_FragColor = SMAANeighborhoodBlendingPS(vUv, vOffset, tColor, tWeights);\n}\n");var A=Object(n.__assign)(Object(n.__assign)({},i.b),{tDepth:Object(a.i)("texture","rgba","ubyte","nearest"),uTexSize:Object(a.j)("v2"),dOrthographic:Object(a.c)("number"),uNear:Object(a.j)("f"),uFar:Object(a.j)("f"),uMaxPossibleViewZDiff:Object(a.j)("f")});var D=Object(n.__assign)(Object(n.__assign)({},i.b),{tDepth:Object(a.i)("texture","rgba","ubyte","nearest"),uSamples:Object(a.j)("v3[]"),dNSamples:Object(a.c)("number"),uProjection:Object(a.j)("m4"),uInvProjection:Object(a.j)("m4"),uTexSize:Object(a.j)("v2"),uRadius:Object(a.j)("f"),uBias:Object(a.j)("f")});var T=Object(n.__assign)(Object(n.__assign)({},i.b),{tSsaoDepth:Object(a.i)("texture","rgba","ubyte","nearest"),uTexSize:Object(a.j)("v2"),uKernel:Object(a.j)("f[]"),dOcclusionKernelSize:Object(a.c)("number"),uBlurDirectionX:Object(a.j)("f"),uBlurDirectionY:Object(a.j)("f"),uMaxPossibleViewZDiff:Object(a.j)("f"),uNear:Object(a.j)("f"),uFar:Object(a.j)("f"),dOrthographic:Object(a.c)("number")});function I(e,t,r){var a=Object(n.__assign)(Object(n.__assign)({},i.c),{tSsaoDepth:s.e.create(t),uTexSize:s.e.create(l.Vec2.create(t.getWidth(),t.getHeight())),uKernel:s.e.create([0]),dOcclusionKernelSize:s.e.create(1),uBlurDirectionX:s.e.create("horizontal"===r?1:0),uBlurDirectionY:s.e.create("vertical"===r?1:0),uMaxPossibleViewZDiff:s.e.create(.5),uNear:s.e.create(0),uFar:s.e.create(1e4),dOrthographic:s.e.create(0)}),d=Object(n.__assign)({},T),p=Object(o.g)("ssao_blur",f.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform vec2 uTexSize;\n\nuniform float uKernel[dOcclusionKernelSize];\n\nuniform float uBlurDirectionX;\nuniform float uBlurDirectionY;\n\nuniform float uMaxPossibleViewZDiff;\n\nuniform float uNear;\nuniform float uFar;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n    #if dOrthographic == 1\n        return orthographicDepthToViewZ(depth, uNear, uFar);\n    #else\n        return perspectiveDepthToViewZ(depth, uNear, uFar);\n    #endif\n}\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nvoid main(void) {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n\n    vec2 packedDepth = texture2D(tSsaoDepth, coords).zw;\n\n    float selfDepth = unpackRGToUnitInterval(packedDepth);\n    // if background and if second pass\n    if (isBackground(selfDepth) && uBlurDirectionY != 0.0) {\n       gl_FragColor = vec4(packUnitIntervalToRG(1.0), packedDepth);\n       return;\n    }\n\n    float selfViewZ = getViewZ(selfDepth);\n\n    vec2 offset = vec2(uBlurDirectionX, uBlurDirectionY) / uTexSize;\n\n    float sum = 0.0;\n    float kernelSum = 0.0;\n    // only if kernelSize is odd\n    for (int i = -dOcclusionKernelSize / 2; i <= dOcclusionKernelSize / 2; i++) {\n        vec2 sampleCoords = coords + float(i) * offset;\n\n        vec4 sampleSsaoDepth = texture2D(tSsaoDepth, sampleCoords);\n\n        float sampleDepth = unpackRGToUnitInterval(sampleSsaoDepth.zw);\n        if (isBackground(sampleDepth)) {\n            continue;\n        }\n\n        if (abs(float(i)) > 1.0) { // abs is not defined for int in webgl1\n            float sampleViewZ = getViewZ(sampleDepth);\n            if (abs(selfViewZ - sampleViewZ) > uMaxPossibleViewZDiff) {\n                continue;\n            }\n        }\n\n        float kernel = uKernel[int(abs(float(i)))]; // abs is not defined for int in webgl1\n        float sampleValue = unpackRGToUnitInterval(sampleSsaoDepth.xy);\n\n        sum += kernel * sampleValue;\n        kernelSum += kernel;\n    }\n\n    gl_FragColor = vec4(packUnitIntervalToRG(sum / kernelSum), packedDepth);\n}\n"),m=Object(u.a)(e,"triangles",p,d,a);return Object(c.a)(m,a)}var M=Object(n.__assign)(Object(n.__assign)({},i.b),{tSsaoDepth:Object(a.i)("texture","rgba","ubyte","nearest"),tColor:Object(a.i)("texture","rgba","ubyte","nearest"),tDepth:Object(a.i)("texture","rgba","ubyte","nearest"),tOutlines:Object(a.i)("texture","rgba","ubyte","nearest"),uTexSize:Object(a.j)("v2"),dOrthographic:Object(a.c)("number"),uNear:Object(a.j)("f"),uFar:Object(a.j)("f"),uFogNear:Object(a.j)("f"),uFogFar:Object(a.j)("f"),uFogColor:Object(a.j)("v3"),uTransparentBackground:Object(a.j)("b"),uMaxPossibleViewZDiff:Object(a.j)("f"),dOcclusionEnable:Object(a.c)("boolean"),dOutlineEnable:Object(a.c)("boolean"),dOutlineScale:Object(a.c)("number"),uOutlineThreshold:Object(a.j)("f")});var k={occlusion:d.ParamDefinition.MappedStatic("on",{on:d.ParamDefinition.Group({samples:d.ParamDefinition.Numeric(32,{min:1,max:256,step:1}),radius:d.ParamDefinition.Numeric(5,{min:0,max:10,step:.1},{description:"Final radius is 2^x."}),bias:d.ParamDefinition.Numeric(.8,{min:0,max:3,step:.1}),blurKernelSize:d.ParamDefinition.Numeric(15,{min:1,max:25,step:2})}),off:d.ParamDefinition.Group({})},{cycle:!0,description:"Darken occluded crevices with the ambient occlusion effect"}),outline:d.ParamDefinition.MappedStatic("off",{on:d.ParamDefinition.Group({scale:d.ParamDefinition.Numeric(1,{min:1,max:5,step:1}),threshold:d.ParamDefinition.Numeric(.33,{min:.01,max:1,step:.01})}),off:d.ParamDefinition.Group({})},{cycle:!0,description:"Draw outline around 3D objects"}),antialiasing:d.ParamDefinition.MappedStatic("smaa",{fxaa:d.ParamDefinition.Group(m),smaa:d.ParamDefinition.Group(S),off:d.ParamDefinition.Group({})},{options:[["fxaa","FXAA"],["smaa","SMAA"],["off","Off"]],description:"Smooth pixel edges"})},B=function(){function e(e,t){this.webgl=e,this.scale=1/this.webgl.pixelRatio;var r=t.colorTarget,a=t.depthTexture,d=r.getWidth(),p=r.getHeight();this.nSamples=1,this.blurKernelSize=1,this.target=e.createRenderTarget(d,p,!1,"uint8","linear"),this.outlinesTarget=e.createRenderTarget(d,p,!1),this.outlinesRenderable=function(e,t){var r=Object(n.__assign)(Object(n.__assign)({},i.c),{tDepth:s.e.create(t),uTexSize:s.e.create(l.Vec2.create(t.getWidth(),t.getHeight())),dOrthographic:s.e.create(0),uNear:s.e.create(1),uFar:s.e.create(1e4),uMaxPossibleViewZDiff:s.e.create(.5)}),a=Object(n.__assign)({},A),d=Object(o.g)("outlines",f.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tDepth;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\n\nuniform float uMaxPossibleViewZDiff;\n\n#include common\n\nfloat getViewZ(const in float depth) {\n    #if dOrthographic == 1\n        return orthographicDepthToViewZ(depth, uNear, uFar);\n    #else\n        return perspectiveDepthToViewZ(depth, uNear, uFar);\n    #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n    return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nvoid main(void) {\n    float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;\n\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    vec2 invTexSize = 1.0 / uTexSize;\n\n    float selfDepth = getDepth(coords);\n    float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(getDepth(coords));\n\n    float outline = 1.0;\n    float bestDepth = 1.0;\n\n    for (int y = -1; y <= 1; y++) {\n        for (int x = -1; x <= 1; x++) {\n            vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n            float sampleDepth = getDepth(sampleCoords);\n            float sampleViewZ = isBackground(sampleDepth) ? backgroundViewZ : getViewZ(sampleDepth);\n\n            if (abs(selfViewZ - sampleViewZ) > uMaxPossibleViewZDiff && selfDepth > sampleDepth && sampleDepth <= bestDepth) {\n                outline = 0.0;\n                bestDepth = sampleDepth;\n            }\n        }\n    }\n\n    gl_FragColor = vec4(outline, packUnitIntervalToRG(bestDepth), 0.0);\n}\n"),p=Object(u.a)(e,"triangles",d,a,r);return Object(c.a)(p,r)}(e,a),this.randomHemisphereVector=[];for(var m=0;m<256;m++){var h=Object(l.Vec3)();h[0]=2*Math.random()-1,h[1]=2*Math.random()-1,h[2]=Math.random(),l.Vec3.normalize(h,h),l.Vec3.scale(h,h,Math.random()),this.randomHemisphereVector.push(h)}this.ssaoFramebuffer=e.resources.framebuffer(),this.ssaoBlurFirstPassFramebuffer=e.resources.framebuffer(),this.ssaoBlurSecondPassFramebuffer=e.resources.framebuffer();var g=Math.floor(d*this.scale),v=Math.floor(p*this.scale);this.ssaoDepthTexture=e.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthTexture.define(g,v),this.ssaoDepthTexture.attachFramebuffer(this.ssaoFramebuffer,"color0"),this.ssaoDepthBlurProxyTexture=e.resources.texture("image-uint8","rgba","ubyte","linear"),this.ssaoDepthBlurProxyTexture.define(g,v),this.ssaoDepthBlurProxyTexture.attachFramebuffer(this.ssaoBlurFirstPassFramebuffer,"color0"),this.ssaoDepthTexture.attachFramebuffer(this.ssaoBlurSecondPassFramebuffer,"color0"),this.ssaoRenderable=function(e,t){var r=Object(n.__assign)(Object(n.__assign)({},i.c),{tDepth:s.e.create(t),uSamples:s.e.create([0,0,1]),dNSamples:s.e.create(1),uProjection:s.e.create(l.Mat4.identity()),uInvProjection:s.e.create(l.Mat4.identity()),uTexSize:s.e.create(l.Vec2.create(e.gl.drawingBufferWidth,e.gl.drawingBufferHeight)),uRadius:s.e.create(8),uBias:s.e.create(.025)}),a=Object(n.__assign)({},D),d=Object(o.g)("ssao",f.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#include common\n\nuniform sampler2D tDepth;\n\nuniform vec3 uSamples[dNSamples];\n\nuniform mat4 uProjection;\nuniform mat4 uInvProjection;\n\nuniform vec2 uTexSize;\n\nuniform float uRadius;\nuniform float uBias;\n\nfloat smootherstep(float edge0, float edge1, float x) {\n    x = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n    return x * x * x * (x * (x * 6.0 - 15.0) + 10.0);\n}\n\nfloat noise(const in vec2 coords) {\n    float a = 12.9898;\n    float b = 78.233;\n    float c = 43758.5453;\n    float dt = dot(coords, vec2(a,b));\n    float sn = mod(dt, PI);\n    return abs(fract(sin(sn) * c)); // is abs necessary?\n}\n\nvec2 getNoiseVec2(const in vec2 coords) {\n    return vec2(noise(coords), noise(coords + vec2(PI, 2.71828)));\n}\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nfloat getDepth(const in vec2 coords) {\n    return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nvec3 normalFromDepth(const in float depth, const in float depth1, const in float depth2, vec2 offset1, vec2 offset2) {\n    vec3 p1 = vec3(offset1, depth1 - depth);\n    vec3 p2 = vec3(offset2, depth2 - depth);\n\n    vec3 normal = cross(p1, p2);\n    normal.z = -normal.z;\n\n    return normalize(normal);\n}\n\n// StarCraft II Ambient Occlusion by [Filion and McNaughton 2008]\nvoid main(void) {\n    vec2 invTexSize = 1.0 / uTexSize;\n    vec2 selfCoords = gl_FragCoord.xy * invTexSize;\n\n    float selfDepth = getDepth(selfCoords);\n    vec2 selfPackedDepth = packUnitIntervalToRG(selfDepth);\n\n    if (isBackground(selfDepth)) {\n        gl_FragColor = vec4(packUnitIntervalToRG(0.0), selfPackedDepth);\n        return;\n    }\n\n    vec2 offset1 = vec2(0.0, invTexSize.y);\n    vec2 offset2 = vec2(invTexSize.x, 0.0);\n\n    float selfDepth1 = getDepth(selfCoords + offset1);\n    float selfDepth2 = getDepth(selfCoords + offset2);\n\n    vec3 selfViewNormal = normalFromDepth(selfDepth, selfDepth1, selfDepth2, offset1, offset2);\n    vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);\n\n    vec3 randomVec = normalize(vec3(getNoiseVec2(selfCoords) * 2.0 - 1.0, 0.0));\n\n    vec3 tangent = normalize(randomVec - selfViewNormal * dot(randomVec, selfViewNormal));\n    vec3 bitangent = cross(selfViewNormal, tangent);\n    mat3 TBN = mat3(tangent, bitangent, selfViewNormal);\n\n    float occlusion = 0.0;\n    for(int i = 0; i < dNSamples; i++){\n        vec3 sampleViewPos = TBN * uSamples[i];\n        sampleViewPos = selfViewPos + sampleViewPos * uRadius;\n\n        vec4 offset = vec4(sampleViewPos, 1.0);\n        offset = uProjection * offset;\n        offset.xyz = (offset.xyz / offset.w) * 0.5 + 0.5;\n\n        float sampleViewZ = screenSpaceToViewSpace(vec3(offset.xy, getDepth(offset.xy)), uInvProjection).z;\n\n        occlusion += step(sampleViewPos.z + 0.025, sampleViewZ) * smootherstep(0.0, 1.0, uRadius / abs(selfViewPos.z - sampleViewZ));\n    }\n    occlusion = 1.0 - (uBias * occlusion / float(dNSamples));\n\n    vec2 packedOcclusion = packUnitIntervalToRG(occlusion);\n\n    gl_FragColor = vec4(packedOcclusion, selfPackedDepth);\n}\n"),p=Object(u.a)(e,"triangles",d,a,r);return Object(c.a)(p,r)}(e,a),this.ssaoBlurFirstPassRenderable=I(e,this.ssaoDepthTexture,"horizontal"),this.ssaoBlurSecondPassRenderable=I(e,this.ssaoDepthBlurProxyTexture,"vertical"),this.renderable=function(e,t,r,a,d){var p=Object(n.__assign)(Object(n.__assign)({},i.c),{tSsaoDepth:s.e.create(d),tColor:s.e.create(t),tDepth:s.e.create(r),tOutlines:s.e.create(a),uTexSize:s.e.create(l.Vec2.create(t.getWidth(),t.getHeight())),dOrthographic:s.e.create(0),uNear:s.e.create(1),uFar:s.e.create(1e4),uFogNear:s.e.create(1e4),uFogFar:s.e.create(1e4),uFogColor:s.e.create(l.Vec3.create(1,1,1)),uTransparentBackground:s.e.create(!1),uMaxPossibleViewZDiff:s.e.create(.5),dOcclusionEnable:s.e.create(!1),dOutlineEnable:s.e.create(!1),dOutlineScale:s.e.create(1),uOutlineThreshold:s.e.create(.33)}),m=Object(n.__assign)({},M),h=Object(o.g)("postprocessing",f.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform bool uTransparentBackground;\n\nuniform float uOcclusionBias;\nuniform float uOcclusionRadius;\n\nuniform float uOutlineScale;\nuniform float uOutlineThreshold;\n\nuniform float uMaxPossibleViewZDiff;\n\nconst vec3 occlusionColor = vec3(0.0);\n\n#include common\n\nfloat getViewZ(const in float depth) {\n    #if dOrthographic == 1\n        return orthographicDepthToViewZ(depth, uNear, uFar);\n    #else\n        return perspectiveDepthToViewZ(depth, uNear, uFar);\n    #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n    return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nbool isBackground(const in float depth) {\n    return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, out float closestTexel) {\n    float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;\n    vec2 invTexSize = 1.0 / uTexSize;\n\n    float selfDepth = getDepth(coords);\n    float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);\n\n    float outline = 1.0;\n    closestTexel = 1.0;\n    for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n        for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n            if (x * x + y * y > dOutlineScale * dOutlineScale) {\n                continue;\n            }\n\n            vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n            vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);\n            float sampleOutline = sampleOutlineCombined.r;\n            float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n\n            if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineDepth) > uMaxPossibleViewZDiff) {\n                outline = 0.0;\n                closestTexel = sampleOutlineDepth;\n            }\n        }\n    }\n    return outline;\n}\n\nfloat getSsao(vec2 coords) {\n    float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n    if (rawSsao > 0.999) {\n        return 1.0;\n    } else if (rawSsao > 0.001) {\n        return rawSsao;\n    }\n    return 0.0;\n}\n\nvoid main(void) {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    vec4 color = texture2D(tColor, coords);\n\n    float viewDist;\n    float fogFactor;\n\n    #ifdef dOcclusionEnable\n        float depth = getDepth(coords);\n        if (!isBackground(depth)) {\n            viewDist = abs(getViewZ(depth));\n            fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n            float occlusionFactor = getSsao(coords);\n            if (!uTransparentBackground) {\n                color.rgb = mix(mix(occlusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n            } else {\n                color.rgb = mix(occlusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n            }\n        }\n    #endif\n\n    // outline needs to be handled after occlusion to keep them clean\n    #ifdef dOutlineEnable\n        float closestTexel;\n        float outline = getOutline(coords, closestTexel);\n\n        if (outline == 0.0) {\n            color.rgb *= outline;\n            viewDist = abs(getViewZ(closestTexel));\n            fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n            if (!uTransparentBackground) {\n                color.rgb = mix(color.rgb, uFogColor, fogFactor);\n            } else {\n                color.a = 1.0 - fogFactor;\n            }\n        }\n    #endif\n\n    gl_FragColor = color;\n}\n"),g=Object(u.a)(e,"triangles",h,m,p);return Object(c.a)(g,p)}(e,r.texture,a,this.outlinesTarget.texture,this.ssaoDepthTexture)}return e.isEnabled=function(e){return"on"===e.occlusion.name||"on"===e.outline.name},e.prototype.setSize=function(e,t){var r=this.renderable.values.uTexSize.ref.value,n=r[0],i=r[1];if(e!==n||t!==i){var a=Math.floor(e*this.scale),o=Math.floor(t*this.scale);this.target.setSize(e,t),this.outlinesTarget.setSize(e,t),this.ssaoDepthTexture.define(a,o),this.ssaoDepthBlurProxyTexture.define(a,o),s.e.update(this.renderable.values.uTexSize,l.Vec2.set(this.renderable.values.uTexSize.ref.value,e,t)),s.e.update(this.outlinesRenderable.values.uTexSize,l.Vec2.set(this.outlinesRenderable.values.uTexSize.ref.value,e,t)),s.e.update(this.ssaoRenderable.values.uTexSize,l.Vec2.set(this.ssaoRenderable.values.uTexSize.ref.value,a,o)),s.e.update(this.ssaoBlurFirstPassRenderable.values.uTexSize,l.Vec2.set(this.ssaoRenderable.values.uTexSize.ref.value,a,o)),s.e.update(this.ssaoBlurSecondPassRenderable.values.uTexSize,l.Vec2.set(this.ssaoRenderable.values.uTexSize.ref.value,a,o))}},e.prototype.updateState=function(e,t,r,n){var i=!1,a=!1,o=!1,u="orthographic"===e.state.mode?1:0,c="on"===n.outline.name,d="on"===n.occlusion.name,f=l.Mat4.identity();if(l.Mat4.invert(f,e.projection),"on"===n.occlusion.name&&(s.e.updateIfChanged(this.ssaoRenderable.values.uProjection,e.projection),s.e.updateIfChanged(this.ssaoRenderable.values.uInvProjection,f),s.e.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uNear,e.near),s.e.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uNear,e.near),s.e.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uFar,e.far),s.e.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uFar,e.far),this.ssaoBlurFirstPassRenderable.values.dOrthographic.ref.value!==u&&(o=!0),s.e.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.dOrthographic,u),s.e.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.dOrthographic,u),this.nSamples!==n.occlusion.params.samples&&(a=!0,this.nSamples=n.occlusion.params.samples,s.e.updateIfChanged(this.ssaoRenderable.values.uSamples,function(e,t){for(var r=[],n=0;n<t;n++){var i=(n*n+2*n+1)/(t*t);i=.1+.9*i,r.push(e[n][0]*i),r.push(e[n][1]*i),r.push(e[n][2]*i)}return r}(this.randomHemisphereVector,this.nSamples)),s.e.updateIfChanged(this.ssaoRenderable.values.dNSamples,this.nSamples)),s.e.updateIfChanged(this.ssaoRenderable.values.uRadius,Math.pow(2,n.occlusion.params.radius)),s.e.updateIfChanged(this.ssaoRenderable.values.uBias,n.occlusion.params.bias),this.blurKernelSize!==n.occlusion.params.blurKernelSize)){o=!0,this.blurKernelSize=n.occlusion.params.blurKernelSize;var m=function(e){for(var t=e/3,r=Math.floor((e+1)/2),n=[],i=0;i<r;i++)n.push(1/(Math.sqrt(2*Math.PI)*t)*Math.exp(-i*i/(2*t*t)));return n}(this.blurKernelSize);s.e.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.uKernel,m),s.e.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.uKernel,m),s.e.updateIfChanged(this.ssaoBlurFirstPassRenderable.values.dOcclusionKernelSize,this.blurKernelSize),s.e.updateIfChanged(this.ssaoBlurSecondPassRenderable.values.dOcclusionKernelSize,this.blurKernelSize)}if("on"===n.outline.name){var h=Math.pow(1e3,n.outline.params.threshold)/1e3*(e.far-e.near),g=n.outline.params.scale-1;s.e.updateIfChanged(this.outlinesRenderable.values.uNear,e.near),s.e.updateIfChanged(this.outlinesRenderable.values.uFar,e.far),s.e.updateIfChanged(this.outlinesRenderable.values.uMaxPossibleViewZDiff,h),s.e.updateIfChanged(this.renderable.values.uMaxPossibleViewZDiff,h),s.e.updateIfChanged(this.renderable.values.uOutlineThreshold,n.outline.params.threshold),this.renderable.values.dOutlineScale.ref.value!==g&&(i=!0),s.e.updateIfChanged(this.renderable.values.dOutlineScale,g)}s.e.updateIfChanged(this.renderable.values.uFar,e.far),s.e.updateIfChanged(this.renderable.values.uNear,e.near),s.e.updateIfChanged(this.renderable.values.uFogFar,e.fogFar),s.e.updateIfChanged(this.renderable.values.uFogNear,e.fogNear),s.e.update(this.renderable.values.uFogColor,p.Color.toVec3Normalized(this.renderable.values.uFogColor.ref.value,r)),s.e.updateIfChanged(this.renderable.values.uTransparentBackground,t),this.renderable.values.dOrthographic.ref.value!==u&&(i=!0),s.e.updateIfChanged(this.renderable.values.dOrthographic,u),this.renderable.values.dOutlineEnable.ref.value!==c&&(i=!0),s.e.updateIfChanged(this.renderable.values.dOutlineEnable,c),this.renderable.values.dOcclusionEnable.ref.value!==d&&(i=!0),s.e.updateIfChanged(this.renderable.values.dOcclusionEnable,d),a&&this.ssaoRenderable.update(),o&&(this.ssaoBlurFirstPassRenderable.update(),this.ssaoBlurSecondPassRenderable.update()),i&&this.renderable.update();var v=this.webgl,b=v.gl,y=v.state;y.enable(b.SCISSOR_TEST),y.disable(b.BLEND),y.disable(b.DEPTH_TEST),y.depthMask(!1);var _=e.viewport,S=_.x,x=_.y,O=_.width,w=_.height;b.viewport(S,x,O,w),b.scissor(S,x,O,w)},e.prototype.render=function(e,t,r,n,i){if(this.updateState(e,r,n,i),"on"===i.outline.name&&(this.outlinesTarget.bind(),this.outlinesRenderable.render()),"on"===i.occlusion.name){var a=e.viewport,o=a.x,s=a.y,u=a.width,c=a.height,l=Math.floor(o*this.scale),d=Math.floor(s*this.scale),f=Math.floor(u*this.scale),p=Math.floor(c*this.scale);this.webgl.gl.viewport(l,d,f,p),this.webgl.gl.scissor(l,d,f,p),this.ssaoFramebuffer.bind(),this.ssaoRenderable.render(),this.ssaoBlurFirstPassFramebuffer.bind(),this.ssaoBlurFirstPassRenderable.render(),this.ssaoBlurSecondPassFramebuffer.bind(),this.ssaoBlurSecondPassRenderable.render(),this.webgl.gl.viewport(o,s,u,c),this.webgl.gl.scissor(o,s,u,c)}t?this.webgl.unbindFramebuffer():this.target.bind();var m=this.webgl,h=m.gl;m.state.clearColor(0,0,0,1),h.clear(h.COLOR_BUFFER_BIT),this.renderable.render()},e}(),V=function(){function e(e,t){this.drawPass=t;var r=t.colorTarget,n=r.getWidth(),i=r.getHeight();this.target=e.createRenderTarget(n,i,!1),this.fxaa=new h(e,this.target.texture),this.smaa=new x(e,this.target.texture)}return e.isEnabled=function(e){return"off"!==e.antialiasing.name},e.prototype.setSize=function(e,t){var r=this.target.texture.getWidth(),n=this.target.texture.getHeight();e===r&&t===n||(this.target.setSize(e,t),this.fxaa.setSize(e,t),this.smaa.supported&&this.smaa.setSize(e,t))},e.prototype._renderFxaa=function(e,t,r){if("fxaa"===r.antialiasing.name){var n=B.isEnabled(r)?this.drawPass.postprocessing.target.texture:this.drawPass.colorTarget.texture;this.fxaa.update(n,r.antialiasing.params),this.fxaa.render(e.viewport,t?void 0:this.target)}},e.prototype._renderSmaa=function(e,t,r){if("smaa"===r.antialiasing.name){var n=B.isEnabled(r)?this.drawPass.postprocessing.target.texture:this.drawPass.colorTarget.texture;this.smaa.update(n,r.antialiasing.params),this.smaa.render(e.viewport,t?void 0:this.target)}},e.prototype.render=function(e,t,r){if("off"!==r.antialiasing.name)if("fxaa"===r.antialiasing.name)this._renderFxaa(e,t,r);else if("smaa"===r.antialiasing.name){if(!this.smaa.supported)throw new Error('SMAA not supported, missing "HTMLImageElement"');this._renderSmaa(e,t,r)}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return se}));var n=r(0),i=r(7),a=r(200),o=r(361),s=r(66),u=r(6),c=r(120),l=r(313),d=r(12);function f(e,t){return t?1===t.length?Object(d.f)(t.charCodeAt(0),e):2===t.length?Object(d.f)(t.charCodeAt(0),Object(d.f)(t.charCodeAt(1),e)):e+" "+t:e}function p(e,t,r,n){if(e.has(t)){(i=e.get(t)).has(r)||i.set(r,n)}else{var i=new Map;e.set(t,i),i.set(r,n)}}function m(e){throw new Error("Missing entity entry for entity id '"+e+"'.")}var h=l.b.EmptyResidueKey(),g=function(){function e(e){this.map=e,this.entityIndex=e.entities.getEntityIndex,this.residueOffsets=this.map.segments.residueAtomSegments.offsets}return e.prototype.getEntityFromChain=function(e){return this.map.chain_index_entity_index[e]},e.prototype.findEntity=function(e){var t=this.map.label_asym_id.get(e);return void 0!==t?t:-1},e.prototype.findChainLabel=function(e){var t=this.entityIndex(e.label_entity_id);if(t<0||!this.map.entity_index_label_asym_id.has(t))return-1;var r=this.map.entity_index_label_asym_id.get(t);return r&&r.has(e.label_asym_id)?r.get(e.label_asym_id):-1},e.prototype.findChainAuth=function(e){if(!this.map.auth_asym_id_auth_seq_id.has(e.auth_asym_id))return-1;var t=this.map.auth_asym_id_auth_seq_id.get(e.auth_asym_id);return t.has(e.auth_seq_id)?t.get(e.auth_seq_id):-1},e.prototype.findResidue=function(e,t,r,n){var i;1===arguments.length?i=e:(h.label_entity_id=e,h.label_asym_id=t,h.auth_seq_id=r,h.pdbx_PDB_ins_code=n,i=h);var a=this.findChainLabel(i);if(a<0)return-1;var o=this.map.chain_index_auth_seq_id.get(a),s=f(i.auth_seq_id,i.pdbx_PDB_ins_code||"");return o.has(s)?o.get(s):-1},e.prototype.findResidueAuth=function(e){var t=this.findChainAuth(e);if(t<0)return-1;var r=this.map.chain_index_auth_seq_id.get(t),n=f(e.auth_seq_id,e.pdbx_PDB_ins_code||"");return r.has(n)?r.get(n):-1},e.prototype.findResidueInsertion=function(e){var t=this.findChainLabel(e);if(t<0)return-1;var r=this.map.chain_index_label_seq_id.get(t),n=f(e.label_seq_id,e.pdbx_PDB_ins_code||"");if(r.has(n))return r.get(n);var i=u.SortedArray.findPredecessorIndex(this.map.label_seq_id,e.label_seq_id),a=l.a.chainStartResidueIndex(this.map.segments,t);if(i<a)return a;var o=l.a.chainEndResidueIndexExcl(this.map.segments,t)-1;return i>=o?o:i},e.prototype.findAtom=function(e){var t=this.findResidue(e);return t<0?-1:void 0===e.label_alt_id?v(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,e.label_atom_id):b(this.residueOffsets[t],this.residueOffsets[t+1],this.map.label_atom_id,this.map.label_alt_id,e.label_atom_id,e.label_alt_id)},e.prototype.findAtomAuth=function(e){var t=this.findResidueAuth(e);return t<0?-1:void 0===e.label_alt_id?v(this.residueOffsets[t],this.residueOffsets[t+1],this.map.auth_atom_id,e.auth_atom_id):b(this.residueOffsets[t],this.residueOffsets[t+1],this.map.auth_atom_id,this.map.label_alt_id,e.auth_atom_id,e.label_alt_id)},e.prototype.findAtomOnResidue=function(e,t,r){return void 0===r?v(this.residueOffsets[e],this.residueOffsets[e+1],this.map.label_atom_id,t):b(this.residueOffsets[e],this.residueOffsets[e+1],this.map.label_atom_id,this.map.label_alt_id,t,r)},e.prototype.findAtomsOnResidue=function(e,t){return function(e,t,r,n){for(var i=e;i<t;i++)if(n.has(r.value(i)))return i;return-1}(this.residueOffsets[e],this.residueOffsets[e+1],this.map.label_atom_id,t)},e}();function v(e,t,r,n){for(var i=e;i<t;i++)if(r.value(i)===n)return i;return-1}function b(e,t,r,n,i,a){for(var o=e;o<t;o++)if(r.value(o)===i&&n.value(o)===a)return o;return-1}function y(e,t,r){for(var n=function(e,t,r){return{entities:e,segments:r,label_seq_id:u.SortedArray.ofSortedArray(t.residues.label_seq_id.toArray({array:Int32Array})),label_atom_id:t.atoms.label_atom_id,auth_atom_id:t.atoms.auth_atom_id,label_alt_id:t.atoms.label_alt_id,chain_index_entity_index:new Int32Array(t.chains._rowCount),entity_index_label_asym_id:new Map,chain_index_label_seq_id:new Map,auth_asym_id_auth_seq_id:new Map,chain_index_auth_seq_id:new Map,label_asym_id:new Map}}(t,e,r),i=e.residues,a=i.label_seq_id,o=i.auth_seq_id,s=i.pdbx_PDB_ins_code,c=e.chains,l=c.label_entity_id,d=c.label_asym_id,h=c.auth_asym_id,v=u.Interval.ofBounds(0,e.atoms._rowCount),b=u.Segmentation.transientSegments(r.chainAtomSegments,v);b.hasNext;){var y=b.move(),_=y.index,S=t.getEntityIndex(l.value(_));S<0&&m(l.value(_)),n.chain_index_entity_index[_]=S;var x=h.value(_),O=n.auth_asym_id_auth_seq_id.get(x);O||(O=new Map,n.auth_asym_id_auth_seq_id.set(x,O));var w=d.value(_);n.label_asym_id.has(w)||n.label_asym_id.set(w,S),p(n.entity_index_label_asym_id,S,w,_);var C=new Map,j=new Map;n.chain_index_label_seq_id.set(_,C),n.chain_index_auth_seq_id.set(_,j);for(var P=u.Segmentation.transientSegments(r.residueAtomSegments,v,y);P.hasNext;){var E=P.move().index,A=o.value(E),D=s.value(E);C.set(f(a.value(E),D),E),j.set(f(A,D),E),O.set(A,_)}}return new g(n)}var _=r(22),S=r(150),x=r(48);var O,w=r(9),C=r(74),j=r(333),P=r(152),E=r(1);function A(e,t,r){e[t].isDefined||(e[t]=e[r]),e[r].isDefined||(e[r]=e[t])}function D(e,t,r,a,o,s){var l,d,f=function(e){if(0===e._rowCount)return{residues:[],chains:[]};for(var t=e._rowCount,r=[0],n=[0],i=e.label_entity_id,a=e.label_asym_id,o=e.label_seq_id,s=e.auth_seq_id,u=e.pdbx_PDB_ins_code,c=1;c<t;c++){var l=!i.areValuesEqual(c-1,c)||!a.areValuesEqual(c-1,c);(l||!o.areValuesEqual(c-1,c)||!s.areValuesEqual(c-1,c)||!u.areValuesEqual(c-1,c))&&(r[r.length]=c),l&&(n[n.length]=c)}return{residues:r,chains:n}}(e),p=function(e,t,r){var n=i.d.ofColumns(c.e,{type_symbol:i.a.ofArray({array:i.a.mapToArray(e.type_symbol,_.ElementSymbol),schema:i.a.Schema.Aliased(i.a.Schema.str)}),label_atom_id:e.label_atom_id,auth_atom_id:e.auth_atom_id,label_alt_id:e.label_alt_id,label_comp_id:e.label_comp_id,auth_comp_id:e.auth_comp_id,pdbx_formal_charge:e.pdbx_formal_charge}),a=i.d.view(e,c.g,r.residues),o=i.d.view(e,c.f,r.chains);if(!a.label_seq_id.isDefined){for(var s=new Int32Array(a.label_seq_id.rowCount),u=r.residues,l=r.chains,d=0,f=0,p=0,m=s.length;p<m;++p)u[p]>l[d+1]&&(d+=1,f=0),s[p]=++f;a.label_seq_id=i.a.ofIntArray(s)}return i.d.columnToArray(a,"label_seq_id",Int32Array),i.d.columnToArray(a,"auth_seq_id",Int32Array),A(n,"label_atom_id","auth_atom_id"),A(n,"label_comp_id","auth_comp_id"),A(a,"label_seq_id","auth_seq_id"),A(o,"label_asym_id","auth_asym_id"),{atoms:n,residues:a,chains:o,atomSourceIndex:t}}(e,t,f),m=function(e,t){var r=new Map;if(!C.a.is(t))return r;var n=Object(P.a)(j.a,t.data.frame).molstar_atom_site_operator_mapping;if(0===n._rowCount)return r;for(var a=new Map,o=new Map,s=0;s<n._rowCount;s++){var u=0===n.assembly_operator_id.valueKind(s)?{id:n.assembly_id.value(s),operList:[],operId:n.assembly_operator_id.value(s)}:void 0,c=w.h.create(n.operator_name.value(s),E.Mat4.identity(),{assembly:u,spgrOp:0===n.symmetry_operator_index.valueKind(s)?n.symmetry_operator_index.value(s):void 0,hkl:E.Vec3.ofArray(n.symmetry_hkl.value(s)),ncsId:n.ncs_id.value(s)}),l=n.suffix.value(s),d=n.label_asym_id.value(s);a.set(""+d+l,{name:d,operator:c});var f=n.auth_asym_id.value(s);o.set(""+f+l,f)}var p=e.chains,m=p.label_asym_id,h=p.auth_asym_id,g=new Array(m.rowCount),v=new Array(m.rowCount);for(s=0;s<m.rowCount;s++){d=m.value(s),f=h.value(s);if(a.has(d)){var b=a.get(d),y=b.name;c=b.operator;r.set(s,c),g[s]=y,v[s]=o.get(f)||f}else g[s]=d,v[s]=f}return e.chains.label_asym_id=i.a.ofArray({array:g,valueKind:e.chains.label_asym_id.valueKind,schema:e.chains.label_asym_id.schema}),e.chains.auth_asym_id=i.a.ofArray({array:v,valueKind:e.chains.auth_asym_id.valueKind,schema:e.chains.auth_asym_id.schema}),r}(p,o);if(s&&(l=s.atomicHierarchy,d=p,i.d.areEqual(l.chains,d.chains)&&i.d.areEqual(l.residues,d.residues)&&i.d.areEqual(l.atoms,d.atoms)))return{sameAsPrevious:!0,hierarchy:s.atomicHierarchy,chainOperatorMapping:m};var h={residueAtomSegments:u.Segmentation.ofOffsets(f.residues,u.Interval.ofBounds(0,e._rowCount)),chainAtomSegments:u.Segmentation.ofOffsets(f.chains,u.Interval.ofBounds(0,e._rowCount))},g=y(p,r,h),v=function(e,t,r,n){for(var i=e.atoms,a=i.label_comp_id,o=i.type_symbol,s=i._rowCount,u=e.residues._rowCount,l=t.residueAtomSegments.offsets,d=new Uint8Array(s),f=0;f<s;++f)d[f]=Object(c.a)(o.value(f));var p=new Int32Array(u),m=new Int32Array(u),h=new Int32Array(u),g=new Uint8Array(u),v=new Uint8Array(u),b=new Map,y=new Map;for(f=0;f<u;++f){var O=a.value(l[f]),w=n,C=void 0,j=void 0;if(b.has(O))C=b.get(O),j=y.get(O);else{var P=void 0;w.has(O)?P=w.get(O).type:(x.b||console.info("chemComp not found",O),P=Object(_.getComponentType)(O)),C=Object(_.getMoleculeType)(P,O),j=Object(_.getPolymerType)(P,C),b.set(O,C),y.set(O,j)}g[f]=C,v[f]=j;var E=Object(S.a)(j,"trace"),A=r.findAtomsOnResidue(f,E);if(-1===A){var D=Object(S.a)(j,"coarseBackbone");A=r.findAtomsOnResidue(f,D)}p[f]=A;var T=Object(S.a)(j,"directionFrom");m[f]=r.findAtomsOnResidue(f,T);var I=Object(S.a)(j,"directionTo");h[f]=r.findAtomsOnResidue(f,I)}return{atom:{atomicNumber:d},residue:{traceElementIndex:p,directionFromElementIndex:m,directionToElementIndex:h,moleculeType:g,polymerType:v}}}(p,h,g,a);return{sameAsPrevious:!1,hierarchy:Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},p),h),{index:g,derived:v}),chainOperatorMapping:m}}function T(e,t,r,n,i,o){var s=D(e,t,r,n,i,o),u=s.sameAsPrevious,c=s.hierarchy,l=s.chainOperatorMapping;return{sameAsPrevious:u,hierarchy:c,conformation:function(e){return{id:a.a.create22(),atomId:e.id,occupancy:e.occupancy,B_iso_or_equiv:e.B_iso_or_equiv,xyzDefined:e.Cartn_x.isDefined&&e.Cartn_y.isDefined&&e.Cartn_z.isDefined,x:e.Cartn_x.toArray({array:Float32Array}),y:e.Cartn_y.toArray({array:Float32Array}),z:e.Cartn_z.toArray({array:Float32Array})}}(e),chainOperatorMapping:l}}!function(e){e.Empty={isDefined:!1}}(O||(O={}));var I=r(88);function M(e,t,r){if(e.has(t))return e.get(t);var n=r.index++;return e.set(t,n),n}function k(e,t){if(e.has(t))return e.get(t);var r=new Map;return e.set(t,r),r}function B(e){throw new Error("Missing entity entry for entity id '"+e+"'.")}function V(e,t){for(var r=e.entity_id,n=e.asym_id,i=e.seq_id_begin,a=e.seq_id_end,o=e.count,s=e.chainElementSegments,c=new Map,l=new Map,d={index:0},f=new Int32Array(o),p=new Int32Array(o),m=new Int32Array(s.count),h=0;h<o;h++)p[h]=t.getEntityIndex(r.value(h)),p[h]<0&&B(r.value(h));for(var g=0;g<s.count;g++){var v=s.offsets[g],b=s.offsets[g+1],y=p[v];m[g]=y;var _=M(k(l,y),n.value(v),d);for(h=v;h<b;h++)f[h]=_;var S=[],x=[];for(h=v;h<b;h++){var O=i.value(h),w=a.value(h);S.push(h),x.push(O,w)}var C={elementIndices:S,seqRanges:I.a.ofSortedRanges(x)};c.set(_,C)}var j=function(e,t,r){var n=e.getEntityIndex;return{findChainKey:function(e,r){var i=n(e);if(i<0)return-1;var a=t.get(i);return a.has(r)?a.get(r):-1},findSequenceKey:function(e,i,a){var o=n(e);if(o<0)return-1;var s=t.get(o);if(void 0===s)return-1;var c=s.get(i);if(void 0===c)return-1;var l=r.get(c),d=l.elementIndices,f=l.seqRanges,p=I.a.firstIntersectionIndex(f,u.OrderedSet.ofSingleton(a));return-1!==p?d[p]:-1}}}(t,l,c),P=j.findChainKey;return{chainKey:f,entityKey:p,findSequenceKey:j.findSequenceKey,findChainKey:P,getEntityFromChain:function(e){return m[e]}}}var R=r(5);function L(e,t){for(var r=[],n=[],i=u.Segmentation.transientSegments(e.chainElementSegments,u.Interval.ofBounds(0,e.count)),a=e.seq_id_begin,o=e.seq_id_end;i.hasNext;)for(var s=i.move(),c=s.start,l=s.end,d=-1,f=-1,p=c;p<l;++p){var m=o.value(p);p===c?(d=p,f=o.value(p)):a.value(p)-f>1&&(r.push(d,p-1),n.push(p-1,p),d=p),p===l-1&&r.push(d,p),f=m}return{polymerRanges:I.a.ofSortedRanges(r),gapRanges:I.a.ofSortedRanges(n)}}var N=r(111),F={hierarchy:O.Empty,conformation:void 0};function U(e,t){var r=e.ihm_sphere_obj_site,i=e.ihm_gaussian_obj_site;if(0===r._rowCount&&0===i._rowCount)return F;var a=z(r),o=function(e){return{x:e.Cartn_x.toArray({array:Float32Array}),y:e.Cartn_y.toArray({array:Float32Array}),z:e.Cartn_z.toArray({array:Float32Array}),radius:e.object_radius.toArray({array:Float32Array}),rmsf:e.rmsf.toArray({array:Float32Array})}}(r),s=V(a,e.entities),u=L(a,t.chemicalComponentMap),c=z(i),l=function(e){for(var t=N.a.ihm_gaussian_obj_site.covariance_matrix.space,r=[],n=e.covariance_matrix,i=0,a=n.rowCount;i<a;i++)r[i]=E.Tensor.toMat3(Object(E.Mat3)(),t,n.value(i));return{x:e.mean_Cartn_x.toArray({array:Float32Array}),y:e.mean_Cartn_y.toArray({array:Float32Array}),z:e.mean_Cartn_z.toArray({array:Float32Array}),weight:e.weight.toArray({array:Float32Array}),covariance_matrix:r}}(i),d=V(c,e.entities),f=L(c,t.chemicalComponentMap);return{hierarchy:{isDefined:!0,spheres:Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},a),s),u),gaussians:Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},c),d),f)},conformation:{id:R.c.create22(),spheres:o,gaussians:l}}}function z(e){var t=e.entity_id,r=e.seq_id_begin,i=e.seq_id_end,a=e.asym_id;return Object(n.__assign)({count:t.rowCount,entity_id:t,asym_id:a,seq_id_begin:r,seq_id_end:i},function(e,t,r){for(var n=[0],i=1,a=e.rowCount;i<a;i++){!e.areValuesEqual(i-1,i)&&(n[n.length]=i)}return{chainElementSegments:u.Segmentation.ofOffsets(n,u.Interval.ofBounds(0,e.rowCount))}}(a))}var H=r(353),G=r(343);function q(e,t,r,n){if(!e.entity_poly_seq||!e.entity_poly_seq._rowCount)return H.a.fromHierarchy(t,r,n);for(var a=e.entity_poly_seq,o=a.entity_id,s=a.num,u=a.mon_id,c={},l=[],d=o.rowCount,f=0;f<d;){for(var p=f;f<d-1&&o.areValuesEqual(f,f+1);)f++;f++;var m=o.value(p),h=i.a.window(u,p,f),g=i.a.window(s,p,f),v=t.getEntityIndex(m);c[v]={entityId:m,sequence:G.a.ofResidueNames(h,g)},l.push(c[v])}return{byEntityKey:c,sequences:l}}var W=r(29);function X(e,t,r,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var o,s,u,c,l,f,p,m,h,g,v;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return o=Object(d.g)(r,a-1),s=t.label_entity_id,u=t.label_asym_id,c=t.label_seq_id,l=Object(d.o)(o,s.value),e.shouldUpdate?[4,e.update()]:[3,2];case 1:n.sent(),n.label=2;case 2:f=0,p=l.length-1,n.label=3;case 3:if(!(f<p))return[3,10];m=Object(d.o)(o,u.value,{start:l[f],end:l[f+1]}),h=0,g=m.length-1,n.label=4;case 4:return h<g?(v=m[h],0!==c.valueKind(v)?[3,6]:(Object(d.o)(o,c.value,{sort:!0,start:v,end:m[h+1]}),e.shouldUpdate?[4,e.update()]:[3,6])):[3,7];case 5:n.sent(),n.label=6;case 6:return h++,[3,4];case 7:return e.shouldUpdate?[4,e.update()]:[3,9];case 8:n.sent(),n.label=9;case 9:return f++,[3,3];case 10:return Object(W.arrayIsIdentity)(o)&&o.length===t._rowCount?[2,{atom_site:t,sourceIndex:i.a.ofIntArray(o)}]:[2,{atom_site:i.d.view(t,t._schema,o),sourceIndex:i.a.ofIntArray(o)}]}}))}))}function Y(e,t,r,n,i){var a=i.residue,o=a.polymerType,s=a.traceElementIndex,u=a.directionFromElementIndex,c=a.directionToElementIndex,l=o[e],d=o[t];if(0===l||0===d)return!1;if(-1===s[e]||-1===s[t])return!1;var f=n.findAtomsOnResidue(e,Object(S.a)(l,"backboneStart")),p=n.findAtomsOnResidue(t,Object(S.a)(d,"backboneEnd"));-1!==f&&-1!==p||(f=n.findAtomsOnResidue(e,Object(S.a)(l,"coarseBackbone")),p=n.findAtomsOnResidue(t,Object(S.a)(d,"coarseBackbone")));var m=r.x,h=r.y,g=r.z,v=E.Vec3.create(m[f],h[f],g[f]),b=E.Vec3.create(m[p],h[p],g[p]),y=-1===u[e]||-1===c[e]||-1===u[t]||-1===c[t];return E.Vec3.distance(v,b)<(y?10:3)}function Q(e,t,r,n){for(var i,a,o,s,c=[],l=[],d=new Map,f=u.Segmentation.transientSegments(e.chainAtomSegments,u.Interval.ofBounds(0,e.atoms._rowCount)),p=u.Segmentation.transientSegments(e.residueAtomSegments,u.Interval.ofBounds(0,e.atoms._rowCount)),m=e.index,h=e.derived,g=e.residues.label_seq_id,v=e.chains.label_entity_id,b=h.residue,y=b.moleculeType,S=b.traceElementIndex;f.hasNext;){var x=f.move();p.setSegment(x),i=-1,a=-1,o=-1,s=-1;var O=t.getEntityIndex(v.value(x.index)),w=n.byEntityKey[O],C=w?w.sequence.seqId.value(w.sequence.seqId.rowCount-1):-1,j=e.residueAtomSegments.index[x.start],P=e.residueAtomSegments.index[x.end-1],E=g.value(j),A=g.value(P);for(1===E&&A===C&&r.xyzDefined&&Y(j,P,r,m,h)&&(d.set(j,P),d.set(P,j));p.hasNext;){var D=p.move(),T=D.index,M=g.value(T);if(Object(_.isPolymer)(y[T])&&-1!==S[T])if(-1!==s)if(M!==i+1)c.push(s,o-1),l.push(a,D.end-1),s=D.start;else if(p.hasNext){var k=e.residueAtomSegments.index[D.start],B=e.residueAtomSegments.index[o-1];r.xyzDefined&&!Y(k,B,r,e.index,h)&&(c.push(s,o-1),l.push(a,D.end-1),s=D.start)}else c.push(s,D.end-1);else s=D.start;else-1!==s&&(c.push(s,o-1),s=-1);a=D.start,o=D.end,i=M}}return{polymerRanges:I.a.ofSortedRanges(c),gapRanges:I.a.ofSortedRanges(l),cyclicPolymerMap:d}}var K=r(184),Z=r(154);function J(e){for(var t=new Map,r=function(e,t,r){return e+"|"+t+"|"+r},n=e.pdbx_unobs_or_zero_occ_residues,i=0,a=n._rowCount;i<a;++i){var o=r(n.PDB_model_num.value(i),n.label_asym_id.value(i),n.label_seq_id.value(i));t.set(o,{polymer_flag:n.polymer_flag.value(i),occupancy_flag:n.occupancy_flag.value(i)})}return{has:function(e,n,i){return t.has(r(e,n,i))},get:function(e,n,i){return t.get(r(e,n,i))},size:t.size}}function $(e){var t=new Map;if(e.chem_comp._rowCount>0)for(var r=e.chem_comp.id,n=0,a=r.rowCount;n<a;++n)t.set(r.value(n),i.d.getRow(e.chem_comp,n));else te(e).forEach((function(e){t.set(e,Object(_.getDefaultChemicalComponent)(e))}));return t}function ee(e){var t=new Map;if(e.pdbx_chem_comp_identifier._rowCount>0)for(var r=e.pdbx_chem_comp_identifier,n=r.comp_id,i=r.type,a=r.identifier,o=0,s=n.rowCount;o<s;++o)if("SNFG CARBOHYDRATE SYMBOL"===i.value(o)||"SNFG CARB SYMBOL"===i.value(o)){var u=a.value(o),c=K.d.get(u);c?t.set(n.value(o),c):console.warn("Unknown SNFG name '"+u+"'")}if(e.chem_comp._rowCount>0){var l=e.chem_comp,d=l.id;for(i=l.type,o=0,s=d.rowCount;o<s;++o){var f=d.value(o);if(!t.has(f)){var p=i.value(o);K.c.has(f)?t.set(f,K.c.get(f)):9===Object(_.getMoleculeType)(p,f)&&t.set(f,K.e)}}}else{var m=te(e);K.c.forEach((function(e,r){!t.has(r)&&m.has(r)&&t.set(r,e)}))}return t}var te=Object(Z.a)((function(e){for(var t=new Set,r=e.atom_site,n=r.label_comp_id,i=r.auth_comp_id,a=n.isDefined?n:i,o=0,s=a.rowCount;o<s;++o)t.add(a.value(o));return t}));function re(e){for(var t=new Map,r=e.atom_site,n=r.label_asym_id,i=r.auth_asym_id,a=r.label_entity_id,o=0,s=n.rowCount;o<s;++o){var u=n.value(o);t.has(u)||t.set(u,{id:u,auth_id:i.value(o),entity_id:a.value(o)})}if(e.struct_asym._rowCount>0){var c=e.struct_asym,l=(u=c.id,c.entity_id);for(o=0,s=u.rowCount;o<s;++o){var d=u.value(o);t.has(d)||t.set(d,{id:d,auth_id:"",entity_id:l.value(o)})}}return t}var ne=i.a.Schema.Aliased(i.a.Schema.Str(""));function ie(e,t){var r,n;if(e.entity.id.isDefined)n=e.entity;else{for(var a=new Set,o=[],s=[],u=e.atom_site,c=u.label_entity_id,l=u.label_comp_id,d=0,f=e.atom_site._rowCount;d<f;d++){var p=c.value(d);a.has(p)||(o.push(p),s.push(Object(_.getEntityType)(l.value(d))),a.add(p))}var m=e.ihm_sphere_obj_site.entity_id;for(d=0,f=e.ihm_sphere_obj_site._rowCount;d<f;d++){p=m.value(d);a.has(p)||(o.push(p),s.push("polymer"),a.add(p))}var h=e.ihm_gaussian_obj_site.entity_id;for(d=0,f=e.ihm_gaussian_obj_site._rowCount;d<f;d++){p=h.value(d);a.has(p)||(o.push(p),s.push("polymer"),a.add(p))}n=i.d.ofPartialColumns(N.a.entity,{id:i.a.ofArray({array:o,schema:N.a.entity.id}),type:i.a.ofArray({array:s,schema:N.a.entity.type})},o.length)}var g=i.a.createIndexer(n.id),v=new Array(n._rowCount);v.fill("other");var b=new Set,y=!1;if(e.entity_poly&&e.entity_poly.type.isDefined){var S=e.entity_poly,x=S.entity_id,O=S.type,w=S._rowCount;for(d=0;d<w;++d){v[g(p=x.value(d))]=O.value(d),b.add(p)}}else y=!0;if(e.pdbx_entity_branch&&e.pdbx_entity_branch.entity_id.isDefined){var C=e.pdbx_entity_branch;for(x=C.entity_id,O=C.type,w=C._rowCount,d=0;d<w;++d){v[g(p=x.value(d))]=O.value(d),b.add(p)}}else y=!0;if(b.size<v.length&&(y=!0),y){var j=new Map;if(e.chem_comp){var P=e.chem_comp,E=P.id;for(O=P.type,d=0,f=e.chem_comp._rowCount;d<f;d++)j.set(E.value(d),O.value(d))}if(e.atom_site){var A=e.atom_site;for(c=A.label_entity_id,l=A.label_comp_id,d=0,f=e.atom_site._rowCount;d<f;d++){p=c.value(d);if(!b.has(p)){var D=l.value(d),T=j.get(D)||"";v[g(p)]=Object(_.getEntitySubtype)(D,T),b.add(p)}}}}var I=i.a.ofArray({array:v,schema:ne}),M=new Array(n._rowCount);if(M.fill(""),e.pdbx_molecule&&e.pdbx_molecule.prd_id.isDefined){var k=e.pdbx_molecule,B=k.asym_id,V=k.prd_id;for(w=k._rowCount,d=0;d<w;++d){var R=B.value(d);void 0!==(p=null===(r=t.structAsymMap.get(R))||void 0===r?void 0:r.entity_id)&&(M[g(p)]=V.value(d))}}return{data:n,subtype:I,prd_id:i.a.ofArray({array:M,schema:i.a.Schema.str}),getEntityIndex:g}}function ae(e,t){var r=t.ihm_model_group,n=t.ihm_model_group_link,a=i.d.pickRow(n,(function(t){return n.model_id.value(t)===e}));if(a){var o=i.d.pickRow(r,(function(e){return r.id.value(e)===a.group_id}));if(o)return o.name}return""}var oe=r(252);function se(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return i=function(e){return{missingResidues:J(e),chemicalComponentMap:$(e),saccharideComponentMap:ee(e),structAsymMap:re(e)}}(e),e.ihm_model_list._rowCount>0?[4,de(r,e,i,t)]:[3,2];case 1:return s=n.sent(),[3,4];case 2:return[4,ce(r,e,i,t)];case 3:s=n.sent(),n.label=4;case 4:for(a=s,u=0;u<a.length;u++)o.a.TrajectoryInfo.set(a[u],{index:u,size:a.length});return[2,new oe.a(a)]}}))}))}function ue(e,t){var r=e.rowCount;if(!e.isDefined)return r;for(var n=t+1;n<r&&e.areValuesEqual(t,n);)n++;return n}function ce(e,t,r,i){return Object(n.__awaiter)(this,void 0,void 0,(function(){var o,u,c,l,d,f,p,m,h;return Object(n.__generator)(this,(function(g){switch(g.label){case 0:if(o=[],!t.atom_site)return[3,3];u=t.atom_site.id.rowCount,c=ie(t,r),l=0,g.label=1;case 1:return l<u?(d=ue(t.atom_site.pdbx_PDB_model_num,l),[4,X(e,t.atom_site,l,d)]):[3,3];case 2:return f=g.sent(),p=f.atom_site,m=f.sourceIndex,h=function(e,t,r,i,o,u,c){var l=T(t,r,i,o.chemicalComponentMap,u,c),d=t.pdbx_PDB_model_num.value(0);if(c&&l.sameAsPrevious)return Object(n.__assign)(Object(n.__assign)({},c),{id:a.a.create22(),modelNum:d,atomicConformation:l.conformation,_dynamicPropertyData:Object.create(null)});var f=F,p=q(e,i,l.hierarchy,f.hierarchy),m=Q(l.hierarchy,i,l.conformation,p),h=0===e.entry.id.valueKind(0)?e.entry.id.value(0):u.name,g=[];return h&&g.push(h),0===e.struct.title.valueKind(0)&&g.push(e.struct.title.value(0)),{id:a.a.create22(),entryId:h,label:g.join(" | "),entry:h,sourceData:u,modelNum:d,parent:void 0,entities:i,sequence:p,atomicHierarchy:l.hierarchy,atomicConformation:l.conformation,atomicRanges:m,atomicChainOperatorMappinng:l.chainOperatorMapping,coarseHierarchy:f.hierarchy,coarseConformation:f.conformation,properties:o,customProperties:new s.CustomProperties,_staticPropertyData:Object.create(null),_dynamicPropertyData:Object.create(null)}}(t,p,m,c,r,i,o.length>0?o[o.length-1]:void 0),o.push(h),l=d,[3,1];case 3:return[2,o]}}))}))}function le(e,t){for(var r=new Map,n=e._rowCount,a=0;a<n;){var o=ue(t,a),s=t.value(a);r.set(s,{table:i.d.window(e,e._schema,a,o),start:a,end:o}),a=o}return r}function de(e,t,r,o){return Object(n.__awaiter)(this,void 0,void 0,(function(){var u,c,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C,j;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(u=ie(t,r),c=t.atom_site.ihm_model_id.isDefined?t.atom_site.ihm_model_id:t.atom_site.pdbx_PDB_model_num,l=le(t.atom_site,c),d=le(t.ihm_sphere_obj_site,t.ihm_sphere_obj_site.model_id),f=le(t.ihm_gaussian_obj_site,t.ihm_gaussian_obj_site.model_id),p=[],!t.ihm_model_list)return[3,6];m=t.ihm_model_list,h=m.model_id,g=m.model_name,v=0,n.label=1;case 1:return v<t.ihm_model_list._rowCount?(b=h.value(v),y=void 0,_=void 0,l.has(b)?(S=l.get(b),[4,X(e,t.atom_site,S.start,S.end)]):[3,3]):[3,6];case 2:return x=n.sent(),O=x.atom_site,w=x.sourceIndex,y=O,_=w,[3,4];case 3:y=i.d.window(t.atom_site,t.atom_site._schema,0,0),_=i.a.ofIntArray([]),n.label=4;case 4:C={model_id:b,model_name:g.value(v),model_group_name:ae(b,t),entities:u,atom_site:y,atom_site_sourceIndex:_,ihm_sphere_obj_site:d.has(b)?d.get(b).table:i.d.window(t.ihm_sphere_obj_site,t.ihm_sphere_obj_site._schema,0,0),ihm_gaussian_obj_site:f.has(b)?f.get(b).table:i.d.window(t.ihm_gaussian_obj_site,t.ihm_gaussian_obj_site._schema,0,0)},j=function(e,t,r,n){var i=T(t.atom_site,t.atom_site_sourceIndex,t.entities,r.chemicalComponentMap,n),o=U(t,r),u=q(e,t.entities,i.hierarchy,o.hierarchy),c=Q(i.hierarchy,t.entities,i.conformation,u),l=0===e.entry.id.valueKind(0)?e.entry.id.value(0):n.name,d=[];return l&&d.push(l),0===e.struct.title.valueKind(0)&&d.push(e.struct.title.value(0)),t.model_name&&d.push(t.model_name),t.model_group_name&&d.push(t.model_group_name),{id:a.a.create22(),entryId:l,label:d.join(" | "),entry:l,sourceData:n,modelNum:t.model_id,parent:void 0,entities:t.entities,sequence:u,atomicHierarchy:i.hierarchy,atomicConformation:i.conformation,atomicRanges:c,atomicChainOperatorMappinng:i.chainOperatorMapping,coarseHierarchy:o.hierarchy,coarseConformation:o.conformation,properties:r,customProperties:new s.CustomProperties,_staticPropertyData:Object.create(null),_dynamicPropertyData:Object.create(null)}}(t,C,r,o),p.push(j),n.label=5;case 5:return v++,[3,1];case 6:return[2,p]}}))}))}},function(e,t,r){"use strict";var n=r(37),i=r(120),a=r(181),o=r(9);function s(){throw"Property only available for atomic models."}function u(e){if(e)throw"Property only available for coarse models ("+e+").";throw"Property only available for coarse models."}var c={key:function(e){return e.element},x:function(e){return e.unit.conformation.x(e.element)},y:function(e){return e.unit.conformation.y(e.element)},z:function(e){return e.unit.conformation.z(e.element)},id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicConformation.atomId.value(e.element):s()},occupancy:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicConformation.occupancy.value(e.element):s()},B_iso_or_equiv:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicConformation.B_iso_or_equiv.value(e.element):s()},sourceIndex:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atomSourceIndex.value(e.element):e.element},type_symbol:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element):s()},label_atom_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_atom_id.value(e.element):s()},auth_atom_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_atom_id.value(e.element):s()},label_alt_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.label_alt_id.value(e.element):s()},label_comp_id:l,auth_comp_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.auth_comp_id.value(e.element):s()},pdbx_formal_charge:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.atoms.pdbx_formal_charge.value(e.element):s()},vdw_radius:function(e){return n.a.isAtomic(e.unit)?Object(i.h)(e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element)):s()}};function l(e){return n.a.isAtomic(e.unit)||s(),e.unit.model.atomicHierarchy.atoms.label_comp_id.value(e.element)}function d(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.label_seq_id.value(e.unit.residueIndex[e.element]):s()}function f(e){n.a.isAtomic(e.unit)||s();var t=e.unit.model.sequence.byEntityKey[p(e)];return t&&t.sequence.microHet.get(d(e))||[l(e)]}function p(e){switch(e.unit.kind){case 0:return e.unit.model.atomicHierarchy.index.getEntityFromChain(e.unit.chainIndex[e.element]);case 1:return e.unit.model.coarseHierarchy.spheres.entityKey[e.element];case 2:return e.unit.model.coarseHierarchy.gaussians.entityKey[e.element]}}var m=[],h={constant:{true:function(e){return!0},false:function(e){return!1},zero:function(e){return 0}},atom:c,residue:{key:function(e){return n.a.isAtomic(e.unit)?e.unit.residueIndex[e.element]:s()},group_PDB:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.group_PDB.value(e.unit.residueIndex[e.element]):s()},label_seq_id:d,auth_seq_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.auth_seq_id.value(e.unit.residueIndex[e.element]):s()},pdbx_PDB_ins_code:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.residues.pdbx_PDB_ins_code.value(e.unit.residueIndex[e.element]):s()},isNonStandard:function(e){return n.a.isAtomic(e.unit)?f(e).some((function(t){return"n"===e.unit.model.properties.chemicalComponentMap.get(t).mon_nstd_flag[0]})):s()},hasMicroheterogeneity:function(e){n.a.isAtomic(e.unit)||s();var t=e.unit.model.sequence.byEntityKey[p(e)];return t&&t.sequence.microHet.has(d(e))},microheterogeneityCompIds:f,secondary_structure_type:function(e){var t,r;n.a.isAtomic(e.unit)||s();var i=null===(t=a.a.get(e.structure).value)||void 0===t?void 0:t.get(e.unit.id);return null!==(r=null==i?void 0:i.type[e.unit.residueIndex[e.element]])&&void 0!==r?r:536870912},secondary_structure_key:function(e){var t,r;n.a.isAtomic(e.unit)||s();var i=null===(t=a.a.get(e.structure).value)||void 0===t?void 0:t.get(e.unit.id);return null!==(r=null==i?void 0:i.key[e.unit.residueIndex[e.element]])&&void 0!==r?r:-1},chem_comp_type:function(e){return n.a.isAtomic(e.unit)?e.unit.model.properties.chemicalComponentMap.get(l(e)).type:s()}},chain:{key:function(e){return n.a.isAtomic(e.unit)?e.unit.chainIndex[e.element]:s()},label_asym_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_asym_id.value(e.unit.chainIndex[e.element]):s()},auth_asym_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.auth_asym_id.value(e.unit.chainIndex[e.element]):s()},label_entity_id:function(e){return n.a.isAtomic(e.unit)?e.unit.model.atomicHierarchy.chains.label_entity_id.value(e.unit.chainIndex[e.element]):s()}},entity:{key:p,id:function(e){return e.unit.model.entities.data.id.value(p(e))},type:function(e){return e.unit.model.entities.data.type.value(p(e))},src_method:function(e){return e.unit.model.entities.data.src_method.value(p(e))},pdbx_description:function(e){return e.unit.model.entities.data.pdbx_description.value(p(e))},formula_weight:function(e){return e.unit.model.entities.data.formula_weight.value(p(e))},pdbx_number_of_molecules:function(e){return e.unit.model.entities.data.pdbx_number_of_molecules.value(p(e))},details:function(e){return e.unit.model.entities.data.details.value(p(e))},pdbx_mutation:function(e){return e.unit.model.entities.data.pdbx_mutation.value(p(e))},pdbx_fragment:function(e){return e.unit.model.entities.data.pdbx_fragment.value(p(e))},pdbx_ec:function(e){return e.unit.model.entities.data.pdbx_ec.value(p(e))},subtype:function(e){return e.unit.model.entities.subtype.value(p(e))},prd_id:function(e){return e.unit.model.entities.prd_id.value(p(e))}},unit:{id:function(e){return e.unit.id},chainGroupId:function(e){return e.unit.chainGroupId},multiChain:function(e){return n.a.Traits.is(e.unit.traits,1)},object_primitive:function(e){return e.unit.objectPrimitive},operator_name:function(e){return e.unit.conformation.operator.name},model_index:function(e){return e.unit.model.modelNum},model_label:function(e){return e.unit.model.label},model_entry_id:function(e){return e.unit.model.entryId},hkl:function(e){return e.unit.conformation.operator.hkl},spgrOp:function(e){return e.unit.conformation.operator.spgrOp},model_num:function(e){return e.unit.model.modelNum},pdbx_struct_assembly_id:function(e){var t;return(null===(t=e.unit.conformation.operator.assembly)||void 0===t?void 0:t.id)||o.h.DefaultName},pdbx_struct_oper_list_ids:function(e){var t;return(null===(t=e.unit.conformation.operator.assembly)||void 0===t?void 0:t.operList)||m},struct_ncs_oper_id:function(e){return e.unit.conformation.operator.ncsId}},coarse:{key:c.key,entityKey:function(e){return n.a.isCoarse(e.unit)?e.unit.coarseElements.entityKey[e.element]:u()},x:c.x,y:c.y,z:c.z,asym_id:function(e){return n.a.isCoarse(e.unit)?e.unit.coarseElements.asym_id.value(e.element):u()},seq_id_begin:function(e){return n.a.isCoarse(e.unit)?e.unit.coarseElements.seq_id_begin.value(e.element):u()},seq_id_end:function(e){return n.a.isCoarse(e.unit)?e.unit.coarseElements.seq_id_end.value(e.element):u()},sphere_radius:function(e){return n.a.isSpheres(e.unit)?e.unit.coarseConformation.radius[e.element]:u("spheres")},sphere_rmsf:function(e){return n.a.isSpheres(e.unit)?e.unit.coarseConformation.rmsf[e.element]:u("spheres")},gaussian_weight:function(e){return n.a.isGaussians(e.unit)?e.unit.coarseConformation.weight[e.element]:u("gaussians")},gaussian_covariance_matrix:function(e){return n.a.isGaussians(e.unit)?e.unit.coarseConformation.covariance_matrix[e.element]:u("gaussians")}}};t.a=h},function(e,t,r){"use strict";r.r(t),r.d(t,"PluginBehavior",(function(){return u.a})),r.d(t,"BuiltInPluginBehaviors",(function(){return St})),r.d(t,"PluginBehaviors",(function(){return xt}));var n={};r.r(n),r.d(n,"registerDefault",(function(){return d})),r.d(n,"SyncRepresentationToCanvas",(function(){return f})),r.d(n,"SyncStructureRepresentation3DState",(function(){return p})),r.d(n,"UpdateRepresentationVisibility",(function(){return m}));var i={};r.r(i),r.d(i,"registerDefault",(function(){return v})),r.d(i,"Reset",(function(){return b})),r.d(i,"SetSnapshot",(function(){return y})),r.d(i,"Focus",(function(){return _}));var a={};r.r(a),r.d(a,"registerDefault",(function(){return x})),r.d(a,"Canvas3DSetSettings",(function(){return O}));var o={};r.r(o),r.d(o,"FocusLoci",(function(){return k}));var s={};r.r(s),r.d(s,"StructureInfo",(function(){return R})),r.d(s,"AccessibleSurfaceArea",(function(){return Oe})),r.d(s,"Interactions",(function(){return ke})),r.d(s,"SecondaryStructure",(function(){return Ve})),r.d(s,"ValenceModel",(function(){return Ne})),r.d(s,"CrossLinkRestraint",(function(){return yt}));var u=r(79),c=r(224),l=r(8);function d(e){f(e),p(e),m(e)}function f(e){var t=e.state.data.events;t.object.created.subscribe((function(t){var r;l.a.isRepresentation3D(t.obj)&&(h(t.state.cells.get(t.ref),t.obj.data.repr),t.obj.data.repr.setState({syncManually:!0}),null===(r=e.canvas3d)||void 0===r||r.add(t.obj.data.repr))})),t.object.updated.subscribe((function(t){var r,n;t.oldObj&&l.a.isRepresentation3D(t.oldObj)&&(null===(r=e.canvas3d)||void 0===r||r.remove(t.oldObj.data.repr),t.oldObj.data.repr.destroy()),l.a.isRepresentation3D(t.obj)&&(h(t.state.cells.get(t.ref),t.obj.data.repr),"recreate"===t.action&&t.obj.data.repr.setState({syncManually:!0}),null===(n=e.canvas3d)||void 0===n||n.add(t.obj.data.repr))})),t.object.removed.subscribe((function(t){var r;l.a.isRepresentation3D(t.obj)&&(null===(r=e.canvas3d)||void 0===r||r.remove(t.obj.data.repr),t.obj.data.repr.destroy())}))}function p(e){var t=e.state.data.events;t.object.created.subscribe((function(t){var r;if(l.a.Molecule.Structure.Representation3DState.is(t.obj)){var n=t.obj.data;n.source.data.repr.setState(n.state),null===(r=e.canvas3d)||void 0===r||r.update(n.source.data.repr)}})),t.object.updated.subscribe((function(t){var r;if(l.a.Molecule.Structure.Representation3DState.is(t.obj)){var n=t.obj.data;n.source.data.repr.setState(n.state),null===(r=e.canvas3d)||void 0===r||r.update(n.source.data.repr)}})),t.object.removed.subscribe((function(t){var r;if(l.a.Molecule.Structure.Representation3DState.is(t.obj)){var n=t.obj.data;n.source.data.repr.setState(n.initialState),null===(r=e.canvas3d)||void 0===r||r.update(n.source.data.repr)}}))}function m(e){e.state.data.events.cell.stateUpdated.subscribe((function(t){var r,n=t.state.cells.get(t.ref);l.a.isRepresentation3D(n.obj)&&h(n,n.obj.data.repr)&&(null===(r=e.canvas3d)||void 0===r||r.syncVisibility())}))}function h(e,t){return t.state.visible===e.state.isHidden&&(t.setState({visible:!e.state.isHidden}),!0)}var g=r(27);function v(e){b(e),_(e),y(e)}function b(e){g.PluginCommands.Camera.Reset.subscribe(e,(function(t){e.managers.camera.reset(null==t?void 0:t.snapshot,null==t?void 0:t.durationMs)}))}function y(e){g.PluginCommands.Camera.SetSnapshot.subscribe(e,(function(t){var r=t.snapshot,n=t.durationMs;e.managers.camera.setSnapshot(r,n)}))}function _(e){g.PluginCommands.Camera.Focus.subscribe(e,(function(t){var r=t.center,n=t.radius,i=t.durationMs;e.managers.camera.focusSphere({center:r,radius:n},{durationMs:i}),e.events.canvas3d.settingsUpdated.next()}))}var S=r(146);function x(e){O(e)}function O(e){g.PluginCommands.Canvas3D.ResetSettings.subscribe(e,(function(){var t;null===(t=e.canvas3d)||void 0===t||t.setProps(S.DefaultCanvas3DParams),e.events.canvas3d.settingsUpdated.next()})),g.PluginCommands.Canvas3D.SetSettings.subscribe(e,(function(t){var r;e.canvas3d&&(null===(r=e.canvas3d)||void 0===r||r.setProps(t.settings),e.events.canvas3d.settingsUpdated.next())}))}var w=r(234),C=r(0),j=r(23),P=r(2),E=r(90),A=r(61),D=(E.a,E.b),T=A.a.Trigger,I={clickCenterFocus:Object(A.a)([T(1,D.create()),T(2,D.create()),T(1,D.create({control:!0}))],"Camera center and focus","Click element using ${triggers}"),clickCenterFocusSelectMode:Object(A.a)([T(2,D.create()),T(1,D.create({control:!0}))],"Camera center and focus","Click element using ${triggers}")},M={minRadius:P.ParamDefinition.Numeric(8,{min:1,max:50,step:1}),extraRadius:P.ParamDefinition.Numeric(4,{min:1,max:50,step:1},{description:"Value added to the bounding-sphere radius of the Loci"}),durationMs:P.ParamDefinition.Numeric(250,{min:0,max:1e3,step:1},{description:"Camera transition duration"}),bindings:P.ParamDefinition.Value(I,{isHidden:!0})},k=u.a.create({name:"camera-focus-loci",category:"interaction",ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(C.__extends)(t,e),t.prototype.register=function(){var e=this;this.subscribeObservable(this.ctx.behaviors.interaction.click,(function(t){var r=t.current,n=t.button,i=t.modifiers;if(e.ctx.canvas3d){var a=e.ctx.selectionMode?e.params.bindings.clickCenterFocusSelectMode:e.params.bindings.clickCenterFocus;if(A.a.match(a,n,i)){if(j.Loci.isEmpty(r.loci))return void g.PluginCommands.Camera.Reset(e.ctx,{});var o=j.Loci.normalize(r.loci,e.ctx.managers.interactivity.props.granularity);e.ctx.managers.camera.focusLoci(o,e.params)}}}))},t}(u.a.Handler),params:function(){return M},display:{name:"Camera Focus Loci on Canvas"}}),B=r(4),V=r(13),R=u.a.create({name:"structure-info-prop",category:"custom-props",display:{name:"Structure Info"},ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(C.__extends)(t,e),Object.defineProperty(t.prototype,"maxModelIndex",{get:function(){for(var e,t,r=-1,n=0,i=this.ctx.state.data.select(V.StateSelection.Generators.rootsOfType(l.a.Molecule.Model));n<i.length;n++){var a=i[n],o=(null===(e=a.obj)||void 0===e?void 0:e.data)&&B.Model.Index.get(null===(t=a.obj)||void 0===t?void 0:t.data).value;void 0!==o&&o>r&&(r=o)}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"maxStructureIndex",{get:function(){for(var e,t,r=-1,n=0,i=this.ctx.state.data.select(V.StateSelection.Generators.rootsOfType(l.a.Molecule.Structure));n<i.length;n++){var a=i[n],o=(null===(e=a.obj)||void 0===e?void 0:e.data)&&B.Structure.Index.get(null===(t=a.obj)||void 0===t?void 0:t.data).value;void 0!==o&&o>r&&(r=o)}return r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"asymIdOffset",{get:function(){for(var e,t=0,r=0,n=0,i=this.ctx.state.data.select(V.StateSelection.Generators.rootsOfType(l.a.Molecule.Model));n<i.length;n++){var a=null===(e=i[n].obj)||void 0===e?void 0:e.data;if(a){var o=B.Model.AsymIdCount.get(a),s=B.Model.AsymIdOffset.get(a).value;void 0!==o&&void 0!==s&&(t=Math.max(t,s.auth+o.auth),r=Math.max(r,s.label+o.label))}}return{auth:t,label:r}},enumerable:!1,configurable:!0}),t.prototype.handleModel=function(e,t){if(void 0===B.Model.Index.get(e).value){var r=t&&B.Model.Index.get(t).value,n=null!=r?r:this.maxModelIndex+1;B.Model.Index.set(e,{value:n})}if(void 0===B.Model.AsymIdOffset.get(e).value){var i=t&&B.Model.AsymIdOffset.get(t).value;n=null!=i?i:Object(C.__assign)({},this.asymIdOffset);B.Model.AsymIdOffset.set(e,{value:n})}},t.prototype.handleStructure=function(e,t){if(void 0===e.parent&&void 0===B.Structure.Index.get(e).value){var r=t&&B.Structure.Index.get(t).value,n=null!=r?r:this.maxStructureIndex+1;B.Structure.Index.set(e,{value:n})}},t.prototype.handle=function(e,t,r){if(l.a.Molecule.Structure.is(t))this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator||void 0!==t.data.parent||this.handleStructure(t.data,null==r?void 0:r.data);else if(l.a.Molecule.Model.is(t)){this.ctx.state.data.tree.transforms.get(e).transformer.definition.isDecorator||this.handleModel(t.data,null==r?void 0:r.data)}},t.prototype.register=function(){var e=this;this.ctx.customModelProperties.register(B.Model.AsymIdOffset,!0),this.ctx.customModelProperties.register(B.Model.Index,!0),this.ctx.customStructureProperties.register(B.Structure.Index,!0),this.subscribeObservable(this.ctx.state.data.events.object.created,(function(t){e.handle(t.ref,t.obj)})),this.subscribeObservable(this.ctx.state.data.events.object.updated,(function(t){e.handle(t.ref,t.obj,t.oldObj)}))},t.prototype.unregister=function(){this.ctx.customModelProperties.unregister(B.Model.AsymIdOffset.descriptor.name),this.ctx.customModelProperties.unregister(B.Model.Index.descriptor.name),this.ctx.customStructureProperties.unregister(B.Structure.Index.descriptor.name)},t}(u.a.Handler)}),L=r(17),N=r(1),F=[-1,1.76,1.87,1.65,1.5,1.4,1.85,1.8,1.6,1.4],U={ALA:121,ARG:265,ASN:187,ASP:187,CYS:148,GLU:214,GLN:214,GLY:97,HIS:216,ILE:195,LEU:191,LYS:230,MET:203,PHE:228,PRO:154,SER:143,THR:163,TRP:264,TYR:255,VAL:165},z=r(113),H=r(22),G=r(120),q=r(28),W=r(150),X=q.d.Location.create(void 0);function Y(e,t,r){switch(t){case"O":return 5;case"S":return 6;case"N":return"NZ"===e?4:3;case"C":switch(e){case"C":case"CE1":case"CE2":case"CE3":case"CH2":case"CZ":case"CZ2":case"CZ3":return 1;case"CA":case"CB":case"CE":case"CG1":case"CG2":return 2;default:switch(r){case"PHE":case"TRP":case"TYR":case"HIS":case"ASP":case"ASN":return 1;case"PRO":case"LYS":case"ARG":case"MET":case"ILE":case"LEU":return 2;case"GLU":case"GLN":return"CD"===e?1:2}}}return K(t)}function Q(e,t,r){switch(t){case"C":return 7;case"N":return 8;case"P":return 9;case"O":return 5}return K(t)}function K(e){var t=Object(G.h)(e),r=F.indexOf(t);return-1===r&&(r=F.length,F[r]=t),r}function Z(e,t){return Object(C.__awaiter)(this,void 0,void 0,(function(){var r,n;return Object(C.__generator)(this,(function(i){switch(i.label){case 0:r=t.atomRadiusType,n=0,i.label=1;case 1:return n<r.length?e.shouldUpdate?[4,e.update({message:"Computing per residue surface accessibility...",current:n,max:r.length})]:[3,3]:[3,5];case 2:i.sent(),i.label=3;case 3:!function(e,t,r){for(var n=e.structure,i=e.atomRadiusType,a=e.serialResidueIndex,o=e.area,s=e.spherePoints,u=e.scalingConstant,c=e.maxLookupRadius,l=e.probeSize,d=q.e.atom,f=d.x,p=d.y,m=d.z,h=n.lookup3d,g=n.serialMapping,v=n.unitIndexMap,b=g.cumulativeUnitElementCount,y=t;y<r;++y){var _=F[i[y]];if(_!==F[0]){ne(te,n,y);for(var S=f(te),x=p(te),O=m(te),w=h.find(S,x,O,c),C=w.count,j=w.units,P=w.indices,E=w.squaredDistances,A=l+l+_,D=[],T=0;T<C;++T){var I=j[T];q.d.Location.set(re,e.structure,I,I.elements[P[T]]);var M=b[v.get(I.id)]+P[T],k=F[i[M]];if(!q.d.Location.areEqual(te,re)&&k!==F[0]){var B=(A+k)*(A+k);E[T]<B&&(D[D.length]=M)}}N.Vec3.set(J,S,x,O);for(var V=l+_,R=0,L=0;L<s.length;++L){N.Vec3.scaleAndAdd(ee,J,s[L],V);for(var U=!0,z=0;z<D.length;++z){var H=D[z];ne(re,n,H),N.Vec3.set($,f(re),p(re),m(re));var G=F[i[H]],W=(G+l)*(G+l);if(N.Vec3.squaredDistance(ee,$)<W){U=!1;break}}U&&++R}o[a[y]]+=u*R*V*V}}}(t,n,Math.min(n+5e3,r.length)),i.label=4;case 4:return n+=5e3,[3,1];case 5:return[2]}}))}))}var J=Object(N.Vec3)(),$=Object(N.Vec3)(),ee=Object(N.Vec3)(),te=q.d.Location.create(void 0),re=q.d.Location.create(void 0);function ne(e,t,r){return e.structure=t,e.unit=t.units[t.serialMapping.unitIndices[r]],e.element=t.serialMapping.elementIndices[r],e}var ie,ae={numberOfSpherePoints:P.ParamDefinition.Numeric(92,{min:12,max:360,step:1},{description:"Number of sphere points to sample per atom: 92 (original paper), 960 (BioJava), 3000 (EPPIC) - see Shrake A, Rupley JA: Environment and exposure to solvent of protein atoms. Lysozyme and insulin. J Mol Biol 1973."}),probeSize:P.ParamDefinition.Numeric(1.4,{min:.1,max:4,step:.01},{description:"Corresponds to the size of a water molecule: 1.4 (original paper), 1.5 (occassionally used)"}),nonPolymer:P.ParamDefinition.Boolean(!1,{description:"Include non-polymer atoms as occluders."})};!function(e){function t(e,t,n){return Object(C.__awaiter)(this,void 0,void 0,(function(){var i,a,o;return Object(C.__generator)(this,(function(s){switch(s.label){case 0:return function(e){var t=q.e.residue.key,r=q.e.atom,n=r.type_symbol,i=r.label_atom_id,a=r.label_comp_id,o=e.structure,s=e.atomRadiusType,u=e.serialResidueIndex,c=0,l=0,d=-1;X.structure=o;for(var f=0,p=0,m=o.units.length;f<m;++f){var h=o.units[f],g=h.elements;X.unit=h,c=-1;for(var v=0,b=g.length;v<b;++v){var y=g[v],_=p+v;X.element=y,c!==(l=t(X))&&++d,c=l;var S=n(X),x=Object(z.c)(S);if(Object(z.f)(x))s[_]=F[0],u[_]=-1;else{var O=Object(W.b)(h,y);if(2!==O&&(e.nonPolymer||Object(H.isPolymer)(O))){var w=i(X),C=a(X);Object(H.isNucleic)(O)?s[_]=Q(w,S,C):s[_]=5===O?Y(w,S,C):K(S),u[_]=d}else s[_]=F[0],u[_]=-1}}p+=g.length}}(i=function(e,t){var n=e.elementCount,i=e.atomicResidueCount,a=t.probeSize,o=t.nonPolymer,s=t.numberOfSpherePoints;return{structure:e,probeSize:a,nonPolymer:o,spherePoints:r(s),scalingConstant:4*Math.PI/s,maxLookupRadius:2*t.probeSize+2*F[2],atomRadiusType:new Int8Array(n),serialResidueIndex:new Int32Array(n),area:new Float32Array(i)}}(t,n)),[4,Z(e,i)];case 1:return s.sent(),a=i.area,o=i.serialResidueIndex,[2,{area:a,serialResidueIndex:o}]}}))}))}function r(e){for(var t=[],r=Math.PI*(3-Math.sqrt(5)),n=2/e,i=0;i<e;++i){var a=i*n-1+n/2,o=Math.sqrt(1-a*a),s=i*r;t[t.length]=N.Vec3.create(Math.cos(s)*o,a,Math.sin(s)*o)}return t}function n(e,t){return t/(U[e]||121)}function i(e,t){var r=e.structure.root.serialMapping.getSerialIndex,n=t.area,i=t.serialResidueIndex[r(e.unit,e.element)];return-1===i?-1:n[i]}function a(e,t){var r=i(e,t);return-1===r?-1:n(B.StructureProperties.atom.label_comp_id(e),r)}e.compute=function(e,r){var n=this;void 0===r&&(r={});var i=Object(C.__assign)(Object(C.__assign)({},P.ParamDefinition.getDefaultValues(ae)),r);return L.b.create("Compute Accessible Surface Area",(function(r){return Object(C.__awaiter)(n,void 0,void 0,(function(){return Object(C.__generator)(this,(function(n){switch(n.label){case 0:return[4,t(r,e,i)];case 1:return[2,n.sent()]}}))}))}))},e.normalize=n,e.getValue=i,e.getNormalizedValue=a,e.getFlag=function(e,t){var r=a(e,t);return-1===r?0:r<.16?1:2}}(ie||(ie={}));var oe=r(212),se=r(169),ue=r(19),ce=r(16),le=r(66),de=Object(C.__assign)({},ae),fe={isBuried:se.QuerySymbolRuntime.Dynamic(Object(ue.c)("computed","accessible-surface-area.is-buried",ce.a.Bool),(function(e){if(!B.Unit.isAtomic(e.element.unit))return!1;var t=pe.get(e.element.structure).value;return!!t&&1===ie.getFlag(e.element,t)})),isAccessible:se.QuerySymbolRuntime.Dynamic(Object(ue.c)("computed","accessible-surface-area.is-accessible",ce.a.Bool),(function(e){if(!B.Unit.isAtomic(e.element.unit))return!1;var t=pe.get(e.element.structure).value;return!!t&&2===ie.getFlag(e.element,t)}))},pe=oe.a.createProvider({label:"Accessible Surface Area",descriptor:Object(le.CustomPropertyDescriptor)({name:"molstar_accessible_surface_area",symbols:fe}),type:"root",defaultParams:de,getParams:function(e){return de},isApplicable:function(e){return!0},obtain:function(e,t,r){return Object(C.__awaiter)(void 0,void 0,void 0,(function(){var n,i;return Object(C.__generator)(this,(function(a){switch(a.label){case 0:return n=Object(C.__assign)(Object(C.__assign)({},P.ParamDefinition.getDefaultValues(de)),r),i={},[4,ie.compute(t,n).runInContext(e.runtime)];case 1:return[2,(i.value=a.sent(),i)]}}))}))}}),me=r(24),he=r(12),ge=Object(me.Color)(16448250),ve={list:P.ParamDefinition.ColorList("rainbow",{presetKind:"scale"})};var be={name:"accessible-surface-area",label:"Accessible Surface Area",category:"Residue Property",factory:function e(t,r){var n,i=me.ColorScale.create({listOrName:r.list.colors,minLabel:"buried",maxLabel:"exposed",domain:[0,1]}),a=t.structure&&pe.get(t.structure),o=a?Object(he.i)(a.id,a.version):-1;if((null==a?void 0:a.value)&&t.structure){var s=B.StructureElement.Location.create(t.structure),u=a.value,c=function(e){var t=ie.getNormalizedValue(e,u);return-1===t?ge:i.color(t)};n=function(e){return B.StructureElement.Location.is(e)&&B.Unit.isAtomic(e.unit)?c(e):B.Bond.isLocation(e)?(s.unit=e.aUnit,s.element=e.aUnit.elements[e.aIndex],c(s)):ge}}else n=function(){return ge};return{factory:e,granularity:"group",color:n,props:r,contextHash:o,description:"Assigns a color based on the relative accessible surface area of a residue.",legend:i?i.legend:void 0}},getParams:function(e){return ve},defaultValues:P.ParamDefinition.getDefaultValues(ve),isApplicable:function(e){return!!e.structure},ensureCustomProperties:{attach:function(e,t){return t.structure?pe.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&e.structure.customPropertyDescriptors.reference(pe.descriptor,!1)}}},ye=r(6),_e=r(29),Se=r(89),xe=r(10),Oe=u.a.create({name:"computed-accessible-surface-area-prop",category:"custom-props",display:{name:"Accessible Surface Area"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=pe,t.labelProvider={label:function(e){if(t.params.showTooltip)return we(e)}},t}return Object(C.__extends)(t,e),t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){se.DefaultQueryRuntimeTable.addCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(be),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.query.structure.registry.add(Pe),this.ctx.query.structure.registry.add(Ee)},t.prototype.unregister=function(){se.DefaultQueryRuntimeTable.removeCustomProp(this.provider.descriptor),this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(be),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.query.structure.registry.remove(Pe),this.ctx.query.structure.registry.remove(Ee)},t}(u.a.Handler),params:function(){return{autoAttach:P.ParamDefinition.Boolean(!1),showTooltip:P.ParamDefinition.Boolean(!0)}}});function we(e){if("element-loci"===e.kind){if(0===e.elements.length)return;if(!(l=pe.get(e.structure).value)||e.structure.customPropertyDescriptors.hasReference(pe.descriptor))return;for(var t=e.structure.root.serialMapping.getSerialIndex,r=l.area,n=l.serialResidueIndex,i=new Set,a=0,o=function(e,o){var s=o.elements;ye.OrderedSet.forEach(e,(function(e){var u=n[t(o,s[e])];-1===u||i.has(u)||(a+=r[u],i.add(u))}))},s=0,u=e.elements;s<u.length;s++){var c=u[s];o(c.indices,c.unit)}if(0===i.size)return;return"Accessible Surface Area "+("<small>("+i.size+" "+(i.size>1?"Residues sum":"Residue")+")</small>")+": "+a.toFixed(2)+" Å<sup>2</sup>"}if("structure-loci"===e.kind){var l;if(!(l=pe.get(e.structure).value)||e.structure.customPropertyDescriptors.hasReference(pe.descriptor))return;return"Accessible Surface Area <small>(Whole Structure)</small>: "+Object(_e.arraySum)(l.area).toFixed(2)+" Å<sup>2</sup>"}}var Ce,je,Pe=Object(Se.c)("Buried Protein Residues",xe.MolScriptBuilder.struct.modifier.union([xe.MolScriptBuilder.struct.modifier.wholeResidues([xe.MolScriptBuilder.struct.modifier.union([xe.MolScriptBuilder.struct.generator.atomGroups({"chain-test":xe.MolScriptBuilder.core.rel.eq([xe.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":fe.isBuried.symbol()})])])]),{description:"Select buried protein residues.",category:Se.a.Residue,ensureCustomProperties:function(e,t){return pe.attach(e,t)}}),Ee=Object(Se.c)("Accessible Protein Residues",xe.MolScriptBuilder.struct.modifier.union([xe.MolScriptBuilder.struct.modifier.wholeResidues([xe.MolScriptBuilder.struct.modifier.union([xe.MolScriptBuilder.struct.generator.atomGroups({"chain-test":xe.MolScriptBuilder.core.rel.eq([xe.MolScriptBuilder.ammp("objectPrimitive"),"atomistic"]),"residue-test":fe.isAccessible.symbol()})])])]),{description:"Select accessible protein residues.",category:Se.a.Residue,ensureCustomProperties:function(e,t){return pe.attach(e,t)}}),Ae=r(106),De=r(139),Te=r(264),Ie=r(338),Me=r(342),ke=u.a.create({name:"computed-interactions-prop",category:"custom-props",display:{name:"Interactions"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=Ae.a,t.labelProvider={label:function(e){if(t.params.showTooltip)switch(e.kind){case"element-loci":if(0===e.elements.length)return;for(var r=[],n=0,i=t.getStructures(e.structure);n<i.length;n++){var a=i[n],o=t.provider.get(a).value;if(o){var s=De.a.Loci.remap(e,a);if(1===s.elements.length){var u=s.elements[0];if(1===ye.OrderedSet.size(u.indices)){var c=o.unitsFeatures.get(u.unit.id);if(c){for(var l=[],d=[],f=[],p=ye.OrderedSet.start(u.indices),m=c.types,h=c.groups,g=c.elementsIndex,v=g.indices,b=g.offsets,y=b[p],_=b[p+1];y<_;++y){var S=v[y],x=m[S],O=h[S];x&&l.push(Object(Te.d)(x)),O&&d.push(Object(Te.c)(O))}l.length&&f.push("<small>Types</small> "+l.join(", ")),d.length&&f.push("<small>Groups</small> "+d.join(", ")),f.length&&r.push("Interaction Feature: "+f.join(" | "))}}}}}return r.length?r.join("<br/>"):void 0;default:return}}},t}return Object(C.__extends)(t,e),t.prototype.getStructures=function(e){var t=[],r=this.ctx.helpers.substructureParent.get(e);if(r)for(var n=0,i=this.ctx.state.data.select(V.StateSelection.Generators.ofType(l.a.Molecule.Structure,r.transform.ref));n<i.length;n++){var a=i[n];a.obj&&Object(_e.arraySetAdd)(t,a.obj.data)}return t},t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.representation.structure.themes.colorThemeRegistry.add(Ie.a),this.ctx.managers.lociLabels.addProvider(this.labelProvider),this.ctx.representation.structure.registry.add(Me.a)},t.prototype.unregister=function(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.representation.structure.themes.colorThemeRegistry.remove(Ie.a),this.ctx.managers.lociLabels.removeProvider(this.labelProvider),this.ctx.representation.structure.registry.remove(Me.a)},t}(u.a.Handler),params:function(){return{autoAttach:P.ParamDefinition.Boolean(!1),showTooltip:P.ParamDefinition.Boolean(!0)}}}),Be=r(181),Ve=u.a.create({name:"computed-secondary-structure-prop",category:"custom-props",display:{name:"Secondary Structure"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=Be.a,t}return Object(C.__extends)(t,e),t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach;return this.params.autoAttach=e.autoAttach,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach)},t.prototype.unregister=function(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name)},t}(u.a.Handler),params:function(){return{autoAttach:P.ParamDefinition.Boolean(!1)}}}),Re=r(239),Le=r(155),Ne=u.a.create({name:"computed-valence-model-prop",category:"custom-props",display:{name:"Valence Model"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=Re.a,t.labelProvider={label:function(e){if(t.params.showTooltip)switch(e.kind){case"element-loci":if(0===e.elements.length)return;for(var r=[],n=0,i=t.getStructures(e.structure);n<i.length;n++){var a=i[n],o=t.provider.get(a).value;if(o){var s=B.StructureElement.Loci.remap(e,a);if(1===s.elements.length){var u=s.elements[0];if(1===ye.OrderedSet.size(u.indices)){var c=o.get(u.unit.id);if(c){var l=ye.OrderedSet.start(u.indices),d=c.charge[l],f=c.idealGeometry[l],p=c.implicitH[l],m=c.totalH[l];r.push("Valence Model: <small>Charge</small> "+d+" | <small>Ideal Geometry</small> "+Object(Le.e)(f)+" | <small>Implicit H</small> "+p+" | <small>Total H</small> "+m)}}}}}return r.length?r.join("<br/>"):void 0;default:return}}},t}return Object(C.__extends)(t,e),t.prototype.getStructures=function(e){var t=[],r=this.ctx.helpers.substructureParent.get(e);if(r)for(var n=0,i=this.ctx.state.data.select(V.StateSelection.Generators.ofType(l.a.Molecule.Structure,r.transform.ref));n<i.length;n++){var a=i[n];a.obj&&Object(_e.arraySetAdd)(t,a.obj.data)}return t},t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach||this.params.showTooltip!==e.showTooltip;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customStructureProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.register=function(){this.ctx.customStructureProperties.register(this.provider,this.params.autoAttach),this.ctx.managers.lociLabels.addProvider(this.labelProvider)},t.prototype.unregister=function(){this.ctx.customStructureProperties.unregister(this.provider.descriptor.name),this.ctx.managers.lociLabels.removeProvider(this.labelProvider)},t}(u.a.Handler),params:function(){return{autoAttach:P.ParamDefinition.Boolean(!1),showTooltip:P.ParamDefinition.Boolean(!0)}}}),Fe=r(157);(je=Ce||(Ce={})).Descriptor={name:"ihm_cross_link_restraint"},je.Provider=Fe.a.create(je.Descriptor),je.fromTable=function(e,t){var r={entity_id:e.entity_id_1,asym_id:e.asym_id_1,seq_id:e.seq_id_1,atom_id:e.atom_id_1},n={entity_id:e.entity_id_2,asym_id:e.asym_id_2,seq_id:e.seq_id_2,atom_id:e.atom_id_2};function i(e,t,r){var n=e.get(t);n?n.push(r):e.set(t,[r])}function a(r,n){var a=n.entity_id.value(r),c=n.asym_id.value(r),l=n.seq_id.value(r);if("by-atom"===e.model_granularity.value(r)){var d=t.atomicHierarchy.index.findAtom({auth_seq_id:l,label_asym_id:c,label_atom_id:n.atom_id.value(r),label_entity_id:a});d>=0&&i(o,d,r)}else if(t.coarseHierarchy.isDefined){var f=t.coarseHierarchy.spheres.findSequenceKey(a,c,l);if(f>=0)i(s,f,r);else{var p=t.coarseHierarchy.gaussians.findSequenceKey(a,c,l);p>=0&&i(u,p,r)}}}for(var o=new Map,s=new Map,u=new Map,c=[],l=0;l<e._rowCount;++l)a(l,r),a(l,n);return{getIndicesByElement:function(e,t){var r=function(e){switch(e){case 0:return o;case 1:return s;case 2:return u}}(t).get(e);return void 0!==r?r:c},data:e}};var Ue=r(74),ze=r(41),He=r(38),Ge=r(53),qe=r(112),We=r(92),Xe=r(55),Ye=[];function Qe(e,t,r,n){return e+"|"+t.id+"|"+r+"|"+n.id}var Ke,Ze=function(){function e(e){this.pairs=e;var t=new Map;this.pairs.forEach((function(e,r){var n=Qe(e.indexA,e.unitA,e.indexB,e.unitB),i=t.get(n);i?i.push(r):t.set(n,[r])})),this.count=e.length,this.pairKeyIndices=t}return e.prototype.getPairIndices=function(e,t,r,n){var i=Qe(e,t,r,n);return this.pairKeyIndices.get(i)||Ye},e.prototype.getPairs=function(e,t,r,n){var i=this;return this.getPairIndices(e,t,r,n).map((function(e){return i.pairs[e]}))},e}(),Je=r(117),$e=r(201),et=r(77),tt=oe.a.createProvider({label:"Cross Link Restraint",descriptor:Object(le.CustomPropertyDescriptor)({name:"integrative-cross-link-restraint"}),type:"local",defaultParams:{},getParams:function(e){return{}},isApplicable:function(e){return e.models.some((function(e){return!!Ce.Provider.get(e)}))},obtain:function(e,t,r){return Object(C.__awaiter)(void 0,void 0,void 0,(function(){return Object(C.__generator)(this,(function(e){return[2,{value:ot(t)}]}))}))}});function rt(e,t,r){for(var n=t.elements,i=n.length,a=t.kind,o=function(t){var i=n[t];r.getIndicesByElement(i,a).forEach((function(r){return e.set(r,t)}))},s=0;s<i;s++)o(s)}function nt(e,t,r){if(t.model===r.model&&"mmCIF"===t.model.sourceData.kind){var n=Ce.Provider.get(t.model);if(n){var i=new Map,a=new Map;rt(i,t,n),rt(a,r,n),i.forEach((function(i,o){var s=a.get(o);void 0!==s&&e.push(at(t,i,r,s,n,o),at(r,s,t,i,n,o))}))}}}function it(e,t){if("mmCIF"===t.model.sourceData.kind){var r=Ce.Provider.get(t.model);if(r){for(var n=t.elements,i=n.length,a=t.kind,o=new Map,s=function(e){var t=n[e];r.getIndicesByElement(t,a).forEach((function(t){var r=o.get(t);r?r.push(e):o.set(t,[e])}))},u=0;u<i;u++)s(u);o.forEach((function(n,i){if(!(n.length<2)){var a=n[0],o=n[1];e.push(at(t,a,t,o,r,i),at(t,o,t,a,r,i))}}))}}}function at(e,t,r,n,i,a){return{unitA:e,indexA:t,unitB:r,indexB:n,restraintType:i.data.restraint_type.value(a),distanceThreshold:i.data.distance_threshold.value(a),psi:i.data.psi.value(a),sigma1:i.data.sigma_1.value(a),sigma2:i.data.sigma_2.value(a)}}function ot(e){var t=[];if(!e.models.some((function(e){return Ce.Provider.get(e)})))return new Ze(t);for(var r=e.units.length,n=0;n<r;++n){var i=e.units[n];it(t,i);for(var a=n+1;a<r;++a){var o=e.units[a];i.model===o.model&&nt(t,i,o)}}return new Ze(t)}function st(e,t,r,n,i){var a=tt.get(t).value;if(!a.count)return He.a.createEmpty(i);var o=n.sizeFactor,s=B.StructureElement.Location.create(t),u={linkCount:a.count,position:function(e,t,r){var n=a.pairs[r],i=n.unitA,o=n.unitB;i.conformation.position(i.elements[n.indexA],e),o.conformation.position(o.elements[n.indexB],t)},radius:function(e){var t=a.pairs[e];return s.unit=t.unitA,s.element=t.unitA.elements[t.indexA],r.size.size(s)*o}};return Object(qe.d)(e,u,n,i)}!function(e){!function(e){e.CrossLinkRestraint="cross-link-restraint"}(e.Tag||(e.Tag={})),e.isApplicable=function(e){return e.models.some((function(e){return!!Ce.Provider.get(e)}))};var t=Object(N.Vec3)(),r=Object(N.Vec3)();function n(e){return e.unitA.conformation.position(e.unitA.elements[e.indexA],t),e.unitB.conformation.position(e.unitB.elements[e.indexB],r),N.Vec3.distance(t,r)}function i(e,t){var r=e.pairs[t];return"Cross Link Restraint | Type: "+r.restraintType+" | Threshold: "+r.distanceThreshold+" Å | Psi: "+r.psi+" | Sigma 1: "+r.sigma1+" | Sigma 2: "+r.sigma2+" | Distance: "+n(r).toFixed(2)+" Å"}function a(e,t,r){return $e.a.fromPairProvider(t.length,(function(r,n,i){var a=e.pairs[t[r]];a.unitA.conformation.position(a.unitA.elements[a.indexA],n),a.unitB.conformation.position(a.unitB.elements[a.indexB],i)}),r)}function o(e,t,r){var n=r[0];if(void 0===n)return"";var a=t.pairs[n];return[i(t,n),Object(et.bondLabel)(B.Bond.Location(e,a.unitA,a.indexA,e,a.unitB,a.indexB))].join("</br>")}e.distance=n,e.Location=function(e,t,r){return Object(Je.a)("cross-link-restraints",{structure:t,crossLinkRestraints:e},r)},e.isLocation=function(e){return!!e&&"data-location"===e.kind&&"cross-link-restraints"===e.tag},e.areLocationsEqual=function(e,t){return e.data.structure===t.data.structure&&e.data.crossLinkRestraints===t.data.crossLinkRestraints&&e.element===t.element},e.locationLabel=function(e){return i(e.data.crossLinkRestraints,e.element)},e.Loci=function(e,t,r){return Object(j.DataLoci)("cross-link-restraints",{structure:e,crossLinkRestraints:t},r,(function(e){return a(t,r,e)}),(function(){return o(e,t,r)}))},e.isLoci=function(e){return!!e&&"data-loci"===e.kind&&"interactions"===e.tag},e.getBoundingSphere=a,e.getLabel=o}(Ke||(Ke={}));var ut=Object(C.__assign)(Object(C.__assign)(Object(C.__assign)({},We.g),qe.a),{sizeFactor:P.ParamDefinition.Numeric(.5,{min:0,max:10,step:.1})});function ct(e){return Object(We.h)({defaultProps:P.ParamDefinition.getDefaultValues(ut),createGeometry:st,createLocationIterator:lt,getLoci:dt,eachLocation:ft,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments||t.linkCap!==r.linkCap}},e)}function lt(e){var t=tt.get(e).value,r=t.pairs.length,n=Ke.Location(t,e);return Object(Ge.a)(r,1,1,(function(e){return n.element=e,n}),!0)}function dt(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=tt.get(t).value;if(a.pairs[i])return Ke.Loci(t,a,[i])}return j.EmptyLoci}function ft(e,t,r){var n=!1;if(Ke.isLoci(e)){if(!B.Structure.areEquivalent(e.data.structure,t))return!1;var i=tt.get(t).value;if(e.data.crossLinkRestraints!==i)return!1;for(var a=0,o=e.elements;a<o.length;a++){var s=o[a];r(ye.Interval.ofSingleton(s))&&(n=!0)}}return n}var pt={"cross-link-restraint":function(e,t){return Object(Xe.a)("Cross-link restraint",e,t,ct)}},mt=Object(C.__assign)({},ut);var ht=Object(Xe.b)({name:Ke.Tag.CrossLinkRestraint,label:"Cross Link Restraint",description:"Displays cross-link restraints.",factory:function(e,t){return ze.a.createMulti("CrossLinkRestraint",e,t,Xe.c,pt)},getParams:function(e,t){return P.ParamDefinition.clone(mt)},defaultValues:P.ParamDefinition.getDefaultValues(mt),defaultColorTheme:{name:Ke.Tag.CrossLinkRestraint},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return Ke.isApplicable(e)},ensureCustomProperties:{attach:function(e,t){return tt.attach(e,t,void 0,!0)},detach:function(e){return tt.ref(e,!1)}}}),gt=Object(me.Color)(13421772),vt={domain:P.ParamDefinition.Interval([.5,1.5],{step:.01}),list:P.ParamDefinition.ColorList("red-grey",{presetKind:"scale"})};var bt={name:"cross-link",label:"Cross Link",category:"Miscellaneous",factory:function e(t,r){var n,i=void 0,a=t.structure&&tt.get(t.structure).value;if(a){var o=(i=me.ColorScale.create({domain:r.domain,listOrName:r.list.colors})).color;n=function(e){if(Ke.isLocation(e)){var t=a.pairs[e.element];if(t)return o(Ke.distance(t)/t.distanceThreshold)}return gt}}else n=function(){return gt};return{factory:e,granularity:"group",color:n,props:r,description:"Colors cross-links by the deviation of the observed distance versus the modeled distance (e.g. modeled / `ihm_cross_link_restraint.distance_threshold`).",legend:i?i.legend:void 0}},getParams:function(e){return vt},defaultValues:P.ParamDefinition.getDefaultValues(vt),isApplicable:function(e){return!!e.structure&&Ke.isApplicable(e.structure)},ensureCustomProperties:{attach:function(e,t){return t.structure?tt.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&e.structure.customPropertyDescriptors.reference(tt.descriptor,!1)}}},yt=u.a.create({name:"integrative-cross-link-restraint",category:"custom-props",display:{name:"Cross Link Restraint"},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=Ce.Provider,t}return Object(C.__extends)(t,e),t.prototype.register=function(){this.provider.formatRegistry.add("mmCIF",_t),this.ctx.representation.structure.themes.colorThemeRegistry.add(bt),this.ctx.representation.structure.registry.add(ht)},t.prototype.unregister=function(){this.provider.formatRegistry.remove("mmCIF"),this.ctx.representation.structure.themes.colorThemeRegistry.remove(bt),this.ctx.representation.structure.registry.remove(ht)},t}(u.a.Handler)});function _t(e){if(Ue.a.is(e.sourceData)){var t=e.sourceData.data.db.ihm_cross_link_restraint;if(0!==t._rowCount)return Ce.fromTable(t,e)}}var St={State:c,Representation:n,Camera:i,Misc:a},xt={Representation:w,Camera:o,CustomProps:s}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(20),i=function(e){function t(t,r,n){var i=e.call(this)||this;return i.parent=t,i.outerValue=r,i.outerIndex=n,i.index=0,i}return n.a(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(r(34).a),a=r(259),o=r(45);function s(e,t,r,n,s){if(void 0===s&&(s=new i(e,r,n)),!s.closed)return t instanceof o.a?t.subscribe(s):Object(a.a)(t)(s)}},function(e,t,r){"use strict";function n(e,t,r){var n,i=1;for(n=0;n<t;n++){var a=i*e;if(Math.abs(Math.round(a)-a)<=r)return n;i*=10}return-1}function i(e,t){return Math.abs(e)<t?0:Math.floor(Math.log10(Math.abs(e)))+1}function a(e,t,r){for(var i=1,a=0,o=0,s=e.length;o<s;o++){if(i>=0){var u=n(e[o],t,r);u<0?i=-1:u>i&&(i=u)}var c=Math.abs(e[o]);if(c>r){var l=Math.floor(Math.log10(Math.abs(c)))+1;l>a&&(a=l)}}return{mantissaDigits:i,integerDigits:a}}function o(e){e=e.trim();var t=parseInt(e,10);return!isNaN(t)&&t.toString()===e}function s(e){if(!isFinite(e))return 0;for(var t=1,r=0;Math.round(e*t)/t!==e;)t*=10,++r;return r}function u(e,t){return parseFloat(e.toPrecision(t))}r.d(t,"c",(function(){return i})),r.d(t,"a",(function(){return a})),r.d(t,"d",(function(){return o})),r.d(t,"b",(function(){return s})),r.d(t,"e",(function(){return u}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return s})),r.d(t,"c",(function(){return d}));var n=r(70),i=r(322),a=r(1);Object(i.b)(10001);function o(e,t,r){return e=Object(n.a)(e,0,16777215)+1,t[r+2]=e%256,e=Math.floor(e/256),t[r+1]=e%256,e=Math.floor(e/256),t[r]=e%256,t}function s(e,t,r){return 256*Math.floor(e)*256+256*Math.floor(t)+Math.floor(r)-1}var u=a.Vec3.create(16777216,65536,256),c=a.Vec4.create(255/256/u[0],255/256/u[1],255/256/u[2],255/256/1),l=Object(a.Vec4)();function d(e,t,r,n){return a.Vec4.set(l,e/255,t/255,r/255,n/255),a.Vec4.dot(l,c)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return N}));var n=r(0),i=r(365),a=r(22),o=r(2),s=r(1),u=r(44);var c=r(145),l=-27.888;function d(e,t,r,n){var i=s.Vec3.distance(e,n),a=s.Vec3.distance(t,n),o=s.Vec3.distance(t,r),u=s.Vec3.distance(e,r),c=l/i-l/a+(l/o-l/u);return c<-9.9?-9.9:c}function f(e,t,r){for(var n=t.residueIndices,i=t.cIndices,a=t.hIndices,o=t.nIndices,u=t.oIndices,l=e.model.atomicHierarchy.index,f=e.conformation.invariantPosition,p=e.model.atomicHierarchy.derived.residue.traceElementIndex,m=n.length,h=[],g=[],v=[],b=Object(s.Vec3)(),y=Object(s.Vec3)(),_=Object(s.Vec3)(),S=Object(s.Vec3)(),x=Object(s.Vec3)(),O=Object(s.Vec3)(),w=Object(s.Vec3)(),C=0,j=n.length;C<j;++C){var P=C,E=n[C],A=u[P],D=i[P],T=p[E];if(-1!==A&&-1!==D&&-1===l.findAtomOnResidue(E,"OXT")){f(A,b),f(D,y),f(T,_);for(var I=r.find(_[0],_[1],_[2],9),M=I.indices,k=I.count,B=0;B<k;++B){var V=M[B];if(V!==P&&V-1!==P&&V+1!==P){var R=o[V];if(-1!==R){f(R,S);var L=a[V];if(-1===L){if(0===V)continue;var N=V-1,F=u[N],U=i[N];if(-1===F||-1===U)continue;f(F,w),f(U,O),s.Vec3.sub(x,O,w);var z=s.Vec3.distance(w,O);s.Vec3.scaleAndAdd(x,S,x,1/z)}else f(L,x);var H=d(b,y,S,x);H>-.5||(h[h.length]=P,g[g.length]=V,v[v.length]=H)}}}}}return function(e,t,r,n){for(var i=new c.a.DirectedEdgeBuilder(e,t,r),a=new Float32Array(i.slotCount),o=0,s=i.edgeCount;o<s;o++)i.addNextEdge(),i.assignProperty(a,n[o]);return i.createGraph({energies:n})}(m,h,g,v)}var p,m,h=r(5);(m=p||(p={})).is=h.a.has,m.create=h.a.create;var g=function(e,t,r){this.partner1=Math.min(e,t),this.partner2=Math.max(e,t),this.type=r};function v(e,t){if(t.type!==e.type)return!1;if(t.partner1!==e.firstEnd+1)return!1;if(0===t.type){if(t.partner2===e.secondEnd+1)return!0}else if(t.partner2===e.secondStart-1)return!0;return!1}function b(e,t){return e.type===t.type&&t.firstStart-e.firstEnd<6&&e.firstStart<t.firstStart&&0===t.nextLadder&&(0===e.type?y(e,t):y(t,e))}function y(e,t){return t.secondStart-e.secondEnd>0&&(t.secondStart-e.secondEnd<6&&t.firstStart-e.firstEnd<3||t.secondStart-e.secondEnd<3)}function _(e){return p.is(e,8)||p.is(e,1)||p.is(e,16)}var S=r(9),x=r(6),O=r(203);var w={oldDefinition:o.ParamDefinition.Boolean(!0,{description:"Whether to use the old DSSP convention for the annotation of turns and helices, causes them to be two residues shorter"}),oldOrdering:o.ParamDefinition.Boolean(!0,{description:"Alpha-helices are preferred over 3-10 helices"})};function C(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,a,o,c,l,d,m,h,y,w,C,I,M,k,B,V,R,L,N,F,U;return Object(n.__generator)(this,(function(n){for(r=function(e){for(var t=e.model.atomicHierarchy.index,r=e.proteinElements,n=e.residueIndex,i=r.length,a=new Uint32Array(i),o=new Int32Array(i),s=new Int32Array(i),u=new Int32Array(i),c=new Int32Array(i),l=0;l<i;++l){var d=n[r[l]];a[l]=d,o[l]=t.findAtomOnResidue(d,"C"),s[l]=t.findAtomOnResidue(d,"H"),u[l]=t.findAtomOnResidue(d,"O"),c[l]=t.findAtomOnResidue(d,"N")}return{residueIndices:x.SortedArray.ofSortedArray(a),cIndices:o,hIndices:s,oIndices:u,nIndices:c}}(e),a=r.residueIndices,o=function(e,t){for(var r=e.model.atomicConformation,n=r.x,i=r.y,a=r.z,o=e.model.atomicHierarchy.derived.residue.traceElementIndex,s=new Uint32Array(t.length),u=0,c=t.length;u<c;++u)s[u]=o[t[u]];var l={x:n,y:i,z:a,indices:x.SortedArray.ofSortedArray(s)};return Object(S.c)(l,Object(O.a)(l))}(e,a),c=f(e,r,o),l=a.length,d=new Uint32Array(l),m=function(e,t){var r=t.cIndices,n=t.nIndices,i=t.residueIndices,a=e.conformation.position,o=e.model.atomicHierarchy.index,c=e.model.atomicHierarchy.derived.residue.traceElementIndex,l=i.length,d=function(e,t){return-1===e?s.Vec3.setNaN(t):a(e,t)},f=Object(s.Vec3)(),p=Object(s.Vec3)(),m=Object(s.Vec3)(),h=Object(s.Vec3)(),g=Object(s.Vec3)(),v=Object(s.Vec3)(),b=Object(s.Vec3)(),y=Object(s.Vec3)(),_=Object(s.Vec3)();if(0===l)return{phi:new Float32Array(0),psi:new Float32Array(0)};var S=new Float32Array(l-1),x=new Float32Array(l-1);d(-1,f),d(-1,p),d(-1,m),d(r[0],h),d(c[i[0]],g),d(n[0],v),d(r[1],b),d(c[i[1]],y),d(n[1],_);for(var O=0;O<l-1;++O)-1===o.findAtomOnResidue(i[O],"OXT")&&(S[O]=Object(u.f)(s.Vec3.dihedralAngle(f,v,g,h)),x[O]=Object(u.f)(s.Vec3.dihedralAngle(v,g,h,_)),f=h,p=g,m=v,h=b,g=y,v=_,d(r[O+1],b),d(c[i[O+1]],y),d(n[O+1],_));return{phi:S,psi:x}}(e,r),h=[],y=[],w=t.oldDefinition?E:D,C=t.oldOrdering?A:T,function(e){for(var t=e.proteinInfo,r=e.hbonds,n=e.flags,i=[1024,2048,4096,128,256,512],a=0;a<3;a++)for(var o=0,s=t.residueIndices.length-1;o<s;++o)if(-1!==r.getDirectedEdgeIndex(o,o+a+3))if(n[o]|=i[a+3]|i[a],e.params.oldDefinition)for(var u=1;u<a+3;++u)n[o+u]|=64|i[a+3];else for(u=0;u<=a+3;++u)n[o+u]|=64|i[a+3]}(I={params:t,getResidueFlag:w,getFlagName:C,unit:e,proteinInfo:r,flags:d,hbonds:c,torsionAngles:m,ladders:h,bridges:y}),function(e){for(var t=e.proteinInfo,r=e.flags,n=t.residueIndices.length,i=[1024,2048,4096,128,256,512],a=[0,0,0,8,1,16],o=e.params.oldOrdering?[4,3,5]:[3,4,5],s=0;s<o.length;s++)for(var u=o[s],c=1,l=n-u;c<l;c++){var d=p.create(r[c]),f=p.create(r[c-1]),m=p.create(r[c+1]);if(e.params.oldOrdering){if(3===u&&(p.is(d,1)||p.is(m,1))||5===u&&(p.is(d,1)||p.is(d,8)||p.is(m,1)||p.is(m,8)))continue}else if(4===u&&(p.is(d,8)||p.is(m,8))||5===u&&(p.is(d,1)||p.is(d,8)||p.is(m,1)||p.is(m,8)))continue;if(p.is(d,i[u])&&p.is(d,i[u-3])&&p.is(f,i[u])&&p.is(f,i[u-3]))if(e.params.oldDefinition)for(var h=0;h<u;h++)r[c+h]|=a[u];else for(h=-1;h<=u;h++)r[c+h]|=a[u]}}(I),function(e){var t=e.unit,r=e.flags,n=e.proteinInfo,i=t.conformation.position,a=t.model.atomicHierarchy.derived.residue.traceElementIndex,o=n.residueIndices,c=n.nIndices,l=o.length,d=function(e,t){return-1===e?s.Vec3.setNaN(t):i(e,t)},f=Object(s.Vec3)(),p=Object(s.Vec3)(),m=Object(s.Vec3)(),h=Object(s.Vec3)(),g=Object(s.Vec3)(),v=Object(s.Vec3)(),b=Object(s.Vec3)();e:for(var y=2;y<l-2;y++){for(var _=0;_<4;_++){var S=y+_-2;if(d(a[S],h),d(c[S+1],g),s.Vec3.squaredDistance(h,g)>6.25)continue e}var x=o[y-2],O=o[y],w=o[y+2],C=a[x],j=a[O],P=a[w];d(C,f),d(j,p),d(P,m),s.Vec3.sub(v,f,p),s.Vec3.sub(b,p,m);var E=Object(u.f)(s.Vec3.angle(v,b));E&&E>70&&(r[y]|=32)}}(I),function(e){for(var t,r,n=e.proteinInfo,i=e.hbonds,a=e.flags,o=e.bridges,s=i.offset,u=i.b,c=0,l=n.residueIndices.length;c<l;++c)for(var d=s[c],f=s[c+1];d<f;d++){var p=u[d];c>p||((t=c+1)!==(r=p)&&-1!==i.getDirectedEdgeIndex(r,t+1)&&(a[t]|=2,a[r]|=2,o[o.length]=new g(t,r,0)),(t=c)!==(r=p-1)&&-1!==i.getDirectedEdgeIndex(r-1,t)&&(a[t]|=2,a[r]|=2,o[o.length]=new g(r,t,0)),(t=c)!==(r=p)&&-1!==i.getDirectedEdgeIndex(r,t)&&(a[t]|=2,a[r]|=2,o[o.length]=new g(r,t,1)),(t=c+1)!==(r=p-1)&&-1!==i.getDirectedEdgeIndex(r-1,t+1)&&(a[t]|=2,a[r]|=2,o[o.length]=new g(r,t,1)))}o.sort((function(e,t){return e.partner1>t.partner1?1:e.partner1<t.partner1?-1:0}))}(I),function(e){for(var t=e.bridges,r=e.ladders,n=0;n<t.length;n++){for(var i=t[n],a=!1,o=0;o<r.length;o++){var s=r[o];v(s,i)&&(a=!0,s.firstEnd++,0===i.type?s.secondEnd++:s.secondStart--)}a||(r[r.length]={previousLadder:0,nextLadder:0,firstStart:i.partner1,firstEnd:i.partner1,secondStart:i.partner2,secondEnd:i.partner2,type:i.type})}for(var u=0;u<r.length;u++)for(var c=r[u],l=u;l<r.length;l++){var d=r[l];b(c,d)&&(c.nextLadder=l,d.previousLadder=u)}}(I),function(e){for(var t=e.ladders,r=e.flags,n=0;n<t.length;n++){for(var i=t[n],a=i.firstStart;a<=i.firstEnd;a++){var o=i.firstStart-a,s=i.secondStart-o;i.firstStart!==i.firstEnd?(r[a]|=4,r[s]|=4):(!_(r[a])&&p.is(r[a],4)&&(r[a]|=2),!_(r[s])&&p.is(r[s],4)&&(r[s]|=2))}if(0!==i.nextLadder){var u=t[i.nextLadder];for(a=i.firstStart;a<=u.firstEnd;a++)r[a]|=4;if(0===i.type)for(a=i.secondStart;a<=u.secondEnd;a++)r[a]|=4;else for(a=u.secondEnd;a<=i.secondStart;a++)r[a]|=4}}}(I),M=function(e,t){for(var r=new Uint32Array(e.length),n=0,i=e.length;n<i;++n){var a=p.create(e[n]);r[n]=t(a)}return r}(d,w),k=new Uint32Array(l),B=[],V=[],R=function(e){return x.SortedArray.indexOf(a,e)},L=0,N=a.length;L<N;++L)F=M[L],k[L]=F,U=w(d[L]),0!==V.length&&U===V[V.length-1].flags||(V[V.length]=j(P(F),d[L],w)),B[L]=V.length-1;return[2,Object(i.a)(k,B,V,R)]}))}))}function j(e,t,r){return"helix"===e?{kind:"helix",flags:r(t)}:"sheet"===e?{kind:"sheet",flags:r(t)}:"turn"===e||"bend"===e?{kind:"turn",flags:r(t)}:{kind:"none"}}function P(e){return e===a.SecondaryStructureType.SecondaryStructureDssp.H||e===a.SecondaryStructureType.SecondaryStructureDssp.G||e===a.SecondaryStructureType.SecondaryStructureDssp.I?"helix":e===a.SecondaryStructureType.SecondaryStructureDssp.B||e===a.SecondaryStructureType.SecondaryStructureDssp.E?"sheet":e===a.SecondaryStructureType.SecondaryStructureDssp.T?"turn":e===a.SecondaryStructureType.SecondaryStructureDssp.S?"bend":"none"}function E(e){return p.is(e,1)?a.SecondaryStructureType.SecondaryStructureDssp.H:p.is(e,4)?a.SecondaryStructureType.SecondaryStructureDssp.E:p.is(e,2)?a.SecondaryStructureType.SecondaryStructureDssp.B:p.is(e,8)?a.SecondaryStructureType.SecondaryStructureDssp.G:p.is(e,16)?a.SecondaryStructureType.SecondaryStructureDssp.I:p.is(e,64)?a.SecondaryStructureType.SecondaryStructureDssp.T:p.is(e,32)?a.SecondaryStructureType.SecondaryStructureDssp.S:0}function A(e){return p.is(e,1)?"H":p.is(e,4)?"E":p.is(e,2)?"B":p.is(e,8)?"G":p.is(e,16)?"I":p.is(e,64)?"T":p.is(e,32)?"S":"-"}function D(e){return p.is(e,16)?a.SecondaryStructureType.SecondaryStructureDssp.I:p.is(e,1)?a.SecondaryStructureType.SecondaryStructureDssp.H:p.is(e,4)?a.SecondaryStructureType.SecondaryStructureDssp.E:p.is(e,2)?a.SecondaryStructureType.SecondaryStructureDssp.B:p.is(e,8)?a.SecondaryStructureType.SecondaryStructureDssp.G:p.is(e,64)?a.SecondaryStructureType.SecondaryStructureDssp.T:p.is(e,32)?a.SecondaryStructureType.SecondaryStructureDssp.S:0}function T(e){return p.is(e,16)?"I":p.is(e,1)?"H":p.is(e,4)?"E":p.is(e,2)?"B":p.is(e,8)?"G":p.is(e,64)?"T":p.is(e,32)?"S":"-"}var I=r(28),M=r(212),k=r(287),B=r(66),V=r(192);function R(e){var t="model";if(e){t="dssp";for(var r=0,n=e.models.length;r<n;++r){var i=e.models[r];if(V.b.isFromPdbArchive(i)||V.b.hasSecondaryStructure(i)){t="model";break}}}return{type:o.ParamDefinition.MappedStatic(t,{model:o.ParamDefinition.EmptyGroup({label:"Model"}),dssp:o.ParamDefinition.Group(w,{label:"DSSP",isFlat:!0})},{options:[["model","Model"],["dssp","DSSP"]]})}}var L=R(),N=M.a.createProvider({label:"Secondary Structure",descriptor:Object(B.CustomPropertyDescriptor)({name:"molstar_computed_secondary_structure"}),type:"root",defaultParams:L,getParams:R,isApplicable:function(e){return!0},obtain:function(e,t,r){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var e,i,a;return Object(n.__generator)(this,(function(s){switch(s.label){case 0:switch(e=Object(n.__assign)(Object(n.__assign)({},o.ParamDefinition.getDefaultValues(L)),r),e.type.name){case"dssp":return[3,1];case"model":return[3,3]}return[3,5];case 1:return i={},[4,F(t,e.type.params)];case 2:return[2,(i.value=s.sent(),i)];case 3:return a={},[4,U(t)];case 4:return[2,(a.value=s.sent(),a)];case 5:return[2]}}))}))}});function F(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,s;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:r=new Map,i=0,a=e.unitSymmetryGroups.length,n.label=1;case 1:return i<a?(o=e.unitSymmetryGroups[i].units[0],I.g.isAtomic(o)?[4,C(o,t)]:[3,3]):[3,4];case 2:s=n.sent(),r.set(o.invariantId,s),n.label=3;case 3:return++i,[3,1];case 4:return[2,r]}}))}))}function U(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,o;return Object(n.__generator)(this,(function(n){for(t=new Map,r=0,i=e.unitSymmetryGroups.length;r<i;++r)a=e.unitSymmetryGroups[r].units[0],I.g.isAtomic(a)&&(o=k.a.Provider.get(a.model))&&t.set(a.invariantId,o);return[2,t]}))}))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){e&&(new Error).stack;n=e},get useDeprecatedSynchronousErrorHandling(){return n}}},function(e,t,r){"use strict";r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return y}));var n,i=r(0),a=r(17),o=r(325),s=r(161),u=r(119),c="undefined"==typeof document?r(431):XMLHttpRequest;function l(e,t){return g(e,t)}function d(e){return"string"==typeof e?b(e,e,"string"):b(e.title,e.url,e.type||"string",e.body,e.headers)}function f(e){return e?"Failed to download data. Possible reasons: Resource is not available, or CORS is not allowed on the server.":"Failed to open file."}function p(e,t,r){return new Promise((function(n,i){if(function(e){if(e instanceof FileReader)return e.readyState===FileReader.DONE;if(e instanceof XMLHttpRequest)return e.readyState===XMLHttpRequest.DONE;throw new Error("unknown data type")}(r)){var a=r.error;null!=a?i(null!=a?a:f(r instanceof XMLHttpRequest)):n(r)}else{var o=!1;r.onerror=function(e){if(!o){var t=e.target.error;i(null!=t?t:f(r instanceof XMLHttpRequest))}},r.onprogress=function(r){if(e.shouldUpdate&&!o)try{r.lengthComputable?e.update({message:t,isIndeterminate:!1,current:r.loaded,max:r.total}):e.update({message:t+" "+(r.loaded/1024/1024).toFixed(2)+" MB",isIndeterminate:!0})}catch(r){o=!0,i(r)}},r.onload=function(e){n(r)}}}))}function m(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var a,s;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:switch(r){case n.None:return[3,1];case n.Gzip:return[3,2];case n.Zip:return[3,3]}return[3,5];case 1:return[2,t];case 2:return[2,Object(o.a)(e,t)];case 3:return[4,Object(o.b)(e,t.buffer)];case 4:if(a=i.sent(),1!==(s=Object.keys(a)).length)throw new Error("can only decompress zip files with a single entry");return[2,a[s[0]]];case 5:return[2]}}))}))}function h(e,t,r,a){return Object(i.__awaiter)(this,void 0,void 0,(function(){var u,c,l;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if(u=t.result,null===(c=u instanceof ArrayBuffer?new Uint8Array(u):u))throw new Error("no data given");if(a===n.None)return[3,4];if(!(c instanceof Uint8Array))throw new Error("need Uint8Array for decompression");return[4,m(e,c,a)];case 1:return l=i.sent(),"string"!==r?[3,3]:[4,e.update({message:"Decoding text..."})];case 2:return i.sent(),c=Object(s.b)(l,0,l.length),[3,4];case 3:c=l,i.label=4;case 4:return"binary"===r&&c instanceof Uint8Array?[2,c]:[3,5];case 5:return"zip"===r&&c instanceof Uint8Array?[4,Object(o.b)(e,c.buffer)]:[3,7];case 6:return[2,i.sent()];case 7:if("string"===r&&"string"==typeof c)return[2,c];if("xml"===r&&"string"==typeof c)return[2,(new DOMParser).parseFromString(c,"application/xml")];if("json"===r&&"string"==typeof c)return[2,JSON.parse(c)];i.label=8;case 8:throw new Error("could not get requested response data '"+r+"'")}}))}))}function g(e,t){var r=this,o=void 0;return a.b.create("Read File",(function(a){return Object(i.__awaiter)(r,void 0,void 0,(function(){var r,s;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return i.trys.push([0,,5,6]),o=new FileReader,r="zip"===t?n.None:(u=e.name,/\.gz$/i.test(u)?n.Gzip:/\.zip$/i.test(u)?n.Zip:n.None),"binary"===t||"zip"===t||r!==n.None?o.readAsArrayBuffer(e):o.readAsText(e),[4,a.update({message:"Opening file...",canAbort:!0})];case 1:return i.sent(),[4,p(a,"Reading...",o)];case 2:return s=i.sent(),[4,a.update({message:"Processing file...",canAbort:!1})];case 3:return i.sent(),[4,h(a,s,t,r)];case 4:return[2,i.sent()];case 5:return o=void 0,[7];case 6:return[2]}var u}))}))}),(function(){o&&o.abort()}))}!function(e){e[e.None=0]="None",e[e.Gzip=1]="Gzip",e[e.Zip=2]="Zip"}(n||(n={}));var v=function(){function e(){}return e.get=function(){return this.pool.length?this.pool.pop():new c},e.emptyFunc=function(){},e.deposit=function(t){this.pool.length<this.poolSize&&(t.onabort=e.emptyFunc,t.onerror=e.emptyFunc,t.onload=e.emptyFunc,t.onprogress=e.emptyFunc,this.pool.push(t))},e.pool=[],e.poolSize=15,e}();function b(e,t,r,n,o){var s=this,u=void 0;return a.b.create(e||"Download",(function(e){return Object(i.__awaiter)(s,void 0,void 0,(function(){var a,s,c,l,d,f;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if((u=v.get()).open(n?"post":"get",t,!0),o)for(a=0,s=o;a<s.length;a++)c=s[a],l=c[0],d=c[1],u.setRequestHeader(l,d);return u.responseType=function(e){switch(e){case"json":return"json";case"xml":return"document";case"string":return"text";case"binary":case"zip":return"arraybuffer"}}(r),u.send(n),[4,e.update({message:"Waiting for server...",canAbort:!0})];case 1:return i.sent(),[4,p(e,"Downloading...",u)];case 2:return f=i.sent(),u=void 0,[4,e.update({message:"Parsing response...",canAbort:!1})];case 3:return i.sent(),[2,function(e,t){if(e.status>=200&&e.status<400){var r=e.response;if(v.deposit(e),("binary"===t||"zip"===t)&&r instanceof ArrayBuffer)return new Uint8Array(r);if("string"===t&&"string"==typeof r)return r;if("xml"===t&&r instanceof XMLDocument)return r;if("json"===t&&"object"==typeof r)return r;throw new Error("could not get requested response data '"+t+"'")}throw v.deposit(e),new Error("Download failed with status code "+e.status)}(f,r)]}}))}))}),(function(){u&&(u.abort(),u=void 0)}))}function y(e,t,r,n){return Object(i.__awaiter)(this,void 0,void 0,(function(){var a,o,s,c,l,d,f,p,m,h,g,v;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return a=r.length,o=new Array(r.length),[4,e.update({message:"Downloading...",current:0,max:a})];case 1:for(i.sent(),s=[],c=[],l=0,d=Math.min(a,n);l<d;l++)g=r[l],s.push(S(l,g.id,t.resolve(u.Asset.getUrlAsset(t,g.url),g.isBinary?"binary":"string").runAsChild(e))),c.push(l);f=0,i.label=2;case 2:return s.length>0?[4,Promise.race(s)]:[3,6];case 3:if(p=i.sent(),m=r[p.index],h=c.indexOf(p.index),f++,"error"===p.kind&&!m.canFail)throw new Error(m.url+": "+p.error);return e.shouldUpdate?[4,e.update({message:"Downloading...",current:f,max:a})]:[3,5];case 4:i.sent(),i.label=5;case 5:return o[p.index]=p,s=s.filter(_,h),c=c.filter(_,h),l<a&&(g=r[l],v=t.resolve(u.Asset.getUrlAsset(t,g.url),g.isBinary?"binary":"string").runAsChild(e),s.push(S(l,g.id,v)),c.push(l),l++),[3,2];case 6:return[2,o]}}))}))}function _(e,t){return this!==t}function S(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){return Object(i.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,r];case 1:return[2,{kind:"ok",result:n.sent(),index:e,id:t}];case 2:return[2,{kind:"error",error:n.sent(),index:e,id:t}];case 3:return[2]}}))}))}},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"f",(function(){return u})),r.d(t,"e",(function(){return c})),r.d(t,"d",(function(){return d})),r.d(t,"a",(function(){return f})),r.d(t,"c",(function(){return h}));var n,i,a=r(24),o=Object(a.ColorMap)({Blue:37052,Green:42577,Yellow:16765952,Orange:16021792,Pink:16162465,Purple:10830745,LightBlue:9424105,Brown:10582605,Red:15539236,Secondary:15854817});(n={})[0]="Hexose",n[1]="HexNAc",n[2]="Hexosamine",n[3]="Hexuronate",n[4]="Deoxyhexose",n[5]="DeoxyhexNAc",n[6]="Di-deoxyhexose",n[7]="Pentose",n[8]="Deoxynonulosonate",n[9]="Di-deoxynonulosonate",n[10]="Unknown",n[11]="Assigned";var s=((i={})[0]=0,i[1]=1,i[2]=2,i[3]=3,i[4]=4,i[5]=5,i[6]=6,i[7]=7,i[8]=8,i[9]=9,i[10]=10,i[11]=11,i);function u(e,t){return 10===e?4===t?12:5===t?13:6===t?14:7===t?15:10:s[e]}var c={abbr:"Unk",name:"Unknown",color:o.Secondary,type:10},l=[{abbr:"Glc",name:"Glucose",color:o.Blue,type:0},{abbr:"Man",name:"Mannose",color:o.Green,type:0},{abbr:"Gal",name:"Galactose",color:o.Yellow,type:0},{abbr:"Gul",name:"Gulose",color:o.Orange,type:0},{abbr:"Alt",name:"Altrose",color:o.Pink,type:0},{abbr:"All",name:"Allose",color:o.Purple,type:0},{abbr:"Tal",name:"Talose",color:o.LightBlue,type:0},{abbr:"Ido",name:"Idose",color:o.Brown,type:0},{abbr:"GlcNAc",name:"N-Acetyl Glucosamine",color:o.Blue,type:1},{abbr:"ManNAc",name:"N-Acetyl Mannosamine",color:o.Green,type:1},{abbr:"GalNAc",name:"N-Acetyl Galactosamine",color:o.Yellow,type:1},{abbr:"GulNAc",name:"N-Acetyl Gulosamine",color:o.Orange,type:1},{abbr:"AltNAc",name:"N-Acetyl Altrosamine",color:o.Pink,type:1},{abbr:"AllNAc",name:"N-Acetyl Allosamine",color:o.Purple,type:1},{abbr:"TalNAc",name:"N-Acetyl Talosamine",color:o.LightBlue,type:1},{abbr:"IdoNAc",name:"N-Acetyl Idosamine",color:o.Brown,type:1},{abbr:"GlcN",name:"Glucosamine",color:o.Blue,type:2},{abbr:"ManN",name:"Mannosamine",color:o.Green,type:2},{abbr:"GalN",name:"Galactosamine",color:o.Yellow,type:2},{abbr:"GulN",name:"Gulosamine",color:o.Orange,type:2},{abbr:"AltN",name:"Altrosamine",color:o.Pink,type:2},{abbr:"AllN",name:"Allosamine",color:o.Purple,type:2},{abbr:"TalN",name:"Talosamine",color:o.LightBlue,type:2},{abbr:"IdoN",name:"Idosamine",color:o.Brown,type:2},{abbr:"GlcA",name:"Glucuronic Acid",color:o.Blue,type:3},{abbr:"ManA",name:"Mannuronic Acid",color:o.Green,type:3},{abbr:"GalA",name:"Galacturonic Acid",color:o.Yellow,type:3},{abbr:"GulA",name:"Guluronic Acid",color:o.Orange,type:3},{abbr:"AltA",name:"Altruronic Acid",color:o.Pink,type:3},{abbr:"AllA",name:"Alluronic Acid",color:o.Purple,type:3},{abbr:"TalA",name:"Taluronic Acid",color:o.LightBlue,type:3},{abbr:"IdoA",name:"Iduronic Acid",color:o.Brown,type:3},{abbr:"Qui",name:"Quinovose",color:o.Blue,type:4},{abbr:"Rha",name:"Rhamnose",color:o.Green,type:4},{abbr:"6dGul",name:"6-Deoxy Gulose",color:o.Orange,type:4},{abbr:"6dAlt",name:"6-Deoxy Altrose",color:o.Pink,type:4},{abbr:"6dTal",name:"6-Deoxy Talose",color:o.LightBlue,type:4},{abbr:"Fuc",name:"Fucose",color:o.Red,type:4},{abbr:"QuiNAc",name:"N-Acetyl Quinovosamine",color:o.Blue,type:5},{abbr:"RhaNAc",name:"N-Acetyl Rhamnosamine",color:o.Green,type:5},{abbr:"6dAltNAc",name:"N-Acetyl 6-Deoxy Altrosamine",color:o.Pink,type:5},{abbr:"6dTalNAc",name:"N-Acetyl 6-Deoxy Talosamine",color:o.LightBlue,type:5},{abbr:"FucNAc",name:"N-Acetyl Fucosamine",color:o.Red,type:5},{abbr:"Oli",name:"Olivose",color:o.Blue,type:6},{abbr:"Tyv",name:"Tyvelose",color:o.Green,type:6},{abbr:"Abe",name:"Abequose",color:o.Orange,type:6},{abbr:"Par",name:"Paratose",color:o.Pink,type:6},{abbr:"Dig",name:"Digitoxose",color:o.Purple,type:6},{abbr:"Col",name:"Colitose",color:o.LightBlue,type:6},{abbr:"Ara",name:"Arabinose",color:o.Green,type:7},{abbr:"Lyx",name:"Lyxose",color:o.Yellow,type:7},{abbr:"Xyl",name:"Xylose",color:o.Orange,type:7},{abbr:"Rib",name:"Ribose",color:o.Pink,type:7},{abbr:"Kdn",name:"Keto-Deoxy Nonulonic Acid",color:o.Green,type:8},{abbr:"Neu5Ac",name:"N-Acetyl Neuraminic Acid",color:o.Purple,type:8},{abbr:"Neu5Gc",name:"N-Glycolyl Neuraminic Acid",color:o.LightBlue,type:8},{abbr:"Neu",name:"Neuraminic Acid",color:o.Brown,type:8},{abbr:"Sia",name:"Sialic acid",color:o.Red,type:8},{abbr:"Pse",name:"Pseudaminic Acid",color:o.Green,type:9},{abbr:"Leg",name:"Legionaminic Acid",color:o.Yellow,type:9},{abbr:"Aci",name:"Acinetaminic Acid",color:o.Pink,type:9},{abbr:"4eLeg",name:"4-Epilegionaminic Acid",color:o.LightBlue,type:9},{abbr:"Bac",name:"Bacillosamine",color:o.Blue,type:10},{abbr:"LDmanHep",name:"L-Glycero-D-Manno Heptose",color:o.Green,type:10},{abbr:"Kdo",name:"Keto-Deoxy Octulonic Acid",color:o.Yellow,type:10},{abbr:"Dha",name:"3-Deoxy Lyxo-Heptulosaric Acid",color:o.Orange,type:10},{abbr:"DDmanHep",name:"D-Glycero-D-Manno-Heptose",color:o.Pink,type:10},{abbr:"MurNAc",name:"N-Acetyl Muramic Acid",color:o.Purple,type:10},{abbr:"MurNGc",name:"N-Glycolyl Muramic Acid",color:o.LightBlue,type:10},{abbr:"Mur",name:"Muramic Acid",color:o.Brown,type:10},{abbr:"Api",name:"Apicose",color:o.Green,type:11},{abbr:"Fru",name:"Fructose",color:o.Green,type:11},{abbr:"Tag",name:"Tagatose",color:o.Yellow,type:11},{abbr:"Sor",name:"Sorbose",color:o.Orange,type:11},{abbr:"Psi",name:"Psicose",color:o.Pink,type:11}],d=function(){for(var e=new Map,t=0,r=l.length;t<r;++t){var n=l[t];e.set(n.abbr,n)}return e}(),f=[["Glc-family",o.Blue],["Man-family",o.Green],["Gal-family",o.Yellow],["Gul-family",o.Orange],["Alt-family",o.Pink],["All-family",o.Purple],["Tal-family",o.LightBlue],["Ido-family",o.Brown],["Fuc-family",o.Red],["Generic/Unknown/Secondary",o.Secondary]],p={Glc:["GLC","BGC","Z8T","TRE","MLR"],Man:["MAN","BMA"],Gal:["GLA","GAL","GZL","GXL","GIV"],Gul:["4GL","GL0","GUP","Z8H"],Alt:["Z6H","3MK","SHD"],All:["AFD","ALL","WOO","Z2D"],Tal:["ZEE","A5C","SDY"],Ido:["ZCD","Z0F","4N2"],GlcNAc:["NDG","NAG","NGZ"],ManNAc:["BM3","BM7"],GalNAc:["A2G","NGA","YYQ"],GulNAc:["LXB"],AltNAc:[],AllNAc:["NAA"],TalNAc:[],IdoNAc:["LXZ","HSQ"],GlcN:["PA1","GCS"],ManN:["95Z"],GalN:["X6X","1GN"],GulN:[],AltN:[],AllN:[],TalN:[],IdoN:[],GlcA:["GCU","BDP"],ManA:["MAV","BEM"],GalA:["ADA","GTR","GTK"],GulA:["LGU"],AltA:[],AllA:[],TalA:["X1X","X0X"],IdoA:["IDR"],Qui:["G6D","YYK"],Rha:["RAM","RM4","XXR"],"6dGul":["66O"],"6dAlt":[],"6dTal":[],Fuc:["FUC","FUL","FCA","FCB","GYE"],QuiNAc:["Z9W"],RhaNAc:[],"6dAltNAc":[],"6dTalNAc":[],FucNAc:["49T"],Oli:["DDA","RAE","Z5J"],Tyv:["TYV"],Abe:["ABE"],Par:["PZU"],Dig:["Z3U"],Col:[],Ara:["64K","ARA","ARB","AHR","FUB","BXY","BXX","SEJ"],Lyx:["LDY","Z4W"],Xyl:["XYS","XYP","XYZ","HSY","LXC"],Rib:["YYM","RIP","RIB","BDR","0MK","Z6J","32O"],Kdn:["KDM","KDN"],Neu5Ac:["SIA","SLB"],Neu5Gc:["NGC","NGE"],Neu:[],Sia:[],Pse:[],Leg:[],Aci:[],"4eLeg":[],Bac:[],LDmanHep:["GMH"],Kdo:["KDO"],Dha:[],DDmanHep:["289"],MurNAc:["MUB","AMU"],MurNGc:[],Mur:["1S4","MUR"],Api:["XXM"],Fru:["BDF","Z9N","FRU","LFR"],Tag:["T6T"],Sor:["SOE","UEA"],Psi:["PSV","SF6","SF9","TTV"]},m=["NGZ","LAT","PUF","GDA","9WJ"],h=function(){for(var e=new Map,t=0,r=l.length;t<r;++t){var n=l[t],i=p[n.abbr];if(i)for(var a=0,o=i.length;a<o;++a)e.set(i[a],n)}for(t=0,r=m.length;t<r;++t)e.set(m[t],c);return e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return a}));var n=r(364);function i(e){return e}function a(e,t){if("bcif"===e.ext)try{if(Object(n.a)(t).encoder.startsWith("VolumeServer"))return"dscif"}catch(e){}else if("cif"===e.ext){var r=t;if(r.startsWith("data_SERVER\n#\n_density_server_result"))return"dscif";if(r.includes("atom_site_fract_x")||r.includes("atom_site.fract_x"))return"coreCif"}return-1}},function(e,t,r){"use strict";r.r(t),r.d(t,"RxEventHelper",(function(){return n}));var n,i=r(62),a=r(245);!function(e){e.create=function(){var e=new o,t=function(){return e.create()};return t.dispose=function(){return e.dispose()},t.behavior=function(t){return e.behavior(t)},t}}(n||(n={}));var o=function(){function e(){this._eventList=[],this._disposed=!1}return e.prototype.create=function(){var e=new i.a;return this._eventList.push(e),e},e.prototype.behavior=function(e){var t=new a.a(e);return this._eventList.push(t),t},e.prototype.dispose=function(){if(!this._disposed){for(var e=0,t=this._eventList;e<t.length;e++){t[e].complete()}this._disposed=!0}},e}()},function(e,t,r){"use strict";function n(e){return e}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return l})),r.d(t,"c",(function(){return d})),r.d(t,"d",(function(){return f}));var n=r(5),i=r(1),a=r(29),o=Object(i.Mat3)(),s=Object(i.Mat4)();function u(e,t,r){var u=function(e,t){for(var r=0;r<t;r++)if(i.Mat3.fromMat4(o,i.Mat4.fromArray(s,e,16*r)),i.Mat3.determinant(o)<0)return!0;return!1}(e,t);if(r){n.e.update(r.matrix,r.matrix.ref.value),n.e.update(r.transform,e),n.e.updateIfChanged(r.uInstanceCount,t),n.e.updateIfChanged(r.instanceCount,t);var c=r.aTransform.ref.value.length>=16*t?r.aTransform.ref.value:new Float32Array(16*t);c.set(e),n.e.update(r.aTransform,c);var l=r.extraTransform.ref.value.length>=16*t?r.extraTransform.ref.value:new Float32Array(16*t);n.e.update(r.extraTransform,d(l,t));var p=r.aInstance.ref.value.length>=t?r.aInstance.ref.value:new Float32Array(t);return n.e.update(r.aInstance,Object(a.fillSerial)(p,t)),n.e.update(r.hasReflection,u),f(r),r}return{aTransform:n.e.create(new Float32Array(e)),matrix:n.e.create(i.Mat4.identity()),transform:n.e.create(e),extraTransform:n.e.create(d(new Float32Array(16*t),t)),uInstanceCount:n.e.create(t),instanceCount:n.e.create(t),aInstance:n.e.create(Object(a.fillSerial)(new Float32Array(t))),hasReflection:n.e.create(u)}}var c=new Float32Array(16);function l(e){return u(new Float32Array(c),1,e)}function d(e,t){for(var r=0;r<t;r++)e.set(c,16*r);return e}function f(e){for(var t=e.aTransform.ref.value,r=e.instanceCount.ref.value,a=e.matrix.ref.value,o=e.transform.ref.value,s=e.extraTransform.ref.value,u=0;u<r;u++){var c=16*u;i.Mat4.mulOffset(t,s,o,c,c,c),i.Mat4.mulOffset(t,a,t,c,0,c)}n.e.update(e.aTransform,t)}i.Mat4.toArray(i.Mat4.identity(),c,0)},function(e,t,r){"use strict";r.r(t),r.d(t,"UpdateTransformControl",(function(){return u})),r.d(t,"TransformUpdaterControl",(function(){return c}));var n=r(0),i=r(154),a=r(294),o=r(3),s=r(33),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._getInfo=Object(i.b)((function(e){return a.a.infoFromTransform(t.plugin,t.props.state,e)})),t.state={error:void 0,isInitial:!0,params:t.getInfo().initialValues,busy:!1,isCollapsed:t.props.initiallyCollapsed},t}return Object(n.__extends)(t,e),t.prototype.applyAction=function(){return this.props.customUpdate?this.props.customUpdate(this.state.params):this.plugin.state.updateTransform(this.props.state,this.props.transform.ref,this.state.params)},t.prototype.getInfo=function(){return this._getInfo(this.props.transform)},t.prototype.getTransformerId=function(){return this.props.transform.transformer.id},t.prototype.getHeader=function(){return this.props.customHeader||this.props.transform.transformer.definition.display},t.prototype.canApply=function(){var e=this.props.state,t=e.cells.get(this.props.transform.ref);if(!t)return!1;if("error"===t.status){var r=e.cells.get(this.props.transform.parent);return!!r&&"ok"===r.status}return!this.state.error&&!this.state.busy&&!this.state.isInitial},t.prototype.applyText=function(){return this.canApply()?"Update":"Nothing to Update"},t.prototype.isUpdate=function(){return!0},t.prototype.getSourceAndTarget=function(){var e=this.props.state.cells.get(this.props.transform.ref);return{a:this.props.state.cells.get(this.props.transform.parent).obj,b:null==e?void 0:e.obj,bCell:e}},t.prototype.canAutoApply=function(e){var t=this.props.transform.transformer.definition.canAutoUpdate;if(!t)return!1;var r=this.props.state,n=r.cells.get(this.props.transform.ref);return!(!n||!n.sourceRef||"ok"!==n.status)&&t({a:r.cells.get(n.sourceRef).obj,b:n.obj,oldParams:this.getInfo().initialValues,newParams:e},this.plugin)},t.prototype.componentDidMount=function(){var t=this;e.prototype.componentDidMount.call(this),this.props.toggleCollapsed&&this.subscribe(this.props.toggleCollapsed,(function(){return t.setState({isCollapsed:!t.state.isCollapsed})})),this.subscribe(this.plugin.state.events.object.updated,(function(e){var r=e.ref,n=e.state;t.props.transform.ref===r&&t.props.state===n&&t.state.params!==t.props.transform.params&&(t._getInfo=Object(i.b)((function(e){return a.a.infoFromTransform(t.plugin,t.props.state,e)})),t.setState({params:t.props.transform.params,isInitial:!0}))}))},t.prototype.componentDidUpdate=function(e){var t;if(this.props.transform!==e.transform){var r=this.props.state.cells.get(this.props.transform.ref);this.setState({params:(null===(t=r.params)||void 0===t?void 0:t.values)||{},isInitial:!0,error:void 0,simpleOnly:this.state.simpleOnly})}},t}(a.b),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.object.updated,(function(t){var r=t.ref,n=t.state;e.props.nodeRef===r&&e.plugin.state.data===n&&e.forceUpdate()}))},t.prototype.render=function(){var e=this.plugin.state.data,t=this.props.nodeRef,r=e.cells.get(t);if(!r||"ok"!==r.status&&"error"!==r.status)return null;var n=r.transform;return o.createElement(u,{state:e,transform:n,initiallyCollapsed:this.props.initiallyCollapsed,customHeader:this.props.header})},t}(s.PluginUIComponent)},function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return a})),r.d(t,"c",(function(){return s}));var n=r(1);function i(e,t){return{vertices:e,edges:t}}function a(e){return{vertices:new Float32Array(e.vertices),edges:new Uint32Array(e.edges)}}var o=n.Vec3.zero();function s(e,t){for(var r=e.vertices,i=0,a=r.length;i<a;i+=3)n.Vec3.transformMat4(o,n.Vec3.fromArray(o,r,i),t),n.Vec3.toArray(o,r,i);return e}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(5),o=r(9),s=r(2),u=r(53),c=r(115),l=r(124),d=r(30),f=r(129),p=r(130),m=r(52),h=r(1),g=r(136),v=r(117);!function(e){function t(e){return{}}function r(t,r,n,s,u){var v=n.instanceCount,b=n.groupCount,y=e.Utils.createPositionIterator(t,r),_=Object(c.a)(n,y,s.color),S=Object(l.a)(v*b),x=Object(f.c)(),O=Object(p.c)(),w=Object(g.d)(),C={drawCount:t.vertexCount,vertexCount:t.vertexCount,groupCount:b,instanceCount:v},j=o.g.clone(t.boundingSphere),P=Object(m.b)(j,r.aTransform.ref.value,v);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({uGeoTexDim:t.geoTextureDim,tPosition:t.vertexTexture,tGroup:t.groupTexture,tNormal:t.normalTexture,boundingSphere:a.e.create(P),invariantBoundingSphere:a.e.create(j),uInvariantBoundingSphere:a.e.create(h.Vec4.ofSphere(j))},_),S),x),O),w),r),d.a.createValues(u,C)),{dDoubleSided:a.e.create(u.doubleSided),dFlatShaded:a.e.create(u.flatShaded),dFlipSided:a.e.create(u.flipSided),dIgnoreLight:a.e.create(u.ignoreLight),dXrayShaded:a.e.create(u.xrayShaded),dGeoTexture:a.e.create(!0)})}e.create=function(e,t,r,n,i,s,u){var c=r.getWidth(),l=r.getHeight();return u?(u.vertexCount=e,u.groupCount=t,a.e.update(u.geoTextureDim,h.Vec2.set(u.geoTextureDim.ref.value,c,l)),a.e.update(u.vertexTexture,r),a.e.update(u.normalTexture,i),o.g.copy(u.boundingSphere,s),u):{kind:"texture-mesh",vertexCount:e,groupCount:t,geoTextureDim:a.e.create(h.Vec2.create(c,l)),vertexTexture:a.e.create(r),groupTexture:a.e.create(n),normalTexture:a.e.create(i),boundingSphere:o.g.clone(s)}},e.createEmpty=t,e.Params=Object(i.__assign)(Object(i.__assign)({},d.a.Params),{doubleSided:s.ParamDefinition.Boolean(!1,d.a.CustomQualityParamInfo),flipSided:s.ParamDefinition.Boolean(!1,d.a.ShadingCategory),flatShaded:s.ParamDefinition.Boolean(!1,d.a.ShadingCategory),ignoreLight:s.ParamDefinition.Boolean(!1,d.a.ShadingCategory),xrayShaded:s.ParamDefinition.Boolean(!1,d.a.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:t,createValues:r,createValuesSimple:function(t,n,a,o,u){var c=d.a.createSimple(a,o,u),l=Object(i.__assign)(Object(i.__assign)({},s.ParamDefinition.getDefaultValues(e.Params)),n);return r(t,c.transform,c.locationIterator,c.theme,l)},updateValues:function(e,t){d.a.updateValues(e,t),a.e.updateIfChanged(e.dDoubleSided,t.doubleSided),a.e.updateIfChanged(e.dFlatShaded,t.flatShaded),a.e.updateIfChanged(e.dFlipSided,t.flipSided),a.e.updateIfChanged(e.dIgnoreLight,t.ignoreLight),a.e.updateIfChanged(e.dXrayShaded,t.xrayShaded)},updateBoundingSphere:function(e,t){var r=o.g.clone(t.boundingSphere),n=Object(m.b)(r,e.aTransform.ref.value,e.instanceCount.ref.value);o.g.equals(n,e.boundingSphere.ref.value)||a.e.update(e.boundingSphere,n);o.g.equals(r,e.invariantBoundingSphere.ref.value)||(a.e.update(e.invariantBoundingSphere,r),a.e.update(e.uInvariantBoundingSphere,h.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:d.a.createRenderableState,updateRenderableState:d.a.updateRenderableState,createPositionIterator:function(){return Object(u.a)(1,1,1,(function(){return v.b}))}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i.a})),r.d(t,"e",(function(){return a})),r.d(t,"d",(function(){return o.b})),r.d(t,"c",(function(){return s.a}));var n,i=r(361),a=r(22),o=r(299),s=r(353),u=r(28),c=r(6),l=r(5);function d(e){for(var t=new Map,r=0,n=e.length;r<n;r++)t.set(r,e[r]);return t}!function(e){e.getCifDataSource=function(e,t,r){if(!t)return{rowCount:0};if(r&&r[t.id])return r[t.id];var n=t.getElements(e),i={data:n,rowCount:n.elements.length};return r&&(r[t.id]=i),i},e.fromAtomMap=function(e){return new p(e)},e.fromAtomArray=function(e){return new p(d(e))};var t=function(e){return e.atomicHierarchy.residueAtomSegments};e.fromResidueMap=function(e){return new f("residue",e,t,0)},e.fromResidueArray=function(e){return new f("residue",d(e),t,0)};var r=function(e){return e.atomicHierarchy.chainAtomSegments};e.fromChainMap=function(e){return new f("chain",e,r,0)},e.fromChainArray=function(e){return new f("chain",d(e),r,0)},e.fromEntityMap=function(e){return new m(e)}}(n||(n={}));var f=function(){function e(e,t,r,n){this.level=e,this.map=t,this.segmentGetter=r,this.id=l.c.create22(),this.kind=n}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.getStructureElements=function(e){var t=e.models;if(1!==t.length)throw new Error("Only works on structures with a single model.");for(var r=new Set,n=e.unitSymmetryGroups,i=[],a=this.segmentGetter(t[0]),o=0,s=n;o<s.length;o++){var l=s[o].units[0];if(l.kind===this.kind)for(var d=c.Segmentation.transientSegments(a,l.elements);d.hasNext;){var f=d.move();this.has(f.index)&&!r.has(f.index)&&(r.add(f.index),i[i.length]=u.d.Location.create(e,l,l.elements[f.start]))}}return i.sort((function(e,t){return e.element-t.element})),i},e.prototype.getElements=function(e){var t=this,r=this.segmentGetter(e.model).index,n=this.getStructureElements(e);return{elements:n,property:function(e){return t.get(r[n[e].element])}}},e}(),p=function(){function e(e){this.map=e,this.id=l.c.create22(),this.level="atom",this.kind=0}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.getStructureElements=function(e){if(1!==e.models.length)throw new Error("Only works on structures with a single model.");for(var t=new Set,r=[],n=0,i=e.unitSymmetryGroups;n<i.length;n++){var a=i[n].units[0];if(a.kind===this.kind)for(var o=a.elements,s=0,c=o.length;s<c;s++){var l=o[s];this.has(l)&&!t.has(l)&&(t.add(o[s]),r[r.length]=u.d.Location.create(e,a,l))}}return r.sort((function(e,t){return e.element-t.element})),r},e.prototype.getElements=function(e){var t=this,r=this.getStructureElements(e);return{elements:r,property:function(e){return t.get(r[e].element)}}},e}(),m=function(){function e(e){this.map=e,this.id=l.c.create22(),this.level="entity",this.kind=0}return e.prototype.has=function(e){return this.map.has(e)},e.prototype.get=function(e){return this.map.get(e)},e.prototype.getStructureElements=function(e){var t=e.models;if(1!==t.length)throw new Error("Only works on structures with a single model.");for(var r=t[0].atomicHierarchy.index,n=new Set,i=e.unitSymmetryGroups,a=[],o=t[0].atomicHierarchy.chainAtomSegments,s=0,l=i;s<l.length;s++){var d=l[s].units[0];if(d.kind===this.kind)for(var f=c.Segmentation.transientSegments(o,d.elements);f.hasNext;){var p=f.move(),m=r.getEntityFromChain(p.index);this.has(m)&&!n.has(m)&&(n.add(m),a[a.length]=u.d.Location.create(e,d,d.elements[p.start]))}}return a.sort((function(e,t){return e.element-t.element})),a},e.prototype.getElements=function(e){var t=this,r=this.getStructureElements(e),n=e.model.atomicHierarchy.chainAtomSegments.index,i=e.model.atomicHierarchy.index;return{elements:r,property:function(e){return t.get(i.getEntityFromChain(n[r[e].element]))}}},e}()},function(e,t,r){"use strict";function n(e,t,r){return{i:e,j:t,k:r}}function i(e,t){return{a:e,b:t}}r.d(t,"b",(function(){return o})),r.d(t,"c",(function(){return s})),r.d(t,"d",(function(){return u})),r.d(t,"e",(function(){return c})),r.d(t,"a",(function(){return l}));var a=[n(0,0,0),n(1,0,0),n(1,1,0),n(0,1,0),n(0,0,1),n(1,0,1),n(1,1,1),n(0,1,1)],o=[i(a[0],a[1]),i(a[1],a[2]),i(a[2],a[3]),i(a[3],a[0]),i(a[4],a[5]),i(a[5],a[6]),i(a[6],a[7]),i(a[7],a[4]),i(a[0],a[4]),i(a[1],a[5]),i(a[2],a[6]),i(a[3],a[7])],s=[{i:0,j:0,k:0,e:0},{i:1,j:0,k:0,e:1},{i:0,j:1,k:0,e:0},{i:0,j:0,k:0,e:1},{i:0,j:0,k:1,e:0},{i:1,j:0,k:1,e:1},{i:0,j:1,k:1,e:0},{i:0,j:0,k:1,e:1},{i:0,j:0,k:0,e:2},{i:1,j:0,k:0,e:2},{i:1,j:1,k:0,e:2},{i:0,j:1,k:0,e:2}],u=[0,265,515,778,1030,1295,1541,1804,2060,2309,2575,2822,3082,3331,3593,3840,400,153,915,666,1430,1183,1941,1692,2460,2197,2975,2710,3482,3219,3993,3728,560,825,51,314,1590,1855,1077,1340,2620,2869,2111,2358,3642,3891,3129,3376,928,681,419,170,1958,1711,1445,1196,2988,2725,2479,2214,4010,3747,3497,3232,1120,1385,1635,1898,102,367,613,876,3180,3429,3695,3942,2154,2403,2665,2912,1520,1273,2035,1786,502,255,1013,764,3580,3317,4095,3830,2554,2291,3065,2800,1616,1881,1107,1370,598,863,85,348,3676,3925,3167,3414,2650,2899,2137,2384,1984,1737,1475,1226,966,719,453,204,4044,3781,3535,3270,3018,2755,2505,2240,2240,2505,2755,3018,3270,3535,3781,4044,204,453,719,966,1226,1475,1737,1984,2384,2137,2899,2650,3414,3167,3925,3676,348,85,863,598,1370,1107,1881,1616,2800,3065,2291,2554,3830,4095,3317,3580,764,1013,255,502,1786,2035,1273,1520,2912,2665,2403,2154,3942,3695,3429,3180,876,613,367,102,1898,1635,1385,1120,3232,3497,3747,4010,2214,2479,2725,2988,1196,1445,1711,1958,170,419,681,928,3376,3129,3891,3642,2358,2111,2869,2620,1340,1077,1855,1590,314,51,825,560,3728,3993,3219,3482,2710,2975,2197,2460,1692,1941,1183,1430,666,915,153,400,3840,3593,3331,3082,2822,2575,2309,2060,1804,1541,1295,1030,778,515,265,0],c=[[],[0,8,3],[0,1,9],[1,8,3,9,8,1],[1,2,10],[0,8,3,1,2,10],[9,2,10,0,2,9],[2,8,3,2,10,8,10,9,8],[3,11,2],[0,11,2,8,11,0],[1,9,0,2,3,11],[1,11,2,1,9,11,9,8,11],[3,10,1,11,10,3],[0,10,1,0,8,10,8,11,10],[3,9,0,3,11,9,11,10,9],[9,8,10,10,8,11],[4,7,8],[4,3,0,7,3,4],[0,1,9,8,4,7],[4,1,9,4,7,1,7,3,1],[1,2,10,8,4,7],[3,4,7,3,0,4,1,2,10],[9,2,10,9,0,2,8,4,7],[2,10,9,2,9,7,2,7,3,7,9,4],[8,4,7,3,11,2],[11,4,7,11,2,4,2,0,4],[9,0,1,8,4,7,2,3,11],[4,7,11,9,4,11,9,11,2,9,2,1],[3,10,1,3,11,10,7,8,4],[1,11,10,1,4,11,1,0,4,7,11,4],[4,7,8,9,0,11,9,11,10,11,0,3],[4,7,11,4,11,9,9,11,10],[9,5,4],[9,5,4,0,8,3],[0,5,4,1,5,0],[8,5,4,8,3,5,3,1,5],[1,2,10,9,5,4],[3,0,8,1,2,10,4,9,5],[5,2,10,5,4,2,4,0,2],[2,10,5,3,2,5,3,5,4,3,4,8],[9,5,4,2,3,11],[0,11,2,0,8,11,4,9,5],[0,5,4,0,1,5,2,3,11],[2,1,5,2,5,8,2,8,11,4,8,5],[10,3,11,10,1,3,9,5,4],[4,9,5,0,8,1,8,10,1,8,11,10],[5,4,0,5,0,11,5,11,10,11,0,3],[5,4,8,5,8,10,10,8,11],[9,7,8,5,7,9],[9,3,0,9,5,3,5,7,3],[0,7,8,0,1,7,1,5,7],[1,5,3,3,5,7],[9,7,8,9,5,7,10,1,2],[10,1,2,9,5,0,5,3,0,5,7,3],[8,0,2,8,2,5,8,5,7,10,5,2],[2,10,5,2,5,3,3,5,7],[7,9,5,7,8,9,3,11,2],[9,5,7,9,7,2,9,2,0,2,7,11],[2,3,11,0,1,8,1,7,8,1,5,7],[11,2,1,11,1,7,7,1,5],[9,5,8,8,5,7,10,1,3,10,3,11],[5,7,0,5,0,9,7,11,0,1,0,10,11,10,0],[11,10,0,11,0,3,10,5,0,8,0,7,5,7,0],[11,10,5,7,11,5],[10,6,5],[0,8,3,5,10,6],[9,0,1,5,10,6],[1,8,3,1,9,8,5,10,6],[1,6,5,2,6,1],[1,6,5,1,2,6,3,0,8],[9,6,5,9,0,6,0,2,6],[5,9,8,5,8,2,5,2,6,3,2,8],[2,3,11,10,6,5],[11,0,8,11,2,0,10,6,5],[0,1,9,2,3,11,5,10,6],[5,10,6,1,9,2,9,11,2,9,8,11],[6,3,11,6,5,3,5,1,3],[0,8,11,0,11,5,0,5,1,5,11,6],[3,11,6,0,3,6,0,6,5,0,5,9],[6,5,9,6,9,11,11,9,8],[5,10,6,4,7,8],[4,3,0,4,7,3,6,5,10],[1,9,0,5,10,6,8,4,7],[10,6,5,1,9,7,1,7,3,7,9,4],[6,1,2,6,5,1,4,7,8],[1,2,5,5,2,6,3,0,4,3,4,7],[8,4,7,9,0,5,0,6,5,0,2,6],[7,3,9,7,9,4,3,2,9,5,9,6,2,6,9],[3,11,2,7,8,4,10,6,5],[5,10,6,4,7,2,4,2,0,2,7,11],[0,1,9,4,7,8,2,3,11,5,10,6],[9,2,1,9,11,2,9,4,11,7,11,4,5,10,6],[8,4,7,3,11,5,3,5,1,5,11,6],[5,1,11,5,11,6,1,0,11,7,11,4,0,4,11],[0,5,9,0,6,5,0,3,6,11,6,3,8,4,7],[6,5,9,6,9,11,4,7,9,7,11,9],[10,4,9,6,4,10],[4,10,6,4,9,10,0,8,3],[10,0,1,10,6,0,6,4,0],[8,3,1,8,1,6,8,6,4,6,1,10],[1,4,9,1,2,4,2,6,4],[3,0,8,1,2,9,2,4,9,2,6,4],[0,2,4,4,2,6],[8,3,2,8,2,4,4,2,6],[10,4,9,10,6,4,11,2,3],[0,8,2,2,8,11,4,9,10,4,10,6],[3,11,2,0,1,6,0,6,4,6,1,10],[6,4,1,6,1,10,4,8,1,2,1,11,8,11,1],[9,6,4,9,3,6,9,1,3,11,6,3],[8,11,1,8,1,0,11,6,1,9,1,4,6,4,1],[3,11,6,3,6,0,0,6,4],[6,4,8,11,6,8],[7,10,6,7,8,10,8,9,10],[0,7,3,0,10,7,0,9,10,6,7,10],[10,6,7,1,10,7,1,7,8,1,8,0],[10,6,7,10,7,1,1,7,3],[1,2,6,1,6,8,1,8,9,8,6,7],[2,6,9,2,9,1,6,7,9,0,9,3,7,3,9],[7,8,0,7,0,6,6,0,2],[7,3,2,6,7,2],[2,3,11,10,6,8,10,8,9,8,6,7],[2,0,7,2,7,11,0,9,7,6,7,10,9,10,7],[1,8,0,1,7,8,1,10,7,6,7,10,2,3,11],[11,2,1,11,1,7,10,6,1,6,7,1],[8,9,6,8,6,7,9,1,6,11,6,3,1,3,6],[0,9,1,11,6,7],[7,8,0,7,0,6,3,11,0,11,6,0],[7,11,6],[7,6,11],[3,0,8,11,7,6],[0,1,9,11,7,6],[8,1,9,8,3,1,11,7,6],[10,1,2,6,11,7],[1,2,10,3,0,8,6,11,7],[2,9,0,2,10,9,6,11,7],[6,11,7,2,10,3,10,8,3,10,9,8],[7,2,3,6,2,7],[7,0,8,7,6,0,6,2,0],[2,7,6,2,3,7,0,1,9],[1,6,2,1,8,6,1,9,8,8,7,6],[10,7,6,10,1,7,1,3,7],[10,7,6,1,7,10,1,8,7,1,0,8],[0,3,7,0,7,10,0,10,9,6,10,7],[7,6,10,7,10,8,8,10,9],[6,8,4,11,8,6],[3,6,11,3,0,6,0,4,6],[8,6,11,8,4,6,9,0,1],[9,4,6,9,6,3,9,3,1,11,3,6],[6,8,4,6,11,8,2,10,1],[1,2,10,3,0,11,0,6,11,0,4,6],[4,11,8,4,6,11,0,2,9,2,10,9],[10,9,3,10,3,2,9,4,3,11,3,6,4,6,3],[8,2,3,8,4,2,4,6,2],[0,4,2,4,6,2],[1,9,0,2,3,4,2,4,6,4,3,8],[1,9,4,1,4,2,2,4,6],[8,1,3,8,6,1,8,4,6,6,10,1],[10,1,0,10,0,6,6,0,4],[4,6,3,4,3,8,6,10,3,0,3,9,10,9,3],[10,9,4,6,10,4],[4,9,5,7,6,11],[0,8,3,4,9,5,11,7,6],[5,0,1,5,4,0,7,6,11],[11,7,6,8,3,4,3,5,4,3,1,5],[9,5,4,10,1,2,7,6,11],[6,11,7,1,2,10,0,8,3,4,9,5],[7,6,11,5,4,10,4,2,10,4,0,2],[3,4,8,3,5,4,3,2,5,10,5,2,11,7,6],[7,2,3,7,6,2,5,4,9],[9,5,4,0,8,6,0,6,2,6,8,7],[3,6,2,3,7,6,1,5,0,5,4,0],[6,2,8,6,8,7,2,1,8,4,8,5,1,5,8],[9,5,4,10,1,6,1,7,6,1,3,7],[1,6,10,1,7,6,1,0,7,8,7,0,9,5,4],[4,0,10,4,10,5,0,3,10,6,10,7,3,7,10],[7,6,10,7,10,8,5,4,10,4,8,10],[6,9,5,6,11,9,11,8,9],[3,6,11,0,6,3,0,5,6,0,9,5],[0,11,8,0,5,11,0,1,5,5,6,11],[6,11,3,6,3,5,5,3,1],[1,2,10,9,5,11,9,11,8,11,5,6],[0,11,3,0,6,11,0,9,6,5,6,9,1,2,10],[11,8,5,11,5,6,8,0,5,10,5,2,0,2,5],[6,11,3,6,3,5,2,10,3,10,5,3],[5,8,9,5,2,8,5,6,2,3,8,2],[9,5,6,9,6,0,0,6,2],[1,5,8,1,8,0,5,6,8,3,8,2,6,2,8],[1,5,6,2,1,6],[1,3,6,1,6,10,3,8,6,5,6,9,8,9,6],[10,1,0,10,0,6,9,5,0,5,6,0],[0,3,8,5,6,10],[10,5,6],[11,5,10,7,5,11],[11,5,10,11,7,5,8,3,0],[5,11,7,5,10,11,1,9,0],[10,7,5,10,11,7,9,8,1,8,3,1],[11,1,2,11,7,1,7,5,1],[0,8,3,1,2,7,1,7,5,7,2,11],[9,7,5,9,2,7,9,0,2,2,11,7],[7,5,2,7,2,11,5,9,2,3,2,8,9,8,2],[2,5,10,2,3,5,3,7,5],[8,2,0,8,5,2,8,7,5,10,2,5],[9,0,1,5,10,3,5,3,7,3,10,2],[9,8,2,9,2,1,8,7,2,10,2,5,7,5,2],[1,3,5,3,7,5],[0,8,7,0,7,1,1,7,5],[9,0,3,9,3,5,5,3,7],[9,8,7,5,9,7],[5,8,4,5,10,8,10,11,8],[5,0,4,5,11,0,5,10,11,11,3,0],[0,1,9,8,4,10,8,10,11,10,4,5],[10,11,4,10,4,5,11,3,4,9,4,1,3,1,4],[2,5,1,2,8,5,2,11,8,4,5,8],[0,4,11,0,11,3,4,5,11,2,11,1,5,1,11],[0,2,5,0,5,9,2,11,5,4,5,8,11,8,5],[9,4,5,2,11,3],[2,5,10,3,5,2,3,4,5,3,8,4],[5,10,2,5,2,4,4,2,0],[3,10,2,3,5,10,3,8,5,4,5,8,0,1,9],[5,10,2,5,2,4,1,9,2,9,4,2],[8,4,5,8,5,3,3,5,1],[0,4,5,1,0,5],[8,4,5,8,5,3,9,0,5,0,3,5],[9,4,5],[4,11,7,4,9,11,9,10,11],[0,8,3,4,9,7,9,11,7,9,10,11],[1,10,11,1,11,4,1,4,0,7,4,11],[3,1,4,3,4,8,1,10,4,7,4,11,10,11,4],[4,11,7,9,11,4,9,2,11,9,1,2],[9,7,4,9,11,7,9,1,11,2,11,1,0,8,3],[11,7,4,11,4,2,2,4,0],[11,7,4,11,4,2,8,3,4,3,2,4],[2,9,10,2,7,9,2,3,7,7,4,9],[9,10,7,9,7,4,10,2,7,8,7,0,2,0,7],[3,7,10,3,10,2,7,4,10,1,10,0,4,0,10],[1,10,2,8,7,4],[4,9,1,4,1,7,7,1,3],[4,9,1,4,1,7,0,8,1,8,7,1],[4,0,3,7,4,3],[4,8,7],[9,10,8,10,11,8],[3,0,9,3,9,11,11,9,10],[0,1,10,0,10,8,8,10,11],[3,1,10,11,3,10],[1,2,11,1,11,9,9,11,8],[3,0,9,3,9,11,1,2,9,2,11,9],[0,2,11,8,0,11],[3,2,11],[2,3,8,2,8,10,10,8,9],[9,10,2,0,9,2],[2,3,8,2,8,10,0,1,8,1,10,8],[1,10,2],[1,3,8,9,1,8],[0,9,1],[0,3,8],[]],l=[[0,4,4,4,2,0,0,0,2,2,0,0],[4,0,4,4,0,8,0,0,0,8,8,0],[4,4,0,4,0,0,8,0,0,0,8,8],[4,4,4,0,0,0,0,1,1,0,0,1],[2,0,0,0,0,8,8,8,2,2,0,0],[0,8,0,0,8,0,8,8,0,8,8,0],[0,0,8,0,8,8,0,8,0,0,8,8],[0,0,0,1,8,8,8,0,1,0,0,1],[2,0,0,1,2,0,0,1,0,2,0,1],[2,8,0,0,2,8,0,0,2,0,8,0],[0,8,8,0,0,8,8,0,0,8,0,8],[0,0,8,1,0,0,8,1,1,0,8,0]]},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(20),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.a(t,e),t.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(r(34).a)},function(e,t,r){"use strict";r.r(t),r.d(t,"BindingsHelp",(function(){return d})),r.d(t,"HelpText",(function(){return f})),r.d(t,"HelpGroup",(function(){return p})),r.d(t,"ViewportHelpContent",(function(){return h})),r.d(t,"HelpContent",(function(){return g}));var n=r(0),i=r(3),a=r(61),o=r(33),s=r(13),u=r(234),c=r(15),l=r(18);var d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.getBindingComponents=function(){var e,t=(e=this.props.bindings,Object.keys(e).map((function(t){return[t,e[t]]})));return i.createElement(i.Fragment,null,t.map((function(e){var t=e[0],r=e[1];return a.a.isEmpty(r)?null:i.createElement("div",{key:t,style:{marginBottom:"6px"}},i.createElement("b",null,r.action),i.createElement("br",null),i.createElement("span",{dangerouslySetInnerHTML:{__html:a.a.format(r,t)}}))})))},t.prototype.render=function(){return i.createElement(f,null,this.getBindingComponents())},t}(i.PureComponent),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){return i.createElement("div",{className:"msp-help-text"},i.createElement("div",null,this.props.children))},t}(i.PureComponent),p=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={header:t.props.header,isExpanded:!!t.props.initiallyExpanded},t.toggleExpanded=function(){return t.setState({isExpanded:!t.state.isExpanded})},t}return Object(n.__extends)(t,e),t.prototype.render=function(){return i.createElement("div",{className:"msp-control-group-wrapper"},i.createElement("div",{className:"msp-control-group-header"},i.createElement(l.Button,{onClick:this.toggleExpanded},i.createElement(c.Icon,{svg:this.state.isExpanded?c.ArrowDropDownSvg:c.ArrowRightSvg}),this.props.header)),this.state.isExpanded&&i.createElement("div",{className:"msp-control-offset",style:{display:this.state.isExpanded?"block":"none"}},this.props.children))},t}(i.PureComponent);function m(e){return i.createElement("div",{className:"msp-simple-help-section"},e.header)}var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e={};return this.plugin.spec.behaviors.forEach((function(t){var r=t.defaultParams.bindings;r&&Object.assign(e,r)})),i.createElement(i.Fragment,null,!this.props.selectOnly&&this.plugin.canvas3d&&i.createElement(p,{key:"trackball",header:"Moving in 3D"},i.createElement(d,{bindings:this.plugin.canvas3d.props.trackball.bindings})),i.createElement(p,{key:"interactions",header:"Mouse Controls"},i.createElement(d,{bindings:e})))},t}(o.PluginUIComponent),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()}))},t.prototype.formatTriggers=function(e){return e.triggers.map((function(e){return a.a.Trigger.format(e)})).join(" or ")},t.prototype.getTriggerFor=function(e,t){var r=this.plugin.state.behaviors.select(s.StateSelection.Generators.ofTransformer(e)),n=1===r.length?r[0].params:void 0,i=n?n.values.bindings:{},o=t in i?i[t]:a.a.Empty;return this.formatTriggers(o)},t.prototype.render=function(){var e=this.getTriggerFor(u.SelectLoci,"clickSelectToggle"),t=this.getTriggerFor(u.FocusLoci,"clickFocus");return i.createElement("div",null,i.createElement(m,{header:"Interface Controls"}),i.createElement(p,{header:"Inline Help"},i.createElement(f,null,"Many user interface elements show a little questionmark icon when hovered over. Clicking the icon toggles the display of an inline help text."),i.createElement(f,null,"Tooltips may provide additional information on a user interface element and are shown when hovering over it with the mouse.")),i.createElement(p,{header:"Selections"},i.createElement(f,null,"The viewer allows changing colors and representations for selections of atoms, residues or chains. Selections can be created by",i.createElement("ul",{style:{paddingLeft:"20px"}},i.createElement("li",null,"picking elements on the 3D canvas or the sequence view using the mouse, e.g. toggle selection using ",e," (for more see help section on ",i.createElement("i",null,"Mouse Controls"),")"),i.createElement("li",null,"using the ",i.createElement("i",null,"Add"),", ",i.createElement("i",null,"Remove")," and ",i.createElement("i",null,"Only")," dropdown buttons in the ",i.createElement("i",null,"Manage Selection")," panel which allow modifing the current selection by predefined sets")))),i.createElement(p,{header:"Coloring"},i.createElement(f,null,"There are two ways to color structures. Every representation (e.g. cartoon or spacefill) has a color theme which can be changed using the dropdown for each representation in the ",i.createElement("i",null,"Structure Settings")," panel. Additionally any selection atoms, residues or chains can by given a custom color. For that, first select the parts of the structure to be colored (see help section on ",i.createElement("i",null,"Selections"),") and, second, choose a color from the color dropdown botton in the ",i.createElement("i",null,"Selection")," row of the ",i.createElement("i",null,"Change Representation")," panel. The theme color can be seen as a base color that is overpainted by the custom color. Custom colors can be removed for a selection with the 'Clear' option in the color dropdown.")),i.createElement(p,{header:"Representations"},i.createElement(f,null,"Structures can be shown with many different representations (e.g. cartoon or spacefill). The ",i.createElement("i",null,"Change Representation")," panel offers a collection of predefined styles which can be applied using the ",i.createElement("i",null,"Preset")," dropdown button. Additionally any selection atoms, residues or chains can by shown with a custom representation. For that, first select the parts of the structure to be mofified (see help section on ",i.createElement("i",null,"Selections"),") and, second, choose a representation to hide or show from the ",i.createElement("i",null,"Show")," and ",i.createElement("i",null,"Hide")," dropdown bottons in the ",i.createElement("i",null,"Selection")," row of the ",i.createElement("i",null,"Change Representation")," panel. The ",i.createElement("i",null,"Everything")," row applies the action to the whole structure instead of the current selection.")),i.createElement(p,{header:"Surroundings"},i.createElement(f,null,"To show the surroundings of a residue or ligand, click it in the 3D scene or in the sequence widget using ",t,".")),i.createElement(m,{header:"How-to Guides"}),i.createElement(p,{header:"Create an Image"},i.createElement(f,null,i.createElement("p",null,"Use the ",i.createElement(c.Icon,{svg:c.CameraSvg})," icon in the viewport to bring up the screenshot controls."),i.createElement("p",null,"To adjust the size of the image, use the ",i.createElement("i",null,"Resolution")," dropdown."))),i.createElement(m,{header:"Mouse Controls"}),i.createElement(h,null))},t}(o.PluginUIComponent)},function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return s}));var n,i=r(143),a=r(265),o=r(303);n||(n={});var s=function(){function e(e,t,r){this.kind=e,this.value=t,this.error=r,this.hasValue="N"===e}return e.prototype.observe=function(e){switch(this.kind){case"N":return e.next&&e.next(this.value);case"E":return e.error&&e.error(this.error);case"C":return e.complete&&e.complete()}},e.prototype.do=function(e,t,r){switch(this.kind){case"N":return e&&e(this.value);case"E":return t&&t(this.error);case"C":return r&&r()}},e.prototype.accept=function(e,t,r){return e&&"function"==typeof e.next?this.observe(e):this.do(e,t,r)},e.prototype.toObservable=function(){switch(this.kind){case"N":return Object(a.a)(this.value);case"E":return Object(o.a)(this.error);case"C":return Object(i.b)()}throw new Error("unexpected notification kind value")},e.createNext=function(t){return void 0!==t?new e("N",t):e.undefinedValueNotification},e.createError=function(t){return new e("E",void 0,t)},e.createComplete=function(){return e.completeNotification},e.completeNotification=new e("C"),e.undefinedValueNotification=new e("N",void 0),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(84),o=r(2),s=r(350),u=r(42);!function(e){var t;e.getParamDefinition=function(e,t,r){return e.definition.params?e.definition.params(t,r):{}},e.is=function(e){return!!e&&"function"==typeof e.toAction&&"function"==typeof e.apply},function(e){e[e.Unchanged=0]="Unchanged",e[e.Updated=1]="Updated",e[e.Recreate=2]="Recreate",e[e.Null=3]="Null"}(t=e.UpdateResult||(e.UpdateResult={}));var r,n=new Map,c=new Map;function l(e,t){var r=t.name,i=e+"."+r;if(n.has(i))throw new Error("A transform with id '"+r+"' is already registered. Please pick a unique identifier for your transforms and/or register them only once. This is to ensure that transforms can be serialized and replayed.");var u={apply:function(e,t,r){return a.a.create(e,u,t,r)},toAction:function(){return s.a.fromTransformer(u)},namespace:e,id:i,definition:t,createDefaultParams:function(e,r){return t.params?o.ParamDefinition.getDefaultValues(t.params(e,r)):{}}};return n.set(i,u),function(e){for(var t=0,r=e.definition.from;t<r.length;t++){var n=r[t];c.has(n.type)?c.get(n.type).push(e):c.set(n.type,[e])}}(u),u}e.getAll=function(){return Array.from(n.values())},e.get=function(e){var t=n.get(e);if(!t)throw new Error("A transformer with signature '"+e+"' is not registered.");return t},e.fromType=function(e){return c.get(e)||[]},e.create=l,e.factory=function(e){return function(t){return l(e,t)}},e.builderFactory=function(e){return r.build(e)},function(e){e.build=function(e){return function(t){return function(e,t){return function(r){return l(e,Object(i.__assign)({name:t.name,from:t.from instanceof Array?t.from:[t.from],to:t.to instanceof Array?t.to:[t.to],display:"string"==typeof t.display?{name:t.display}:t.display?t.display:{name:Object(u.b)(t.name.replace(/[-]/g," "))},params:"object"==typeof t.params?function(){return t.params}:t.params?t.params:void 0,isDecorator:t.isDecorator},r))}}(e,t)}}}(r=e.Builder||(e.Builder={})),e.build=function(e){return r.build(e)},e.ROOT=l("build-in",{name:"root",from:[],to:[],display:{name:"Root",description:"For internal use."},apply:function(){throw new Error("should never be applied")},update:function(){return t.Unchanged}})}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(5);!function(e){function t(e){var t=new DataView(e.buffer);return Object.assign(e.subarray(0),{readInt8:function(e){return t.getInt8(e)},readUInt8:function(e){return t.getUint8(e)},writeInt8:function(e,r){return t.setInt8(r,e)},writeUInt8:function(e,r){return t.setUint8(r,e)},readInt16LE:function(e){return t.getInt16(e,!0)},readInt32LE:function(e){return t.getInt32(e,!0)},readUInt16LE:function(e){return t.getUint16(e,!0)},readUInt32LE:function(e){return t.getUint32(e,!0)},readFloatLE:function(e){return t.getFloat32(e,!0)},readDoubleLE:function(e){return t.getFloat64(e,!0)},writeInt16LE:function(e,r){return t.setInt16(r,e,!0)},writeInt32LE:function(e,r){return t.setInt32(r,e,!0)},writeUInt16LE:function(e,r){return t.setUint16(r,e,!0)},writeUInt32LE:function(e,r){return t.setUint32(r,e,!0)},writeFloatLE:function(e,r){return t.setFloat32(r,e,!0)},writeDoubleLE:function(e,r){return t.setFloat64(r,e,!0)},readInt16BE:function(e){return t.getInt16(e,!1)},readInt32BE:function(e){return t.getInt32(e,!1)},readUInt16BE:function(e){return t.getUint16(e,!1)},readUInt32BE:function(e){return t.getUint32(e,!1)},readFloatBE:function(e){return t.getFloat32(e,!1)},readDoubleBE:function(e){return t.getFloat64(e,!1)},writeInt16BE:function(e,r){return t.setInt16(r,e,!1)},writeInt32BE:function(e,r){return t.setInt32(r,e,!1)},writeUInt16BE:function(e,r){return t.setUint16(r,e,!1)},writeUInt32BE:function(e,r){return t.setUint32(r,e,!1)},writeFloatBE:function(e,r){return t.setFloat32(r,e,!1)},writeDoubleBE:function(e,r){return t.setFloat64(r,e,!1)},copy:function(t,r,n,a){return r=Object(i.h)(r,0),n=Object(i.h)(n,0),a=Object(i.h)(a,e.length),t.set(e.subarray(n,a),r),a-n}})}function r(e,t,r,n,i){for(var a=0,o=r;a<o;a+=n)for(var s=0;s<n;s++)t[i+a+n-s-1]=e[i+a+s]}e.fromUint8Array=t,e.fromArrayBuffer=function(e){return t(new Uint8Array(e))},e.fromBuffer=function(e){return e},e.IsNativeEndianLittle=13330===new Uint16Array(new Uint8Array([18,52]).buffer)[0],e.flipByteOrder=r,e.flipByteOrderInPlace2=function(e,t,r){void 0===t&&(t=0);for(var n=new Int16Array(e,t,r),i=0,a=n.length;i<a;++i){var o=n[i];n[i]=(255&o)<<8|o>>8&255}},e.ensureLittleEndian=function(t,n,i,a,o){e.IsNativeEndianLittle||!i||a<=1||r(t,n,i,a,o)}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"c",(function(){return o})),r.d(t,"b",(function(){return u})),r.d(t,"d",(function(){return c}));var n,i=r(0),a=r(198);function o(e){return e===n.Float32?4:e===n.Int16||e===n.Uint16?2:1}function s(e,t,r,i){return void 0===r&&(r=0),e===n.Float32?new Float32Array(t,r,i):e===n.Int16?new Int16Array(t,r,i):e===n.Uint16?new Uint16Array(t,r,i):new Int8Array(t,r,i)}function u(e,t){var r=o(t),n=new ArrayBuffer(r*e),i=a.a.fromArrayBuffer(n),u=a.a.IsNativeEndianLittle?n:new ArrayBuffer(r*e);return{type:t,elementByteSize:r,readBuffer:i,valuesBuffer:new Uint8Array(u),values:s(t,u)}}function c(e,t,r,n,o,s){return Object(i.__awaiter)(this,void 0,void 0,(function(){return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return[4,t.readBuffer(r,e.readBuffer,n,o)];case 1:return i.sent(),e.elementByteSize>1&&(void 0!==s&&s!==a.a.IsNativeEndianLittle||!a.a.IsNativeEndianLittle)&&a.a.flipByteOrder(e.readBuffer,e.valuesBuffer,n,e.elementByteSize,o),[2,e.values]}}))}))}!function(e){e.Float32="float32",e.Int8="int8",e.Int16="int16",e.Uint16="uint16"}(n||(n={}))},function(e,t,r){"use strict";(function(e){var n,i=r(75);!function(t){var r="undefined"!=typeof btoa?btoa:function(t){return e.from(t).toString("base64")},n=[];t.create22=function(){for(var e=+new Date+Object(i.b)(),t=0;t<16;t++)n[t]=String.fromCharCode((e+255*Math.random())%255|0),e=Math.floor(e/255);return r(n.join("")).replace(/\+/g,"-").replace(/\//g,"_").substr(0,22)},t.createv4=function(){var e=+new Date+Object(i.b)();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?r:3&r|8).toString(16)}))},t.is=function(e){return"string"==typeof e}}(n||(n={})),t.a=n}).call(this,r(426).Buffer)},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(25),i=r(250),a=function(){function e(){this.count=0,this.center=Object(n.f)(),this.radiusSq=0}return e.prototype.reset=function(){n.f.set(this.center,0,0,0),this.radiusSq=0,this.count=0},e.prototype.includeStep=function(e){n.f.add(this.center,this.center,e),this.count++},e.prototype.finishedIncludeStep=function(){0!==this.count&&n.f.scale(this.center,this.center,1/this.count)},e.prototype.radiusStep=function(e){var t=n.f.squaredDistance(e,this.center);t>this.radiusSq&&(this.radiusSq=t)},e.prototype.radiusSphereStep=function(e,t){var r=n.f.distance(e,this.center)+t,i=r*r;i>this.radiusSq&&(this.radiusSq=i)},e.prototype.getSphere=function(e){return e||(e=Object(i.a)()),n.f.copy(e.center,this.center),e.radius=Math.sqrt(this.radiusSq),e},e.prototype.getCount=function(){return this.count},e}();!function(e){var t=new e,r=Object(n.f)(),i=Object(n.f)();e.fromArrays=function(e,i){var a=e.x,o=e.y,s=e.z;t.reset();for(var u=a.length,c=0;c<u;c++)n.f.set(r,a[c],o[c],s[c]),t.includeStep(r);for(t.finishedIncludeStep(),c=0;c<u;c++)n.f.set(r,a[c],o[c],s[c]),t.radiusStep(r);return n.f.copy(i.center,t.center),i.radius=Math.sqrt(t.radiusSq),i},e.fromProvider=function(e,i,a){t.reset();for(var o=0;o<e;o++)i(o,r),t.includeStep(r);for(t.finishedIncludeStep(),o=0;o<e;o++)i(o,r),t.radiusStep(r);return n.f.copy(a.center,t.center),a.radius=Math.sqrt(t.radiusSq),a},e.fromPairProvider=function(e,a,o){t.reset();for(var s=0;s<e;s++)a(s,r,i),t.includeStep(r),t.includeStep(i);for(t.finishedIncludeStep(),s=0;s<e;s++)a(s,r,i),t.radiusStep(r),t.radiusStep(i);return n.f.copy(o.center,t.center),o.radius=Math.sqrt(t.radiusSq),o}}(a||(a={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return Qe}));var n=r(24),i=r(4),a=r(184),o=r(2),s=r(149),u=Object(n.Color)(13421772),c={};var l={name:"carbohydrate-symbol",label:"Carbohydrate Symbol",category:"Residue Property",factory:function e(t,r){var n;if(t.structure){var o=t.structure.carbohydrates,c=o.elements,l=o.getElementIndices,d=function(e,t){if(!i.Unit.isAtomic(e))return u;var r=l(e,t);return r.length>0?c[r[0]].component.color:u};n=function(e,t){return t?a.b.Secondary:i.StructureElement.Location.is(e)?d(e.unit,e.element):i.Bond.isLocation(e)?d(e.aUnit,e.aUnit.elements[e.aIndex]):u}}else n=function(){return u};return{factory:e,granularity:"group",color:n,props:r,description:"Assigns colors according to the Symbol Nomenclature for Glycans (SNFG).",legend:Object(s.b)(a.a)}},getParams:function(e){return c},defaultValues:o.ParamDefinition.getDefaultValues(c),isApplicable:function(e){return!!e.structure&&e.structure.models.some((function(e){return i.Model.hasCarbohydrate(e)}))}},d=r(367),f=r(5),p=r(94),m=r(241),h=r(0),g=r(6),v=r(114),b=Object(n.Color)(13421772),y=Object(h.__assign)({},Object(v.b)({type:"colors",colorList:"red-yellow-blue"}));var _={name:"element-index",label:"Element Index",category:"Atom Property",factory:function e(t,r){var n,a;if(t.structure){for(var o=t.structure.root.units,s=o.length,u=new Map,c=new Map,l=0,d=0;d<s;++d)u.set(d,l),l+=o[d].elements.length,c.set(o[d].id,d);var f=Object(v.a)(l,r);a=f.legend,n=function(e){if(i.StructureElement.Location.is(e)){var t=c.get(e.unit.id),r=g.OrderedSet.findPredecessorIndex(o[t].elements,e.element);return f.color(u.get(t)+r)}if(i.Bond.isLocation(e)){t=c.get(e.aUnit.id),r=g.OrderedSet.findPredecessorIndex(o[t].elements,e.aUnit.elements[e.aIndex]);return f.color(u.get(t)+r)}return b}}else n=function(){return b};return{factory:e,granularity:"groupInstance",color:n,props:r,description:"Gives every element (atom or coarse sphere/gaussian) a unique color based on the position (index) of the element in the list of elements in the structure.",legend:a}},getParams:function(e){return y},defaultValues:o.ParamDefinition.getDefaultValues(y),isApplicable:function(e){return!!e.structure}},S=r(397),x=r(150),O=r(46),w=Object(n.ColorMap)({water:3697840,ion:15729279,protein:12496596,RNA:16629894,DNA:12540695,PNA:4367514,saccharide:8374655}),C=Object(n.Color)(16777113),j={saturation:o.ParamDefinition.Numeric(0,{min:-6,max:6,step:.1}),lightness:o.ParamDefinition.Numeric(0,{min:-6,max:6,step:.1})};function P(e,t,r){switch(Object(x.b)(t,r)){case 2:return e.water;case 3:return e.ion;case 5:return e.protein;case 6:return e.RNA;case 7:return e.DNA;case 8:return e.PNA;case 9:return e.saccharide}return C}var E={name:"molecule-type",label:"Molecule Type",category:"Residue Property",factory:function e(t,r){var n=Object(O.getAdjustedColorMap)(w,r.saturation,r.lightness);return{factory:e,granularity:"group",color:function(e){return i.StructureElement.Location.is(e)?P(n,e.unit,e.element):i.Bond.isLocation(e)?P(n,e.aUnit,e.aUnit.elements[e.aIndex]):C},props:r,description:"Assigns a color based on the molecule type of a residue.",legend:Object(s.b)(Object.keys(w).map((function(e){return[e,w[e]]})).concat([["Other/unknown",C]]))}},getParams:function(e){return j},defaultValues:o.ParamDefinition.getDefaultValues(j),isApplicable:function(e){return!!e.structure}},A=r(100),D=Object(n.Color)(16448250),T=Object(h.__assign)({},Object(v.b)({type:"colors",colorList:"dark-2"}));function I(e){switch(e.kind){case 0:return i.StructureProperties.chain.label_asym_id;case 1:case 2:return i.StructureProperties.coarse.asym_id}}function M(e){for(var t=new Map,r=0,n=e.unitSymmetryGroups.length;r<n;++r){var a=e.unitSymmetryGroups[r].units[0],o=a.model;if(i.Unit.isAtomic(a))for(var s=o.atomicHierarchy,u=s.chainAtomSegments,c=s.chains,l=g.Segmentation.transientSegments(u,a.elements);l.hasNext;){var d=l.move().index,f=c.label_entity_id.value(d),p=o.entities.getEntityIndex(f);if("polymer"===o.entities.data.type.value(p)){var m=c.label_asym_id.value(d);t.has(m)||t.set(m,t.size)}}else if(i.Unit.isCoarse(a)){var h=i.Unit.isSpheres(a)?o.coarseHierarchy.spheres:o.coarseHierarchy.gaussians,v=h.chainElementSegments,b=h.asym_id,y=h.entity_id;for(l=g.Segmentation.transientSegments(v,a.elements);l.hasNext;){d=l.move().index;var _=v.offsets[d];f=y.value(_),p=o.entities.getEntityIndex(f);if("polymer"===o.entities.data.type.value(p)){m=b.value(_);t.has(m)||t.set(m,t.size)}}}}return t}var k={name:"polymer-id",label:"Polymer Chain Id",category:"Chain Property",factory:function e(t,r){var n,a;if(t.structure){var o=i.StructureElement.Location.create(t.structure),s=M(t.structure.root),u=Array.from(s.keys()),c=Object(v.a)(s.size,r,{valueLabel:function(e){return u[e]}});a=c.legend,n=function(e){var t=void 0;if(i.StructureElement.Location.is(e)){var r=I(e.unit);t=s.get(r(e))}else if(i.Bond.isLocation(e)){r=I(e.aUnit);o.unit=e.aUnit,o.element=e.aUnit.elements[e.aIndex],t=s.get(r(o))}return void 0===t?D:c.color(t)}}else n=function(){return D};return{factory:e,granularity:"group",color:n,props:r,description:"Gives every polymer chain a color based on its `asym_id` value.",legend:a}},getParams:function(e){var t=o.ParamDefinition.clone(T);return e.structure&&M(e.structure.root).size>A.ColorLists["dark-2"].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Object(h.__assign)(Object(h.__assign)({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:Object(A.getColorListFromName)("dark-2").list}})),t},defaultValues:o.ParamDefinition.getDefaultValues(T),isApplicable:function(e){return!!e.structure}},B=Object(n.Color)(13421772),V=Object(h.__assign)({},Object(v.b)({type:"colors",colorList:"dark-2"}));function R(e){for(var t=0,r=e.units,n=0,i=r.length;n<i;++n)r[n].polymerElements.length>0&&++t;return t}var L={name:"polymer-index",label:"Polymer Chain Instance",category:"Chain Property",factory:function e(t,r){var n,a;if(t.structure){var o=Object(v.a)(R(t.structure.root),r);a=o.legend;for(var s=t.structure.root.units,u=new Map,c=0,l=0,d=s.length;c<d;++c)s[c].polymerElements.length>0&&(u.set(s[c].id,o.color(l)),++l);n=function(e){var t;return i.StructureElement.Location.is(e)?t=u.get(e.unit.id):i.Bond.isLocation(e)&&(t=u.get(e.aUnit.id)),void 0!==t?t:B}}else n=function(){return B};return{factory:e,granularity:"instance",color:n,props:r,description:"Gives every polymer chain instance a unique color based on the position (index) of the polymer in the list of polymers in the structure.",legend:a}},getParams:function(e){var t=o.ParamDefinition.clone(V);return e.structure&&R(e.structure.root)>A.ColorLists["dark-2"].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Object(h.__assign)(Object(h.__assign)({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:Object(A.getColorListFromName)("dark-2").list}})),t},defaultValues:o.ParamDefinition.getDefaultValues(V),isApplicable:function(e){return!!e.structure}},N=Object(n.ColorMap)({ALA:9240460,ARG:124,ASN:16743536,ASP:10485826,CYS:16777072,GLN:16731212,GLU:6684672,GLY:15658734,HIS:7368959,ILE:19456,LEU:4546117,LYS:4671416,MET:12099650,PHE:5459026,PRO:5395026,SER:16740418,THR:12078080,TRP:5195264,TYR:9203788,VAL:16747775,A:14423100,G:3329330,I:10145074,C:16766720,T:4286945,U:4251856,DA:14423100,DG:3329330,DI:10145074,DC:16766720,DT:4286945,DU:4251856,APN:14423100,GPN:3329330,CPN:16766720,TPN:4286945}),F=Object(n.Color)(16711935),U={saturation:o.ParamDefinition.Numeric(0,{min:-6,max:6,step:.1}),lightness:o.ParamDefinition.Numeric(1,{min:-6,max:6,step:.1})};function z(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function H(e,t){var r=e.coarseElements.seq_id_begin.value(t);if(r===e.coarseElements.seq_id_end.value(t)){var n=e.coarseElements.entityKey[t];return e.model.sequence.byEntityKey[n].sequence.compId.value(r-1)}}function G(e,t){var r=e[t];return void 0===r?F:r}var q={name:"residue-name",label:"Residue Name",category:"Residue Property",factory:function e(t,r){var n=Object(O.getAdjustedColorMap)(N,r.saturation,r.lightness);return{factory:e,granularity:"group",color:function(e){if(i.StructureElement.Location.is(e)){if(i.Unit.isAtomic(e.unit)){var t=z(e.unit,e.element);return G(n,t)}if(t=H(e.unit,e.element))return G(n,t)}else if(i.Bond.isLocation(e)){if(i.Unit.isAtomic(e.aUnit)){t=z(e.aUnit,e.aUnit.elements[e.aIndex]);return G(n,t)}if(t=H(e.aUnit,e.aUnit.elements[e.aIndex]))return G(n,t)}return F},props:r,description:"Assigns a color to every residue according to its name.",legend:Object(s.b)(Object.keys(N).map((function(e){return[e,N[e]]})).concat([["Unknown",F]]))}},getParams:function(e){return U},defaultValues:o.ParamDefinition.getDefaultValues(U),isApplicable:function(e){return!!e.structure}},W=r(22),X=r(181),Y=r(12),Q=Object(n.ColorMap)({alphaHelix:16711808,threeTenHelix:10485888,piHelix:6291584,betaTurn:6324479,betaStrand:16762880,coil:16777215,bend:6740169,turn:45670,dna:11403518,rna:16580962,carbohydrate:10921722}),K=Object(n.Color)(8421504),Z={saturation:o.ParamDefinition.Numeric(-1,{min:-6,max:6,step:.1}),lightness:o.ParamDefinition.Numeric(0,{min:-6,max:6,step:.1})};function J(e,t,r,n){var a=W.SecondaryStructureType.create(0);if(n&&i.Unit.isAtomic(t)){var o=n.get(t.invariantId);o&&(a=o.type[o.getIndex(t.residueIndex[r])])}if(W.SecondaryStructureType.is(a,2))return W.SecondaryStructureType.is(a,2048)?e.threeTenHelix:W.SecondaryStructureType.is(a,32768)?e.piHelix:e.alphaHelix;if(W.SecondaryStructureType.is(a,4))return e.betaStrand;if(W.SecondaryStructureType.is(a,8))return e.bend;if(W.SecondaryStructureType.is(a,16))return e.turn;var s=Object(x.b)(t,r);return 7===s?e.dna:6===s?e.rna:9===s?e.carbohydrate:5===s?e.coil:K}var $={name:"secondary-structure",label:"Secondary Structure",category:"Residue Property",factory:function e(t,r){var n=t.structure&&X.a.get(t.structure),a=n?Object(Y.i)(n.id,n.version):-1,o=Object(O.getAdjustedColorMap)(Q,r.saturation,r.lightness);return{factory:e,granularity:"group",color:function(e){return i.StructureElement.Location.is(e)?J(o,e.unit,e.element,null==n?void 0:n.value):i.Bond.isLocation(e)?J(o,e.aUnit,e.aUnit.elements[e.aIndex],null==n?void 0:n.value):K},props:r,contextHash:a,description:"Assigns a color based on the type of secondary structure and basic molecule type.",legend:Object(s.b)(Object.keys(Q).map((function(e){return[e,Q[e]]})).concat([["Other",K]]))}},getParams:function(e){return Z},defaultValues:o.ParamDefinition.getDefaultValues(Z),isApplicable:function(e){return!!e.structure},ensureCustomProperties:{attach:function(e,t){return t.structure?X.a.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&e.structure.customPropertyDescriptors.reference(X.a.descriptor,!1)}}},ee=Object(n.Color)(13421772),te={list:o.ParamDefinition.ColorList("turbo",{presetKind:"scale"})};function re(e,t){var r=e.model;switch(e.kind){case 0:var n=r.atomicHierarchy.residueAtomSegments.index[t];return r.atomicHierarchy.residues.label_seq_id.value(n);case 1:return Math.round((r.coarseHierarchy.spheres.seq_id_begin.value(t)+r.coarseHierarchy.spheres.seq_id_end.value(t))/2);case 2:return Math.round((r.coarseHierarchy.gaussians.seq_id_begin.value(t)+r.coarseHierarchy.gaussians.seq_id_end.value(t))/2)}}function ne(e,t){var r=e.model,n="";switch(e.kind){case 0:var i=r.atomicHierarchy.chainAtomSegments.index[t];n=r.atomicHierarchy.chains.label_entity_id.value(i);break;case 1:n=r.coarseHierarchy.spheres.entity_id.value(t);break;case 2:n=r.coarseHierarchy.gaussians.entity_id.value(t)}if(""===n)return 0;var a=r.entities.getEntityIndex(n);if(-1===a)return 0;var o=r.sequence.byEntityKey[a];return void 0===o?0:o.sequence.length}var ie={name:"sequence-id",label:"Sequence Id",category:"Residue Property",factory:function e(t,r){var a=n.ColorScale.create({listOrName:r.list.colors,minLabel:"Start",maxLabel:"End"});return{factory:e,granularity:"group",color:function(e){if(i.StructureElement.Location.is(e)){var t=e.unit,r=e.element;if((n=re(t,r))>0)if(o=ne(t,r))return a.setDomain(0,o-1),a.color(n)}else if(i.Bond.isLocation(e)){var n,o,s=e.aUnit,u=e.aIndex;if((n=re(s,s.elements[u]))>0)if(o=ne(s,s.elements[u]))return a.setDomain(0,o-1),a.color(n)}return ee},props:r,description:"Gives every polymer residue a color based on its `seq_id` value.",legend:a?a.legend:void 0}},getParams:function(e){return te},defaultValues:o.ParamDefinition.getDefaultValues(te),isApplicable:function(e){return!!e.structure}},ae=r(370),oe=Object(n.Color)(13421772),se=Object(h.__assign)({},Object(v.b)({type:"colors",colorList:"dark-2"}));var ue={name:"unit-index",label:"Chain Instance",category:"Chain Property",factory:function e(t,r){var n,a;if(t.structure){var o=t.structure.root.units,s=Object(v.a)(o.length,r);a=s.legend;for(var u=new Map,c=0,l=o.length;c<l;++c)u.set(o[c].id,s.color(c));n=function(e){return i.StructureElement.Location.is(e)?u.get(e.unit.id):i.Bond.isLocation(e)?u.get(e.aUnit.id):oe}}else n=function(){return oe};return{factory:e,granularity:"instance",color:n,props:r,description:"Gives every chain instance (single chain or collection of single elements) a unique color based on the position (index) of the chain in the list of chains in the structure.",legend:a}},getParams:function(e){var t=o.ParamDefinition.clone(se);return e.structure&&e.structure.root.units.length>A.ColorLists["dark-2"].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Object(h.__assign)(Object(h.__assign)({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:Object(A.getColorListFromName)("dark-2").list}})),t},defaultValues:o.ParamDefinition.getDefaultValues(se),isApplicable:function(e){return!!e.structure}},ce=Object(n.Color)(16777113),le={domain:o.ParamDefinition.Interval([0,100]),list:o.ParamDefinition.ColorList("red-white-blue",{presetKind:"scale"})};function de(e,t){return i.Unit.isAtomic(e)?e.model.atomicConformation.B_iso_or_equiv.value(t):i.Unit.isSpheres(e)?e.model.coarseConformation.spheres.rmsf[t]:0}var fe={name:"uncertainty",label:"Uncertainty/Disorder",category:"Atom Property",factory:function e(t,r){var a=n.ColorScale.create({reverse:!0,domain:r.domain,listOrName:r.list.colors});return{factory:e,granularity:"group",color:function(e){return i.StructureElement.Location.is(e)?a.color(de(e.unit,e.element)):i.Bond.isLocation(e)?a.color(de(e.aUnit,e.aUnit.elements[e.aIndex])):ce},props:r,description:"Assigns a color based on the uncertainty or disorder of an element's position, e.g. B-factor or RMSF, depending on the data availability and experimental technique.",legend:a?a.legend:void 0}},getParams:function(e){return le},defaultValues:o.ParamDefinition.getDefaultValues(le),isApplicable:function(e){return!!e.structure&&e.structure.models.some((function(e){return e.atomicConformation.B_iso_or_equiv.isDefined||e.coarseHierarchy.isDefined}))}},pe=r(179),me=r(74),he=Object(n.Color)(16448250),ge=Object(h.__assign)({},Object(v.b)({type:"colors",colorList:"dark-2"}));function ve(e,t){return e+"|"+t}function be(e,t,r,n,i,a){return e+"|"+t+"|"+r+"|"+(a||(i||n))}function ye(e,t,r,n,i,a,o,s){for(var u=i.entity_id,c=i.pdbx_src_id,l=i.pdbx_beg_seq_num,d=i.pdbx_end_seq_num,f=0,p=i._rowCount;f<p;++f){var m=u.value(f),h=ve(r,m),g=void 0;if(e.has(h))g=e.get(h);else{var v=n.entities.getEntityIndex(m),b=n.sequence.sequences[v].sequence;g=new Int16Array(b.length),e.set(h,g)}var y=o?o.value(f):"",_=s?s.value(f)[0]:"",S=be(r,m,a.value(f),c.value(f),y,_),x=0===l.valueKind(f)?l.value(f):1,O=0===d.valueKind(f)?d.value(f):g.length,w=void 0;t.has(S)?w=t.get(S):(w=t.size+1,t.set(S,w));for(var C=x,j=O;C<=j;++C)g[C-1]=w}}function _e(e){for(var t=new Map,r=new Map,n=0,i=e.length;n<i;++n){var a=e[n];if(me.a.is(a.sourceData)){var o=a.sourceData.data.db,s=o.entity_src_gen,u=o.entity_src_nat,c=o.pdbx_entity_src_syn;ye(t,r,n,a,s,s.pdbx_gene_src_scientific_name,s.plasmid_name,s.pdbx_gene_src_gene),ye(t,r,n,a,u,u.pdbx_organism_scientific,u.pdbx_plasmid_name),ye(t,r,n,a,c,c.organism_scientific)}}return{seqToSrcByModelEntity:t,srcKeySerialMap:r}}var Se={name:"entity-source",label:"Entity Source",category:"Chain Property",factory:function e(t,r){var n,a;if(t.structure){var o=i.StructureElement.Location.create(t.structure),s=t.structure.root.models,u=_e(s),c=u.seqToSrcByModelEntity,l=u.srcKeySerialMap,d=function(e){var t=0;return Array.from(e.keys()).map((function(e){var r=e.split("|"),n=r[2];return(Object(pe.d)(r[3])?"Unnamed "+ ++t:r[3])+(n?" ("+n+")":"")}))}(l),f=Object(v.a)(l.size,r,{valueLabel:function(e){return d[e]}});a=f.legend;var p=function(e){var t=ve(s.indexOf(e.unit.model),i.StructureProperties.entity.id(e)),r=c.get(t);return r?f.color(r[i.StructureProperties.residue.label_seq_id(e)-1]-1):he};n=function(e){return i.StructureElement.Location.is(e)?p(e):i.Bond.isLocation(e)?(o.unit=e.aUnit,o.element=e.aUnit.elements[e.aIndex],p(o)):he}}else n=function(){return he};return{factory:e,granularity:"group",color:n,props:r,description:"Gives ranges of a polymer chain a color based on the entity source it originates from (e.g. gene, plasmid, organism).",legend:a}},getParams:function(e){var t=o.ParamDefinition.clone(ge);return e.structure&&_e(e.structure.root.models).srcKeySerialMap.size>A.ColorLists["dark-2"].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Object(h.__assign)(Object(h.__assign)({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:Object(A.getColorListFromName)("dark-2").list}})),t},defaultValues:o.ParamDefinition.getDefaultValues(ge),isApplicable:function(e){return!!e.structure}},xe=Object(n.Color)(15658734),Oe=Object(h.__assign)({},m.b);var we={name:"illustrative",label:"Illustrative",category:"Miscellaneous",factory:function e(t,r){var a=Object(m.a)(t,r),o=a.color;function s(e,t){var r=o(e,!1);return"C"===t?n.Color.lighten(r,.8):r}return{factory:e,granularity:"group",color:function(e){if(i.StructureElement.Location.is(e)&&i.Unit.isAtomic(e.unit)){var t=e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element);return s(e,t)}if(i.Bond.isLocation(e)&&i.Unit.isAtomic(e.aUnit)){var r=e.aUnit.elements[e.aIndex];t=e.aUnit.model.atomicHierarchy.atoms.type_symbol.value(r);return s(e,t)}return xe},props:r,description:"Assigns an illustrative color that gives every chain a unique color with lighter carbons (inspired by David Goodsell's Molecule of the Month style).",legend:a.legend}},getParams:function(e){return Oe},defaultValues:o.ParamDefinition.getDefaultValues(Oe),isApplicable:function(e){return!!e.structure}},Ce={list:o.ParamDefinition.ColorList("red-yellow-green",{presetKind:"scale"}),scale:o.ParamDefinition.Select("DGwif",[["DGwif","DG water-membrane"],["DGwoct","DG water-octanol"],["Oct-IF","DG difference"]])};var je={DGwif:0,DGwoct:1,"Oct-IF":2};function Pe(e,t){return e.model.atomicHierarchy.atoms.label_comp_id.value(t)}function Ee(e,t){var r=e.coarseElements.seq_id_begin.value(t);if(r===e.coarseElements.seq_id_end.value(t)){var n=e.coarseElements.entityKey[t];return e.model.sequence.byEntityKey[n].sequence.compId.value(r-1)}}var Ae={name:"hydrophobicity",label:"Hydrophobicity",category:"Residue Property",factory:function e(t,r){var a=je[r.scale],o=1/0,s=-1/0;for(var u in W.ResidueHydrophobicity){var c=W.ResidueHydrophobicity[u][a];o=Math.min(o,c),s=Math.max(s,c)}var l=n.ColorScale.create({listOrName:r.list.colors,domain:[s,o],minLabel:"Hydrophobic",maxLabel:"Hydrophilic"});return{factory:e,granularity:"group",color:function(e){var t;return i.StructureElement.Location.is(e)?t=i.Unit.isAtomic(e.unit)?Pe(e.unit,e.element):Ee(e.unit,e.element):i.Bond.isLocation(e)&&(t=i.Unit.isAtomic(e.aUnit)?Pe(e.aUnit,e.aUnit.elements[e.aIndex]):Ee(e.aUnit,e.aUnit.elements[e.aIndex])),l.color(t?function(e,t){var r=W.ResidueHydrophobicity[e];return void 0===r?0:r[t]}(t,a):0)},props:r,description:'Assigns a color to every amino acid according to the "Experimentally determined hydrophobicity scale for proteins at membrane interfaces" by Wimely and White (doi:10.1038/nsb1096-842).',legend:l?l.legend:void 0}},getParams:function(e){return Ce},defaultValues:o.ParamDefinition.getDefaultValues(Ce),isApplicable:function(e){return!!e.structure}},De=Object(n.Color)(13421772),Te=Object(h.__assign)({},Object(v.b)({type:"colors",colorList:"purples"}));var Ie={name:"model-index",label:"Model Index",category:"Chain Property",factory:function e(t,r){var n,a,o,s;if(t.structure){for(var u=t.structure.root.models,c=0,l=0,d=u;l<d.length;l++){var f=d[l];c=Math.max(c,(null===(n=i.Model.TrajectoryInfo.get(f))||void 0===n?void 0:n.size)||0)}var p=Object(v.a)(c,r);s=p.legend;for(var m=new Map,h=0,g=u.length;h<g;++h){var b=(null===(a=i.Model.TrajectoryInfo.get(u[h]))||void 0===a?void 0:a.index)||0;m.set(b,p.color(b))}o=function(e){return i.StructureElement.Location.is(e)?m.get(i.Model.TrajectoryInfo.get(e.unit.model).index):i.Bond.isLocation(e)?m.get(i.Model.TrajectoryInfo.get(e.aUnit.model).index):De}}else o=function(){return De};return{factory:e,granularity:"instance",color:o,props:r,description:"Gives every model a unique color based on the position (index) of the model in the list of models in the structure.",legend:s}},getParams:function(e){return Te},defaultValues:o.ParamDefinition.getDefaultValues(Te),isApplicable:function(e){return!!e.structure&&e.structure.elementCount>0&&i.Model.TrajectoryInfo.get(e.structure.models[0]).size>1}},Me=Object(n.Color)(13421772),ke={domain:o.ParamDefinition.Interval([0,1]),list:o.ParamDefinition.ColorList("purples",{presetKind:"scale"})};function Be(e,t){return i.Unit.isAtomic(e)?e.model.atomicConformation.occupancy.value(t):0}var Ve={name:"occupancy",label:"Occupancy",category:"Atom Property",factory:function e(t,r){var a=n.ColorScale.create({reverse:!1,domain:r.domain,listOrName:r.list.colors});return{factory:e,granularity:"group",color:function(e){return i.StructureElement.Location.is(e)?a.color(Be(e.unit,e.element)):i.Bond.isLocation(e)?a.color(Be(e.aUnit,e.aUnit.elements[e.aIndex])):Me},props:r,description:"Assigns a color based on the occupancy of an atom.",legend:a?a.legend:void 0}},getParams:function(e){return ke},defaultValues:o.ParamDefinition.getDefaultValues(ke),isApplicable:function(e){return!!e.structure&&e.structure.models.some((function(e){return e.atomicConformation.occupancy.isDefined}))}},Re=r(257),Le=Object(n.Color)(13421772),Ne=Object(h.__assign)({},Object(v.b)({type:"colors",colorList:"dark-2"}));function Fe(e){return e.map((function(e){return(""+(e+1e4)).padStart(5,"0")})).join("")}function Ue(e){var t=Object(pe.c)(1e4,0);return[parseInt(e.substr(0,t))-1e4,parseInt(e.substr(t,t))-1e4,parseInt(e.substr(t+t,t))-1e4]}function ze(e){return e.map((function(e){return e+5})).join("")}function He(e){for(var t=new Map,r=new Set,n=0,i=e.units.length;n<i;++n){var a=Fe(e.units[n].conformation.operator.hkl);r.add(a)}var o=Array.from(r.values()).sort();return o.forEach((function(e){return t.set(e,t.size)})),{min:Ue(o[0]),max:Ue(o[o.length-1]),map:t}}var Ge={name:"operator-hkl",label:"Operator HKL",category:"Symmetry",factory:function e(t,r){var n,a;if(t.structure){var o=He(t.structure.root),s=o.min,u=o.max,c=o.map,l=[];c.forEach((function(e,t){var r=e%c.size,n=ze(Ue(t));void 0===l[r]?l[r]=n:l[r]+=", "+n}));var d={minLabel:ze(s),maxLabel:ze(u),valueLabel:function(e){return l[e]}},f=Object(v.a)(c.size,r,d);a=f.legend,n=function(e){var t=void 0;if(i.StructureElement.Location.is(e)){var r=Fe(e.unit.conformation.operator.hkl);t=c.get(r)}else if(i.Bond.isLocation(e)){r=Fe(e.aUnit.conformation.operator.hkl);t=c.get(r)}return void 0===t?Le:f.color(t)}}else n=function(){return Le};return{factory:e,granularity:"instance",color:n,props:r,description:"Assigns a color based on the operator HKL value of a transformed chain.",legend:a}},getParams:function(e){var t=o.ParamDefinition.clone(Ne);return e.structure&&He(e.structure.root).map.size>A.ColorLists["dark-2"].list.length&&(t.palette.defaultValue.name="colors",t.palette.defaultValue.params=Object(h.__assign)(Object(h.__assign)({},t.palette.defaultValue.params),{list:{kind:"interpolate",colors:Object(A.getColorListFromName)("dark-2").list}})),t},defaultValues:o.ParamDefinition.getDefaultValues(Ne),isApplicable:function(e){return!!e.structure}},qe=r(289),We=Object(n.Color)(16777113),Xe={domain:o.ParamDefinition.Interval([-1,1]),list:o.ParamDefinition.ColorList("red-white-blue",{presetKind:"scale"})};function Ye(e,t){var r;return null===(r=qe.a.Provider.get(e.model))||void 0===r?void 0:r.data.value(t)}var Qe,Ke={name:"partial-charge",label:"Partial Charge",category:"Atom Property",factory:function e(t,r){var a=n.ColorScale.create({domain:r.domain,listOrName:r.list.colors});return{factory:e,granularity:"group",color:function(e){var t;return i.StructureElement.Location.is(e)?void 0!==(t=Ye(e.unit,e.element))?a.color(t):We:i.Bond.isLocation(e)&&void 0!==(t=Ye(e.aUnit,e.aUnit.elements[e.aIndex]))?a.color(t):We},props:r,description:"Assigns a color based on the partial charge of an atom.",legend:a?a.legend:void 0}},getParams:function(e){return Xe},defaultValues:o.ParamDefinition.getDefaultValues(Xe),isApplicable:function(e){return!!e.structure&&e.structure.models.some((function(e){return void 0!==qe.a.Provider.get(e)}))}};!function(e){e.EmptyFactory=function(){return e.Empty};var t=Object(n.Color)(13421772);e.Empty={factory:e.EmptyFactory,granularity:"uniform",color:function(){return t},props:{}},e.areEqual=function(e,t){return e.contextHash===t.contextHash&&e.factory===t.factory&&Object(f.g)(e.props,t.props)},e.EmptyProvider={name:"",label:"",category:"",factory:e.EmptyFactory,getParams:function(){return{}},defaultValues:{},isApplicable:function(){return!0}},e.createRegistry=function(){return new p.b(e.BuiltIn,e.EmptyProvider)},e.BuiltIn={"carbohydrate-symbol":l,"chain-id":m.c,"element-index":_,"element-symbol":S.ElementSymbolColorThemeProvider,"entity-source":Se,hydrophobicity:Ae,illustrative:we,"model-index":Ie,"molecule-type":E,occupancy:Ve,"operator-hkl":Ge,"operator-name":Re.c,"partial-charge":Ke,"polymer-id":k,"polymer-index":L,"residue-name":q,"secondary-structure":$,"sequence-id":ie,"shape-group":ae.b,uncertainty:fe,"unit-index":ue,uniform:d.b}}(Qe||(Qe={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(1),i=r(6),a=r(128),o=r(9),s=n.Vec3.set,u=new a.a("14"),c=new a.a("98");var l=Object(n.Vec3)();function d(e){var t=e.x,r=e.y,a=e.z,d=e.radius,f=e.indices,p=i.OrderedSet.size(f);if(p>25e4){var m=o.b.computeBounding(e);return{box:m,sphere:o.g.fromBox3D(Object(o.g)(),m)}}var h=p>1e4?u:c;h.reset();for(var g=0;g<p;g++){var v=i.OrderedSet.getAt(f,g);s(l,t[v],r[v],a[v]),h.includePositionRadius(l,d&&d[v]||0)}h.finishedIncludeStep();for(g=0;g<p;g++){v=i.OrderedSet.getAt(f,g);s(l,t[v],r[v],a[v]),h.radiusPositionRadius(l,d&&d[v]||0)}var b=h.getSphere();if(!d&&o.g.hasExtrema(b)&&p<=b.extrema.length){var y=[];for(g=0;g<p;g++){v=i.OrderedSet.getAt(f,g);y.push(n.Vec3.create(t[v],r[v],a[v]))}o.g.setExtrema(b,y)}return{box:h.getBox(),sphere:b}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return d})),r.d(t,"c",(function(){return f})),r.d(t,"d",(function(){return p})),r.d(t,"a",(function(){return m}));var n=r(5),i=r(99),a=r(60),o=Object(i.a)();function s(e,t){switch(t){case"image-uint8":case"image-float32":case"image-float16":case"image-depth":return e.TEXTURE_2D}if(Object(a.q)(e))switch(t){case"image-int32":return e.TEXTURE_2D;case"volume-uint8":case"volume-float32":case"volume-float16":return e.TEXTURE_3D}throw new Error("unknown texture kind '"+t+"'")}function u(e,t,r){switch(t){case"alpha":return Object(a.q)(e)&&"float"===r?e.RED:Object(a.q)(e)&&"int"===r?e.RED_INTEGER:e.ALPHA;case"rgb":return Object(a.q)(e)&&"int"===r?e.RGB_INTEGER:e.RGB;case"rgba":return Object(a.q)(e)&&"int"===r?e.RGBA_INTEGER:e.RGBA;case"depth":return e.DEPTH_COMPONENT}}function c(e,t,r){switch(r){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"color0":case 0:return e.COLOR_ATTACHMENT0}if(t.drawBuffers)switch(r){case"color1":case 1:return t.drawBuffers.COLOR_ATTACHMENT1;case"color2":case 2:return t.drawBuffers.COLOR_ATTACHMENT2;case"color3":case 3:return t.drawBuffers.COLOR_ATTACHMENT3;case"color4":case 4:return t.drawBuffers.COLOR_ATTACHMENT4;case"color5":case 5:return t.drawBuffers.COLOR_ATTACHMENT5;case"color6":case 6:return t.drawBuffers.COLOR_ATTACHMENT6;case"color7":case 7:return t.drawBuffers.COLOR_ATTACHMENT7}throw new Error("unknown texture attachment")}function l(e){var t=e.createTexture();if(null===t)throw new Error("Could not create WebGL texture");return t}function d(e,t,r,n,i,d){var f=o(),p=l(e);if(r.endsWith("float32")&&"float"!==i||r.endsWith("float16")&&"fp16"!==i||r.endsWith("uint8")&&"ubyte"!==i||r.endsWith("int32")&&"int"!==i||r.endsWith("depth")&&"ushort"!==i)throw new Error("texture kind '"+r+"' and type '"+i+"' are incompatible");var m=s(e,r),h=function(e,t){switch(t){case"nearest":return e.NEAREST;case"linear":return e.LINEAR}}(e,d),g=u(e,n,i),v=function(e,t,r){if(Object(a.q)(e))switch(t){case"alpha":switch(r){case"ubyte":return e.ALPHA;case"float":return e.R32F;case"fp16":return e.R16F;case"int":return e.R32I}case"rgb":switch(r){case"ubyte":return e.RGB;case"float":return e.RGB32F;case"fp16":return e.RGB16F;case"int":return e.RGB32I}case"rgba":switch(r){case"ubyte":return e.RGBA;case"float":return e.RGBA32F;case"fp16":return e.RGBA16F;case"int":return e.RGBA32I}case"depth":return e.DEPTH_COMPONENT16}return u(e,t,r)}(e,n,i),b=function(e,t,r){switch(r){case"ubyte":return e.UNSIGNED_BYTE;case"ushort":return e.UNSIGNED_SHORT;case"float":return e.FLOAT;case"fp16":if(t.textureHalfFloat)return t.textureHalfFloat.HALF_FLOAT;throw new Error('extension "texture_half_float" unavailable');case"int":if(Object(a.q)(e))return e.INT;throw new Error('texture type "int" requires webgl2')}}(e,t,i);function y(){e.bindTexture(m,p),e.texParameteri(m,e.TEXTURE_MAG_FILTER,h),e.texParameteri(m,e.TEXTURE_MIN_FILTER,h),e.texParameteri(m,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(m,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.bindTexture(m,null)}y();var _,S=0,x=0,O=0,w=!1;function C(t,r,n){if(S!==t||x!==r||O!==(n||0))if(S=t,x=r,O=n||0,e.bindTexture(m,p),m===e.TEXTURE_2D)e.texImage2D(m,0,v,S,x,0,g,b,null);else{if(!Object(a.q)(e)||m!==e.TEXTURE_3D||void 0===O)throw new Error("unknown texture target");e.texImage3D(m,0,v,S,x,O,0,g,b,null)}}function j(t,r){if(void 0===r&&(r=!1),e.bindTexture(m,p),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),n=t,void 0!==typeof HTMLImageElement&&n instanceof HTMLImageElement)e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),e.bindTexture(e.TEXTURE_2D,p),e.texImage2D(e.TEXTURE_2D,0,v,g,b,t);else if(function(e,t,r){return t===r.TEXTURE_2D}(0,m,e))e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!!t.flipY),r?e.texSubImage2D(m,0,0,0,t.width,t.height,g,b,t.array):(S=t.width,x=t.height,e.texImage2D(m,0,v,S,x,0,g,b,t.array));else{if(!Object(a.q)(e)||!function(e,t,r){return t===r.TEXTURE_3D}(0,m,e))throw new Error("unknown texture target");e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!1),r?e.texSubImage3D(m,0,0,0,0,t.width,t.height,t.depth,g,b,t.array):(S=t.width,x=t.height,O=t.depth,e.texImage3D(m,0,v,S,x,O,0,g,b,t.array))}var n;e.bindTexture(m,null),_=t}return{id:f,target:m,format:g,internalFormat:v,type:b,getWidth:function(){return S},getHeight:function(){return x},getDepth:function(){return O},getByteCount:function(){return function(e,t,r,n,i){return function(e){switch(e){case"alpha":return 1;case"rgb":return 3;case"rgba":case"depth":return 4}}(e)*function(e){switch(e){case"ubyte":return 1;case"ushort":return 2;case"float":return 4;case"fp16":return 2;case"int":return 4}}(t)*r*n*(i||1)}(n,i,S,x,O)},define:C,load:j,bind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(m,p)},unbind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(m,null)},attachFramebuffer:function(r,n,i){if(r.bind(),m===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,c(e,t,n),e.TEXTURE_2D,p,0);else{if(!Object(a.q)(e)||m!==e.TEXTURE_3D)throw new Error("unknown/unsupported texture target");if(void 0===i)throw new Error("need `layer` to attach 3D texture");e.framebufferTextureLayer(e.FRAMEBUFFER,c(e,t,n),p,0,i)}},detachFramebuffer:function(r,n){if(r.bind(),m===e.TEXTURE_2D)e.framebufferTexture2D(e.FRAMEBUFFER,c(e,t,n),e.TEXTURE_2D,null,0);else{if(!Object(a.q)(e)||m!==e.TEXTURE_3D)throw new Error("unknown texture target");e.framebufferTextureLayer(e.FRAMEBUFFER,c(e,t,n),null,0,0)}},reset:function(){p=l(e),y();var t=[S,x,O];S=0,x=0,O=0,C(t[0],t[1],t[2]),_&&j(_)},destroy:function(){w||(e.deleteTexture(p),w=!0)}}}function f(e,t,r){var n=e.resources,i=[];return Object.keys(t).forEach((function(e){var a=t[e];if("texture"===a.type){var o=r[e];if(o)if("texture"===a.kind)i[i.length]=[e,o.ref.value];else{var s=n.texture(a.kind,a.format,a.dataType,a.filter);s.load(o.ref.value),i[i.length]=[e,s]}}})),i}function p(e,t,r){var i=new Image;i.onload=function(){r.load(i),n.e.update(t,r)},i.src=e}function m(e,t){var r=s(e,t);return{id:o(),target:r,format:0,internalFormat:0,type:0,getWidth:function(){return 0},getHeight:function(){return 0},getDepth:function(){return 0},getByteCount:function(){return 0},define:function(){},load:function(){},bind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(r,null)},unbind:function(t){e.activeTexture(e.TEXTURE0+t),e.bindTexture(r,null)},attachFramebuffer:function(){},detachFramebuffer:function(){},reset:function(){},destroy:function(){}}}},function(e,t,r){"use strict";function n(){return"function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}r.d(t,"a",(function(){return i}));var i=n()},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureRepresentation3D",(function(){return Yt})),r.d(t,"ExplodeStructureRepresentation3D",(function(){return Kt})),r.d(t,"UnwindStructureAssemblyRepresentation3D",(function(){return Qt})),r.d(t,"OverpaintStructureRepresentation3DFromScript",(function(){return Zt})),r.d(t,"OverpaintStructureRepresentation3DFromBundle",(function(){return Jt})),r.d(t,"TransparencyStructureRepresentation3DFromScript",(function(){return $t})),r.d(t,"TransparencyStructureRepresentation3DFromBundle",(function(){return er})),r.d(t,"ClippingStructureRepresentation3DFromScript",(function(){return tr})),r.d(t,"ClippingStructureRepresentation3DFromBundle",(function(){return rr})),r.d(t,"VolumeRepresentation3D",(function(){return nr})),r.d(t,"VolumeRepresentation3DHelpers",(function(){return Ht})),r.d(t,"ShapeRepresentation3D",(function(){return ir})),r.d(t,"ModelUnitcell3D",(function(){return ar})),r.d(t,"StructureSelectionsDistance3D",(function(){return or})),r.d(t,"StructureSelectionsAngle3D",(function(){return sr})),r.d(t,"StructureSelectionsDihedral3D",(function(){return ur})),r.d(t,"StructureSelectionsLabel3D",(function(){return cr})),r.d(t,"StructureSelectionsOrientation3D",(function(){return lr}));var n=r(0),i=r(4),a=r(36),o=r(13),s=r(17),u=r(94),c=r(2),l=r(8),d=r(47),f=r(125),p=r(41),m=r(54),h=r(62),g=r(121),v=r(160),b=r(124),y=r(51),_=r(5),S=r(115),x=r(132),O=r(23),w=r(6),C=r(65),j=r(48);function P(e,t,r){void 0===r&&(r={});var i,a,o,l,d=0,P=new h.a,E=p.a.createState(),A=Object(g.c)(),D=[],T=u.a.createEmpty(),I=c.ParamDefinition.getDefaultValues(t.Params);r.modifyState&&p.a.updateState(E,r.modifyState(E));var M=v.a.create();function k(e,t){return Object(O.isEveryLoci)(e)||m.a.isLoci(e)&&e.shape===a?t(w.Interval.ofBounds(0,a.groupCount*a.transforms.length)):function(e,t,r){if(!m.b.isLoci(e))return!1;if(e.shape!==t)return!1;for(var n=!1,i=t.groupCount,a=e.groups,o=0,s=a;o<s.length;o++){var u=s[o],c=u.ids,l=u.instance;if(w.Interval.is(c)){var d=l*i+w.Interval.start(c),f=l*i+w.Interval.end(c);r(w.Interval.ofBounds(d,f))&&(n=!0)}else for(var p=0,h=c.length;p<h;p++){var g=l*i+c[p];r(w.Interval.ofSingleton(g))&&(n=!0)}}return n}(e,a,t)}return{label:"Shape geometry",get groupCount(){return o?o.count:0},get props(){return I},get params(){},get state(){return E},get theme(){return T},renderObjects:D,updated:P,createOrUpdate:function(u,c){var h=this;return void 0===u&&(u={}),r.modifyProps&&(u=r.modifyProps(u)),s.b.create("ShapeRepresentation.create",(function(s){return Object(n.__awaiter)(h,void 0,void 0,(function(){var h,y,O,w,C,j,k,B;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return h=Object.assign(I,u),c?[4,e(s,c,h,a)]:[3,2];case 1:return O=n.sent(),[3,3];case 2:O=void 0,n.label=3;case 3:if(function(e,t){void 0===e&&(e={}),v.a.reset(M),(t||a)&&(t&&!a?M.createNew=!0:t&&a&&t.id===a.id||(t&&a&&t.id!==a.id?(M.updateTransform=!0,M.createGeometry=!0):t&&console.warn("unexpected state")),M.updateTransform&&(M.updateColor=!0,M.updateSize=!0),M.createGeometry&&(M.updateColor=!0,M.updateSize=!0))}(u,y=O),y&&(a=y,Object.assign(T,m.a.getTheme(a))),M.createNew)D.length=0,o=m.a.groupIterator(a),w=m.a.createTransform(a.transforms),C=t.createValues(a.geometry,w,o,T,h),j=t.createRenderableState(h),r.modifyState&&Object.assign(j,r.modifyState(j)),p.a.updateState(E,j),(i=Object(g.a)(a.geometry.kind,C,j,A))&&D.push(i),l=t.createPositionIterator(a.geometry,i.values);else{if(!i)throw new Error("expected renderObject to be available");M.updateTransform&&(m.a.createTransform(a.transforms,i.values),o=m.a.groupIterator(a),k=o.instanceCount,B=o.groupCount,Object(b.a)(k*B,i.values)),M.createGeometry&&(_.e.updateIfChanged(i.values.drawCount,f.a.getDrawCount(a.geometry)),_.e.updateIfChanged(i.values.uVertexCount,f.a.getVertexCount(a.geometry))),(M.updateTransform||M.createGeometry)&&(t.updateBoundingSphere(i.values,a.geometry),l=t.createPositionIterator(a.geometry,i.values)),M.updateColor&&Object(S.a)(o,l,T.color,i.values),M.updateSize&&"uSize"in i.values&&Object(x.a)(o,T.size,i.values),t.updateValues(i.values,h),t.updateRenderableState(i.state,h)}return I=h,P.next(d++),[2]}}))}))}))},getLoci:function(e){if(void 0===e)return m.a.Loci(a);var t=e.objectId,r=e.groupId,n=e.instanceId;return i&&i.id===t?m.b.Loci(a,[{ids:w.OrderedSet.ofSingleton(r),instance:n}]):O.EmptyLoci},mark:function(e,t){if(!y.b.is(E.markerActions,t))return!1;if(m.b.isLoci(e)||m.a.isLoci(e)){if(e.shape!==a)return!1}else if(!Object(O.isEveryLoci)(e))return!1;return C.a.mark(i,e,t,k)},setState:function(e){r.modifyState&&(e=r.modifyState(e)),i&&(void 0!==e.visible&&C.a.setVisibility(i,e.visible),void 0!==e.alphaFactor&&C.a.setAlphaFactor(i,e.alphaFactor),void 0!==e.pickable&&C.a.setPickable(i,e.pickable),void 0!==e.colorOnly&&C.a.setColorOnly(i,e.colorOnly),void 0!==e.overpaint&&C.a.setOverpaint(i,e.overpaint,k,!0),void 0!==e.transparency&&C.a.setTransparency(i,e.transparency,k,!0),void 0!==e.transform&&C.a.setTransform(i,e.transform)),p.a.updateState(E,e)},setTheme:function(e){j.a&&console.warn("The `ShapeRepresentation` theme is fixed to `ShapeGroupColorTheme` and `ShapeGroupSizeTheme`. Colors are taken from `Shape.getColor` and sizes from `Shape.getSize`")},destroy:function(){D.length=0,i&&(i.state.disposed=!0,i=void 0)}}}var E=r(1),A=r(188),D=Object(E.Mat4)(),T=function(){function e(e){this.structure=e,this.groupUnitTransforms=[],this.unitOffsetMap=w.IntMap.Mutable(),this.groupIndexMap=w.IntMap.Mutable(),this._isIdentity=void 0,this.version=0,this.unitTransforms=new Float32Array(16*e.units.length),this.size=e.units.length,this.reset();for(var t=0,r=0,n=e.unitSymmetryGroups.length;r<n;++r){var i=e.unitSymmetryGroups[r];this.groupIndexMap.set(i.hashCode,r);var a=this.unitTransforms.subarray(t,t+16*i.units.length);this.groupUnitTransforms.push(a);for(var o=0,s=i.units.length;o<s;++o)this.unitOffsetMap.set(i.units[o].id,t+16*o);t+=16*i.units.length}}return e.prototype.reset=function(){this.version=0,Object(A.c)(this.unitTransforms,this.size),this._isIdentity=!0},Object.defineProperty(e.prototype,"isIdentity",{get:function(){if(void 0===this._isIdentity){this._isIdentity=!0;for(var e=0,t=16*this.size;e<t;e+=16)if(E.Mat4.fromArray(D,this.unitTransforms,e),!E.Mat4.isIdentity(D)){this._isIdentity=!1;break}}return this._isIdentity},enumerable:!1,configurable:!0}),e.prototype.setTransform=function(e,t){this.version=(this.version+1)%2147483647,E.Mat4.toArray(e,this.unitTransforms,this.unitOffsetMap.get(t.id)),this._isIdentity=void 0},e.prototype.getTransform=function(e,t){return E.Mat4.fromArray(e,this.unitTransforms,this.unitOffsetMap.get(t.id))},e.prototype.getSymmetryGroupTransforms=function(e){return this.groupUnitTransforms[this.groupIndexMap.get(e.hashCode)]},e}(),I=r(9),M=E.Mat4.zero();function k(e,t,r){for(var n=0,i=e.units.length;n<i;n++){var a=e.units[n];I.h.lerpFromIdentity(M,a.conformation.operator,r),t.setTransform(M,a)}}var B=E.Vec3.zero(),V=E.Vec3.zero(),R=E.Mat4.zero();function L(e,t,r){for(var n=e.boundary.sphere,i=n.radius*r,a=0,o=e.units.length;a<o;a++){var s=e.units[a];E.Vec3.transformMat4(B,s.lookup3d.boundary.sphere.center,s.conformation.operator.matrix),E.Vec3.sub(V,B,n.center),E.Vec3.setMagnitude(V,V,i),E.Mat4.fromTranslation(R,V),t.setTransform(R,s)}}var N=r(24),F=r(140),U=r(141),z=r(30),H=r(126),G=r(38),q=r(35),W=r(256),X=r(190),Y=E.Mat4.fromTranslation(Object(E.Mat4)(),E.Vec3.create(.5,.5,.5)),Q=Object(X.c)(Object(X.a)(Object(W.b)()),Y),K=Object(E.Vec3)(),Z=Object(E.Mat4)(),J=Object(n.__assign)(Object(n.__assign)({},G.a.Params),{cellColor:c.ParamDefinition.Color(d.a.orange),cellScale:c.ParamDefinition.Numeric(2,{min:.1,max:5,step:.1}),ref:c.ParamDefinition.Select("model",c.ParamDefinition.objectToOptions({origin:"Origin",model:"Model"}),{isEssential:!0}),attachment:c.ParamDefinition.Select("corner",c.ParamDefinition.objectToOptions({corner:"Corner",center:"Center"}),{isEssential:!0})}),$={mesh:function(e,t){return P(te,G.a.Utils)}},ee=Object(n.__assign)({},J);function te(e,t,r,n){var a=function(e,t,r){var n=q.a.createState(256,128,r),i=e.symmetry.spacegroup.cell.fromFractional;E.Vec3.copy(K,e.ref),"center"===t.attachment?(E.Vec3.trunc(K,K),E.Vec3.subScalar(K,K,.5)):E.Vec3.floor(K,K),E.Mat4.fromTranslation(Z,K);var a=Object(X.c)(Object(X.a)(Q),Z),o=Math.cbrt(e.symmetry.spacegroup.cell.volume)/300*t.cellScale;n.currentGroup=1,q.a.addCage(n,i,a,o,2,20);var s=I.g.fromDimensionsAndTransform(Object(I.g)(),E.Vec3.unit,i);E.Vec3.transformMat4(K,K,i),I.g.translate(s,s,K),I.g.expand(s,s,o);var u=q.a.getMesh(n);return u.setBoundingSphere(s),u}(t,r,n&&n.geometry),o=i.Symmetry.getUnitcellLabel(t.symmetry);return m.a.create(o,t,a,(function(){return r.cellColor}),(function(){return 1}),(function(){return o}))}function re(e,t,r){var n=Object(E.Vec3)();return"model"===r.ref&&E.Vec3.transformMat4(n,i.Model.getCenter(e),t.spacegroup.cell.toFractional),{symmetry:t,ref:n}}var ne=r(80),ie=r(144),ae=r(170),oe=r(216),se=r(77),ue=r(232),ce={unitLabel:c.ParamDefinition.Text("Å",{isEssential:!0})},le=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},ne.a.Params),ce),{lineSizeAttenuation:c.ParamDefinition.Boolean(!0),linesColor:c.ParamDefinition.Color(d.a.lightgreen,{isEssential:!0}),linesSize:c.ParamDefinition.Numeric(.075,{min:.01,max:5,step:.01}),dashLength:c.ParamDefinition.Numeric(.2,{min:.01,max:.2,step:.01})}),de=Object(n.__assign)(Object(n.__assign)({},ue.a),ce),fe={lines:function(e,t){return P(ve,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{markerActions:y.b.Highlighting})}})},text:function(e,t){return P(be,ie.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{markerActions:y.a.None})}})}},pe=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},le),de),{visuals:c.ParamDefinition.MultiSelect(["lines","text"],c.ParamDefinition.objectToOptions(fe))});function me(e,t){var r=t.sphereA,n=t.sphereB,i=t.center,a=e.loci,o=a[0],s=a[1];return O.Loci.getBoundingSphere(o,r),O.Loci.getBoundingSphere(s,n),E.Vec3.add(i,r.center,n.center),E.Vec3.scale(i,i,.5),t.distance=E.Vec3.distance(r.center,n.center),t}var he={sphereA:Object(I.g)(),sphereB:Object(I.g)(),center:Object(E.Vec3)(),distance:0};function ge(e,t){return 1===e.pairs.length?"Distance "+Object(se.distanceLabel)(e.pairs[0],{unitLabel:t,measureOnly:!0}):e.pairs.length+" Distances"}function ve(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.pairs.length;i<a;++i)me(e.pairs[i],he),n.addFixedLengthDashes(he.sphereA.center,he.sphereB.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=ge(t,r.unitLabel);return m.a.create(a,t,i,(function(){return r.linesColor}),(function(){return r.linesSize}),(function(e){return Object(se.distanceLabel)(t.pairs[e],r)}))}function be(e,t,r,n){var i=function(e,t,r){for(var n=oe.a.create(t,128,64,r),i=0,a=e.pairs.length;i<a;++i){me(e.pairs[i],he);var o=he.center,s=he.distance,u=he.sphereA,c=he.sphereB,l=t.customText||s.toFixed(2)+" "+t.unitLabel,d=Math.max(2,u.radius,c.radius)/2;n.add(l,o[0],o[1],o[2],1,d,i)}return n.getText()}(t,r,n&&n.geometry),a=ge(t,r.unitLabel);return m.a.create(a,t,i,(function(){return r.textColor}),(function(){return r.textSize}),(function(e){return Object(se.distanceLabel)(t.pairs[e],r)}))}function ye(e){return{pairs:[{loci:[e[0].loci,e[1].loci]}]}}function _e(e){return{triples:[{loci:[e[0].loci,e[1].loci,e[2].loci]}]}}function Se(e){return{quads:[{loci:[e[0].loci,e[1].loci,e[2].loci,e[3].loci]}]}}function xe(e){return{infos:[{loci:e[0].loci}]}}function Oe(e){return{locis:[e[0].loci]}}var we=Object(n.__assign)(Object(n.__assign)({},ue.a),{offsetZ:c.ParamDefinition.Numeric(2,{min:0,max:10,step:.1})}),Ce={text:function(e,t){return P(Ae,ie.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})}},je=Object(n.__assign)(Object(n.__assign)({},we),{scaleByRadius:c.ParamDefinition.Boolean(!0),visuals:c.ParamDefinition.MultiSelect(["text"],c.ParamDefinition.objectToOptions(Ce))}),Pe=Object(I.g)();function Ee(e,t){return void 0===t&&(t=!1),e.label||Object(se.lociLabel)(e.loci,{hidePrefix:!0,htmlStyling:!1,condensed:t})}function Ae(e,t,r,n){var i=function(e,t,r){for(var n=oe.a.create(t,128,64,r),i=t.customText.trim(),a=0,o=e.infos.length;a<o;++a){var s=e.infos[a],u=O.Loci.getBoundingSphere(s.loci,Pe);if(u){var c=u.center,l=u.radius,d=i||Ee(s,!0);n.add(d,c[0],c[1],c[2],t.scaleByRadius?l/.9:0,t.scaleByRadius?Math.max(1,l):1,a)}}return n.getText()}(t,r,n&&n.geometry),a=function(e){return 1===e.infos.length?Ee(e.infos[0]):e.infos.length+" Labels"}(t),o=r.customText.trim(),s=o?function(e){return o}:function(e){return Ee(t.infos[e])};return m.a.create(a,t,i,(function(){return r.textColor}),(function(){return r.textSize}),s)}var De=Object(E.Vec3)(),Te=E.Mat4.identity(),Ie=new Float32Array(18),Me=new Uint8Array([0,1,2,3,4,5]);function ke(e,t,r,n,i){var a=t.origin,o=t.dirA,s=t.dirB,u=t.dirC;E.Vec3.add(De,a,o),E.Vec3.toArray(E.Vec3.add(De,a,o),Ie,0),E.Vec3.toArray(E.Vec3.sub(De,a,o),Ie,3),E.Vec3.toArray(E.Vec3.add(De,a,s),Ie,6),E.Vec3.toArray(E.Vec3.sub(De,a,s),Ie,9),E.Vec3.toArray(E.Vec3.add(De,a,u),Ie,12),E.Vec3.toArray(E.Vec3.sub(De,a,u),Ie,15);var c=Object(X.b)(Ie,Me),l=I.a.volume(t),d=Math.cbrt(l)/300*r;q.a.addCage(e,Te,c,d,n,i)}r(91),r(82),E.Vec3.zero(),E.Vec3.zero();var Be=Object(E.Vec3)(),Ve=Object(E.Vec3)(),Re=Object(E.Vec3)(),Le=Object(E.Vec3)(),Ne=E.Mat4.identity(),Fe=new Float32Array(24),Ue=new Uint8Array([0,1,0,3,0,6,1,2,1,7,2,3,2,4,3,5,4,5,4,7,5,6,6,7]);function ze(e,t,r,n,i){var a=t.origin,o=t.dirA,s=t.dirB,u=t.dirC,c=E.Vec3.negate(Ve,o),l=E.Vec3.negate(Re,s),d=E.Vec3.negate(Le,u),f=0,p=function(e,t,r){E.Vec3.copy(Be,a),E.Vec3.add(Be,Be,e),E.Vec3.add(Be,Be,t),E.Vec3.add(Be,Be,r),E.Vec3.toArray(Be,Fe,f),f+=3};p(o,s,u),p(o,s,d),p(o,l,d),p(o,l,u),p(c,l,d),p(c,l,u),p(c,s,u),p(c,s,d);var m=Object(X.b)(Fe,Ue),h=I.a.volume(t),g=Math.cbrt(h)/300*r;q.a.addCage(e,Ne,m,g,n,i)}var He=r(317),Ge={color:c.ParamDefinition.Color(d.a.orange),scale:c.ParamDefinition.Numeric(2,{min:.1,max:10,step:.1})},qe=Object(n.__assign)(Object(n.__assign)({},G.a.Params),Ge),We=Object(n.__assign)(Object(n.__assign)({},G.a.Params),Ge),Xe=(Object(n.__assign)(Object(n.__assign)({},G.a.Params),Ge),{axes:function(e,t){return P(Ze,G.a.Utils)},box:function(e,t){return P(Je,G.a.Utils)},ellipsoid:function(e,t){return P($e,G.a.Utils)}}),Ye=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},qe),We),{visuals:c.ParamDefinition.MultiSelect(["box"],c.ParamDefinition.objectToOptions(Xe)),color:c.ParamDefinition.Color(d.a.orange),scale:c.ParamDefinition.Numeric(2,{min:.1,max:5,step:.1})});function Qe(e){return"Principal Axes of "+Object(se.lociLabel)(e,{countsOnly:!0})}function Ke(e){return 1===e.locis.length?Qe(e.locis[0]):e.locis.length+" Orientations"}function Ze(e,t,r,n){var i=function(e,t,r){for(var n=q.a.createState(256,128,r),i=0,a=e.locis.length;i<a;++i){var o=O.Loci.getPrincipalAxes(e.locis[i]);o&&(n.currentGroup=i,ke(n,o.momentsAxes,t.scale,2,20))}return q.a.getMesh(n)}(t,r,n&&n.geometry),a=Ke(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return 1}),(function(e){return Qe(t.locis[e])}))}function Je(e,t,r,n){var i=function(e,t,r){for(var n=q.a.createState(256,128,r),i=0,a=e.locis.length;i<a;++i){var o=O.Loci.getPrincipalAxes(e.locis[i]);o&&(n.currentGroup=i,ze(n,o.boxAxes,t.scale,2,20))}return q.a.getMesh(n)}(t,r,n&&n.geometry),a=Ke(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return 1}),(function(e){return Qe(t.locis[e])}))}function $e(e,t,r,n){var i=function(e,t,r){for(var n=q.a.createState(256,128,r),i=0,a=e.locis.length;i<a;++i){var o=O.Loci.getPrincipalAxes(e.locis[i]);if(o){var s=o.boxAxes,u=s.origin,c=s.dirA,l=s.dirB,d=I.a.size(Object(E.Vec3)(),s);E.Vec3.scale(d,d,.5);var f=E.Vec3.create(d[2],d[1],d[0]);n.currentGroup=i,Object(He.a)(n,u,c,l,f,2)}}return q.a.getMesh(n)}(t,0,n&&n.geometry),a=Ke(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return 1}),(function(e){return Qe(t.locis[e])}))}var et=r(44),tt={radius:1,segments:36,thetaStart:0,thetaLength:2*Math.PI};function rt(e){var t=Object(n.__assign)(Object(n.__assign)({},tt),e),r=t.radius,i=t.segments,a=t.thetaStart,o=t.thetaLength,s=o===2*Math.PI,u=s?i+1:i+2,c=new Float32Array(3*u),l=new Float32Array(3*u),d=new Uint32Array(3*i);c[0]=0,c[1]=0,c[2]=0,l[0]=0,l[1]=1,l[2]=0;for(var f=0,p=3;f<i;++f,p+=3){var m=a+f/i*o;c[p]=r*Math.sin(m),c[p+1]=0,c[p+2]=r*Math.cos(m),l[p]=0,l[p+1]=1,l[p+2]=0}for(f=1,p=0;f<i;++f,p+=3)d[p]=f,d[p+1]=f+1,d[p+2]=0;if(s){d[h=3*(i-1)]=i,d[h+1]=1,d[h+2]=0}else{var h;m=a+o;c[p=3*(i+1)]=r*Math.sin(m),c[p+1]=0,c[p+2]=r*Math.cos(m),l[p]=0,l[p+1]=1,l[p+2]=0,d[h=3*(i-1)]=i,d[h+1]=i+1,d[h+2]=0}return{vertices:c,normals:l,indices:d}}var nt=r(137),it={color:c.ParamDefinition.Color(d.a.lightgreen),arcScale:c.ParamDefinition.Numeric(.7,{min:.01,max:1,step:.01})},at=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},ne.a.Params),it),{lineSizeAttenuation:c.ParamDefinition.Boolean(!0),linesSize:c.ParamDefinition.Numeric(.04,{min:.01,max:5,step:.01}),dashLength:c.ParamDefinition.Numeric(.04,{min:.01,max:.2,step:.01})}),ot=Object(n.__assign)({},at),st=Object(n.__assign)({},at),ut=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},G.a.Params),it),{ignoreLight:c.ParamDefinition.Boolean(!0),sectorOpacity:c.ParamDefinition.Numeric(.75,{min:0,max:1,step:.01})}),ct={vectors:function(e,t){return P(vt,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})},arc:function(e,t){return P(bt,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})},sector:function(e,t){return P(yt,G.a.Utils,{modifyProps:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{alpha:e.sectorOpacity})},modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{markerActions:y.b.Highlighting})}})},text:function(e,t){return P(_t,ie.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{markerActions:y.a.None})}})}},lt=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},ot),st),ut),ue.a),{visuals:c.ParamDefinition.MultiSelect(["vectors","sector","text"],c.ParamDefinition.objectToOptions(ct))});var dt=Object(E.Vec3)(),ft=Object(E.Mat4)();function pt(e,t,r){var n=t.sphereA,i=t.sphereB,a=t.sphereC,o=t.arcDirA,s=t.arcDirC,u=t.arcNormal,c=e.loci,l=c[0],d=c[1],f=c[2];O.Loci.getBoundingSphere(l,n),O.Loci.getBoundingSphere(d,i),O.Loci.getBoundingSphere(f,a),E.Vec3.sub(o,n.center,i.center),E.Vec3.sub(s,a.center,i.center),E.Vec3.cross(u,o,s);var p=Math.min(E.Vec3.magnitude(o),E.Vec3.magnitude(s))*r;return t.radius=p,t.angle=E.Vec3.angle(o,s),t}function mt(e,t){var r=e.radius,n=e.angle,i=t?Object(et.b)(n,r)/t:32;E.Mat4.targetTo(ft,e.sphereB.center,e.sphereA.center,e.arcNormal),E.Mat4.setTranslation(ft,e.sphereB.center),E.Mat4.mul(ft,ft,E.Mat4.rotY180);var a=rt({radius:r,thetaLength:n,segments:i});return Object(nt.c)(a,ft)}var ht={sphereA:Object(I.g)(),sphereB:Object(I.g)(),sphereC:Object(I.g)(),arcDirA:Object(E.Vec3)(),arcDirC:Object(E.Vec3)(),arcNormal:Object(E.Vec3)(),radius:0,angle:0};function gt(e){return 1===e.triples.length?"Angle "+Object(se.angleLabel)(e.triples[0],{measureOnly:!0}):e.triples.length+" Angles"}function vt(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.triples.length;i<a;++i)pt(e.triples[i],ht,t.arcScale),n.addFixedLengthDashes(ht.sphereB.center,ht.sphereA.center,t.dashLength,i),n.addFixedLengthDashes(ht.sphereB.center,ht.sphereC.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=gt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return r.linesSize}),(function(){return""}))}function bt(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.triples.length;i<a;++i){pt(e.triples[i],ht,t.arcScale);for(var o=mt(ht,t.dashLength),s=o.indices,u=o.vertices,c=0,l=s.length;c<l;c+=3)if(c%2!=1){var d=3*s[c],f=3*s[c+1],p=u[d],m=u[d+1],h=u[d+2],g=u[f],v=u[f+1],b=u[f+2];n.add(p,m,h,g,v,b,i)}}return n.getLines()}(t,r,n&&n.geometry),a=gt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return r.linesSize}),(function(){return""}))}function yt(e,t,r,n){var i=function(e,t,r){for(var n=q.a.createState(128,64,r),i=0,a=e.triples.length;i<a;++i){pt(e.triples[i],ht,t.arcScale);var o=mt(ht);n.currentGroup=i,q.a.addPrimitive(n,E.Mat4.id,o),q.a.addPrimitiveFlipped(n,E.Mat4.id,o)}return q.a.getMesh(n)}(t,r,n&&n.geometry),a=gt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return 1}),(function(e){return Object(se.angleLabel)(t.triples[e])}))}function _t(e,t,r,n){var i=function(e,t,r){for(var n=oe.a.create(t,128,64,r),i=0,a=e.triples.length;i<a;++i){pt(e.triples[i],ht,t.arcScale),E.Vec3.add(dt,ht.arcDirA,ht.arcDirC),E.Vec3.setMagnitude(dt,dt,ht.radius),E.Vec3.add(dt,ht.sphereB.center,dt);var o=Object(et.f)(ht.angle).toFixed(2),s=t.customText||o+"°",u=Math.max(2,ht.sphereA.radius,ht.sphereB.radius,ht.sphereC.radius)/2;n.add(s,dt[0],dt[1],dt[2],.1,u,i)}return n.getText()}(t,r,n&&n.geometry),a=gt(t);return m.a.create(a,t,i,(function(){return r.textColor}),(function(){return r.textSize}),(function(e){return Object(se.angleLabel)(t.triples[e])}))}var St={color:c.ParamDefinition.Color(d.a.lightgreen),arcScale:c.ParamDefinition.Numeric(.7,{min:.01,max:1,step:.01})},xt=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},ne.a.Params),St),{lineSizeAttenuation:c.ParamDefinition.Boolean(!0),linesSize:c.ParamDefinition.Numeric(.04,{min:.01,max:5,step:.01}),dashLength:c.ParamDefinition.Numeric(.04,{min:.01,max:.2,step:.01})}),Ot=Object(n.__assign)({},xt),wt=Object(n.__assign)({},xt),Ct=Object(n.__assign)({},xt),jt=Object(n.__assign)({},xt),Pt=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},G.a.Params),St),{ignoreLight:c.ParamDefinition.Boolean(!0),sectorOpacity:c.ParamDefinition.Numeric(.75,{min:0,max:1,step:.01})}),Et={vectors:function(e,t){return P(Vt,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})},extenders:function(e,t){return P(Nt,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})},connector:function(e,t){return P(Rt,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})},arms:function(e,t){return P(Lt,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})},arc:function(e,t){return P(Ft,ne.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{pickable:!1})}})},sector:function(e,t){return P(Ut,G.a.Utils,{modifyProps:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{alpha:e.sectorOpacity})},modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{markerActions:y.b.Highlighting})}})},text:function(e,t){return P(zt,ie.a.Utils,{modifyState:function(e){return Object(n.__assign)(Object(n.__assign)({},e),{markerActions:y.a.None})}})}},At=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},Ot),wt),Ct),jt),Pt),ue.a),{visuals:c.ParamDefinition.MultiSelect(["extenders","arms","sector","text"],c.ParamDefinition.objectToOptions(Et))});var Dt=Object(E.Vec3)(),Tt=Object(E.Mat4)();function It(e,t,r){var n=t.sphereA,i=t.sphereB,a=t.sphereC,o=t.sphereD,s=t.dirBA,u=t.dirCD,c=t.projA,l=t.projD,d=t.arcPointA,f=t.arcPointD,p=t.arcDirA,m=t.arcDirD,h=t.arcCenter,g=t.arcNormal,v=e.loci,b=v[0],y=v[1],_=v[2],S=v[3];O.Loci.getBoundingSphere(b,n),O.Loci.getBoundingSphere(y,i),O.Loci.getBoundingSphere(_,a),O.Loci.getBoundingSphere(S,o),E.Vec3.add(h,i.center,a.center),E.Vec3.scale(h,h,.5),E.Vec3.sub(s,n.center,i.center),E.Vec3.sub(u,o.center,a.center),E.Vec3.add(d,h,s),E.Vec3.add(f,h,u),E.Vec3.sub(g,a.center,i.center),E.Vec3.orthogonalize(p,g,s),E.Vec3.orthogonalize(m,g,u),E.Vec3.projectPointOnVector(c,d,p,h),E.Vec3.projectPointOnVector(l,f,m,h);var x=Math.min(E.Vec3.distance(c,h),E.Vec3.distance(l,h))*r;E.Vec3.setMagnitude(p,p,x),E.Vec3.setMagnitude(m,m,x),E.Vec3.add(d,h,p),E.Vec3.add(f,h,m),t.radius=x,t.angle=E.Vec3.dihedralAngle(n.center,i.center,a.center,o.center),E.Vec3.matchDirection(Dt,g,E.Vec3.sub(Dt,d,n.center));var w=E.Vec3.angle(s,Dt),C=x/Math.cos(w-et.d);E.Vec3.add(c,i.center,E.Vec3.setMagnitude(Dt,s,C)),E.Vec3.matchDirection(Dt,g,E.Vec3.sub(Dt,f,o.center));var j=E.Vec3.angle(u,Dt),P=x/Math.cos(j-et.d);return E.Vec3.add(l,a.center,E.Vec3.setMagnitude(Dt,u,P)),t}function Mt(e,t){var r=e.radius,n=e.angle,i=t?Object(et.b)(n,r)/t:32;E.Mat4.targetTo(Tt,e.arcCenter,n<0?e.arcPointD:e.arcPointA,e.arcNormal),E.Mat4.setTranslation(Tt,e.arcCenter),E.Mat4.mul(Tt,Tt,E.Mat4.rotY180);var a=rt({radius:r,thetaLength:Math.abs(n),segments:i});return Object(nt.c)(a,Tt)}var kt={sphereA:Object(I.g)(),sphereB:Object(I.g)(),sphereC:Object(I.g)(),sphereD:Object(I.g)(),dirBA:Object(E.Vec3)(),dirCD:Object(E.Vec3)(),projA:Object(E.Vec3)(),projD:Object(E.Vec3)(),arcPointA:Object(E.Vec3)(),arcPointD:Object(E.Vec3)(),arcDirA:Object(E.Vec3)(),arcDirD:Object(E.Vec3)(),arcCenter:Object(E.Vec3)(),arcNormal:Object(E.Vec3)(),radius:0,angle:0};function Bt(e){return 1===e.quads.length?"Dihedral "+Object(se.dihedralLabel)(e.quads[0],{measureOnly:!0}):e.quads.length+" Dihedrals"}function Vt(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.quads.length;i<a;++i)It(e.quads[i],kt,t.arcScale),n.addFixedLengthDashes(kt.arcCenter,kt.arcPointA,t.dashLength,i),n.addFixedLengthDashes(kt.arcCenter,kt.arcPointD,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=Bt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return r.linesSize}),(function(){return""}))}function Rt(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.quads.length;i<a;++i)It(e.quads[i],kt,t.arcScale),n.addFixedLengthDashes(kt.sphereB.center,kt.sphereC.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=Bt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return r.linesSize}),(function(){return""}))}function Lt(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.quads.length;i<a;++i)It(e.quads[i],kt,t.arcScale),n.addFixedLengthDashes(kt.sphereB.center,kt.sphereA.center,t.dashLength,i),n.addFixedLengthDashes(kt.sphereC.center,kt.sphereD.center,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=Bt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return r.linesSize}),(function(){return""}))}function Nt(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.quads.length;i<a;++i)It(e.quads[i],kt,t.arcScale),n.addFixedLengthDashes(kt.arcPointA,kt.projA,t.dashLength,i),n.addFixedLengthDashes(kt.arcPointD,kt.projD,t.dashLength,i);return n.getLines()}(t,r,n&&n.geometry),a=Bt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return r.linesSize}),(function(){return""}))}function Ft(e,t,r,n){var i=function(e,t,r){for(var n=ae.a.create(128,64,r),i=0,a=e.quads.length;i<a;++i){It(e.quads[i],kt,t.arcScale);for(var o=Mt(kt,t.dashLength),s=o.indices,u=o.vertices,c=0,l=s.length;c<l;c+=3)if(c%2!=1){var d=3*s[c],f=3*s[c+1],p=u[d],m=u[d+1],h=u[d+2],g=u[f],v=u[f+1],b=u[f+2];n.add(p,m,h,g,v,b,i)}}return n.getLines()}(t,r,n&&n.geometry),a=Bt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return r.linesSize}),(function(){return""}))}function Ut(e,t,r,n){var i=function(e,t,r){for(var n=q.a.createState(128,64,r),i=0,a=e.quads.length;i<a;++i){It(e.quads[i],kt,t.arcScale);var o=Mt(kt);n.currentGroup=i,q.a.addPrimitive(n,E.Mat4.id,o),q.a.addPrimitiveFlipped(n,E.Mat4.id,o)}return q.a.getMesh(n)}(t,r,n&&n.geometry),a=Bt(t);return m.a.create(a,t,i,(function(){return r.color}),(function(){return 1}),(function(e){return Object(se.dihedralLabel)(t.quads[e])}))}function zt(e,t,r,n){var i=function(e,t,r){for(var n=oe.a.create(t,128,64,r),i=0,a=e.quads.length;i<a;++i){It(e.quads[i],kt,t.arcScale),E.Vec3.add(Dt,kt.arcDirA,kt.arcDirD),E.Vec3.setMagnitude(Dt,Dt,kt.radius),E.Vec3.add(Dt,kt.arcCenter,Dt);var o=Object(et.f)(kt.angle).toFixed(2);"-0.00"===o&&(o="0.00");var s=t.customText||o+"°",u=Math.max(2,kt.sphereA.radius,kt.sphereB.radius,kt.sphereC.radius,kt.sphereD.radius)/2;n.add(s,Dt[0],Dt[1],Dt[2],.1,u,i)}return n.getText()}(t,r,n&&n.geometry),a=Bt(t);return m.a.create(a,t,i,(function(){return r.textColor}),(function(){return r.textSize}),(function(e){return Object(se.dihedralLabel)(t.quads[e])}))}var Ht,Gt,qt=r(95),Wt=r(85),Xt=r(291),Yt=l.b.BuiltIn({name:"structure-representation-3d",display:"3D Representation",from:l.a.Molecule.Structure,to:l.a.Molecule.Structure.Representation3D,params:function(e,t){var r=t.representation.structure,n=r.registry,a=r.themes,o=n.get(n.default.name);if(!e){var s={help:function(e){var t=e.name,r=e.params,n=a.colorThemeRegistry.get(t).factory({},r);return{description:n.description,legend:n.legend}}};return{type:c.ParamDefinition.Mapped(n.default.name,n.types,(function(e){return c.ParamDefinition.Group(n.get(e).getParams(a,i.Structure.Empty))})),colorTheme:c.ParamDefinition.Mapped(o.defaultColorTheme.name,a.colorThemeRegistry.types,(function(e){return c.ParamDefinition.Group(a.colorThemeRegistry.get(e).getParams({structure:i.Structure.Empty}))}),s),sizeTheme:c.ParamDefinition.Mapped(o.defaultSizeTheme.name,a.sizeThemeRegistry.types,(function(e){return c.ParamDefinition.Group(a.sizeThemeRegistry.get(e).getParams({structure:i.Structure.Empty}))}))}}var u={structure:e.data},l={help:function(e){var t=e.name,r=e.params,n=a.colorThemeRegistry.get(t).factory(u,r);return{description:n.description,legend:n.legend}}};return{type:c.ParamDefinition.Mapped(n.default.name,n.getApplicableTypes(e.data),(function(t){return c.ParamDefinition.Group(n.get(t).getParams(a,e.data))})),colorTheme:c.ParamDefinition.Mapped(o.defaultColorTheme.name,a.colorThemeRegistry.getApplicableTypes(u),(function(e){return c.ParamDefinition.Group(a.colorThemeRegistry.get(e).getParams(u))}),l),sizeTheme:c.ParamDefinition.Mapped(o.defaultSizeTheme.name,a.sizeThemeRegistry.types,(function(e){return c.ParamDefinition.Group(a.sizeThemeRegistry.get(e).getParams(u))}))}}})({canAutoUpdate:function(e){var t=e.a,r=e.oldParams,n=e.newParams;return t.data.elementCount<1e4||r.type.name===n.type.name&&"custom"!==n.type.params.quality},apply:function(e,t){var r=this,i=e.a,a=e.params;e.cache;return s.b.create("Structure Representation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s,c,d;return Object(n.__generator)(this,(function(f){switch(f.label){case 0:return r={runtime:e,assetManager:t.managers.asset},(o=t.representation.structure.registry.get(a.type.name)).ensureCustomProperties?[4,o.ensureCustomProperties.attach(r,i.data)]:[3,2];case 1:f.sent(),f.label=2;case 2:return s=o.factory(Object(n.__assign)({webgl:null===(d=t.canvas3d)||void 0===d?void 0:d.webgl},t.representation.structure.themes),o.getParams),[4,u.a.ensureDependencies(r,t.representation.structure.themes,{structure:i.data},a)];case 3:return f.sent(),s.setTheme(u.a.create(t.representation.structure.themes,{structure:i.data},a)),c=a.type.params||{},[4,s.createOrUpdate(c,i.data).runInContext(e)];case 4:return f.sent(),[2,new l.a.Molecule.Structure.Representation3D({repr:s,source:i},{label:o.label})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,c=e.oldParams,l=e.newParams;e.cache;return s.b.create("Structure Representation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,s,d;return Object(n.__generator)(this,(function(f){switch(f.label){case 0:return l.type.name!==c.type.name?[2,o.StateTransformer.UpdateResult.Recreate]:(r=t.representation.structure.registry.get(l.type.name),s={runtime:e,assetManager:t.managers.asset},r.ensureCustomProperties?[4,r.ensureCustomProperties.attach(s,i.data)]:[3,2]);case 1:f.sent(),f.label=2;case 2:return u.a.releaseDependencies(t.representation.structure.themes,{structure:a.data.source.data},c),[4,u.a.ensureDependencies(s,t.representation.structure.themes,{structure:i.data},l)];case 3:return f.sent(),a.data.repr.setTheme(u.a.create(t.representation.structure.themes,{structure:i.data},l)),d=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),l.type.params),[4,a.data.repr.createOrUpdate(d,i.data).runInContext(e)];case 4:return f.sent(),a.data.source=i,[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))},dispose:function(e,t){var r=e.b,n=e.params;if(r&&n){var i=r.data.source.data,a=t.representation.structure.registry.get(n.type.name);a.ensureCustomProperties&&a.ensureCustomProperties.detach(i),u.a.releaseDependencies(t.representation.structure.themes,{structure:i},n)}},interpolate:function(e,t,r){if("uniform"!==e.colorTheme.name||"uniform"!==t.colorTheme.name)return r<=.5?e:t;var n=e.colorTheme.params.value,i=t.colorTheme.params.value,a=N.Color.interpolate(n,i,r);return{type:r<=.5?e.type:t.type,colorTheme:{name:"uniform",params:{value:a}},sizeTheme:r<=.5?e.sizeTheme:t.sizeTheme}}}),Qt=l.b.BuiltIn({name:"unwind-structure-assembly-representation-3d",display:"Unwind Assembly 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{t:c.ParamDefinition.Numeric(0,{min:0,max:1,step:.01})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=new T(n);return k(n,i,r.t),new l.a.Molecule.Structure.Representation3DState({state:{unitTransforms:i},initialState:{unitTransforms:new T(n)},info:n,source:t},{label:"Unwind T = "+r.t.toFixed(2)})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=e.oldParams,a=r.data.info;return t.data.source.data!==a||t.data.repr!==r.data.source.data.repr?o.StateTransformer.UpdateResult.Recreate:i.t===n.t?o.StateTransformer.UpdateResult.Unchanged:(k(a,r.data.state.unitTransforms,n.t),r.label="Unwind T = "+n.t.toFixed(2),r.data.source=t,o.StateTransformer.UpdateResult.Updated)}}),Kt=l.b.BuiltIn({name:"explode-structure-representation-3d",display:"Explode 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{t:c.ParamDefinition.Numeric(0,{min:0,max:1,step:.01})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=new T(n.root);return L(n,i,r.t),new l.a.Molecule.Structure.Representation3DState({state:{unitTransforms:i},initialState:{unitTransforms:new T(n.root)},info:n.root,source:t},{label:"Explode T = "+r.t.toFixed(2)})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=e.oldParams,a=t.data.source.data;if(r.data.info!==a.root)return o.StateTransformer.UpdateResult.Recreate;if(t.data.repr!==r.data.source.data.repr)return o.StateTransformer.UpdateResult.Recreate;if(i.t===n.t)return o.StateTransformer.UpdateResult.Unchanged;var s=r.data.state.unitTransforms;return L(a.root,s,n.t),r.label="Explode T = "+n.t.toFixed(2),r.data.source=t,o.StateTransformer.UpdateResult.Updated}}),Zt=l.b.BuiltIn({name:"overpaint-structure-representation-3d-from-script",display:"Overpaint 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{layers:c.ParamDefinition.ObjectList({script:c.ParamDefinition.Script(Object(H.Script)("(sel.atom.all)","mol-script")),color:c.ParamDefinition.Color(d.a.blueviolet),clear:c.ParamDefinition.Boolean(!1)},(function(e){return""+(e.clear?"Clear":N.Color.toRgbString(e.color))}),{defaultValue:[{script:Object(H.Script)("(sel.atom.all)","mol-script"),color:d.a.blueviolet,clear:!1}]})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=F.a.ofScript(r.layers,n);return new l.a.Molecule.Structure.Representation3DState({state:{overpaint:i},initialState:{overpaint:F.a.Empty},info:n,source:t},{label:"Overpaint ("+i.layers.length+" Layers)"})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=(e.oldParams,r.data.info),a=t.data.source.data;if(a!==i)return o.StateTransformer.UpdateResult.Recreate;if(t.data.repr!==r.data.source.data.repr)return o.StateTransformer.UpdateResult.Recreate;var s=r.data.state.overpaint,u=F.a.ofScript(n.layers,a);return F.a.areEqual(s,u)?o.StateTransformer.UpdateResult.Unchanged:(r.data.state.overpaint=u,r.data.source=t,r.label="Overpaint ("+u.layers.length+" Layers)",o.StateTransformer.UpdateResult.Updated)}}),Jt=l.b.BuiltIn({name:"overpaint-structure-representation-3d-from-bundle",display:"Overpaint 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{layers:c.ParamDefinition.ObjectList({bundle:c.ParamDefinition.Value(i.StructureElement.Bundle.Empty),color:c.ParamDefinition.Color(d.a.blueviolet),clear:c.ParamDefinition.Boolean(!1)},(function(e){return""+(e.clear?"Clear":N.Color.toRgbString(e.color))}),{defaultValue:[{bundle:i.StructureElement.Bundle.Empty,color:d.a.blueviolet,clear:!1}],isHidden:!0})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=F.a.ofBundle(r.layers,n);return new l.a.Molecule.Structure.Representation3DState({state:{overpaint:i},initialState:{overpaint:F.a.Empty},info:n,source:t},{label:"Overpaint ("+i.layers.length+" Layers)"})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=(e.oldParams,r.data.info),a=t.data.source.data;if(a!==i)return o.StateTransformer.UpdateResult.Recreate;if(t.data.repr!==r.data.source.data.repr)return o.StateTransformer.UpdateResult.Recreate;var s=r.data.state.overpaint,u=F.a.ofBundle(n.layers,a);return F.a.areEqual(s,u)?o.StateTransformer.UpdateResult.Unchanged:(r.data.state.overpaint=u,r.data.source=t,r.label="Overpaint ("+u.layers.length+" Layers)",o.StateTransformer.UpdateResult.Updated)}}),$t=l.b.BuiltIn({name:"transparency-structure-representation-3d-from-script",display:"Transparency 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{layers:c.ParamDefinition.ObjectList({script:c.ParamDefinition.Script(Object(H.Script)("(sel.atom.all)","mol-script")),value:c.ParamDefinition.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},(function(e){return"Transparency ("+e.value+")"}),{defaultValue:[{script:Object(H.Script)("(sel.atom.all)","mol-script"),value:.5}]})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=U.a.ofScript(r.layers,n);return new l.a.Molecule.Structure.Representation3DState({state:{transparency:i},initialState:{transparency:U.a.Empty},info:n,source:t},{label:"Transparency ("+i.layers.length+" Layers)"})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=(e.oldParams,r.data.info);if(t.data.source.data!==i)return o.StateTransformer.UpdateResult.Recreate;if(t.data.repr!==r.data.source.data.repr)return o.StateTransformer.UpdateResult.Recreate;var a=r.data.state.transparency,s=U.a.ofScript(n.layers,i);return U.a.areEqual(a,s)?o.StateTransformer.UpdateResult.Unchanged:(r.data.state.transparency=s,r.data.source=t,r.label="Transparency ("+s.layers.length+" Layers)",o.StateTransformer.UpdateResult.Updated)}}),er=l.b.BuiltIn({name:"transparency-structure-representation-3d-from-bundle",display:"Transparency 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{layers:c.ParamDefinition.ObjectList({bundle:c.ParamDefinition.Value(i.StructureElement.Bundle.Empty),value:c.ParamDefinition.Numeric(.5,{min:0,max:1,step:.01},{label:"Transparency"})},(function(e){return"Transparency ("+e.value+")"}),{defaultValue:[{bundle:i.StructureElement.Bundle.Empty,value:.5}],isHidden:!0})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=U.a.ofBundle(r.layers,n);return new l.a.Molecule.Structure.Representation3DState({state:{transparency:i},initialState:{transparency:U.a.Empty},info:n,source:t},{label:"Transparency ("+i.layers.length+" Layers)"})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=(e.oldParams,r.data.info);if(t.data.source.data!==i)return o.StateTransformer.UpdateResult.Recreate;if(t.data.repr!==r.data.source.data.repr)return o.StateTransformer.UpdateResult.Recreate;var a=r.data.state.transparency,s=U.a.ofBundle(n.layers,i);return U.a.areEqual(a,s)?o.StateTransformer.UpdateResult.Unchanged:(r.data.state.transparency=s,r.data.source=t,r.label="Transparency ("+s.layers.length+" Layers)",o.StateTransformer.UpdateResult.Updated)}}),tr=l.b.BuiltIn({name:"clipping-structure-representation-3d-from-script",display:"Clipping 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{layers:c.ParamDefinition.ObjectList({script:c.ParamDefinition.Script(Object(H.Script)("(sel.atom.all)","mol-script")),groups:c.ParamDefinition.Converted((function(e){return Wt.a.Groups.toNames(e)}),(function(e){return Wt.a.Groups.fromNames(e)}),c.ParamDefinition.MultiSelect(Object(Xt.a)(Wt.a.Groups.Names),c.ParamDefinition.objectToOptions(Wt.a.Groups.Names)))},(function(e){return Wt.a.Groups.toNames(e.groups).length+" group(s)"}),{defaultValue:[{script:Object(H.Script)("(sel.atom.all)","mol-script"),groups:0}]})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=Wt.a.ofScript(r.layers,n);return new l.a.Molecule.Structure.Representation3DState({state:{clipping:i},initialState:{clipping:Wt.a.Empty},info:n,source:t},{label:"Clipping ("+i.layers.length+" Layers)"})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=(e.oldParams,r.data.info);if(t.data.source.data!==i)return o.StateTransformer.UpdateResult.Recreate;if(t.data.repr!==r.data.source.data.repr)return o.StateTransformer.UpdateResult.Recreate;var a=r.data.state.clipping,s=Wt.a.ofScript(n.layers,i);return Wt.a.areEqual(a,s)?o.StateTransformer.UpdateResult.Unchanged:(r.data.state.clipping=s,r.data.source=t,r.label="Clipping ("+s.layers.length+" Layers)",o.StateTransformer.UpdateResult.Updated)}}),rr=l.b.BuiltIn({name:"clipping-structure-representation-3d-from-bundle",display:"Clipping 3D Representation",from:l.a.Molecule.Structure.Representation3D,to:l.a.Molecule.Structure.Representation3DState,params:{layers:c.ParamDefinition.ObjectList({bundle:c.ParamDefinition.Value(i.StructureElement.Bundle.Empty),groups:c.ParamDefinition.Converted((function(e){return Wt.a.Groups.toNames(e)}),(function(e){return Wt.a.Groups.fromNames(e)}),c.ParamDefinition.MultiSelect(Object(Xt.a)(Wt.a.Groups.Names),c.ParamDefinition.objectToOptions(Wt.a.Groups.Names)))},(function(e){return Wt.a.Groups.toNames(e.groups).length+" group(s)"}),{defaultValue:[{bundle:i.StructureElement.Bundle.Empty,groups:0}],isHidden:!0})}})({canAutoUpdate:function(){return!0},apply:function(e){var t=e.a,r=e.params,n=t.data.source.data,i=Wt.a.ofBundle(r.layers,n);return new l.a.Molecule.Structure.Representation3DState({state:{clipping:i},initialState:{clipping:Wt.a.Empty},info:n,source:t},{label:"Clipping ("+i.layers.length+" Layers)"})},update:function(e){var t=e.a,r=e.b,n=e.newParams,i=(e.oldParams,r.data.info);if(t.data.source.data!==i)return o.StateTransformer.UpdateResult.Recreate;if(t.data.repr!==r.data.source.data.repr)return o.StateTransformer.UpdateResult.Recreate;var a=r.data.state.clipping,s=Wt.a.ofBundle(n.layers,i);return Wt.a.areEqual(a,s)?o.StateTransformer.UpdateResult.Unchanged:(r.data.state.clipping=s,r.data.source=t,r.label="Clipping ("+s.layers.length+" Layers)",o.StateTransformer.UpdateResult.Updated)}});(Gt=Ht||(Ht={})).getDefaultParams=function(e,t,r,i){var a=e.representation.volume.registry.get(t),o={volume:r},s=e.representation.volume.themes.colorThemeRegistry.get(a.defaultColorTheme.name).getParams(o),u=e.representation.volume.themes.sizeThemeRegistry.get(a.defaultSizeTheme.name).getParams(o),l=c.ParamDefinition.getDefaultValues(a.getParams(e.representation.volume.themes,r));return{type:{name:t,params:i?Object(n.__assign)(Object(n.__assign)({},l),i):l},colorTheme:{name:a.defaultColorTheme.name,params:c.ParamDefinition.getDefaultValues(s)},sizeTheme:{name:a.defaultSizeTheme.name,params:c.ParamDefinition.getDefaultValues(u)}}},Gt.getDefaultParamsStatic=function(e,t,r,i,a,o,s){var u=e.representation.volume.registry.get(t),c=e.representation.volume.themes.colorThemeRegistry.get(i||u.defaultColorTheme.name),l=e.representation.volume.themes.sizeThemeRegistry.get(o||u.defaultSizeTheme.name);return{type:{name:t,params:r?Object(n.__assign)(Object(n.__assign)({},u.defaultValues),r):u.defaultValues},colorTheme:{name:u.defaultColorTheme.name,params:a?Object(n.__assign)(Object(n.__assign)({},c.defaultValues),a):c.defaultValues},sizeTheme:{name:u.defaultSizeTheme.name,params:s?Object(n.__assign)(Object(n.__assign)({},l.defaultValues),s):l.defaultValues}}},Gt.getDescription=function(e){var t,r,n,i;return e.isoValue?a.b.IsoValue.toString(e.isoValue):(null===(r=null===(t=e.renderMode)||void 0===t?void 0:t.params)||void 0===r?void 0:r.isoValue)?a.b.IsoValue.toString(null===(i=null===(n=e.renderMode)||void 0===n?void 0:n.params)||void 0===i?void 0:i.isoValue):void 0};var nr=l.b.BuiltIn({name:"volume-representation-3d",display:"3D Representation",from:l.a.Volume.Data,to:l.a.Volume.Representation3D,params:function(e,t){var r=t.representation.volume,n=r.registry,i=r.themes,o=n.get(n.default.name);if(!e)return{type:c.ParamDefinition.Mapped(n.default.name,n.types,(function(e){return c.ParamDefinition.Group(n.get(e).getParams(i,a.b.One))})),colorTheme:c.ParamDefinition.Mapped(o.defaultColorTheme.name,i.colorThemeRegistry.types,(function(e){return c.ParamDefinition.Group(i.colorThemeRegistry.get(e).getParams({volume:a.b.One}))})),sizeTheme:c.ParamDefinition.Mapped(o.defaultSizeTheme.name,i.sizeThemeRegistry.types,(function(e){return c.ParamDefinition.Group(i.sizeThemeRegistry.get(e).getParams({volume:a.b.One}))}))};var s={volume:e.data};return{type:c.ParamDefinition.Mapped(n.default.name,n.types,(function(t){return c.ParamDefinition.Group(n.get(t).getParams(i,e.data))})),colorTheme:c.ParamDefinition.Mapped(o.defaultColorTheme.name,i.colorThemeRegistry.getApplicableTypes(s),(function(e){return c.ParamDefinition.Group(i.colorThemeRegistry.get(e).getParams(s))})),sizeTheme:c.ParamDefinition.Mapped(o.defaultSizeTheme.name,i.sizeThemeRegistry.types,(function(e){return c.ParamDefinition.Group(i.sizeThemeRegistry.get(e).getParams(s))}))}}})({canAutoUpdate:function(e){var t=e.oldParams,r=e.newParams;return t.type.name===r.type.name},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Volume Representation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s,c,d;return Object(n.__generator)(this,(function(f){switch(f.label){case 0:return r={runtime:e,assetManager:t.managers.asset},(o=t.representation.volume.registry.get(a.type.name)).ensureCustomProperties?[4,o.ensureCustomProperties.attach(r,i.data)]:[3,2];case 1:f.sent(),f.label=2;case 2:return(s=o.factory(Object(n.__assign)({webgl:null===(d=t.canvas3d)||void 0===d?void 0:d.webgl},t.representation.volume.themes),o.getParams)).setTheme(u.a.create(t.representation.volume.themes,{volume:i.data},a)),c=a.type.params||{},[4,s.createOrUpdate(c,i.data).runInContext(e)];case 3:return f.sent(),[2,new l.a.Volume.Representation3D({repr:s,source:i},{label:o.label,description:Ht.getDescription(c)})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,c=e.oldParams,l=e.newParams;return s.b.create("Volume Representation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,s,d;return Object(n.__generator)(this,(function(f){switch(f.label){case 0:return l.type.name!==c.type.name?(r=t.representation.volume.registry.get(c.type.name),null===(d=r.ensureCustomProperties)||void 0===d||d.detach(i.data),[2,o.StateTransformer.UpdateResult.Recreate]):(s=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),l.type.params),a.data.repr.setTheme(u.a.create(t.representation.volume.themes,{volume:i.data},l)),[4,a.data.repr.createOrUpdate(s,i.data).runInContext(e)]);case 1:return f.sent(),a.description=Ht.getDescription(s),[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}}),ir=l.b.BuiltIn({name:"shape-representation-3d",display:"3D Representation",from:l.a.Shape.Provider,to:l.a.Shape.Representation3D,params:function(e,t){return e?e.data.params:z.a.Params}})({canAutoUpdate:function(){return!0},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Shape Representation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(o){switch(o.label){case 0:return t=Object(n.__assign)(Object(n.__assign)({},c.ParamDefinition.getDefaultValues(i.data.params)),a),[4,(r=P(i.data.getShape,i.data.geometryUtils)).createOrUpdate(t,i.data.data).runInContext(e)];case 1:return o.sent(),[2,new l.a.Shape.Representation3D({repr:r,source:i},{label:i.data.label})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,u=(e.oldParams,e.newParams);return s.b.create("Shape Representation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return t=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),u),[4,a.data.repr.createOrUpdate(t,i.data.data).runInContext(e)];case 1:return r.sent(),[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}}),ar=l.b.BuiltIn({name:"model-unitcell-3d",display:"Model Unit Cell",from:l.a.Molecule.Model,to:l.a.Shape.Representation3D,params:Object(n.__assign)({},ee)})({isApplicable:function(e){return!!qt.a.Provider.get(e.data)},canAutoUpdate:function(e){e.oldParams,e.newParams;return!0},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Model Unit Cell",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,s,u,c;return Object(n.__generator)(this,(function(d){switch(d.label){case 0:return(r=qt.a.Provider.get(i.data))?(s=re(i.data,r,a),[4,(u=function(e,t){return p.a.createMulti("Unit Cell",e,t,p.a.StateBuilder,$)}(Object(n.__assign)({webgl:null===(c=t.canvas3d)||void 0===c?void 0:c.webgl},t.representation.structure.themes),(function(){return ee}))).createOrUpdate(a,s).runInContext(e)]):[2,o.StateObject.Null];case 1:return d.sent(),[2,new l.a.Shape.Representation3D({repr:u,source:i},{label:"Unit Cell",description:r.spacegroup.name})]}}))}))}))},update:function(e){var t=this,r=e.a,i=e.b,a=e.newParams;return s.b.create("Model Unit Cell",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,s,u;return Object(n.__generator)(this,(function(c){switch(c.label){case 0:return(t=qt.a.Provider.get(r.data))?(s=Object(n.__assign)(Object(n.__assign)({},i.data.repr.props),a),u=re(r.data,t,s),[4,i.data.repr.createOrUpdate(s,u).runInContext(e)]):[2,o.StateTransformer.UpdateResult.Null];case 1:return c.sent(),i.data.source=r,[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}}),or=l.b.BuiltIn({name:"structure-selections-distance-3d",display:"3D Distance",from:l.a.Molecule.Structure.Selections,to:l.a.Shape.Representation3D,params:Object(n.__assign)({},pe)})({canAutoUpdate:function(e){e.oldParams,e.newParams;return!0},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Structure Distance",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s;return Object(n.__generator)(this,(function(u){switch(u.label){case 0:return r=ye(i.data),[4,(o=function(e,t){return p.a.createMulti("Distance",e,t,p.a.StateBuilder,fe)}(Object(n.__assign)({webgl:null===(s=t.canvas3d)||void 0===s?void 0:s.webgl},t.representation.structure.themes),(function(){return pe}))).createOrUpdate(a,r).runInContext(e)];case 1:return u.sent(),[2,new l.a.Shape.Representation3D({repr:o,source:i},{label:"Distance"})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,u=(e.oldParams,e.newParams);return s.b.create("Structure Distance",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(s){switch(s.label){case 0:return t=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),u),r=ye(i.data),[4,a.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return s.sent(),a.data.source=i,[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}}),sr=l.b.BuiltIn({name:"structure-selections-angle-3d",display:"3D Angle",from:l.a.Molecule.Structure.Selections,to:l.a.Shape.Representation3D,params:Object(n.__assign)({},lt)})({canAutoUpdate:function(e){e.oldParams,e.newParams;return!0},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Structure Angle",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s;return Object(n.__generator)(this,(function(u){switch(u.label){case 0:return r=_e(i.data),[4,(o=function(e,t){return p.a.createMulti("Angle",e,t,p.a.StateBuilder,ct)}(Object(n.__assign)({webgl:null===(s=t.canvas3d)||void 0===s?void 0:s.webgl},t.representation.structure.themes),(function(){return lt}))).createOrUpdate(a,r).runInContext(e)];case 1:return u.sent(),[2,new l.a.Shape.Representation3D({repr:o,source:i},{label:"Angle"})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,u=(e.oldParams,e.newParams);return s.b.create("Structure Angle",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(s){switch(s.label){case 0:return t=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),u),r=_e(i.data),[4,a.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return s.sent(),a.data.source=i,[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}}),ur=l.b.BuiltIn({name:"structure-selections-dihedral-3d",display:"3D Dihedral",from:l.a.Molecule.Structure.Selections,to:l.a.Shape.Representation3D,params:Object(n.__assign)({},At)})({canAutoUpdate:function(e){e.oldParams,e.newParams;return!0},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Structure Dihedral",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s;return Object(n.__generator)(this,(function(u){switch(u.label){case 0:return r=Se(i.data),[4,(o=function(e,t){return p.a.createMulti("Dihedral",e,t,p.a.StateBuilder,Et)}(Object(n.__assign)({webgl:null===(s=t.canvas3d)||void 0===s?void 0:s.webgl},t.representation.structure.themes),(function(){return At}))).createOrUpdate(a,r).runInContext(e)];case 1:return u.sent(),[2,new l.a.Shape.Representation3D({repr:o,source:i},{label:"Dihedral"})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,u=(e.oldParams,e.newParams);return s.b.create("Structure Dihedral",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(s){switch(s.label){case 0:return t=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),u),r=Se(i.data),[4,a.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return s.sent(),a.data.source=i,[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}}),cr=l.b.BuiltIn({name:"structure-selections-label-3d",display:"3D Label",from:l.a.Molecule.Structure.Selections,to:l.a.Shape.Representation3D,params:Object(n.__assign)({},je)})({canAutoUpdate:function(e){e.oldParams,e.newParams;return!0},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Structure Label",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s;return Object(n.__generator)(this,(function(u){switch(u.label){case 0:return r=xe(i.data),[4,(o=function(e,t){return p.a.createMulti("Label",e,t,p.a.StateBuilder,Ce)}(Object(n.__assign)({webgl:null===(s=t.canvas3d)||void 0===s?void 0:s.webgl},t.representation.structure.themes),(function(){return je}))).createOrUpdate(a,r).runInContext(e)];case 1:return u.sent(),[2,new l.a.Shape.Representation3D({repr:o,source:i},{label:"Label"})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,u=(e.oldParams,e.newParams);return s.b.create("Structure Label",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(s){switch(s.label){case 0:return t=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),u),r=xe(i.data),[4,a.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return s.sent(),a.data.source=i,[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}}),lr=l.b.BuiltIn({name:"structure-selections-orientation-3d",display:"3D Orientation",from:l.a.Molecule.Structure.Selections,to:l.a.Shape.Representation3D,params:Object(n.__assign)({},Ye)})({canAutoUpdate:function(e){e.oldParams,e.newParams;return!0},apply:function(e,t){var r=this,i=e.a,a=e.params;return s.b.create("Structure Orientation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s;return Object(n.__generator)(this,(function(u){switch(u.label){case 0:return r=Oe(i.data),[4,(o=function(e,t){var r=p.a.createMulti("Orientation",e,t,p.a.StateBuilder,Xe);return r.setState({markerActions:y.b.Highlighting}),r}(Object(n.__assign)({webgl:null===(s=t.canvas3d)||void 0===s?void 0:s.webgl},t.representation.structure.themes),(function(){return Ye}))).createOrUpdate(a,r).runInContext(e)];case 1:return u.sent(),[2,new l.a.Shape.Representation3D({repr:o,source:i},{label:"Orientation"})]}}))}))}))},update:function(e,t){var r=this,i=e.a,a=e.b,u=(e.oldParams,e.newParams);return s.b.create("Structure Orientation",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(s){switch(s.label){case 0:return t=Object(n.__assign)(Object(n.__assign)({},a.data.repr.props),u),r=Oe(i.data),[4,a.data.repr.createOrUpdate(t,r).runInContext(e)];case 1:return s.sent(),a.data.source=i,[2,o.StateTransformer.UpdateResult.Updated]}}))}))}))}})},function(e,t,r){"use strict";function n(){}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return it})),r.d(t,"b",(function(){return pt})),r.d(t,"c",(function(){return mt}));var n,i,a=r(0),o=r(2),s=r(4),u=r(12),c=r(9),l=r(6),d=r(239),f=r(1),p=r(203);!function(e){function t(e,t){for(var r=new Int32Array(t+1),n=new Int32Array(t),i=new Int32Array(t),a=e.members,o=e.count,s=e.offsets,u=0,c=s[o];u<c;++u)++i[a[u]];var l=0;for(u=0;u<t;u++)r[u]=l,l+=i[u];r[t]=l;var d=new Int32Array(l);for(u=0;u<o;++u)for(var f=s[u],p=s[u+1];f<p;++f){var m=a[f];d[r[m]+n[m]]=u,++n[m]}return{indices:d,offsets:r}}function r(e,t){for(var r,n=e.count,i=e.types,a=[],o=0;o<n;++o)t.has(i[o])&&a.push(o);var s=l.SortedArray.ofSortedArray(a);return{indices:s,get lookup3d(){if(!r){var t={x:e.x,y:e.y,z:e.z,indices:s};r=Object(c.c)(t,Object(p.a)(t))}return r}}}e.setPosition=function(e,t,r,n){return f.Vec3.set(e,n.x[r],n.y[r],n.z[r]),f.Vec3.transformMat4(e,e,t.conformation.operator.matrix),e},e.createElementsIndex=t,e.create=function(e,n){var i,o;return Object(a.__assign)(Object(a.__assign)({},n),{get lookup3d(){if(!i){var e={x:n.x,y:n.y,z:n.z,indices:l.OrderedSet.ofBounds(0,n.count)};i=Object(c.c)(e,Object(p.a)(e))}return i},get elementsIndex(){return o||(o=t(n,e))},subset:function(e){return r(n,e)}})},e.createSubset=r,e.Info=function(e,t,r){var n=d.a.get(e).value;if(!n||!n.has(t.id))throw new Error("valence model required");return{unit:t,types:r.types,feature:-1,x:r.x,y:r.y,z:r.z,members:r.members,offsets:r.offsets,idealGeometry:n.get(t.id).idealGeometry}},e.position=function(e,t){return f.Vec3.set(e,t.x[t.feature],t.y[t.feature],t.z[t.feature]),f.Vec3.transformMat4(e,e,t.unit.conformation.operator.matrix),e};var n=Object(f.Vec3)(),i=Object(f.Vec3)();e.distance=function(e,t){var r=e.members[e.offsets[e.feature]],a=t.members[t.offsets[t.feature]];return e.unit.conformation.position(e.unit.elements[r],n),t.unit.conformation.position(t.unit.elements[a],i),f.Vec3.distance(n,i)},e.Provider=function(e,t){return{types:new Set(e),add:t}}}(n||(n={})),(i||(i={})).create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var i=u.a.create(Float32Array,1,t,r?r.x:e),a=u.a.create(Float32Array,1,t,r?r.y:e),o=u.a.create(Float32Array,1,t,r?r.z:e),s=u.a.create(Uint8Array,1,t,r?r.types:e),c=u.a.create(Uint8Array,1,t,r?r.groups:e),l=u.a.create(Uint32Array,1,t,r?r.offsets:e),d=u.a.create(Uint32Array,1,t,r?r.members:e),f={x:0,y:0,z:0,offset:0,count:0};return{startState:function(){f.x=0,f.y=0,f.z=0,f.offset=d.elementCount,f.count=0},pushMember:function(e,t,r,n){u.a.add(d,n),f.x+=e,f.y+=t,f.z+=r,f.count+=1},finishState:function(e,t){var r=f.count;0!==r&&(u.a.add(s,e),u.a.add(c,t),u.a.add(i,f.x/r),u.a.add(a,f.y/r),u.a.add(o,f.z/r),u.a.add(l,f.offset))},add:function(e,t,r,n,f,p){u.a.add(s,e),u.a.add(c,t),u.a.add(i,r),u.a.add(a,n),u.a.add(o,f),u.a.add(l,d.elementCount),u.a.add(d,p)},getFeatures:function(e){u.a.add(l,d.elementCount);var t=u.a.compact(i,!0),r=u.a.compact(a,!0),f=u.a.compact(o,!0),p=i.elementCount;return n.create(e,{x:t,y:r,z:f,count:p,types:u.a.compact(s,!0),groups:u.a.compact(c,!0),offsets:u.a.compact(l,!0),members:u.a.compact(d,!0)})}}};var m,h,g=r(264),v=r(145),b=r(255);(m||(m={})).create=function(e,t){var r=[],n=[],i=[];return{add:function(e,t,a){r[r.length]=e,n[n.length]=t,i[i.length]=a},getContacts:function(){for(var a=new v.a.EdgeBuilder(e.count,r,n),o=new Int8Array(a.slotCount),s=new Int8Array(a.slotCount),u=0,c=a.edgeCount;u<c;u++)a.addNextEdge(),a.assignProperty(o,i[u]);var l,d=a.createGraph({type:o,flag:s});return Object.defineProperty(d,"elementsIndex",{get:function(){return l||(l=g.b.createElementsIndex(d,e,t))}})}}},(h||(h={})).create=function(){var e=new b.a.Builder;return{startUnitPair:function(t,r){e.startUnitPair(t.id,r.id)},finishUnitPair:function(){e.finishUnitPair()},add:function(t,r,n){e.add(t,r,{type:n,flag:0})},getContacts:function(t){return new g.a(e.getMap(),t)}}};var y=r(32),_=r(120),S={lineOfSightDistFactor:o.ParamDefinition.Numeric(1,{min:0,max:3,step:.1})};function x(e,t,r){var n=t.members[t.offsets[t.feature]],i=r.members[r.offsets[r.feature]];if(n===i&&t.unit===r.unit)return!1;var a=Object(y.a)(t.unit,n),o=Object(y.a)(r.unit,i);return(!a||!o||a===o)&&((t.unit.residueIndex[t.unit.elements[n]]!==r.unit.residueIndex[r.unit.elements[i]]||t.unit!==r.unit)&&!Object(y.f)(e,t.unit,n,r.unit,i))}function O(e,t,r,n){var i=Object(y.a)(e,t),a=Object(y.a)(r,n);return i&&a&&i!==a}function w(e,t){for(var r=t.feature,n=t.offsets,i=t.members,a=n[r],o=n[r+1];a<o;++a)if(i[a]===e)return!0;return!1}var C=Object(f.Vec3)(),j=Object(f.Vec3)(),P=Object(f.Vec3)();function E(e,t,r,i){var a=t.feature,o=r.feature,u=t.members[t.offsets[a]],c=r.members[r.offsets[o]];n.position(j,t),n.position(P,r),f.Vec3.scale(C,f.Vec3.add(C,j,P),.5);var l=3*i,d=e.lookup3d.find(C[0],C[1],C[2],l),p=d.count,m=d.indices,h=d.units,g=d.squaredDistances;if(0===p)return!0;for(var v=0;v<p;++v){var b=m[v],S=h[v];if(s.Unit.isAtomic(S)){var x=Object(y.i)(S,b);if("H"!==x){var E=Object(_.h)(x);if(!(E*E*i*i<=g[v]||O(S,b,t.unit,u)||O(S,b,r.unit,c)||t.unit===S&&w(b,t)||r.unit===S&&w(b,r)||(S.conformation.position(S.elements[b],C),f.Vec3.squaredDistance(C,j)<1||f.Vec3.squaredDistance(C,P)<1)))return!1}}}return!0}function A(e,t,r,i,o,s){for(var u=r.x,c=r.y,d=r.z,f=r.subset(o.requiredFeatures),p=f.lookup3d,m=f.indices,h=n.Info(e,t,r),g=Object(a.__assign)({},h),v=s.lineOfSightDistFactor,b=0,y=l.OrderedSet.size(m);b<y;++b){var _=l.OrderedSet.getAt(m,b),S=p.find(u[_],c[_],d[_],o.maxDistance),O=S.count,w=S.indices,C=S.squaredDistances;if(0!==O){h.feature=_;for(var j=0;j<O;++j){var P=l.OrderedSet.getAt(m,w[j]);if(!(P<=_)&&(g.feature=P,x(e,h,g))){var A=o.getType(e,h,g,C[j]);A&&E(e,h,g,v)&&i.add(_,P,A)}}}}}var D=Object(f.Mat4)();var T=r(155),I=r(44),M={distanceMax:o.ParamDefinition.Numeric(4,{min:1,max:5,step:.1}),angleMax:o.ParamDefinition.Numeric(30,{min:0,max:60,step:1})},k=["CL","BR","I","AT"];var B=["N","O","S"],V=["C","N","P","S"];var R=Object(I.c)(180),L=Object(I.c)(120);var N=n.Provider([6],(function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=n.length;u<c;++u){var l=Object(y.i)(t,u);k.includes(l)&&r.add(6,0,a[n[u]],o[n[u]],s[n[u]],u)}})),F=n.Provider([7],(function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=function(i,u){var c=Object(y.i)(t,i);if(B.includes(c)){var l=!1;Object(y.g)(e,t,i,(function(e,t){V.includes(Object(y.i)(e,t))&&(l=!0)})),l&&r.add(7,0,a[n[i]],o[n[i]],s[n[i]],i)}},c=0,l=n.length;c<l;++c)u(c)})),U={name:"halogen-bonds",params:M,createTester:function(e){var t=function(e){return{angleMax:Object(I.c)(e.angleMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([6,7]),getType:function(e,r,n){return function(e,t,r,n){var i=t.types[t.feature],a=r.types[r.feature];if(s=a,7===(o=i)&&6===s||6===o&&7===s){var o,s,u=6===i?[t,r]:[r,t],c=u[0],l=u[1],d=c.members[c.offsets[c.feature]],f=l.members[l.offsets[l.feature]],p=Object(T.c)(e,c.unit,d,l.unit,f);if(1===p.length&&!(R-p[0]>n.angleMax)){var m=Object(T.c)(e,l.unit,f,c.unit,d);if(0!==m.length&&!m.some((function(e){return L-e>n.angleMax})))return 5}}}(e,r,n,t)}}}},z=r(22),H={distanceMax:o.ParamDefinition.Numeric(3.5,{min:1,max:5,step:.1}),backbone:o.ParamDefinition.Boolean(!0,{description:"Include backbone-to-backbone hydrogen bonds"}),accAngleDevMax:o.ParamDefinition.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal acceptor angle"}),donAngleDevMax:o.ParamDefinition.Numeric(45,{min:0,max:180,step:1},{description:"Max deviation from ideal donor angle"}),accOutOfPlaneAngleMax:o.ParamDefinition.Numeric(90,{min:0,max:180,step:1}),donOutOfPlaneAngleMax:o.ParamDefinition.Numeric(45,{min:0,max:180,step:1})},G=Object(a.__assign)(Object(a.__assign)({},H),{water:o.ParamDefinition.Boolean(!1,{description:"Include water-to-water hydrogen bonds"}),sulfurDistanceMax:o.ParamDefinition.Numeric(4.1,{min:1,max:5,step:.1})}),q=Object(a.__assign)({},H);function W(e,t){var r=d.a.get(e).value;if(!r)throw Error("expected valence model to be available");var n=r.get(t.id);if(!n)throw Error("expected valence model for unit to be available");return n}function X(e,t){var r=e.rings,n=r.elementAromaticRingIndices,i=r.all,a=n.get(t);if(void 0===a)return!1;for(var o=0,s=a.length;o<s;++o)for(var u=i[a[o]],c=0,l=u.length;c<l;++c){var d=Object(y.i)(e,u[c]);if("N"===d||"O"===d)return!0}return!1}function Y(e,t){return 2===e.model.atomicHierarchy.derived.residue.moleculeType[e.residueIndex[e.elements[t]]]}function Q(e,t){return z.ProteinBackboneAtoms.has(Object(y.b)(e,t))}function K(e,t){return"HIS"===Object(y.e)(e,t)&&"N"===Object(y.i)(e,t)&&function(e,t){return e.rings.elementRingIndices.has(t)}(e,t)}function Z(e){return{includeBackbone:e.backbone,maxAccAngleDev:Object(I.c)(e.accAngleDevMax),maxDonAngleDev:Object(I.c)(e.donAngleDevMax),maxAccOutOfPlaneAngle:Object(I.c)(e.accOutOfPlaneAngleMax),maxDonOutOfPlaneAngle:Object(I.c)(e.donOutOfPlaneAngleMax)}}var J=Object(I.c)(120);function $(e,t,r,n){var i=t.members[t.offsets[t.feature]],a=r.members[r.offsets[r.feature]];if(n.includeBackbone||(o=t.unit,s=i,u=r.unit,c=a,!Q(o,s)||!Q(u,c))){var o,s,u,c,l=Object(T.c)(e,t.unit,i,r.unit,a),d=T.a.get(t.idealGeometry[i])||J;if(!l.some((function(e){return Math.abs(d-e)>n.maxDonAngleDev}))){if(3===t.idealGeometry[i])if(void 0!==(m=Object(T.d)(e,t.unit,i,r.unit,a))&&m>n.maxDonOutOfPlaneAngle)return;var f=Object(T.c)(e,r.unit,a,t.unit,i),p=T.a.get(r.idealGeometry[a])||J;if(!f.some((function(e){return p-e>n.maxAccAngleDev}))){var m;if(3===r.idealGeometry[a])if(void 0!==(m=Object(T.d)(e,r.unit,a,t.unit,i))&&m>n.maxAccOutOfPlaneAngle)return;return!0}}}}function ee(e,t,r,n,i){var a=t.types[t.feature],o=r.types[r.feature];if(u=o,5===(s=a)&&4===u||4===s&&5===u){var s,u,c,l,d,f,p=5===o?[t,r]:[r,t],m=p[0],h=p[1],g=m.members[m.offsets[m.feature]],v=h.members[h.offsets[h.feature]];if(!(n>("S"===Object(y.i)(m.unit,g)||"S"===Object(y.i)(h.unit,v)?i.maxSulfurDistSq:i.maxDistSq)))if(i.includeWater||(c=m.unit,l=g,d=h.unit,f=v,!Y(c,l)||!Y(d,f)))if($(e,m,h,i))return 4}}var te=n.Provider([4],(function(e,t,r){for(var n=W(e,t).totalH,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=t.rings.elementAromaticRingIndices,l=0,d=i.length;l<d;++l)if(!c.has(l)){var f=Object(y.i)(t,l);(K(t,l)||n[l]>0&&("N"===f||"O"===f||"S"===f))&&r.add(4,0,o[i[l]],s[i[l]],u[i[l]],l)}})),re=n.Provider([9],(function(e,t,r){for(var n=W(e,t).totalH,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=0,l=i.length;c<l;++c)"C"===Object(y.i)(t,c)&&n[c]>0&&(Object(y.d)(e,t,c,"N")>0||Object(y.d)(e,t,c,"O")>0||X(t,c))&&r.add(9,0,o[i[c]],s[i[c]],u[i[c]],c)})),ne=n.Provider([5],(function(e,t,r){for(var n=W(e,t),i=n.charge,a=n.implicitH,o=n.idealGeometry,s=t.elements,u=t.model.atomicConformation,c=u.x,l=u.y,d=u.z,f=t.rings.elementAromaticRingIndices,p=function(e){r.add(5,0,c[s[e]],l[s[e]],d[s[e]],e)},m=0,h=s.length;m<h;++m)if(!f.has(m)){var g=Object(y.i)(t,m);if("O"===g)p(m);else if("N"===g){if(K(t,m))p(m);else if(i[m]<1){var v=Object(y.c)(e,t,m)+a[m],b=o[m];(4===b&&v<4||3===b&&v<3||2===b&&v<2)&&p(m)}}else if("S"===g){var _=Object(y.e)(t,m);"CYS"!==_&&"MET"!==_&&-1!==Object(y.h)(t,m)||p(m)}}})),ie={name:"hydrogen-bonds",params:G,createTester:function(e){var t=Math.max(e.distanceMax,e.sulfurDistanceMax),r=function(e){return Object(a.__assign)(Object(a.__assign)({},Z(e)),{includeWater:e.water,maxSulfurDistSq:e.sulfurDistanceMax*e.sulfurDistanceMax,maxDistSq:e.distanceMax*e.distanceMax})}(e);return{maxDistance:t,requiredFeatures:new Set([4,5]),getType:function(e,t,n,i){return ee(e,t,n,i,r)}}}},ae={name:"weak-hydrogen-bonds",params:q,createTester:function(e){var t=Z(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([9,5]),getType:function(e,r,n,i){return function(e,t,r,n,i){var a=t.types[t.feature],o=r.types[r.feature];if(u=o,9===(s=a)&&5===u||5===s&&9===u){var s,u,c=5===o?[t,r]:[r,t];if($(e,c[0],c[1],i))return 8}}(e,r,n,0,t)}}}},oe=r(258);function se(e,t,r){return"S"===Object(y.i)(t,r)&&3===Object(y.d)(e,t,r,"O")}function ue(e,t,r){return"S"===Object(y.i)(t,r)&&4===Object(y.d)(e,t,r,"O")}function ce(e,t,r){return"P"===Object(y.i)(t,r)&&Object(y.d)(e,t,r,"O")===Object(y.c)(e,t,r)}function le(e,t,r){var n=0;return"C"===Object(y.i)(t,r)&&2===Object(y.d)(e,t,r,"O")&&1===Object(y.d)(e,t,r,"C")&&Object(y.g)(e,t,r,(function(t,r){"O"===Object(y.i)(t,r)&&Object(y.c)(e,t,r)-Object(y.d)(e,t,r,"H")==1&&(n+=1)})),2===n}function de(e,t,r){var n=0;return"C"===Object(y.i)(t,r)&&3===Object(y.c)(e,t,r)&&3===Object(y.d)(e,t,r,"N")&&Object(y.g)(e,t,r,(function(t,r){Object(y.c)(e,t,r)-Object(y.d)(e,t,r,"H")==1&&(n+=1)})),2===n}function fe(e,t,r){var n=0;return"C"===Object(y.i)(t,r)&&3===Object(y.c)(e,t,r)&&2===Object(y.d)(e,t,r,"N")&&1===Object(y.d)(e,t,r,"C")&&Object(y.g)(e,t,r,(function(t,r){Object(y.c)(e,t,r)-Object(y.d)(e,t,r,"H")==1&&(n+=1)})),2===n}new Set(["N","O","S","F","CL","BR","I"]);var pe={distanceMax:o.ParamDefinition.Numeric(5,{min:0,max:8,step:.1})},me={distanceMax:o.ParamDefinition.Numeric(5.5,{min:1,max:8,step:.1}),offsetMax:o.ParamDefinition.Numeric(2,{min:0,max:4,step:.1}),angleDevMax:o.ParamDefinition.Numeric(30,{min:0,max:180,step:1})},he={distanceMax:o.ParamDefinition.Numeric(6,{min:1,max:8,step:.1}),offsetMax:o.ParamDefinition.Numeric(2,{min:0,max:4,step:.1})},ge=["ARG","HIS","LYS"],ve=["GLU","ASP"];function be(e,t){var r=d.a.get(e).value;if(!r)throw Error("expected valence model to be available");var n=r.get(t.id);if(!n)throw Error("expected valence model for unit to be available");return n}var ye=Object(f.Vec3)(),_e=Object(f.Vec3)();var Se=Object(f.Vec3)(),xe=Object(f.Vec3)(),Oe=Object(f.Vec3)(),we=Object(f.Vec3)();function Ce(e,t){var r=t.unit,n=t.feature,i=t.offsets,a=t.members,o=r.elements,s=i[n];return t.unit.conformation.position(o[a[s]],Se),t.unit.conformation.position(o[a[s+1]],xe),t.unit.conformation.position(o[a[s+2]],Oe),f.Vec3.triangleNormal(e,Se,xe,Oe)}var je=function(e,t,r){return n.position(Se,e),n.position(xe,t),f.Vec3.sub(Oe,Se,xe),f.Vec3.projectOnPlane(we,Oe,r),f.Vec3.add(we,we,xe),f.Vec3.distance(we,xe)};var Pe=Object(I.c)(180),Ee=Object(I.c)(90),Ae=Object(f.Vec3)(),De=Object(f.Vec3)();function Te(e,t,r,n,i){var a,o,s=t.types[t.feature],u=r.types[r.feature];if(o=u,(2===(a=s)&&1===o||1===a&&2===o)&&function(e,t,r){for(var n=e.feature,i=e.offsets,a=e.members,o=t.feature,s=t.offsets,u=t.members,c=i[n],l=i[n+1];c<l;++c){var d=a[c];e.unit.conformation.position(e.unit.elements[d],ye);for(var p=s[o],m=s[o+1];p<m;++p){var h=u[p];if(t.unit.conformation.position(t.unit.elements[h],_e),f.Vec3.squaredDistance(ye,_e)<r)return!0}}return!1}(t,r,i.distanceMaxSq))return 1}var Ie=n.Provider([2],(function(e,t,r){for(var n=be(e,t).charge,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=new Set,d=t.model.atomicHierarchy.atoms.label_comp_id,f=l.Segmentation.transientSegments(t.model.atomicHierarchy.residueAtomSegments,i);f.hasNext;){var p=f.move(),m=p.index,h=p.start,g=p.end,v=d.value(t.model.atomicHierarchy.residueAtomSegments.offsets[m]);if(ve.includes(v)){r.startState();for(var b=h;b<g;++b)"O"!==Object(y.i)(t,b)||z.ProteinBackboneAtoms.has(Object(y.b)(t,b))||r.pushMember(o[i[b]],s[i[b]],u[i[b]],b);r.finishState(2,0)}else if(z.BaseNames.has(v))for(b=h;b<g;++b)ce(e,t,b)&&(r.startState(),Object(y.g)(e,t,b,(function(e,n){"O"===Object(y.i)(t,n)&&r.pushMember(o[i[n]],s[i[n]],u[i[n]],n)})),r.finishState(2,6));else if(!z.PolymerNames.has(v)){for(b=h;b<g;++b){r.startState(),"N"!==Object(y.i)(t,b)||z.ProteinBackboneAtoms.has(Object(y.b)(t,b))||r.pushMember(o[i[b]],s[i[b]],u[i[b]],b),r.finishState(2,0);var _=0;se(e,t,b)?_=4:ce(e,t,b)?_=6:ue(e,t,b)?_=5:le(e,t,b)&&(_=10),_&&(r.startState(),Object(y.g)(e,t,b,(function(e,n){"O"===Object(y.i)(t,n)&&(c.add(n),r.pushMember(o[i[n]],s[i[n]],u[i[n]],n))})),r.finishState(2,_))}for(b=h;b<g;++b)n[b]<0&&!c.has(b)&&r.add(2,0,o[i[b]],s[i[b]],u[i[b]],b)}}})),Me=n.Provider([1],(function(e,t,r){for(var n=be(e,t).charge,i=t.elements,a=t.model.atomicConformation,o=a.x,s=a.y,u=a.z,c=new Set,d=t.model.atomicHierarchy.atoms.label_comp_id,f=l.Segmentation.transientSegments(t.model.atomicHierarchy.residueAtomSegments,i);f.hasNext;){var p=f.move(),m=p.index,h=p.start,g=p.end,v=d.value(t.model.atomicHierarchy.residueAtomSegments.offsets[m]);if(ge.includes(v)){r.startState();for(var b=h;b<g;++b)"N"!==Object(y.i)(t,b)||z.ProteinBackboneAtoms.has(Object(y.b)(t,b))||r.pushMember(o[i[b]],s[i[b]],u[i[b]],b);r.finishState(1,0)}else if(!z.PolymerNames.has(v)){c.clear();for(b=h;b<g;++b){var _=0;de(e,t,b)?_=8:fe(e,t,b)&&(_=9),_&&(r.startState(),Object(y.g)(e,t,b,(function(e,n){"N"===Object(y.i)(t,n)&&(c.add(n),r.pushMember(o[i[n]],s[i[n]],u[i[n]],n))})),r.finishState(1,_))}for(b=h;b<g;++b)n[b]>0&&!c.has(b)&&r.add(1,0,o[i[b]],s[i[b]],u[i[b]],b)}}})),ke=n.Provider([3],(function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=t.rings.aromaticRings;u<c.length;u++){var l=c[u],d=t.rings.all[l];r.startState();for(var f=0,p=d.length;f<p;++f){var m=d[f];r.pushMember(a[n[m]],o[n[m]],s[n[m]],m)}r.finishState(3,0)}})),Be={name:"ionic",params:pe,createTester:function(e){var t=function(e){return{distanceMaxSq:e.distanceMax*e.distanceMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([2,1]),getType:function(e,r,n,i){return Te(0,r,n,0,t)}}}},Ve={name:"pi-stacking",params:me,createTester:function(e){var t=function(e){return{offsetMax:e.offsetMax,angleDevMax:Object(I.c)(e.angleDevMax)}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3]),getType:function(e,r,n,i){return function(e,t,r,n,i){var a,o=t.types[t.feature],s=r.types[r.feature];if(a=s,3===o&&3===a){Ce(Ae,t),Ce(De,r);var u=f.Vec3.angle(Ae,De);if(Math.min(je(t,r,De),je(r,t,Ae))<=i.offsetMax){if(u<=i.angleDevMax||u>=Pe-i.angleDevMax)return 3;if(u<=i.angleDevMax+Ee&&u>=Ee-i.angleDevMax)return 3}}}(0,r,n,0,t)}}}},Re={name:"cation-pi",params:he,createTester:function(e){var t=function(e){return{offsetMax:e.offsetMax}}(e);return{maxDistance:e.distanceMax,requiredFeatures:new Set([3,1]),getType:function(e,r,n,i){return function(e,t,r,n,i){var a,o,s=t.types[t.feature],u=r.types[r.feature];if(o=u,3===(a=s)&&1===o||1===a&&3===o){var c=3===s?[t,r]:[r,t],l=c[0],d=c[1];if(Ce(Ae,l),je(d,l,Ae)<=i.offsetMax)return 2}}(0,r,n,0,t)}}}},Le={distanceMax:o.ParamDefinition.Numeric(4,{min:1,max:5,step:.1})};var Ne=n.Provider([8],(function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=function(i,u){var c=Object(y.i)(t,i),l=!1;"C"===c?(l=!0,Object(y.g)(e,t,i,(function(e,t){var r=Object(y.i)(e,t);"C"!==r&&"H"!==r&&(l=!1)}))):"F"===c&&(l=!0),l&&r.add(8,0,a[n[i]],o[n[i]],s[n[i]],i)},c=0,l=n.length;c<l;++c)u(c)})),Fe={name:"hydrophobic",params:Le,createTester:function(e){return{maxDistance:e.distanceMax,requiredFeatures:new Set([8]),getType:function(e,t,r,n){return function(e,t,r,n){var i=t.types[t.feature],a=r.types[r.feature];if(o=a,8===i&&8===o){var o,s=t.members[t.offsets[t.feature]],u=r.members[r.offsets[r.feature]];if("F"!==Object(y.i)(t.unit,s)||"F"!==Object(y.i)(r.unit,u))return 6}}(0,t,r)}}}},Ue=r(96),ze={distanceMax:o.ParamDefinition.Numeric(3,{min:1,max:5,step:.1})},He=["LI","NA","K","RB","CS","MG","CA","SR","BA","AL","GA","IN","TL","SC","SN","PB","BI","SB","HG"];function Ge(e){return!z.ProteinBackboneAtoms.has(e)}function qe(e){return z.ProteinBackboneAtoms.has(e)}function We(e){return z.NucleicBackboneAtoms.has(e)}function Xe(e,t){return 12===e?11===t||12===t:13===e?10===t:void 0}var Ye=n.Provider([13,12],(function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=n.length;u<c;++u){var l=Object(y.i)(t,u),d=0;He.includes(l)?d=13:(Object(oe.d)(l)||"ZN"===l||"CD"===l)&&(d=12),d&&r.add(d,0,a[n[u]],o[n[u]],s[n[u]],u)}})),Qe=n.Provider([10,11],(function(e,t,r){for(var n=t.elements,i=t.model.atomicConformation,a=i.x,o=i.y,s=i.z,u=0,c=n.length;u<c;++u){var l=Object(y.i)(t,u),d=Object(y.e)(t,u),f=Object(y.b)(t,u),p=!1,m=!1,h=z.AminoAcidNames.has(d),g=z.BaseNames.has(d);h||g?h?"O"===l?(["ASP","GLU","SER","THR","TYR","ASN","GLN"].includes(d)&&Ge(f)||qe(f))&&(p=!0,m=!0):"S"!==l||"CYS"!==d&&"MET"!==d?"N"===l&&"HIS"===d&&Ge(f)&&(p=!0):(p=!0,m=!0):g&&("O"===l&&We(f)?(p=!0,m=!0):["N3","N4","N7"].includes(f)?p=!0:["O2","O4","O6"].includes(f)&&(p=!0,m=!0)):Object(oe.b)(l)||"O"===l||"S"===l?(p=!0,m=!0):"N"===l&&(p=!0),p&&r.add(11,0,a[n[u]],o[n[u]],s[n[u]],u),m&&r.add(10,0,a[n[u]],o[n[u]],s[n[u]],u)}})),Ke={name:"metal-coordination",params:ze,createTester:function(e){return{maxDistance:e.distanceMax,requiredFeatures:new Set([13,12,10,11]),getType:function(e,t,r,n){return function(e,t,r,n){var i=t.types[t.feature],a=r.types[r.feature];if(Xe(i,a)||Xe(a,i))return 7}(0,t,r)}}}};function Ze(e,t){var r=t.contacts,i=function(e,t,r,n,i){var a=n.get(r)||[1/0,-1],o=a[0],s=a[1];e<o?(-1!==s&&i(s),n.set(r,[e,t])):i(t)};function a(e,t,r,a,o){var s=t.members[t.offsets[t.feature]],u=r.members[r.offsets[r.feature]],c=t.unit.getResidueIndex(s),l=r.unit.getResidueIndex(u),d=s+"|"+t.unit.id+"|"+l+"|"+r.unit.id+"|A",f=u+"|"+r.unit.id+"|"+c+"|"+t.unit.id+"|B",p=n.distance(t,r);i(p,e,d,a,o),i(p,e,f,a,o)}var o,s,u=new Map,c=function(e){return r.edges[e].props.flag=1};return{isApplicable:function(e){return 6===e},handleInterContact:function(e,t,r){a(e,t,r,u,c)},startUnit:function(e,t,r){o=new Map,s=function(e){return t.edgeProps.flag[e]=1}},handleIntraContact:function(e,t,r){a(e,t,r,o,s)}}}function Je(e,t){var r=t.contacts,n=function(e,n){for(var i=9===e.types[e.feature]?n:e,a=i.members[i.offsets[i.feature]],o=t.unitsContacts.get(i.unit.id),s=o.edgeProps.type,u=o.elementsIndex,c=u.offsets,l=u.indices,d=c[a],f=c[a+1];d<f;++d)if(4===s[l[d]])return!0;var p=r.getEdgeIndices(i.feature,i.unit.id);for(d=0,f=p.length;d<f;++d)if(4===r.edges[p[d]].props.type)return!0;return!1};return{isApplicable:function(e){return 8===e},handleInterContact:function(e,t,i){n(t,i)&&(r.edges[e].props.flag=1)},startUnit:function(){},handleIntraContact:function(e,r,i){n(r,i)&&(t.unitsContacts.get(r.unit.id).edgeProps.flag[e]=1)}}}function $e(e,t,r,n,i){for(var a=r.offsets,o=r.feature,s=n.offsets,u=n.feature,c=a[o],l=a[o+1];c<l;++c)for(var d=r.members[c],f=i.getContactIndicesForElement(d,r.unit),p=0,m=f.length;p<m;++p){var h=f[p];if(e.includes(i.edges[h].props.type))for(var g=s[u],v=s[u+1];g<v;++g){var b=n.members[g];if(i.getContactIndicesForElement(b,n.unit).includes(h))return void(i.edges[t].props.flag=1)}}}function et(e,t,r,n,i){for(var a=i.edgeProps,o=a.type,s=a.flag,u=i.elementsIndex,c=u.offsets,l=u.indices,d=r.offsets,f=r.feature,p=n.offsets,m=n.feature,h=d[f],g=d[f+1];h<g;++h)for(var v=r.members[h],b=c[v],y=c[v+1];b<y;++b){var _=l[b];if(e.includes(o[_]))for(var S=p[m],x=p[m+1];S<x;++S)for(var O=n.members[S],w=c[O],C=c[O+1];w<C;++w)if(_===l[w])return void(s[t]=1)}}function tt(e,t){var r=t.contacts;return{isApplicable:function(e){return 1===e},handleInterContact:function(e,t,n){$e([4,8],e,t,n,r)},startUnit:function(){},handleIntraContact:function(e,r,n){et([4,8],e,r,n,t.unitsContacts.get(r.unit.id))}}}function rt(e,t){var r=t.contacts;return{isApplicable:function(e){return 6===e||2===e},handleInterContact:function(e,t,n){$e([3],e,t,n,r)},startUnit:function(){},handleIntraContact:function(e,r,n){et([3],e,r,n,t.unitsContacts.get(r.unit.id))}}}function nt(e,t){var r=t.contacts;return{isApplicable:function(e){return 1===e},handleInterContact:function(e,t,n){$e([7],e,t,n,r)},startUnit:function(){},handleIntraContact:function(e,r,n){et([7],e,r,n,t.unitsContacts.get(r.unit.id))}}}var it,at=r(117),ot=r(201),st=r(23),ut=r(77),ct=r(291);!function(e){function t(e,t){var r=t.unitA,n=t.indexA,i=t.unitB,a=t.indexB,o=e.contacts,s=e.unitsContacts;if(r===i){var u=s.get(r.id),c=u.getDirectedEdgeIndex(n,a);return Object(g.e)(u.edgeProps.type[c])}c=o.getEdgeIndex(n,r.id,a,i.id);return Object(g.e)(o.edges[c].props.type)}function r(e,t,r){var i=e.unitsFeatures;return ot.a.fromPairProvider(t.length,(function(e,r,a){var o=t[e];n.setPosition(r,o.unitA,o.indexA,i.get(o.unitA.id)),n.setPosition(a,o.unitB,o.indexB,i.get(o.unitB.id))}),r)}function i(e,r,n){var i=n[0];if(void 0===i)return"";var a=i.unitA,o=i.indexA,u=i.unitB,c=i.indexB,l=r.unitsFeatures,d=l.get(a.id),f=d.members,p=d.offsets,m=l.get(u.id),h=m.members,g=m.offsets,v={granularity:"element"};return(p[o+1]-p[o]>1||g[c+1]-g[c]>1)&&(v.granularity="residue"),[t(r,i),Object(ut.bondLabel)(s.Bond.Location(e,a,f[p[o]],e,u,h[g[c]]),v)].join("</br>")}e.Location=function(e,t,r,n,i,a){return Object(at.a)("interactions",{structure:t,interactions:e},{unitA:r,indexA:n,unitB:i,indexB:a})},e.isLocation=function(e){return!!e&&"data-location"===e.kind&&"interactions"===e.tag},e.areLocationsEqual=function(e,t){return e.data.structure===t.data.structure&&e.data.interactions===t.data.interactions&&e.element.indexA===t.element.indexA&&e.element.indexB===t.element.indexB&&e.element.unitA===t.element.unitA&&e.element.unitB===t.element.unitB},e.locationLabel=function(e){return t(e.data.interactions,e.element)},e.Loci=function(e,t,n){return Object(st.DataLoci)("interactions",{structure:e,interactions:t},n,(function(e){return r(t,n,e)}),(function(){return i(e,t,n)}))},e.isLoci=function(e){return!!e&&"data-loci"===e.kind&&"interactions"===e.tag},e.getBoundingSphere=r,e.getLabel=i}(it||(it={}));var lt=[te,re,ne,Ie,Me,ke,N,F,Ne,Ye,Qe],dt={ionic:Be,"pi-stacking":Ve,"cation-pi":Re,"halogen-bonds":U,"hydrogen-bonds":ie,"weak-hydrogen-bonds":ae,hydrophobic:Fe,"metal-coordination":Ke};var ft=function(e){void 0===e&&(e=[]);var t=Object.create(null);return Object.keys(dt).forEach((function(r){t[r]=o.ParamDefinition.MappedStatic(e.includes(r)?"on":"off",{on:o.ParamDefinition.Group(dt[r].params),off:o.ParamDefinition.Group({})},{cycle:!0})})),t}(["cation-pi","pi-stacking","hydrogen-bonds","halogen-bonds","metal-coordination"]),pt={providers:o.ParamDefinition.Group(ft,{isFlat:!0}),contacts:o.ParamDefinition.Group(S,{label:"Advanced Options"})};function mt(e,t,r){return Object(a.__awaiter)(this,void 0,void 0,(function(){var u,c,p,g,v,b,y,_,S,O,w,C,j,P,T,I;return Object(a.__generator)(this,(function(M){switch(M.label){case 0:return u=Object(a.__assign)(Object(a.__assign)({},o.ParamDefinition.getDefaultValues(pt)),r),[4,d.a.attach(e,t)];case 1:M.sent(),c=[],Object(ct.a)(dt).forEach((function(e){var t=u.providers[e],r=t.name,n=t.params;"on"===r&&c.push(dt[e].createTester(n))})),p=new Set,c.forEach((function(e){return Ue.a.add(p,e.requiredFeatures)})),g=lt.filter((function(e){return Ue.a.areIntersecting(p,e.types)})),v=l.IntMap.Mutable(),b=l.IntMap.Mutable(),y=0,_=t.unitSymmetryGroups.length,M.label=2;case 2:return y<_?(S=t.unitSymmetryGroups[y],e.runtime.shouldUpdate?[4,e.runtime.update({message:"computing interactions",current:y,max:_})]:[3,4]):[3,6];case 3:M.sent(),M.label=4;case 4:for(O=function(e,t,r){var n=t.elements.length,a=i.create(n,n/2);if(s.Unit.isAtomic(t))for(var o=0,u=r;o<u.length;o++){u[o].add(e,t,a)}return a.getFeatures(n)}(t,S.units[0],g),w=function(e,t,r,n,i){var a=m.create(r,t.elements.length);s.Unit.isAtomic(t)&&function(e,t,r,n,i,a){for(var o=0,s=i;o<s.length;o++){A(e,t,r,n,s[o],a)}}(e,t,r,a,n,i);return a.getContacts()}(t,S.units[0],O,c,u.contacts),C=0,j=S.units.length;C<j;++C)P=S.units[C],v.set(P.id,O),b.set(P.id,w);M.label=5;case 5:return++y,[3,2];case 6:return T=function(e,t,r,i){var a=h.create();return s.Structure.eachUnitPair(e,(function(o,s){var u=t.get(o.id),c=t.get(s.id);!function(e,t,r,i,a,o,s,u){var c=r.count,l=r.x,d=r.y,p=r.z,m=a.lookup3d,h=f.Mat4.mul(D,i.conformation.operator.inverse,t.conformation.operator.matrix),g=!f.Mat4.isIdentity(h),v=Object(f.Vec3)(),b=Math.max.apply(Math,s.map((function(e){return e.maxDistance}))),y=m.boundary.sphere,_=y.center,S=y.radius,O=(S+b)*(S+b),w=u.lineOfSightDistFactor,C=n.Info(e,t,r),j=n.Info(e,i,a);o.startUnitPair(t,i);for(var P=0;P<c;++P)if(f.Vec3.set(v,l[P],d[P],p[P]),g&&f.Vec3.transformMat4(v,v,h),!(f.Vec3.squaredDistance(v,_)>O)){var A=m.find(v[0],v[1],v[2],b),T=A.indices,I=A.count,M=A.squaredDistances;if(0!==I){C.feature=P;for(var k=0;k<I;++k){var B=T[k];if(j.feature=B,x(e,C,j))for(var V=M[k],R=0,L=s;R<L.length;R++){var N=L[R];if(V<N.maxDistance*N.maxDistance){var F=N.getType(e,C,j,V);if(F&&E(e,C,j,w)){o.add(P,B,F);break}}}}}}o.finishUnitPair()}(e,o,u,s,c,a,r,i)}),{maxRadius:Math.max.apply(Math,r.map((function(e){return e.maxDistance}))),validUnit:function(e){return s.Unit.isAtomic(e)},validUnitPair:function(t,r){return s.Structure.validUnitPair(e,t,r)}}),a.getContacts(t)}(t,v,c,u.contacts),function(e,t){for(var r=t.contacts,i=t.unitsContacts,a=t.unitsFeatures,o=[Ze(e,t),Je(e,t),tt(e,t),rt(e,t),nt(e,t)],u=0,c=r.edgeCount;u<c;++u){var l=r.edges[u],d=e.unitMap.get(l.unitA),f=e.unitMap.get(l.unitB);(x=n.Info(e,d,a.get(l.unitA))).feature=l.indexA,(O=n.Info(e,f,a.get(l.unitB))).feature=l.indexB;for(var p=0,m=o;p<m.length;p++){(E=m[p]).isApplicable(l.props.type)&&E.handleInterContact(u,x,O)}}for(var h=i.keys();;){var g=h.next(),v=g.done,b=g.value;if(v)break;var y=i.get(b),_=a.get(b),S=e.unitMap.get(b);if(s.Unit.isAtomic(S)){for(var x=n.Info(e,S,_),O=n.Info(e,S,_),w=0,C=o;w<C.length;w++){(E=C[w]).startUnit(S,y,_)}for(u=0,c=2*y.edgeCount;u<c;++u){x.feature=y.a[u],O.feature=y.b[u];for(var j=0,P=o;j<P.length;j++){var E;(E=P[j]).isApplicable(y.edgeProps.type[u])&&E.handleIntraContact(u,x,O)}}}}}(t,I={unitsFeatures:v,unitsContacts:b,contacts:T}),[2,I]}}))}))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return h})),r.d(t,"b",(function(){return _}));var n=r(6),i=r(145),a=r(22),o=r(12),s=r(29);function u(e){for(var t=function(e,t){return{startVertex:0,endVertex:0,count:0,visited:new Int32Array(t),queue:new Int32Array(t),pred:new Int32Array(t),left:new Int32Array(4),right:new Int32Array(4),color:new Int32Array(t),currentColor:0,currentAltLoc:"",hasAltLoc:!1,rings:[],currentRings:[],unit:e,bonds:e.bonds,altLoc:e.model.atomicHierarchy.atoms.label_alt_id}}(e,function(e){var t=n.Segmentation.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements),r=0;for(;t.hasNext;){var i=t.move();r=Math.max(r,i.end-i.start)}return r}(e)),r=n.Segmentation.transientSegments(e.model.atomicHierarchy.residueAtomSegments,e.elements);r.hasNext;){var i=r.move();l(t,i.start,i.end)}return t.rings}function c(e){e.count=e.endVertex-e.startVertex;for(var t=e.visited,r=e.pred,n=e.color,i=0;i<e.count;i++)t[i]=-1,r[i]=-1,n[i]=0;e.currentColor=0,e.currentAltLoc="",e.hasAltLoc=!1}function l(e,t,r){var n=e.visited;if(e.startVertex=t,e.endVertex=r,!(e.endVertex-e.startVertex<3)){e.currentRings=[];for(var i=e.unit.elements,a=[],o=e.startVertex;o<e.endVertex;o++){var u=e.altLoc.value(i[o]);Object(s.arraySetAdd)(a,u)}if(Object(s.arraySetRemove)(a,""),0===a.length){c(e);for(o=0;o<e.count;o++)n[o]>=0||f(e,o)}else for(var l=0;l<a.length;l++){c(e),e.hasAltLoc=!0,e.currentAltLoc=a[l];for(o=0;o<e.count;o++){if(!(n[o]>=0))(u=e.altLoc.value(i[e.startVertex+o]))&&u!==e.currentAltLoc||f(e,o)}}o=0;for(var d=e.currentRings.length;o<d;o++)e.rings.push(e.currentRings[o])}}function d(e,t,r){if(!(r<t)){for(var i=e.pred,a=e.color,s=e.left,u=e.right,c=++e.currentColor,l=t,d=0;d<4&&(a[l]=c,!((l=i[l])<0));d++);var f=0,p=0,m=!1,h=0;l=r;for(d=0;d<4;d++){if(a[l]===c){h=l,m=!0;break}if(u[p++]=l,(l=i[l])<0)break}if(m){l=t;for(d=0;d<4&&(s[f++]=l,h!==l)&&!((l=i[l])<0);d++);var g=f+p;if(!(g<3)){var v=new Int32Array(g),b=0;for(d=0;d<f;d++)v[b++]=e.startVertex+s[d];for(d=p-1;d>=0;d--)v[b++]=e.startVertex+u[d];if(Object(o.q)(v),e.hasAltLoc)for(var y=0,_=e.currentRings.length;y<_;y++){var S=e.currentRings[y];if(v[0]===S[0]&&v.length===S.length){for(var x=!0,O=0,w=v.length;O<w;O++)if(v[O]!==S[O]){x=!1;break}if(x)return}}e.currentRings.push(n.SortedArray.ofSortedArray(v))}}}}function f(e,t){var r=e.bonds,n=e.startVertex,i=e.endVertex,o=e.visited,s=e.queue,u=e.pred,c=e.unit.elements,l=r.b,f=r.edgeProps.flags,p=r.offset;o[t]=1,s[0]=t;for(var m=0,h=1;m<h;)for(var g=s[m++],v=n+g,b=p[v],y=p[v+1],_=b;_<y;_++){var S=l[_];if(!(S<n||S>=i)&&a.BondType.isCovalent(f[_])){if(e.hasAltLoc){var x=e.altLoc.value(c[S]);if(x&&e.currentAltLoc!==x)continue}var O=S-n;o[O]>0?u[O]!==g&&u[g]!==O&&d(e,g,O):(o[O]=1,s[h++]=O,u[O]=g)}}}function p(e){for(var t=e.length,r=new Int32Array(2*t),n=0;n<r.length;n++)r[n]=-1;for(var i="",a="",o=0,s=1;s<r.length;s++){for(n=r[s-o-1];-1!==n&&(i=e[s%t])!==(a=e[(o+n+1)%t]);)i<a&&(o=s-n-1),n=r[n];-1===n&&(i=e[s%t])!==(a=e[(o+n+1)%t])?(i<a&&(o=s),r[s-o]=-1):r[s-o]=n+1}return o}function m(e,t){var r,n=e.length,i=[];for(r=0;r<n-1;r++)i.push(e[(r+t)%n]),i.push("-");return i.push(e[(r+t)%n]),i.join("")}var h,g,v=r(150),b=r(238),y=r(1),_=function(){function e(e,t){this.unit=t,this.all=e}return Object.defineProperty(e.prototype,"index",{get:function(){return this._index||(this._index=function(e,t){for(var r=new Map,n=new Map,a=0,o=e.length;a<o;a++)for(var s=0,u=(p=e[a]).length;s<u;s++){var c=p[s];r.has(c)?r.get(c).push(a):r.set(c,[a])}for(var l=0,d=t.length;l<d;l++)for(s=0,u=(p=e[a=t[l]]).length;s<u;s++){c=p[s];n.has(c)?n.get(c).push(a):n.set(c,[a])}var f=new i.a.UniqueEdgeBuilder(e.length);for(a=0,o=e.length;a<o;a++){var p;for(s=0,u=(p=e[a]).length;s<u;s++){c=p[s];var m=r.get(c);if(1!==m.length)for(var h=0,g=m.length;h<g;h++){var v=m[h];a>=v||f.addEdge(a,v)}}}var b=i.a.connectedComponents(f.getGraph()),y=b.componentIndex,_=[];for(s=0;s<b.componentCount;s++)_[s]=[];for(a=0,o=e.length;a<o;a++)_[y[a]].push(a);return{elementRingIndices:r,elementAromaticRingIndices:n,ringComponentIndex:y,ringComponents:_}}(this.all,this.aromaticRings)),this._index},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"byFingerprint",{get:function(){return this._byFingerprint||(this._byFingerprint=function(e,t){for(var r=new Map,n=0,i=0,a=t.length;i<a;i++){var o=t[i],s=h.fingerprint(e,o);r.has(s)?r.get(s).push(n):r.set(s,[n]),n++}return r}(this.unit,this.all)),this._byFingerprint},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elementRingIndices",{get:function(){return this.index.elementRingIndices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"elementAromaticRingIndices",{get:function(){return this.index.elementAromaticRingIndices},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ringComponentIndex",{get:function(){return this.index.ringComponentIndex},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"ringComponents",{get:function(){return this.index.ringComponents},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aromaticRings",{get:function(){return this._aromaticRings||(this._aromaticRings=function(e,t){for(var r=[],n=0,i=t.length;n<i;++n)h.isAromatic(e,t[n])&&r.push(n);return r}(this.unit,this.all)),this._aromaticRings},enumerable:!1,configurable:!0}),e}();function S(e,t){for(var r=e.elements,n=e.model.atomicHierarchy.residueAtomSegments.index,i=n[r[t[0]]],a=1,o=t.length;a<o;a++)if(i!==n[r[t[a]]])return-1;return i}function x(e,t,r){var n=e.byFingerprint.get(t);if(n)for(var i=0,a=n.length;i<a;i++){var o=n[i],s=S(e.unit,e.all[o]);s>=0&&(r.has(s)?r.get(s).push(o):r.set(s,[o]))}}!function(e){function t(e){return function(e){for(var t=e.length,r=new Array(t),n=0;n<t;n++)r[n]=e[t-n-1];var i=p(e),a=p(r),o=!1;for(n=0;n<t;n++){var s=e[(n+i)%t],u=r[(n+a)%t];if(s!==u){o=s<u;break}}return o?m(e,i):m(r,a)}(e)}e.fingerprint=function(e,r){for(var n=e.elements,i=e.model.atomicHierarchy.atoms.type_symbol,a=[],o=0,s=r.length;o<s;o++)a[a.length]=i.value(n[r[o]]);return t(a)},e.elementFingerprint=t;var r=new Set(["B","C","N","O","SI","P","S","GE","AS","SN","SB","BI"]);e.isAromatic=function(e,t){var i=e.elements,o=e.bonds,s=o.b,u=o.offset,c=o.edgeProps.flags,l=e.model.atomicHierarchy.atoms,d=l.type_symbol;if("PRO"===l.label_comp_id.value(e.elements[t[0]]))return!1;for(var f=0,p=!1,m=0,h=t.length;m<h;++m){var g=t[m];!p&&r.has(d.value(i[g]))&&(p=!0);for(var _=u[g],S=u[g+1];_<S;++_)a.BondType.is(16,c[_])&&n.SortedArray.has(t,s[_])&&(f+=1)}if(f===2*t.length)return!0;if(!p)return!1;var x=b.a.calculateMomentsAxes(Object(v.c)(e,t));return y.Vec3.magnitude(x.dirC)<.05},e.getAltId=function(e,t){for(var r=e.model.atomicHierarchy.atoms.label_alt_id,n=e.elements,i=0,a=t.length;i<a;++i){var o=n[t[i]],s=r.value(o);if(s)return s}return""}}(h||(h={})),(g=_||(_={})).create=function(e){var t=u(e);return new g(t,e)},g.byFingerprintAndResidue=function(e,t){for(var r=new Map,n=0,i=t.length;n<i;n++)x(e,t[n],r);return r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(16),a=r(19),o=r(43);function s(e,t){return Object(o.b)(a.b.Dictionary({0:Object(a.a)(e)}),e,t)}function u(e,t){return Object(o.b)(a.b.List(e,{nonEmpty:!0}),e,t)}function c(e,t,r){return Object(o.b)(a.b.Dictionary({0:Object(a.a)(e),1:Object(a.a)(e)}),t,r)}!function(e){e.AnyVar=i.a.Variable("a",i.a.Any),e.AnyValueVar=i.a.Variable("a",i.a.Any),e.ConstrainedVar=i.a.Variable("a",i.a.Any,!0),e.Regex=i.a.Value("Core","Regex"),e.Set=function(t){return i.a.Container("Core","Set",t||e.AnyValueVar)},e.List=function(t){return i.a.Container("Core","List",t||e.AnyVar)},e.Fn=function(t,r){return i.a.Container("Core","Fn",t||e.AnyVar,r)},e.Flags=function(e,t){return i.a.Container("Core","Flags",e,t)},e.BitFlags=e.Flags(i.a.Num,"BitFlags")}(n||(n={}));a.b.Dictionary({0:Object(a.a)(i.a.Num),1:Object(a.a)(i.a.Num)}),Object(a.a)(i.a.Str);var l={"@header":"Language Primitives",type:{"@header":"Types",bool:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.AnyValue)}),i.a.Bool,"Convert a value to boolean."),num:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.AnyValue)}),i.a.Num,"Convert a value to number."),str:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.AnyValue)}),i.a.Str,"Convert a value to string."),regex:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.Str,{description:"Expression"}),1:Object(a.a)(i.a.Str,{isOptional:!0,description:"Flags, e.g. 'i' for ignore case"})}),n.Regex,"Creates a regular expression from a string using the ECMAscript syntax."),list:Object(o.b)(a.b.List(n.AnyVar),n.List()),set:Object(o.b)(a.b.List(n.AnyValueVar),n.Set()),bitflags:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.Num)}),n.BitFlags,"Interpret a number as bitflags."),compositeKey:Object(o.b)(a.b.List(i.a.AnyValue),i.a.AnyValue)},logic:{"@header":"Logic",not:s(i.a.Bool),and:u(i.a.Bool),or:u(i.a.Bool)},ctrl:{"@header":"Control",eval:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.Fn(n.AnyVar))}),n.AnyVar,"Evaluate a function."),fn:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.AnyVar)}),n.Fn(n.AnyVar),'Wrap an expression to a "lazy" function.'),if:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.Bool,{description:"Condition"}),1:Object(a.a)(i.a.Variable("a",i.a.Any),{description:"If true"}),2:Object(a.a)(i.a.Variable("b",i.a.Any),{description:"If false"})}),i.a.Union([i.a.Variable("a",i.a.Any),i.a.Variable("b",i.a.Any)])),assoc:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.Str,{description:"Name"}),1:Object(a.a)(i.a.Variable("a",i.a.Any),{description:"Value to assign"})}),i.a.Variable("a",i.a.Any))},rel:{"@header":"Relational",eq:c(i.a.Variable("a",i.a.AnyValue,!0),i.a.Bool),neq:c(i.a.Variable("a",i.a.AnyValue,!0),i.a.Bool),lt:c(i.a.Num,i.a.Bool),lte:c(i.a.Num,i.a.Bool),gr:c(i.a.Num,i.a.Bool),gre:c(i.a.Num,i.a.Bool),inRange:Object(o.b)(a.b.Dictionary({0:Object(a.a)(i.a.Num,{description:"Value to test"}),1:Object(a.a)(i.a.Num,{description:"Minimum value"}),2:Object(a.a)(i.a.Num,{description:"Maximum value"})}),i.a.Bool,"Check if the value of the 1st argument is >= 2nd and <= 3rd.")},math:{"@header":"Math",add:u(i.a.Num),sub:u(i.a.Num),mult:u(i.a.Num),div:c(i.a.Num,i.a.Num),pow:c(i.a.Num,i.a.Num),mod:c(i.a.Num,i.a.Num),min:u(i.a.Num),max:u(i.a.Num),floor:s(i.a.Num),ceil:s(i.a.Num),roundInt:s(i.a.Num),abs:s(i.a.Num),sqrt:s(i.a.Num),cbrt:s(i.a.Num),sin:s(i.a.Num),cos:s(i.a.Num),tan:s(i.a.Num),asin:s(i.a.Num),acos:s(i.a.Num),atan:s(i.a.Num),sinh:s(i.a.Num),cosh:s(i.a.Num),tanh:s(i.a.Num),exp:s(i.a.Num),log:s(i.a.Num),log10:s(i.a.Num),atan2:c(i.a.Num,i.a.Num)},str:{"@header":"Strings",concat:u(i.a.Str),match:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.Regex),1:Object(a.a)(i.a.Str)}),i.a.Bool)},list:{"@header":"Lists",getAt:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.List()),1:Object(a.a)(i.a.Num)}),n.AnyVar),equal:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.List()),1:Object(a.a)(n.List())}),i.a.Bool)},set:{"@header":"Sets",has:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.Set(n.ConstrainedVar)),1:Object(a.a)(n.ConstrainedVar)}),i.a.Bool,"Check if the the 1st argument includes the value of the 2nd."),isSubset:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.Set(n.ConstrainedVar)),1:Object(a.a)(n.Set(n.ConstrainedVar))}),i.a.Bool,"Check if the the 1st argument is a subset of the 2nd.")},flags:{"@header":"Flags",hasAny:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.Flags(n.ConstrainedVar)),1:Object(a.a)(n.Flags(n.ConstrainedVar))}),i.a.Bool,"Check if the the 1st argument has at least one of the 2nd one's flags."),hasAll:Object(o.b)(a.b.Dictionary({0:Object(a.a)(n.Flags(n.ConstrainedVar)),1:Object(a.a)(n.Flags(n.ConstrainedVar))}),i.a.Bool,"Check if the the 1st argument has all 2nd one's flags.")}};Object(o.a)(l);var d=Object(o.c)(l);!function(){for(var e=Object.create(null),t=0,r=d;t<r.length;t++){var n=r[t];e[n.id]=n}}();t.b=l},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(2),o=r(5),s=r(66),u=r(42);!function(e){function t(e){var t=this,r=e.descriptor.name,n="root"===e.type?"inheritedPropertyData":"currentPropertyData",s=function(t){return r in t[n]||(t[n][r]={props:Object(i.__assign)({},a.ParamDefinition.getDefaultValues(e.getParams(t))),data:o.d.create(void 0)}),t[n][r]},u=function(e,t,i){var a=s(e);e[n][r]={props:t,data:o.d.withValue(a.data,i)}};return{label:e.label,descriptor:e.descriptor,isHidden:e.isHidden,getParams:function(t){var r=a.ParamDefinition.clone(e.getParams(t));return a.ParamDefinition.setDefaultValues(r,s(t).props),r},defaultParams:e.defaultParams,isApplicable:e.isApplicable,attach:function(r,n,o,c){return void 0===o&&(o={}),Object(i.__awaiter)(t,void 0,void 0,(function(){var t,l,d,f,p,m;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return c&&n.customPropertyDescriptors.reference(e.descriptor,!0),"root"===e.type&&(n=n.root),t=s(n.root).props,l=s(n),d=a.ParamDefinition.merge(e.defaultParams,t,o),l.data.value&&a.ParamDefinition.areEqual(e.defaultParams,l.props,d)?[2]:[4,e.obtain(r,n,d)];case 1:return f=i.sent(),p=f.value,m=f.assets,n.customPropertyDescriptors.add(e.descriptor),n.customPropertyDescriptors.assets(e.descriptor,m),u(n,d,p),[2]}}))}))},ref:function(t,r){return t.customPropertyDescriptors.reference(e.descriptor,r)},get:function(e){return s(e).data},set:function(t,r,n){void 0===r&&(r={}),"root"===e.type&&(t=t.root);var i=s(t),o=a.ParamDefinition.merge(e.defaultParams,i.props,r);a.ParamDefinition.areEqual(e.defaultParams,i.props,o)||(u(t,o,n),t.customPropertyDescriptors.assets(e.descriptor))},props:function(e){return s(e).props}}}e.createProvider=t,e.createSimple=function(e,r,n){var o=this,c={value:a.ParamDefinition.Value(n,{isHidden:!0})};return t({label:Object(u.d)(e),descriptor:Object(s.CustomPropertyDescriptor)({name:e}),isHidden:!0,type:r,defaultParams:c,getParams:function(){return{value:a.ParamDefinition.Value(n,{isHidden:!0})}},isApplicable:function(){return!0},obtain:function(e,t,r){return Object(i.__awaiter)(o,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){return[2,Object(i.__assign)(Object(i.__assign)({},a.ParamDefinition.getDefaultValues(c)),r)]}))}))}})}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"ToggleSelectionModeButton",(function(){return b})),r.d(t,"StructureSelectionActionsControls",(function(){return S})),r.d(t,"StructureSelectionStatsControls",(function(){return x}));var n=r(0),i=r(3),a=r(89),o=r(380),s=r(260),u=r(154),c=r(2),l=r(42),d=r(33),f=r(56),p=r(18),m=r(73),h=r(15),g=r(330),v=r(195),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._toggleSelMode=function(){t.plugin.selectionMode=!t.plugin.selectionMode},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.layout.events.updated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.behaviors.interaction.selectionMode,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e=this.props.inline?{background:"transparent",width:"auto",height:"auto",lineHeight:"unset"}:{background:"transparent"};return i.createElement(p.IconButton,{svg:h.SelectionModeSvg,onClick:this._toggleSelMode,title:"Toggle Selection Mode",style:e,toggleState:this.plugin.selectionMode})},t}(d.PurePluginUIComponent),y={granularity:o.a.Params.granularity},_=new Map([["add","Add/Union Selection"],["remove","Remove/Subtract Selection"],["intersect","Intersect Selection"],["set","Set Selection"]]),S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={action:void 0,isEmpty:!0,isBusy:!1,canUndo:!1},t.set=function(e,r){t.plugin.managers.structure.selection.fromSelectionQuery(e,r,!1)},t.selectQuery=function(e,r){if(e&&t.state.action){var n=t.state.action;(null==r?void 0:r.shiftKey)?t.set(n,e.value):t.setState({action:void 0},(function(){t.set(n,e.value)}))}else t.setState({action:void 0})},t.queriesItems=[],t.queriesVersion=-1,t.toggleAdd=t.showAction("add"),t.toggleRemove=t.showAction("remove"),t.toggleIntersect=t.showAction("intersect"),t.toggleSet=t.showAction("set"),t.toggleTheme=t.showAction("theme"),t.toggleAddComponent=t.showAction("add-component"),t.toggleHelp=t.showAction("help"),t.setGranuality=function(e){var r=e.value;t.plugin.managers.interactivity.setProps({granularity:r})},t.turnOff=function(){return t.plugin.selectionMode=!1},t.undo=function(){var e=t.plugin.state.data.undo();e&&t.plugin.runTask(e)},t.subtract=function(){for(var e=[],r=0,n=t.plugin.managers.structure.hierarchy.getStructuresWithSelection();r<n.length;r++){var i=n[r];e.push.apply(e,i.components)}0!==e.length&&t.plugin.managers.structure.component.modifyByCurrentSelection(e,"subtract")},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(t){var r=0===t.hierarchy.structures.length;e.state.isEmpty!==r&&e.setState({isEmpty:r}),e.queriesVersion=-1,e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t,action:void 0})})),this.subscribe(this.plugin.managers.interactivity.events.propsUpdated,(function(){e.forceUpdate()})),this.subscribe(this.plugin.state.data.events.historyUpdated,(function(t){var r=t.state;e.setState({canUndo:r.canUndo})}))},Object.defineProperty(t.prototype,"isDisabled",{get:function(){return this.state.isBusy||this.state.isEmpty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"structures",{get:function(){for(var e,t=[],r=0,n=this.plugin.managers.structure.hierarchy.selection.structures;r<n.length;r++){var i=null===(e=n[r].cell.obj)||void 0===e?void 0:e.data;i&&t.push(i)}return t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"queries",{get:function(){var e=this.plugin.query.structure.registry;if(e.version!==this.queriesVersion){var t=this.structures,r=Object(n.__spreadArrays)(e.list,Object(a.g)(t),Object(a.f)(t),Object(a.e)(t)).sort((function(e,t){return t.priority-e.priority}));this.queriesItems=f.a.createItems(r,{filter:function(e){return e!==a.b.current&&!e.isHidden},label:function(e){return e.label},category:function(e){return e.category},description:function(e){return e.description}}),this.queriesVersion=e.version}return this.queriesItems},enumerable:!1,configurable:!0}),t.prototype.showAction=function(e){var t=this;return function(){return t.setState({action:t.state.action===e?void 0:e})}},t.prototype.render=function(){var e=this.plugin.managers.interactivity.props.granularity,t=this.state.canUndo?"Undo "+this.plugin.state.data.latestUndoLabel:"Some mistakes of the past can be undone.";return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row",style:{background:"none"}},i.createElement(m.PureSelectControl,{title:"Picking Level for selecting and highlighting",param:y.granularity,name:"granularity",value:e,onChange:this.setGranuality,isDisabled:this.isDisabled}),i.createElement(p.ToggleButton,{icon:h.UnionSvg,title:_.get("add")+". Hold shift key to keep menu open.",toggle:this.toggleAdd,isSelected:"add"===this.state.action,disabled:this.isDisabled}),i.createElement(p.ToggleButton,{icon:h.SubtractSvg,title:_.get("remove")+". Hold shift key to keep menu open.",toggle:this.toggleRemove,isSelected:"remove"===this.state.action,disabled:this.isDisabled}),i.createElement(p.ToggleButton,{icon:h.IntersectSvg,title:_.get("intersect")+". Hold shift key to keep menu open.",toggle:this.toggleIntersect,isSelected:"intersect"===this.state.action,disabled:this.isDisabled}),i.createElement(p.ToggleButton,{icon:h.SetSvg,title:_.get("set")+". Hold shift key to keep menu open.",toggle:this.toggleSet,isSelected:"set"===this.state.action,disabled:this.isDisabled}),i.createElement(p.ToggleButton,{icon:h.BrushSvg,title:"Apply Theme to Selection",toggle:this.toggleTheme,isSelected:"theme"===this.state.action,disabled:this.isDisabled,style:{marginLeft:"10px"}}),i.createElement(p.ToggleButton,{icon:h.CubeOutlineSvg,title:"Create Component of Selection with Representation",toggle:this.toggleAddComponent,isSelected:"add-component"===this.state.action,disabled:this.isDisabled}),i.createElement(p.IconButton,{svg:h.RemoveSvg,title:"Remove/subtract Selection from all Components",onClick:this.subtract,disabled:this.isDisabled}),i.createElement(p.IconButton,{svg:h.RestoreSvg,onClick:this.undo,disabled:!this.state.canUndo||this.isDisabled,title:t}),i.createElement(p.ToggleButton,{icon:h.HelpOutlineSvg,title:"Show/hide help",toggle:this.toggleHelp,style:{marginLeft:"10px"},isSelected:"help"===this.state.action}),i.createElement(p.IconButton,{svg:h.CancelOutlinedSvg,title:"Turn selection mode off",onClick:this.turnOff})),this.state.action&&"theme"!==this.state.action&&"add-component"!==this.state.action&&"help"!==this.state.action&&i.createElement("div",{className:"msp-selection-viewport-controls-actions"},i.createElement(f.a,{header:_.get(this.state.action),title:"Click to close.",items:this.queries,onSelect:this.selectQuery,noOffset:!0})),"theme"===this.state.action&&i.createElement("div",{className:"msp-selection-viewport-controls-actions"},i.createElement(p.ControlGroup,{header:"Theme",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleTheme,topRightIcon:h.CloseSvg},i.createElement(O,{onApply:this.toggleTheme}))),"add-component"===this.state.action&&i.createElement("div",{className:"msp-selection-viewport-controls-actions"},i.createElement(p.ControlGroup,{header:"Add Component",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleAddComponent,topRightIcon:h.CloseSvg},i.createElement(g.AddComponentControls,{onApply:this.toggleAddComponent,forSelection:!0}))),"help"===this.state.action&&i.createElement("div",{className:"msp-selection-viewport-controls-actions"},i.createElement(p.ControlGroup,{header:"Help",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleHelp,topRightIcon:h.CloseSvg,maxHeight:"300px"},i.createElement(v.HelpGroup,{header:"Selection Operations"},i.createElement(v.HelpText,null,"Use ",i.createElement(h.Icon,{svg:h.UnionSvg,inline:!0})," ",i.createElement(h.Icon,{svg:h.SubtractSvg,inline:!0})," ",i.createElement(h.Icon,{svg:h.IntersectSvg,inline:!0})," ",i.createElement(h.Icon,{svg:h.SetSvg,inline:!0})," to modify the selection.")),i.createElement(v.HelpGroup,{header:"Representation Operations"},i.createElement(v.HelpText,null,"Use ",i.createElement(h.Icon,{svg:h.BrushSvg,inline:!0})," ",i.createElement(h.Icon,{svg:h.CubeOutlineSvg,inline:!0})," ",i.createElement(h.Icon,{svg:h.RemoveSvg,inline:!0})," ",i.createElement(h.Icon,{svg:h.RestoreSvg,inline:!0})," to color, create components, remove from components, or undo actions.")),i.createElement(v.ViewportHelpContent,{selectOnly:!0}))))},t}(d.PluginUIComponent),x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isEmpty:!0,isBusy:!1},t.clear=function(){return t.plugin.managers.interactivity.lociSelects.deselectAll()},t.focus=function(){if(0!==t.plugin.managers.structure.selection.stats.elementCount){var e=t.plugin.managers.structure.selection.getBoundary().sphere;t.plugin.managers.camera.focusSphere(e)}},t.highlight=function(e){t.plugin.managers.interactivity.lociHighlights.clearHighlights(),t.plugin.managers.structure.selection.entries.forEach((function(e){t.plugin.managers.interactivity.lociHighlights.highlight({loci:e.selection},!1)}))},t.clearHighlight=function(){t.plugin.managers.interactivity.lociHighlights.clearHighlights()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.selection.events.changed,(function(){e.forceUpdate()})),this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(t){var r=0===t.structures.length;e.state.isEmpty!==r&&e.setState({isEmpty:r})})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})}))},Object.defineProperty(t.prototype,"isDisabled",{get:function(){return this.state.isBusy||this.state.isEmpty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stats",{get:function(){var e=this.plugin.managers.structure.selection.stats;return 0===e.structureCount||0===e.elementCount?"Nothing Selected":Object(l.e)(e.label)+" Selected"},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.plugin.managers.structure.selection.stats,t=0===e.structureCount||0===e.elementCount;return t&&this.props.hideOnEmpty?null:i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(p.Button,{noOverflow:!0,onClick:this.focus,title:"Click to Focus Selection",disabled:t,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlignLast:t?void 0:"left"}},this.stats),!t&&i.createElement(p.IconButton,{svg:h.CancelOutlinedSvg,onClick:this.clear,title:"Clear",className:"msp-form-control",flex:!0})))},t}(d.PluginUIComponent),O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._params=Object(u.b)((function(e){return s.StructureComponentManager.getThemeParams(t.plugin,e)})),t.state={values:c.ParamDefinition.getDefaultValues(t.params)},t.apply=function(){var e,r;t.plugin.managers.structure.component.applyTheme(t.state.values,t.plugin.managers.structure.hierarchy.current.structures),null===(r=(e=t.props).onApply)||void 0===r||r.call(e)},t.paramsChanged=function(e){return t.setState({values:e})},t}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"params",{get:function(){return this._params(this.plugin.managers.structure.component.pivotStructure)},enumerable:!1,configurable:!0}),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement(m.ParameterControls,{params:this.params,values:this.state.values,onChangeValues:this.paramsChanged}),i.createElement(p.Button,{icon:h.BrushSvg,className:"msp-btn-commit msp-btn-commit-on",onClick:this.apply,style:{marginTop:"1px"}},"Apply Theme"))},t}(d.PurePluginUIComponent)},function(e,t,r){"use strict";var n;!function(e){e.create=function(e){return e},e.has=function(e,t){return 0!=(e&t)},e.hasAll=function(e,t){return!!t&&(e&t)===t}}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return e.prototype=Object.create(Error.prototype),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(2),o=r(12),s=r(144),u=r(393),c=new Uint16Array([0,1,2,1,3,2]),l=o.a.add3,d=o.a.add2,f=o.a.add;!function(e){e.create=function(e,t,r,n){void 0===e&&(e={}),void 0===t&&(t=2048),void 0===r&&(r=1024),t*=2,r*=2;var p=o.a.create(Float32Array,3,r,n?n.centerBuffer.ref.value:t),m=o.a.create(Float32Array,2,r,n?n.mappingBuffer.ref.value:t),h=o.a.create(Float32Array,1,r,n?n.depthBuffer.ref.value:t),g=o.a.create(Uint32Array,3,r,n?n.indexBuffer.ref.value:t),v=o.a.create(Float32Array,1,r,n?n.groupBuffer.ref.value:t),b=o.a.create(Float32Array,2,r,n?n.tcoordBuffer.ref.value:t),y=Object(i.__assign)(Object(i.__assign)({},a.ParamDefinition.getDefaultValues(s.a.Params)),e),_=y.attachment,S=y.background,x=y.backgroundMargin,O=y.tether,w=y.tetherLength,C=y.tetherBaseWidth,j=Object(u.b)(y),P=.4*x,E=j.buffer/j.lineHeight,A=function(e,t,r,n,i){l(p,e,t,r),f(h,n),f(v,i)};return{add:function(e,t,r,n,i,a,o){for(var s=0,u=e.length,f=0;f<u;++f){s+=(q=j.get(e[f])).nw-2*E}var h,v;if(h=_.startsWith("top")?.8:_.startsWith("middle")?.4:0,v=_.endsWith("right")?s:_.endsWith("center")?s/2:0,O)switch(_){case"bottom-left":v-=w/2+P+.1,h-=w/2+P;break;case"bottom-center":h-=w+P;break;case"bottom-right":v+=w/2+P+.1,h-=w/2+P;break;case"middle-left":v-=w+P+.1;break;case"middle-center":break;case"middle-right":v+=w+P+.1;break;case"top-left":v-=w/2+P+.1,h+=w/2+P;break;case"top-center":h+=w+P;break;case"top-right":v+=w/2+P+.1,h+=w/2+P}var y=(-v-P-.1)*a,x=(s-v+P+.1)*a,D=(.8-h+P)*a,T=(-h-P)*a;if(S){d(m,y,D),d(m,y,T),d(m,x,D),d(m,x,T);for(var I=p.elementCount,M=0;M<4;++M)d(b,10,10),A(t,r,n,i,o);l(g,I+c[0],I+c[1],I+c[2]),l(g,I+c[3],I+c[4],I+c[5])}if(O){var k=void 0,B=void 0,V=void 0,R=void 0,L=void 0,N=void 0,F=void 0,U=void 0,z=w*a,H=C*a;switch(_){case"bottom-left":k=y-z/2,V=y+H/2,L=y,F=y,B=T-z/2,R=T,N=T+H/2,U=T;break;case"bottom-center":k=0,V=H/2,L=-H/2,F=0,B=T-z,R=T,N=T,U=T;break;case"bottom-right":k=x+z/2,V=x,L=x-H/2,F=x,B=T-z/2,R=T+H/2,N=T,U=T;break;case"middle-left":k=y-z,V=y,L=y,F=y,B=0,R=-H/2,N=H/2,U=0;break;case"middle-center":k=0,V=0,L=0,F=0,B=0,R=0,N=0,U=0;break;case"middle-right":k=x+z,V=x,L=x,F=x,B=0,R=H/2,N=-H/2,U=0;break;case"top-left":k=y-z/2,V=y+H/2,L=y,F=y,B=D+z/2,R=D,N=D-H/2,U=D;break;case"top-center":k=0,V=H/2,L=-H/2,F=0,B=D+z,R=D,N=D,U=D;break;case"top-right":k=x+z/2,V=x,L=x-H/2,F=x,B=D+z/2,R=D-H/2,N=D,U=D;break;default:throw new Error("unsupported attachment")}d(m,k,B),d(m,V,R),d(m,L,N),d(m,F,U);for(I=p.elementCount,M=0;M<4;++M)d(b,10,10),A(t,r,n,i,o);l(g,I,I+1,I+3),l(g,I,I+3,I+2)}v+=E,h+=E;var G=0;for(f=0;f<u;++f){var q,W=(G-v)*a,X=(G+(q=j.get(e[f])).nw-v)*a,Y=(q.nh-h)*a,Q=-h*a;d(m,W,Y),d(m,W,Q),d(m,X,Y),d(m,X,Q);var K=j.texture.width,Z=j.texture.height;d(b,q.x/K,q.y/Z),d(b,q.x/K,(q.y+q.h)/Z),d(b,(q.x+q.w)/K,q.y/Z),d(b,(q.x+q.w)/K,(q.y+q.h)/Z),G+=q.nw-2*E;for(I=p.elementCount,M=0;M<4;++M)A(t,r,n,i,o);l(g,I+c[0],I+c[1],I+c[2]),l(g,I+c[3],I+c[4],I+c[5])}},getText:function(){var e=j.texture,t=o.a.compact(p,!0),r=o.a.compact(m,!0),i=o.a.compact(h,!0),a=o.a.compact(g,!0),u=o.a.compact(v,!0),c=o.a.compact(b,!0);return s.a.create(e,t,r,i,a,u,c,g.elementCount/2,n)}}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return f})),r.d(t,"a",(function(){return p}));var n=r(0),i=r(17),a=r(193),o=r(5),s=r(12),u=r(38),c=r(170);function l(e){return Object(n.__assign)(Object(n.__assign)({},e),{bottomLeft:Object(o.h)(e.bottomLeft,[0,0,0]),topRight:Object(o.h)(e.topRight,e.scalarField.space.dimensions)})}function d(e){return{dX:e.topRight[0]-e.bottomLeft[0],dY:e.topRight[1]-e.bottomLeft[1],dZ:e.topRight[2]-e.bottomLeft[2]}}function f(e,t){var r=this;return i.b.create("Marching Cubes Mesh",(function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,o,c,f,p,h;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=l(e),a=d(r),o=a.dX,c=a.dY,f=a.dZ,p=Math.min(262144,Math.max(o*c*f/32,1024)),h=function(e,t){var r=Math.min(65536,4*e),n=s.a.create(Float32Array,3,e,t&&t.vertexBuffer.ref.value),i=s.a.create(Float32Array,3,e,t&&t.normalBuffer.ref.value),a=s.a.create(Float32Array,1,e,t&&t.groupBuffer.ref.value),o=s.a.create(Uint32Array,3,r,t&&t.indexBuffer.ref.value),c=0,l=0;return{addVertex:function(e,t,r){return++c,s.a.add3(n,e,t,r)},addNormal:function(e,t,r){s.a.add3(i,e,t,r)},addGroup:function(e){s.a.add(a,e)},addTriangle:function(e,t,r,n){var i=e[t],a=e[r],u=e[n];i>=0&&a>=0&&u>=0&&(++l,s.a.add3(o,i,a,u))},get:function(){var e=s.a.compact(n,!0),r=s.a.compact(i,!0),d=s.a.compact(o,!0),f=s.a.compact(a,!0);return u.a.create(e,d,r,f,c,l,t)}}}(p,t),[4,new m(i,h,r).run()];case 1:return n.sent(),[2,h.get()]}}))}))}))}function p(e,t){var r=this;return i.b.create("Marching Cubes Lines",(function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,u,f,p,h,g,v;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=l(e),u=d(r),f=u.dX,p=u.dY,h=u.dZ,g=Math.min(262144,Math.max(f*p*h/32,1024)),v=function(e,t){var r=s.a.create(Float32Array,3,e),n=s.a.create(Float32Array,1,e),i=s.a.create(Float32Array,2,e),u=0;return{addVertex:function(e,t,n){return s.a.add3(r,e,t,n)},addNormal:function(){return o.j},addGroup:function(e){s.a.add(n,e)},addTriangle:function(e,t,r,n,o){var c=e[t],l=e[r],d=e[n];c>=0&&l>=0&&d>=0&&(a.a[t][r]&o&&(++u,s.a.add2(i,e[t],e[r])),a.a[r][n]&o&&(++u,s.a.add2(i,e[r],e[n])),a.a[t][n]&o&&(++u,s.a.add2(i,e[t],e[n])))},get:function(){for(var e=s.a.compact(r,!0),a=s.a.compact(i,!0),o=s.a.compact(n,!0),l=c.a.create(u,u/10,t),d=0;d<u;++d){var f=a[2*d],p=a[2*d+1];l.add(e[3*f],e[3*f+1],e[3*f+2],e[3*p],e[3*p+1],e[3*p+2],o[f])}return l.getLines()}}}(g,t),[4,new m(i,v,r).run()];case 1:return n.sent(),[2,v.get()]}}))}))}))}var m=function(){function e(e,t,r){this.ctx=e,this.minX=0,this.minY=0,this.minZ=0,this.maxX=0,this.maxY=0,this.maxZ=0,this.state=new h(t,r),this.minX=r.bottomLeft[0],this.minY=r.bottomLeft[1],this.minZ=r.bottomLeft[2],this.maxX=r.topRight[0]-1,this.maxY=r.topRight[1]-1,this.maxZ=r.topRight[2]-1,this.size=(this.maxX-this.minX)*(this.maxY-this.minY)*(this.maxZ-this.minZ),this.sliceSize=(this.maxX-this.minX)*(this.maxY-this.minY)}return e.prototype.doSlices=function(){return Object(n.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(n.__generator)(this,(function(r){switch(r.label){case 0:e=0,this.edgeFilter=15,t=this.minZ,r.label=1;case 1:return t<this.maxZ?(this.slice(t),e+=this.sliceSize,this.ctx.shouldUpdate?[4,this.ctx.update({message:"Computing surface...",current:e,max:this.size})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t++,this.edgeFilter&=-5,[3,1];case 4:return[2]}}))}))},e.prototype.slice=function(e){this.edgeFilter|=2;for(var t=this.minY;t<this.maxY;t++,this.edgeFilter&=-3){this.edgeFilter|=1;for(var r=this.minX;r<this.maxX;r++,this.edgeFilter&=-2)this.state.processCell(r,t,e,this.edgeFilter)}this.state.clearEdgeVertexIndexSlice(e)},e.prototype.run=function(){return Object(n.__awaiter)(this,void 0,void 0,(function(){return Object(n.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.doSlices()];case 1:return e.sent(),[2]}}))}))},e}(),h=function(){function e(e,t){this.builder=e,this.vertList=[0,0,0,0,0,0,0,0,0,0,0,0],this.i=0,this.j=0,this.k=0;var r=t.scalarField.space.dimensions;this.nX=r[0],this.nY=r[1],this.nZ=r[2],this.isoLevel=t.isoLevel,this.scalarFieldGet=t.scalarField.space.get,this.scalarField=t.scalarField.data,t.idField&&(this.idField=t.idField.data,this.idFieldGet=t.idField.space.get),this.verticesOnEdges=new Int32Array(3*this.nX*this.nY*2)}return e.prototype.get3dOffsetFromEdgeInfo=function(e){return this.nX*((this.k+e.k)%2*this.nY+this.j+e.j)+this.i+e.i},e.prototype.clearEdgeVertexIndexSlice=function(e){var t=e%2==0?0:3*this.nX*this.nY,r=e%2==0?3*this.nX*this.nY:this.verticesOnEdges.length;this.verticesOnEdges.fill(0,t,r)},e.prototype.interpolate=function(e){var t=a.c[e],r=3*this.get3dOffsetFromEdgeInfo(t)+t.e,n=this.verticesOnEdges[r];if(n>0)return n-1;var i=this.scalarField,o=this.scalarFieldGet,s=a.b[e],u=s.a,c=s.b,l=u.i+this.i,d=u.j+this.j,f=u.k+this.k,p=c.i+this.i,m=c.j+this.j,h=c.k+this.k,g=o(i,l,d,f),v=o(i,p,m,h),b=(this.isoLevel-g)/(g-v);if(this.idField){var y=this.idFieldGet(this.idField,l,d,f),_=this.idFieldGet(this.idField,p,m,h),S=b<.5?y:_;if(-1===S&&(S=b<.5?_:y),-2===S)return-1;this.builder.addGroup(S)}else this.builder.addGroup(0);var x=this.builder.addVertex(l+b*(l-p),d+b*(d-m),f+b*(f-h));this.verticesOnEdges[r]=x+1;var O=o(i,Math.max(0,l-1),d,f)-o(i,Math.min(this.nX-1,l+1),d,f),w=o(i,l,Math.max(0,d-1),f)-o(i,l,Math.min(this.nY-1,d+1),f),C=o(i,l,d,Math.max(0,f-1))-o(i,l,d,Math.min(this.nZ,f+1)),j=O+b*(O-(o(i,Math.max(0,p-1),m,h)-o(i,Math.min(this.nX-1,p+1),m,h))),P=w+b*(w-(o(i,p,Math.max(0,m-1),h)-o(i,p,Math.min(this.nY-1,m+1),h))),E=C+b*(C-(o(i,p,m,Math.max(0,h-1))-o(i,p,m,Math.min(this.nZ-1,h+1))));return this.isoLevel>=0?this.builder.addNormal(j,P,E):this.builder.addNormal(-j,-P,-E),x},e.prototype.get=function(e,t,r){return this.scalarFieldGet(this.scalarField,e,t,r)},e.prototype.processCell=function(e,t,r,n){var i=0;if(this.get(e,t,r)<this.isoLevel&&(i|=1),this.get(e+1,t,r)<this.isoLevel&&(i|=2),this.get(e+1,t+1,r)<this.isoLevel&&(i|=4),this.get(e,t+1,r)<this.isoLevel&&(i|=8),this.get(e,t,r+1)<this.isoLevel&&(i|=16),this.get(e+1,t,r+1)<this.isoLevel&&(i|=32),this.get(e+1,t+1,r+1)<this.isoLevel&&(i|=64),this.get(e,t+1,r+1)<this.isoLevel&&(i|=128),0!==i&&255!==i){this.i=e,this.j=t,this.k=r;var o=a.d[i];(1&o)>0&&(this.vertList[0]=this.interpolate(0)),(2&o)>0&&(this.vertList[1]=this.interpolate(1)),(4&o)>0&&(this.vertList[2]=this.interpolate(2)),(8&o)>0&&(this.vertList[3]=this.interpolate(3)),(16&o)>0&&(this.vertList[4]=this.interpolate(4)),(32&o)>0&&(this.vertList[5]=this.interpolate(5)),(64&o)>0&&(this.vertList[6]=this.interpolate(6)),(128&o)>0&&(this.vertList[7]=this.interpolate(7)),(256&o)>0&&(this.vertList[8]=this.interpolate(8)),(512&o)>0&&(this.vertList[9]=this.interpolate(9)),(1024&o)>0&&(this.vertList[10]=this.interpolate(10)),(2048&o)>0&&(this.vertList[11]=this.interpolate(11));for(var s=a.e[i],u=0;u<s.length;u+=3){var c=s[u],l=s[u+1],d=s[u+2];this.isoLevel>=0?this.builder.addTriangle(this.vertList,c,l,d,n):this.builder.addTriangle(this.vertList,d,l,c,n)}}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(59),a=r(63),o=r(157),s=r(74),u={U:i.a.atom_site_anisotrop.U,U_esd:i.a.atom_site_anisotrop.U_esd};!function(e){e.Schema=u,e.Descriptor={name:"atom_site_anisotrop",cifExport:{prefix:"",categories:[{name:"atom_site_anisotrop",instance:function(t){return e.Provider.get(t.firstModel)&&s.a.is(t.firstModel.sourceData)?a.a.Category.ofTable(t.firstModel.sourceData.data.db.atom_site_anisotrop):a.a.Category.Empty}}]}},e.Provider=o.a.create(e.Descriptor),e.getElementToAnsiotrop=function(e,t){var r=new Int32Array(e.rowCount);r.fill(-1);for(var n=0,i=e.rowCount;n<i;n++)r[e.value(n)]=n;var a=new Int32Array(e.rowCount);for(a.fill(-1),n=0,i=t.rowCount;n<i;++n){var o=r[t.value(n)];-1!==o&&(a[o]=n)}return a},e.getElementToAnsiotropFromLabel=function(e,t){for(var r={},n=0,i=e.rowCount;n<i;n++)r[e.value(n)]=n;var a=new Int32Array(e.rowCount);for(a.fill(-1),n=0,i=t.rowCount;n<i;++n){var o=r[t.value(n)];void 0!==o&&(a[o]=n)}return a}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(6),a=r(63),o=r(315),s=r(157);!function(e){function t(e,t){for(var r=e.units,n=0,a=r.length;n<a;n++)if(i.SortedArray.indexOf(r[n].elements,t)>=0)return!0;return!1}e.Descriptor={name:"struct_conn",cifExport:{prefix:"",categories:[{name:"struct_conn",instance:function(r){var n=e.Provider.get(r.firstModel);if(!n||0===n.entries.length)return a.a.Category.Empty;for(var i=r.structures[0],o=[],s=0,u=n.entries;s<u.length;s++){var c=u[s];t(i,c.partnerA.atomIndex)&&t(i,c.partnerB.atomIndex)&&(o[o.length]=c.rowIndex)}return a.a.Category.ofTable(n.data,o)}}]}},e.Provider=s.a.create(e.Descriptor),e.isExhaustive=function(t){var r=e.Provider.get(t);return!!r&&r.data.id.rowCount/t.atomicConformation.atomId.rowCount>.95},e.getAtomIndexFromEntries=function(e){for(var t=new Map,r=0,n=e;r<n.length;r++){var i=n[r],a=i.partnerA.atomIndex,o=i.partnerB.atomIndex;t.has(a)?t.get(a).push(i):t.set(a,[i]),t.has(o)?t.get(o).push(i):t.set(o,[i])}return t},e.getEntriesFromStructConn=function(e,t){for(var r=e.conn_type_id,n=e.pdbx_dist_value,i=e.pdbx_value_order,a={label_asym_id:e.ptnr1_label_asym_id,label_seq_id:e.ptnr1_label_seq_id,auth_seq_id:e.ptnr1_auth_seq_id,label_atom_id:e.ptnr1_label_atom_id,label_alt_id:e.pdbx_ptnr1_label_alt_id,ins_code:e.pdbx_ptnr1_PDB_ins_code,symmetry:e.ptnr1_symmetry},s={label_asym_id:e.ptnr2_label_asym_id,label_seq_id:e.ptnr2_label_seq_id,auth_seq_id:e.ptnr2_auth_seq_id,label_atom_id:e.ptnr2_label_atom_id,label_alt_id:e.pdbx_ptnr2_label_alt_id,ins_code:e.pdbx_ptnr2_PDB_ins_code,symmetry:e.ptnr2_symmetry},u=function(e,r){if(0===r.label_asym_id.valueKind(e)){var n=r.label_asym_id.value(e),i=t.atomicHierarchy.index.findEntity(n);if(!(i<0)){var a=t.atomicHierarchy.index.findResidue(t.entities.data.id.value(i),n,r.auth_seq_id.value(e),r.ins_code.value(e));if(!(a<0)){var o=r.label_atom_id.value(e);if(o){var s=t.atomicHierarchy.index.findAtomOnResidue(a,o,r.label_alt_id.value(e));if(!(s<0))return{residueIndex:a,atomIndex:s,symmetry:r.symmetry.value(e)}}}}}},c=[],l=0;l<e._rowCount;l++){var d=u(l,a),f=u(l,s);if(void 0!==d&&void 0!==f){var p=r.value(l),m=0,h=1;switch((i.value(l)||"").toLowerCase()){case"sing":h=1;break;case"doub":h=2;break;case"trip":h=3;break;case"quad":h=4;break;default:h=Object(o.a)(e.ptnr1_label_comp_id.value(l),e.ptnr1_label_atom_id.value(l),e.ptnr2_label_comp_id.value(l),e.ptnr2_label_atom_id.value(l))}switch(p){case"covale":m=1;break;case"disulf":m=9;break;case"hydrog":m=4;break;case"metalc":m=2}c.push({rowIndex:l,flags:m,order:h,distance:n.value(l),partnerA:d,partnerB:f})}}return c}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return g})),r.d(t,"a",(function(){return A}));var n=r(0),i=r(2),a=r(30),o=r(4),s=r(13),u=r(89),c=r(78),l=r(327),d=r(167),f=r(241),p=r(257),m=r(133),h=r(219);function g(e){return e}!function(e){e.CommonParams={ignoreHydrogens:i.ParamDefinition.Optional(i.ParamDefinition.Boolean(!1)),quality:i.ParamDefinition.Optional(i.ParamDefinition.Select("auto",a.b)),theme:i.ParamDefinition.Optional(i.ParamDefinition.Group({globalName:i.ParamDefinition.Optional(i.ParamDefinition.Text("")),carbonColor:i.ParamDefinition.Optional(i.ParamDefinition.Select("chain-id",i.ParamDefinition.arrayToOptions(["chain-id","operator-name","element-symbol"]))),symmetryColor:i.ParamDefinition.Optional(i.ParamDefinition.Text("")),focus:i.ParamDefinition.Optional(i.ParamDefinition.Group({name:i.ParamDefinition.Optional(i.ParamDefinition.Text("")),params:i.ParamDefinition.Optional(i.ParamDefinition.Value({}))}))}))},e.reprBuilder=function(e,t,r){var n,i,a,o,s,u,c=e.state.data.build(),l=e.builders.structure.representation,d={quality:e.managers.structure.component.state.options.visualQuality,ignoreHydrogens:!e.managers.structure.component.state.options.showHydrogens};t.quality&&"auto"!==t.quality&&(d.quality=t.quality),void 0!==t.ignoreHydrogens&&(d.ignoreHydrogens=!!t.ignoreHydrogens);var m,h=(null===(n=t.theme)||void 0===n?void 0:n.globalName)?null===(i=t.theme)||void 0===i?void 0:i.globalName:void 0,g=void 0!==(null===(a=t.theme)||void 0===a?void 0:a.carbonColor)?{carbonColor:(m=null===(o=t.theme)||void 0===o?void 0:o.carbonColor,"chain-id"===m?{name:m,params:f.c.defaultValues}:"operator-name"===m?{name:m,params:p.c.defaultValues}:{name:m,params:{}})}:{};return{update:c,builder:l,color:h,symmetryColor:r&&(null===(s=t.theme)||void 0===s?void 0:s.symmetryColor)&&function(e){return e.units.some((function(e){return!e.conformation.operator.assembly&&e.conformation.operator.spgrOp>=0}))}(r)?null===(u=t.theme)||void 0===u?void 0:u.symmetryColor:h,typeParams:d,ballAndStickColor:g}},e.updateFocusRepr=function(e,t,r,n){return e.state.updateBehavior(l.StructureFocusRepresentation,(function(i){var a=Object(d.createStructureColorThemeParams)(e,t,"ball-and-stick",r||"element-symbol",n);i.surroundingsParams.colorTheme=a,i.targetParams.colorTheme=a}))}}(g||(g={}));var v=g.CommonParams,b=g.reprBuilder,y=g.updateFocusRepr,_=g({id:"preset-structure-representation-auto",display:{name:"Automatic",description:"Show representations based on the size of the structure. Smaller structures are shown with more detail than larger ones, ranging from atomistic display to coarse surfaces."},params:function(){return v},apply:function(e,t,r){var i,a,u=null===(a=null===(i=s.StateObjectRef.resolveAndCheck(r.state.data,e))||void 0===i?void 0:i.obj)||void 0===a?void 0:a.data;if(!u)return{};var l=r.config.get(c.PluginConfig.Structure.SizeThresholds)||o.Structure.DefaultSizeThresholds;switch(o.Structure.getSize(u,l)){case o.Structure.Size.Gigantic:case o.Structure.Size.Huge:return w.apply(e,t,r);case o.Structure.Size.Large:return C.apply(e,t,r);case o.Structure.Size.Medium:return x.apply(e,t,r);case o.Structure.Size.Small:return j.apply(e,Object(n.__assign)(Object(n.__assign)({},t),{showCarbohydrateSymbol:!0}),r)}}}),S=g({id:"preset-structure-representation-empty",display:{name:"Empty",description:"Removes all existing representations."},apply:function(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){return Object(n.__generator)(this,(function(e){return[2,{}]}))}))}}),x=g({id:"preset-structure-representation-polymer-and-ligand",display:{name:"Polymer & Ligand",group:"Basic",description:"Shows polymers as Cartoon, ligands as Ball & Stick, carbohydrates as 3D-SNFG and water molecules semi-transparent."},params:function(){return v},apply:function(e,t,r){var i,a,o,u,c,l,d,f,p,m;return Object(n.__awaiter)(this,void 0,void 0,(function(){var h,g,v,_,S,x,O,w,C,j,E,A,D,T,I;return Object(n.__generator)(this,(function(M){switch(M.label){case 0:return(h=s.StateObjectRef.resolveAndCheck(r.state.data,e))?(I={},[4,P(r,h,"polymer")]):[2,{}];case 1:return I.polymer=M.sent(),[4,P(r,h,"ligand")];case 2:return I.ligand=M.sent(),[4,P(r,h,"non-standard")];case 3:return I.nonStandard=M.sent(),[4,P(r,h,"branched",{label:"Carbohydrate"})];case 4:return I.branched=M.sent(),[4,P(r,h,"water")];case 5:return I.water=M.sent(),[4,P(r,h,"ion")];case 6:return I.ion=M.sent(),[4,P(r,h,"lipid")];case 7:return I.lipid=M.sent(),[4,P(r,h,"coarse")];case 8:return I.coarse=M.sent(),g=I,v=h.obj.data,_={sizeFactor:v.isCoarseGrained?.8:.2},S=((null===(o=null===(a=null===(i=g.water)||void 0===i?void 0:i.obj)||void 0===a?void 0:a.data)||void 0===o?void 0:o.elementCount)||0)>5e4?"line":"ball-and-stick",x=((null===(l=null===(c=null===(u=g.lipid)||void 0===u?void 0:u.obj)||void 0===c?void 0:c.data)||void 0===l?void 0:l.elementCount)||0)>2e4?"line":"ball-and-stick",O=b(r,t,v),w=O.update,C=O.builder,j=O.typeParams,E=O.color,A=O.symmetryColor,D=O.ballAndStickColor,T={polymer:C.buildRepresentation(w,g.polymer,{type:"cartoon",typeParams:Object(n.__assign)(Object(n.__assign)({},j),_),color:A},{tag:"polymer"}),ligand:C.buildRepresentation(w,g.ligand,{type:"ball-and-stick",typeParams:j,color:E,colorParams:D},{tag:"ligand"}),nonStandard:C.buildRepresentation(w,g.nonStandard,{type:"ball-and-stick",typeParams:j,color:E,colorParams:D},{tag:"non-standard"}),branchedBallAndStick:C.buildRepresentation(w,g.branched,{type:"ball-and-stick",typeParams:Object(n.__assign)(Object(n.__assign)({},j),{alpha:.3}),color:E,colorParams:D},{tag:"branched-ball-and-stick"}),branchedSnfg3d:C.buildRepresentation(w,g.branched,{type:"carbohydrate",typeParams:j,color:E},{tag:"branched-snfg-3d"}),water:C.buildRepresentation(w,g.water,{type:S,typeParams:Object(n.__assign)(Object(n.__assign)({},j),{alpha:.6}),color:E,colorParams:{carbonColor:{name:"element-symbol",params:{}}}},{tag:"water"}),ion:C.buildRepresentation(w,g.ion,{type:"ball-and-stick",typeParams:j,color:E,colorParams:{carbonColor:{name:"element-symbol",params:{}}}},{tag:"ion"}),lipid:C.buildRepresentation(w,g.lipid,{type:x,typeParams:Object(n.__assign)(Object(n.__assign)({},j),{alpha:.6}),color:E,colorParams:{carbonColor:{name:"element-symbol",params:{}}}},{tag:"lipid"}),coarse:C.buildRepresentation(w,g.coarse,{type:"spacefill",typeParams:j,color:E||"chain-id"},{tag:"coarse"})},[4,w.commit({revertOnError:!1})];case 9:return M.sent(),[4,y(r,v,null===(f=null===(d=t.theme)||void 0===d?void 0:d.focus)||void 0===f?void 0:f.name,null===(m=null===(p=t.theme)||void 0===p?void 0:p.focus)||void 0===m?void 0:m.params)];case 10:return M.sent(),[2,{components:g,representations:T}]}}))}))}}),O=g({id:"preset-structure-representation-protein-and-nucleic",display:{name:"Protein & Nucleic",group:"Basic",description:"Shows proteins as Cartoon and RNA/DNA as Gaussian Surface."},params:function(){return v},apply:function(e,t,r){var i,a,o,u;return Object(n.__awaiter)(this,void 0,void 0,(function(){var c,l,d,f,p,m,h,g,v,_,S,x;return Object(n.__generator)(this,(function(O){switch(O.label){case 0:return(c=s.StateObjectRef.resolveAndCheck(r.state.data,e))?(x={},[4,E(r,c,"protein")]):[2,{}];case 1:return x.protein=O.sent(),[4,E(r,c,"nucleic")];case 2:return x.nucleic=O.sent(),l=x,d=c.obj.data,f={sizeFactor:d.isCoarseGrained?.8:.2},p={radiusOffset:d.isCoarseGrained?2:0,smoothness:d.isCoarseGrained?1:1.5},m=b(r,t,d),h=m.update,g=m.builder,v=m.typeParams,_=m.symmetryColor,S={protein:g.buildRepresentation(h,l.protein,{type:"cartoon",typeParams:Object(n.__assign)(Object(n.__assign)({},v),f),color:_},{tag:"protein"}),nucleic:g.buildRepresentation(h,l.nucleic,{type:"gaussian-surface",typeParams:Object(n.__assign)(Object(n.__assign)({},v),p),color:_},{tag:"nucleic"})},[4,h.commit({revertOnError:!0})];case 3:return O.sent(),[4,y(r,d,null===(a=null===(i=t.theme)||void 0===i?void 0:i.focus)||void 0===a?void 0:a.name,null===(u=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===u?void 0:u.params)];case 4:return O.sent(),[2,{components:l,representations:S}]}}))}))}}),w=g({id:"preset-structure-representation-coarse-surface",display:{name:"Coarse Surface",group:"Basic",description:"Shows polymers as coarse Gaussian Surface."},params:function(){return v},apply:function(e,t,r){var i,a,u,c;return Object(n.__awaiter)(this,void 0,void 0,(function(){var l,d,f,p,m,h,g,v,_,S,x,O;return Object(n.__generator)(this,(function(w){switch(w.label){case 0:return(l=s.StateObjectRef.resolveAndCheck(r.state.data,e))?(O={},[4,P(r,l,"polymer")]):[2,{}];case 1:return O.polymer=w.sent(),d=O,f=l.obj.data,p=o.Structure.getSize(f),m=Object.create(null),p===o.Structure.Size.Gigantic?Object.assign(m,{traceOnly:!0,radiusOffset:2,smoothness:1,visuals:["structure-gaussian-surface-mesh"]}):p===o.Structure.Size.Huge?Object.assign(m,{radiusOffset:f.isCoarseGrained?2:0,smoothness:1}):f.isCoarseGrained&&Object.assign(m,{radiusOffset:2,smoothness:1}),h=b(r,t,f),g=h.update,v=h.builder,_=h.typeParams,S=h.symmetryColor,x={polymer:v.buildRepresentation(g,d.polymer,{type:"gaussian-surface",typeParams:Object(n.__assign)(Object(n.__assign)({},_),m),color:S},{tag:"polymer"})},[4,g.commit({revertOnError:!0})];case 2:return w.sent(),[4,y(r,f,null===(a=null===(i=t.theme)||void 0===i?void 0:i.focus)||void 0===a?void 0:a.name,null===(c=null===(u=t.theme)||void 0===u?void 0:u.focus)||void 0===c?void 0:c.params)];case 3:return w.sent(),[2,{components:d,representations:x}]}}))}))}}),C=g({id:"preset-structure-representation-polymer-cartoon",display:{name:"Polymer Cartoon",group:"Basic",description:"Shows polymers as Cartoon."},params:function(){return v},apply:function(e,t,r){var i,a,o,u;return Object(n.__awaiter)(this,void 0,void 0,(function(){var c,l,d,f,p,m,h,g,v,_,S;return Object(n.__generator)(this,(function(x){switch(x.label){case 0:return(c=s.StateObjectRef.resolveAndCheck(r.state.data,e))?(S={},[4,P(r,c,"polymer")]):[2,{}];case 1:return S.polymer=x.sent(),l=S,d=c.obj.data,f={sizeFactor:d.isCoarseGrained?.8:.2},p=b(r,t,d),m=p.update,h=p.builder,g=p.typeParams,v=p.symmetryColor,_={polymer:h.buildRepresentation(m,l.polymer,{type:"cartoon",typeParams:Object(n.__assign)(Object(n.__assign)({},g),f),color:v},{tag:"polymer"})},[4,m.commit({revertOnError:!0})];case 2:return x.sent(),[4,y(r,d,null===(a=null===(i=t.theme)||void 0===i?void 0:i.focus)||void 0===a?void 0:a.name,null===(u=null===(o=t.theme)||void 0===o?void 0:o.focus)||void 0===u?void 0:u.params)];case 3:return x.sent(),[2,{components:l,representations:_}]}}))}))}}),j=g({id:"preset-structure-representation-atomic-detail",display:{name:"Atomic Detail",group:"Basic",description:"Shows everything in atomic detail with Ball & Stick."},params:function(){return Object(n.__assign)(Object(n.__assign)({},v),{showCarbohydrateSymbol:i.ParamDefinition.Boolean(!1)})},apply:function(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,o,u,c,l,d,f,p,g,v,y,_,S,x,O,w,C,j,E,A,D;return Object(n.__generator)(this,(function(T){switch(T.label){case 0:return(i=s.StateObjectRef.resolveAndCheck(r.state.data,e))?(A={},[4,P(r,i,"all")]):[2,{}];case 1:return A.all=T.sent(),A.branched=void 0,a=A,o=i.obj.data,u=o.elementCount>1e5,c=o.atomicResidueCount&&o.elementCount>1e3&&o.atomicResidueCount/o.elementCount<3,l=o.models[0],d=!!m.a.Provider.get(l)||h.a.isExhaustive(l),f=c&&!d?"spacefill":u?"line":"ball-and-stick",(p=t.showCarbohydrateSymbol&&!u&&!c)?(v=(g=Object).assign,y=[a],D={},[4,P(r,i,"branched",{label:"Carbohydrate"})]):[3,3];case 2:v.apply(g,y.concat([(D.branched=T.sent(),D)])),T.label=3;case 3:return _=b(r,t,o),S=_.update,x=_.builder,O=_.typeParams,w=_.color,C=_.ballAndStickColor,j=c&&!d?{carbonColor:{name:"element-symbol",params:{}}}:C,E={all:x.buildRepresentation(S,a.all,{type:f,typeParams:O,color:w,colorParams:j},{tag:"all"})},p&&Object.assign(E,{snfg3d:x.buildRepresentation(S,a.branched,{type:"carbohydrate",typeParams:Object(n.__assign)(Object(n.__assign)({},O),{alpha:.4,visuals:["carbohydrate-symbol"]}),color:w},{tag:"snfg-3d"})}),[4,S.commit({revertOnError:!0})];case 4:return T.sent(),[2,{components:a,representations:E}]}}))}))}});function P(e,t,r,n){return e.builders.structure.tryCreateComponentStatic(t,r,n)}function E(e,t,r,n){return e.builders.structure.tryCreateComponentFromSelection(t,u.b[r],"selection-"+r,n)}var A={empty:S,auto:_,"atomic-detail":j,"polymer-cartoon":C,"polymer-and-ligand":x,"protein-and-nucleic":O,"coarse-surface":w}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return x}));var n,i=r(0),a=r(7),o=r(152),s=r(366),u=r(63),c=r(4),l=r(263),d=r(19),f=r(16),p=r(169),m=r(2),h=r(29),g=r(74),v=r(248),b=r(316),y=r(119),_=r(66);!function(e){function t(e,t){return t+"/"+e.toLowerCase()}function r(e,t){return{info:v.PropertyWrapper.createInfo(),data:function(e,t){var r=new Map;if(!t.molecules)return;for(var n=[],i=0,a=t.molecules;i<a.length;i++)for(var o=a[i],s=o.entity_id.toString(),u=0,l=o.chains;u<l.length;u++)for(var d=l[u],f=d.struct_asym_id.toString(),p=0,m=d.models;p<m.length;p++){var g=m[p];if(+g.model_id.toString()===e.modelNum)for(var v=0,b=g.residues;v<b.length;v++){var y=b[v],_=y.author_residue_number,S=y.author_insertion_code||"",x=e.atomicHierarchy.index.findResidue(s,f,_,S);r.set(x,y.outlier_types);for(var O=0,w=y.outlier_types;O<w.length;O++){var C=w[O];Object(h.arraySetAdd)(n,C)}}}return{issues:c.IndexedCustomProperty.fromResidueMap(r),issueTypes:n}}(e,t)}}function n(e,n,a){return Object(i.__awaiter)(this,void 0,void 0,(function(){var o,s,u;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return o=y.Asset.getUrlAsset(e.assetManager,t(n.entryId,a.serverUrl)),[4,e.assetManager.resolve(o,"json").runInContext(e.runtime)];case 1:if(s=i.sent(),!(u=s.data[n.entryId.toLowerCase()]))throw new Error("missing data");return[2,{value:r(n,u),assets:[s]}]}}))}))}function u(t,r,n){var i=v.PropertyWrapper.tryGetInfoFromCif("pdbe_structure_quality_report",r);if(i){var a=function(t){if(!g.a.is(t.sourceData))throw new Error("Data format must be mmCIF.");return{residues:Object(o.c)(e.Schema.pdbe_structure_quality_report_issues,t.sourceData.data.frame.categories.pdbe_structure_quality_report_issues),groups:Object(o.c)(e.Schema.pdbe_structure_quality_report_issue_types,t.sourceData.data.frame.categories.pdbe_structure_quality_report_issue_types)}}(r);return{info:i,data:function(e,t,r){for(var n=new Map,i=t.label_entity_id,a=t.label_asym_id,o=t.auth_seq_id,s=t.pdbx_PDB_ins_code,u=t.issue_type_group_id,l=t.pdbx_PDB_model_num,d=t._rowCount,f=function(e){for(var t=new Map,r=e.group_id,n=e.issue_type,i=0;i<e._rowCount;i++){var a=void 0,o=r.value(i);t.has(o)?a=t.get(o):(a=[],t.set(o,a)),a.push(n.value(i))}return t}(r),p=0;p<d;p++)if(l.value(p)===e.modelNum){var m=e.atomicHierarchy.index.findResidue(i.value(p),a.value(p),o.value(p),s.value(p));n.set(m,f.get(u.value(p)))}var g=[];return f.forEach((function(e){for(var t=0,r=e;t<r.length;t++){var n=r[t];Object(h.arraySetAdd)(g,n)}})),{issues:c.IndexedCustomProperty.fromResidueMap(n),issueTypes:g}}(r,a.residues,a.groups)}}}e.DefaultServerUrl="https://www.ebi.ac.uk/pdbe/api/validation/residuewise_outlier_summary/entry/",e.getEntryUrl=t,e.isApplicable=function(e){return!!e&&c.Model.isFromPdbArchive(e)},e.Schema={pdbe_structure_quality_report:{updated_datetime_utc:a.a.Schema.str},pdbe_structure_quality_report_issues:Object(i.__assign)(Object(i.__assign)({id:a.a.Schema.int},s.b),{pdbx_PDB_model_num:a.a.Schema.int,issue_type_group_id:a.a.Schema.int}),pdbe_structure_quality_report_issue_types:{group_id:a.a.Schema.int,issue_type:a.a.Schema.str}},e.fromJson=r,e.fromServer=n,e.fromCif=u,e.fromCifOrServer=function(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var a;return Object(i.__generator)(this,(function(i){return[2,(a=u(0,t))?{value:a}:n(e,t,r)]}))}))};var l=[];e.getIssues=function(e){if(!c.Unit.isAtomic(e.unit))return l;var t=x.get(e.unit.model).value;if(!t||!t.data)return l;var r=e.unit.residueIndex[e.element];return t.data.issues.has(r)?t.data.issues.get(r):l},e.getIssueTypes=function(e){if(!e)return l;var t=x.get(e.models[0]).value;return t&&t.data?t.data.issueTypes:l}}(n||(n={}));var S={serverUrl:m.ParamDefinition.Text(n.DefaultServerUrl,{description:"JSON API Server URL"})},x=b.CustomModelProperty.createProvider({label:"Structure Quality Report",descriptor:Object(_.CustomPropertyDescriptor)({name:"pdbe_structure_quality_report",cifExport:{prefix:"pdbe",context:function(e){return function(e){for(var t=new Map,r=[],i=[],o=[],s=v.PropertyWrapper.createInfo(),u=0,c=e.structures;u<c.length;u++){var l=c[u],d=x.get(l.model).value;if(d&&(s=d.info),d&&d.data){var f=d.data.issues.getElements(l),p=f.elements,m=f.property;if(0!==p.length){for(var h=[],g=0;g<p.length;g++){var b=m(g),y=b.join(",");if(!t.has(y)){var _=t.size+1;t.set(y,_);for(var S=0,O=b;S<O.length;S++){var w=O[S];i.push(_),o.push(w)}}h[g]=t.get(y)}r.push({elements:p,groupId:h})}}}return{info:s,models:r,issueTypes:a.d.ofArrays(n.Schema.pdbe_structure_quality_report_issue_types,{group_id:i,issue_type:o})}}(e)},categories:[v.PropertyWrapper.defaultInfoCategory("pdbe_structure_quality_report",(function(e){return e.info})),{name:"pdbe_structure_quality_report_issues",instance:function(e){return{fields:O,source:e.models.map((function(e){return{data:e,rowCount:e.elements.length}}))}}},{name:"pdbe_structure_quality_report_issue_types",instance:function(e){return u.a.Category.ofTable(e.issueTypes)}}]},symbols:{issueCount:p.QuerySymbolRuntime.Dynamic(Object(d.c)("pdbe","structure-quality.issue-count",f.a.Num),(function(e){return n.getIssues(e.element).length}))}}),type:"static",defaultParams:S,getParams:function(e){return S},isApplicable:function(e){return n.isApplicable(e)},obtain:function(e,t,r){return Object(i.__awaiter)(void 0,void 0,void 0,(function(){var a;return Object(i.__generator)(this,(function(o){switch(o.label){case 0:return a=Object(i.__assign)(Object(i.__assign)({},m.ParamDefinition.getDefaultValues(S)),r),[4,n.fromCifOrServer(e,t,a)];case 1:return[2,o.sent()]}}))}))}}),O=u.a.fields().index("id").many(Object(l.b)((function(e,t){return t.elements[e]}),{includeModelNum:!0})).int("issue_type_group_id",(function(e,t){return t.groupId[e]})).getFields()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(){return Error.call(this),this.message="argument out of range",this.name="ArgumentOutOfRangeError",this}return e.prototype=Object.create(Error.prototype),e}()},function(e,t,r){"use strict";function n(e){return"function"==typeof e}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.r(t),r.d(t,"registerDefault",(function(){return p})),r.d(t,"SyncBehaviors",(function(){return m})),r.d(t,"SetCurrentObject",(function(){return h})),r.d(t,"Update",(function(){return g})),r.d(t,"ApplyAction",(function(){return v})),r.d(t,"RemoveObject",(function(){return b})),r.d(t,"ToggleExpanded",(function(){return y})),r.d(t,"ToggleVisibility",(function(){return _})),r.d(t,"setSubtreeVisibility",(function(){return S})),r.d(t,"Highlight",(function(){return O})),r.d(t,"ClearHighlights",(function(){return w})),r.d(t,"Snapshots",(function(){return C}));var n=r(0),i=r(4),a=r(372),o=r(8),s=r(13),u=r(337),c=r(373),l=r(267),d=r(27),f=r(78);function p(e){m(e),h(e),g(e),v(e),b(e),y(e),_(e),O(e),w(e),C(e)}function m(e){e.state.events.object.created.subscribe((function(e){o.a.isBehavior(e.obj)&&e.obj.data.register(e.ref)})),e.state.events.object.removed.subscribe((function(e){o.a.isBehavior(e.obj)&&e.obj.data.unregister()})),e.state.events.object.updated.subscribe((function(e){"recreate"===e.action&&(e.oldObj&&o.a.isBehavior(e.oldObj)&&e.oldObj.data.unregister(),e.obj&&o.a.isBehavior(e.obj)&&e.obj.data.register(e.ref))}))}function h(e){d.PluginCommands.State.SetCurrentObject.subscribe(e,(function(e){var t=e.state,r=e.ref;return t.setCurrent(r)}))}function g(e){d.PluginCommands.State.Update.subscribe(e,(function(t){var r=t.state,n=t.tree,i=t.options;return e.runTask(r.updateTree(n,i))}))}function v(e){d.PluginCommands.State.ApplyAction.subscribe(e,(function(t){var r=t.state,n=t.action,i=t.ref;return e.runTask(r.applyAction(n.action,n.params,i))}))}function b(e){function t(t,r){var n=t.build().delete(r);return e.runTask(t.updateTree(n))}d.PluginCommands.State.RemoveObject.subscribe(e,(function(e){var r=e.state,n=e.ref;if(!e.removeParentGhosts)return t(r,n);var i=r.tree,a=i.transforms.get(n);if(a.parent===n)return t(r,n);for(;;){var o=i.children.get(a.parent);if(a.parent===a.ref||o.size>1)return t(r,a.ref);var s=i.transforms.get(a.parent);if(!s.state.isGhost)return t(r,a.ref);a=s}}))}function y(e){d.PluginCommands.State.ToggleExpanded.subscribe(e,(function(e){var t=e.state,r=e.ref;return t.updateCellState(r,(function(e){return{isCollapsed:!e.isCollapsed}}))}))}function _(e){d.PluginCommands.State.ToggleVisibility.subscribe(e,(function(e){var t=e.state,r=e.ref;return S(t,r,!t.cells.get(r).state.isHidden)}))}function S(e,t,r){s.StateTree.doPreOrder(e.tree,e.transforms.get(t),{state:e,value:r},x)}function x(e,t,r){r.state.updateCellState(e.ref,{isHidden:r.value})}function O(e){d.PluginCommands.Interactivity.Object.Highlight.subscribe(e,(function(t){var r=t.state,n=t.ref;if(e.canvas3d&&!e.isBusy){e.managers.interactivity.lociHighlights.clearHighlights();for(var a=0,s="string"==typeof n?[n]:n;a<s.length;a++){var u=s[a],c=r.cells.get(u);if(c)if(o.a.Molecule.Structure.is(c.obj))e.managers.interactivity.lociHighlights.highlight({loci:i.Structure.Loci(c.obj.data)},!1);else if(c&&o.a.isRepresentation3D(c.obj)){var l=c.obj.data.repr;e.managers.interactivity.lociHighlights.highlight({loci:l.getLoci(),repr:l},!1)}else if(o.a.Molecule.Structure.Selections.is(c.obj))for(var d=0,f=c.obj.data;d<f.length;d++){var p=f[d];e.managers.interactivity.lociHighlights.highlight({loci:p.loci},!1)}}}}))}function w(e){d.PluginCommands.Interactivity.ClearHighlights.subscribe(e,(function(){e.managers.interactivity.lociHighlights.clearHighlights()}))}function C(e){var t=this;e.config.set(f.PluginConfig.State.CurrentServer,e.config.get(f.PluginConfig.State.DefaultServer)),d.PluginCommands.State.Snapshots.Clear.subscribe(e,(function(){e.managers.snapshot.clear()})),d.PluginCommands.State.Snapshots.Remove.subscribe(e,(function(t){var r=t.id;e.managers.snapshot.remove(r)})),d.PluginCommands.State.Snapshots.Add.subscribe(e,(function(t){var r=t.name,n=t.description,i=t.params,o=a.a.Entry(e.state.getSnapshot(i),{name:r,description:n});e.managers.snapshot.add(o)})),d.PluginCommands.State.Snapshots.Replace.subscribe(e,(function(t){var r=t.id,n=t.params;e.managers.snapshot.replace(r,e.state.getSnapshot(n))})),d.PluginCommands.State.Snapshots.Move.subscribe(e,(function(t){var r=t.id,n=t.dir;e.managers.snapshot.move(r,n)})),d.PluginCommands.State.Snapshots.Apply.subscribe(e,(function(t){var r=t.id,n=e.managers.snapshot.setCurrent(r);if(n)return e.state.setSnapshot(n)})),d.PluginCommands.State.Snapshots.Upload.subscribe(e,(function(t){var r=t.name,n=t.description,i=t.playOnLoad,a=t.serverUrl;t.params;return fetch(Object(l.a)(a,"set?name="+encodeURIComponent(r||"")+"&description="+encodeURIComponent(n||"")),{method:"POST",mode:"cors",referrer:"no-referrer",headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(e.managers.snapshot.getStateSnapshot({name:r,description:n,playOnLoad:i}))})})),d.PluginCommands.State.Snapshots.Fetch.subscribe(e,(function(r){var i=r.url;return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return[4,e.runTask(e.fetch({url:i,type:"json"}))];case 1:return t=r.sent(),[4,e.managers.snapshot.setStateSnapshot(t.data)];case 2:return r.sent(),[2]}}))}))})),d.PluginCommands.State.Snapshots.DownloadToFile.subscribe(e,(function(r){var i=r.name,a=r.type,o=r.params;return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return t="mol-star_state_"+(i||Object(u.b)())+"."+("json"===a?"molj":"molx"),[4,e.managers.snapshot.serialize({type:a,params:o})];case 1:return r=n.sent(),Object(c.a)(r,""+t),[2]}}))}))})),d.PluginCommands.State.Snapshots.OpenFile.subscribe(e,(function(t){var r=t.file;return e.managers.snapshot.open(r)})),d.PluginCommands.State.Snapshots.OpenUrl.subscribe(e,(function(r){var i=r.url,a=r.type;return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return[4,e.runTask(e.fetch({url:i,type:"binary"}))];case 1:return t=r.sent(),[2,e.managers.snapshot.open(new File([t],"state."+a))]}}))}))}))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(16),a=r(210),o=r(19),s=r(43);!function(e){e.ElementSymbol=i.a.Value("Structure","ElementSymbol"),e.AtomName=i.a.Value("Structure","AtomName"),e.BondFlag=i.a.OneOf("Structure","BondFlag",i.a.Str,["covalent","metallic","ion","hydrogen","sulfide","computed","aromatic"]),e.BondFlags=a.a.Flags(e.BondFlag,"BondFlags"),e.SecondaryStructureFlag=i.a.OneOf("Structure","SecondaryStructureFlag",i.a.Str,["alpha","beta","3-10","pi","sheet","strand","helix","turn","none"]),e.SecondaryStructureFlags=a.a.Flags(e.SecondaryStructureFlag,"SecondaryStructureFlag"),e.RingFingerprint=i.a.Value("Structure","RingFingerprint"),e.EntityType=i.a.OneOf("Structure","EntityType",i.a.Str,["polymer","non-polymer","water","branched"]),e.EntitySubtype=i.a.OneOf("Structure","EntitySubtype",i.a.Str,["other","polypeptide(D)","polypeptide(L)","polydeoxyribonucleotide","polyribonucleotide","polydeoxyribonucleotide/polyribonucleotide hybrid","cyclic-pseudo-peptide","peptide nucleic acid","oligosaccharide"]),e.ObjectPrimitive=i.a.OneOf("Structure","ObjectPrimitive",i.a.Str,["atomistic","sphere","gaussian","other"]),e.ResidueId=i.a.Value("Structure","ResidueId"),e.ElementSet=i.a.Value("Structure","ElementSet"),e.ElementSelection=i.a.Value("Structure","ElementSelection"),e.ElementReference=i.a.Value("Structure","ElementReference"),e.ElementSelectionQuery=a.a.Fn(e.ElementSelection,"ElementSelectionQuery")}(n||(n={}));var u={"@header":"Types",elementSymbol:Object(s.b)(o.b.Dictionary({0:Object(o.a)(i.a.Str)}),n.ElementSymbol,"Create element symbol representation from a string value."),atomName:Object(s.b)(o.b.Dictionary({0:Object(o.a)(i.a.AnyValue)}),n.AtomName,"Convert a value to an atom name."),entityType:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.EntityType)}),n.EntityType,"Create normalized representation of entity type: "+i.a.oneOfValues(n.EntityType).join(", ")+"."),bondFlags:Object(s.b)(o.b.List(n.BondFlag),n.BondFlags,"Create bond flags representation from a list of strings. Allowed flags: "+i.a.oneOfValues(n.BondFlag).join(", ")+"."),ringFingerprint:Object(s.b)(o.b.List(n.ElementSymbol,{nonEmpty:!0}),n.RingFingerprint,"Create ring fingerprint from the supplied atom element list."),secondaryStructureFlags:Object(s.b)(o.b.List(n.SecondaryStructureFlag),n.SecondaryStructureFlags,"Create secondary structure flags representation from a list of strings. Allowed flags: "+i.a.oneOfValues(n.SecondaryStructureFlag).join(", ")+"."),authResidueId:Object(s.b)(o.b.Dictionary({0:Object(o.a)(i.a.Str,{description:"auth_asym_id"}),1:Object(o.a)(i.a.Num,{description:"auth_seq_id"}),2:Object(o.a)(i.a.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),n.ResidueId,'Residue identifier based on "auth_" annotation.'),labelResidueId:Object(s.b)(o.b.Dictionary({0:Object(o.a)(i.a.Str,{description:"label_entity_id"}),1:Object(o.a)(i.a.Str,{description:"label_asym_id"}),2:Object(o.a)(i.a.Num,{description:"label_seq_id"}),3:Object(o.a)(i.a.Str,{description:"pdbx_PDB_ins_code",isOptional:!0})}),n.ResidueId,'Residue identifier based on mmCIF\'s "label_" annotation.')},c={"@header":"Iteration Slots",element:Object(s.b)(o.b.None,n.ElementReference,"A reference to the current element."),elementSetReduce:Object(s.b)(o.b.None,i.a.Variable("a",i.a.AnyValue,!0),"Current value of the element set reducer.")},l={"@header":"Generators",all:Object(s.b)(o.b.None,n.ElementSelectionQuery,"The entire structure."),atomGroups:Object(s.b)(o.b.Dictionary({"entity-test":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every entity"}),"chain-test":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom of every chain"}),"residue-test":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!0,description:"Test for the 1st atom every residue"}),"atom-test":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!0}),"group-by":Object(o.a)(i.a.Any,{isOptional:!0,defaultValue:"atom-key",description:"Group atoms to sets based on this property. Default: each atom has its own set"})}),n.ElementSelectionQuery,"Return all atoms for which the tests are satisfied, grouped into sets."),bondedAtomicPairs:Object(s.b)(o.b.Dictionary({0:Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:"true for covalent bonds",description:"Test each bond with this predicate. Each bond is visited twice with swapped atom order."})}),n.ElementSelectionQuery,"Return all pairs of atoms for which the test is satisfied."),rings:Object(s.b)(o.b.Dictionary({fingerprint:Object(o.a)(n.RingFingerprint,{isOptional:!0}),"only-aromatic":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!1})}),n.ElementSelectionQuery,"Return all rings or those with the specified fingerprint and/or only aromatic rings."),queryInSelection:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),query:Object(o.a)(n.ElementSelectionQuery),"in-complement":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!1})}),n.ElementSelectionQuery,"Executes query only on atoms that are in the source selection."),empty:Object(s.b)(o.b.None,n.ElementSelectionQuery,"Nada.")},d={"@header":"Selection Modifications",queryEach:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),query:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"Query every atom set in the input selection separately."),intersectBy:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),by:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"Intersect each atom set from the first sequence from atoms in the second one."),exceptBy:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),by:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"Remove all atoms from 'selection' that occur in 'by'."),unionBy:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),by:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"For each atom set A in the orginal sequence, combine all atoms sets in the target selection that intersect with A."),union:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"Collects all atom sets in the sequence into a single atom set."),cluster:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),"min-distance":Object(o.a)(i.a.Num,{isOptional:!0,defaultValue:0}),"max-distance":Object(o.a)(i.a.Num),"min-size":Object(o.a)(i.a.Num,{description:"Minimal number of sets to merge, must be at least 2",isOptional:!0,defaultValue:2}),"max-size":Object(o.a)(i.a.Num,{description:"Maximal number of sets to merge, if not set, no limit",isOptional:!0})}),n.ElementSelectionQuery,"Combines atom sets that have mutual distance in the interval [min-radius, max-radius]. Minimum/maximum size determines how many atom sets can be combined."),includeSurroundings:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),radius:Object(o.a)(i.a.Num),"atom-radius":Object(o.a)(i.a.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),"as-whole-residues":Object(o.a)(i.a.Bool,{isOptional:!0})}),n.ElementSelectionQuery,"For each atom set in the selection, include all surrouding atoms/residues that are within the specified radius."),includeConnected:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),"bond-test":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),"layer-count":Object(o.a)(i.a.Num,{isOptional:!0,defaultValue:1,description:"Number of bonded layers to include."}),"as-whole-residues":Object(o.a)(i.a.Bool,{isOptional:!0})}),n.ElementSelectionQuery,"Pick all atom sets that are connected to the target."),wholeResidues:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"Expand the selection to whole residues."),expandProperty:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),property:Object(o.a)(i.a.AnyValue)}),n.ElementSelectionQuery,"To each atom set in the selection, add all atoms that have the same property value that was already present in the set.")},f={"@header":"Selection Filters",pick:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),test:Object(o.a)(i.a.Bool)}),n.ElementSelectionQuery,"Pick all atom sets that satisfy the test."),first:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"Take the 1st atom set in the sequence."),withSameAtomProperties:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),source:Object(o.a)(n.ElementSelectionQuery),property:Object(o.a)(i.a.Any)}),n.ElementSelectionQuery,"Pick all atom sets for which the set of given atom properties is a subset of the source properties."),intersectedBy:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),by:Object(o.a)(n.ElementSelectionQuery)}),n.ElementSelectionQuery,"Pick all atom sets that have non-zero intersection with the target."),within:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),target:Object(o.a)(n.ElementSelectionQuery),"min-radius":Object(o.a)(i.a.Num,{isOptional:!0,defaultValue:0}),"max-radius":Object(o.a)(i.a.Num),"atom-radius":Object(o.a)(i.a.Num,{isOptional:!0,defaultValue:0,description:"Value added to each atom before the distance check, for example VDW radius. Using this argument is computationally demanding."}),invert:Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!1,description:"If true, pick only atom sets that are further than the specified radius."})}),n.ElementSelectionQuery,"Pick all atom sets from selection that have any atom within the radius of any atom from target."),isConnectedTo:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery),target:Object(o.a)(n.ElementSelectionQuery),"bond-test":Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:"true for covalent bonds"}),disjunct:Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!0,description:"If true, there must exist a bond to an atom that lies outside the given atom set to pass test."}),invert:Object(o.a)(i.a.Bool,{isOptional:!0,defaultValue:!1,description:"If true, return atom sets that are not connected."})}),n.ElementSelectionQuery,"Pick all atom sets that are connected to the target.")},p={"@header":"Selection Combinators",intersect:Object(s.b)(o.b.List(n.ElementSelectionQuery),n.ElementSelectionQuery,"Return all unique atom sets that appear in all of the source selections."),merge:Object(s.b)(o.b.List(n.ElementSelectionQuery),n.ElementSelectionQuery,"Merges multiple selections into a single one. Only unique atom sets are kept."),distanceCluster:Object(s.b)(o.b.Dictionary({matrix:Object(o.a)(a.a.List(a.a.List(i.a.Num)),{description:"Distance matrix, represented as list of rows (num[][])). Lower triangle is min distance, upper triangle is max distance."}),selections:Object(o.a)(a.a.List(n.ElementSelectionQuery),{description:"A list of held selections."})}),n.ElementSelectionQuery,"Pick combinations of atom sets from the source sequences that are mutually within distances specified by a matrix.")},m={"@header":"Atom Sets",atomCount:Object(s.b)(o.b.None,i.a.Num),countQuery:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementSelectionQuery)}),i.a.Num,"Counts the number of occurences of a specific query inside the current atom set."),reduce:Object(s.b)(o.b.Dictionary({initial:Object(o.a)(i.a.Variable("a",i.a.AnyValue,!0),{description:"Initial value assigned to slot.atom-set-reduce. Current atom is set to the 1st atom of the current set for this."}),value:Object(o.a)(i.a.Variable("a",i.a.AnyValue,!0),{description:"Expression executed for each atom in the set"})}),i.a.Variable("a",i.a.AnyValue,!0),"Execute the value expression for each atom in the current atom set and return the result. Works the same way as Array.reduce in JavaScript (``result = value(value(...value(initial)))``)"),propertySet:Object(s.b)(o.b.Dictionary({0:Object(o.a)(a.a.ConstrainedVar)}),a.a.Set(a.a.ConstrainedVar),"Returns a set with all values of the given property in the current atom set.")},h={"@header":"Atom Properties",core:{"@header":"Core Properties",elementSymbol:v(n.ElementSymbol),vdw:v(i.a.Num,"Van der Waals radius"),mass:v(i.a.Num,"Atomic weight"),atomicNumber:v(i.a.Num,"Atomic number"),x:v(i.a.Num,"Cartesian X coordinate"),y:v(i.a.Num,"Cartesian Y coordinate"),z:v(i.a.Num,"Cartesian Z coordinate"),atomKey:v(i.a.AnyValue,"Unique value for each atom. Main use case is grouping of atoms."),bondCount:Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"}),flags:Object(o.a)(n.BondFlags,{isOptional:!0,defaultValue:"covalent"})}),i.a.Num,"Number of bonds (by default only covalent bonds are counted)."),sourceIndex:v(i.a.Num,"Index of the atom/element in the input file."),operatorName:v(i.a.Str,"Name of the symmetry operator applied to this element."),modelIndex:v(i.a.Num,"Index of the model in the input file."),modelLabel:v(i.a.Str,"Label/header of the model in the input file.")},topology:{connectedComponentKey:v(i.a.AnyValue,"Unique value for each connected component.")},macromolecular:{"@header":"Macromolecular Properties (derived from the mmCIF format)",authResidueId:v(n.ResidueId,"type.auth-residue-id symbol executed on current atom's residue"),labelResidueId:v(n.ResidueId,"type.label-residue-id symbol executed on current atom's residue"),residueKey:v(i.a.AnyValue,"Unique value for each tuple ``(label_entity_id,auth_asym_id, auth_seq_id, pdbx_PDB_ins_code)``, main use case is grouping of atoms"),chainKey:v(i.a.AnyValue,"Unique value for each tuple ``(label_entity_id, auth_asym_id)``, main use case is grouping of atoms"),entityKey:v(i.a.AnyValue,"Unique value for each tuple ``label_entity_id``, main use case is grouping of atoms"),isHet:v(i.a.Bool,"Equivalent to atom_site.group_PDB !== ATOM"),id:v(i.a.Num,"_atom_site.id"),label_atom_id:v(n.AtomName),label_alt_id:v(i.a.Str),label_comp_id:v(i.a.Str),label_asym_id:v(i.a.Str),label_entity_id:v(i.a.Str),label_seq_id:v(i.a.Num),auth_atom_id:v(n.AtomName),auth_comp_id:v(i.a.Str),auth_asym_id:v(i.a.Str),auth_seq_id:v(i.a.Num),pdbx_PDB_ins_code:v(i.a.Str),pdbx_formal_charge:v(i.a.Num),occupancy:v(i.a.Num),B_iso_or_equiv:v(i.a.Num),entityType:v(n.EntityType,"Type of the entity as defined in mmCIF (polymer, non-polymer, branched, water)"),entitySubtype:v(n.EntitySubtype,"Subtype of the entity as defined in mmCIF _entity_poly.type and _pdbx_entity_branch.type (other, polypeptide(D), polypeptide(L), polydeoxyribonucleotide, polyribonucleotide, polydeoxyribonucleotide/polyribonucleotide hybrid, cyclic-pseudo-peptide, peptide nucleic acid, oligosaccharide)"),entityPrdId:v(i.a.Str,"The PRD ID of the entity."),entityDescription:v(a.a.List(i.a.Str)),objectPrimitive:v(n.ObjectPrimitive,"Type of the primitive object used to model this segment as defined in mmCIF/IHM (atomistic, sphere, gaussian, other)"),secondaryStructureKey:v(i.a.AnyValue,"Unique value for each secondary structure element."),secondaryStructureFlags:v(n.SecondaryStructureFlags),isModified:v(i.a.Bool,"True if the atom belongs to modification of a standard residue."),modifiedParentName:v(i.a.Str,"'3-letter' code of the modifed parent residue."),isNonStandard:v(i.a.Bool,"True if this is a non-standard residue."),chemCompType:v(i.a.Str,"Type of the chemical component as defined in mmCIF.")}},g={"@header":"Bond Properties",flags:b(n.BondFlags),order:b(i.a.Num),length:b(i.a.Num),atomA:b(n.ElementReference),atomB:b(n.ElementReference)};function v(e,t){return Object(s.b)(o.b.Dictionary({0:Object(o.a)(n.ElementReference,{isOptional:!0,defaultValue:"slot.current-atom"})}),e,t)}function b(e,t){return Object(s.b)(o.b.None,e,t)}t.b={"@header":"Structure Queries",type:u,slot:c,generator:l,modifier:d,filter:f,combinator:p,atomSet:m,atomProperty:h,bondProperty:g}},function(e,t,r){"use strict";r.d(t,"b",(function(){return w})),r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(12),o=r(53),s=r(52),u=r(9),c=r(1),l=r(5),d=r(2),f=r(30),p=r(115),m=r(124),h=r(129),g=r(130),v=r(29),b=r(136),y=r(117),_=r(72),S=new Uint32Array([0,1,2,1,3,2]),x=new Float32Array([0,1,0,0,1,1,1,0]),O={nearest:"Nearest",catmulrom:"Catmulrom (Cubic)",mitchell:"Mitchell (Cubic)",bspline:"B-Spline (Cubic)"},w=Object.keys(O);!function(e){function t(e){return{}}function r(t,r,n,a,o){var d=n.instanceCount,y=n.groupCount,O=e.Utils.createPositionIterator(t,r),w=Object(p.a)(n,O,a.color),C=Object(m.a)(d*y),j=Object(h.c)(),P=Object(g.c)(),E=Object(b.d)(),A={drawCount:S.length,vertexCount:_.a.length/3,groupCount:y,instanceCount:d},D=u.g.clone(t.boundingSphere),T=Object(s.b)(D,r.aTransform.ref.value,d);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({},w),C),j),P),E),r),f.a.createValues(o,A)),{aPosition:t.cornerBuffer,aUv:l.e.create(x),elements:l.e.create(S),aGroup:l.e.create(Object(v.fillSerial)(new Float32Array(4))),boundingSphere:l.e.create(T),invariantBoundingSphere:l.e.create(D),uInvariantBoundingSphere:l.e.create(c.Vec4.ofSphere(D)),dInterpolation:l.e.create(o.interpolation),uImageTexDim:t.imageTextureDim,tImageTex:t.imageTexture,tGroupTex:t.groupTexture})}e.create=function(e,t,r,n){return n?function(e,t,r,n){var i=e.width,a=e.height;return l.e.update(n.imageTexture,e),l.e.update(n.imageTextureDim,c.Vec2.set(n.imageTextureDim.ref.value,i,a)),l.e.update(n.cornerBuffer,t),l.e.update(n.groupTexture,r),n}(e,t,r,n):function(e,t,r){var n=Object(u.g)(),i=-1,o=e.width,s=e.height,d={kind:"image",imageTexture:l.e.create(e),imageTextureDim:l.e.create(c.Vec2.create(o,s)),cornerBuffer:l.e.create(t),groupTexture:l.e.create(r),get boundingSphere(){var e=function(e){return Object(a.l)([e.cornerBuffer.ref.version])}(d);if(e!==i){var t=function(e){for(var t=Object(c.Vec3)(),r=[],n=0,i=e.length;n<i;n+=3){var a=c.Vec3.fromArray(Object(c.Vec3)(),e,n);r.push(a),c.Vec3.add(t,t,a)}c.Vec3.scale(t,t,1/(e.length/3));for(var o=0,s=0,l=r;s<l.length;s++){a=l[s];var d=c.Vec3.distance(t,a);d>o&&(o=d)}var f=u.g.create(t,o);return u.g.setExtrema(f,r),f}(d.cornerBuffer.ref.value);u.g.copy(n,t),i=e}return n}};return d}(e,t,r)},e.createEmpty=t,e.Params=Object(i.__assign)(Object(i.__assign)({},f.a.Params),{interpolation:d.ParamDefinition.Select("bspline",d.ParamDefinition.objectToOptions(O))}),e.Utils={Params:e.Params,createEmpty:t,createValues:r,createValuesSimple:function(t,n,a,o,s){var u=f.a.createSimple(a,o,s),c=Object(i.__assign)(Object(i.__assign)({},d.ParamDefinition.getDefaultValues(e.Params)),n);return r(t,u.transform,u.locationIterator,u.theme,c)},updateValues:function(e,t){f.a.updateValues(e,t),l.e.updateIfChanged(e.dInterpolation,t.interpolation)},updateBoundingSphere:function(e,t){var r=u.g.clone(t.boundingSphere),n=Object(s.b)(r,e.aTransform.ref.value,e.instanceCount.ref.value);u.g.equals(n,e.boundingSphere.ref.value)||l.e.update(e.boundingSphere,n);u.g.equals(r,e.invariantBoundingSphere.ref.value)||(l.e.update(e.invariantBoundingSphere,r),l.e.update(e.uInvariantBoundingSphere,c.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=f.a.createRenderableState(e);return t.opaque=!1,t},updateRenderableState:function(e,t){f.a.updateRenderableState(e,t),e.opaque=!1},createPositionIterator:function(){return Object(o.a)(1,1,1,(function(){return y.b}))}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(9),a=r(1),o=r(29);function s(e,t,r,n){var i=(n-r)/t;0===i&&(i=1);for(var a=new Int32Array(t),o=0,s=e.length;o<s;o++){var u=Math.floor((e[o]-r)/i);u>=t?u=t-1:u<0&&(u=0),a[u]++}return{min:r,max:n,binWidth:i,counts:a}}!function(e){e.One={transform:{kind:"matrix",matrix:a.Mat4.identity()},cells:a.Tensor.create(a.Tensor.Space([1,1,1],[0,1,2]),a.Tensor.Data1([0])),stats:{min:0,max:0,mean:0,sigma:0}};var t=a.Mat4.zero(),r=a.Mat4.zero();e.getGridToCartesianTransform=function(e){if("matrix"===e.transform.kind)return a.Mat4.copy(Object(a.Mat4)(),e.transform.matrix);if("spacegroup"===e.transform.kind){var n=e.cells.space,o=a.Mat4.fromScaling(t,a.Vec3.div(a.Vec3.zero(),i.b.size(a.Vec3.zero(),e.transform.fractionalBox),a.Vec3.ofArray(n.dimensions))),s=a.Mat4.fromTranslation(r,e.transform.fractionalBox.min);return a.Mat4.mul3(a.Mat4.zero(),e.transform.cell.fromFractional,s,o)}return a.Mat4.identity()},e.areEquivalent=function(e,t){return e===t},e.isEmpty=function(e){return 0===e.cells.data.length},e.getBoundingSphere=function(t,r){r||(r=Object(i.g)());var n=t.cells.space.dimensions,a=e.getGridToCartesianTransform(t);return i.g.fromDimensionsAndTransform(r,n,a)},e.getHistogram=function(e,t){var r=e._historams;return r||(r=e._historams={}),r[t]||(r[t]=function(e,t,r){if(r)return s(e,t,r.min,r.max);var n=Object(o.arrayMinMax)(e);return s(e,t,n[0],n[1])}(e.cells.data,t,{min:e.stats.min,max:e.stats.max})),r[t]}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return g})),r.d(t,"c",(function(){return v})),r.d(t,"a",(function(){return y}));var n=r(0),i=r(72),a=r(11),o=r(5),s=r(1),u=r(64),c=r(68),l=r(67),d=r(2),f=r(172),p=r(138),m=Object(n.__assign)(Object(n.__assign)({},i.b),{tColor:Object(a.i)("texture","rgba","ubyte","nearest"),uTexSize:Object(a.j)("v2"),uWeight:Object(a.j)("f")}),h=Object(u.g)("compose",p.a,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSize;\nuniform float uWeight;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    gl_FragColor = texture2D(tColor, coords) * uWeight;\n}\n");var g={mode:d.ParamDefinition.Select("off",[["off","Off"],["on","On"],["temporal","Temporal"]]),sampleLevel:d.ParamDefinition.Numeric(2,{min:0,max:5,step:1})},v=function(){function e(e,t){this.webgl=e,this.drawPass=t;var r=e.extensions,a=r.colorBufferFloat,u=r.textureFloat,d=r.colorBufferHalfFloat,f=r.textureHalfFloat,p=t.colorTarget.getWidth(),g=t.colorTarget.getHeight();this.colorTarget=e.createRenderTarget(p,g,!1);var v,b,y,_,S,x=d&&f?"fp16":a&&u?"float32":"uint8";this.composeTarget=e.createRenderTarget(p,g,!1,x),this.holdTarget=e.createRenderTarget(p,g,!1),this.compose=(v=e,b=t.colorTarget.texture,y=Object(n.__assign)(Object(n.__assign)({},i.c),{tColor:o.e.create(b),uTexSize:o.e.create(s.Vec2.create(b.getWidth(),b.getHeight())),uWeight:o.e.create(1)}),_=Object(n.__assign)({},m),S=Object(c.a)(v,"triangles",h,_,y),Object(l.a)(S,y))}return e.isEnabled=function(e){return"off"!==e.mode},e.prototype.syncSize=function(){var e=this.drawPass.colorTarget.getWidth(),t=this.drawPass.colorTarget.getHeight(),r=this.compose.values.uTexSize.ref.value,n=r[0],i=r[1];e===n&&t===i||(this.colorTarget.setSize(e,t),this.composeTarget.setSize(e,t),this.holdTarget.setSize(e,t),o.e.update(this.compose.values.uTexSize,s.Vec2.set(this.compose.values.uTexSize.ref.value,e,t)))},e.prototype.render=function(e,t,r,n,i,a,o,s){return"temporal"===s.multiSample.mode?this.renderTemporalMultiSample(e,t,r,n,i,a,o,s):(this.renderMultiSample(t,r,n,i,a,o,s),e)},e.prototype.bindOutputTarget=function(e){e?this.webgl.unbindFramebuffer():this.colorTarget.bind()},e.prototype.renderMultiSample=function(e,t,r,n,i,a,s){var u=this.compose,c=this.composeTarget,l=this.drawPass,d=this.webgl,p=d.gl,m=d.state,h=b[Math.max(0,Math.min(s.multiSample.sampleLevel,5))],g=t.viewport,v=g.x,y=g.y,_=g.width,S=g.height,x=1/h.length;t.viewOffset.enabled=!0,o.e.update(u.values.tColor,l.getColorTarget(s.postprocessing).texture),u.update();for(var O=0;O<h.length;++O){var w=h[O];f.a.setViewOffset(t.viewOffset,_,S,w[0],w[1],_,S),t.update();var C=x+1/32*((O+.5)/h.length-.5);o.e.update(u.values.uWeight,C),l.render(e,t,r,n,!1,a,s.postprocessing),c.bind(),m.enable(p.BLEND),m.blendEquationSeparate(p.FUNC_ADD,p.FUNC_ADD),m.blendFuncSeparate(p.ONE,p.ONE,p.ONE,p.ONE),m.disable(p.DEPTH_TEST),m.depthMask(!1),p.viewport(v,y,_,S),p.scissor(v,y,_,S),0===O&&(m.clearColor(0,0,0,0),p.clear(p.COLOR_BUFFER_BIT)),u.render()}o.e.update(u.values.uWeight,1),o.e.update(u.values.tColor,c.texture),u.update(),this.bindOutputTarget(i),p.viewport(v,y,_,S),p.scissor(v,y,_,S),m.disable(p.BLEND),u.render(),t.viewOffset.enabled=!1,t.update()},e.prototype.renderTemporalMultiSample=function(e,t,r,n,i,a,s,u){var c=this,l=c.compose,d=c.composeTarget,p=c.holdTarget,m=c.drawPass,h=c.webgl,g=h.gl,v=h.state,y=b[Math.max(0,Math.min(u.multiSample.sampleLevel,5))];if(-2===e||e>=y.length)return-2;var _=r.viewport,S=_.x,x=_.y,O=_.width,w=_.height,C=1/y.length;if(-1===e)m.render(t,r,n,i,!1,s,u.postprocessing),o.e.update(l.values.uWeight,1),o.e.update(l.values.tColor,m.getColorTarget(u.postprocessing).texture),l.update(),p.bind(),v.disable(g.BLEND),v.disable(g.DEPTH_TEST),v.depthMask(!1),g.viewport(S,x,O,w),g.scissor(S,x,O,w),l.render(),e+=1;else{r.viewOffset.enabled=!0,o.e.update(l.values.tColor,m.getColorTarget(u.postprocessing).texture),o.e.update(l.values.uWeight,C),l.update();for(var j=Math.pow(2,Math.max(0,u.multiSample.sampleLevel-2)),P=0;P<j;++P){var E=y[e];if(f.a.setViewOffset(r.viewOffset,O,w,E[0],E[1],O,w),r.update(),m.render(t,r,n,i,!1,s,u.postprocessing),d.bind(),v.enable(g.BLEND),v.blendEquationSeparate(g.FUNC_ADD,g.FUNC_ADD),v.blendFuncSeparate(g.ONE,g.ONE,g.ONE,g.ONE),v.disable(g.DEPTH_TEST),v.depthMask(!1),g.viewport(S,x,O,w),g.scissor(S,x,O,w),0===e&&(v.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT)),l.render(),(e+=1)>=y.length)break}}this.bindOutputTarget(a),g.viewport(S,x,O,w),g.scissor(S,x,O,w);var A=e*C;return A>0&&(o.e.update(l.values.uWeight,1),o.e.update(l.values.tColor,d.texture),l.update(),v.disable(g.BLEND),l.render()),A<1&&(o.e.update(l.values.uWeight,1-A),o.e.update(l.values.tColor,p.texture),l.update(),0===A?v.disable(g.BLEND):v.enable(g.BLEND),l.render()),r.viewOffset.enabled=!1,r.update(),e>=y.length?-2:e},e}(),b=[[[0,0]],[[4,4],[-4,-4]],[[-2,-6],[6,-2],[-6,2],[2,6]],[[1,-3],[-1,3],[5,1],[-3,-5],[-5,5],[-7,-1],[3,7],[7,-7]],[[1,1],[-1,-3],[-3,2],[4,-1],[-5,-2],[2,5],[5,3],[3,-5],[-2,6],[0,-7],[-4,-6],[-6,4],[-8,0],[7,-4],[6,7],[-7,-8]],[[-4,-7],[-7,-5],[-3,-5],[-5,-4],[-1,-4],[-2,-2],[-6,-1],[-4,0],[-7,1],[-1,2],[-6,3],[-3,3],[-7,6],[-3,6],[-5,7],[-1,7],[5,-7],[1,-6],[6,-5],[4,-4],[2,-3],[7,-2],[1,-1],[4,-1],[2,1],[6,2],[0,4],[4,4],[2,5],[7,5],[5,6],[3,7]]];b.forEach((function(e){e.forEach((function(e){e[0]*=.0625,e[1]*=.0625}))}));var y=function(){function e(e){this.multiSamplePass=e,this.sampleIndex=-2}return e.prototype.update=function(e,t){return e&&(this.sampleIndex=-1),"temporal"===t.mode&&-2!==this.sampleIndex},e.prototype.render=function(e,t,r,n,i,a,o){this.sampleIndex=this.multiSamplePass.render(this.sampleIndex,e,t,r,n,i,a,o)},e}()},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return l}));var n=r(20),i=r(123),a=r(148),o=r(40);function s(e,t,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof t?function(n){return n.pipe(s((function(r,n){return Object(a.a)(e(r,n)).pipe(Object(i.a)((function(e,i){return t(r,e,n,i)})))}),r))}:("number"==typeof t&&(r=t),function(t){return t.lift(new u(e,r))})}var u=function(){function e(e,t){void 0===t&&(t=Number.POSITIVE_INFINITY),this.project=e,this.concurrent=t}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.project,this.concurrent))},e}(),c=function(e){function t(t,r,n){void 0===n&&(n=Number.POSITIVE_INFINITY);var i=e.call(this,t)||this;return i.project=r,i.concurrent=n,i.hasCompleted=!1,i.buffer=[],i.active=0,i.index=0,i}return n.a(t,e),t.prototype._next=function(e){this.active<this.concurrent?this._tryNext(e):this.buffer.push(e)},t.prototype._tryNext=function(e){var t,r=this.index++;try{t=this.project(e,r)}catch(e){return void this.destination.error(e)}this.active++,this._innerSub(t)},t.prototype._innerSub=function(e){var t=new o.a(this),r=this.destination;r.add(t);var n=Object(o.c)(e,t);n!==t&&r.add(n)},t.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e){this.destination.next(e)},t.prototype.notifyComplete=function(){var e=this.buffer;this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&this.destination.complete()},t}(o.b),l=s},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(){return Error.call(this),this.message="no elements in sequence",this.name="EmptyError",this}return e.prototype=Object.create(Error.prototype),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return u})),r.d(t,"c",(function(){return c}));var n=r(99),i=r(60),a=Object(n.a)();function o(e){var t=e.checkFramebufferStatus(e.FRAMEBUFFER);if(t!==e.FRAMEBUFFER_COMPLETE){var r=function(e,t){switch(t){case e.FRAMEBUFFER_COMPLETE:return"complete";case e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"incomplete attachment";case e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"incomplete missing attachment";case e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"incomplete dimensions";case e.FRAMEBUFFER_UNSUPPORTED:return"unsupported"}if(Object(i.q)(e))switch(t){case e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:return"incomplete multisample";case e.RENDERBUFFER_SAMPLES:return"renderbuffer samples"}return"unknown error"}(e,t);throw new Error("Framebuffer status: "+r)}}function s(e){var t=e.createFramebuffer();if(null===t)throw new Error("Could not create WebGL framebuffer");return t}function u(e){var t=s(e),r=!1;return{id:a(),bind:function(){return e.bindFramebuffer(e.FRAMEBUFFER,t)},reset:function(){t=s(e)},destroy:function(){r||(e.deleteFramebuffer(t),r=!0)}}}function c(){return{id:a(),bind:function(){},reset:function(){},destroy:function(){}}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return u}));var n=r(0),i=r(2),a=r(47),o=r(144),s={customText:i.ParamDefinition.Text("",{label:"Text",description:"Override the label with custom value."}),textColor:i.ParamDefinition.Color(a.a.black,{isEssential:!0}),textSize:i.ParamDefinition.Numeric(.5,{min:.1,max:5,step:.1},{isEssential:!0})},u=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},o.a.Params),s),{borderWidth:i.ParamDefinition.Numeric(.2,{min:0,max:.5,step:.01})})},function(e,t,r){"use strict";r.d(t,"a",(function(){return g}));var n=r(0),i=r(2),a=r(55),o=r(4),s=r(62),u=r(121),c=r(94),l=r(17),d=r(23),f=r(51),p=r(140),m=r(85),h=r(141);function g(e,t,r,g){var v,b,y,_,S=0,x=t.webgl,O=new s.a,w=Object(u.c)(),C=[],j=a.c.create(),P=c.a.createEmpty();function E(e){if(a.c.update(j,e),void 0!==e.visible&&v&&v.setVisibility(e.visible&&(null===j.unitTransforms||j.unitTransforms.isIdentity)),void 0!==e.alphaFactor&&v&&v.setAlphaFactor(e.alphaFactor),void 0!==e.pickable&&v&&v.setPickable(e.pickable),void 0!==e.overpaint&&v){var t=p.a.remap(e.overpaint,b);v.setOverpaint(t)}if(void 0!==e.transparency&&v){var r=h.a.remap(e.transparency,b);v.setTransparency(r)}if(void 0!==e.clipping&&v){var n=m.a.remap(e.clipping,b);v.setClipping(n)}void 0!==e.transform&&v&&v.setTransform(e.transform),void 0!==e.unitTransforms&&v&&v.setVisibility(j.visible&&(null===e.unitTransforms||e.unitTransforms.isIdentity))}return{label:e,get groupCount(){return v?v.groupCount:0},get props(){return _},get params(){return y},get state(){return j},get theme(){return P},renderObjects:C,updated:O,createOrUpdate:function(e,a){var o=this;return void 0===e&&(e={}),a&&a!==b&&(y=r(t,a),b=a,_||(_=i.ParamDefinition.getDefaultValues(y))),_=Object.assign({},_,e),l.b.create("Creating or updating ComplexRepresentation",(function(e){return Object(n.__awaiter)(o,void 0,void 0,(function(){var t,r,i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return t=!1,v?(null===(i=v.mustRecreate)||void 0===i?void 0:i.call(v,b,_,x))&&(v.destroy(),v=g(w,b,_,x),t=!0):(v=g(w,b,_,x),t=!0),(r=v.createOrUpdate({webgl:x,runtime:e},P,_,a))?[4,r]:[3,2];case 1:n.sent(),n.label=2;case 2:return t&&E(j),C.length=0,v&&v.renderObject&&C.push(v.renderObject),O.next(S++),[2]}}))}))}))},setState:E,setTheme:function(e){P=e},getLoci:function(e){return void 0===e?o.Structure.Loci(b):v?v.getLoci(e):d.EmptyLoci},mark:function(e,t){if(!b)return!1;if(!f.b.is(j.markerActions,t))return!1;if(o.Structure.isLoci(e)||o.StructureElement.Loci.is(e)||o.Bond.isLoci(e)){if(!o.Structure.areRootsEquivalent(e.structure,b))return!1;e=d.Loci.remap(e,b)}else if(!Object(d.isEveryLoci)(e)&&!Object(d.isDataLoci)(e))return!1;return!d.Loci.isEmpty(e)&&(!!v&&v.mark(e,t))},destroy:function(){v&&v.destroy()}}}},function(e,t,r){"use strict";r.r(t),r.d(t,"HighlightLoci",(function(){return _})),r.d(t,"SelectLoci",(function(){return O})),r.d(t,"DefaultLociLabelProvider",(function(){return w})),r.d(t,"FocusLoci",(function(){return P}));var n=r(0),i=r(51),a=r(8),o=r(77),s=r(79),u=r(311),c=r(13),l=r(90),d=r(61),f=r(2),p=r(23),m=r(4),h=r(29),g=(l.a,l.b),v=d.a.Trigger,b={hoverHighlightOnly:Object(d.a)([v(0)],"Highlight","Hover element using ${triggers}"),hoverHighlightOnlyExtend:Object(d.a)([v(0,g.create({shift:!0}))],"Extend highlight","From selected to hovered element along polymer using ${triggers}")},y={bindings:f.ParamDefinition.Value(b,{isHidden:!0}),ignore:f.ParamDefinition.Value([],{isHidden:!0}),mark:f.ParamDefinition.Boolean(!0)},_=s.a.create({name:"representation-highlight-loci",category:"interaction",ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.lociMarkProvider=function(e,r){t.ctx.canvas3d&&t.params.mark&&t.ctx.canvas3d.mark(e,r)},t}return Object(n.__extends)(t,e),t.prototype.register=function(){var e=this;this.subscribeObservable(this.ctx.behaviors.interaction.hover,(function(t){var r,n=t.current,i=t.buttons,a=t.modifiers;if(e.ctx.canvas3d&&!e.ctx.isBusy)if((null===(r=e.params.ignore)||void 0===r?void 0:r.indexOf(n.loci.kind))>=0)e.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:n.repr,loci:p.EmptyLoci});else{var o=!1;d.a.match(e.params.bindings.hoverHighlightOnly,i,a)&&(e.ctx.managers.interactivity.lociHighlights.highlightOnly({loci:n.loci}),o=!0),d.a.match(e.params.bindings.hoverHighlightOnlyExtend,i,a)&&(e.ctx.managers.interactivity.lociHighlights.highlightOnlyExtend({loci:n.loci}),o=!0),o||e.ctx.managers.interactivity.lociHighlights.highlightOnly({repr:n.repr,loci:p.EmptyLoci})}})),this.ctx.managers.interactivity.lociHighlights.addProvider(this.lociMarkProvider)},t.prototype.unregister=function(){this.ctx.managers.interactivity.lociHighlights.removeProvider(this.lociMarkProvider)},t}(s.a.Handler),params:function(){return y},display:{name:"Highlight Loci on Canvas"}}),S={clickSelect:d.a.Empty,clickToggleExtend:Object(d.a)([v(1,g.create({shift:!0}))],"Toggle extended selection","${triggers} to extend selection along polymer"),clickSelectOnly:d.a.Empty,clickToggle:Object(d.a)([v(1,g.create())],"Toggle selection","${triggers} on element"),clickDeselect:d.a.Empty,clickDeselectAllOnEmpty:Object(d.a)([v(1,g.create())],"Deselect all","Click on nothing using ${triggers}")},x={bindings:f.ParamDefinition.Value(S,{isHidden:!0}),ignore:f.ParamDefinition.Value([],{isHidden:!0}),mark:f.ParamDefinition.Boolean(!0)},O=s.a.create({name:"representation-select-loci",category:"interaction",ctor:function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.lociMarkProvider=function(e,t){n.ctx.canvas3d&&n.params.mark&&n.ctx.canvas3d.mark({loci:e.loci},t)},n.spine=new u.a.Impl(t.state.data.cells),n}return Object(n.__extends)(t,e),t.prototype.applySelectMark=function(e,t){var r=this.ctx.state.data.cells.get(e);if(r&&a.a.isRepresentation3D(r.obj)){this.spine.current=r;var n=this.spine.getRootOfType(a.a.Molecule.Structure);if(n){t&&this.lociMarkProvider({loci:m.Structure.Loci(n.data)},i.a.Deselect);var o=this.ctx.managers.structure.selection.getLoci(n.data);this.lociMarkProvider({loci:o},i.a.Select)}}},t.prototype.register=function(){var e=this,t=function(e){return!p.Loci.isEmpty(e.loci)},r=[["clickSelect",function(t){return e.ctx.managers.interactivity.lociSelects.select(t)},t],["clickToggle",function(t){return e.ctx.managers.interactivity.lociSelects.toggle(t)},t],["clickToggleExtend",function(t){return e.ctx.managers.interactivity.lociSelects.toggleExtend(t)},t],["clickSelectOnly",function(t){return e.ctx.managers.interactivity.lociSelects.selectOnly(t)},t],["clickDeselect",function(t){return e.ctx.managers.interactivity.lociSelects.deselect(t)},t],["clickDeselectAllOnEmpty",function(){return e.ctx.managers.interactivity.lociSelects.deselectAll()},function(e){return p.Loci.isEmpty(e.loci)}]];r.sort((function(t,r){var n=e.params.bindings[t[0]],i=e.params.bindings[r[0]],a=0===n.triggers.length?0:Object(h.arrayMax)(n.triggers.map((function(e){return g.size(e.modifiers)})));return(0===i.triggers.length?0:Object(h.arrayMax)(i.triggers.map((function(e){return g.size(e.modifiers)}))))-a})),this.subscribeObservable(this.ctx.behaviors.interaction.click,(function(t){var n,i=t.current,a=t.button,o=t.modifiers;if(e.ctx.canvas3d&&!e.ctx.isBusy&&e.ctx.selectionMode&&!((null===(n=e.params.ignore)||void 0===n?void 0:n.indexOf(i.loci.kind))>=0))for(var s=0,u=r;s<u.length;s++){var c=u[s],l=c[0],f=c[1],p=c[2];if(d.a.match(e.params.bindings[l],a,o)&&(!p||p(i))){f(i);break}}})),this.ctx.managers.interactivity.lociSelects.addProvider(this.lociMarkProvider),this.subscribeObservable(this.ctx.state.events.object.created,(function(t){var r=t.ref;return e.applySelectMark(r)})),this.subscribeObservable(this.ctx.state.events.object.updated,(function(t){var r=t.ref,n=t.obj,i=t.oldObj,o=t.oldData,s=t.action,u=e.ctx.state.data.cells.get(r);if(u&&a.a.Molecule.Structure.is(u.obj)){var l=n.data,d="recreate"===s?null==i?void 0:i.data:"in-place"===s?o:void 0;if(d&&m.Structure.areEquivalent(l,d)&&m.Structure.areHierarchiesEqual(l,d))return;for(var f=0,p=e.ctx.state.data.select(c.StateSelection.Generators.ofType(a.a.Molecule.Structure.Representation3D,r));f<p.length;f++){var h=p[f];e.applySelectMark(h.transform.ref,!0)}}}))},t.prototype.unregister=function(){this.ctx.managers.interactivity.lociSelects.removeProvider(this.lociMarkProvider)},t}(s.a.Handler),params:function(){return x},display:{name:"Select Loci on Canvas"}}),w=s.a.create({name:"default-loci-label-provider",category:"interaction",ctor:function(){function e(e){this.ctx=e,this.f={label:function(e){var t=[];if(m.StructureElement.Loci.is(e)&&1===e.elements.length){var r=e.elements[0].unit,n=m.StructureElement.Location.create(e.structure,r,r.elements[0]),i=m.StructureProperties.entity.pdbx_description(n).join(", ");t.push(i)}return t.push(Object(o.lociLabel)(e)),t.filter((function(e){return!!e})).join("</br>")},group:function(e){return e.toString().replace(/Model [0-9]+/g,"Models")},priority:100}}return e.prototype.register=function(){this.ctx.managers.lociLabels.addProvider(this.f)},e.prototype.unregister=function(){this.ctx.managers.lociLabels.removeProvider(this.f)},e}(),display:{name:"Provide Default Loci Label"}}),C={clickFocus:Object(d.a)([v(1,g.create())],"Representation Focus","Click element using ${triggers}"),clickFocusAdd:Object(d.a)([v(1,g.create({shift:!0}))],"Representation Focus Add","Click element using ${triggers}"),clickFocusSelectMode:Object(d.a)([],"Representation Focus","Click element using ${triggers}"),clickFocusAddSelectMode:Object(d.a)([],"Representation Focus Add","Click element using ${triggers}")},j={bindings:f.ParamDefinition.Value(C,{isHidden:!0})},P=s.a.create({name:"representation-focus-loci",category:"interaction",ctor:function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.register=function(){var e=this;this.subscribeObservable(this.ctx.behaviors.interaction.click,(function(t){var r,n=t.current,i=t.button,a=t.modifiers,o=e.params.bindings,s=o.clickFocus,u=o.clickFocusAdd,c=o.clickFocusSelectMode,l=o.clickFocusAddSelectMode,f=e.ctx.managers.interactivity.props.granularity;if("residue"===f||"element"===f){var m=e.ctx.selectionMode?c:s,h=d.a.match(m,i,a),g=e.ctx.selectionMode?l:u,v=d.a.match(g,i,a);if(h||v){var b=p.Loci.normalize(n.loci,"residue"),y=e.ctx.managers.structure.focus.current;if(y&&p.Loci.areEqual(y.loci,b))e.ctx.managers.structure.focus.clear();else if(h)e.ctx.managers.structure.focus.setFromLoci(b);else{e.ctx.managers.structure.focus.addFromLoci(b);var _=null===(r=e.ctx.managers.structure.focus.current)||void 0===r?void 0:r.loci;_&&e.ctx.managers.camera.focusLoci(_)}}}}))},t}(s.a.Handler),params:function(){return j},display:{name:"Representation Focus Loci on Canvas"}})},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(45),i=r(384),a=r(319);function o(e,t){return t?Object(a.a)(e,t):new n.a(Object(i.a)(e))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(20),i=r(328),a=function(e){function t(r,n){void 0===n&&(n=i.a.now);var a=e.call(this,r,(function(){return t.delegate&&t.delegate!==a?t.delegate.now():n()}))||this;return a.actions=[],a.active=!1,a.scheduled=void 0,a}return n.a(t,e),t.prototype.schedule=function(r,n,i){return void 0===n&&(n=0),t.delegate&&t.delegate!==this?t.delegate.schedule(r,n,i):e.prototype.schedule.call(this,r,n,i)},t.prototype.flush=function(e){var t=this.actions;if(this.active)t.push(e);else{var r;this.active=!0;do{if(r=e.execute(e.state,e.delay))break}while(e=t.shift());if(this.active=!1,r){for(;e=t.shift();)e.unsubscribe();throw r}}},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(20),i=r(62),a=r(76),o=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.value=null,t.hasNext=!1,t.hasCompleted=!1,t}return n.a(t,e),t.prototype._subscribe=function(t){return this.hasError?(t.error(this.thrownError),a.a.EMPTY):this.hasCompleted&&this.hasNext?(t.next(this.value),t.complete(),a.a.EMPTY):e.prototype._subscribe.call(this,t)},t.prototype.next=function(e){this.hasCompleted||(this.value=e,this.hasNext=!0)},t.prototype.error=function(t){this.hasCompleted||e.prototype.error.call(this,t)},t.prototype.complete=function(){this.hasCompleted=!0,this.hasNext&&e.prototype.next.call(this,this.value),e.prototype.complete.call(this)},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(71),i=r(25);function a(e,t,r,n){n=e[t],e[t]=e[r],e[r]=n}function o(e,t){return(e=Math.abs(e))>(t=Math.abs(t))?(t/=e,e*Math.sqrt(1+t*t)):t>0?(e/=t,t*Math.sqrt(1+e*e)):0}function s(e,t,r,i){var s=0,u=0,c=e.rows,l=e.cols,d=c,f=l;d<f&&(s=1,u=d,d=f,f=u);var p=n.a.create(d,d),m=n.a.create(1,f),h=n.a.create(f,f);if(0===s)n.a.transpose(p,e);else{for(u=0;u<l*c;u++)p.data[u]=e.data[u];for(;u<f*d;u++)p.data[u]=0}if(function(e,t,r,n,i,s,u,c){for(var l=0,d=0,f=0,p=0,m=Math.max(s,30),h=0,g=0,v=0,b=0,y=0,_=0,S=0,x=0,O=0,w=0,C=0,j=0,P=0,E=0,A=0,D=0,T=0,I=4660,M=0,k=0,B=0,V=new Float64Array(u<<3);l<u;l++){for(f=0,C=0;f<s;f++)C+=(x=e[l*t+f])*x;if(V[l]=C,n){for(f=0;f<u;f++)n[l*i+f]=0;n[l*i+l]=1}}for(;p<m;p++){for(y=0,l=0;l<u-1;l++)for(d=l+1;d<u;d++){for(h=l*t|0,g=d*t|0,A=V[l],D=0,T=V[d],f=2,D+=e[h]*e[g],D+=e[h+1]*e[g+1];f<s;f++)D+=e[h+f]*e[g+f];if(!(Math.abs(D)<=2.384185792e-7*Math.sqrt(A*T))){for(P=o(D*=2,j=A-T),j<0?(E=.5*(P-j),_=D/(P*(S=Math.sqrt(E/P))*2)):S=D/(P*(_=Math.sqrt((P+j)/(2*P)))*2),A=0,T=0,f=2,O=_*e[h]+S*e[g],w=-S*e[h]+_*e[g],e[h]=O,e[g]=w,A+=O*O,T+=w*w,O=_*e[h+1]+S*e[g+1],w=-S*e[h+1]+_*e[g+1],e[h+1]=O,e[g+1]=w,A+=O*O,T+=w*w;f<s;f++)O=_*e[h+f]+S*e[g+f],w=-S*e[h+f]+_*e[g+f],e[h+f]=O,e[g+f]=w,A+=O*O,T+=w*w;if(V[l]=A,V[d]=T,y=1,n)for(b=d*i|0,f=2,O=_*n[v=l*i|0]+S*n[b],w=-S*n[v]+_*n[b],n[v]=O,n[b]=w,O=_*n[v+1]+S*n[b+1],w=-S*n[v+1]+_*n[b+1],n[v+1]=O,n[b+1]=w;f<u;f++)O=_*n[v+f]+S*n[b+f],w=-S*n[v+f]+_*n[b+f],n[v+f]=O,n[b+f]=w}}if(0===y)break}for(l=0;l<u;l++){for(f=0,C=0;f<s;f++)C+=(x=e[l*t+f])*x;V[l]=Math.sqrt(C)}for(l=0;l<u-1;l++){for(d=l,f=l+1;f<u;f++)V[d]<V[f]&&(d=f);if(l!==d&&(a(V,l,d,C),n)){for(f=0;f<s;f++)a(e,l*t+f,d*t+f,x);for(f=0;f<u;f++)a(n,l*i+f,d*i+f,x)}}for(l=0;l<u;l++)r[l]=V[l];if(n)for(l=0;l<c;l++){for(C=l<u?V[l]:0;C<=1e-37;){for(k=1/s,f=0;f<s;f++)M=0!=(256&(I=214013*I+2531011)>>16)?k:-k,e[l*t+f]=M;for(p=0;p<2;p++)for(d=0;d<l;d++){for(C=0,f=0;f<s;f++)C+=e[l*t+f]*e[d*t+f];for(B=0,f=0;f<s;f++)x=e[l*t+f]-C*e[d*t+f],e[l*t+f]=x,B+=Math.abs(x);for(B=B?1/B:0,f=0;f<s;f++)e[l*t+f]*=B}for(C=0,f=0;f<s;f++)C+=(x=e[l*t+f])*x;C=Math.sqrt(C)}for(S=1/C,f=0;f<s;f++)e[l*t+f]*=S}}(p.data,d,m.data,h.data,f,d,f,d),t){for(u=0;u<f;u++)t.data[u]=m.data[u];for(;u<l;u++)t.data[u]=0}0===s?(r&&n.a.transpose(r,p),i&&n.a.transpose(i,h)):(r&&n.a.transpose(r,h),i&&n.a.transpose(i,p))}var u,c=r(9);!function(e){function t(e){if(3===e.length)return c.a.create(i.f.fromArray(Object(i.f)(),e,0),i.f.create(1,0,0),i.f.create(0,1,0),i.f.create(0,1,0));var t=n.a.fromArray(e,3,e.length/3),r=t.rows,a=r/3,o=n.a.create(3,3),u=n.a.create(1,3),l=n.a.create(3,3),d=n.a.create(3,3),f=n.a.meanRows(t),p=n.a.subRows(n.a.clone(t),f),m=n.a.transpose(n.a.create(r,3),p);n.a.multiplyABt(o,m,m),s(o,u,l,d);var h=i.f.create(f[0],f[1],f[2]),g=i.f.create(l.data[0],l.data[3],l.data[6]),v=i.f.create(l.data[1],l.data[4],l.data[7]),b=i.f.create(l.data[2],l.data[5],l.data[8]);return i.f.scale(g,g,Math.sqrt(u.data[0]/a)),i.f.scale(v,v,Math.sqrt(u.data[1]/a)),i.f.scale(b,b,Math.sqrt(u.data[2]/a)),c.a.create(h,g,v,b)}e.ofPositions=function(e){var r=t(e);return{momentsAxes:r,boxAxes:l(e,r)}},e.calculateMomentsAxes=t;var r=Object(i.f)(),a=Object(i.f)(),o=Object(i.f)(),u=Object(i.f)();function l(e,t){if(3===e.length)return c.a.clone(t);for(var n=-1/0,s=-1/0,l=-1/0,d=-1/0,f=-1/0,p=-1/0,m=Object(i.f)(),h=Object(i.f)(),g=t.origin,v=i.f.normalize(a,t.dirA),b=i.f.normalize(o,t.dirB),y=i.f.normalize(u,t.dirC),_=0,S=e.length;_<S;_+=3){i.f.projectPointOnVector(m,i.f.fromArray(m,e,_),v,g);var x=i.f.dot(v,i.f.normalize(h,i.f.sub(h,m,g))),O=i.f.distance(m,g);x>0?O>n&&(n=O):O>s&&(s=O),i.f.projectPointOnVector(m,i.f.fromArray(m,e,_),b,g);var w=i.f.dot(b,i.f.normalize(h,i.f.sub(h,m,g))),C=i.f.distance(m,g);w>0?C>l&&(l=C):C>d&&(d=C),i.f.projectPointOnVector(m,i.f.fromArray(m,e,_),y,g);var j=i.f.dot(y,i.f.normalize(h,i.f.sub(h,m,g))),P=i.f.distance(m,g);j>0?P>f&&(f=P):P>p&&(p=P)}var E=i.f.setMagnitude(Object(i.f)(),v,(n+s)/2),A=i.f.setMagnitude(Object(i.f)(),b,(l+d)/2),D=i.f.setMagnitude(Object(i.f)(),y,(f+p)/2),T=Object(i.f)(),I=function(e,t,n){i.f.copy(r,g),i.f.scaleAndAdd(r,r,v,e),i.f.scaleAndAdd(r,r,b,t),i.f.scaleAndAdd(r,r,y,n),i.f.add(T,T,r)};return I(n,l,f),I(n,l,-p),I(n,-d,-p),I(n,-d,f),I(-s,-d,-p),I(-s,-d,f),I(-s,l,f),I(-s,l,-p),i.f.scale(T,T,1/8),c.a.create(T,E,A,D)}e.calculateBoxAxes=l}(u||(u={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return O}));var n=r(0),i=r(2),a=r(4),o=r(258),s=r(155),u=r(32),c=r(48),l=r(6),d=r(22),f=new a.Bond.ElementBondIterator,p=new a.Bond.ElementBondIterator;var m=new a.Bond.ElementBondIterator,h=new a.Bond.ElementBondIterator;function g(e,t,r,n){var i=Object(u.d)(e,t,r,"H"),a=Object(u.i)(t,r),l=Object(u.h)(t,r),g="always"===n.assignCharge||"auto"===n.assignCharge&&0===l,v="always"===n.assignH||"auto"===n.assignH&&0===i,b=Object(u.c)(e,t,r),y=function(e,t,r){for(var n=0,i=t.bonds,a=i.offset,o=i.edgeProps,s=o.flags,u=o.order,c=a[r],l=a[r+1];c<l;++c)d.BondType.isCovalent(s[c])&&(n+=u[c]);return e.interUnitBonds.getEdgeIndices(r,t.id).forEach((function(t){var r=e.interUnitBonds.edges[t];d.BondType.isCovalent(r.props.flag)&&(n+=r.props.order)})),n}(e,t,r),_=function(e,t,r){var n=Object(u.i)(t,r),i="O"===n||"N"===n;if(i&&4===Object(u.c)(e,t,r))return!1;for(f.setElement(e,t,r);f.hasNext;){var a=f.move();if(a.order>1)return!0;if(i){var o=Object(u.i)(a.otherUnit,a.otherIndex);for(p.setElement(e,a.otherUnit,a.otherIndex);p.hasNext;){var s=p.move();if(s.order>1){if(("P"===o||"S"===o)&&"O"===Object(u.i)(s.otherUnit,s.otherIndex))continue;return!0}}}}return!1}(e,t,r),S=y-b>0,x=0,O=8;switch(a){case"H":g&&(0===b?(l=1,O=0):1===b&&(l=0,O=1));break;case"C":g&&(l=0),v&&(x=Math.max(0,4-y-Math.abs(l))),O=Object(s.b)(b+x+Math.max(0,-l));break;case"N":if(g)if(v)if(_&&y<4)l=b-i==1&&y-i==2?1:0;else for(m.setElement(e,t,r);m.hasNext;){var w=m.move(),C=Object(u.i)(w.otherUnit,w.otherIndex);if("S"===C||Object(o.c)(C)){l=0;break}l=1}else l=y-3;v&&(x=Math.max(0,3-y+l)),O=_&&!S?Object(s.b)(b+x-l):Object(s.b)(b+x+1-l);break;case"O":if(g&&(v||(l=y-2),1===y)){m.setElement(e,t,r);e:for(;m.hasNext;){var j=m.move();for(h.setElement(e,j.otherUnit,j.otherIndex);h.hasNext;){var P=h.move();if((P.otherUnit!==t||P.otherIndex!==r)&&"O"===Object(u.i)(P.otherUnit,P.otherIndex)&&2===P.order){l=-1;break e}}}}v&&(x=Math.max(0,2-y+l)),O=_&&!S?Object(s.b)(b+x-l+1):Object(s.b)(b+x-l+2);break;case"S":g&&(v||(l=y<=3&&0===Object(u.d)(e,t,r,"O")?y-2:0)),v&&y<2&&(x=Math.max(0,2-y+l)),y<=3&&(O=Object(s.b)(b+x-l+2));break;case"F":case"CL":case"BR":case"I":case"AT":g&&(l=y-1);break;case"LI":case"NA":case"K":case"RB":case"CS":case"FR":g&&(l=1-y);break;case"BE":case"MG":case"CA":case"SR":case"BA":case"RA":g&&(l=2-y);break;default:c.a&&console.warn("Requested charge, protonation for an unhandled element",a)}return[l,x,x+i,O]}function v(e,t,r){var n,i=t.elements.length,a=new Int8Array(i),o=new Int8Array(i),s=new Int8Array(i),u=new Int8Array(i),c=!!e.parent;if(c){var d=e.root.unitMap.get(t.id);if((n=l.SortedArray.indicesOf(d.elements,t.elements)).length!==t.elements.length)throw new Error("expected to find an index for every element");t=d,e=e.root}for(var f=0;f<i;++f){var p=g(e,t,c?n[f]:f,r),m=p[0],h=p[1],v=p[2],b=p[3];a[f]=m,o[f]=h,s[f]=v,u[f]=b}return{charge:a,implicitH:o,totalH:s,idealGeometry:u}}var b={assignCharge:i.ParamDefinition.Select("auto",[["always","always"],["auto","auto"],["never","never"]]),assignH:i.ParamDefinition.Select("auto",[["always","always"],["auto","auto"],["never","never"]])};function y(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var e,o,s,u,c,l;return Object(n.__generator)(this,(function(d){for(e=Object(n.__assign)(Object(n.__assign)({},i.ParamDefinition.getDefaultValues(b)),r),o=new Map,s=0,u=t.units.length;s<u;++s)c=t.units[s],a.Unit.isAtomic(c)&&(l=v(t,c,e),o.set(c.id,l));return[2,o]}))}))}var _=r(212),S=r(66),x=Object(n.__assign)({},b),O=_.a.createProvider({label:"Valence Model",descriptor:Object(S.CustomPropertyDescriptor)({name:"molstar_computed_valence_model"}),type:"local",defaultParams:x,getParams:function(e){return x},isApplicable:function(e){return!0},obtain:function(e,t,r){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var a,o;return Object(n.__generator)(this,(function(s){switch(s.label){case 0:return a=Object(n.__assign)(Object(n.__assign)({},i.ParamDefinition.getDefaultValues(x)),r),o={},[4,y(e.runtime,t,a)];case 1:return[2,(o.value=s.sent(),o)]}}))}))}})},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(20),i=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n.pending=!1,n}return n.a(t,e),t.prototype.schedule=function(e,t){if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,n=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(n,r,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(n,this.id,t),this},t.prototype.requestAsyncId=function(e,t,r){return void 0===r&&(r=0),setInterval(e.flush.bind(e,this),r)},t.prototype.recycleAsyncId=function(e,t,r){if(void 0===r&&(r=0),null!==r&&this.delay===r&&!1===this.pending)return t;clearInterval(t)},t.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var r=this._execute(e,t);if(r)return r;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,t){var r=!1,n=void 0;try{this.work(e)}catch(e){r=!0,n=!!e&&e||new Error(e)}if(r)return this.unsubscribe(),n},t.prototype._unsubscribe=function(){var e=this.id,t=this.scheduler,r=t.actions,n=r.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==n&&r.splice(n,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null},t}(function(e){function t(t,r){return e.call(this)||this}return n.a(t,e),t.prototype.schedule=function(e,t){return void 0===t&&(t=0),this},t}(r(76).a))},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return f})),r.d(t,"c",(function(){return p}));var n=r(0),i=r(4),a=r(24),o=r(2),s=r(114),u=Object(a.Color)(16448250),c=Object(n.__assign)({asymId:o.ParamDefinition.Select("auth",o.ParamDefinition.arrayToOptions(["auth","label"]))},Object(s.b)({type:"colors",colorList:"many-distinct"}));function l(e,t){var r=function(e,t){switch(e.kind){case 0:return"auth"===t?i.StructureProperties.chain.auth_asym_id:i.StructureProperties.chain.label_asym_id;case 1:case 2:return i.StructureProperties.coarse.asym_id}}(e.unit,t)(e);return e.structure.root.models.length>1?d(e.unit.model,r):r}function d(e,t){return t+"|"+((i.Model.Index.get(e).value||0)+1)}function f(e,t){var r,n;if(e.structure){var a=i.StructureElement.Location.create(e.structure.root),o=function(e,t){for(var r=new Map,n=function(n){var a=i.Model.AsymIdOffset.get(n).value,o=("auth"===t?null==a?void 0:a.auth:null==a?void 0:a.label)||0,s=0;n.properties.structAsymMap.forEach((function(i,a){var u=i.auth_id,c="auth"===t?u:a,l=e.models.length>1?d(n,c):c;r.has(l)||(r.set(l,s+o),++s)}))},a=0,o=e.models;a<o.length;a++){n(o[a])}return r}(e.structure.root,t.asymId),c=Array.from(o.keys()),p=Object(s.a)(o.size,t,{valueLabel:function(e){return c[e]}});n=p.legend,r=function(e){var r=void 0;if(i.StructureElement.Location.is(e)){var n=l(e,t.asymId);r=o.get(n)}else if(i.Bond.isLocation(e)){a.unit=e.aUnit,a.element=e.aUnit.elements[e.aIndex];n=l(a,t.asymId);r=o.get(n)}return void 0===r?u:p.color(r)}}else r=function(){return u};return{factory:f,granularity:"group",color:r,props:t,description:"Gives every chain a color based on its `asym_id` value.",legend:n}}var p={name:"chain-id",label:"Chain Id",category:"Chain Property",factory:f,getParams:function(e){var t,r=o.ParamDefinition.clone(c);return(null===(t=e.structure)||void 0===t?void 0:t.models.some((function(e){return e.coarseHierarchy.isDefined})))&&(r.asymId.defaultValue="label"),r},defaultValues:o.ParamDefinition.getDefaultValues(c),isApplicable:function(e){return!!e.structure}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return v})),r.d(t,"a",(function(){return b}));var n=r(0),i=r(271),a=r(172),o=r(35),s=r(1),u=r(82),c=r(38),l=r(47),d=r(91),f=r(9),p=r(2),m=r(158),h=r(54),g=Object(n.__assign)(Object(n.__assign)({},c.a.Params),{alpha:Object(n.__assign)(Object(n.__assign)({},c.a.Params.alpha),{defaultValue:.33}),ignoreLight:Object(n.__assign)(Object(n.__assign)({},c.a.Params.ignoreLight),{defaultValue:!0}),colorX:p.ParamDefinition.Color(l.a.red,{isEssential:!0}),colorY:p.ParamDefinition.Color(l.a.green,{isEssential:!0}),colorZ:p.ParamDefinition.Color(l.a.blue,{isEssential:!0}),scale:p.ParamDefinition.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0})}),v={axes:p.ParamDefinition.MappedStatic("on",{on:p.ParamDefinition.Group(g),off:p.ParamDefinition.Group({})},{cycle:!0,description:"Show camera orientation axes"})},b=function(){function e(e,t){void 0===t&&(t={}),this.webgl=e,this.props={axes:{name:"off",params:{}}},this.scene=i.a.create(e),this.camera=new a.a,s.Vec3.set(this.camera.up,0,1,0),s.Vec3.set(this.camera.target,0,0,0),this.setProps(t)}return e.prototype.setProps=function(e){var t=this;this.props=Object(m.a)(this.props,(function(r){if(void 0!==e.axes&&(r.axes.name=e.axes.name,"on"===e.axes.name)){t.scene.clear();var i=Object(n.__assign)(Object(n.__assign)({},e.axes.params),{scale:e.axes.params.scale*t.webgl.pixelRatio});t.renderObject=function(e){var t=function(e,t){var r=100*e.scale,n=function(e,t){var r=o.a.createState(512,256,t),n=.05*e,i=s.Vec3.scale(Object(s.Vec3)(),s.Vec3.unitX,e),a=s.Vec3.scale(Object(s.Vec3)(),s.Vec3.unitY,e),c=s.Vec3.scale(Object(s.Vec3)(),s.Vec3.unitZ,e),l={radiusTop:n,radiusBottom:n,radialSegments:32};return r.currentGroup=0,Object(u.a)(r,s.Vec3.origin,n,2),r.currentGroup=1,Object(u.a)(r,i,n,2),Object(d.a)(r,s.Vec3.origin,i,1,l),r.currentGroup=2,Object(u.a)(r,a,n,2),Object(d.a)(r,s.Vec3.origin,a,1,l),r.currentGroup=3,Object(u.a)(r,c,n,2),Object(d.a)(r,s.Vec3.origin,c,1,l),o.a.getMesh(r)}(r,null==t?void 0:t.geometry);n.setBoundingSphere(f.g.create(s.Vec3.create(r/2,r/2,r/2),r+r/4));return h.a.create("axes",{},n,(function(t){switch(t){case 1:return e.colorX;case 2:return e.colorY;case 3:return e.colorZ;default:return l.a.grey}}),(function(){return 1}),(function(){return""}))}(e);return h.a.createRenderObject(t,e)}(i),t.renderObject.state.noClip=!0,t.scene.add(t.renderObject),t.scene.commit(),s.Vec3.set(t.camera.position,0,0,200*i.scale),s.Mat4.lookAt(t.camera.view,t.camera.position,t.camera.target,t.camera.up),r.axes.params=Object(n.__assign)({},e.axes.params)}}))},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return"on"===this.props.axes.name},enumerable:!1,configurable:!0}),e.prototype.update=function(e){if(this.renderObject){!function(e,t,r){var n=e.near,i=e.far,a=-t.width/2,o=t.width/2,u=t.height/2,c=-t.height/2,l=(o-a)/2,d=(u-c)/2,f=(o+a)/2,p=(u+c)/2,m=f-l,h=f+l,g=p+d,v=p-d;if(r.enabled){var b=(o-a)/r.width,y=(u-c)/r.height;m+=b*r.offsetX,h=m+b*r.width,g-=y*r.offsetY,v=g-y*r.height}s.Mat4.ortho(e.projection,m,h,g,v,n,i)}(this.camera,e.viewport,e.viewOffset),s.Mat4.extractRotation(this.scene.view,e.view);var t=this.renderObject.values.boundingSphere.ref.value.radius;s.Mat4.setTranslation(this.scene.view,s.Vec3.create(-e.viewport.width/2+t,-e.viewport.height/2+t,0))}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(104);function i(e){return!Object(n.a)(e)&&e-parseFloat(e)+1>=0}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(44),i=r(165);function a(){return a.zero()}!function(e){function t(){var e=[.1,0,0];return e[0]=0,e}e.zero=t,e.create=function(e,r,n){var i=t();return i[0]=e,i[1]=r,i[2]=n,i};var r=[0,0,0];e.fromColor=function(e,t){return i.a.toHcl(e,i.a.fromColor(r,t))},e.fromLab=function(e,t){return i.a.toHcl(e,t)};var a=[0,0,0];function o(e,t){var r=t[0],i=t[1],a=t[2];return isNaN(r)&&(r=0),r=Object(n.c)(r),e[0]=a,e[1]=Math.cos(r)*i,e[2]=Math.sin(r)*i,e}function s(e,t,r){return e[0]=t[0],e[1]=Math.max(0,t[1]+l*r),e[2]=t[2],e}e.toColor=function(e){return i.a.toColor(o(a,e))},e.toLab=o,e.copy=function(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},e.saturate=s,e.desaturate=function(e,t,r){return s(e,t,-r)};var u=[0,0,0];function c(e,t,r){return o(u,t),i.a.toHcl(e,i.a.darken(u,u,r))}e.darken=c,e.lighten=function(e,t,r){return c(e,t,-r)};var l=18}(a||(a={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(20),i=r(62),a=r(215),o=function(e){function t(t){var r=e.call(this)||this;return r._value=t,r}return n.a(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),t.prototype._subscribe=function(t){var r=e.prototype._subscribe.call(this,t);return r&&!r.closed&&t.next(this._value),r},t.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new a.a;return this._value},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)},t}(i.a)},function(e,t,r){"use strict";r.d(t,"e",(function(){return y})),r.d(t,"a",(function(){return _})),r.d(t,"d",(function(){return S})),r.d(t,"c",(function(){return x})),r.d(t,"g",(function(){return O})),r.d(t,"b",(function(){return w})),r.d(t,"f",(function(){return C}));var n,i,a,o,s,u=r(0),c=r(1),l=r(137),d=r(153),f=Object(c.Vec3)(),p=Object(c.Vec3)(),m=Object(c.Vec3)(),h=Object(c.Vec3)(),g=Object(c.Vec3)(),v=Object(c.Vec3)(),b={height:1,topCap:!0,bottomCap:!0};function y(e,t){var r=e.length/3;if(r<3)throw new Error("need at least 3 points to build a prism");var n=Object(u.__assign)(Object(u.__assign)({},b),t),i=n.height,a=n.topCap,o=n.bottomCap,s=2*r,d=4*r,y=(a?1:0)+(o?1:0);3===r?(s+=y,d+=3*y):4===r?(s+=2*y,d+=4*y):(s+=y*r,d+=y*r*3);var _=Object(l.a)(s,d),S=.5*i;c.Vec3.set(f,0,0,-S),c.Vec3.set(p,0,0,S);for(var x=0;x<r;++x){var O=(x+1)%r;c.Vec3.set(m,e[3*x],e[3*x+1],-S),c.Vec3.set(h,e[3*O],e[3*O+1],-S),c.Vec3.set(g,e[3*O],e[3*O+1],S),c.Vec3.set(v,e[3*x],e[3*x+1],S),_.addQuad(m,h,g,v)}if(3===r)a&&(c.Vec3.set(m,e[0],e[1],-S),c.Vec3.set(h,e[3],e[4],-S),c.Vec3.set(g,e[6],e[7],-S),_.add(g,h,m)),o&&(c.Vec3.set(m,e[0],e[1],S),c.Vec3.set(h,e[3],e[4],S),c.Vec3.set(g,e[6],e[7],S),_.add(m,h,g));else if(4===r)a&&(c.Vec3.set(m,e[0],e[1],-S),c.Vec3.set(h,e[3],e[4],-S),c.Vec3.set(g,e[6],e[7],-S),c.Vec3.set(v,e[9],e[10],-S),_.addQuad(v,g,h,m)),o&&(c.Vec3.set(m,e[0],e[1],S),c.Vec3.set(h,e[3],e[4],S),c.Vec3.set(g,e[6],e[7],S),c.Vec3.set(v,e[9],e[10],S),_.addQuad(m,h,g,v));else for(x=0;x<r;++x){O=(x+1)%r;a&&(c.Vec3.set(m,e[3*x],e[3*x+1],-S),c.Vec3.set(h,e[3*O],e[3*O+1],-S),_.add(f,h,m)),o&&(c.Vec3.set(m,e[3*x],e[3*x+1],S),c.Vec3.set(h,e[3*O],e[3*O+1],S),_.add(m,h,p))}return _.getPrimitive()}function _(){return n||(n=y(Object(d.a)(4,!1))),n}function S(){return i||(i=y(Object(d.a)(5,!1))),i}function x(){return a||(a=y(Object(d.a)(6,!1))),a}function O(){return o||(o=y(Object(d.a)(6,!0))),o}function w(){return s||(s=y(Object(d.a)(7,!1))),s}function C(e,t){void 0===t&&(t=1);for(var r=e.length/3,n=[],i=[],a=.5*t,o=0,s=0;s<r;++s)n.push(e[3*s],e[3*s+1],-a,e[3*s],e[3*s+1],a),i.push(o,o+1),o+=2;for(s=0;s<r;++s){var u=(s+1)%r;i.push(2*s,2*u,2*s+1,2*u+1)}return{vertices:n,edges:i}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(45),i=r(131),a=r(300),o=r(235);function s(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Number.POSITIVE_INFINITY,s=null,u=e[e.length-1];return Object(i.a)(u)?(s=e.pop(),e.length>1&&"number"==typeof e[e.length-1]&&(r=e.pop())):"number"==typeof u&&(r=e.pop()),null===s&&1===e.length&&e[0]instanceof n.a?e[0]:Object(a.a)(r)(Object(o.a)(e,s))}},function(e,t,r){"use strict";r.r(t),r.d(t,"PropertyWrapper",(function(){return n}));var n,i=r(63),a=r(337),o=r(74);!function(e){e.createInfo=function(){return{timestamp_utc:Object(a.a)(new Date)}},e.defaultInfoCategory=function(e,r){return{name:e,instance:function(e){var n=r(e);return{fields:t,source:[{data:n,rowCount:1}]}}}};var t=[i.a.Field.str("updated_datetime_utc",(function(e,t){return t.timestamp_utc}))];e.tryGetInfoFromCif=function(e,t){if(o.a.is(t.sourceData)&&t.sourceData.data.frame.categoryNames.includes(e)){var r=t.sourceData.data.frame.categories[e].getField("updated_datetime_utc");if(r&&0!==r.rowCount)return{timestamp_utc:r.str(0)||Object(a.a)(new Date)}}}}(n||(n={}))},function(e,t,r){"use strict";var n;r.d(t,"a",(function(){return n})),function(e){e.message=function(e){return{type:"message",timestamp:new Date,message:e}},e.error=function(e){return{type:"error",timestamp:new Date,message:e}},e.warning=function(e){return{type:"warning",timestamp:new Date,message:e}},e.info=function(e){return{type:"info",timestamp:new Date,message:e}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0),i=r(1),a=r(6);function o(){return o.zero()}!function(e){function t(e){return void 0!==e.extrema}function r(e,t){return{center:e,radius:t}}function o(e,t){var r;return void 0!==e.extrema?(e.extrema.length=0,(r=e.extrema).push.apply(r,t)):e.extrema=t,e}e.hasExtrema=t,e.create=r,e.zero=function(){return{center:Object(i.Vec3)(),radius:0}},e.clone=function(e){var n=r(i.Vec3.clone(e.center),e.radius);return t(e)&&(n.extrema=e.extrema.map((function(e){return i.Vec3.clone(e)}))),n},e.set=function(e,t,r){return i.Vec3.copy(e.center,t),e.radius=r,e},e.copy=function(e,r){return i.Vec3.copy(e.center,r.center),e.radius=r.radius,t(r)&&o(e,r.extrema.map((function(e){return i.Vec3.clone(e)}))),e},e.setExtrema=o,e.computeBounding=function(e){for(var t=e.x,r=e.y,n=e.z,o=e.indices,s=0,u=0,c=0,l=0,d=a.OrderedSet.size(o),f=0;f<d;f++){s+=t[p=a.OrderedSet.getAt(o,f)],u+=r[p],c+=n[p]}for(d>0&&(s/=d,u/=d,c/=d),f=0;f<d;f++){var p,m=t[p=a.OrderedSet.getAt(o,f)]-s,h=r[p]-u,g=n[p]-c,v=m*m+h*h+g*g;v>l&&(l=v)}return{center:i.Vec3.create(s,u,c),radius:Math.sqrt(l)}},e.transform=function(e,r,n){return i.Vec3.transformMat4(e.center,r.center,n),e.radius=r.radius*i.Mat4.getMaxScaleOnAxis(n),t(r)&&o(e,r.extrema.map((function(e){return i.Vec3.transformMat4(Object(i.Vec3)(),e,n)}))),e},e.translate=function(e,r,n){return i.Vec3.add(e.center,r.center,n),t(r)&&o(e,r.extrema.map((function(e){return i.Vec3.add(Object(i.Vec3)(),e,n)}))),e},e.toArray=function(e,t,r){i.Vec3.toArray(e.center,t,r),t[r+3]=e.radius},e.fromArray=function(e,t,r){return i.Vec3.fromArray(e.center,t,r),e.radius=t[r+3],e},e.fromBox3D=function(t,r){return i.Vec3.scale(t.center,i.Vec3.add(t.center,r.max,r.min),.5),t.radius=i.Vec3.distance(t.center,r.max),e.setExtrema(t,[i.Vec3.create(r.min[0],r.min[1],r.min[2]),i.Vec3.create(r.max[0],r.max[1],r.max[2]),i.Vec3.create(r.max[0],r.min[1],r.min[2]),i.Vec3.create(r.min[0],r.max[1],r.max[2]),i.Vec3.create(r.min[0],r.min[1],r.max[2]),i.Vec3.create(r.max[0],r.min[1],r.max[2]),i.Vec3.create(r.max[0],r.max[1],r.min[2]),i.Vec3.create(r.min[0],r.max[1],r.min[2])]),t},e.fromAxes3D=function(e,t){return i.Vec3.copy(e.center,t.origin),e.radius=Math.max(i.Vec3.magnitude(t.dirA),i.Vec3.magnitude(t.dirB),i.Vec3.magnitude(t.dirC)),e};var s=Object(i.Vec3)();e.fromDimensionsAndTransform=function(t,r,n){var a=r[0],o=r[1],u=r[2],c=i.Vec3.create(0,0,0);i.Vec3.transformMat4(c,c,n);var l=i.Vec3.create(a,o,u);i.Vec3.transformMat4(l,l,n);var d=i.Vec3.create(a,0,0);i.Vec3.transformMat4(d,d,n);var f=i.Vec3.create(0,o,u);i.Vec3.transformMat4(f,f,n);var p=i.Vec3.create(0,0,u);i.Vec3.transformMat4(p,p,n);var m=i.Vec3.create(a,0,u);i.Vec3.transformMat4(m,m,n);var h=i.Vec3.create(a,o,0);i.Vec3.transformMat4(h,h,n);var g=i.Vec3.create(0,o,0);i.Vec3.transformMat4(g,g,n),i.Vec3.add(s,c,l),i.Vec3.scale(s,s,.5);var v=Math.max(i.Vec3.distance(c,l),i.Vec3.distance(d,f));return e.set(t,s,v/2),e.setExtrema(t,[c,l,d,f,p,m,h,g]),t};var u=Object(i.Vec3)();e.addVec3=function(t,r,n){return i.Vec3.distance(r.center,n)<r.radius?e.copy(t,r):(i.Vec3.sub(u,r.center,n),i.Vec3.sub(u,r.center,u),i.Vec3.setMagnitude(u,u,r.radius),i.Vec3.scale(t.center,i.Vec3.add(u,u,n),.5),t.radius=i.Vec3.distance(t.center,n),t)},e.expandBySphere=function(e,r,a){return i.Vec3.copy(e.center,r.center),e.radius=Math.max(r.radius,i.Vec3.distance(r.center,a.center)+a.radius),t(r)&&t(a)&&o(e,Object(n.__spreadArrays)(r.extrema.map((function(e){return i.Vec3.clone(e)})),a.extrema.map((function(e){return i.Vec3.clone(e)})))),e};var c=Object(i.Vec3)();e.expand=function(e,r,n){var a,s;return i.Vec3.copy(e.center,r.center),e.radius=r.radius+n,r.radius<1e-12||(null!==(s=null===(a=r.extrema)||void 0===a?void 0:a.length)&&void 0!==s?s:0)<=1?(e.extrema=void 0,e):(t(r)&&o(e,r.extrema.map((function(e){i.Vec3.sub(c,e,r.center);var t=i.Vec3.distance(r.center,e);return i.Vec3.normalize(c,c),i.Vec3.scaleAndAdd(Object(i.Vec3)(),r.center,c,t+n)}))),e)},e.exactEquals=function(e,t){return e.radius===t.radius&&i.Vec3.exactEquals(e.center,t.center)},e.equals=function(e,t){var r=e.radius,n=t.radius;return Math.abs(r-n)<=i.EPSILON*Math.max(1,Math.abs(r),Math.abs(n))&&i.Vec3.equals(e.center,t.center)},e.includes=function(e,r){if(t(r)){for(var n=0,a=r.extrema;n<a.length;n++){var o=a[n];if(i.Vec3.distance(e.center,o)>e.radius)return!1}return!0}return i.Vec3.distance(e.center,r.center)+r.radius<=e.radius},e.overlaps=function(e,t){return i.Vec3.distance(e.center,t.center)<=e.radius+t.radius},e.distance=function(e,t){return i.Vec3.distance(e.center,t.center)-e.radius+t.radius}}(o||(o={}))},function(e,t,r){"use strict";var n,i=r(0),a=r(6),o=r(12),s=r(9),u=r(1),c=r(17),l=r(192),d=r(173),f=r(118),p=r(37),m=r(95),h=r(176);function g(e,t,r,n,i,a){var o=e.spacegroup,c=e.ncsOperators,l=[],d=o.cell.toFractional,f=u.Vec3.transformMat4(Object(u.Vec3)(),a,d),p=s.e.getSymmetryOperatorRef(o,t,r,n,i,f);if(c&&c.length)for(var m=0,h=c.length;m<h;++m){var g=c[m],v=u.Mat4.mul(Object(u.Mat4)(),p.matrix,g.matrix),b=s.h.create(p.name+" "+g.name,v,{assembly:p.assembly,ncsId:g.ncsId,hkl:p.hkl,spgrOp:p.spgrOp});l.push(b)}else l.push(p);return l}function v(e,t,r,n){var i=e.spacegroup,a=e.ncsOperators,o=a&&a.length||0,c=[];!o&&t[0]<=0&&r[0]>=0&&t[1]<=0&&r[1]>=0&&t[2]<=0&&r[2]>=0&&(c[0]=s.e.getSymmetryOperator(i,0,0,0,0));for(var l=i.cell.toFractional,d=u.Vec3.transformMat4(Object(u.Vec3)(),n,l),f=0;f<i.operators.length;f++)for(var p=t[0];p<=r[0];p++)for(var m=t[1];m<=r[1];m++)for(var h=t[2];h<=r[2];h++)(o||0!==f||0!==p||0!==m||0!==h)&&c.push.apply(c,g(e,f,p,m,h,d));return c}function b(e,t){for(var r=f.a.Builder({label:e.label}),n=e.units,i=0,a=t;i<a.length;i++)for(var o=a[i],s=0,u=n;s<u.length;s++){var c=u[s];r.addWithOperator(c,o)}return r.getStructure()}!function(e){function t(e,t){return e.invariantId===t.invariantId&&e.model.id===t.model.id&&a.SortedArray.areEqual(e.elements,t.elements)}function r(){return Object(o.b)(p.a.hashUnit,t)}e.buildAssembly=function(e,t){var r=this;return c.b.create("Build Assembly",(function(n){return Object(i.__awaiter)(r,void 0,void 0,(function(){var r,n,a,o,c,p,m,h,g,v,b,y,_,S,x,O;return Object(i.__generator)(this,(function(i){if(1!==(r=e.models).length)throw new Error("Can only build assemblies from structures based on 1 model.");if(!(n=l.d.findAssembly(r[0],t)))throw new Error("Assembly '"+t+"' is not defined.");for(a=s.h.create(n.id,u.Mat4.identity(),{assembly:{id:n.id,operId:0,operList:[]}}),o=f.a.Builder({coordinateSystem:a,label:e.label}),c=new d.b(e),p=0,m=n.operatorGroups;p<m.length;p++)if(h=m[p],g=h.selector(c),0!==d.d.structureCount(g))for(v=d.d.unionStructure(g).units,b=0,y=h.operators;b<y.length;b++)for(_=y[b],S=0,x=v;S<x.length;S++)O=x[S],o.addWithOperator(O,_);return[2,o.getStructure()]}))}))}))},e.buildSymmetryAssembly=function(e,t,r){var n=this;return c.b.create("Build Symmetry Assembly",(function(a){return Object(i.__awaiter)(n,void 0,void 0,(function(){var n,a,o,c,l,p,m,v,b,y,_,S,x,O,w,C,j,P,E,A,D,T,I,M,k;return Object(i.__generator)(this,(function(i){if(1!==(n=e.models).length)throw new Error("Can only build symmetry assemblies from structures based on 1 model.");for(a=Object(u.Vec3)(),o=f.a.Builder({label:e.label,representativeModel:n[0]}),c=new d.b(e),l=0,p=t;l<p.length;l++)if(m=p[l],B=m.asymIds,v=d.a.generators.atoms({chainTest:d.a.pred.and(d.a.pred.eq((function(e){return h.a.unit.operator_name(e.element)}),s.h.DefaultName),d.a.pred.inSet((function(e){return h.a.chain.label_asym_id(e.element)}),B))}),b=v(c),0!==d.d.structureCount(b))for(y=d.d.unionStructure(b).units,_=0,S=m.operators;_<S.length;_++)for(x=S[_],O=x.index,w=x.shift,C=w[0],j=w[1],P=w[2],E=g(r,O,C,j,P,a),A=0,D=y;A<D.length;A++)for(T=D[A],I=0,M=E;I<M.length;I++)k=M[I],o.addWithOperator(T,k);var B;return[2,o.getStructure()]}))}))}))},e.builderSymmetryMates=function(e,t){return c.b.create("Find Symmetry Mates",(function(r){return function(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){function n(e,t){return e.invariantId+"|"+t.name}var a,o,c,d,p,h,g,b,y,_,S,x,O,w,C,j,P,E,A,D,T;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if(1!==(a=t.models).length)throw new Error("Can only build symmetries from structures based on 1 model.");return(o=m.a.Provider.get(a[0]))?(c=o.spacegroup,s.f.isZero(c.cell)?[2,t]:e.shouldUpdate?[4,e.update("Initialing...")]:[3,2]):[2,t];case 1:i.sent(),i.label=2;case 2:d=l.b.getCenter(a[0]),p=function(e,t){if(e._operators_333&&u.Vec3.equals(t,e._operators_333.ref))return e._operators_333.operators;return e._operators_333={ref:u.Vec3.clone(t),operators:v(e,u.Vec3.create(-3,-3,-3),u.Vec3.create(3,3,3),t)},e._operators_333.operators}(o,d),h=t.lookup3d,g=new Set,b=f.a.Builder({label:t.label}),y=t.units,_=u.Vec3.zero(),S=0,x=p,i.label=3;case 3:if(!(S<x.length))return[3,6];for(O=x[S],w=0,C=y;w<C.length;w++)for(j=C[w],P=j.lookup3d.boundary.sphere,u.Vec3.transformMat4(_,P.center,O.matrix),E=h.findUnitIndices(_[0],_[1],_[2],P.radius+r),A=0,D=E.count;A<D;A++)y[E.indices[A]].lookup3d.check(_[0],_[1],_[2],P.radius+r)&&(T=n(j,O),g.has(T)||(b.addWithOperator(j,O),g.add(T)));return e.shouldUpdate?[4,e.update("Building symmetry...")]:[3,5];case 4:i.sent(),i.label=5;case 5:return S++,[3,3];case 6:return[2,b.getStructure()]}}))}))}(r,e,t)}))},e.buildSymmetryRange=function(e,t,r){return c.b.create("Build Symmetry",(function(n){return function(e,t,r,n){return Object(i.__awaiter)(this,void 0,void 0,(function(){var e,a,o,u,c;return Object(i.__generator)(this,(function(i){if(1!==(e=t.models).length)throw new Error("Can only build symmetries from structures based on 1 model.");return(a=m.a.Provider.get(e[0]))?(o=a.spacegroup,s.f.isZero(o.cell)?[2,t]:(u=l.b.getCenter(e[0]),c=v(a,r,n,u),[2,b(t,c)])):[2,t]}))}))}(0,e,t,r)}))},e.buildNcs=function(e){return c.b.create("Build NCS",(function(t){return function(e,t){return Object(i.__awaiter)(this,void 0,void 0,(function(){var e,r,n;return Object(i.__generator)(this,(function(i){if(1!==(e=t.models).length)throw new Error("Can only build NCS from structures based on 1 model.");return(r=m.a.Provider.get(e[0]))&&(n=r.ncsOperators)&&n.length?[2,b(t,n)]:[2,t]}))}))}(0,e)}))},e.areUnitsEquivalent=t,e.UnitEquivalenceBuilder=r,e.computeTransformGroups=function(e){for(var t=r(),n=0,i=e.units;n<i.length;n++){var a=i[n];t.add(a.id,a)}for(var o=[],s=0,u=t.groups;s<u.length;s++){var c=u[s];o.push(p.a.SymmetryGroup(c.map((function(t){return e.unitMap.get(t)}))))}return o},e.areTransformGroupsEquivalent=function(e,t){if(e.length!==t.length)return!1;for(var r=0,n=e.length;r<n;++r){var i=e[r].units,a=t[r].units;if(i.length!==a.length)return!1;if(e[r].hashCode!==t[r].hashCode)return!1;for(var o=0,s=i.length;o<s;o++)if(i[o].conformation!==a[o].conformation)return!1}return!0}}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(e){this.frames=e,this.frameCount=e.length,this.representative=e[0],this.duration=e.length}return e.prototype.getFrameAtIndex=function(e){return this.frames[e]},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(265),i=r(355);function a(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Object(i.a)()(n.a.apply(void 0,e))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(1),i=r(6),a=r(250);function o(){return o.zero()}!function(e){function t(){return{min:Object(n.Vec3)(),max:Object(n.Vec3)()}}function r(e,t){return n.Vec3.copy(e.min,t.min),n.Vec3.copy(e.max,t.max),e}function o(t,r){e.setEmpty(t);for(var n=0,i=r.length;n<i;n++)e.add(t,r[n]);return t}function s(e,t){return n.Vec3.sub(e,t.max,t.min)}e.create=function(e,t){return{min:e,max:t}},e.zero=t,e.copy=r,e.clone=function(e){return r(t(),e)},e.fromSphere3D=function(e,t){if(a.a.hasExtrema(t))return o(e,t.extrema);var r=n.Vec3.create(t.radius,t.radius,t.radius);return n.Vec3.sub(e.min,t.center,r),n.Vec3.add(e.max,t.center,r),e},e.fromVec3Array=o,e.computeBounding=function(e){for(var t=n.Vec3.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=n.Vec3.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),a=e.x,o=e.y,s=e.z,u=e.indices,c=0,l=i.OrderedSet.size(u);c<l;c++){var d=i.OrderedSet.getAt(u,c);t[0]=Math.min(a[d],t[0]),t[1]=Math.min(o[d],t[1]),t[2]=Math.min(s[d],t[2]),r[0]=Math.max(a[d],r[0]),r[1]=Math.max(o[d],r[1]),r[2]=Math.max(s[d],r[2])}return{min:t,max:r}},e.size=s;var u=Object(n.Vec3)();function c(e){return n.Vec3.set(e.min,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),n.Vec3.set(e.max,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),e}function l(e,t){return n.Vec3.min(e.min,e.min,t),n.Vec3.max(e.max,e.max,t),e}e.volume=function(e){return s(u,e),u[0]*u[1]*u[2]},e.setEmpty=c,e.add=l,e.expand=function(e,t,r){return n.Vec3.sub(e.min,t.min,r),n.Vec3.add(e.max,t.max,r),e},e.scale=function(e,t,r){return n.Vec3.scale(e.min,t.min,r),n.Vec3.scale(e.max,t.max,r),e};var d=Object(n.Vec3)();e.transform=function(e,t,r){var i=t.min,a=i[0],o=i[1],s=i[2],u=t.max,f=u[0],p=u[1],m=u[2];return c(e),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,a,o,s),r)),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,a,o,m),r)),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,a,p,s),r)),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,a,p,m),r)),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,f,o,s),r)),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,f,o,m),r)),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,f,p,s),r)),l(e,n.Vec3.transformMat4(d,n.Vec3.set(d,f,p,m),r)),e},e.containsVec3=function(e,t){return!(t[0]<e.min[0]||t[0]>e.max[0]||t[1]<e.min[1]||t[1]>e.max[1]||t[2]<e.min[2]||t[2]>e.max[2])}}(o||(o={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),i=r(57),a=function(){function e(t){this.map=t;var r=0,i=[],a=new Map,o=new Map;this.map.forEach((function(t){t.forEach((function(t){r+=t.edgeCount,t.connectedIndices.forEach((function(r){t.getEdges(r).forEach((function(s){var u=t.unitA,c=t.unitB,l=e.getEdgeKey(r,u,s.indexB,c);a.set(l,i.length);var d=e.getVertexKey(r,u),f=o.get(d);void 0===f?o.set(d,[i.length]):f.push(i.length),i.push(Object(n.__assign)(Object(n.__assign)({},s),{indexA:r,unitA:u,unitB:c}))}))}))}))})),this.edgeCount=r,this.edges=i,this.edgeKeyIndex=a,this.vertexKeyIndex=o}return e.prototype.getConnectedUnits=function(e){return this.map.has(e)?this.map.get(e):o},e.prototype.getEdgeIndex=function(t,r,n,i){var a=e.getEdgeKey(t,r,n,i),o=this.edgeKeyIndex.get(a);return void 0!==o?o:-1},e.prototype.hasEdge=function(e,t,r,n){return-1!==this.getEdgeIndex(e,t,r,n)},e.prototype.getEdge=function(e,t,r,n){var i=this.getEdgeIndex(e,t,r,n);return-1!==i?this.edges[i]:void 0},e.prototype.getEdgeIndices=function(t,r){return this.vertexKeyIndex.get(e.getVertexKey(t,r))||[]},e}();!function(e){var t=function(){function e(e,t,r,n,i){this.unitA=e,this.unitB=t,this.edgeCount=r,this.connectedIndices=n,this.edgeMap=i}return e.prototype.hasEdges=function(e){return this.edgeMap.has(e)},e.prototype.getEdges=function(e){return this.edgeMap.has(e)?this.edgeMap.get(e):o},Object.defineProperty(e.prototype,"areUnitsOrdered",{get:function(){return this.unitA<this.unitB},enumerable:!1,configurable:!0}),e}();function r(e,t,r){e.has(t)?e.get(t).push(r):e.set(t,[r])}e.UnitPairEdges=t,e.getEdgeKey=function(e,t,r,n){return e+"|"+t+"|"+r+"|"+n},e.getVertexKey=function(e,t){return e+"|"+t};var n=function(){function e(){this.map=new Map}return e.prototype.startUnitPair=function(e,t){this.uA=e,this.uB=t,this.mapAB=new Map,this.mapBA=new Map,this.linkedA=i.c.create(),this.linkedB=i.c.create(),this.linkCount=0},e.prototype.finishUnitPair=function(){0!==this.linkCount&&(r(this.map,this.uA,new t(this.uA,this.uB,this.linkCount,this.linkedA.array,this.mapAB)),r(this.map,this.uB,new t(this.uB,this.uA,this.linkCount,this.linkedB.array,this.mapBA)))},e.prototype.add=function(e,t,n){r(this.mapAB,e,{indexB:t,props:n}),r(this.mapBA,t,{indexB:e,props:n}),i.c.add(this.linkedA,e,e),i.c.add(this.linkedB,t,t),this.linkCount+=1},e.prototype.getMap=function(){return this.map},e}();e.Builder=n}(a||(a={}));var o=[]},function(e,t,r){"use strict";r.d(t,"a",(function(){return g})),r.d(t,"c",(function(){return v})),r.d(t,"b",(function(){return b}));var n,i,a,o=r(1),s=r(137),u=r(153),c=r(190),l=Object(o.Vec3)(),d=Object(o.Vec3)(),f=Object(o.Vec3)(),p=Object(o.Vec3)(),m=Object(u.a)(4,!0);function h(e){for(var t=e?36:24,r=Object(s.a)(12,t),n=0;n<4;++n){var i=(n+1)%4;o.Vec3.set(l,m[3*n],m[3*n+1],-.5),o.Vec3.set(d,m[3*i],m[3*i+1],-.5),o.Vec3.set(f,m[3*i],m[3*i+1],.5),o.Vec3.set(p,m[3*n],m[3*n+1],.5),e?r.add(l,d,f):r.addQuad(l,d,f,p)}return o.Vec3.set(l,m[0],m[1],-.5),o.Vec3.set(d,m[3],m[4],-.5),o.Vec3.set(f,m[6],m[7],-.5),o.Vec3.set(p,m[9],m[10],-.5),e?r.add(f,d,l):r.addQuad(p,f,d,l),o.Vec3.set(l,m[0],m[1],.5),o.Vec3.set(d,m[3],m[4],.5),o.Vec3.set(f,m[6],m[7],.5),o.Vec3.set(p,m[9],m[10],.5),e?r.add(l,d,f):r.addQuad(l,d,f,p),r.getPrimitive()}function g(){return n||(n=h(!1)),n}function v(){return i||(i=h(!0)),i}function b(){return a||(a=Object(c.b)([.5,.5,-.5,-.5,.5,-.5,-.5,-.5,-.5,.5,-.5,-.5,.5,.5,.5,-.5,.5,.5,-.5,-.5,.5,.5,-.5,.5],[0,4,1,5,2,6,3,7,0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4])),a}},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return l})),r.d(t,"c",(function(){return d}));var n=r(0),i=r(24),a=r(4),o=r(2),s=r(114),u=Object(i.Color)(13421772),c=Object(n.__assign)({},Object(s.b)({type:"colors",colorList:"many-distinct"}));function l(e,t){var r,n;if(e.structure){var i=function(e){for(var t=new Map,r=0,n=e.units.length;r<n;++r){var i=e.units[r].conformation.operator.name;t.has(i)||t.set(i,t.size)}return t}(e.structure.root),o=Array.from(i.keys()),c=Object(s.a)(i.size,t,{valueLabel:function(e){return o[e]}});n=c.legend,r=function(e){var t=void 0;if(a.StructureElement.Location.is(e)){var r=e.unit.conformation.operator.name;t=i.get(r)}else if(a.Bond.isLocation(e)){var n=e.aUnit.conformation.operator.name;t=i.get(n)}return void 0===t?u:c.color(t)}}else r=function(){return u};return{factory:l,granularity:"instance",color:r,props:t,description:"Assigns a color based on the operator name of a transformed chain.",legend:n}}var d={name:"operator-name",label:"Operator Name",category:"Symmetry",factory:l,getParams:function(e){return o.ParamDefinition.clone(c)},defaultValues:o.ParamDefinition.getDefaultValues(c),isApplicable:function(e){return!!e.structure}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return c})),r.d(t,"d",(function(){return l})),r.d(t,"c",(function(){return d}));var n=r(314),i={H:"Hydrogen",HE:"Helium",LI:"Lithium",BE:"Beryllium",B:"Boron",C:"Carbon",N:"Nitrogen",O:"Oxygen",F:"Fluorine",NE:"Neon",NA:"Sodium",MG:"Magnesium",AL:"Aluminum",SI:"Silicon",P:"Phosphorus",S:"Sulfur",CL:"Chlorine",AR:"Argon",K:"Potassium",CA:"Calcium",SC:"Scandium",TI:"Titanium",V:"Vanadium",CR:"Chromium",MN:"Manganese",FE:"Iron",CO:"Cobalt",NI:"Nickel",CU:"Copper",ZN:"Zinc",GA:"Gallium",GE:"Germanium",AS:"Arsenic",SE:"Selenium",BR:"Bromine",KR:"Krypton",RB:"Rubidium",SR:"Strontium",Y:"Yttrium",ZR:"Zirconium",NB:"Niobium",MO:"Molybdenum",TC:"Technetium",RU:"Ruthenium",RH:"Rhodium",PD:"Palladium",AG:"Silver",CD:"Cadmium",IN:"Indium",SN:"Tin",SB:"Antimony",TE:"Tellurium",I:"Iodine",XE:"Xenon",CS:"Cesium",BA:"Barium",LA:"Lanthanum",CE:"Cerium",PR:"Praseodymium",ND:"Neodymium",PM:"Promethium",SM:"Samarium",EU:"Europium",GD:"Gadolinium",TB:"Terbium",DY:"Dysprosium",HO:"Holmium",ER:"Erbium",TM:"Thulium",YB:"Ytterbium",LU:"Lutetium",HF:"Hafnium",TA:"Tantalum",W:"Wolfram",RE:"Rhenium",OS:"Osmium",IR:"Iridium",PT:"Platinum",AU:"Gold",HG:"Mercury",TL:"Thallium",PB:"Lead",BI:"Bismuth",PO:"Polonium",AT:"Astatine",RN:"Radon",FR:"Francium",RA:"Radium",AC:"Actinium",TH:"Thorium",PA:"Protactinium",U:"Uranium",NP:"Neptunium",PU:"Plutonium",AM:"Americium",CM:"Curium",BK:"Berkelium",CF:"Californium",ES:"Einsteinium",FM:"Fermium",MD:"Mendelevium",NO:"Nobelium",LR:"Lawrencium",RF:"Rutherfordium",DB:"Dubnium",SG:"Seaborgium",BH:"Bohrium",HS:"Hassium",MT:"Meitnerium",DS:"Darmstadtium",RG:"Roentgenium",CN:"Copernicium",NH:"Nihonium",FL:"Flerovium",MC:"Moscovium",LV:"Livermorium",TS:"Tennessine",OG:"Oganesson"},a=new Set(["LI","NA","K","RB","CS","FR"]);var o=new Set(["BE","MG","CA","SR","BA","RA"]);new Set(["C","P","S","SE"]);new Set(["H","N","O","F","CL","BR","I"]);new Set(["HE","NE","AR","KR","XE","RN"]);var s=new Set(["ZN","GA","CD","IN","SN","HG","TI","PB","BI","PO","CN"]);new Set(["B","SI","GE","AS","SB","TE","AT"]);var u=new Set(["F","CL","BR","I","AT"]);function c(e){return u.has(e)}function l(e){var t=Object(n.a)(e);return t>=21&&t<=29||t>=39&&t<=47||t>=72&&t<=79||t>=104&&t<=108}function d(e){return function(e){return a.has(e)}(e)||function(e){return o.has(e)}(e)||function(e){var t=Object(n.a)(e);return t>=57&&t<=71}(e)||function(e){var t=Object(n.a)(e);return t>=89&&t<=103}(e)||l(e)||function(e){return s.has(e)}(e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(384),i=r(261),a=r(205),o=r(211),s=r(383),u=r(385),c=r(309),l=function(e){if(e&&"function"==typeof e[o.a])return l=e,function(e){var t=l[o.a]();if("function"!=typeof t.subscribe)throw new TypeError("Provided object does not correctly implement Symbol.observable");return t.subscribe(e)};if(Object(s.a)(e))return Object(n.a)(e);if(Object(u.a)(e))return r=e,function(e){return r.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,i.a),e};if(e&&"function"==typeof e[a.a])return t=e,function(e){for(var r=t[a.a]();;){var n=void 0;try{n=r.next()}catch(t){return e.error(t),e}if(n.done){e.complete();break}if(e.next(n.value),e.closed)break}return"function"==typeof r.return&&e.add((function(){r.return&&r.return()})),e};var t,r,l,d=Object(c.a)(e)?"an invalid object":"'"+e+"'";throw new TypeError("You provided "+d+" where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.")}},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureComponentManager",(function(){return T}));var n=r(0),i=r(30),a=r(106),o=r(4),s=r(159),u=r(224),c=r(17),l=r(5),d=r(47),f=r(87),p=r(2),m=r(116),h=r(378),g=r(167),v=r(89),b=r(206),y=r(85),_=r(31),S=r(13),x=r(23);function O(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var s=this;return Object(n.__generator)(this,(function(u){switch(u.label){case 0:return[4,w(e,t,(function(e,t,u){return Object(n.__awaiter)(s,void 0,void 0,(function(){var s,c,l,d,f;return Object(n.__generator)(this,(function(p){switch(p.label){case 0:return a&&a.length>0&&!a.includes(t.params.values.type.name)?[2]:(s=t.obj.data.source.data,[4,i(s.root)]);case 1:return c=p.sent(),x.Loci.isEmpty(c)?[2]:(l={bundle:o.StructureElement.Bundle.fromLoci(c),groups:r},u?(d=Object(n.__spreadArrays)(u.params.values.layers,[l]),f=C(d,s),e.to(u).update(y.a.toBundle(f))):(f=C([l],s),e.to(t.transform.ref).apply(_.StateTransforms.Representation.ClippingStructureRepresentation3DFromBundle,y.a.toBundle(f),{tags:"clipping-controls"})),[2])}}))}))}))];case 1:return u.sent(),[2]}}))}))}function w(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,o,s,u,c,l,d,f;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:i=e.state.data,a=i.build(),o=0,s=t,n.label=1;case 1:if(!(o<s.length))return[3,6];u=s[o],c=0,l=u.representations,n.label=2;case 2:return c<l.length?(d=l[c],f=i.select(S.StateSelection.Generators.ofTransformer(_.StateTransforms.Representation.ClippingStructureRepresentation3DFromBundle,d.cell.transform.ref).withTag("clipping-controls")),[4,r(a,d.cell,f[0])]):[3,5];case 3:n.sent(),n.label=4;case 4:return c++,[3,2];case 5:return o++,[3,1];case 6:return[2,a.commit({doNotUpdateCurrent:!0})]}}))}))}function C(e,t){var r=y.a.ofBundle(e,t.root),n=y.a.merge(r);return y.a.filter(n,t)}var j=r(141);function P(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var s=this;return Object(n.__generator)(this,(function(u){switch(u.label){case 0:return[4,E(e,t,(function(e,t,u){return Object(n.__awaiter)(s,void 0,void 0,(function(){var s,c,l,d,f;return Object(n.__generator)(this,(function(p){switch(p.label){case 0:return a&&a.length>0&&!a.includes(t.params.values.type.name)?[2]:(s=t.obj.data.source.data,[4,i(s.root)]);case 1:return c=p.sent(),x.Loci.isEmpty(c)?[2]:(l={bundle:o.StructureElement.Bundle.fromLoci(c),value:r},u?(d=Object(n.__spreadArrays)(u.params.values.layers,[l]),f=A(d,s),e.to(u).update(j.a.toBundle(f))):(f=A([l],s),e.to(t.transform.ref).apply(_.StateTransforms.Representation.TransparencyStructureRepresentation3DFromBundle,j.a.toBundle(f),{tags:"transparency-controls"})),[2])}}))}))}))];case 1:return u.sent(),[2]}}))}))}function E(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,o,s,u,c,l,d,f;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:i=e.state.data,a=i.build(),o=0,s=t,n.label=1;case 1:if(!(o<s.length))return[3,6];u=s[o],c=0,l=u.representations,n.label=2;case 2:return c<l.length?(d=l[c],f=i.select(S.StateSelection.Generators.ofTransformer(_.StateTransforms.Representation.TransparencyStructureRepresentation3DFromBundle,d.cell.transform.ref).withTag("transparency-controls")),[4,r(a,d.cell,f[0])]):[3,5];case 3:n.sent(),n.label=4;case 4:return c++,[3,2];case 5:return o++,[3,1];case 6:return[2,a.commit({doNotUpdateCurrent:!0})]}}))}))}function A(e,t){var r=j.a.ofBundle(e,t.root),n=j.a.merge(r);return j.a.filter(n,t)}var D=r(327),T=function(e){function t(r){var n=e.call(this,{options:p.ParamDefinition.getDefaultValues(t.OptionsParams)})||this;return n.plugin=r,n.events={optionsUpdated:n.ev()},n}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"currentStructures",{get:function(){return this.plugin.managers.structure.hierarchy.selection.structures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pivotStructure",{get:function(){return this.currentStructures[0]},enumerable:!1,configurable:!0}),t.prototype.setOptions=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,o,s,u,c,l=this;return Object(n.__generator)(this,(function(d){for(t=e.interactions!==this.state.options.interactions,this.updateState({options:e}),this.events.optionsUpdated.next(),r=this.dataState.build(),i=0,a=this.currentStructures;i<a.length;i++)for(o=a[i],s=0,u=o.components;s<u.length;s++)c=u[s],this.updateReprParams(r,c);return[2,this.plugin.dataTransaction((function(){return Object(n.__awaiter)(l,void 0,void 0,(function(){return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,r.commit()];case 1:return n.sent(),[4,this.plugin.state.updateBehavior(D.StructureFocusRepresentation,(function(t){t.ignoreHydrogens=!e.showHydrogens}))];case 2:return n.sent(),t?[4,this.updateInterationProps()]:[3,4];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))}))]}))}))},t.prototype.updateReprParams=function(e,t){for(var r=this.state.options,n=r.showHydrogens,i=r.visualQuality,a=!n,o=0,s=t.representations;o<s.length;o++){var u=s[o];if(u.cell.transform.transformer===b.StructureRepresentation3D){var c=u.cell.transform.params;!!c.type.params.ignoreHydrogens===a&&c.type.params.quality===i||e.to(u.cell).update((function(e){e.type.params.ignoreHydrogens=a,e.type.params.quality=i}))}}},t.prototype.updateInterationProps=function(){var e,t,r;return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,o,s,u,c,l,d,f=this;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:i=0,o=this.currentStructures,n.label=1;case 1:return i<o.length?(s=o[i],u=a.a.getParams(null===(e=s.cell.obj)||void 0===e?void 0:e.data),s.properties?(c=null===(t=s.properties.cell.transform.params)||void 0===t?void 0:t.properties[a.a.descriptor.name],p.ParamDefinition.areEqual(u,c,this.state.options.interactions)?[3,5]:[4,this.dataState.build().to(s.properties.cell).update((function(e){e.properties[a.a.descriptor.name]=f.state.options.interactions})).commit()]):[3,3]):[3,6];case 2:return n.sent(),[3,5];case 3:return l=this.plugin.customStructureProperties.getParams(null===(r=s.cell.obj)||void 0===r?void 0:r.data),d=p.ParamDefinition.getDefaultValues(l),p.ParamDefinition.areEqual(u,d.properties[a.a.descriptor.name],this.state.options.interactions)?[3,5]:(d.properties[a.a.descriptor.name]=this.state.options.interactions,[4,this.plugin.builders.structure.insertStructureProperties(s.cell,d)]);case 4:n.sent(),n.label=5;case 5:return i++,[3,1];case 6:return[2]}}))}))},t.prototype.applyPreset=function(e,t,r){var i=this;return this.plugin.dataTransaction((function(){return Object(n.__awaiter)(i,void 0,void 0,(function(){var i,a,o,s;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:i=0,a=e,n.label=1;case 1:return i<a.length?(o=a[i],[4,this.plugin.builders.structure.representation.applyPreset(o.cell,t,r)]):[3,5];case 2:return s=n.sent(),[4,this.syncPreset(o,s)];case 3:n.sent(),n.label=4;case 4:return i++,[3,1];case 5:return[2]}}))}))}),{canUndo:"Preset"})},t.prototype.syncPreset=function(e,t){if(!t||!t.components)return this.clearComponents([e]);var r=new Set;if(Object(f.c)(t.components,(function(e){e&&r.add(e.ref)})),t.representations&&Object(f.c)(t.representations,(function(e){e&&r.add(e.ref)})),0===r.size)return this.clearComponents([e]);for(var n=!1,i=this.dataState.build(),a=function(e){r.has(e.cell.transform.ref)||(n=!0,i.delete(e.cell))},o=0,s=e.components;o<s.length;o++){var u=s[o];a(u);for(var c=0,l=u.representations;c<l.length;c++){a(l[c])}if(u.genericRepresentations)for(var d=0,p=u.genericRepresentations;d<p.length;d++){a(p[d])}}if(e.genericRepresentations)for(var m=0,h=e.genericRepresentations;m<h.length;m++){a(h[m])}return n?i.commit():void 0},t.prototype.clear=function(e){return this.clearComponents(e)},t.prototype.selectThis=function(e){var t,r=this.plugin.managers.structure.selection;r.clear();for(var n=0,i=e;n<i.length;n++){var a=i[n],s=o.Structure.toSubStructureElementLoci(a.structure.cell.obj.data,null===(t=a.cell.obj)||void 0===t?void 0:t.data);r.fromLoci("set",s)}},t.prototype.canBeModified=function(e){return this.plugin.builders.structure.isComponentTransform(e.cell)},t.prototype.modifyByCurrentSelection=function(e,t){var r=this;return this.plugin.runTask(c.b.create("Modify Component",(function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,o,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(r=this.dataState.build(),a=0,o=e;a<o.length;a++)s=o[a],this.canBeModified(s)&&(u=this.plugin.managers.structure.selection.getStructure(s.structure.cell.obj.data))&&0!==u.elementCount&&this.modifyComponent(r,s,u,t);return[4,this.dataState.updateTree(r,{canUndo:"Modify Selection"}).runInContext(i)];case 1:return n.sent(),[2]}}))}))})))},t.prototype.toggleVisibility=function(e,t){if(0!==e.length)if(t)for(var r=e[0].representations.indexOf(t),n=(o=!t.cell.state.isHidden,0),i=e;n<i.length;n++){var a=(l=i[n]).representations[r];a&&Object(u.setSubtreeVisibility)(this.dataState,a.cell.transform.ref,o)}else for(var o=!e[0].cell.state.isHidden,s=0,c=e;s<c.length;s++){var l=c[s];Object(u.setSubtreeVisibility)(this.dataState,l.cell.transform.ref,o)}},t.prototype.removeRepresentations=function(e,t){if(0!==e.length){var r=[];if(t){var n=e[0].representations.indexOf(t);if(n<0)return;for(var i=0,a=e;i<a.length;i++){(u=a[i]).representations[n]&&r.push(u.representations[n])}}else for(var o=0,s=e;o<s.length;o++)for(var u,c=0,l=(u=s[o]).representations;c<l.length;c++){var d=l[c];r.push(d)}return this.plugin.managers.structure.hierarchy.remove(r,!0)}},t.prototype.updateRepresentations=function(e,t,r){if(0===e.length)return Promise.resolve();var n=e[0].representations.indexOf(t);if(n<0)return Promise.resolve();for(var i=this.dataState.build(),a=0,o=e;a<o.length;a++){var s=o[a].representations[n];s&&(s.cell.transform.transformer===t.cell.transform.transformer&&i.to(s.cell).update(r))}return i.commit({canUndo:"Update Representation"})},t.prototype.updateRepresentationsTheme=function(e,t){var r,n,i,a;if(0!==e.length){for(var o=this.dataState.build(),s=0,u=e;s<u.length;s++)for(var c=u[s],l=function(e){var s=e.cell.transform.params,u="function"==typeof t?t(c,e):t,l="default"===u.color?Object(g.createStructureColorThemeParams)(d.plugin,null===(r=c.structure.cell.obj)||void 0===r?void 0:r.data,null==s?void 0:s.type.name):u.color?Object(g.createStructureColorThemeParams)(d.plugin,null===(n=c.structure.cell.obj)||void 0===n?void 0:n.data,null==s?void 0:s.type.name,u.color,u.colorParams):void 0,f="default"===u.size?Object(g.createStructureSizeThemeParams)(d.plugin,null===(i=c.structure.cell.obj)||void 0===i?void 0:i.data,null==s?void 0:s.type.name):u.color?Object(g.createStructureSizeThemeParams)(d.plugin,null===(a=c.structure.cell.obj)||void 0===a?void 0:a.data,null==s?void 0:s.type.name,u.size,u.sizeParams):void 0;(l||f)&&o.to(e.cell).update((function(e){l&&(e.colorTheme=l),f&&(e.sizeTheme=f)}))},d=this,f=0,p=c.representations;f<p.length;f++){l(p[f])}return o.commit({canUndo:"Update Theme"})}},t.prototype.addRepresentation=function(e,t){var r=this;if(0!==e.length){var i=this.state.options,a={ignoreHydrogens:!i.showHydrogens,quality:i.visualQuality};return this.plugin.dataTransaction((function(){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,i,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:r=0,i=e,n.label=1;case 1:return r<i.length?(o=i[r],[4,this.plugin.builders.structure.representation.addRepresentation(o.cell,{type:this.plugin.representation.structure.registry.get(t),typeParams:a})]):[3,4];case 2:n.sent(),n.label=3;case 3:return r++,[3,1];case 4:return[2]}}))}))}),{canUndo:"Add Representation"})}},t.prototype.tryFindComponent=function(e,t){var r=this;if(0!==e.components.length)return this.plugin.runTask(c.b.create("Find Component",(function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,u,c,l,d,f,p,m,h;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return(r=null===(m=e.cell.obj)||void 0===m?void 0:m.data)?(c=(u=o.StructureSelection).unionStructure,[4,t.getSelection(this.plugin,i,r)]):[2];case 1:for(a=c.apply(u,[n.sent()]),l=0,d=e.components;l<d.length;l++)if(f=d[l],(p=null===(h=f.cell.obj)||void 0===h?void 0:h.data)&&f.cell.parent&&Object(s.a)(a,p))return[2,f.cell];return[2]}}))}))})))},t.prototype.add=function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r=this;return Object(n.__generator)(this,(function(i){return[2,this.plugin.dataTransaction((function(){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,i,a,o,s,u,c,d,f,p;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(0===(r=t||this.currentStructures).length)return[2];i=this.state.options,a=i.showHydrogens,o=i.visualQuality,s={ignoreHydrogens:!a,quality:o},u=l.c.create22(),c=0,d=r,n.label=1;case 1:return c<d.length?(f=d[c],p=void 0,e.options.checkExisting?[4,this.tryFindComponent(f,e.selection)]:[3,3]):[3,8];case 2:p=n.sent(),n.label=3;case 3:return p?[3,5]:[4,this.plugin.builders.structure.tryCreateComponentFromSelection(f.cell,e.selection,u,{label:e.options.label||(e.selection===v.b.current?"Custom Selection":"")})];case 4:p=n.sent(),n.label=5;case 5:return"none"!==e.representation&&p?[4,this.plugin.builders.structure.representation.addRepresentation(p,{type:this.plugin.representation.structure.registry.get(e.representation),typeParams:s})]:[3,7];case 6:n.sent(),n.label=7;case 7:return c++,[3,1];case 8:return[2]}}))}))}),{canUndo:"Add Selection"})]}))}))},t.prototype.applyTheme=function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r=this;return Object(n.__generator)(this,(function(i){return[2,this.plugin.dataTransaction((function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,s,u,c,l,d=this;return Object(n.__generator)(this,(function(f){switch(f.label){case 0:if(0===(r=t||this.currentStructures).length)return[2];a=function(t){return Object(n.__awaiter)(d,void 0,void 0,(function(){var r,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return a=(r=o.StructureSelection).toLociWithSourceUnits,[4,e.selection.getSelection(this.plugin,i,t)];case 1:return[2,a.apply(r,[n.sent()])]}}))}))},s=0,u=r,f.label=1;case 1:return s<u.length?(c=u[s],"reset"!==e.action.name?[3,3]:[4,Object(h.setStructureOverpaint)(this.plugin,c.components,-1,a,e.representations)]):[3,10];case 2:return f.sent(),[3,9];case 3:return"color"!==e.action.name?[3,5]:(l=e.action.params,[4,Object(h.setStructureOverpaint)(this.plugin,c.components,l.color,a,e.representations)]);case 4:return f.sent(),[3,9];case 5:return"transparency"!==e.action.name?[3,7]:(l=e.action.params,[4,P(this.plugin,c.components,l.value,a,e.representations)]);case 6:return f.sent(),[3,9];case 7:return"clipping"!==e.action.name?[3,9]:(l=e.action.params,[4,O(this.plugin,c.components,y.a.Groups.fromNames(l.excludeGroups),a,e.representations)]);case 8:f.sent(),f.label=9;case 9:return s++,[3,1];case 10:return[2]}}))}))}),{canUndo:"Apply Theme"})]}))}))},t.prototype.modifyComponent=function(e,t,r,n){var i,a,u,c=null===(i=t.cell.obj)||void 0===i?void 0:i.data;if(c&&("subtract"!==n&&"intersect"!==n||Object(s.b)(c,r))){var l=null===(a=t.structure.cell.obj)||void 0===a?void 0:a.data,d="union"===n?Object(s.e)(l,[c,r]):"intersect"===n?Object(s.c)(c,r):Object(s.d)(c,r);if(0===d.elementCount)e.delete(t.cell.transform.ref);else{var f={type:{name:"bundle",params:o.StructureElement.Bundle.fromSubStructure(l,d)},nullIfEmpty:!0,label:null===(u=t.cell.obj)||void 0===u?void 0:u.label};e.to(t.cell).update(f)}}},t.prototype.updateLabel=function(e,t){var r,n,i={type:null===(r=e.cell.params)||void 0===r?void 0:r.values.type,nullIfEmpty:null===(n=e.cell.params)||void 0===n?void 0:n.values.nullIfEmpty,label:t};this.dataState.build().to(e.cell).update(i).commit()},Object.defineProperty(t.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),t.prototype.clearComponents=function(e){for(var t=this.dataState.build(),r=0,n=e;r<n.length;r++)for(var i=0,a=n[r].components;i<a.length;i++){var o=a[i];t.delete(o.cell.transform.ref)}return t.commit({canUndo:"Clear Selections"})},t}(m.b);!function(e){function t(e,t){var r,n;return(null===(r=null==t?void 0:t.cell.obj)||void 0===r?void 0:r.data)?e.representation.structure.registry.getApplicableTypes(null===(n=t.cell.obj)||void 0===n?void 0:n.data):e.representation.structure.registry.types}function r(e,r,i,a){var o=Object(n.__spreadArrays)(i,t(e,r));return p.ParamDefinition.Select(o[0][0],o,{label:a})}e.OptionsParams={showHydrogens:p.ParamDefinition.Boolean(!0,{description:"Toggle display of hydrogen atoms in representations"}),visualQuality:p.ParamDefinition.Select("auto",i.b,{description:"Control the visual/rendering quality of representations"}),interactions:p.ParamDefinition.Group(a.a.defaultParams,{label:"Non-covalent Interactions"})},e.getAddParams=function(e,t){var i=e.query.structure.registry.options;return t=Object(n.__assign)({pivot:e.managers.structure.component.pivotStructure,allowNone:!0,hideSelection:!1,checkExisting:!1},t),{selection:p.ParamDefinition.Select(i[1][0],i,{isHidden:null==t?void 0:t.hideSelection}),representation:r(e,null==t?void 0:t.pivot,(null==t?void 0:t.allowNone)?[["none","< Create Later >"]]:[]),options:p.ParamDefinition.Group({label:p.ParamDefinition.Text(""),checkExisting:p.ParamDefinition.Boolean(!!(null==t?void 0:t.checkExisting),{help:function(){return{description:"Checks if a selection with the specifield elements already exists to avoid creating duplicate components."}}})})}},e.getThemeParams=function(e,r){var n=e.query.structure.registry.options;return{selection:p.ParamDefinition.Select(n[1][0],n,{isHidden:!1}),action:p.ParamDefinition.MappedStatic("color",{color:p.ParamDefinition.Group({color:p.ParamDefinition.Color(d.a.blue,{isExpanded:!0})},{isFlat:!0}),reset:p.ParamDefinition.EmptyGroup({label:"Reset Color"}),transparency:p.ParamDefinition.Group({value:p.ParamDefinition.Numeric(.5,{min:0,max:1,step:.01})},{isFlat:!0}),clipping:p.ParamDefinition.Group({excludeGroups:p.ParamDefinition.MultiSelect([],p.ParamDefinition.objectToOptions(y.a.Groups.Names))},{isFlat:!0})}),representations:p.ParamDefinition.MultiSelect([],t(e,r),{emptyValue:"All"})}},e.getRepresentationTypes=t}(T||(T={}))},function(e,t,r){"use strict";function n(e){setTimeout((function(){throw e}),0)}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return n}));var n,i="0.3.0";!function(e){e.getDataType=function(e){return e instanceof Int8Array?1:e instanceof Int16Array?2:e instanceof Int32Array?3:e instanceof Uint8Array?4:e instanceof Uint16Array?5:e instanceof Uint32Array?6:e instanceof Float32Array?32:e instanceof Float64Array?33:3},e.isSignedIntegerDataType=function(e){if(e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array)return!0;for(var t=0,r=e.length;t<r;t++)if(t<0)return!1;return!0}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return m}));var n=r(63),i=r(28),a=(n.a.Field,n.a.Encodings),o=i.e.chain.label_asym_id;var s=i.e.chain.auth_asym_id;var u=n.a.fields().str("group_PDB",i.e.residue.group_PDB).index("id").str("type_symbol",i.e.atom.type_symbol).str("label_atom_id",i.e.atom.label_atom_id).str("label_comp_id",i.e.atom.label_comp_id).int("label_seq_id",i.e.residue.label_seq_id,{encoder:a.deltaRLE,valueKind:function(e,t){var r=e.unit.model;return r.atomicHierarchy.residues.label_seq_id.valueKind(r.atomicHierarchy.residueAtomSegments.index[e.element])}}).str("label_alt_id",i.e.atom.label_alt_id).str("pdbx_PDB_ins_code",i.e.residue.pdbx_PDB_ins_code).str("label_asym_id",(function(e){var t=o(e),r=e.unit.conformation.operator.suffix;return r?t+r:t})).str("label_entity_id",i.e.chain.label_entity_id).float("Cartn_x",i.e.atom.x,{digitCount:3,encoder:a.fixedPoint3}).float("Cartn_y",i.e.atom.y,{digitCount:3,encoder:a.fixedPoint3}).float("Cartn_z",i.e.atom.z,{digitCount:3,encoder:a.fixedPoint3}).float("occupancy",i.e.atom.occupancy,{digitCount:2,encoder:a.fixedPoint2}).float("B_iso_or_equiv",i.e.atom.B_iso_or_equiv,{digitCount:2,encoder:a.fixedPoint2}).int("pdbx_formal_charge",i.e.atom.pdbx_formal_charge,{encoder:a.deltaRLE,valueKind:function(e,t){return e.unit.model.atomicHierarchy.atoms.pdbx_formal_charge.valueKind(e.element)}}).str("auth_atom_id",i.e.atom.auth_atom_id).str("auth_comp_id",i.e.atom.auth_comp_id).int("auth_seq_id",i.e.residue.auth_seq_id,{encoder:a.deltaRLE}).str("auth_asym_id",(function(e){var t=s(e),r=e.unit.conformation.operator.suffix;return r?t+r:t})).int("pdbx_PDB_model_num",i.e.unit.model_num,{encoder:a.deltaRLE}).getFields(),c={name:"atom_site",instance:function(e){var t=e.structures;return{fields:u,source:t.map((function(e){return{data:e,rowCount:e.elementCount,keys:function(){return e.elementLocations()}}}))}}};function l(e,t){return e?e+"_"+t:t}function d(e){return e?"pdbx_"+e+"_PDB_ins_code":"pdbx_PDB_ins_code"}function f(e,t){return function(r,n){return t(e(r,n))}}function p(e,t,r){r&&r.includeModelNum&&e.int("pdbx_PDB_model_num",f(t,i.e.unit.model_num))}function m(e,t){var r=t&&t.prefix,o=n.a.fields().str(l(r,"label_comp_id"),f(e,i.e.atom.label_comp_id)).int(l(r,"label_seq_id"),f(e,i.e.residue.label_seq_id),{encoder:a.deltaRLE,valueKind:function(t,r){var n=e(t,r),i=n.unit.model;return i.atomicHierarchy.residues.label_seq_id.valueKind(i.atomicHierarchy.residueAtomSegments.index[n.element])}}).str(d(r),f(e,i.e.residue.pdbx_PDB_ins_code)).str(l(r,"label_asym_id"),f(e,i.e.chain.label_asym_id)).str(l(r,"label_entity_id"),f(e,i.e.chain.label_entity_id)).str(l(r,"auth_comp_id"),f(e,i.e.atom.auth_comp_id)).int(l(r,"auth_seq_id"),f(e,i.e.residue.auth_seq_id),{encoder:a.deltaRLE}).str(l(r,"auth_asym_id"),f(e,i.e.chain.auth_asym_id));return p(o,e,t),o.getFields()}},function(e,t,r){"use strict";r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return o})),r.d(t,"e",(function(){return s})),r.d(t,"d",(function(){return u})),r.d(t,"c",(function(){return c}));var n,i=r(0),a=r(255);!function(e){e.createElementsIndex=function(e,t,r){for(var n=new Int32Array(r+1),i=new Int32Array(r),a=new Int32Array(r),o=t.members,s=t.offsets,u=0,c=2*e.edgeCount;u<c;++u){if(!((m=e.a[u])>(h=e.b[u]))){for(var l=s[m],d=s[m+1];l<d;++l)++a[o[l]];for(l=s[h],d=s[h+1];l<d;++l)++a[o[l]]}}var f=0;for(u=0;u<r;u++)n[u]=f,f+=a[u];n[r]=f;var p=new Int32Array(f);for(u=0,c=2*e.edgeCount;u<c;++u){var m,h;if(!((m=e.a[u])>(h=e.b[u]))){for(l=s[m],d=s[m+1];l<d;++l){p[n[g=o[l]]+i[g]]=u,++i[g]}for(l=s[h],d=s[h+1];l<d;++l){var g;p[n[g=o[l]]+i[g]]=u,++i[g]}}}return{indices:p,offsets:n}}}(n||(n={}));var o=function(e){function t(t,r){var n=e.call(this,t)||this,i=0,a=new Map;return n.map.forEach((function(e){e.forEach((function(e){var t=e.unitA;e.connectedIndices.forEach((function(e){for(var o,s,u,c,l=r.get(t),d=l.offsets,f=l.members,p=d[e],m=d[e+1];p<m;++p)o=f[p],s=t,u=void 0,c=void 0,u=n.getElementKey(o,s),void 0===(c=a.get(u))?a.set(u,[i]):c.push(i);i+=1}))}))})),n.elementKeyIndex=a,n}return Object(i.__extends)(t,e),t.prototype.getContactIndicesForElement=function(e,t){return this.elementKeyIndex.get(this.getElementKey(e,t.id))||[]},t.prototype.getElementKey=function(e,t){return e+"|"+t},t}(a.a);function s(e){switch(e){case 4:return"Hydrogen Bond";case 6:return"Hydrophobic Contact";case 5:return"Halogen Bond";case 1:return"Ionic Interaction";case 7:return"Metal Coordination";case 2:return"Cation-Pi Interaction";case 3:return"Pi Stacking";case 8:return"Weak Hydrogen Bond";case 0:return"Unknown Interaction"}}function u(e){switch(e){case 0:return"None";case 1:return"Positive Charge";case 2:return"Negative Charge";case 3:return"Aromatic Ring";case 4:return"Hydrogen Donor";case 5:return"Hydrogen Acceptor";case 6:return"Halogen Donor";case 7:return"Halogen Acceptor";case 8:return"HydrophobicAtom";case 9:return"Weak Hydrogen Donor";case 10:return"Ionic Type Partner";case 11:return"Dative Bond Partner";case 12:return"Transition Metal";case 13:return"Ionic Type Metal"}}function c(e){switch(e){case 0:return"None";case 1:return"Quaternary Amine";case 2:return"Tertiary Amine";case 3:return"Sulfonium";case 4:return"Sulfonic Acid";case 5:return"Sulfate";case 6:return"Phosphate";case 7:return"Halocarbon";case 8:return"Guanidine";case 9:return"Acetamidine";case 10:return"Carboxylate"}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(131),i=r(235),a=r(319);function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[e.length-1];return Object(n.a)(r)?(e.pop(),Object(a.a)(e,r)):Object(i.a)(e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(297),o=r(320),s=r(99);!function(e){var t=function(){function e(e,t,r){this.name=e,this.f=t,this.onAbort=r,this.id=u()}return e.prototype.run=function(e,t){return void 0===t&&(t=250),e?Object(a.c)(this,e,t):this.f(o.a)},e.prototype.runAsChild=function(e,t){return e.isSynchronous?this.f(o.a):Object(a.d)(e,this,t)},e.prototype.runInContext=function(e){return e.isSynchronous?this.f(o.a):Object(a.b)(e,this)},e}();function r(e){var t=e;return!!e&&"number"==typeof t.id&&"string"==typeof t.name&&!!t.run}function n(e,r,n){return new t(e,r,n)}e.is=r,e.isAbort=function(e){return!!e&&!!e.isAborted},e.Aborted=function(e){return{isAborted:!0,reason:e,toString:function(){return"Aborted"+(e?": "+e:"")}}},e.create=n,e.constant=function(e,t){var r=this;return n(e,(function(e){return Object(i.__awaiter)(r,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){return[2,t]}))}))}))},e.empty=function(){var e=this;return n("",(function(t){return Object(i.__awaiter)(e,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){return[2]}))}))}))},e.fail=function(e,t){var r=this;return n(e,(function(e){return Object(i.__awaiter)(r,void 0,void 0,(function(){return Object(i.__generator)(this,(function(e){throw new Error(t)}))}))}))},e.resolveInContext=function(e,t){return r(e)?t?e.runInContext(t):e.run():e};var u=Object(s.a)(0,1073741823)}(n||(n={}))},function(e,t,r){"use strict";function n(e,t){return e+("/"===e[e.length-1]||"/"===t[0]?"":"/")+t}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return c}));var n,i,a=r(0),o=r(109),s=r(179);function u(e){return n.classify(e)}function c(e){return i.classify(e)}!function(e){function t(e,t){return e>=0?Math.ceil((e+1)/t):Math.ceil((e+1)/(-t-1))}function r(e,r,n){var i=e.limit8,a=e.limit16;r.pack8+=t(n,i),r.pack16+=t(n,a),r.count+=1}function n(e,r){e.pack8+=t(r,127),e.pack16+=t(r,32767),e.count+=1}function i(e){return 4*e.count<2*e.pack16?{length:4*e.count,elem:4}:2*e.pack16<e.pack8?{length:2*e.pack16,elem:2}:{length:e.pack8,elem:1}}function s(e,t){for(var n={pack8:0,pack16:0,count:0},o=0,s=e.length;o<s;o++)r(t,n,e[o]);return Object(a.__assign)(Object(a.__assign)({},i(n)),{kind:"pack"})}function u(e,t){for(var r={pack8:0,pack16:0,count:0},o=e[0],s=1,u=e.length;s<u;s++)n(r,e[s]-o),o=e[s];return Object(a.__assign)(Object(a.__assign)({},i(r)),{kind:"delta"})}function c(e,t){for(var n={pack8:0,pack16:0,count:0},o=1,s=1,u=e.length;s<u;s++)e[s-1]!==e[s]?(r(t,n,e[s-1]),r(t,n,o),o=1):o++;return r(t,n,e[e.length-1]),r(t,n,o),Object(a.__assign)(Object(a.__assign)({},i(n)),{kind:"rle"})}function l(e,t){for(var r={pack8:0,pack16:0,count:0},o=1,s=0,u=0,c=1,l=e.length;c<l;c++){var d=e[c]-s;u!==d?(n(r,u),n(r,o),o=1):o++,u=d,s=e[c]}return n(r,u),n(r,o),Object(a.__assign)(Object(a.__assign)({},i(r)),{kind:"delta-rle"})}function d(e){var t=function(e){for(var t=!1,r=0,n=e.length;r<n;r++)if(e[r]<0){t=!0;break}return t?{signed:t,limit8:127,limit16:32767}:{signed:t,limit8:255,limit16:65535}}(e),r=[s(e,t),c(e,t),u(e),l(e)];return r.sort((function(e,t){return e.length-t.length})),r}e.getSize=d,e.classify=function(e){if(e.length<2)return o.b.by(o.b.byteArray);switch(d(e)[0].kind){case"pack":return o.b.by(o.b.integerPacking);case"rle":return o.b.by(o.b.runLength).and(o.b.integerPacking);case"delta":return o.b.by(o.b.delta).and(o.b.integerPacking);case"delta-rle":return o.b.by(o.b.delta).and(o.b.runLength).and(o.b.integerPacking)}throw new Error("should not happen :)")}}(n||(n={})),function(e){e.classify=function(e){var t=Object(s.a)(e,4,1e-6),r=t.mantissaDigits,i=t.integerDigits;if(r<0||r+i>10)return o.b.by(o.b.byteArray);if(0===r)return n.classify(e);for(var a=function(e){for(var t=1,r=0;r<e;r++)t*=10;return t}(r),u=new Int32Array(e.length),c=0,l=e.length;c<l;c++)u[c]=Math.round(a*e[c]);var d=n.getSize(u)[0],f=o.b.by(o.b.fixedPoint(a));switch(d.kind){case"pack":return f.and(o.b.integerPacking);case"rle":return f.and(o.b.runLength).and(o.b.integerPacking);case"delta":return f.and(o.b.delta).and(o.b.integerPacking);case"delta-rle":return f.and(o.b.delta).and(o.b.runLength).and(o.b.integerPacking)}throw new Error("should not happen :)")}}(i||(i={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(5),o=r(1),s=r(122),u=r(115),c=r(124),l=r(132),d=r(53),f=r(2),p=r(52),m=r(9),h=r(30),g=r(129),v=r(130),b=r(12),y=r(136);!function(e){function t(e,t,r,i){return i?function(e,t,r,n){return n.pointCount=r,a.e.update(n.centerBuffer,e),a.e.update(n.groupBuffer,t),n}(e,t,r,i):function(e,t,r){var i,o=Object(m.g)(),u=-1,c=-1,l={kind:"points",pointCount:r,centerBuffer:a.e.create(e),groupBuffer:a.e.create(t),get boundingSphere(){var e=n(l);if(e!==u){var t=Object(p.a)(l.centerBuffer.ref.value,l.pointCount,1);m.g.copy(o,t),u=e}return o},get groupMapping(){return l.groupBuffer.ref.version!==c&&(i=Object(s.c)(l.groupBuffer.ref.value,l.pointCount),c=l.groupBuffer.ref.version),i},setBoundingSphere:function(e){m.g.copy(o,e),u=n(l)}};return l}(e,t,r)}function r(e){return t(e?e.centerBuffer.ref.value:new Float32Array(0),e?e.groupBuffer.ref.value:new Float32Array(0),0,e)}function n(e){return Object(b.l)([e.pointCount,e.centerBuffer.ref.version,e.groupBuffer.ref.version])}function _(e,t){var r=e.pointCount,n=t.instanceCount.ref.value,i=Object(d.b)(),a=i.position,s=e.centerBuffer.ref.value,u=t.aTransform.ref.value;return Object(d.a)(r,n,1,(function(e,t){return t<0?o.Vec3.fromArray(a,s,3*e):o.Vec3.transformMat4Offset(a,s,u,0,3*e,16*t),i}))}function S(e,t,r,n,s){var d=r.instanceCount,f=r.groupCount,b=_(e,t),S=Object(u.a)(r,b,n.color),x=Object(l.a)(r,n.size),O=Object(c.a)(d*f),w=Object(g.c)(),C=Object(v.c)(),j=Object(y.d)(),P={drawCount:e.pointCount,vertexCount:e.pointCount,groupCount:f,instanceCount:d},E=m.g.clone(e.boundingSphere),A=Object(p.b)(E,t.aTransform.ref.value,d);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({aPosition:e.centerBuffer,aGroup:e.groupBuffer,boundingSphere:a.e.create(A),invariantBoundingSphere:a.e.create(E),uInvariantBoundingSphere:a.e.create(o.Vec4.ofSphere(E))},S),x),O),w),C),j),t),h.a.createValues(s,P)),{uSizeFactor:a.e.create(s.sizeFactor),dPointSizeAttenuation:a.e.create(s.pointSizeAttenuation),dPointFilledCircle:a.e.create(s.pointFilledCircle),uPointEdgeBleach:a.e.create(s.pointEdgeBleach)})}function x(e,t){h.a.updateRenderableState(e,t),e.opaque=e.opaque&&(!t.pointFilledCircle||t.pointFilledCircle&&0===t.pointEdgeBleach),e.writeDepth=e.opaque}e.create=t,e.createEmpty=r,e.transform=function(e,t){var r=e.centerBuffer.ref.value;Object(s.e)(t,r,0,e.pointCount),a.e.update(e.centerBuffer,r)},e.Params=Object(i.__assign)(Object(i.__assign)({},h.a.Params),{sizeFactor:f.ParamDefinition.Numeric(1.5,{min:0,max:10,step:.1}),pointSizeAttenuation:f.ParamDefinition.Boolean(!1),pointFilledCircle:f.ParamDefinition.Boolean(!1),pointEdgeBleach:f.ParamDefinition.Numeric(.2,{min:0,max:1,step:.05})}),e.Utils={Params:e.Params,createEmpty:r,createValues:S,createValuesSimple:function(t,r,n,a,o){var s=h.a.createSimple(n,a,o),u=Object(i.__assign)(Object(i.__assign)({},f.ParamDefinition.getDefaultValues(e.Params)),r);return S(t,s.transform,s.locationIterator,s.theme,u)},updateValues:function(e,t){h.a.updateValues(e,t),a.e.updateIfChanged(e.uSizeFactor,t.sizeFactor),a.e.updateIfChanged(e.dPointSizeAttenuation,t.pointSizeAttenuation),a.e.updateIfChanged(e.dPointFilledCircle,t.pointFilledCircle),a.e.updateIfChanged(e.uPointEdgeBleach,t.pointEdgeBleach)},updateBoundingSphere:function(e,t){var r=m.g.clone(t.boundingSphere),n=Object(p.b)(r,e.aTransform.ref.value,e.instanceCount.ref.value);m.g.equals(n,e.boundingSphere.ref.value)||a.e.update(e.boundingSphere,n);m.g.equals(r,e.invariantBoundingSphere.ref.value)||(a.e.update(e.invariantBoundingSphere,r),a.e.update(e.uInvariantBoundingSphere,o.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,r)))},createRenderableState:function(e){var t=h.a.createRenderableState(e);return x(t,e),t},updateRenderableState:x,createPositionIterator:_}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(5),o=r(2),s=r(53),u=r(115),c=r(124),l=r(52),d=r(9),f=r(132),p=r(30),m=r(129),h=r(130),g=r(12),v=r(122),b=r(136),y=r(1);!function(e){function t(e,t,r,i,o,s){return s?function(e,t,r,n,i,o){i>o.sphereCount&&(a.e.update(o.mappingBuffer,t),a.e.update(o.indexBuffer,r));return o.sphereCount=i,a.e.update(o.centerBuffer,e),a.e.update(o.groupBuffer,n),o}(e,t,r,i,o,s):function(e,t,r,i,o){var s,u=Object(d.g)(),c=-1,f=-1,p={kind:"spheres",sphereCount:o,centerBuffer:a.e.create(e),mappingBuffer:a.e.create(t),indexBuffer:a.e.create(r),groupBuffer:a.e.create(i),get boundingSphere(){var e=n(p);if(e!==c){var t=Object(l.a)(p.centerBuffer.ref.value,4*p.sphereCount,4);d.g.copy(u,t),c=e}return u},get groupMapping(){return p.groupBuffer.ref.version!==f&&(s=Object(v.c)(p.groupBuffer.ref.value,p.sphereCount,4),f=p.groupBuffer.ref.version),s},setBoundingSphere:function(e){d.g.copy(u,e),c=n(p)}};return p}(e,t,r,i,o)}function r(e){return t(e?e.centerBuffer.ref.value:new Float32Array(0),e?e.mappingBuffer.ref.value:new Float32Array(0),e?e.indexBuffer.ref.value:new Uint32Array(0),e?e.groupBuffer.ref.value:new Float32Array(0),0,e)}function n(e){return Object(g.l)([e.sphereCount,e.centerBuffer.ref.version,e.mappingBuffer.ref.version,e.indexBuffer.ref.version,e.groupBuffer.ref.version])}function _(e,t){var r=4*e.sphereCount,n=t.instanceCount.ref.value,i=Object(s.b)(),a=i.position,o=e.centerBuffer.ref.value,u=t.aTransform.ref.value;return Object(s.a)(r,n,4,(function(e,t){return t<0?y.Vec3.fromArray(a,o,3*e):y.Vec3.transformMat4Offset(a,o,u,0,3*e,16*t),i}))}function S(e,t,r,n,o){var s=r.instanceCount,g=r.groupCount;if(s!==t.instanceCount.ref.value)throw new Error("instanceCount values in TransformData and LocationIterator differ");var v=_(e,t),S=Object(u.a)(r,v,n.color),x=Object(f.a)(r,n.size),O=Object(c.a)(s*g),w=Object(m.c)(),C=Object(h.c)(),j=Object(b.d)(),P={drawCount:2*e.sphereCount*3,vertexCount:4*e.sphereCount,groupCount:g,instanceCount:s},E=Object(f.b)(x)*o.sizeFactor,A=d.g.expand(Object(d.g)(),e.boundingSphere,E),D=Object(l.b)(A,t.aTransform.ref.value,s);return Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)(Object(i.__assign)({aPosition:e.centerBuffer,aMapping:e.mappingBuffer,aGroup:e.groupBuffer,elements:e.indexBuffer,boundingSphere:a.e.create(D),invariantBoundingSphere:a.e.create(A),uInvariantBoundingSphere:a.e.create(y.Vec4.ofSphere(A))},S),x),O),w),C),j),t),{padding:a.e.create(E)}),p.a.createValues(o,P)),{uSizeFactor:a.e.create(o.sizeFactor),dDoubleSided:a.e.create(o.doubleSided),dIgnoreLight:a.e.create(o.ignoreLight),dXrayShaded:a.e.create(o.xrayShaded)})}function x(e,t){p.a.updateRenderableState(e,t),e.opaque=e.opaque&&!t.xrayShaded,e.writeDepth=e.opaque}e.create=t,e.createEmpty=r,e.Params=Object(i.__assign)(Object(i.__assign)({},p.a.Params),{sizeFactor:o.ParamDefinition.Numeric(1,{min:0,max:10,step:.1}),doubleSided:o.ParamDefinition.Boolean(!1,p.a.CustomQualityParamInfo),ignoreLight:o.ParamDefinition.Boolean(!1,p.a.ShadingCategory),xrayShaded:o.ParamDefinition.Boolean(!1,p.a.ShadingCategory)}),e.Utils={Params:e.Params,createEmpty:r,createValues:S,createValuesSimple:function(t,r,n,a,s){var u=p.a.createSimple(n,a,s),c=Object(i.__assign)(Object(i.__assign)({},o.ParamDefinition.getDefaultValues(e.Params)),r);return S(t,u.transform,u.locationIterator,u.theme,c)},updateValues:function(e,t){p.a.updateValues(e,t),a.e.updateIfChanged(e.uSizeFactor,t.sizeFactor),a.e.updateIfChanged(e.dDoubleSided,t.doubleSided),a.e.updateIfChanged(e.dIgnoreLight,t.ignoreLight),a.e.updateIfChanged(e.dXrayShaded,t.xrayShaded)},updateBoundingSphere:function(e,t){var r=Object(f.b)(e)*e.uSizeFactor.ref.value,n=d.g.expand(Object(d.g)(),t.boundingSphere,r),i=Object(l.b)(n,e.aTransform.ref.value,e.instanceCount.ref.value);d.g.equals(i,e.boundingSphere.ref.value)||a.e.update(e.boundingSphere,i);d.g.equals(n,e.invariantBoundingSphere.ref.value)||(a.e.update(e.invariantBoundingSphere,n),a.e.update(e.uInvariantBoundingSphere,y.Vec4.fromSphere(e.uInvariantBoundingSphere.ref.value,n)));a.e.update(e.padding,r)},createRenderableState:function(e){var t=p.a.createRenderableState(e);return x(t,e),t},updateRenderableState:x,createPositionIterator:_}}(n||(n={}))},function(e,t,r){"use strict";var n,i=r(121),a=r(1);!function(e){e.create=function(){return{view:a.Mat4.identity(),position:a.Vec3.create(0,0,0),direction:a.Vec3.create(0,0,-1),up:a.Vec3.create(0,1,0)}};var t=a.Vec3.zero();e.update=function(e){a.Vec3.add(t,e.position,e.direction),a.Mat4.lookAt(e.view,e.position,t,e.up)}}(n||(n={}));var o,s=r(9),u=r(57),c=function(){function e(){this.removeList=Object(u.b)(),this.removeMap=new Map,this.addList=Object(u.b)(),this.addMap=new Map}return Object.defineProperty(e.prototype,"isEmpty",{get:function(){return 0===this.removeList.count&&0===this.addList.count},enumerable:!1,configurable:!0}),e.prototype.add=function(e){if(this.removeMap.has(e)){var t=this.removeMap.get(e);this.removeMap.delete(e),this.removeList.remove(t)}if(!this.addMap.has(e)){var r=this.addList.addLast(e);this.addMap.set(e,r)}},e.prototype.remove=function(e){if(this.addMap.has(e)){var t=this.addMap.get(e);this.addMap.delete(e),this.addList.remove(t)}if(!this.removeMap.has(e)){var r=this.removeList.addLast(e);this.removeMap.set(e,r)}},e.prototype.tryGetRemove=function(){var e=this.removeList.removeFirst();return e&&this.removeMap.delete(e),e},e.prototype.tryGetAdd=function(){var e=this.addList.removeFirst();return e&&this.addMap.delete(e),e},e}(),l=r(75),d=r(29),f=r(128),p=r(12),m=new f.a("98");function h(e,t,r){m.reset();for(var n=0,i=e.length;n<i;++n)if(!r||e[n].state.visible){var a=e[n].values.boundingSphere.ref.value;a.radius&&m.includeSphere(a)}m.finishedIncludeStep();for(n=0,i=e.length;n<i;++n)if(!r||e[n].state.visible){var o=e[n].values.boundingSphere.ref.value;o.radius&&m.radiusSphere(o)}return m.getSphere(t)}function g(e,t){var r=e.getProgram("colorBlended").id,n=t.getProgram("colorBlended").id,i=e.materialId,a=t.materialId;return r!==n?r-n:i!==a?i-a:e.id-t.id}(o||(o={})).create=function(e){var t=new Map,r=[],a=Object(s.g)(),o=Object(s.g)(),u=[],f=[],m=!0,v=!0,b=n.create(),y=b.view,_=b.position,S=b.direction,x=b.up;function O(n){if(t.has(n))return console.warn("RenderObject with id '"+n.id+"' already present"),t.get(n);var a=Object(i.b)(e,n);return r.push(a),"direct-volume"===n.type?f.push(a):u.push(a),t.set(n,a),m=!0,v=!0,a}function w(e){var n=t.get(e);n&&(n.dispose(),Object(d.arraySetRemove)(r,n),Object(d.arraySetRemove)(u,n),Object(d.arraySetRemove)(f,n),t.delete(e),m=!0,v=!0)}var C=new c,j=-1;function P(){for(var e=23,t=0,n=r.length;t<n;++t)r[t].state.visible&&(e=31*e+r[t].id|0);return-1===(e=Object(p.h)(e))&&(e=0),e}function E(){return P()!==j&&(v=!0,!0)}return{view:y,position:_,direction:S,up:x,renderables:r,primitives:{view:y,position:_,direction:S,up:x,renderables:u},volumes:{view:y,position:_,direction:S,up:x,renderables:f},syncVisibility:E,update:function(e,i){var a;if(n.update(b),e)for(var o=0,s=e.length;o<s;++o)null===(a=t.get(e[o]))||void 0===a||a.update();else for(o=0,s=r.length;o<s;++o)r[o].update();i?E():(m=!0,v=!0)},add:function(e){return C.add(e)},remove:function(e){return C.remove(e)},commit:function(e){return void 0===e&&(e=Number.MAX_VALUE),function(e){for(var t=Object(l.b)(),n=0;i=C.tryGetRemove();)if(w(i),++n%100==0&&Object(l.b)()-t>e)return!1;for(;;){var i;if(!(i=C.tryGetAdd()))break;if(O(i),++n%100==0&&Object(l.b)()-t>e)return!1}return r.sort(g),!0}(e)},get needsCommit(){return!C.isEmpty},has:function(e){return t.has(e)},clear:function(){for(var e=0,n=r.length;e<n;++e)r[e].dispose();r.length=0,t.clear(),m=!0,v=!0},forEach:function(e){t.forEach(e)},get count(){return r.length},get boundingSphere(){return m&&(h(r,a,!1),m=!1),a},get boundingSphereVisible(){return v&&(h(r,o,!0),v=!1,j=P()),o}}};t.a=o},function(e,t,r){"use strict";r.d(t,"b",(function(){return v})),r.d(t,"a",(function(){return b}));var n=r(0),i=r(1),a=r(122),o={radius:1,detail:0};function s(e,t,r){var s=Object(n.__assign)(Object(n.__assign)({},o),r),u=s.radius,c=s.detail,l=function(){var e=[],t=[],r=new Map;function n(t){var n=t[0].toFixed(5)+"|"+t[1].toFixed(5)+"|"+t[2].toFixed(5),i=r.get(n);return void 0===i&&(i=e.length/3,r.set(n,i),e.push.apply(e,t)),i}return{vertices:e,indices:t,add:function(e,r,i){t.push(n(e),n(r),n(i))}}}(),d=l.vertices,f=l.indices;!function(r){for(var n=Object(i.Vec3)(),a=Object(i.Vec3)(),o=Object(i.Vec3)(),s=0;s<t.length;s+=3)i.Vec3.fromArray(n,e,3*t[s+0]),i.Vec3.fromArray(a,e,3*t[s+1]),i.Vec3.fromArray(o,e,3*t[s+2]),m(n,a,o,r)}(c),Object(a.a)(d,u);var p=new Float32Array(d.length);return Object(a.b)(d,f,p,d.length/3,f.length/3),{vertices:new Float32Array(d),normals:new Float32Array(p),indices:new Uint32Array(f)};function m(e,t,r,n){for(var a=Math.pow(2,n),o=[],s=0;s<=a;++s){o[s]=[];var u=Object(i.Vec3)();i.Vec3.lerp(u,e,r,s/a);var c=Object(i.Vec3)();i.Vec3.lerp(c,t,r,s/a);for(var d=a-s,f=0;f<=d;++f)if(0===f&&s===a)o[s][f]=u;else{var p=Object(i.Vec3)();i.Vec3.lerp(p,u,c,f/d),o[s][f]=p}}for(s=0;s<a;++s)for(f=0;f<2*(a-s)-1;++f){var m=Math.floor(f/2);f%2==0?l.add(o[s][m+1],o[s+1][m],o[s][m]):l.add(o[s][m+1],o[s+1][m+1],o[s+1][m])}}}var u,c=r(137),l=r(190),d=(1+Math.sqrt(5))/2,f=[-1,d,0,1,d,0,-1,-d,0,1,-d,0,0,-1,d,0,1,d,0,-1,-d,0,1,-d,d,0,-1,d,0,1,-d,0,-1,-d,0,1],p=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];Object(l.b)(f,[0,11,5,11,0,5,1,5,0,1,1,7,0,7,7,10,0,10,10,11,5,9,4,11,2,10,6,7,1,8,3,9,4,9,3,4,2,4,2,3,2,6,3,6,6,8,3,8,8,9,4,5,2,11,6,10,7,8,1,9]);var m=(u||(u=Object(c.b)(f,p)),u),h=m.vertices,g=m.indices;function v(e){return 10*Math.pow(Math.pow(2,e),2)+2}function b(e){return s(h,g,{detail:e,radius:1})}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(157),a=r(66),o=r(7),s=r(63),u=r(74),c=r(152);!function(e){var t,r="molstar_global_model_transform_info";function n(t){return e.Provider.get(t)}e.Schema=((t={})[r]={matrix:o.a.Schema.Matrix(4,4,o.a.Schema.float)},t),e.Descriptor=Object(a.CustomPropertyDescriptor)({name:r,cifExport:{categories:[{name:r,instance:function(t){var r=n(t.firstModel);if(!r)return s.a.Category.Empty;var i=o.d.ofRows(e.Schema.molstar_global_model_transform_info,[{matrix:r}]);return s.a.Category.ofTable(i)}}],prefix:"molstar"}}),e.Provider=i.a.create(e.Descriptor),e.attach=function(t,r){t.customProperties.has(e.Descriptor)||t.customProperties.add(e.Descriptor),e.Provider.set(t,r)},e.get=n,e.fromMmCif=function(t){if(u.a.is(t.sourceData)){var n=t.sourceData.data.frame.categories[r];if(n){var i=Object(c.c)(e.Schema[r],n);if(0!==i._rowCount)return i.matrix.value(0)}}},e.hasData=function(e){if(!u.a.is(e.sourceData))return!1;var t=e.sourceData.data.frame.categories[r];return!!t&&t.rowCount>0},e.writeMmCif=function(t,n){t.writeCategory({name:r,instance:function(){var t=o.d.ofRows(e.Schema.molstar_global_model_transform_info,[{matrix:n}]);return s.a.Category.ofTable(t)}})}}(n||(n={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"defaultBondTest",(function(){return l})),r.d(t,"atomicSequence",(function(){return d})),r.d(t,"water",(function(){return f})),r.d(t,"atomicHet",(function(){return p})),r.d(t,"spheres",(function(){return m})),r.d(t,"bundleElementImpl",(function(){return h})),r.d(t,"bundleGenerator",(function(){return g}));var n=r(6),i=r(139),a=r(28),o=r(118),s=r(39),u=r(22),c=r(352);function l(e){return u.BondType.isCovalent(e.atomicBond.type)}function d(){return function(e){for(var t=e.inputStructure,r=i.a.Location.create(t),u=[],c=0,l=t.units;c<l.length;c++){var d=l[c];if(0===d.kind){r.unit=d;var f=d.elements;if(r.element=f[0],"polymer"===a.e.entity.type(r)){for(var p=n.Segmentation.transientSegments(d.model.atomicHierarchy.residueAtomSegments,f),m=0;p.hasNext;)m++,p.move();m<8||u.push(d)}}}return s.a.Singletons(t,new o.a(u,{parent:t}))}}function f(){return function(e){for(var t=e.inputStructure,r=i.a.Location.create(t),n=[],u=0,c=t.units;u<c.length;u++){var l=c[u];if(0===l.kind){r.unit=l;var d=l.elements;r.element=d[0],"water"===a.e.entity.type(r)&&n.push(l)}}return s.a.Singletons(t,new o.a(n,{parent:t}))}}function p(){return function(e){for(var t=e.inputStructure,r=i.a.Location.create(t),u=[],c=0,l=t.units;c<l.length;c++){var d=l[c];if(0===d.kind){r.unit=d;var f=d.elements;if(r.element=f[0],"water"!==a.e.entity.type(r)){if("polymer"===a.e.entity.type(r)){for(var p=n.Segmentation.transientSegments(d.model.atomicHierarchy.residueAtomSegments,f),m=0;p.hasNext;)m++,p.move();if(m>=8)continue}u.push(d)}}}return s.a.Singletons(t,new o.a(u,{parent:t}))}}function m(){return function(e){for(var t=e.inputStructure,r=[],n=0,i=t.units;n<i.length;n++){var a=i[n];1===a.kind&&r.push(a)}return s.a.Singletons(t,new o.a(r,{parent:t}))}}function h(e,t,r){return{groupedUnits:e,ranges:t,set:r}}function g(e){return function(t){var r={hash:t.inputStructure.hashCode,elements:e};return s.a.Sequence(t.inputStructure,[c.a.toStructure(r,t.inputStructure)])}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(4),o=r(42),s=r(9),u=r(2),c=r(1),l=r(299),d=r(8),f=r(95);!function(e){function t(e,t,r,n){return Object(i.__awaiter)(this,void 0,void 0,(function(){var o,s,u,c,p,m;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return o=void 0,s=f.a.Provider.get(r),!n&&s&&0!==s.assemblies.length&&(n=s.assemblies[0].id),s&&0!==s.assemblies.length?(o=l.b.findAssembly(r,n||""))||e.log.warn("Model '"+r.entryId+"' has no assembly called '"+n+"', returning model structure."):e.log.warn("Model '"+r.entryId+"' has no assembly, returning model structure."),u=a.Structure.ofModel(r),o?(n=o.id,[4,a.StructureSymmetry.buildAssembly(u,n).runInContext(t)]):(c={label:"Model",description:a.Structure.elementDescription(u)},[2,new d.a.Molecule.Structure(u,c)]);case 1:return p=i.sent(),m={label:"Assembly "+n,description:a.Structure.elementDescription(p)},[2,new d.a.Molecule.Structure(p,m)]}}))}))}function r(e,t,r,n){return Object(i.__awaiter)(this,void 0,void 0,(function(){var o,s,u;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return o=a.Structure.ofModel(t),[4,a.StructureSymmetry.buildSymmetryRange(o,r,n).runInContext(e)];case 1:return s=i.sent(),u={label:"Symmetry ["+r+"] to ["+n+"]",description:a.Structure.elementDescription(s)},[2,new d.a.Molecule.Structure(s,u)]}}))}))}function n(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var n,o,s;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return n=a.Structure.ofModel(t),[4,a.StructureSymmetry.builderSymmetryMates(n,r).runInContext(e)];case 1:return o=i.sent(),s={label:"Symmetry Mates",description:a.Structure.elementDescription(o)},[2,new d.a.Molecule.Structure(o,s)]}}))}))}function p(e,t,r,n){return Object(i.__awaiter)(this,void 0,void 0,(function(){var o,s,u;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return o=a.Structure.ofModel(t),[4,a.StructureSymmetry.buildSymmetryAssembly(o,r,n).runInContext(e)];case 1:return s=i.sent(),u={label:"Symmetry Assembly",description:a.Structure.elementDescription(s)},[2,new d.a.Molecule.Structure(s,u)]}}))}))}e.getParams=function(e,t){var r=e&&f.a.Provider.get(e),n=r?r.assemblies.map((function(e){return[e.id,e.id+": "+Object(o.d)(e.details)]})):[],i=!r||!s.f.isZero(r.spacegroup.cell),a=[];if(r)for(var l=r.spacegroup.operators,d=0,p=l.length;d<p;d++)a.push([d,d+1+": "+s.e.getOperatorXyz(l[d])]);var m=[];e&&e.properties.structAsymMap.forEach((function(e){var t=e.id===e.auth_id?e.id:e.id+" [auth "+e.auth_id+"]";m.push([e.id,t])}));var h={auto:u.ParamDefinition.EmptyGroup(),model:u.ParamDefinition.EmptyGroup(),assembly:u.ParamDefinition.Group({id:u.ParamDefinition.Optional(e?u.ParamDefinition.Select(n.length?n[0][0]:"",n,{label:"Asm Id",description:"Assembly Id"}):u.ParamDefinition.Text("",{label:"Asm Id",description:"Assembly Id (use empty for the 1st assembly)"}))},{isFlat:!0}),"symmetry-mates":u.ParamDefinition.Group({radius:u.ParamDefinition.Numeric(5,{min:0,max:50,step:1})},{isFlat:!0}),symmetry:u.ParamDefinition.Group({ijkMin:u.ParamDefinition.Vec3(c.Vec3.create(-1,-1,-1),{step:1},{label:"Min IJK",fieldLabels:{x:"I",y:"J",z:"K"}}),ijkMax:u.ParamDefinition.Vec3(c.Vec3.create(1,1,1),{step:1},{label:"Max IJK",fieldLabels:{x:"I",y:"J",z:"K"}})},{isFlat:!0}),"symmetry-assembly":u.ParamDefinition.Group({generators:u.ParamDefinition.ObjectList({operators:u.ParamDefinition.ObjectList({index:u.ParamDefinition.Select(0,a),shift:u.ParamDefinition.Vec3(Object(c.Vec3)(),{step:1},{label:"IJK",fieldLabels:{x:"I",y:"J",z:"K"}})},(function(e){return e.index+1+"_"+e.shift.map((function(e){return e+5})).join("")}),{defaultValue:[]}),asymIds:u.ParamDefinition.MultiSelect([],m)},(function(e){return e.asymIds.length+" asym ids, "+e.operators.length+" operators"}),{defaultValue:[]})},{isFlat:!0})},g=[];return"auto"===t&&g.push(["auto","Auto"]),g.push(["model","Model"]),n.length>0&&g.push(["assembly","Assembly"]),i&&(g.push(["symmetry-mates","Symmetry Mates"]),g.push(["symmetry","Symmetry (indices)"]),g.push(["symmetry-assembly","Symmetry (assembly)"])),{type:u.ParamDefinition.MappedStatic(t||"model",h,{options:g})}},e.canAutoUpdate=function(e,t){return"symmetry-assembly"!==t.name&&("symmetry"!==t.name||"symmetry"!==e.name)},e.create=function(e,o,s,u){return Object(i.__awaiter)(this,void 0,void 0,(function(){var c,l;return Object(i.__generator)(this,(function(i){if(!(c=f.a.Provider.get(s))||!u||"model"===u.name)return l=a.Structure.ofModel(s),[2,new d.a.Molecule.Structure(l,{label:"Model",description:a.Structure.elementDescription(l)})];if("auto"===u.name)return 0===c.assemblies.length?(l=a.Structure.ofModel(s),[2,new d.a.Molecule.Structure(l,{label:"Model",description:a.Structure.elementDescription(l)})]):[2,t(e,o,s)];if("assembly"===u.name)return[2,t(e,o,s,u.params.id)];if("symmetry"===u.name)return[2,r(o,s,u.params.ijkMin,u.params.ijkMax)];if("symmetry-mates"===u.name)return[2,n(o,s,u.params.radius)];if("symmetry-assembly"===u.name)return[2,p(o,s,u.params.generators,c)];throw new Error("Unknown represetation type: "+u.name)}))}))}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return l}));var n=r(0),i=r(1),a=r(2),o=r(172),s=r(105),u={eyeSeparation:a.ParamDefinition.Numeric(.064,{min:.01,max:.5,step:.001}),focus:a.ParamDefinition.Numeric(10,{min:1,max:100,step:.01})},c=a.ParamDefinition.getDefaultValues(u),l=function(){function e(e,t){void 0===t&&(t={}),this.parent=e,this.left=new d,this.right=new d,this.props=Object(n.__assign)(Object(n.__assign)({},c),t)}return Object.defineProperty(e.prototype,"viewport",{get:function(){return this.parent.viewport},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewOffset",{get:function(){return this.parent.viewOffset},enumerable:!1,configurable:!0}),e.prototype.setProps=function(e){Object.assign(this.props,e)},e.prototype.update=function(){this.parent.update(),function(e,t,r,n){s.a.copy(r.viewport,e.viewport),i.Mat4.copy(r.view,e.view),i.Mat4.copy(r.projection,e.projection),o.a.copySnapshot(r.state,e.state),o.a.copyViewOffset(r.viewOffset,e.viewOffset),r.far=e.far,r.near=e.near,r.fogFar=e.fogFar,r.fogNear=e.fogNear,s.a.copy(n.viewport,e.viewport),i.Mat4.copy(n.view,e.view),i.Mat4.copy(n.projection,e.projection),o.a.copySnapshot(n.state,e.state),o.a.copyViewOffset(n.viewOffset,e.viewOffset),n.far=e.far,n.near=e.near,n.fogFar=e.fogFar,n.fogNear=e.fogNear;var a=Math.floor(e.viewport.width/2),u=a/e.viewport.height;r.viewport.width=a,n.viewport.x+=a,n.viewport.width-=a;var c,l,d=t.eyeSeparation/2,m=d*e.near/t.focus,h=e.near*Math.tan(.5*e.state.fov);f[12]=-d,p[12]=d,c=-h*u+m,l=h*u+m,r.projection[0]=2*e.near/(l-c),r.projection[8]=(l+c)/(l-c),i.Mat4.mul(r.view,r.view,f),i.Mat4.mul(r.projectionView,r.projection,r.view),i.Mat4.invert(r.inverseProjectionView,r.projectionView),c=-h*u-m,l=h*u-m,n.projection[0]=2*e.near/(l-c),n.projection[8]=(l+c)/(l-c),i.Mat4.mul(n.view,n.view,p),i.Mat4.mul(n.projectionView,n.projection,n.view),i.Mat4.invert(n.inverseProjectionView,n.projectionView)}(this.parent,this.props,this.left,this.right)},e}();!function(e){e.is=function(e){return"left"in e&&"right"in e}}(l||(l={}));var d=function(){this.viewport=s.a.create(0,0,0,0),this.view=Object(i.Mat4)(),this.projection=Object(i.Mat4)(),this.projectionView=Object(i.Mat4)(),this.inverseProjectionView=Object(i.Mat4)(),this.state=o.a.createDefaultSnapshot(),this.viewOffset=o.a.ViewOffset(),this.far=0,this.near=0,this.fogFar=0,this.fogNear=0},f=i.Mat4.identity(),p=i.Mat4.identity()},function(e,t,r){"use strict";r.d(t,"e",(function(){return s})),r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return f}));var n=r(0),i=r(4),a=r(74),o=r(78);function s(e,t){if(void 0===t&&(t="x-ray"),!e)return t;var r=e.models[0];return a.a.is(r.sourceData)?i.Model.hasEmMap(r)?"em":i.Model.hasXrayMap(r)?"x-ray":i.Model.isFromEm(r)?"em":i.Model.isFromXray(r)?"x-ray":t:t}function u(e,t){if(!t||!t.models.length)return[];var r=t.models[0];switch(e){case"em":return function(e){var t=[];if(!a.a.is(e.sourceData))return[e.entryId];var r=e.sourceData.data.db.pdbx_database_related,n=r.db_id,i=r.db_name,o=r.content_type;if(!i.isDefined)return[e.entryId];for(var s=0,u=i.rowCount;s<u;++s)"EMDB"===i.value(s).toUpperCase()&&"associated EM volume"===o.value(s)&&t.push(n.value(s));return t}(r);case"x-ray":return function(e){return[e.entryId]}(r)}}function c(e,t,r,i){return Object(n.__awaiter)(this,void 0,void 0,(function(){return Object(n.__generator)(this,(function(n){switch(e){case"emdb":return[2,l(t,r,i)];case"pdbe":return[2,d(t,r,i)]}return[2]}))}))}function l(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,s;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return i=e.config.get(o.PluginConfig.VolumeStreaming.EmdbHeaderServer),[4,e.fetch({url:i+"/"+r.toUpperCase()+"/header/"+r.toLowerCase()+".xml",type:"xml"}).runInContext(t)];case 1:return a=n.sent(),s=a.getElementsByTagName("map")[0],[2,parseFloat(s.getElementsByTagName("contourLevel")[0].textContent)]}}))}))}function d(e,t,r){var i,a,o;return Object(n.__awaiter)(this,void 0,void 0,(function(){var s,u,c;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=r.toUpperCase(),[4,e.fetch({url:"https://www.ebi.ac.uk/pdbe/api/emdb/entry/map/"+r,type:"json"}).runInContext(t)];case 1:return s=n.sent(),u=null==s?void 0:s[r],c=void 0,void 0!==(null===(o=null===(a=null===(i=null==u?void 0:u[0])||void 0===i?void 0:i.map)||void 0===a?void 0:a.contour_level)||void 0===o?void 0:o.value)&&(c=+u[0].map.contour_level.value),[2,c]}}))}))}function f(e,t,r){var i;return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,o,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.fetch({url:"https://www.ebi.ac.uk/pdbe/api/pdb/entry/summary/"+r,type:"json"}).runInContext(t)];case 1:if(a=n.sent(),o=null==a?void 0:a[r],s=[],!(null===(i=null==o?void 0:o[0])||void 0===i?void 0:i.related_structures))throw new Error("No related EMDB entry found for '"+r+"'.");if(!(u=o[0].related_structures.filter((function(e){return"EMDB"===e.resource&&"associated EM volume"===e.relationship}))).length)throw new Error("No related EMDB entry found for '"+r+"'.");return s.push.apply(s,u.map((function(e){return e.accession}))),[2,s]}}))}))}},function(e,t,r){"use strict";r.r(t),r.d(t,"TrajectoryViewportControls",(function(){return ce})),r.d(t,"StateSnapshotViewportControls",(function(){return le})),r.d(t,"AnimationViewportControls",(function(){return de})),r.d(t,"SelectionViewportControls",(function(){return fe})),r.d(t,"LociLabels",(function(){return pe})),r.d(t,"CustomStructureControls",(function(){return me})),r.d(t,"DefaultStructureTools",(function(){return he}));var n=r(0),i=r(3),a=r(13),o=r(17),s=r(2),u=r(220),c=r(377),l=r(275),d=r(8),f=r(31),p=r(324),m=r(119),h=r(78),g={rcsb:s.ParamDefinition.Group({encoding:s.ParamDefinition.Select("bcif",[["cif","cif"],["bcif","bcif"]])},{label:"RCSB PDB",isFlat:!0}),pdbe:s.ParamDefinition.Group({variant:s.ParamDefinition.Select("updated-bcif",[["updated-bcif","Updated (bcif)"],["updated","Updated"],["archival","Archival"]])},{label:"PDBe",isFlat:!0})};a.StateAction.build({from:d.a.Root,display:{name:"Download Structure",description:"Load a structure from the provided source and create its representation."},params:function(e,t){var r=function(e){return s.ParamDefinition.Group({type:l.a.getParams(void 0,"auto").type,representation:s.ParamDefinition.Select(u.a.auto.id,e.builders.structure.representation.getPresets().map((function(e){return[e.id,e.display.name,e.display.group]})),{description:"Which representation preset to use."}),representationParams:s.ParamDefinition.Group(u.b.CommonParams,{isHidden:!0}),asTrajectory:s.ParamDefinition.Optional(s.ParamDefinition.Boolean(!1,{description:"Load all entries into a single trajectory."}))},{isExpanded:!1})}(t),n=t.config.get(h.PluginConfig.Download.DefaultPdbProvider)||"pdbe";return{source:s.ParamDefinition.MappedStatic("pdb",{pdb:s.ParamDefinition.Group({provider:s.ParamDefinition.Group({id:s.ParamDefinition.Text("1tqn",{label:"PDB Id(s)",description:"One or more comma/space separated PDB ids."}),server:s.ParamDefinition.MappedStatic(n,g)},{pivot:"id"}),options:r},{isFlat:!0,label:"PDB"}),"pdb-dev":s.ParamDefinition.Group({provider:s.ParamDefinition.Group({id:s.ParamDefinition.Text("PDBDEV_00000001",{label:"PDBDev Id(s)",description:"One or more comma/space separated ids."}),encoding:s.ParamDefinition.Select("bcif",[["cif","cif"],["bcif","bcif"]])},{pivot:"id"}),options:r},{isFlat:!0,label:"PDBDEV"}),swissmodel:s.ParamDefinition.Group({id:s.ParamDefinition.Text("Q9Y2I8",{label:"UniProtKB AC(s)",description:"One or more comma/space separated ACs."}),options:r},{isFlat:!0,label:"SWISS-MODEL",description:"Loads the best homology model or experimental structure"}),pubchem:s.ParamDefinition.Group({id:s.ParamDefinition.Text("2244,2245",{label:"PubChem ID",description:"One or more comma/space separated IDs."}),options:r},{isFlat:!0,label:"PubChem",description:"Loads 3D conformer from PubChem."}),url:s.ParamDefinition.Group({url:s.ParamDefinition.Url(""),format:s.ParamDefinition.Select("mmcif",s.ParamDefinition.arrayToOptions(c.a.map((function(e){return e[0]})),(function(e){return e}))),isBinary:s.ParamDefinition.Boolean(!1),options:r},{isFlat:!0,label:"URL"})})}}})((function(e,t){var r=e.params,i=e.state;return o.b.create("Download Structure",(function(e){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var a,o,s,c,l,d,f;return Object(n.__generator)(this,(function(p){switch(p.label){case 0:switch(t.behaviors.layout.leftPanelTabName.next("data"),a=r.source,s=!1,c="mmcif",a.name){case"url":o=[{url:a.params.url,isBinary:a.params.isBinary}],c=a.params.format;break;case"pdb":o="pdbe"===a.params.provider.server.name?"updated"===a.params.provider.server.params.variant?v(a.params.provider.id,(function(e){return"https://www.ebi.ac.uk/pdbe/static/entry/"+e.toLowerCase()+"_updated.cif"}),(function(e){return"PDBe: "+e+" (updated cif)"}),!1):"updated-bcif"===a.params.provider.server.params.variant?v(a.params.provider.id,(function(e){return"https://www.ebi.ac.uk/pdbe/entry-files/download/"+e.toLowerCase()+".bcif"}),(function(e){return"PDBe: "+e+" (updated cif)"}),!0):v(a.params.provider.id,(function(e){return"https://www.ebi.ac.uk/pdbe/static/entry/"+e.toLowerCase()+".cif"}),(function(e){return"PDBe: "+e+" (cif)"}),!1):"cif"===a.params.provider.server.params.encoding?v(a.params.provider.id,(function(e){return"https://files.rcsb.org/download/"+e.toUpperCase()+".cif"}),(function(e){return"RCSB: "+e+" (cif)"}),!1):v(a.params.provider.id,(function(e){return"https://models.rcsb.org/"+e.toUpperCase()+".bcif"}),(function(e){return"RCSB: "+e+" (bcif)"}),!0),s=!!a.params.options.asTrajectory;break;case"pdb-dev":o=v(a.params.provider.id,(function(e){var t=e.toUpperCase().startsWith("PDBDEV_")?e:"PDBDEV_"+e.padStart(8,"0");return"bcif"===a.params.provider.encoding?"https://pdb-dev.wwpdb.org/bcif/"+t.toUpperCase()+".bcif":"https://pdb-dev.wwpdb.org/cif/"+t.toUpperCase()+".cif"}),(function(e){return e.toUpperCase().startsWith("PDBDEV_")?e:"PDBDEV_"+e.padStart(8,"0")}),"bcif"===a.params.provider.encoding),s=!!a.params.options.asTrajectory;break;case"swissmodel":o=v(a.params.id,(function(e){return"https://swissmodel.expasy.org/repository/uniprot/"+e.toUpperCase()+".pdb"}),(function(e){return"SWISS-MODEL: "+e}),!1),s=!!a.params.options.asTrajectory,c="pdb";break;case"pubchem":o=v(a.params.id,(function(e){return"https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/CID/"+e.trim()+"/record/SDF/?record_type=3d"}),(function(e){return"PubChem: "+e}),!1),s=!!a.params.options.asTrajectory,c="mol";break;default:throw new Error(a.name+" not supported.")}return l=r.source.params.options.representation||u.a.auto.id,d=l!==u.a.empty.id,f="auto"===a.params.options.type.name?void 0:a.params.options.type,[4,i.transaction((function(){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var e,i,a,u,p,m;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return o.length>0&&s?[4,t.builders.data.downloadBlob({sources:o.map((function(e,t){return{id:""+t,url:e.url,isBinary:e.isBinary}})),maxConcurrency:6},{state:{isGhost:!0}})]:[3,4];case 1:return e=n.sent(),[4,t.builders.structure.parseTrajectory(e,{formats:o.map((function(e,t){return{id:""+t,format:"cif"}}))})];case 2:return m=n.sent(),[4,t.builders.structure.hierarchy.applyPreset(m,"default",{structure:f,showUnitcell:d,representationPreset:l,representationPresetParams:r.source.params.options.representationParams})];case 3:return n.sent(),[3,10];case 4:i=0,a=o,n.label=5;case 5:return i<a.length?(u=a[i],[4,t.builders.data.download(u,{state:{isGhost:!0}})]):[3,10];case 6:return p=n.sent(),[4,t.builders.structure.parseTrajectory(p,c)];case 7:return m=n.sent(),[4,t.builders.structure.hierarchy.applyPreset(m,"default",{structure:f,showUnitcell:d,representationPreset:l,representationPresetParams:r.source.params.options.representationParams})];case 8:n.sent(),n.label=9;case 9:return i++,[3,5];case 10:return[2]}}))}))})).runInContext(e)];case 1:return p.sent(),[2]}}))}))}))}));function v(e,t,r,n){for(var i=[],a=0,o=e.split(/[,\s]/).map((function(e){return e.trim()})).filter((function(e){return!!e&&(e.length>=4||/^[1-9][0-9]*$/.test(e))}));a<o.length;a++){var s=o[a];i.push({url:m.Asset.Url(t(s)),isBinary:n,label:r(s)})}return i}var b,y,_=a.StateAction.build({display:{name:"Update Trajectory"},params:{action:s.ParamDefinition.Select("advance",[["advance","Advance"],["reset","Reset"]]),by:s.ParamDefinition.Optional(s.ParamDefinition.Numeric(1,{min:-1,max:1,step:1}))}})((function(e){var t=e.params,r=e.state,n=r.selectQ((function(e){return e.ofTransformer(f.StateTransforms.Model.ModelFromTrajectory)})),i=r.build();if("reset"===t.action)for(var o=0,s=n;o<s.length;o++){var u=s[o];i.to(u).update({modelIndex:0})}else for(var c=function(e){var n=a.StateSelection.findAncestorOfType(r.tree,r.cells,e.transform.ref,d.a.Molecule.Trajectory);if(!n||!n.obj)return"continue";var o=n.obj;i.to(e).update((function(e){var r=(e.modelIndex+t.by)%o.data.frameCount;return r<0&&(r+=o.data.frameCount),{modelIndex:r}}))},l=0,p=n;l<p.length;l++){c(u=p[l])}return r.updateTree(i)})),S=(a.StateAction.build({display:{name:"Custom Model Properties",description:"Enable parameters for custom properties of the model."},from:d.a.Molecule.Model,params:function(e,t){return t.customModelProperties.getParams(null==e?void 0:e.data)},isApplicable:function(e,t,r){return t.transformer!==p.CustomModelProperties}})((function(e,t){var r=e.ref,n=e.params;return t.builders.structure.insertModelProperties(r,n)})),a.StateAction.build({display:{name:"Custom Structure Properties",description:"Enable parameters for custom properties of the structure."},from:d.a.Molecule.Structure,params:function(e,t){return t.customStructureProperties.getParams(null==e?void 0:e.data)},isApplicable:function(e,t,r){return t.transformer!==p.CustomStructureProperties}})((function(e,t){var r=e.ref,n=e.params;return t.builders.structure.insertStructureProperties(r,n)})),a.StateAction.build({display:{name:"Add Trajectory",description:"Add trajectory from existing model/topology and coordinates."},from:d.a.Root,params:function(e,t){var r=t.state.data,i=Object(n.__spreadArrays)(r.selectQ((function(e){return e.rootsOfType(d.a.Molecule.Model)})),r.selectQ((function(e){return e.rootsOfType(d.a.Molecule.Topology)}))).map((function(e){return[e.transform.ref,e.obj.label]})),a=r.selectQ((function(e){return e.rootsOfType(d.a.Molecule.Coordinates)})).map((function(e){return[e.transform.ref,e.obj.label]}));return{model:s.ParamDefinition.Select(i.length?i[0][0]:"",i),coordinates:s.ParamDefinition.Select(a.length?a[0][0]:"",a)}}})((function(e,t){var r=e.params,i=e.state;return o.b.create("Add Trajectory",(function(e){return i.transaction((function(){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var a,o,s;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return a=[r.model,r.coordinates],o=i.build().toRoot().apply(p.TrajectoryFromModelAndCoordinates,{modelRef:r.model,coordinatesRef:r.coordinates},{dependsOn:a}).apply(f.StateTransforms.Model.ModelFromTrajectory,{modelIndex:0}),[4,i.updateTree(o).runInContext(e)];case 1:return n.sent(),[4,t.builders.structure.createStructure(o.selector)];case 2:return s=n.sent(),[4,t.builders.structure.representation.applyPreset(s,"auto")];case 3:return n.sent(),[2]}}))}))})).runInContext(e)}))})),r(27)),x=r(33),O=r(18),w=r(15),C=r(73),j=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.updateParams=function(e){var r;t.plugin.managers.animation.updateParams(((r={})[e.name]=e.value,r))},t.updateCurrentParams=function(e){var r;t.plugin.managers.animation.updateCurrentParams(((r={})[e.name]=e.value,r))},t.startOrStop=function(){var e=t.plugin.managers.animation;"playing"===e.state.animationState?e.stop():(t.props.onStart&&t.props.onStart(),e.start())},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.animation.events.updated,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e,t,r=this.plugin.managers.animation;if(r.isEmpty)return null;var n="playing"===r.state.animationState,a=null===(t=(e=r.current.anim).canApply)||void 0===t?void 0:t.call(e,this.plugin);return i.createElement(i.Fragment,null,i.createElement(C.ParameterControls,{params:r.getParams(),values:r.state.params,onChange:this.updateParams,isDisabled:n}),i.createElement(C.ParameterControls,{params:r.current.params,values:r.current.paramValues,onChange:this.updateCurrentParams,isDisabled:n}),i.createElement("div",{className:"msp-flex-row"},i.createElement(O.Button,{icon:"playing"!==r.state.animationState?void 0:w.PlayArrowSvg,onClick:this.startOrStop,disabled:void 0!==a&&!1===a.canApply},"playing"===r.state.animationState?"Stop":void 0===a||a.canApply?"Start":a.reason||"Start")))},t}(x.PluginUIComponent),P=r(330),E=r(398),A=r(213),D=r(402),T=r(381),I=r(4),M=r(107),k=r(71);function B(e,t){if(Math.abs(e)>Math.abs(t)){var r=t/e;return Math.abs(e)*Math.sqrt(1+r*r)}if(0!==t){r=e/t;return Math.abs(t)*Math.sqrt(1+r*r)}return 0}(y=b||(b={})).createCache=function(e){return{size:e,matrix:k.a.create(e,e),eigenValues:new Float64Array(e),D:new Float64Array(e),E:new Float64Array(e)}},y.compute=function(e){!function(e,t,r,n,i){for(var a=0;a<e;a++)i[a]=0;var o=e-1;for(a=0;a<e;a++)n[a]=t[a*e+o];for(function(e,t,r,n){for(var i=n-1;i>0;i--){for(var a=0,o=0,s=0;s<i;s++)a+=Math.abs(t[s]);if(0===a){r[i]=t[i-1];for(var u=0;u<i;u++)t[u]=e[u*n+i-1],e[u*n+i]=0,e[i*n+u]=0}else{for(s=0;s<i;s++)t[s]/=a,o+=t[s]*t[s];var c=t[i-1],l=Math.sqrt(o);for(c>0&&(l=-l),r[i]=a*l,o-=c*l,t[i-1]=c-l,u=0;u<i;u++)r[u]=0;for(u=0;u<i;u++){for(c=t[u],e[i*n+u]=c,l=r[u]+e[u*n+u]*c,s=u+1;s<=i-1;s++)l+=e[u*n+s]*t[s],r[s]+=e[u*n+s]*c;r[u]=l}for(c=0,u=0;u<i;u++)r[u]/=o,c+=r[u]*t[u];var d=c/(o+o);for(u=0;u<i;u++)r[u]-=d*t[u];for(u=0;u<i;u++){for(c=t[u],l=r[u],s=u;s<=i-1;s++)e[u*n+s]-=c*r[s]+l*t[s];t[u]=e[u*n+i-1],e[u*n+i]=0}}t[i]=o}for(i=0;i<n-1;i++){if(e[i*n+n-1]=e[i*n+i],e[i*n+i]=1,0!==(o=t[i+1])){for(s=0;s<=i;s++)t[s]=e[(i+1)*n+s]/o;for(u=0;u<=i;u++){for(l=0,s=0;s<=i;s++)l+=e[(i+1)*n+s]*e[u*n+s];for(s=0;s<=i;s++)e[u*n+s]-=l*t[s]}}for(s=0;s<=i;s++)e[(i+1)*n+s]=0}for(u=0;u<n;u++)t[u]=e[u*n+n-1],e[u*n+n-1]=0;e[n*n-1]=1,r[0]=0}(t,n,i,e),function(e,t,r,n){for(var i=1;i<n;i++)r[i-1]=r[i];r[n-1]=0;for(var a=0,o=0,s=Math.pow(2,-53),u=0;u<n;u++){o=Math.max(o,Math.abs(t[u])+Math.abs(r[u]));for(var c=u;c<n&&!(Math.abs(r[c])<=s*o);)c++;if(c>u){var l=0;do{l+=1;var d=t[u],f=B(x=(t[u+1]-d)/(2*r[u]),1);x<0&&(f=-f),t[u]=r[u]/(x+f),t[u+1]=r[u]*(x+f);var p=t[u+1],m=d-t[u];for(i=u+2;i<n;i++)t[i]-=m;a+=m,x=t[c];var h=1,g=h,v=h,b=r[u+1],y=0,_=0;for(i=c-1;i>=u;i--){v=g,g=h,_=y,d=h*r[i],m=h*x,f=B(x,r[i]),r[i+1]=y*f,y=r[i]/f,x=(h=x/f)*t[i]-y*d,t[i+1]=m+y*(h*d+y*t[i]);for(var S=0;S<n;S++)m=e[(i+1)*n+S],e[(i+1)*n+S]=y*e[i*n+S]+h*m,e[i*n+S]=h*e[i*n+S]-y*m}if(x=-y*_*v*b*r[u]/p,r[u]=y*x,t[u]=h*x,l>=1e3)throw"SVD: Not converging."}while(Math.abs(r[u])>s*o)}t[u]=t[u]+a,r[u]=0}for(i=0;i<n-1;i++){S=i;for(var x=t[i],O=i+1;O<n;O++)t[O]<x&&(S=O,x=t[O]);if(S!==i)for(t[S]=t[i],t[i]=x,O=0;O<n;O++)x=e[i*n+O],e[i*n+O]=e[S*n+O],e[S*n+O]=x}}(t,n,i,e),a=0;a<e;a++)r[a]=n[a]}(e.size,e.matrix.data,e.eigenValues,e.D,e.E)};var V,R,L=r(201),N=r(250);R=V||(V={}),(R.Positions||(R.Positions={})).empty=function(e){return{x:new Float64Array(e),y:new Float64Array(e),z:new Float64Array(e)}},R.compute=function(e,t){return void 0===t&&(t={bTransform:M.a.zero(),rmsd:0}),function(e){var t=function(e){var t=e.evdCache.matrix;k.a.makeZero(t);for(var r=e.a.x,n=e.a.y,i=e.a.z,a=e.b.x,o=e.b.y,s=e.b.z,u=e.centerA,c=e.centerB,l=0,d=0,f=e.a.x.length;d<f;d++){var p=r[d]-u[0],m=n[d]-u[1],h=i[d]-u[2],g=a[d]-c[0],v=o[d]-c[1],b=s[d]-c[2];l+=p*p+m*m+h*h+g*g+v*v+b*b,k.a.add(t,0,0,p*g+m*v+h*b),k.a.add(t,0,1,-h*v+m*b),k.a.add(t,0,2,h*g-p*b),k.a.add(t,0,3,-m*g+p*v),k.a.add(t,1,0,-h*v+m*b),k.a.add(t,1,1,p*g-m*v-h*b),k.a.add(t,1,2,m*g+p*v),k.a.add(t,1,3,h*g+p*b),k.a.add(t,2,0,h*g-p*b),k.a.add(t,2,1,m*g+p*v),k.a.add(t,2,2,-p*g+m*v-h*b),k.a.add(t,2,3,h*v+m*b),k.a.add(t,3,0,-m*g+p*v),k.a.add(t,3,1,h*g+p*b),k.a.add(t,3,2,h*v+m*b),k.a.add(t,3,3,-p*g-m*v+h*b)}return l}(e);b.compute(e.evdCache);var r=t-2*e.evdCache.eigenValues[3];r=r<0?0:Math.sqrt(r/e.a.x.length),function(e){var t=e.evdCache.matrix,r=k.a.get(t,1,3),n=k.a.get(t,2,3),i=k.a.get(t,3,3),a=k.a.get(t,0,3),o=2*n*n,s=2*i*i,u=2*r*r,c=2*r*n,l=2*a*i,d=2*r*i,f=2*a*n,p=2*n*i,m=2*a*r,h=e.translateB;M.a.setValue(h,0,3,-e.centerB[0]),M.a.setValue(h,1,3,-e.centerB[1]),M.a.setValue(h,2,3,-e.centerB[2]),h=e.rotateB,M.a.setValue(h,0,0,1-o-s),M.a.setValue(h,0,1,c+l),M.a.setValue(h,0,2,d-f),M.a.setValue(h,1,0,c-l),M.a.setValue(h,1,1,1-u-s),M.a.setValue(h,1,2,p+m),M.a.setValue(h,2,0,d+f),M.a.setValue(h,2,1,p-m),M.a.setValue(h,2,2,1-u-o),M.a.setValue(h,3,3,1),M.a.mul(e.tempMatrix,e.rotateB,e.translateB),h=e.translateB,M.a.setValue(h,0,3,e.centerA[0]),M.a.setValue(h,1,3,e.centerA[1]),M.a.setValue(h,2,3,e.centerA[2]),M.a.mul(e.result.bTransform,e.translateB,e.tempMatrix)}(e),e.result.rmsd=r}(new F(e,t)),t};var F=function(e,t){this.evdCache=b.createCache(4),this.translateB=M.a.identity(),this.rotateB=M.a.identity(),this.tempMatrix=M.a.identity(),this.a=e.a,this.b=e.b,e.centerA?this.centerA=e.centerA:this.centerA=e.centerA=L.a.fromArrays(e.a,Object(N.a)()).center,e.centerB?this.centerB=e.centerB:this.centerB=e.centerB=L.a.fromArrays(e.b,Object(N.a)()).center,this.result=t};var U=r(139),z=r(6),H=r(28),G=[[4,0,-2,-1,-2,0,-2,-1,-1,-1,-1,-2,-1,-1,-1,1,0,0,-3,-2],[0,9,-3,-4,-2,-3,-3,-1,-3,-1,-1,-3,-3,-3,-3,-1,-1,-1,-2,-2],[-2,-3,6,2,-3,-1,-1,-3,-1,-4,-3,1,-1,0,-2,0,-1,-3,-4,-3],[-1,-4,2,5,-3,-2,0,-3,1,-3,-2,0,-1,2,0,0,-1,-2,-3,-2],[-2,-2,-3,-3,6,-3,-1,0,-3,0,0,-3,-4,-3,-3,-2,-2,-1,1,3],[0,-3,-1,-2,-3,6,-2,-4,-2,-4,-3,0,-2,-2,-2,0,-2,-3,-2,-3],[-2,-3,-1,0,-1,-2,8,-3,-1,-3,-2,1,-2,0,0,-1,-2,-3,-2,2],[-1,-1,-3,-3,0,-4,-3,4,-3,2,1,-3,-3,-3,-3,-2,-1,3,-3,-1],[-1,-3,-1,1,-3,-2,-1,-3,5,-2,-1,0,-1,1,2,0,-1,-2,-3,-2],[-1,-1,-4,-3,0,-4,-3,2,-2,4,2,-3,-3,-2,-2,-2,-1,1,-2,-1],[-1,-1,-3,-2,0,-3,-2,1,-1,2,5,-2,-2,0,-1,-1,-1,1,-1,-1],[-2,-3,1,0,-3,0,1,-3,0,-3,-2,6,-2,0,0,1,0,-3,-4,-2],[-1,-3,-1,-1,-4,-2,-2,-3,-1,-3,-2,-2,7,-1,-2,-1,-1,-2,-4,-3],[-1,-3,0,2,-3,-2,0,-3,1,-2,0,0,-1,5,1,0,-1,-2,-2,-1],[-1,-3,-2,0,-3,-2,0,-3,2,-2,-1,0,-2,1,5,-1,-1,-3,-3,-2],[1,-1,0,0,-2,0,-1,-2,0,-2,-1,1,-1,0,-1,4,1,-2,-3,-2],[0,-1,-1,-1,-2,-2,-2,-1,-1,-1,-1,0,-1,-1,-1,1,5,0,-2,-2],[0,-1,-3,-2,-1,-3,-3,3,-2,1,1,-3,-2,-2,-3,-2,0,4,-3,-1],[-3,-2,-4,-3,1,-2,-2,-3,-3,-2,-1,-4,-4,-2,-3,-3,-2,-3,11,2],[-2,-2,-3,-2,3,-3,2,-1,-2,-1,-1,-2,-3,-1,-2,-2,-2,-1,2,7]];function q(e,t){var r,n=0,i={};return t.forEach((function(t){r=0;var a={};t.forEach((function(t){return a[e[r++]]=t})),i[e[n++]]=a})),i}var W={blosum62:q("ARNDCQEGHILKMFPSTWYVBZX",[[4,-1,-2,-2,0,-1,-1,0,-2,-1,-1,-1,-1,-2,-1,1,0,-3,-2,0,-2,-1,0],[-1,5,0,-2,-3,1,0,-2,0,-3,-2,2,-1,-3,-2,-1,-1,-3,-2,-3,-1,0,-1],[-2,0,6,1,-3,0,0,0,1,-3,-3,0,-2,-3,-2,1,0,-4,-2,-3,3,0,-1],[-2,-2,1,6,-3,0,2,-1,-1,-3,-4,-1,-3,-3,-1,0,-1,-4,-3,-3,4,1,-1],[0,-3,-3,-3,9,-3,-4,-3,-3,-1,-1,-3,-1,-2,-3,-1,-1,-2,-2,-1,-3,-3,-2],[-1,1,0,0,-3,5,2,-2,0,-3,-2,1,0,-3,-1,0,-1,-2,-1,-2,0,3,-1],[-1,0,0,2,-4,2,5,-2,0,-3,-3,1,-2,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-2,0,-1,-3,-2,-2,6,-2,-4,-4,-2,-3,-3,-2,0,-2,-2,-3,-3,-1,-2,-1],[-2,0,1,-1,-3,0,0,-2,8,-3,-3,-1,-2,-1,-2,-1,-2,-2,2,-3,0,0,-1],[-1,-3,-3,-3,-1,-3,-3,-4,-3,4,2,-3,1,0,-3,-2,-1,-3,-1,3,-3,-3,-1],[-1,-2,-3,-4,-1,-2,-3,-4,-3,2,4,-2,2,0,-3,-2,-1,-2,-1,1,-4,-3,-1],[-1,2,0,-1,-3,1,1,-2,-1,-3,-2,5,-1,-3,-1,0,-1,-3,-2,-2,0,1,-1],[-1,-1,-2,-3,-1,0,-2,-3,-2,1,2,-1,5,0,-2,-1,-1,-1,-1,1,-3,-1,-1],[-2,-3,-3,-3,-2,-3,-3,-3,-1,0,0,-3,0,6,-4,-2,-2,1,3,-1,-3,-3,-1],[-1,-2,-2,-1,-3,-1,-1,-2,-2,-3,-3,-1,-2,-4,7,-1,-1,-4,-3,-2,-2,-1,-2],[1,-1,1,0,-1,0,0,0,-1,-2,-2,0,-1,-2,-1,4,1,-3,-2,-2,0,0,0],[0,-1,0,-1,-1,-1,-1,-2,-2,-1,-1,-1,-1,-2,-1,1,5,-2,-2,0,-1,-1,0],[-3,-3,-4,-4,-2,-2,-3,-2,-2,-3,-2,-3,-1,1,-4,-3,-2,11,2,-3,-4,-3,-2],[-2,-2,-2,-3,-2,-1,-2,-3,2,-1,-1,-2,-1,3,-3,-2,-2,2,7,-1,-3,-2,-1],[0,-3,-3,-3,-1,-2,-2,-3,-3,3,1,-2,1,-1,-2,-2,0,-3,-1,4,-3,-2,-1],[-2,-1,3,4,-3,0,1,-1,0,-3,-4,0,-3,-3,-2,0,-1,-4,-3,-3,4,1,-1],[-1,0,0,1,-3,3,4,-2,0,-3,-3,1,-1,-3,-1,0,-1,-3,-2,-2,1,4,-1],[0,-1,-1,-1,-2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-2,0,0,-2,-1,-1,-1,-1,-1]]),blosum62x:q("ACDEFGHIKLMNPQRSTVWY",G)},X={gapPenalty:-11,gapExtensionPenalty:-1,substMatrix:"default"};var Y,Q=function(){function e(e,t,r){this.seqA=e,this.seqB=t,this.S=[],this.V=[],this.H=[],this.gapPenalty=r.gapPenalty,this.gapExtensionPenalty=r.gapExtensionPenalty,this.substMatrix="default"===r.substMatrix?void 0:W[r.substMatrix],this.n=this.seqA.length,this.m=this.seqB.length}return e.prototype.initMatrices=function(){for(var e=this,t=e.n,r=e.m,n=e.gapPenalty,i=e.S,a=e.V,o=e.H,s=0;s<=t;++s){i[s]=[],a[s]=[],o[s]=[];for(var u=0;u<=r;++u)i[s][u]=0,a[s][u]=0,o[s][u]=0}for(s=0;s<=t;++s)i[s][0]=n,o[s][0]=-1/0;for(u=0;u<=r;++u)i[0][u]=n,a[0][u]=-1/0;i[0][0]=0},e.prototype.makeScoreFn=function(){var e=this.seqA,t=this.seqB,r=this.substMatrix;return r?function(n,i){var a,o,s=e[n],u=t[i];return null!==(o=null===(a=r[s])||void 0===a?void 0:a[u])&&void 0!==o?o:-4}:function(r,n){return e[r]===t[n]?5:-3}},e.prototype.calculate=function(){this.initMatrices();for(var e,t,r,n,i,a=this.makeScoreFn(),o=this,s=o.V,u=o.H,c=o.S,l=o.n,d=o.m,f=o.gapExtensionPenalty,p=o.gapPenalty,m=1;m<=l;++m){t=c[m-1],e=s[m-1],r=s[m],n=u[m],i=c[m];for(var h=1;h<=d;++h)r[h]=Math.max(t[h]+p,e[h]+f),n[h]=Math.max(i[h-1]+p,n[h-1]+f),i[h]=Math.max(t[h-1]+a(m-1,h-1),r[h],n[h])}},e.prototype.trace=function(){var e,t,r=this.makeScoreFn(),n=this,i=n.V,a=n.H,o=n.S,s=n.seqA,u=n.seqB,c=n.gapExtensionPenalty,l=n.gapPenalty,d=this.n,f=this.m,p="",m="";for(o[d][f]>=i[d][f]?(e="S",t=o[d][f]):i[d][f]>=a[d][f]?(e="V",t=i[d][f]):(e="H",t=a[d][f]);d>0&&f>0;)"S"===e?o[d][f]===o[d-1][f-1]+r(d-1,f-1)?(p=s[d-1]+p,m=u[f-1]+m,--d,--f,e="S"):o[d][f]===i[d][f]?e="V":o[d][f]===a[d][f]?e="H":(--d,--f):"V"===e?i[d][f]===i[d-1][f]+c?(p=s[d-1]+p,m="-"+m,--d,e="V"):i[d][f]===o[d-1][f]+l?(p=s[d-1]+p,m="-"+m,--d,e="S"):--d:"H"===e&&(a[d][f]===a[d][f-1]+c?(p="-"+p,m=u[f-1]+m,--f,e="H"):a[d][f]===o[d][f-1]+l?(p="-"+p,m=u[f-1]+m,--f,e="S"):--f);for(;d>0;)p=s[d-1]+p,m="-"+m,--d;for(;f>0;)p="-"+p,m=u[f-1]+m,--f;return{aliA:p,aliB:m,score:t}},e}();function K(e){return e.model.sequence.byEntityKey[function(e){switch(e.kind){case 0:return e.model.atomicHierarchy.index.getEntityFromChain(e.chainIndex[e.elements[0]]);case 1:return e.model.coarseHierarchy.spheres.entityKey[e.elements[0]];case 2:return e.model.coarseHierarchy.gaussians.entityKey[e.elements[0]]}}(e)].sequence}!function(e){function t(e){var t=new Map;if(H.g.isAtomic(e.unit))for(var r=e.unit.model.atomicHierarchy.residues.label_seq_id,n=e.unit.residueIndex,i=0,a=z.OrderedSet.size(e.indices);i<a;++i){var o=z.OrderedSet.getAt(e.indices,i),s=e.unit.elements[o],u=r.value(n[s]);t.has(u)?t.get(u).push(o):t.set(u,[o])}else if(H.g.isCoarse(e.unit)){var c=(H.g.isSpheres(e.unit)?e.unit.model.coarseHierarchy.spheres:e.unit.model.coarseHierarchy.gaussians).seq_id_begin;for(i=0,a=z.OrderedSet.size(e.indices);i<a;++i){o=z.OrderedSet.getAt(e.indices,i),s=e.unit.elements[o],u=c.value(s);t.set(u,[o])}}return t}e.compute=function(e,r){void 0===r&&(r={});for(var i=K(e.a.unit),a=K(e.b.unit),o=t(e.a),s=t(e.b),u=[],c=[],l=function(e,t,r){void 0===r&&(r={});var i=Object(n.__assign)(Object(n.__assign)({},X),r),a=new Q(e,t,i);return a.calculate(),a.trace()}(i.code.toArray(),a.code.toArray(),r),d=l.aliA,f=l.aliB,p=l.score,m=0,h=0,g=0,v=d.length;g<v;++g)if("-"!==d[g]&&"-"!==f[g]){var b=i.seqId.value(m),y=a.seqId.value(h);if(o.has(b)&&s.has(y))for(var _=o.get(b),S=s.get(y),x=0,O=Math.min(_.length,S.length);x<O;++x)u.push(_[x]),c.push(S[x]);m+=1,h+=1}else"-"!==d[g]&&(m+=1),"-"!==f[g]&&(h+=1);var w=z.OrderedSet.intersect(z.OrderedSet.ofSortedArray(u),e.a.indices),C=z.OrderedSet.intersect(z.OrderedSet.ofSortedArray(c),e.b.indices);return{a:{unit:e.a.unit,indices:w},b:{unit:e.b.unit,indices:C},score:p}}}(Y||(Y={}));var Z=r(176);function J(e){var t=[];if(e.length<=0)return t;var r=function(e){if(0===e.length)return 0;for(var t=U.a.Loci.size(e[0]),r=1;r<e.length;r++){var n=U.a.Loci.size(e[r]);n<t&&(t=n)}return t}(e),n={a:te(e[0],r),b:te(e[1],r)};t[0]=V.compute(n);for(var i=2;i<e.length;i++)n.b=te(e[i],r),n.centerB=void 0,t.push(V.compute(n));return t}var $=/(polypeptide|cyclic-pseudo-peptide)/i;function ee(e){var t=[];if(e.length<=0)return t;for(var r=U.a.Loci.getFirstLocation(e[0]),i=Z.a.entity.subtype(r).match($)?"blosum62":"default",a=1;a<e.length;a++){var o=Y.compute({a:e[0].elements[0],b:e[a].elements[0]},{substMatrix:i}),s=o.a,u=o.b,c=o.score,l=U.a.Loci(e[0].structure,[s]),d=U.a.Loci(e[a].structure,[u]),f=z.OrderedSet.size(s.indices);t.push(Object(n.__assign)(Object(n.__assign)({},V.compute({a:te(l,f),b:te(d,f)})),{alignmentScore:c}))}return t}function te(e,t){for(var r=V.Positions.empty(t),n=0,i=0,a=e.elements;i<a.length;i++){for(var o=a[i],s=o.unit,u=o.indices,c=s.elements,l=s.conformation,d=l.x,f=l.y,p=l.z,m=0,h=z.OrderedSet.size(u);m<h;m++){var g=c[z.OrderedSet.getAt(u,m)];if(r.x[n]=d(g),r.y[n]=f(g),r.z[n]=p(g),++n>=t)break}if(n>=t)break}return r}var re=r(89),ne=r(77),ie=r(42),ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.defaultState=function(){return{isCollapsed:!1,header:"Superposition",brand:{accent:"gray",svg:w.SuperpositionSvg},isHidden:!0}},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(t){e.setState({isHidden:t.structures.length<2})}))},t.prototype.renderControls=function(){return i.createElement(i.Fragment,null,i.createElement(ue,null))},t}(x.CollapsableControls),oe={alignSequences:s.ParamDefinition.Boolean(!0,{isEssential:!0,description:"Perform a sequence alignment and use the aligned residue pairs to guide the 3D superposition."})},se=s.ParamDefinition.getDefaultValues(oe),ue=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isBusy:!1,action:void 0,options:se},t.superposeChains=function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){var e,t,r,i,a,o,s,u,c,l,d,f,p,m=this;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:e=re.b.trace.query,t=this.chainEntries,r=t.map((function(t,r){var n=I.StructureElement.Loci.toStructure(t.loci),i=I.StructureSelection.toLociWithSourceUnits(e(new I.QueryContext(n)));return I.StructureElement.Loci.remap(i,0===r?m.plugin.helpers.substructureParent.get(t.loci.structure.root).obj.data:i.structure.root)})),i=this.state.options.alignSequences?ee(r):J(r),a=t[0],o=1,s=r.length,n.label=1;case 1:return o<s?(u=t[o],c=i[o-1],l=c.bTransform,d=c.rmsd,[4,this.transform(u.cell,l)]):[3,4];case 2:n.sent(),f=Object(ie.e)(a.label),p=Object(ie.e)(u.label),this.plugin.log.info("Superposed ["+f+"] and ["+p+"] with RMSD "+d.toFixed(2)+"."),n.label=3;case 3:return++o,[3,1];case 4:return[2]}}))}))},t.superposeAtoms=function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){var e,t,r,i,a,o,s,u,c,l,d,f,p,m=this;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:e=this.atomEntries,t=e.map((function(e,t){return I.StructureElement.Loci.remap(e.loci,0===t?m.plugin.helpers.substructureParent.get(e.loci.structure.root).obj.data:e.loci.structure.root)})),r=J(t),i=e[0],a=1,o=t.length,n.label=1;case 1:return a<o?(s=e[a],u=r[a-1],c=u.bTransform,l=u.rmsd,[4,this.transform(s.cell,c)]):[3,4];case 2:n.sent(),d=Object(ie.e)(i.label),f=Object(ie.e)(s.label),p=e[a].atoms.length,this.plugin.log.info("Superposed "+p+" "+(1===p?"atom":"atoms")+" of ["+d+"] and ["+f+"] with RMSD "+l.toFixed(2)+"."),n.label=3;case 3:return++a,[3,1];case 4:return[2]}}))}))},t.toggleByChains=function(){return t.setState({action:"byChains"===t.state.action?void 0:"byChains"})},t.toggleByAtoms=function(){return t.setState({action:"byAtoms"===t.state.action?void 0:"byAtoms"})},t.toggleOptions=function(){return t.setState({action:"options"===t.state.action?void 0:"options"})},t.setOptions=function(e){t.setState({options:e})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.selection.events.changed,(function(){e.forceUpdate()})),this.subscribe(this.selection.events.additionsHistoryUpdated,(function(){e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})}))},Object.defineProperty(t.prototype,"selection",{get:function(){return this.plugin.managers.structure.selection},enumerable:!1,configurable:!0}),t.prototype.transform=function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,o,s;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return(r=a.StateObjectRef.resolveAndCheck(this.plugin.state.data,e))?(i=a.StateSelection.findTagInSubtree(this.plugin.state.data.tree,r.transform.ref,"SuperpositionTransform"),o={transform:{name:"matrix",params:{data:t,transpose:!1}}},s=i?this.plugin.state.data.build().to(i).update(o):this.plugin.state.data.build().to(e).insert(f.StateTransforms.Model.TransformStructureConformation,o,{tags:"SuperpositionTransform"}),[4,this.plugin.runTask(this.plugin.state.data.updateTree(s))]):[2];case 1:return n.sent(),[2]}}))}))},t.prototype.highlight=function(e){this.plugin.managers.interactivity.lociHighlights.highlightOnly({loci:e},!1)},t.prototype.moveHistory=function(e,t){this.plugin.managers.structure.selection.modifyHistory(e,t,void 0,!0)},t.prototype.focusLoci=function(e){this.plugin.managers.camera.focusLoci(e)},t.prototype.lociEntry=function(e,t){var r=this;return i.createElement("div",{className:"msp-flex-row",key:t},i.createElement(O.Button,{noOverflow:!0,title:"Click to focus. Hover to highlight.",onClick:function(){return r.focusLoci(e.loci)},style:{width:"auto",textAlign:"left"},onMouseEnter:function(){return r.highlight(e.loci)},onMouseLeave:this.plugin.managers.interactivity.lociHighlights.clearHighlights},i.createElement("span",{dangerouslySetInnerHTML:{__html:e.label}})))},t.prototype.historyEntry=function(e,t){var r=this,n=this.plugin.managers.structure.selection.additionsHistory;return i.createElement("div",{className:"msp-flex-row",key:e.id},i.createElement(O.Button,{noOverflow:!0,title:"Click to focus. Hover to highlight.",onClick:function(){return r.focusLoci(e.loci)},style:{width:"auto",textAlign:"left"},onMouseEnter:function(){return r.highlight(e.loci)},onMouseLeave:this.plugin.managers.interactivity.lociHighlights.clearHighlights},t,". ",i.createElement("span",{dangerouslySetInnerHTML:{__html:e.label}})),n.length>1&&i.createElement(O.IconButton,{svg:w.ArrowUpwardSvg,small:!0,className:"msp-form-control",onClick:function(){return r.moveHistory(e,"up")},flex:"20px",title:"Move up"}),n.length>1&&i.createElement(O.IconButton,{svg:w.ArrowDownwardSvg,small:!0,className:"msp-form-control",onClick:function(){return r.moveHistory(e,"down")},flex:"20px",title:"Move down"}),i.createElement(O.IconButton,{svg:w.DeleteOutlinedSvg,small:!0,className:"msp-form-control",onClick:function(){return r.plugin.managers.structure.selection.modifyHistory(e,"remove")},flex:!0,title:"Remove"}))},t.prototype.atomsLociEntry=function(e,t){var r=this;return i.createElement("div",{key:t},i.createElement("div",{className:"msp-control-group-header"},i.createElement("div",{className:"msp-no-overflow",title:e.label},e.label)),i.createElement("div",{className:"msp-control-offset"},e.atoms.map((function(e,t){return r.historyEntry(e,t)}))))},Object.defineProperty(t.prototype,"chainEntries",{get:function(){var e=this,t=I.StructureElement.Location.create(),r=[];return this.plugin.managers.structure.selection.entries.forEach((function(n,i){var o=n.selection,s=a.StateObjectRef.resolveAndCheck(e.plugin.state.data,i);if(s&&!I.StructureElement.Loci.isEmpty(o)){var u=I.StructureElement.Loci.getFirstLocation(o,t);if(!(o.elements.length>1||"polymer"!==I.StructureProperties.entity.type(u))){var c=I.StructureElement.Stats.ofLoci(o),l=Object(ne.structureElementStatsLabel)(c,{countsOnly:!0}),d=Object(ne.elementLabel)(u,{reverse:!0,granularity:"chain"}).split("|"),f=l+" | "+d[0]+" | "+d[d.length-1];r.push({loci:o,label:f,cell:s})}}})),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"atomEntries",{get:function(){for(var e=this,t=new Map,r=this.plugin.managers.structure.selection.additionsHistory,n=0,i=r.length;n<i;++n){var a=r[n];if(1===I.StructureElement.Loci.size(a.loci)){var o=a.loci.structure;t.has(o)?t.get(o).push(a):t.set(o,[a])}}var s=[];return t.forEach((function(t,r){for(var n=e.plugin.helpers.substructureParent.get(r),i=[],a=0,o=t.length;a<o;++a)i.push(t[a].loci.elements[0]);var u=I.StructureElement.Loci(t[0].loci.structure,i),c=u.structure.label.split(" | ")[0];s.push({loci:u,label:c,cell:n,atoms:t})})),s},enumerable:!1,configurable:!0}),t.prototype.addByChains=function(){var e=this,t=this.chainEntries;return i.createElement(i.Fragment,null,t.length>0&&i.createElement("div",{className:"msp-control-offset"},t.map((function(t,r){return e.lociEntry(t,r)}))),t.length<2&&i.createElement("div",{className:"msp-control-offset msp-help-text"},i.createElement("div",{className:"msp-help-description"},i.createElement(w.Icon,{svg:w.HelpOutlineSvg,inline:!0}),"Add 2 or more selections (toggle ",i.createElement(A.ToggleSelectionModeButton,{inline:!0})," mode) from separate structures. Selections must be limited to single polymer chains or residues therein.")),t.length>1&&i.createElement(O.Button,{title:"Superpose structures by selected chains.",className:"msp-btn-commit msp-btn-commit-on",onClick:this.superposeChains,style:{marginTop:"1px"}},"Superpose"))},t.prototype.addByAtoms=function(){var e=this,t=this.atomEntries;return i.createElement(i.Fragment,null,t.length>0&&i.createElement("div",{className:"msp-control-offset"},t.map((function(t,r){return e.atomsLociEntry(t,r)}))),t.length<2&&i.createElement("div",{className:"msp-control-offset msp-help-text"},i.createElement("div",{className:"msp-help-description"},i.createElement(w.Icon,{svg:w.HelpOutlineSvg,inline:!0}),"Add 1 or more selections (toggle ",i.createElement(A.ToggleSelectionModeButton,{inline:!0})," mode) from separate structures. Selections must be limited to single atoms.")),t.length>1&&i.createElement(O.Button,{title:"Superpose structures by selected atoms.",className:"msp-btn-commit msp-btn-commit-on",onClick:this.superposeAtoms,style:{marginTop:"1px"}},"Superpose"))},t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(O.ToggleButton,{icon:w.SuperposeChainsSvg,label:"By Chains",toggle:this.toggleByChains,isSelected:"byChains"===this.state.action,disabled:this.state.isBusy}),i.createElement(O.ToggleButton,{icon:w.SuperposeAtomsSvg,label:"By Atoms",toggle:this.toggleByAtoms,isSelected:"byAtoms"===this.state.action,disabled:this.state.isBusy}),i.createElement(O.ToggleButton,{icon:w.TuneSvg,label:"",title:"Options",toggle:this.toggleOptions,isSelected:"options"===this.state.action,disabled:this.state.isBusy,style:{flex:"0 0 40px",padding:0}})),"byChains"===this.state.action&&this.addByChains(),"byAtoms"===this.state.action&&this.addByAtoms(),"options"===this.state.action&&i.createElement("div",{className:"msp-control-offset"},i.createElement(C.ParameterControls,{params:oe,values:this.state.options,onChangeValues:this.setOptions,isDisabled:this.state.isBusy})))},t}(x.PurePluginUIComponent),ce=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={show:!1,label:""},t.update=function(){var e=t.plugin.state.data,r=e.selectQ((function(e){return e.ofTransformer(f.StateTransforms.Model.ModelFromTrajectory)}));if(0!==r.length){for(var n="",i=0,a=new Set,o=0,s=r;o<s.length;o++){var u=s[o];if(u.sourceRef){var c=e.cells.get(u.sourceRef).obj;if(c&&c.data.frameCount>1){if(a.has(u.sourceRef))return void t.setState({show:!1});if(a.add(u.sourceRef),i++,!n)n="Model "+(u.transform.params.modelIndex+1)+" / "+c.data.frameCount}}}i>1&&(n=""),t.setState({show:i>0,label:n})}else t.setState({show:!1})},t.reset=function(){return S.PluginCommands.State.ApplyAction(t.plugin,{state:t.plugin.state.data,action:_.create({action:"reset"})})},t.prev=function(){return S.PluginCommands.State.ApplyAction(t.plugin,{state:t.plugin.state.data,action:_.create({action:"advance",by:-1})})},t.next=function(){return S.PluginCommands.State.ApplyAction(t.plugin,{state:t.plugin.state.data,action:_.create({action:"advance",by:1})})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){this.subscribe(this.plugin.state.data.events.changed,this.update),this.subscribe(this.plugin.behaviors.state.isAnimating,this.update)},t.prototype.render=function(){var e=this.plugin.behaviors.state.isAnimating.value;return!this.state.show||e&&!this.state.label?null:i.createElement("div",{className:"msp-traj-controls"},!e&&i.createElement(O.IconButton,{svg:w.SkipPreviousSvg,title:"First Model",onClick:this.reset,disabled:e}),!e&&i.createElement(O.IconButton,{svg:w.NavigateBeforeSvg,title:"Previous Model",onClick:this.prev,disabled:e}),!e&&i.createElement(O.IconButton,{svg:w.NavigateNextSvg,title:"Next Model",onClick:this.next,disabled:e}),!!this.state.label&&i.createElement("span",null,this.state.label))},t}(x.PluginUIComponent),le=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isBusy:!1,show:!0},t.keyUp=function(e){if(e.ctrlKey&&!t.state.isBusy&&e.target===document.body){var r=t.plugin.managers.snapshot;if(37===e.keyCode||"ArrowLeft"===e.key)r.state.isPlaying&&r.stop(),t.prev();else if(38===e.keyCode||"ArrowUp"===e.key){if(r.state.isPlaying&&r.stop(),0===r.state.entries.size)return;var n=r.state.entries.get(0);t.update(n.snapshot.id)}else if(39===e.keyCode||"ArrowRight"===e.key)r.state.isPlaying&&r.stop(),t.next();else if(40===e.keyCode||"ArrowDown"===e.key){if(r.state.isPlaying&&r.stop(),0===r.state.entries.size)return;var i=r.state.entries.get(r.state.entries.size-1);t.update(i.snapshot.id)}}},t.change=function(e){"none"!==e.target.value&&t.update(e.target.value)},t.prev=function(){var e=t.plugin.managers.snapshot,r=e.getNextId(e.state.current,-1);r&&t.update(r)},t.next=function(){var e=t.plugin.managers.snapshot,r=e.getNextId(e.state.current,1);r&&t.update(r)},t.togglePlay=function(){t.plugin.managers.snapshot.togglePlay()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.snapshot.events.changed,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){return e.setState({isBusy:t})})),this.subscribe(this.plugin.behaviors.state.isAnimating,(function(t){return e.setState({isBusy:t})})),window.addEventListener("keyup",this.keyUp,!1)},t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),window.removeEventListener("keyup",this.keyUp,!1)},t.prototype.update=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){return Object(n.__generator)(this,(function(t){switch(t.label){case 0:return this.setState({isBusy:!0}),[4,S.PluginCommands.State.Snapshots.Apply(this.plugin,{id:e})];case 1:return t.sent(),this.setState({isBusy:!1}),[2]}}))}))},t.prototype.render=function(){var e=this.plugin.managers.snapshot,t=e.state.entries.size;if(t<2||!this.state.show)return null;var r=e.state.current,n=e.state.isPlaying;return i.createElement("div",{className:"msp-state-snapshot-viewport-controls"},i.createElement("select",{className:"msp-form-control",value:r||"none",onChange:this.change,disabled:this.state.isBusy||n},!r&&i.createElement("option",{key:"none",value:"none"}),e.state.entries.valueSeq().map((function(e,r){return i.createElement("option",{key:e.snapshot.id,value:e.snapshot.id},"["+(r+1)+"/"+t+"]"," ",e.name||new Date(e.timestamp).toLocaleString())}))),i.createElement(O.IconButton,{svg:n?w.StopSvg:w.PlayArrowSvg,title:n?"Pause":"Cycle States",onClick:this.togglePlay,disabled:!n&&this.state.isBusy}),!n&&i.createElement(i.Fragment,null,i.createElement(O.IconButton,{svg:w.NavigateBeforeSvg,title:"Previous State",onClick:this.prev,disabled:this.state.isBusy||n}),i.createElement(O.IconButton,{svg:w.NavigateNextSvg,title:"Next State",onClick:this.next,disabled:this.state.isBusy||n})))},t}(x.PluginUIComponent),de=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isEmpty:!0,isExpanded:!1,isBusy:!1,isAnimating:!1,isPlaying:!1},t.toggleExpanded=function(){return t.setState({isExpanded:!t.state.isExpanded})},t.stop=function(){t.plugin.managers.animation.stop(),t.plugin.managers.snapshot.stop()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.snapshot.events.changed,(function(){e.plugin.managers.snapshot.state.isPlaying?e.setState({isPlaying:!0,isExpanded:!1}):e.setState({isPlaying:!1})})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){t?e.setState({isBusy:!0,isExpanded:!1,isEmpty:e.plugin.state.data.tree.transforms.size<2}):e.setState({isBusy:!1,isEmpty:e.plugin.state.data.tree.transforms.size<2})})),this.subscribe(this.plugin.behaviors.state.isAnimating,(function(t){t?e.setState({isAnimating:!0,isExpanded:!1}):e.setState({isAnimating:!1})}))},t.prototype.render=function(){var e=this.plugin.managers.snapshot.state.isPlaying;if(e||this.state.isEmpty||this.plugin.managers.animation.isEmpty||!this.plugin.config.get(h.PluginConfig.Viewport.ShowAnimation))return null;var t=this.state.isAnimating;return i.createElement("div",{className:"msp-animation-viewport-controls"},i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),i.createElement(O.IconButton,{svg:t||e?w.StopSvg:w.SubscriptionsOutlinedSvg,transparent:!0,title:t?"Stop":"Select Animation",onClick:t||e?this.stop:this.toggleExpanded,toggleState:this.state.isExpanded,disabled:!t&&!e&&(this.state.isBusy||this.state.isPlaying||this.state.isEmpty)})),this.state.isExpanded&&!this.state.isBusy&&i.createElement("div",{className:"msp-animation-viewport-controls-select"},i.createElement(j,{onStart:this.toggleExpanded})))},t}(x.PluginUIComponent),fe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onMouseMove=function(e){0===e.buttons&&e.stopPropagation()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.behaviors.interaction.selectionMode,(function(){return e.forceUpdate()}))},t.prototype.render=function(){return this.plugin.selectionMode?i.createElement("div",{className:"msp-selection-viewport-controls",onMouseMove:this.onMouseMove},i.createElement(A.StructureSelectionActionsControls,null)):null},t}(x.PluginUIComponent),pe=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={labels:[]},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.behaviors.labels.highlight,(function(t){return e.setState({labels:t.labels})}))},t.prototype.render=function(){return 0===this.state.labels.length?null:i.createElement("div",{className:"msp-highlight-info"},this.state.labels.map((function(e,t){return i.createElement("div",{key:""+t,dangerouslySetInnerHTML:{__html:e}})})))},t}(x.PluginUIComponent),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.behaviors.events.changed,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e=this,t=[];return this.plugin.customStructureControls.forEach((function(r,n){t.push(i.createElement(r,{initiallyCollapsed:e.props.initiallyCollapsed,key:n}))})),t.length>0?i.createElement(i.Fragment,null,t):null},t}(x.PluginUIComponent),he=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-section-header"},i.createElement(w.Icon,{svg:w.BuildSvg}),"Structure Tools"),i.createElement(D.StructureSourceControls,null),i.createElement(E.StructureMeasurementsControls,null),i.createElement(ae,null),i.createElement(P.StructureComponentControls,null),this.plugin.config.get(h.PluginConfig.VolumeStreaming.Enabled)&&i.createElement(T.VolumeStreamingControls,null),i.createElement(T.VolumeSourceControls,null),i.createElement(me,null))},t}(x.PluginUIComponent)},function(e,t,r){"use strict";r.r(t),r.d(t,"audit",(function(){return a})),r.d(t,"auditTime",(function(){return l})),r.d(t,"buffer",(function(){return d})),r.d(t,"bufferCount",(function(){return h})),r.d(t,"bufferTime",(function(){return _})),r.d(t,"bufferToggle",(function(){return D})),r.d(t,"bufferWhen",(function(){return M})),r.d(t,"catchError",(function(){return V})),r.d(t,"combineAll",(function(){return F})),r.d(t,"combineLatest",(function(){return H})),r.d(t,"concat",(function(){return q})),r.d(t,"concatAll",(function(){return W.a})),r.d(t,"concatMap",(function(){return Y})),r.d(t,"concatMapTo",(function(){return Q})),r.d(t,"count",(function(){return K})),r.d(t,"debounce",(function(){return $})),r.d(t,"debounceTime",(function(){return re.a})),r.d(t,"defaultIfEmpty",(function(){return ne})),r.d(t,"delay",(function(){return ue})),r.d(t,"delayWhen",(function(){return pe})),r.d(t,"dematerialize",(function(){return be})),r.d(t,"distinct",(function(){return Se})),r.d(t,"distinctUntilChanged",(function(){return we})),r.d(t,"distinctUntilKeyChanged",(function(){return Pe})),r.d(t,"elementAt",(function(){return Ve})),r.d(t,"endWith",(function(){return Le})),r.d(t,"every",(function(){return Ne})),r.d(t,"exhaust",(function(){return ze})),r.d(t,"exhaustMap",(function(){return We})),r.d(t,"expand",(function(){return Qe})),r.d(t,"filter",(function(){return Ae.a})),r.d(t,"finalize",(function(){return Je})),r.d(t,"find",(function(){return tt})),r.d(t,"findIndex",(function(){return it})),r.d(t,"first",(function(){return ot})),r.d(t,"groupBy",(function(){return st.b})),r.d(t,"ignoreElements",(function(){return ut})),r.d(t,"isEmpty",(function(){return dt})),r.d(t,"last",(function(){return bt})),r.d(t,"map",(function(){return qe.a})),r.d(t,"mapTo",(function(){return yt})),r.d(t,"materialize",(function(){return xt})),r.d(t,"max",(function(){return Dt})),r.d(t,"merge",(function(){return It})),r.d(t,"mergeAll",(function(){return Mt.a})),r.d(t,"mergeMap",(function(){return X.b})),r.d(t,"flatMap",(function(){return X.a})),r.d(t,"mergeMapTo",(function(){return kt})),r.d(t,"mergeScan",(function(){return Bt})),r.d(t,"min",(function(){return Lt})),r.d(t,"multicast",(function(){return Ft})),r.d(t,"observeOn",(function(){return zt.b})),r.d(t,"onErrorResumeNext",(function(){return Ht})),r.d(t,"pairwise",(function(){return Wt})),r.d(t,"partition",(function(){return Kt})),r.d(t,"pluck",(function(){return Zt})),r.d(t,"publish",(function(){return er})),r.d(t,"publishBehavior",(function(){return rr})),r.d(t,"publishLast",(function(){return ir})),r.d(t,"publishReplay",(function(){return or})),r.d(t,"race",(function(){return ur})),r.d(t,"reduce",(function(){return At})),r.d(t,"repeat",(function(){return cr})),r.d(t,"repeatWhen",(function(){return fr})),r.d(t,"retry",(function(){return hr})),r.d(t,"retryWhen",(function(){return br})),r.d(t,"refCount",(function(){return Sr.a})),r.d(t,"sample",(function(){return xr})),r.d(t,"sampleTime",(function(){return Cr})),r.d(t,"scan",(function(){return Ct})),r.d(t,"sequenceEqual",(function(){return Ar})),r.d(t,"share",(function(){return kr})),r.d(t,"shareReplay",(function(){return Br})),r.d(t,"single",(function(){return Vr})),r.d(t,"skip",(function(){return Nr})),r.d(t,"skipLast",(function(){return zr})),r.d(t,"skipUntil",(function(){return qr})),r.d(t,"skipWhile",(function(){return Yr})),r.d(t,"startWith",(function(){return Zr})),r.d(t,"subscribeOn",(function(){return tn})),r.d(t,"switchAll",(function(){return sn})),r.d(t,"switchMap",(function(){return nn})),r.d(t,"switchMapTo",(function(){return un})),r.d(t,"take",(function(){return Be.a})),r.d(t,"takeLast",(function(){return ht})),r.d(t,"takeUntil",(function(){return cn})),r.d(t,"takeWhile",(function(){return fn})),r.d(t,"tap",(function(){return vn})),r.d(t,"throttle",(function(){return Sn})),r.d(t,"throttleTime",(function(){return wn})),r.d(t,"throwIfEmpty",(function(){return Te})),r.d(t,"timeInterval",(function(){return An})),r.d(t,"timeout",(function(){return Vn})),r.d(t,"timeoutWith",(function(){return In})),r.d(t,"timestamp",(function(){return Rn})),r.d(t,"toArray",(function(){return Fn})),r.d(t,"window",(function(){return Un})),r.d(t,"windowCount",(function(){return Gn})),r.d(t,"windowTime",(function(){return Xn})),r.d(t,"windowToggle",(function(){return ei})),r.d(t,"windowWhen",(function(){return ni})),r.d(t,"withLatestFrom",(function(){return oi})),r.d(t,"zip",(function(){return li})),r.d(t,"zipAll",(function(){return di}));var n=r(20),i=r(40);function a(e){return function(t){return t.lift(new o(e))}}var o=function(){function e(e){this.durationSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new s(e,this.durationSelector))},e}(),s=function(e){function t(t,r){var n=e.call(this,t)||this;return n.durationSelector=r,n.hasValue=!1,n}return n.a(t,e),t.prototype._next=function(e){if(this.value=e,this.hasValue=!0,!this.throttled){var t=void 0;try{t=(0,this.durationSelector)(e)}catch(e){return this.destination.error(e)}var r=Object(i.c)(t,new i.a(this));!r||r.closed?this.clearThrottle():this.add(this.throttled=r)}},t.prototype.clearThrottle=function(){var e=this.value,t=this.hasValue,r=this.throttled;r&&(this.remove(r),this.throttled=void 0,r.unsubscribe()),t&&(this.value=void 0,this.hasValue=!1,this.destination.next(e))},t.prototype.notifyNext=function(){this.clearThrottle()},t.prototype.notifyComplete=function(){this.clearThrottle()},t}(i.b),u=r(103),c=r(354);function l(e,t){return void 0===t&&(t=u.a),a((function(){return Object(c.a)(e,t)}))}function d(e){return function(t){return t.lift(new f(e))}}var f=function(){function e(e){this.closingNotifier=e}return e.prototype.call=function(e,t){return t.subscribe(new p(e,this.closingNotifier))},e}(),p=function(e){function t(t,r){var n=e.call(this,t)||this;return n.buffer=[],n.add(Object(i.c)(r,new i.a(n))),n}return n.a(t,e),t.prototype._next=function(e){this.buffer.push(e)},t.prototype.notifyNext=function(){var e=this.buffer;this.buffer=[],this.destination.next(e)},t}(i.b),m=r(34);function h(e,t){return void 0===t&&(t=null),function(r){return r.lift(new g(e,t))}}var g=function(){function e(e,t){this.bufferSize=e,this.startBufferEvery=t,this.subscriberClass=t&&e!==t?b:v}return e.prototype.call=function(e,t){return t.subscribe(new this.subscriberClass(e,this.bufferSize,this.startBufferEvery))},e}(),v=function(e){function t(t,r){var n=e.call(this,t)||this;return n.bufferSize=r,n.buffer=[],n}return n.a(t,e),t.prototype._next=function(e){var t=this.buffer;t.push(e),t.length==this.bufferSize&&(this.destination.next(t),this.buffer=[])},t.prototype._complete=function(){var t=this.buffer;t.length>0&&this.destination.next(t),e.prototype._complete.call(this)},t}(m.a),b=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.bufferSize=r,i.startBufferEvery=n,i.buffers=[],i.count=0,i}return n.a(t,e),t.prototype._next=function(e){var t=this.bufferSize,r=this.startBufferEvery,n=this.buffers,i=this.count;this.count++,i%r==0&&n.push([]);for(var a=n.length;a--;){var o=n[a];o.push(e),o.length===t&&(n.splice(a,1),this.destination.next(o))}},t.prototype._complete=function(){for(var t=this.buffers,r=this.destination;t.length>0;){var n=t.shift();n.length>0&&r.next(n)}e.prototype._complete.call(this)},t}(m.a),y=r(131);function _(e){var t=arguments.length,r=u.a;Object(y.a)(arguments[arguments.length-1])&&(r=arguments[arguments.length-1],t--);var n=null;t>=2&&(n=arguments[1]);var i=Number.POSITIVE_INFINITY;return t>=3&&(i=arguments[2]),function(t){return t.lift(new S(e,n,i,r))}}var S=function(){function e(e,t,r,n){this.bufferTimeSpan=e,this.bufferCreationInterval=t,this.maxBufferSize=r,this.scheduler=n}return e.prototype.call=function(e,t){return t.subscribe(new O(e,this.bufferTimeSpan,this.bufferCreationInterval,this.maxBufferSize,this.scheduler))},e}(),x=function(){return function(){this.buffer=[]}}(),O=function(e){function t(t,r,n,i,a){var o=e.call(this,t)||this;o.bufferTimeSpan=r,o.bufferCreationInterval=n,o.maxBufferSize=i,o.scheduler=a,o.contexts=[];var s=o.openContext();if(o.timespanOnly=null==n||n<0,o.timespanOnly){var u={subscriber:o,context:s,bufferTimeSpan:r};o.add(s.closeAction=a.schedule(w,r,u))}else{var c={subscriber:o,context:s},l={bufferTimeSpan:r,bufferCreationInterval:n,subscriber:o,scheduler:a};o.add(s.closeAction=a.schedule(j,r,c)),o.add(a.schedule(C,n,l))}return o}return n.a(t,e),t.prototype._next=function(e){for(var t,r=this.contexts,n=r.length,i=0;i<n;i++){var a=r[i],o=a.buffer;o.push(e),o.length==this.maxBufferSize&&(t=a)}t&&this.onBufferFull(t)},t.prototype._error=function(t){this.contexts.length=0,e.prototype._error.call(this,t)},t.prototype._complete=function(){for(var t=this.contexts,r=this.destination;t.length>0;){var n=t.shift();r.next(n.buffer)}e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.contexts=null},t.prototype.onBufferFull=function(e){this.closeContext(e);var t=e.closeAction;if(t.unsubscribe(),this.remove(t),!this.closed&&this.timespanOnly){e=this.openContext();var r=this.bufferTimeSpan,n={subscriber:this,context:e,bufferTimeSpan:r};this.add(e.closeAction=this.scheduler.schedule(w,r,n))}},t.prototype.openContext=function(){var e=new x;return this.contexts.push(e),e},t.prototype.closeContext=function(e){this.destination.next(e.buffer);var t=this.contexts;(t?t.indexOf(e):-1)>=0&&t.splice(t.indexOf(e),1)},t}(m.a);function w(e){var t=e.subscriber,r=e.context;r&&t.closeContext(r),t.closed||(e.context=t.openContext(),e.context.closeAction=this.schedule(e,e.bufferTimeSpan))}function C(e){var t=e.bufferCreationInterval,r=e.bufferTimeSpan,n=e.subscriber,i=e.scheduler,a=n.openContext();n.closed||(n.add(a.closeAction=i.schedule(j,r,{subscriber:n,context:a})),this.schedule(e,t))}function j(e){var t=e.subscriber,r=e.context;t.closeContext(r)}var P=r(76),E=r(178),A=r(194);function D(e,t){return function(r){return r.lift(new T(e,t))}}var T=function(){function e(e,t){this.openings=e,this.closingSelector=t}return e.prototype.call=function(e,t){return t.subscribe(new I(e,this.openings,this.closingSelector))},e}(),I=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.closingSelector=n,i.contexts=[],i.add(Object(E.a)(i,r)),i}return n.a(t,e),t.prototype._next=function(e){for(var t=this.contexts,r=t.length,n=0;n<r;n++)t[n].buffer.push(e)},t.prototype._error=function(t){for(var r=this.contexts;r.length>0;){var n=r.shift();n.subscription.unsubscribe(),n.buffer=null,n.subscription=null}this.contexts=null,e.prototype._error.call(this,t)},t.prototype._complete=function(){for(var t=this.contexts;t.length>0;){var r=t.shift();this.destination.next(r.buffer),r.subscription.unsubscribe(),r.buffer=null,r.subscription=null}this.contexts=null,e.prototype._complete.call(this)},t.prototype.notifyNext=function(e,t){e?this.closeBuffer(e):this.openBuffer(t)},t.prototype.notifyComplete=function(e){this.closeBuffer(e.context)},t.prototype.openBuffer=function(e){try{var t=this.closingSelector.call(this,e);t&&this.trySubscribe(t)}catch(e){this._error(e)}},t.prototype.closeBuffer=function(e){var t=this.contexts;if(t&&e){var r=e.buffer,n=e.subscription;this.destination.next(r),t.splice(t.indexOf(e),1),this.remove(n),n.unsubscribe()}},t.prototype.trySubscribe=function(e){var t=this.contexts,r=new P.a,n={buffer:[],subscription:r};t.push(n);var i=Object(E.a)(this,e,n);!i||i.closed?this.closeBuffer(n):(i.context=n,this.add(i),r.add(i))},t}(A.a);function M(e){return function(t){return t.lift(new k(e))}}var k=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new B(e,this.closingSelector))},e}(),B=function(e){function t(t,r){var n=e.call(this,t)||this;return n.closingSelector=r,n.subscribing=!1,n.openBuffer(),n}return n.a(t,e),t.prototype._next=function(e){this.buffer.push(e)},t.prototype._complete=function(){var t=this.buffer;t&&this.destination.next(t),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){this.buffer=void 0,this.subscribing=!1},t.prototype.notifyNext=function(){this.openBuffer()},t.prototype.notifyComplete=function(){this.subscribing?this.complete():this.openBuffer()},t.prototype.openBuffer=function(){var e=this.closingSubscription;e&&(this.remove(e),e.unsubscribe());var t,r=this.buffer;this.buffer&&this.destination.next(r),this.buffer=[];try{t=(0,this.closingSelector)()}catch(e){return this.error(e)}e=new P.a,this.closingSubscription=e,this.add(e),this.subscribing=!0,e.add(Object(i.c)(t,new i.a(this))),this.subscribing=!1},t}(i.b);function V(e){return function(t){var r=new R(e),n=t.lift(r);return r.caught=n}}var R=function(){function e(e){this.selector=e}return e.prototype.call=function(e,t){return t.subscribe(new L(e,this.selector,this.caught))},e}(),L=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.selector=r,i.caught=n,i}return n.a(t,e),t.prototype.error=function(t){if(!this.isStopped){var r=void 0;try{r=this.selector(t,this.caught)}catch(t){return void e.prototype.error.call(this,t)}this._unsubscribeAndRecycle();var n=new i.a(this);this.add(n);var a=Object(i.c)(r,n);a!==n&&this.add(a)}},t}(i.b),N=r(302);function F(e){return function(t){return t.lift(new N.a(e))}}var U=r(104),z=r(148);function H(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=null;return"function"==typeof e[e.length-1]&&(r=e.pop()),1===e.length&&Object(U.a)(e[0])&&(e=e[0].slice()),function(t){return t.lift.call(Object(z.a)([t].concat(e)),new N.a(r))}}var G=r(253);function q(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(G.a.apply(void 0,[t].concat(e)))}}var W=r(355),X=r(229);function Y(e,t){return Object(X.b)(e,t,1)}function Q(e,t){return Y((function(){return e}),t)}function K(e){return function(t){return t.lift(new Z(e,t))}}var Z=function(){function e(e,t){this.predicate=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new J(e,this.predicate,this.source))},e}(),J=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.predicate=r,i.source=n,i.count=0,i.index=0,i}return n.a(t,e),t.prototype._next=function(e){this.predicate?this._tryPredicate(e):this.count++},t.prototype._tryPredicate=function(e){var t;try{t=this.predicate(e,this.index++,this.source)}catch(e){return void this.destination.error(e)}t&&this.count++},t.prototype._complete=function(){this.destination.next(this.count),this.destination.complete()},t}(m.a);function $(e){return function(t){return t.lift(new ee(e))}}var ee=function(){function e(e){this.durationSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new te(e,this.durationSelector))},e}(),te=function(e){function t(t,r){var n=e.call(this,t)||this;return n.durationSelector=r,n.hasValue=!1,n}return n.a(t,e),t.prototype._next=function(e){try{var t=this.durationSelector.call(this,e);t&&this._tryNext(e,t)}catch(e){this.destination.error(e)}},t.prototype._complete=function(){this.emitValue(),this.destination.complete()},t.prototype._tryNext=function(e,t){var r=this.durationSubscription;this.value=e,this.hasValue=!0,r&&(r.unsubscribe(),this.remove(r)),(r=Object(i.c)(t,new i.a(this)))&&!r.closed&&this.add(this.durationSubscription=r)},t.prototype.notifyNext=function(){this.emitValue()},t.prototype.notifyComplete=function(){this.emitValue()},t.prototype.emitValue=function(){if(this.hasValue){var t=this.value,r=this.durationSubscription;r&&(this.durationSubscription=void 0,r.unsubscribe(),this.remove(r)),this.value=void 0,this.hasValue=!1,e.prototype._next.call(this,t)}},t}(i.b),re=r(400);function ne(e){return void 0===e&&(e=null),function(t){return t.lift(new ie(e))}}var ie=function(){function e(e){this.defaultValue=e}return e.prototype.call=function(e,t){return t.subscribe(new ae(e,this.defaultValue))},e}(),ae=function(e){function t(t,r){var n=e.call(this,t)||this;return n.defaultValue=r,n.isEmpty=!0,n}return n.a(t,e),t.prototype._next=function(e){this.isEmpty=!1,this.destination.next(e)},t.prototype._complete=function(){this.isEmpty&&this.destination.next(this.defaultValue),this.destination.complete()},t}(m.a);function oe(e){return e instanceof Date&&!isNaN(+e)}var se=r(196);function ue(e,t){void 0===t&&(t=u.a);var r=oe(e)?+e-t.now():Math.abs(e);return function(e){return e.lift(new ce(r,t))}}var ce=function(){function e(e,t){this.delay=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new le(e,this.delay,this.scheduler))},e}(),le=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.delay=r,i.scheduler=n,i.queue=[],i.active=!1,i.errored=!1,i}return n.a(t,e),t.dispatch=function(e){for(var t=e.source,r=t.queue,n=e.scheduler,i=e.destination;r.length>0&&r[0].time-n.now()<=0;)r.shift().notification.observe(i);if(r.length>0){var a=Math.max(0,r[0].time-n.now());this.schedule(e,a)}else this.unsubscribe(),t.active=!1},t.prototype._schedule=function(e){this.active=!0,this.destination.add(e.schedule(t.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))},t.prototype.scheduleNotification=function(e){if(!0!==this.errored){var t=this.scheduler,r=new de(t.now()+this.delay,e);this.queue.push(r),!1===this.active&&this._schedule(t)}},t.prototype._next=function(e){this.scheduleNotification(se.a.createNext(e))},t.prototype._error=function(e){this.errored=!0,this.queue=[],this.destination.error(e),this.unsubscribe()},t.prototype._complete=function(){this.scheduleNotification(se.a.createComplete()),this.unsubscribe()},t}(m.a),de=function(){return function(e,t){this.time=e,this.notification=t}}(),fe=r(45);function pe(e,t){return t?function(r){return new ge(r,t).lift(new me(e))}:function(t){return t.lift(new me(e))}}var me=function(){function e(e){this.delayDurationSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new he(e,this.delayDurationSelector))},e}(),he=function(e){function t(t,r){var n=e.call(this,t)||this;return n.delayDurationSelector=r,n.completed=!1,n.delayNotifierSubscriptions=[],n.index=0,n}return n.a(t,e),t.prototype.notifyNext=function(e,t,r,n,i){this.destination.next(e),this.removeSubscription(i),this.tryComplete()},t.prototype.notifyError=function(e,t){this._error(e)},t.prototype.notifyComplete=function(e){var t=this.removeSubscription(e);t&&this.destination.next(t),this.tryComplete()},t.prototype._next=function(e){var t=this.index++;try{var r=this.delayDurationSelector(e,t);r&&this.tryDelay(r,e)}catch(e){this.destination.error(e)}},t.prototype._complete=function(){this.completed=!0,this.tryComplete(),this.unsubscribe()},t.prototype.removeSubscription=function(e){e.unsubscribe();var t=this.delayNotifierSubscriptions.indexOf(e);return-1!==t&&this.delayNotifierSubscriptions.splice(t,1),e.outerValue},t.prototype.tryDelay=function(e,t){var r=Object(E.a)(this,e,t);r&&!r.closed&&(this.destination.add(r),this.delayNotifierSubscriptions.push(r))},t.prototype.tryComplete=function(){this.completed&&0===this.delayNotifierSubscriptions.length&&this.destination.complete()},t}(A.a),ge=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subscriptionDelay=r,n}return n.a(t,e),t.prototype._subscribe=function(e){this.subscriptionDelay.subscribe(new ve(e,this.source))},t}(fe.a),ve=function(e){function t(t,r){var n=e.call(this)||this;return n.parent=t,n.source=r,n.sourceSubscribed=!1,n}return n.a(t,e),t.prototype._next=function(e){this.subscribeToSource()},t.prototype._error=function(e){this.unsubscribe(),this.parent.error(e)},t.prototype._complete=function(){this.unsubscribe(),this.subscribeToSource()},t.prototype.subscribeToSource=function(){this.sourceSubscribed||(this.sourceSubscribed=!0,this.unsubscribe(),this.source.subscribe(this.parent))},t}(m.a);function be(){return function(e){return e.lift(new ye)}}var ye=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new _e(e))},e}(),_e=function(e){function t(t){return e.call(this,t)||this}return n.a(t,e),t.prototype._next=function(e){e.observe(this.destination)},t}(m.a);function Se(e,t){return function(r){return r.lift(new xe(e,t))}}var xe=function(){function e(e,t){this.keySelector=e,this.flushes=t}return e.prototype.call=function(e,t){return t.subscribe(new Oe(e,this.keySelector,this.flushes))},e}(),Oe=function(e){function t(t,r,n){var a=e.call(this,t)||this;return a.keySelector=r,a.values=new Set,n&&a.add(Object(i.c)(n,new i.a(a))),a}return n.a(t,e),t.prototype.notifyNext=function(){this.values.clear()},t.prototype.notifyError=function(e){this._error(e)},t.prototype._next=function(e){this.keySelector?this._useKeySelector(e):this._finalizeNext(e,e)},t.prototype._useKeySelector=function(e){var t,r=this.destination;try{t=this.keySelector(e)}catch(e){return void r.error(e)}this._finalizeNext(t,e)},t.prototype._finalizeNext=function(e,t){var r=this.values;r.has(e)||(r.add(e),this.destination.next(t))},t}(i.b);function we(e,t){return function(r){return r.lift(new Ce(e,t))}}var Ce=function(){function e(e,t){this.compare=e,this.keySelector=t}return e.prototype.call=function(e,t){return t.subscribe(new je(e,this.compare,this.keySelector))},e}(),je=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.keySelector=n,i.hasKey=!1,"function"==typeof r&&(i.compare=r),i}return n.a(t,e),t.prototype.compare=function(e,t){return e===t},t.prototype._next=function(e){var t;try{var r=this.keySelector;t=r?r(e):e}catch(e){return this.destination.error(e)}var n=!1;if(this.hasKey)try{n=(0,this.compare)(this.key,t)}catch(e){return this.destination.error(e)}else this.hasKey=!0;n||(this.key=t,this.destination.next(e))},t}(m.a);function Pe(e,t){return we((function(r,n){return t?t(r[e],n[e]):r[e]===n[e]}))}var Ee=r(222),Ae=r(168),De=r(230);function Te(e){return void 0===e&&(e=ke),function(t){return t.lift(new Ie(e))}}var Ie=function(){function e(e){this.errorFactory=e}return e.prototype.call=function(e,t){return t.subscribe(new Me(e,this.errorFactory))},e}(),Me=function(e){function t(t,r){var n=e.call(this,t)||this;return n.errorFactory=r,n.hasValue=!1,n}return n.a(t,e),t.prototype._next=function(e){this.hasValue=!0,this.destination.next(e)},t.prototype._complete=function(){if(this.hasValue)return this.destination.complete();var e=void 0;try{e=this.errorFactory()}catch(t){e=t}this.destination.error(e)},t}(m.a);function ke(){return new De.a}var Be=r(301);function Ve(e,t){if(e<0)throw new Ee.a;var r=arguments.length>=2;return function(n){return n.pipe(Object(Ae.a)((function(t,r){return r===e})),Object(Be.a)(1),r?ne(t):Te((function(){return new Ee.a})))}}var Re=r(265);function Le(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return Object(G.a)(t,Re.a.apply(void 0,e))}}function Ne(e,t){return function(r){return r.lift(new Fe(e,t,r))}}var Fe=function(){function e(e,t,r){this.predicate=e,this.thisArg=t,this.source=r}return e.prototype.call=function(e,t){return t.subscribe(new Ue(e,this.predicate,this.thisArg,this.source))},e}(),Ue=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a.predicate=r,a.thisArg=n,a.source=i,a.index=0,a.thisArg=n||a,a}return n.a(t,e),t.prototype.notifyComplete=function(e){this.destination.next(e),this.destination.complete()},t.prototype._next=function(e){var t=!1;try{t=this.predicate.call(this.thisArg,e,this.index++,this.source)}catch(e){return void this.destination.error(e)}t||this.notifyComplete(!1)},t.prototype._complete=function(){this.notifyComplete(!0)},t}(m.a);function ze(){return function(e){return e.lift(new He)}}var He=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new Ge(e))},e}(),Ge=function(e){function t(t){var r=e.call(this,t)||this;return r.hasCompleted=!1,r.hasSubscription=!1,r}return n.a(t,e),t.prototype._next=function(e){this.hasSubscription||(this.hasSubscription=!0,this.add(Object(i.c)(e,new i.a(this))))},t.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete()},t.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},t}(i.b),qe=r(123);function We(e,t){return t?function(r){return r.pipe(We((function(r,n){return Object(z.a)(e(r,n)).pipe(Object(qe.a)((function(e,i){return t(r,e,n,i)})))})))}:function(t){return t.lift(new Xe(e))}}var Xe=function(){function e(e){this.project=e}return e.prototype.call=function(e,t){return t.subscribe(new Ye(e,this.project))},e}(),Ye=function(e){function t(t,r){var n=e.call(this,t)||this;return n.project=r,n.hasSubscription=!1,n.hasCompleted=!1,n.index=0,n}return n.a(t,e),t.prototype._next=function(e){this.hasSubscription||this.tryNext(e)},t.prototype.tryNext=function(e){var t,r=this.index++;try{t=this.project(e,r)}catch(e){return void this.destination.error(e)}this.hasSubscription=!0,this._innerSub(t)},t.prototype._innerSub=function(e){var t=new i.a(this),r=this.destination;r.add(t);var n=Object(i.c)(e,t);n!==t&&r.add(n)},t.prototype._complete=function(){this.hasCompleted=!0,this.hasSubscription||this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e){this.destination.next(e)},t.prototype.notifyError=function(e){this.destination.error(e)},t.prototype.notifyComplete=function(){this.hasSubscription=!1,this.hasCompleted&&this.destination.complete()},t}(i.b);function Qe(e,t,r){return void 0===t&&(t=Number.POSITIVE_INFINITY),t=(t||0)<1?Number.POSITIVE_INFINITY:t,function(n){return n.lift(new Ke(e,t,r))}}var Ke=function(){function e(e,t,r){this.project=e,this.concurrent=t,this.scheduler=r}return e.prototype.call=function(e,t){return t.subscribe(new Ze(e,this.project,this.concurrent,this.scheduler))},e}(),Ze=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a.project=r,a.concurrent=n,a.scheduler=i,a.index=0,a.active=0,a.hasCompleted=!1,n<Number.POSITIVE_INFINITY&&(a.buffer=[]),a}return n.a(t,e),t.dispatch=function(e){var t=e.subscriber,r=e.result,n=e.value,i=e.index;t.subscribeToProjection(r,n,i)},t.prototype._next=function(e){var r=this.destination;if(r.closed)this._complete();else{var n=this.index++;if(this.active<this.concurrent){r.next(e);try{var i=(0,this.project)(e,n);if(this.scheduler){var a={subscriber:this,result:i,value:e,index:n};this.destination.add(this.scheduler.schedule(t.dispatch,0,a))}else this.subscribeToProjection(i,e,n)}catch(e){r.error(e)}}else this.buffer.push(e)}},t.prototype.subscribeToProjection=function(e,t,r){this.active++,this.destination.add(Object(i.c)(e,new i.a(this)))},t.prototype._complete=function(){this.hasCompleted=!0,this.hasCompleted&&0===this.active&&this.destination.complete(),this.unsubscribe()},t.prototype.notifyNext=function(e){this._next(e)},t.prototype.notifyComplete=function(){var e=this.buffer;this.active--,e&&e.length>0&&this._next(e.shift()),this.hasCompleted&&0===this.active&&this.destination.complete()},t}(i.b);function Je(e){return function(t){return t.lift(new $e(e))}}var $e=function(){function e(e){this.callback=e}return e.prototype.call=function(e,t){return t.subscribe(new et(e,this.callback))},e}(),et=function(e){function t(t,r){var n=e.call(this,t)||this;return n.add(new P.a(r)),n}return n.a(t,e),t}(m.a);function tt(e,t){if("function"!=typeof e)throw new TypeError("predicate is not a function");return function(r){return r.lift(new rt(e,r,!1,t))}}var rt=function(){function e(e,t,r,n){this.predicate=e,this.source=t,this.yieldIndex=r,this.thisArg=n}return e.prototype.call=function(e,t){return t.subscribe(new nt(e,this.predicate,this.source,this.yieldIndex,this.thisArg))},e}(),nt=function(e){function t(t,r,n,i,a){var o=e.call(this,t)||this;return o.predicate=r,o.source=n,o.yieldIndex=i,o.thisArg=a,o.index=0,o}return n.a(t,e),t.prototype.notifyComplete=function(e){var t=this.destination;t.next(e),t.complete(),this.unsubscribe()},t.prototype._next=function(e){var t=this.predicate,r=this.thisArg,n=this.index++;try{t.call(r||this,e,n,this.source)&&this.notifyComplete(this.yieldIndex?n:e)}catch(e){this.destination.error(e)}},t.prototype._complete=function(){this.notifyComplete(this.yieldIndex?-1:void 0)},t}(m.a);function it(e,t){return function(r){return r.lift(new rt(e,r,!0,t))}}var at=r(187);function ot(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?Object(Ae.a)((function(t,r){return e(t,r,n)})):at.a,Object(Be.a)(1),r?ne(t):Te((function(){return new De.a})))}}var st=r(346);function ut(){return function(e){return e.lift(new ct)}}var ct=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new lt(e))},e}(),lt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.a(t,e),t.prototype._next=function(e){},t}(m.a);function dt(){return function(e){return e.lift(new ft)}}var ft=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new pt(e))},e}(),pt=function(e){function t(t){return e.call(this,t)||this}return n.a(t,e),t.prototype.notifyComplete=function(e){var t=this.destination;t.next(e),t.complete()},t.prototype._next=function(e){this.notifyComplete(!1)},t.prototype._complete=function(){this.notifyComplete(!0)},t}(m.a),mt=r(143);function ht(e){return function(t){return 0===e?Object(mt.b)():t.lift(new gt(e))}}var gt=function(){function e(e){if(this.total=e,this.total<0)throw new Ee.a}return e.prototype.call=function(e,t){return t.subscribe(new vt(e,this.total))},e}(),vt=function(e){function t(t,r){var n=e.call(this,t)||this;return n.total=r,n.ring=new Array,n.count=0,n}return n.a(t,e),t.prototype._next=function(e){var t=this.ring,r=this.total,n=this.count++;t.length<r?t.push(e):t[n%r]=e},t.prototype._complete=function(){var e=this.destination,t=this.count;if(t>0)for(var r=this.count>=this.total?this.total:this.count,n=this.ring,i=0;i<r;i++){var a=t++%r;e.next(n[a])}e.complete()},t}(m.a);function bt(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?Object(Ae.a)((function(t,r){return e(t,r,n)})):at.a,ht(1),r?ne(t):Te((function(){return new De.a})))}}function yt(e){return function(t){return t.lift(new _t(e))}}var _t=function(){function e(e){this.value=e}return e.prototype.call=function(e,t){return t.subscribe(new St(e,this.value))},e}(),St=function(e){function t(t,r){var n=e.call(this,t)||this;return n.value=r,n}return n.a(t,e),t.prototype._next=function(e){this.destination.next(this.value)},t}(m.a);function xt(){return function(e){return e.lift(new Ot)}}var Ot=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new wt(e))},e}(),wt=function(e){function t(t){return e.call(this,t)||this}return n.a(t,e),t.prototype._next=function(e){this.destination.next(se.a.createNext(e))},t.prototype._error=function(e){var t=this.destination;t.next(se.a.createError(e)),t.complete()},t.prototype._complete=function(){var e=this.destination;e.next(se.a.createComplete()),e.complete()},t}(m.a);function Ct(e,t){var r=!1;return arguments.length>=2&&(r=!0),function(n){return n.lift(new jt(e,t,r))}}var jt=function(){function e(e,t,r){void 0===r&&(r=!1),this.accumulator=e,this.seed=t,this.hasSeed=r}return e.prototype.call=function(e,t){return t.subscribe(new Pt(e,this.accumulator,this.seed,this.hasSeed))},e}(),Pt=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a.accumulator=r,a._seed=n,a.hasSeed=i,a.index=0,a}return n.a(t,e),Object.defineProperty(t.prototype,"seed",{get:function(){return this._seed},set:function(e){this.hasSeed=!0,this._seed=e},enumerable:!0,configurable:!0}),t.prototype._next=function(e){if(this.hasSeed)return this._tryNext(e);this.seed=e,this.destination.next(e)},t.prototype._tryNext=function(e){var t,r=this.index++;try{t=this.accumulator(this.seed,e,r)}catch(e){this.destination.error(e)}this.seed=t,this.destination.next(t)},t}(m.a),Et=r(281);function At(e,t){return arguments.length>=2?function(r){return Object(Et.a)(Ct(e,t),ht(1),ne(t))(r)}:function(t){return Object(Et.a)(Ct((function(t,r,n){return e(t,r,n+1)})),ht(1))(t)}}function Dt(e){return At("function"==typeof e?function(t,r){return e(t,r)>0?t:r}:function(e,t){return e>t?e:t})}var Tt=r(247);function It(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(Tt.a.apply(void 0,[t].concat(e)))}}var Mt=r(300);function kt(e,t,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),"function"==typeof t?Object(X.b)((function(){return e}),t,r):("number"==typeof t&&(r=t),Object(X.b)((function(){return e}),r))}function Bt(e,t,r){return void 0===r&&(r=Number.POSITIVE_INFINITY),function(n){return n.lift(new Vt(e,t,r))}}var Vt=function(){function e(e,t,r){this.accumulator=e,this.seed=t,this.concurrent=r}return e.prototype.call=function(e,t){return t.subscribe(new Rt(e,this.accumulator,this.seed,this.concurrent))},e}(),Rt=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a.accumulator=r,a.acc=n,a.concurrent=i,a.hasValue=!1,a.hasCompleted=!1,a.buffer=[],a.active=0,a.index=0,a}return n.a(t,e),t.prototype._next=function(e){if(this.active<this.concurrent){var t=this.index++,r=this.destination,n=void 0;try{n=(0,this.accumulator)(this.acc,e,t)}catch(e){return r.error(e)}this.active++,this._innerSub(n)}else this.buffer.push(e)},t.prototype._innerSub=function(e){var t=new i.a(this),r=this.destination;r.add(t);var n=Object(i.c)(e,t);n!==t&&r.add(n)},t.prototype._complete=function(){this.hasCompleted=!0,0===this.active&&0===this.buffer.length&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete()),this.unsubscribe()},t.prototype.notifyNext=function(e){var t=this.destination;this.acc=e,this.hasValue=!0,t.next(e)},t.prototype.notifyComplete=function(){var e=this.buffer;this.active--,e.length>0?this._next(e.shift()):0===this.active&&this.hasCompleted&&(!1===this.hasValue&&this.destination.next(this.acc),this.destination.complete())},t}(i.b);function Lt(e){return At("function"==typeof e?function(t,r){return e(t,r)<0?t:r}:function(e,t){return e<t?e:t})}var Nt=r(356);function Ft(e,t){return function(r){var n;if(n="function"==typeof e?e:function(){return e},"function"==typeof t)return r.lift(new Ut(n,t));var i=Object.create(r,Nt.b);return i.source=r,i.subjectFactory=n,i}}var Ut=function(){function e(e,t){this.subjectFactory=e,this.selector=t}return e.prototype.call=function(e,t){var r=this.selector,n=this.subjectFactory(),i=r(n).subscribe(e);return i.add(t.subscribe(n)),i},e}(),zt=r(357);function Ht(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return 1===e.length&&Object(U.a)(e[0])&&(e=e[0]),function(t){return t.lift(new Gt(e))}}var Gt=function(){function e(e){this.nextSources=e}return e.prototype.call=function(e,t){return t.subscribe(new qt(e,this.nextSources))},e}(),qt=function(e){function t(t,r){var n=e.call(this,t)||this;return n.destination=t,n.nextSources=r,n}return n.a(t,e),t.prototype.notifyError=function(){this.subscribeToNextSource()},t.prototype.notifyComplete=function(){this.subscribeToNextSource()},t.prototype._error=function(e){this.subscribeToNextSource(),this.unsubscribe()},t.prototype._complete=function(){this.subscribeToNextSource(),this.unsubscribe()},t.prototype.subscribeToNextSource=function(){var e=this.nextSources.shift();if(e){var t=new i.a(this),r=this.destination;r.add(t);var n=Object(i.c)(e,t);n!==t&&r.add(n)}else this.destination.complete()},t}(i.b);function Wt(){return function(e){return e.lift(new Xt)}}var Xt=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new Yt(e))},e}(),Yt=function(e){function t(t){var r=e.call(this,t)||this;return r.hasPrev=!1,r}return n.a(t,e),t.prototype._next=function(e){var t;this.hasPrev?t=[this.prev,e]:this.hasPrev=!0,this.prev=e,t&&this.destination.next(t)},t}(m.a),Qt=r(389);function Kt(e,t){return function(r){return[Object(Ae.a)(e,t)(r),Object(Ae.a)(Object(Qt.a)(e,t))(r)]}}function Zt(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e.length;if(0===r)throw new Error("list of properties cannot be empty.");return function(t){return Object(qe.a)(Jt(e,r))(t)}}function Jt(e,t){return function(r){for(var n=r,i=0;i<t;i++){var a=null!=n?n[e[i]]:void 0;if(void 0===a)return;n=a}return n}}var $t=r(62);function er(e){return e?Ft((function(){return new $t.a}),e):Ft(new $t.a)}var tr=r(245);function rr(e){return function(t){return Ft(new tr.a(e))(t)}}var nr=r(237);function ir(){return function(e){return Ft(new nr.a)(e)}}var ar=r(305);function or(e,t,r,n){r&&"function"!=typeof r&&(n=r);var i="function"==typeof r?r:void 0,a=new ar.a(e,t,n);return function(e){return Ft((function(){return a}),i)(e)}}var sr=r(358);function ur(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return 1===e.length&&Object(U.a)(e[0])&&(e=e[0]),t.lift.call(sr.a.apply(void 0,[t].concat(e)))}}function cr(e){return void 0===e&&(e=-1),function(t){return 0===e?Object(mt.b)():e<0?t.lift(new lr(-1,t)):t.lift(new lr(e-1,t))}}var lr=function(){function e(e,t){this.count=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new dr(e,this.count,this.source))},e}(),dr=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.count=r,i.source=n,i}return n.a(t,e),t.prototype.complete=function(){if(!this.isStopped){var t=this.source,r=this.count;if(0===r)return e.prototype.complete.call(this);r>-1&&(this.count=r-1),t.subscribe(this._unsubscribeAndRecycle())}},t}(m.a);function fr(e){return function(t){return t.lift(new pr(e))}}var pr=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){return t.subscribe(new mr(e,this.notifier,t))},e}(),mr=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.notifier=r,i.source=n,i.sourceIsBeingSubscribedTo=!0,i}return n.a(t,e),t.prototype.notifyNext=function(){this.sourceIsBeingSubscribedTo=!0,this.source.subscribe(this)},t.prototype.notifyComplete=function(){if(!1===this.sourceIsBeingSubscribedTo)return e.prototype.complete.call(this)},t.prototype.complete=function(){if(this.sourceIsBeingSubscribedTo=!1,!this.isStopped){if(this.retries||this.subscribeToRetries(),!this.retriesSubscription||this.retriesSubscription.closed)return e.prototype.complete.call(this);this._unsubscribeAndRecycle(),this.notifications.next(void 0)}},t.prototype._unsubscribe=function(){var e=this.notifications,t=this.retriesSubscription;e&&(e.unsubscribe(),this.notifications=void 0),t&&(t.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},t.prototype._unsubscribeAndRecycle=function(){var t=this._unsubscribe;return this._unsubscribe=null,e.prototype._unsubscribeAndRecycle.call(this),this._unsubscribe=t,this},t.prototype.subscribeToRetries=function(){var t;this.notifications=new $t.a;try{t=(0,this.notifier)(this.notifications)}catch(t){return e.prototype.complete.call(this)}this.retries=t,this.retriesSubscription=Object(i.c)(t,new i.a(this))},t}(i.b);function hr(e){return void 0===e&&(e=-1),function(t){return t.lift(new gr(e,t))}}var gr=function(){function e(e,t){this.count=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new vr(e,this.count,this.source))},e}(),vr=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.count=r,i.source=n,i}return n.a(t,e),t.prototype.error=function(t){if(!this.isStopped){var r=this.source,n=this.count;if(0===n)return e.prototype.error.call(this,t);n>-1&&(this.count=n-1),r.subscribe(this._unsubscribeAndRecycle())}},t}(m.a);function br(e){return function(t){return t.lift(new yr(e,t))}}var yr=function(){function e(e,t){this.notifier=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new _r(e,this.notifier,this.source))},e}(),_r=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.notifier=r,i.source=n,i}return n.a(t,e),t.prototype.error=function(t){if(!this.isStopped){var r=this.errors,n=this.retries,a=this.retriesSubscription;if(n)this.errors=void 0,this.retriesSubscription=void 0;else{r=new $t.a;try{n=(0,this.notifier)(r)}catch(t){return e.prototype.error.call(this,t)}a=Object(i.c)(n,new i.a(this))}this._unsubscribeAndRecycle(),this.errors=r,this.retries=n,this.retriesSubscription=a,r.next(t)}},t.prototype._unsubscribe=function(){var e=this.errors,t=this.retriesSubscription;e&&(e.unsubscribe(),this.errors=void 0),t&&(t.unsubscribe(),this.retriesSubscription=void 0),this.retries=void 0},t.prototype.notifyNext=function(){var e=this._unsubscribe;this._unsubscribe=null,this._unsubscribeAndRecycle(),this._unsubscribe=e,this.source.subscribe(this)},t}(i.b),Sr=r(304);function xr(e){return function(t){return t.lift(new Or(e))}}var Or=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var r=new wr(e),n=t.subscribe(r);return n.add(Object(i.c)(this.notifier,new i.a(r))),n},e}(),wr=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hasValue=!1,t}return n.a(t,e),t.prototype._next=function(e){this.value=e,this.hasValue=!0},t.prototype.notifyNext=function(){this.emitValue()},t.prototype.notifyComplete=function(){this.emitValue()},t.prototype.emitValue=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.value))},t}(i.b);function Cr(e,t){return void 0===t&&(t=u.a),function(r){return r.lift(new jr(e,t))}}var jr=function(){function e(e,t){this.period=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new Pr(e,this.period,this.scheduler))},e}(),Pr=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.period=r,i.scheduler=n,i.hasValue=!1,i.add(n.schedule(Er,r,{subscriber:i,period:r})),i}return n.a(t,e),t.prototype._next=function(e){this.lastValue=e,this.hasValue=!0},t.prototype.notifyNext=function(){this.hasValue&&(this.hasValue=!1,this.destination.next(this.lastValue))},t}(m.a);function Er(e){var t=e.subscriber,r=e.period;t.notifyNext(),this.schedule(e,r)}function Ar(e,t){return function(r){return r.lift(new Dr(e,t))}}var Dr=function(){function e(e,t){this.compareTo=e,this.comparator=t}return e.prototype.call=function(e,t){return t.subscribe(new Tr(e,this.compareTo,this.comparator))},e}(),Tr=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.compareTo=r,i.comparator=n,i._a=[],i._b=[],i._oneComplete=!1,i.destination.add(r.subscribe(new Ir(t,i))),i}return n.a(t,e),t.prototype._next=function(e){this._oneComplete&&0===this._b.length?this.emit(!1):(this._a.push(e),this.checkValues())},t.prototype._complete=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0,this.unsubscribe()},t.prototype.checkValues=function(){for(var e=this._a,t=this._b,r=this.comparator;e.length>0&&t.length>0;){var n=e.shift(),i=t.shift(),a=!1;try{a=r?r(n,i):n===i}catch(e){this.destination.error(e)}a||this.emit(!1)}},t.prototype.emit=function(e){var t=this.destination;t.next(e),t.complete()},t.prototype.nextB=function(e){this._oneComplete&&0===this._a.length?this.emit(!1):(this._b.push(e),this.checkValues())},t.prototype.completeB=function(){this._oneComplete?this.emit(0===this._a.length&&0===this._b.length):this._oneComplete=!0},t}(m.a),Ir=function(e){function t(t,r){var n=e.call(this,t)||this;return n.parent=r,n}return n.a(t,e),t.prototype._next=function(e){this.parent.nextB(e)},t.prototype._error=function(e){this.parent.error(e),this.unsubscribe()},t.prototype._complete=function(){this.parent.completeB(),this.unsubscribe()},t}(m.a);function Mr(){return new $t.a}function kr(){return function(e){return Object(Sr.a)()(Ft(Mr)(e))}}function Br(e,t,r){var n;return n=e&&"object"==typeof e?e:{bufferSize:e,windowTime:t,refCount:!1,scheduler:r},function(e){return e.lift(function(e){var t,r,n=e.bufferSize,i=void 0===n?Number.POSITIVE_INFINITY:n,a=e.windowTime,o=void 0===a?Number.POSITIVE_INFINITY:a,s=e.refCount,u=e.scheduler,c=0,l=!1,d=!1;return function(e){var n;c++,!t||l?(l=!1,t=new ar.a(i,o,u),n=t.subscribe(this),r=e.subscribe({next:function(e){t.next(e)},error:function(e){l=!0,t.error(e)},complete:function(){d=!0,r=void 0,t.complete()}}),d&&(r=void 0)):n=t.subscribe(this),this.add((function(){c--,n.unsubscribe(),n=void 0,r&&!d&&s&&0===c&&(r.unsubscribe(),r=void 0,t=void 0)}))}}(n))}}function Vr(e){return function(t){return t.lift(new Rr(e,t))}}var Rr=function(){function e(e,t){this.predicate=e,this.source=t}return e.prototype.call=function(e,t){return t.subscribe(new Lr(e,this.predicate,this.source))},e}(),Lr=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.predicate=r,i.source=n,i.seenValue=!1,i.index=0,i}return n.a(t,e),t.prototype.applySingleValue=function(e){this.seenValue?this.destination.error("Sequence contains more than one element"):(this.seenValue=!0,this.singleValue=e)},t.prototype._next=function(e){var t=this.index++;this.predicate?this.tryNext(e,t):this.applySingleValue(e)},t.prototype.tryNext=function(e,t){try{this.predicate(e,t,this.source)&&this.applySingleValue(e)}catch(e){this.destination.error(e)}},t.prototype._complete=function(){var e=this.destination;this.index>0?(e.next(this.seenValue?this.singleValue:void 0),e.complete()):e.error(new De.a)},t}(m.a);function Nr(e){return function(t){return t.lift(new Fr(e))}}var Fr=function(){function e(e){this.total=e}return e.prototype.call=function(e,t){return t.subscribe(new Ur(e,this.total))},e}(),Ur=function(e){function t(t,r){var n=e.call(this,t)||this;return n.total=r,n.count=0,n}return n.a(t,e),t.prototype._next=function(e){++this.count>this.total&&this.destination.next(e)},t}(m.a);function zr(e){return function(t){return t.lift(new Hr(e))}}var Hr=function(){function e(e){if(this._skipCount=e,this._skipCount<0)throw new Ee.a}return e.prototype.call=function(e,t){return 0===this._skipCount?t.subscribe(new m.a(e)):t.subscribe(new Gr(e,this._skipCount))},e}(),Gr=function(e){function t(t,r){var n=e.call(this,t)||this;return n._skipCount=r,n._count=0,n._ring=new Array(r),n}return n.a(t,e),t.prototype._next=function(e){var t=this._skipCount,r=this._count++;if(r<t)this._ring[r]=e;else{var n=r%t,i=this._ring,a=i[n];i[n]=e,this.destination.next(a)}},t}(m.a);function qr(e){return function(t){return t.lift(new Wr(e))}}var Wr=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){return t.subscribe(new Xr(e,this.notifier))},e}(),Xr=function(e){function t(t,r){var n=e.call(this,t)||this;n.hasValue=!1;var a=new i.a(n);n.add(a),n.innerSubscription=a;var o=Object(i.c)(r,a);return o!==a&&(n.add(o),n.innerSubscription=o),n}return n.a(t,e),t.prototype._next=function(t){this.hasValue&&e.prototype._next.call(this,t)},t.prototype.notifyNext=function(){this.hasValue=!0,this.innerSubscription&&this.innerSubscription.unsubscribe()},t.prototype.notifyComplete=function(){},t}(i.b);function Yr(e){return function(t){return t.lift(new Qr(e))}}var Qr=function(){function e(e){this.predicate=e}return e.prototype.call=function(e,t){return t.subscribe(new Kr(e,this.predicate))},e}(),Kr=function(e){function t(t,r){var n=e.call(this,t)||this;return n.predicate=r,n.skipping=!0,n.index=0,n}return n.a(t,e),t.prototype._next=function(e){var t=this.destination;this.skipping&&this.tryCallPredicate(e),this.skipping||t.next(e)},t.prototype.tryCallPredicate=function(e){try{var t=this.predicate(e,this.index++);this.skipping=Boolean(t)}catch(e){this.destination.error(e)}},t}(m.a);function Zr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[e.length-1];return Object(y.a)(r)?(e.pop(),function(t){return Object(G.a)(e,t,r)}):function(t){return Object(G.a)(e,t)}}var Jr=r(283),$r=r(243),en=function(e){function t(t,r,n){void 0===r&&(r=0),void 0===n&&(n=Jr.a);var i=e.call(this)||this;return i.source=t,i.delayTime=r,i.scheduler=n,(!Object($r.a)(r)||r<0)&&(i.delayTime=0),n&&"function"==typeof n.schedule||(i.scheduler=Jr.a),i}return n.a(t,e),t.create=function(e,r,n){return void 0===r&&(r=0),void 0===n&&(n=Jr.a),new t(e,r,n)},t.dispatch=function(e){var t=e.source,r=e.subscriber;return this.add(t.subscribe(r))},t.prototype._subscribe=function(e){var r=this.delayTime,n=this.source;return this.scheduler.schedule(t.dispatch,r,{source:n,subscriber:e})},t}(fe.a);function tn(e,t){return void 0===t&&(t=0),function(r){return r.lift(new rn(e,t))}}var rn=function(){function e(e,t){this.scheduler=e,this.delay=t}return e.prototype.call=function(e,t){return new en(t,this.delay,this.scheduler).subscribe(e)},e}();function nn(e,t){return"function"==typeof t?function(r){return r.pipe(nn((function(r,n){return Object(z.a)(e(r,n)).pipe(Object(qe.a)((function(e,i){return t(r,e,n,i)})))})))}:function(t){return t.lift(new an(e))}}var an=function(){function e(e){this.project=e}return e.prototype.call=function(e,t){return t.subscribe(new on(e,this.project))},e}(),on=function(e){function t(t,r){var n=e.call(this,t)||this;return n.project=r,n.index=0,n}return n.a(t,e),t.prototype._next=function(e){var t,r=this.index++;try{t=this.project(e,r)}catch(e){return void this.destination.error(e)}this._innerSub(t)},t.prototype._innerSub=function(e){var t=this.innerSubscription;t&&t.unsubscribe();var r=new i.a(this),n=this.destination;n.add(r),this.innerSubscription=Object(i.c)(e,r),this.innerSubscription!==r&&n.add(this.innerSubscription)},t.prototype._complete=function(){var t=this.innerSubscription;t&&!t.closed||e.prototype._complete.call(this),this.unsubscribe()},t.prototype._unsubscribe=function(){this.innerSubscription=void 0},t.prototype.notifyComplete=function(){this.innerSubscription=void 0,this.isStopped&&e.prototype._complete.call(this)},t.prototype.notifyNext=function(e){this.destination.next(e)},t}(i.b);function sn(){return nn(at.a)}function un(e,t){return t?nn((function(){return e}),t):nn((function(){return e}))}function cn(e){return function(t){return t.lift(new ln(e))}}var ln=function(){function e(e){this.notifier=e}return e.prototype.call=function(e,t){var r=new dn(e),n=Object(i.c)(this.notifier,new i.a(r));return n&&!r.seenValue?(r.add(n),t.subscribe(r)):r},e}(),dn=function(e){function t(t){var r=e.call(this,t)||this;return r.seenValue=!1,r}return n.a(t,e),t.prototype.notifyNext=function(){this.seenValue=!0,this.complete()},t.prototype.notifyComplete=function(){},t}(i.b);function fn(e,t){return void 0===t&&(t=!1),function(r){return r.lift(new pn(e,t))}}var pn=function(){function e(e,t){this.predicate=e,this.inclusive=t}return e.prototype.call=function(e,t){return t.subscribe(new mn(e,this.predicate,this.inclusive))},e}(),mn=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.predicate=r,i.inclusive=n,i.index=0,i}return n.a(t,e),t.prototype._next=function(e){var t,r=this.destination;try{t=this.predicate(e,this.index++)}catch(e){return void r.error(e)}this.nextOrComplete(e,t)},t.prototype.nextOrComplete=function(e,t){var r=this.destination;Boolean(t)?r.next(e):(this.inclusive&&r.next(e),r.complete())},t}(m.a),hn=r(207),gn=r(223);function vn(e,t,r){return function(n){return n.lift(new bn(e,t,r))}}var bn=function(){function e(e,t,r){this.nextOrObserver=e,this.error=t,this.complete=r}return e.prototype.call=function(e,t){return t.subscribe(new yn(e,this.nextOrObserver,this.error,this.complete))},e}(),yn=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a._tapNext=hn.a,a._tapError=hn.a,a._tapComplete=hn.a,a._tapError=n||hn.a,a._tapComplete=i||hn.a,Object(gn.a)(r)?(a._context=a,a._tapNext=r):r&&(a._context=r,a._tapNext=r.next||hn.a,a._tapError=r.error||hn.a,a._tapComplete=r.complete||hn.a),a}return n.a(t,e),t.prototype._next=function(e){try{this._tapNext.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.next(e)},t.prototype._error=function(e){try{this._tapError.call(this._context,e)}catch(e){return void this.destination.error(e)}this.destination.error(e)},t.prototype._complete=function(){try{this._tapComplete.call(this._context)}catch(e){return void this.destination.error(e)}return this.destination.complete()},t}(m.a),_n={leading:!0,trailing:!1};function Sn(e,t){return void 0===t&&(t=_n),function(r){return r.lift(new xn(e,!!t.leading,!!t.trailing))}}var xn=function(){function e(e,t,r){this.durationSelector=e,this.leading=t,this.trailing=r}return e.prototype.call=function(e,t){return t.subscribe(new On(e,this.durationSelector,this.leading,this.trailing))},e}(),On=function(e){function t(t,r,n,i){var a=e.call(this,t)||this;return a.destination=t,a.durationSelector=r,a._leading=n,a._trailing=i,a._hasValue=!1,a}return n.a(t,e),t.prototype._next=function(e){this._hasValue=!0,this._sendValue=e,this._throttled||(this._leading?this.send():this.throttle(e))},t.prototype.send=function(){var e=this._hasValue,t=this._sendValue;e&&(this.destination.next(t),this.throttle(t)),this._hasValue=!1,this._sendValue=void 0},t.prototype.throttle=function(e){var t=this.tryDurationSelector(e);t&&this.add(this._throttled=Object(i.c)(t,new i.a(this)))},t.prototype.tryDurationSelector=function(e){try{return this.durationSelector(e)}catch(e){return this.destination.error(e),null}},t.prototype.throttlingDone=function(){var e=this._throttled,t=this._trailing;e&&e.unsubscribe(),this._throttled=void 0,t&&this.send()},t.prototype.notifyNext=function(){this.throttlingDone()},t.prototype.notifyComplete=function(){this.throttlingDone()},t}(i.b);function wn(e,t,r){return void 0===t&&(t=u.a),void 0===r&&(r=_n),function(n){return n.lift(new Cn(e,t,r.leading,r.trailing))}}var Cn=function(){function e(e,t,r,n){this.duration=e,this.scheduler=t,this.leading=r,this.trailing=n}return e.prototype.call=function(e,t){return t.subscribe(new jn(e,this.duration,this.scheduler,this.leading,this.trailing))},e}(),jn=function(e){function t(t,r,n,i,a){var o=e.call(this,t)||this;return o.duration=r,o.scheduler=n,o.leading=i,o.trailing=a,o._hasTrailingValue=!1,o._trailingValue=null,o}return n.a(t,e),t.prototype._next=function(e){this.throttled?this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0):(this.add(this.throttled=this.scheduler.schedule(Pn,this.duration,{subscriber:this})),this.leading?this.destination.next(e):this.trailing&&(this._trailingValue=e,this._hasTrailingValue=!0))},t.prototype._complete=function(){this._hasTrailingValue?(this.destination.next(this._trailingValue),this.destination.complete()):this.destination.complete()},t.prototype.clearThrottle=function(){var e=this.throttled;e&&(this.trailing&&this._hasTrailingValue&&(this.destination.next(this._trailingValue),this._trailingValue=null,this._hasTrailingValue=!1),e.unsubscribe(),this.remove(e),this.throttled=null)},t}(m.a);function Pn(e){e.subscriber.clearThrottle()}var En=r(306);function An(e){return void 0===e&&(e=u.a),function(t){return Object(En.a)((function(){return t.pipe(Ct((function(t,r){var n=t.current;return{value:r,current:e.now(),last:n}}),{current:e.now(),value:void 0,last:void 0}),Object(qe.a)((function(e){var t=e.current,r=e.last,n=e.value;return new Dn(n,t-r)})))}))}}var Dn=function(){return function(e,t){this.value=e,this.interval=t}}(),Tn=r(359);function In(e,t,r){return void 0===r&&(r=u.a),function(n){var i=oe(e),a=i?+e-r.now():Math.abs(e);return n.lift(new Mn(a,i,t,r))}}var Mn=function(){function e(e,t,r,n){this.waitFor=e,this.absoluteTimeout=t,this.withObservable=r,this.scheduler=n}return e.prototype.call=function(e,t){return t.subscribe(new kn(e,this.absoluteTimeout,this.waitFor,this.withObservable,this.scheduler))},e}(),kn=function(e){function t(t,r,n,i,a){var o=e.call(this,t)||this;return o.absoluteTimeout=r,o.waitFor=n,o.withObservable=i,o.scheduler=a,o.scheduleTimeout(),o}return n.a(t,e),t.dispatchTimeout=function(e){var t=e.withObservable;e._unsubscribeAndRecycle(),e.add(Object(i.c)(t,new i.a(e)))},t.prototype.scheduleTimeout=function(){var e=this.action;e?this.action=e.schedule(this,this.waitFor):this.add(this.action=this.scheduler.schedule(t.dispatchTimeout,this.waitFor,this))},t.prototype._next=function(t){this.absoluteTimeout||this.scheduleTimeout(),e.prototype._next.call(this,t)},t.prototype._unsubscribe=function(){this.action=void 0,this.scheduler=null,this.withObservable=null},t}(i.b),Bn=r(303);function Vn(e,t){return void 0===t&&(t=u.a),In(e,Object(Bn.a)(new Tn.a),t)}function Rn(e){return void 0===e&&(e=u.a),Object(qe.a)((function(t){return new Ln(t,e.now())}))}var Ln=function(){return function(e,t){this.value=e,this.timestamp=t}}();function Nn(e,t,r){return 0===r?[t]:(e.push(t),e)}function Fn(){return At(Nn,[])}function Un(e){return function(t){return t.lift(new zn(e))}}var zn=function(){function e(e){this.windowBoundaries=e}return e.prototype.call=function(e,t){var r=new Hn(e),n=t.subscribe(r);return n.closed||r.add(Object(i.c)(this.windowBoundaries,new i.a(r))),n},e}(),Hn=function(e){function t(t){var r=e.call(this,t)||this;return r.window=new $t.a,t.next(r.window),r}return n.a(t,e),t.prototype.notifyNext=function(){this.openWindow()},t.prototype.notifyError=function(e){this._error(e)},t.prototype.notifyComplete=function(){this._complete()},t.prototype._next=function(e){this.window.next(e)},t.prototype._error=function(e){this.window.error(e),this.destination.error(e)},t.prototype._complete=function(){this.window.complete(),this.destination.complete()},t.prototype._unsubscribe=function(){this.window=null},t.prototype.openWindow=function(){var e=this.window;e&&e.complete();var t=this.destination,r=this.window=new $t.a;t.next(r)},t}(i.b);function Gn(e,t){return void 0===t&&(t=0),function(r){return r.lift(new qn(e,t))}}var qn=function(){function e(e,t){this.windowSize=e,this.startWindowEvery=t}return e.prototype.call=function(e,t){return t.subscribe(new Wn(e,this.windowSize,this.startWindowEvery))},e}(),Wn=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.destination=t,i.windowSize=r,i.startWindowEvery=n,i.windows=[new $t.a],i.count=0,t.next(i.windows[0]),i}return n.a(t,e),t.prototype._next=function(e){for(var t=this.startWindowEvery>0?this.startWindowEvery:this.windowSize,r=this.destination,n=this.windowSize,i=this.windows,a=i.length,o=0;o<a&&!this.closed;o++)i[o].next(e);var s=this.count-n+1;if(s>=0&&s%t==0&&!this.closed&&i.shift().complete(),++this.count%t==0&&!this.closed){var u=new $t.a;i.push(u),r.next(u)}},t.prototype._error=function(e){var t=this.windows;if(t)for(;t.length>0&&!this.closed;)t.shift().error(e);this.destination.error(e)},t.prototype._complete=function(){var e=this.windows;if(e)for(;e.length>0&&!this.closed;)e.shift().complete();this.destination.complete()},t.prototype._unsubscribe=function(){this.count=0,this.windows=null},t}(m.a);function Xn(e){var t=u.a,r=null,n=Number.POSITIVE_INFINITY;return Object(y.a)(arguments[3])&&(t=arguments[3]),Object(y.a)(arguments[2])?t=arguments[2]:Object($r.a)(arguments[2])&&(n=Number(arguments[2])),Object(y.a)(arguments[1])?t=arguments[1]:Object($r.a)(arguments[1])&&(r=Number(arguments[1])),function(i){return i.lift(new Yn(e,r,n,t))}}var Yn=function(){function e(e,t,r,n){this.windowTimeSpan=e,this.windowCreationInterval=t,this.maxWindowSize=r,this.scheduler=n}return e.prototype.call=function(e,t){return t.subscribe(new Kn(e,this.windowTimeSpan,this.windowCreationInterval,this.maxWindowSize,this.scheduler))},e}(),Qn=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._numberOfNextedValues=0,t}return n.a(t,e),t.prototype.next=function(t){this._numberOfNextedValues++,e.prototype.next.call(this,t)},Object.defineProperty(t.prototype,"numberOfNextedValues",{get:function(){return this._numberOfNextedValues},enumerable:!0,configurable:!0}),t}($t.a),Kn=function(e){function t(t,r,n,i,a){var o=e.call(this,t)||this;o.destination=t,o.windowTimeSpan=r,o.windowCreationInterval=n,o.maxWindowSize=i,o.scheduler=a,o.windows=[];var s=o.openWindow();if(null!==n&&n>=0){var u={subscriber:o,window:s,context:null},c={windowTimeSpan:r,windowCreationInterval:n,subscriber:o,scheduler:a};o.add(a.schedule($n,r,u)),o.add(a.schedule(Jn,n,c))}else{var l={subscriber:o,window:s,windowTimeSpan:r};o.add(a.schedule(Zn,r,l))}return o}return n.a(t,e),t.prototype._next=function(e){for(var t=this.windows,r=t.length,n=0;n<r;n++){var i=t[n];i.closed||(i.next(e),i.numberOfNextedValues>=this.maxWindowSize&&this.closeWindow(i))}},t.prototype._error=function(e){for(var t=this.windows;t.length>0;)t.shift().error(e);this.destination.error(e)},t.prototype._complete=function(){for(var e=this.windows;e.length>0;){var t=e.shift();t.closed||t.complete()}this.destination.complete()},t.prototype.openWindow=function(){var e=new Qn;return this.windows.push(e),this.destination.next(e),e},t.prototype.closeWindow=function(e){e.complete();var t=this.windows;t.splice(t.indexOf(e),1)},t}(m.a);function Zn(e){var t=e.subscriber,r=e.windowTimeSpan,n=e.window;n&&t.closeWindow(n),e.window=t.openWindow(),this.schedule(e,r)}function Jn(e){var t=e.windowTimeSpan,r=e.subscriber,n=e.scheduler,i=e.windowCreationInterval,a=r.openWindow(),o={action:this,subscription:null},s={subscriber:r,window:a,context:o};o.subscription=n.schedule($n,t,s),this.add(o.subscription),this.schedule(e,i)}function $n(e){var t=e.subscriber,r=e.window,n=e.context;n&&n.action&&n.subscription&&n.action.remove(n.subscription),t.closeWindow(r)}function ei(e,t){return function(r){return r.lift(new ti(e,t))}}var ti=function(){function e(e,t){this.openings=e,this.closingSelector=t}return e.prototype.call=function(e,t){return t.subscribe(new ri(e,this.openings,this.closingSelector))},e}(),ri=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.openings=r,i.closingSelector=n,i.contexts=[],i.add(i.openSubscription=Object(E.a)(i,r,r)),i}return n.a(t,e),t.prototype._next=function(e){var t=this.contexts;if(t)for(var r=t.length,n=0;n<r;n++)t[n].window.next(e)},t.prototype._error=function(t){var r=this.contexts;if(this.contexts=null,r)for(var n=r.length,i=-1;++i<n;){var a=r[i];a.window.error(t),a.subscription.unsubscribe()}e.prototype._error.call(this,t)},t.prototype._complete=function(){var t=this.contexts;if(this.contexts=null,t)for(var r=t.length,n=-1;++n<r;){var i=t[n];i.window.complete(),i.subscription.unsubscribe()}e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){var e=this.contexts;if(this.contexts=null,e)for(var t=e.length,r=-1;++r<t;){var n=e[r];n.window.unsubscribe(),n.subscription.unsubscribe()}},t.prototype.notifyNext=function(e,t,r,n,i){if(e===this.openings){var a=void 0;try{a=(0,this.closingSelector)(t)}catch(e){return this.error(e)}var o=new $t.a,s=new P.a,u={window:o,subscription:s};this.contexts.push(u);var c=Object(E.a)(this,a,u);c.closed?this.closeWindow(this.contexts.length-1):(c.context=u,s.add(c)),this.destination.next(o)}else this.closeWindow(this.contexts.indexOf(e))},t.prototype.notifyError=function(e){this.error(e)},t.prototype.notifyComplete=function(e){e!==this.openSubscription&&this.closeWindow(this.contexts.indexOf(e.context))},t.prototype.closeWindow=function(e){if(-1!==e){var t=this.contexts,r=t[e],n=r.window,i=r.subscription;t.splice(e,1),n.complete(),i.unsubscribe()}},t}(A.a);function ni(e){return function(t){return t.lift(new ii(e))}}var ii=function(){function e(e){this.closingSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new ai(e,this.closingSelector))},e}(),ai=function(e){function t(t,r){var n=e.call(this,t)||this;return n.destination=t,n.closingSelector=r,n.openWindow(),n}return n.a(t,e),t.prototype.notifyNext=function(e,t,r,n,i){this.openWindow(i)},t.prototype.notifyError=function(e){this._error(e)},t.prototype.notifyComplete=function(e){this.openWindow(e)},t.prototype._next=function(e){this.window.next(e)},t.prototype._error=function(e){this.window.error(e),this.destination.error(e),this.unsubscribeClosingNotification()},t.prototype._complete=function(){this.window.complete(),this.destination.complete(),this.unsubscribeClosingNotification()},t.prototype.unsubscribeClosingNotification=function(){this.closingNotification&&this.closingNotification.unsubscribe()},t.prototype.openWindow=function(e){void 0===e&&(e=null),e&&(this.remove(e),e.unsubscribe());var t=this.window;t&&t.complete();var r,n=this.window=new $t.a;this.destination.next(n);try{r=(0,this.closingSelector)()}catch(e){return this.destination.error(e),void this.window.error(e)}this.add(this.closingNotification=Object(E.a)(this,r))},t}(A.a);function oi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){var r;"function"==typeof e[e.length-1]&&(r=e.pop());var n=e;return t.lift(new si(n,r))}}var si=function(){function e(e,t){this.observables=e,this.project=t}return e.prototype.call=function(e,t){return t.subscribe(new ui(e,this.observables,this.project))},e}(),ui=function(e){function t(t,r,n){var i=e.call(this,t)||this;i.observables=r,i.project=n,i.toRespond=[];var a=r.length;i.values=new Array(a);for(var o=0;o<a;o++)i.toRespond.push(o);for(o=0;o<a;o++){var s=r[o];i.add(Object(E.a)(i,s,void 0,o))}return i}return n.a(t,e),t.prototype.notifyNext=function(e,t,r){this.values[r]=t;var n=this.toRespond;if(n.length>0){var i=n.indexOf(r);-1!==i&&n.splice(i,1)}},t.prototype.notifyComplete=function(){},t.prototype._next=function(e){if(0===this.toRespond.length){var t=[e].concat(this.values);this.project?this._tryProject(t):this.destination.next(t)}},t.prototype._tryProject=function(e){var t;try{t=this.project.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(A.a),ci=r(307);function li(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){return t.lift.call(ci.b.apply(void 0,[t].concat(e)))}}function di(e){return function(t){return t.lift(new ci.a(e))}}},function(e,t,r){"use strict";function n(e,t,r){return e[t]-e[r]}function i(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function a(e,t,r,n){var i=r+n>>1;return t(e,r,n)>0?t(e,r,i)>0?t(e,i,n)>0?i:n:r:t(e,n,i)>0?t(e,i,r)>0?i:r:n}function o(e,t,r){var n=e.cmp,i=e.swap,o=e.data,s=e.parts,u=t+1,c=r;for(i(o,t,a(o,n,t,r));n(o,c,t)>0;)--c;for(var l=t+1;l<=c;l++){var d=n(o,l,t);if(d>0){for(i(o,l,c),--c;n(o,c,t)>0;)--c;l--}else 0===d&&(i(o,l,u),u++)}for(l=t;l<u;l++)i(o,l,t+c-l);s[0]=c-u+t+1,s[1]=c}function s(e,t,r){for(var n=e.data,i=e.cmp,a=e.swap,o=t+1;o<=r;o++)for(var s=o-1;s>=t&&i(n,s,s+1)>0;)a(n,s,s+1),s-=1}function u(e,t,r){for(var n=e.parts;t<r;){if(r-t<16)return void s(e,t,r);o(e,t,r);var i=n[0],a=n[1];i-t<r-a?(u(e,t,i-1),t=a+1):(u(e,a+1,r),r=i-1)}}function c(e,t,r,o){var s=r+1,u=o;i(e,r,a(e,n,r,o));for(var c=e[r];e[u]>c;)--u;for(var l=r+1;l<=u;l++){var d=e[l];if(d>c){for(i(e,l,u),--u;e[u]>c;)--u;l--}else d===c&&(i(e,l,s),++s)}for(l=r;l<s;l++)i(e,l,r+u-l);t[0]=u-s+r+1,t[1]=u}function l(e,t,r){for(var n=t+1;n<=r;n++){for(var i=e[n],a=n-1;a>=t&&e[a]>i;)e[a+1]=e[a],a-=1;e[a+1]=i}}function d(e,t){return void 0===t&&(t=n),function(e,t,r,a){void 0===a&&(a=n);a===n?function e(t,r,n,i){for(;n<i;){if(i-n<16)return void l(t,n,i);c(t,r,n,i);var a=r[0],o=r[1];a-n<i-o?(e(t,r,n,a-1),n=o+1):(e(t,r,o+1,i),i=a-1)}}(e,[0,0],t,r-1):u({data:e,cmp:a,swap:i,parts:[0,0]},t,r-1);return e}(e,0,e.length,t)}function f(e,t,r,n,i){return u({data:e,cmp:n,swap:i,parts:[0,0]},t,r-1),e}r.d(t,"a",(function(){return i})),r.d(t,"c",(function(){return d})),r.d(t,"b",(function(){return f}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i})),r.d(t,"b",(function(){return a}));var n=r(187);function i(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a(e)}function a(e){return 0===e.length?n.a:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(57),i=r(6),a=r(1),o=r(10),s=r(118),u=r(37),c=r(12),l=r(93),d=r(238),f=r(176),p=r(128);function m(e,t){return{kind:"element-loci",structure:e,elements:t}}!function(e){function t(e){return 0===r(e)}function r(e){for(var t=0,r=0,n=e.elements;r<n.length;r++){var a=n[r];t+=i.OrderedSet.size(a.indices)}return t}function m(r){return t(r)?r:e(r.structure,[{unit:r.elements[0].unit,indices:i.OrderedSet.ofSingleton(i.OrderedSet.start(r.elements[0].indices))}])}function h(t,r){for(var n=[],a=new Set,o=0,s=t.elements;o<s.length;o++){var u=s[o];if(v(u))n[n.length]=u;else if(0===u.unit.kind){for(var c=u.unit.elements,l=u.unit.model.atomicHierarchy,d=u.unit.model.atomicHierarchy.atoms.label_alt_id,f=l.residueAtomSegments,p=f.index,m=f.offsets,h=[],g=u.indices,b=i.OrderedSet.size(g),y=0;y<b;){a.clear();var _=c[i.OrderedSet.getAt(g,y)],S=p[_];for(a.add(d.value(_)),y++;y<b;){var x=c[i.OrderedSet.getAt(g,y)];if(p[x]!==S)break;a.add(d.value(x)),y++}for(var O=a.has(""),w=m[S],C=m[S+1];w<C;w++){var j=i.OrderedSet.indexOf(c,w);if(j>=0){var P=d.value(w);r&&!O&&P&&!a.has(P)||(h[h.length]=j)}}}n[n.length]={unit:u.unit,indices:i.SortedArray.ofSortedArray(h)}}else n[n.length]=u}return e(t.structure,n)}function g(e){switch(e.kind){case 0:return e.model.atomicHierarchy.chainAtomSegments;case 1:return e.model.coarseHierarchy.spheres.chainElementSegments;case 2:return e.model.coarseHierarchy.gaussians.chainElementSegments}}function v(e){return e.unit.elements.length===i.OrderedSet.size(e.indices)}function b(e){return e.length>12&&e[e.length-1]-e[0]==e.length-1?i.Interval.ofRange(e[0],e[e.length-1]):i.SortedArray.ofSortedArray(e)}function y(e,t,r){for(var n=g(e).index,a=e.elements,o=0,s=0,u=a.length;s<u;s++){var c=n[a[s]];t.has(c)&&o++}if(o!==e.elements.length){var l=new Int32Array(o);o=0;for(s=0,u=a.length;s<u;s++){c=n[a[s]];t.has(c)&&(l[o++]=s)}l.length>0&&(r[r.length]={unit:e,indices:b(l)})}else r[r.length]={unit:e,indices:i.Interval.ofBounds(0,o)}}function _(e,t,r,n,a){for(var o=g(e.elements[0].unit).index,s=new Set,c=t;c<r;c++)for(var l=e.elements[c],d=l.indices,f=l.unit.elements,p=0,m=i.OrderedSet.size(d);p<m;p++)s.add(o[f[i.OrderedSet.getAt(d,p)]]);if(n)for(var h=e.elements[0].unit,v=0,b=e.structure.units;v<b.length;v++){var _=b[v];u.a.areSameChainOperatorGroup(_,h)&&y(_,s,a)}else for(c=t;c<r;c++)y(e.elements[c].unit,s,a)}function S(t){for(var r=[],n=0,i=t.elements.length;n<i;n++){var a=t.elements[n];if(u.a.Traits.is(a.unit.traits,2)){for(var o=n;n<i&&u.a.areSameChainOperatorGroup(t.elements[n].unit,a.unit);)n++;var s=n;n--,_(t,o,s,!0,r)}else v(a)?r[r.length]=a:_(t,n,n+1,!1,r)}return e(t.structure,r)}function x(e){return e.unit.model.id+"|"+f.a.entity.id(e)}function O(e,t){for(var r=[],n=0,a=i.OrderedSet.size(t);n<a;++n)r.push(e[i.OrderedSet.getAt(t,n)]);return i.SortedArray.ofSortedArray(r)}function w(e,t){return i.SortedArray.indicesOf(e,t)}e.is=function(e){return!!e&&"element-loci"===e.kind},e.areEqual=function(e,t){if(e.structure!==t.structure)return!1;if(e.elements.length!==t.elements.length)return!1;for(var r=0,n=e.elements.length;r<n;++r){var a=e.elements[r],o=t.elements[r];if(a.unit.id!==o.unit.id)return!1;if(!i.OrderedSet.areEqual(a.indices,o.indices))return!1}return!0},e.isEmpty=t,e.isWholeStructure=function(e){return r(e)===e.structure.elementCount},e.size=r,e.all=function(t){return e(t,t.units.map((function(e){return{unit:e,indices:i.OrderedSet.ofBounds(0,e.elements.length)}})))},e.none=function(t){return e(t,[])},e.getFirstLocation=function(e,r){if(!t(e)){var n=e.elements[0].unit,a=n.elements[i.OrderedSet.getAt(e.elements[0].indices,0)];return r?(r.structure=e.structure,r.unit=e.elements[0].unit,r.element=a,r):l.a.create(e.structure,n,a)}},e.firstElement=m,e.firstResidue=function(e){return t(e)?e:h(m(e))},e.firstChain=function(e){return t(e)?e:S(m(e))},e.toStructure=function(e){for(var t=[],r=function(e){var r=e.unit,n=e.indices,a=new Int32Array(i.OrderedSet.size(n));i.OrderedSet.forEach(n,(function(e,t){return a[t]=r.elements[e]})),t.push(r.getChild(i.SortedArray.ofSortedArray(a)))},n=0,a=e.elements;n<a.length;n++){r(a[n])}return s.a.create(t,{parent:e.structure.parent})},e.remap=function(t,r){if(r===t.structure)return t;var n=[];return t.elements.forEach((function(e){if(r.unitMap.has(e.unit.id)){var t=r.unitMap.get(e.unit.id),a=i.OrderedSet.indexedIntersect(e.indices,e.unit.elements,t.elements);i.OrderedSet.size(a)>0&&n.push({unit:t,indices:a})}})),e(r,n)},e.union=function t(r,n){if(r.elements.length>n.elements.length)return t(n,r);if(e.isEmpty(r))return n;for(var a=new Map,o=0,s=r.elements;o<s.length;o++){var u=s[o];a.set(u.unit.id,u.indices)}for(var c=[],l=0,d=n.elements;l<d.length;l++){u=d[l];a.has(u.unit.id)?(c[c.length]={unit:u.unit,indices:i.OrderedSet.union(a.get(u.unit.id),u.indices)},a.delete(u.unit.id)):c[c.length]=u}return a.forEach((function(e,t){c[c.length]={unit:r.structure.unitMap.get(t),indices:e}})),e(r.structure,c)},e.subtract=function(t,r){for(var n=new Map,a=0,o=r.elements;a<o.length;a++){var s=o[a];n.set(s.unit.id,s.indices)}for(var u=[],c=0,l=t.elements;c<l.length;c++){s=l[c];if(n.has(s.unit.id)){var d=i.OrderedSet.subtract(s.indices,n.get(s.unit.id));if(0===i.OrderedSet.size(d))continue;u[u.length]={unit:s.unit,indices:d}}else u[u.length]=s}return e(t.structure,u)},e.intersect=function(t,r){for(var n=new Map,a=0,o=t.elements;a<o.length;a++){var s=o[a];n.set(s.unit.id,s.indices)}for(var u=[],c=0,l=r.elements;c<l.length;c++){s=l[c];if(n.has(s.unit.id)){var d=i.OrderedSet.intersect(n.get(s.unit.id),s.indices);0!==i.OrderedSet.size(d)&&(u[u.length]={unit:s.unit,indices:d})}}return e(t.structure,u)},e.areIntersecting=function t(r,n){if(r.elements.length>n.elements.length)return t(n,r);if(e.isEmpty(r))return e.isEmpty(n);for(var a=new Map,o=0,s=r.elements;o<s.length;o++){var u=s[o];a.set(u.unit.id,u.indices)}for(var c=0,l=n.elements;c<l.length;c++){u=l[c];if(a.has(u.unit.id)&&i.OrderedSet.areIntersecting(a.get(u.unit.id),u.indices))return!0}return!1},e.isSubset=function(t,r){if(e.isEmpty(t))return e.isEmpty(r);for(var n=new Map,a=0,o=t.elements;a<o.length;a++){var s=o[a];n.set(s.unit.id,s.indices)}for(var u=!1,c=0,l=r.elements;c<l.length;c++){s=l[c];if(n.has(s.unit.id)){if(!i.OrderedSet.isSubset(n.get(s.unit.id),s.indices))return!1;u=!0}}return u},e.extendToWholeResidues=h,e.extendToWholeChains=S,e.extendToWholeEntities=function(t){for(var r=[],n=l.a.create(t.structure),a=new Set,o=t.structure.units,s=0,u=t.elements.length;s<u;s++){var c=t.elements[s];n.unit=c.unit,n.element=c.unit.elements[0],a.add(x(n))}s=0;for(var d=o.length;s<d;++s){var f=o[s];if(n.unit=f,n.element=f.elements[0],a.has(x(n))){var p=i.OrderedSet.ofBounds(0,f.elements.length);r[r.length]={unit:f,indices:p}}}return e(t.structure,r)},e.extendToWholeModels=function(t){for(var r=[],n=new Set,a=t.structure.units,o=0,s=t.elements.length;o<s;o++){var u=t.elements[o];n.add(u.unit.model.id)}o=0;for(var c=a.length;o<c;++o){var l=a[o];if(n.has(l.model.id)){var d=i.OrderedSet.ofBounds(0,l.elements.length);r[r.length]={unit:l,indices:d}}}return e(t.structure,r)},e.extendToAllInstances=function(t){for(var r=[],n=new Map,a=0,o=t.elements.length;a<o;a++){var s=t.elements[a],u=s.unit.model,c=O(s.unit.elements,s.indices);n.has(u)?n.set(u,i.SortedArray.union(c,n.get(u))):n.set(u,c)}a=0;for(var l=t.structure.units.length;a<l;++a){var d=t.structure.units[a];if(c=n.get(d.model)){var f=w(d.elements,c);r[r.length]={unit:d,indices:f}}}return e(t.structure,r)};var C=new p.a("98"),j=Object(a.Vec3)();e.getBoundary=function(e,t){C.reset();for(var r=0,n=e.elements;r<n.length;r++)for(var o=(m=n[r]).indices,s=m.unit.conformation.position,u=m.unit.conformation.r,c=m.unit.elements,l=0,d=i.OrderedSet.size(o);l<d;l++){s(h=c[i.OrderedSet.getAt(o,l)],j),t&&a.Vec3.transformMat4(j,j,t),C.includePositionRadius(j,u(h))}C.finishedIncludeStep();for(var f=0,p=e.elements;f<p.length;f++){var m;for(o=(m=p[f]).indices,s=m.unit.conformation.position,u=m.unit.conformation.r,c=m.unit.elements,l=0,d=i.OrderedSet.size(o);l<d;l++){var h;s(h=c[i.OrderedSet.getAt(o,l)],j),t&&a.Vec3.transformMat4(j,j,t),C.radiusPositionRadius(j,u(h))}}return{box:C.getBox(),sphere:C.getSphere()}};var P=Object(a.Vec3)();function E(e,t,r){void 0===r&&(r=0);for(var n=r,o=0,s=e.elements;o<s.length;o++){for(var u=s[o],c=u.indices,l=u.unit.conformation.position,d=u.unit.elements,f=i.OrderedSet.size(c),p=0;p<f;p++){l(d[i.OrderedSet.getAt(c,p)],P),a.Vec3.toArray(P,t,n+3*p)}n+=3*f}return t}function A(e,t,r,n,i){Object(c.q)(t);for(var a=[],o=[],s=0,u=t.length;s<u;){var l=s;for(s++;s<u&&t[s-1]+1===t[s];)s++;var d=s;if(d-l>12)a[a.length]=t[l],a[a.length]=t[d-1];else for(var f=l;f<d;f++)o[o.length]=t[f]}return r?{atom:{set:o,ranges:a},chain:{opName:[e]},entity:{modelLabel:n,modelIndex:i}}:{atom:{set:o,ranges:a},chain:{opName:[e]}}}e.toPositionsArray=E,e.getPrincipalAxes=function(e){var t=r(e),n=E(e,new Float32Array(3*t));return d.a.ofPositions(n)},e.toExpression=function(t){var r;if(e.isEmpty(t))return o.MolScriptBuilder.struct.generator.empty();for(var a,s,l=t.structure.models,d=new Map,f=0,p=t.elements;f<p.length;f++){var m=(w=p[f]).indices,h=w.unit.elements,g=w.unit.conformation.operator.name,v=void 0;d.has(g)?v=d.get(g).xs:(v=n.c.create(),d.set(g,{modelLabel:w.unit.model.label,modelIndex:w.unit.model.modelNum,xs:v}));for(var b=0,y=i.OrderedSet.size(m);b<y;b++){var _=(a=w.unit,s=h[i.OrderedSet.getAt(m,b)],u.a.isAtomic(a)?a.model.atomicHierarchy.atomSourceIndex.value(s):s);n.c.add(v,_,_)}}for(var S=[],x=d.keys();;){var O=x.next();if(O.done)break;var w=d.get(O.value);S.push(A(O.value,w.xs.array,l.length>1,w.modelLabel,w.modelIndex))}for(var C=new Map,j=(b=0,S.length);b<j;++b){var P=S[b];g=Object(c.i)(Object(c.l)(P.atom.ranges),Object(c.l)(P.atom.set))+"|"+(P.entity?P.entity.modelLabel+P.entity.modelIndex:"");C.has(g)?(r=C.get(g).chain.opName).push.apply(r,P.chain.opName):C.set(g,P)}var E=[];return C.forEach((function(e){var t=e.atom,r=t.ranges,n=t.set,i=e.chain.opName,a=o.MolScriptBuilder.struct.atomProperty.core.operatorName(),s=o.MolScriptBuilder.struct.atomProperty.core.sourceIndex(),u=[];n.length>0&&(u[u.length]=o.MolScriptBuilder.core.set.has([o.MolScriptBuilder.core.type.set(n),s]));for(var c=0,l=r.length/2;c<l;c++)u[u.length]=o.MolScriptBuilder.core.rel.inRange([s,r[2*c],r[2*c+1]]);if(e.entity){var d=e.entity,f=d.modelLabel,p=d.modelIndex;E.push(o.MolScriptBuilder.struct.generator.atomGroups({"atom-test":u.length>1?o.MolScriptBuilder.core.logic.or(u):u[0],"chain-test":i.length>1?o.MolScriptBuilder.core.set.has([o.MolScriptBuilder.core.type.set(i),a]):o.MolScriptBuilder.core.rel.eq([a,i[0]]),"entity-test":o.MolScriptBuilder.core.logic.and([o.MolScriptBuilder.core.rel.eq([o.MolScriptBuilder.struct.atomProperty.core.modelLabel(),f]),o.MolScriptBuilder.core.rel.eq([o.MolScriptBuilder.struct.atomProperty.core.modelIndex(),p])])}))}else E.push(o.MolScriptBuilder.struct.generator.atomGroups({"atom-test":u.length>1?o.MolScriptBuilder.core.logic.or(u):u[0],"chain-test":i.length>1?o.MolScriptBuilder.core.set.has([o.MolScriptBuilder.core.type.set(i),a]):o.MolScriptBuilder.core.rel.eq([a,i[0]])}))})),o.MolScriptBuilder.struct.modifier.union([1===E.length?E[0]:o.MolScriptBuilder.struct.combinator.merge(E.map((function(e){return o.MolScriptBuilder.struct.modifier.union([e])})))])}}(m||(m={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return d})),r.d(t,"a",(function(){return f}));var n=r(20),i=1,a=function(){return Promise.resolve()}(),o={};function s(e){return e in o&&(delete o[e],!0)}var u=function(e){var t=i++;return o[t]=!0,a.then((function(){return s(t)&&e()})),t},c=function(e){s(e)},l=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return n.a(t,e),t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0?e.prototype.requestAsyncId.call(this,t,r,n):(t.actions.push(this),t.scheduled||(t.scheduled=u(t.flush.bind(t,null))))},t.prototype.recycleAsyncId=function(t,r,n){if(void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0)return e.prototype.recycleAsyncId.call(this,t,r,n);0===t.actions.length&&(c(r),t.scheduled=void 0)},t}(r(240).a),d=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.a(t,e),t.prototype.flush=function(e){this.active=!0,this.scheduled=void 0;var t,r=this.actions,n=-1,i=r.length;e=e||r.shift();do{if(t=e.execute(e.state,e.delay))break}while(++n<i&&(e=r.shift()));if(this.active=!1,t){for(;++n<i&&(e=r.shift());)e.unsubscribe();throw t}},t}(r(236).a))(l),f=d},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureHierarchyManager",(function(){return L}));var n=r(0),i=r(224),a=r(27),o=r(13),s=r(96),u=r(116),c=r(8),l=r(31),d=r(164);function f(e,t){var r=function(e,t){return{state:e,oldHierarchy:t,hierarchy:p(),changed:!1,added:new Set}}(e,t||p());return function(e,t){var r={tree:e,state:t};V(r,e.root)}(e.tree,r),t&&t.refs.forEach(k,r),{hierarchy:r.hierarchy,added:r.added,changed:r.changed}}function p(){return{trajectories:[],models:[],structures:[],refs:new Map}}function m(e){return{kind:"trajectory",cell:e,version:e.transform.version,models:[]}}function h(e,t){return{kind:"model",cell:e,version:e.transform.version,trajectory:t,structures:[]}}function g(e,t){return{kind:"model-properties",cell:e,version:e.transform.version,model:t}}function v(e,t){return{kind:"model-unitcell",cell:e,version:e.transform.version,model:t}}function b(e,t){return{kind:"structure",cell:e,version:e.transform.version,model:t,components:[]}}function y(e,t){return{kind:"structure-properties",cell:e,version:e.transform.version,structure:t}}function _(e,t){return{kind:"structure-transform",cell:e,version:e.transform.version,structure:t}}function S(e,t){return{kind:"structure-volume-streaming",cell:e,version:e.transform.version,structure:t}}function x(e){return e.transform.tags?Object(n.__spreadArrays)(e.transform.tags).sort().join():e.transform.ref}function O(e,t){return{kind:"structure-component",cell:e,version:e.transform.version,structure:t,key:x(e),representations:[]}}function w(e,t){return{kind:"structure-representation",cell:e,version:e.transform.version,component:t}}function C(e,t){return{kind:"generic-representation",cell:e,version:e.transform.version,parent:t}}function j(e,t,r,n){for(var i=[],a=4;a<arguments.length;a++)i[a-4]=arguments[a];var o=n.apply(void 0,i);r.push(o),e.hierarchy.refs.set(t.transform.ref,o);var s=e.oldHierarchy.refs.get(t.transform.ref);return s?s.version!==t.transform.version&&(e.changed=!0):(e.added.add(o.cell.transform.ref),e.changed=!0),o}function P(e,t,r){for(var n=[],i=3;i<arguments.length;i++)n[i-3]=arguments[i];var a=r.apply(void 0,n);e.hierarchy.refs.set(t.transform.ref,a);var o=e.oldHierarchy.refs.get(t.transform.ref);return o?o.version!==t.transform.version&&(e.changed=!0):(e.added.add(a.cell.transform.ref),e.changed=!0),a}function E(e){return function(t){return e.is(t.obj)}}function A(e,t){return function(r,n){return!t(n)&&e.is(r.obj)}}function D(e){return function(t){return t.transform.transformer===e}}function T(){}var I=[[E(c.a.Molecule.Trajectory),function(e,t){e.currentTrajectory=j(e,t,e.hierarchy.trajectories,m,t)},function(e){return e.currentTrajectory=void 0}],[A(c.a.Molecule.Model,(function(e){return e.currentModel})),function(e,t){e.currentTrajectory?e.currentModel=j(e,t,e.currentTrajectory.models,h,t,e.currentTrajectory):e.currentModel=P(e,t,h,t),e.hierarchy.models.push(e.currentModel)},function(e){return e.currentModel=void 0}],[D(l.StateTransforms.Model.CustomModelProperties),function(e,t){if(!e.currentModel)return!1;e.currentModel.properties=P(e,t,g,t,e.currentModel)},T],[D(l.StateTransforms.Representation.ModelUnitcell3D),function(e,t){if(!e.currentModel)return!1;e.currentModel.unitcell=P(e,t,v,t,e.currentModel)},T],[A(c.a.Molecule.Structure,(function(e){return e.currentStructure})),function(e,t){e.currentModel?e.currentStructure=j(e,t,e.currentModel.structures,b,t,e.currentModel):e.currentStructure=P(e,t,b,t),e.hierarchy.structures.push(e.currentStructure)},function(e){return e.currentStructure=void 0}],[D(l.StateTransforms.Model.CustomStructureProperties),function(e,t){if(!e.currentStructure)return!1;e.currentStructure.properties=P(e,t,y,t,e.currentStructure)},T],[D(l.StateTransforms.Model.TransformStructureConformation),function(e,t){if(!e.currentStructure)return!1;e.currentStructure.transform=P(e,t,_,t,e.currentStructure)},T],[E(d.a),function(e,t){return!!e.currentStructure&&(e.currentStructure.volumeStreaming=P(e,t,S,t,e.currentStructure),!1)},T],[function(e,t){return!(t.currentComponent||!t.currentStructure||e.transform.transformer.definition.isDecorator)&&c.a.Molecule.Structure.is(e.obj)},function(e,t){e.currentStructure&&(e.currentComponent=j(e,t,e.currentStructure.components,O,t,e.currentStructure))},function(e){return e.currentComponent=void 0}],[function(e,t){return!e.state.isGhost&&!!t.currentComponent&&c.a.Molecule.Structure.Representation3D.is(e.obj)},function(e,t){return e.currentComponent&&j(e,t,e.currentComponent.representations,w,t,e.currentComponent),!1},T],[function(e){return!e.state.isGhost&&c.a.isRepresentation3D(e.obj)},function(e,t){var r=e.currentComponent||e.currentStructure||e.currentModel;r&&(r.genericRepresentations||(r.genericRepresentations=[]),j(e,t,r.genericRepresentations,C,t,r))},T]];function M(e){if(!e||!(null==e?void 0:e.parent)||!e.parent.cells.has(e.transform.ref))return!1;var t=e.obj;return!(!t||t===o.StateObject.Null||"ok"!==e.status&&"error"!==e.status)}function k(e){M(e.cell)||(this.changed=!0)}function B(e){V(this,this.tree.transforms.get(e))}function V(e,t){var r=e.state,n=r.state.cells.get(t.ref);if(M(n)){for(var i=void 0,a=!1,o=0,s=I;o<s.length;o++){var u=s[o],c=u[0],l=u[1],d=u[2];if(c(n,r)){if(!1===l(r,n)){a=!0;break}i=d;break}}if(!a){var f=e.tree.children.get(t.ref);f&&f.size&&f.forEach(B,e),i&&i(r)}}}var R,L=function(e){function t(t){var r=e.call(this)||this;return r.plugin=t,r.state={syncedTree:r.dataState.tree,notified:!1,hierarchy:p(),selection:{trajectories:[],models:[],structures:[]}},r.behaviors={selection:r.ev.behavior({hierarchy:r.current,trajectories:r.selection.trajectories,models:r.selection.models,structures:r.selection.structures})},r._currentComponentGroups=void 0,r._currentSelectionSet=void 0,r.subscribe(t.state.data.events.changed,(function(e){e.inTransaction||t.behaviors.state.isAnimating.value||r.sync(!0)})),r.subscribe(t.behaviors.state.isAnimating,(function(e){e||t.behaviors.state.isUpdating.value||r.sync(!0)})),r}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentComponentGroups",{get:function(){return this._currentComponentGroups||(this._currentComponentGroups=t.getComponentGroups(this.selection.structures)),this._currentComponentGroups},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"seletionSet",{get:function(){if(this._currentSelectionSet)return this._currentSelectionSet;this._currentSelectionSet=new Set;for(var e=0,t=this.selection.trajectories;e<t.length;e++){var r=t[e];this._currentSelectionSet.add(r.cell.transform.ref)}for(var n=0,i=this.selection.models;n<i.length;n++){r=i[n];this._currentSelectionSet.add(r.cell.transform.ref)}for(var a=0,o=this.selection.structures;a<o.length;a++){r=o[a];this._currentSelectionSet.add(r.cell.transform.ref)}return this._currentSelectionSet},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"current",{get:function(){return this.sync(!1),this.state.hierarchy},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selection",{get:function(){return this.sync(!1),this.state.selection},enumerable:!1,configurable:!0}),t.prototype.getStructuresWithSelection=function(){for(var e=[],t=0,r=this.plugin.managers.structure.hierarchy.current.structures;t<r.length;t++){var n=r[t];this.plugin.managers.structure.selection.structureHasSelection(n)&&e.push(n)}return e},t.prototype.syncCurrent=function(e,t){for(var r=this.seletionSet,n=[],i=0,a=e;i<a.length;i++){var o=a[i],s=o.cell.transform.ref;(r.has(s)||t.has(s))&&n.push(o)}return 0===n.length?e.length>0?[e[0]]:[]:n},t.prototype.sync=function(e){if(e||!this.dataState.inUpdate)if(this.state.syncedTree!==this.dataState.tree){this.state.syncedTree=this.dataState.tree;var t=f(this.plugin.state.data,this.current);if(t.changed){var r=t.hierarchy,i=this.syncCurrent(r.trajectories,t.added),a=this.syncCurrent(r.models,t.added),o=this.syncCurrent(r.structures,t.added);this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.hierarchy=r,this.state.selection.trajectories=i,this.state.selection.models=a,this.state.selection.structures=o,e?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,trajectories:i,models:a,structures:o})):this.state.notified=!1}}else e&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next(Object(n.__assign)({hierarchy:this.state.hierarchy},this.state.selection)))},t.prototype.updateCurrent=function(e,t){for(var r=this.current,n="add"===t?s.a.union(this.seletionSet,new Set(e.map((function(e){return e.cell.transform.ref})))):s.a.difference(this.seletionSet,new Set(e.map((function(e){return e.cell.transform.ref})))),i=[],a=[],o=[],u=0,c=r.trajectories;u<c.length;u++){var l=c[u];n.has(l.cell.transform.ref)&&i.push(l)}for(var d=0,f=r.models;d<f.length;d++){var p=f[d];n.has(p.cell.transform.ref)&&a.push(p)}for(var m=0,h=r.structures;m<h.length;m++){var g=h[m];n.has(g.cell.transform.ref)&&o.push(g)}this._currentComponentGroups=void 0,this._currentSelectionSet=void 0,this.state.selection.trajectories=i,this.state.selection.models=a,this.state.selection.structures=o,this.behaviors.selection.next({hierarchy:r,trajectories:i,models:a,structures:o})},t.prototype.remove=function(e,t){if(0!==e.length){for(var r=this.plugin.state.data.build(),n=0,i=e;n<i.length;n++){var a=i[n];r.delete("string"==typeof a?a:a.cell.transform.ref)}return r.commit({canUndo:!!t&&"Remove"})}},t.prototype.toggleVisibility=function(e,t){if(0!==e.length)for(var r=void 0!==t?"show"!==t:!e[0].cell.state.isHidden,n=0,a=e;n<a.length;n++){var o=a[n];Object(i.setSubtreeVisibility)(this.dataState,o.cell.transform.ref,r)}},t.prototype.applyPreset=function(e,t,r){var i=this;return this.plugin.dataTransaction((function(){return Object(n.__awaiter)(i,void 0,void 0,(function(){var i,a,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:i=0,a=e,n.label=1;case 1:return i<a.length?(o=a[i]).models.length>0?[4,this.clearTrajectory(o)]:[3,3]:[3,6];case 2:n.sent(),n.label=3;case 3:return[4,this.plugin.builders.structure.hierarchy.applyPreset(o.cell,t,r)];case 4:n.sent(),n.label=5;case 5:return i++,[3,1];case 6:return[2]}}))}))}))},t.prototype.updateStructure=function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r=this;return Object(n.__generator)(this,(function(i){switch(i.label){case 0:return[4,this.plugin.dataTransaction((function(){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=o.StateTree.getDecoratorRoot(this.dataState.tree,e.cell.transform.ref),i=this.dataState.tree.children.get(r).toArray(),[4,this.remove(i,!1)];case 1:return n.sent(),[4,this.plugin.state.updateTransform(this.plugin.state.data,e.cell.transform.ref,t,"Structure Type")];case 2:return n.sent(),[4,this.plugin.builders.structure.representation.applyPreset(e.cell.transform.ref,"auto")];case 3:return n.sent(),[2]}}))}))}),{canUndo:"Structure Type"})];case 1:return i.sent(),a.PluginCommands.Camera.Reset(this.plugin),[2]}}))}))},t.prototype.clearTrajectory=function(e){for(var t=this.dataState.build(),r=0,n=e.models;r<n.length;r++){var i=n[r];t.delete(i.cell)}return t.commit()},t}(u.a);(R=L||(L={})).getComponentGroups=function(e){if(!e.length)return[];if(1===e.length)return e[0].components.map((function(e){return[e]}));for(var t=[],r=new Map,n=0,i=e;n<i.length;n++)for(var a=0,o=i[n].components;a<o.length;a++){var s=o[a],u=s.key;if(u){var c=r.get(u);c||(c=[],r.set(u,c),t.push(c)),c.push(s)}}return t},R.getSelectedStructuresDescription=function(e){var t,r,n,i,a,o,s,u,c,l=e.managers.structure.hierarchy.selection.structures;if(0===l.length)return"";if(1===l.length){var d=null===(t=(y=l[0]).cell.obj)||void 0===t?void 0:t.data;if(!d)return(null===(r=y.cell.obj)||void 0===r?void 0:r.label)||"Structure";var f=d.models[0]||d.representativeModel||d.masterModel;if(!f)return(null===(n=y.cell.obj)||void 0===n?void 0:n.label)||"Structure";var p=f.entryId;return(null===(a=null===(i=y.model)||void 0===i?void 0:i.trajectory)||void 0===a?void 0:a.models)&&1===y.model.trajectory.models.length?p:y.model?(null===(o=y.model.cell.obj)||void 0===o?void 0:o.label)+" | "+p:p}for(var m=l[0],h=null===(s=null==m?void 0:m.model)||void 0===s?void 0:s.trajectory,g=!0,v=0,b=l;v<b.length;v++){var y;if((null===(u=null==(y=b[v])?void 0:y.model)||void 0===u?void 0:u.trajectory)!==h){g=!1;break}}return g&&h?(null===(c=h.cell.obj)||void 0===c?void 0:c.label)+" | "+l.length+" structures":l.length+" structures"}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(e){return Error.call(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(e,t){return t+1+") "+e.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=e,this}return e.prototype=Object.create(Error.prototype),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(22),a=r(120),o=r(365),s=r(157);function u(e,t,r,n,i){for(var a=e.residues,o=a.auth_seq_id,s=a.pdbx_PDB_ins_code,u=t.endSeqNumber,c=t.endInsCode,l=t.key,d=t.type,f=r;f<n;){var p=o.value(f);if(i.type[f]=d,i.key[f]=l,p>u||p===u&&s.value(f)===c)break;f++}}!function(e){e.Descriptor={name:"model_secondary_structure"},e.Provider=s.a.create(e.Descriptor),e.fromStruct=function(e,t,r){var n=new Map,s=[{kind:"none"}];!function(e,t,r){if(!e._rowCount)return;for(var n=e.beg_label_asym_id,a=e.beg_auth_seq_id,o=e.pdbx_beg_PDB_ins_code,s=e.end_auth_seq_id,u=e.pdbx_end_PDB_ins_code,c=e.pdbx_PDB_helix_class,l=e.conf_type_id,d=e.details,f=0,p=e._rowCount;f<p;f++){var m=i.SecondaryStructureType.create(0===c.valueKind(f)?i.SecondaryStructureType.SecondaryStructurePdb[c.value(f)]:0===l.valueKind(f)?i.SecondaryStructureType.SecondaryStructureMmcif[l.value(f)]:536870912),h={kind:"helix",flags:m,type_id:0===l.valueKind(f)?l.value(f):"HELIX_P",helix_class:c.value(f),details:0===d.valueKind(f)?d.value(f):void 0},g={startSeqNumber:a.value(f),startInsCode:o.value(f),endSeqNumber:s.value(f),endInsCode:u.value(f),type:m,key:r.length};r[r.length]=h;var v=n.value(f);if(t.has(v)){var b=t.get(v);b.has(g.startSeqNumber)?b.get(g.startSeqNumber).push(g):b.set(g.startSeqNumber,[g])}else t.set(v,new Map([[g.startSeqNumber,[g]]]))}}(e,n,s),function(e,t,r,n){if(!e._rowCount)return;for(var a=e.beg_label_asym_id,o=e.beg_auth_seq_id,s=e.pdbx_beg_PDB_ins_code,u=e.end_auth_seq_id,c=e.pdbx_end_PDB_ins_code,l=e.sheet_id,d=new Map,f=r+1,p=0,m=e._rowCount;p<m;p++){var h=l.value(p),g=void 0;d.has(h)?g=d.get(h):(g=f++,d.set(h,g));var v=i.SecondaryStructureType.create(8388612),b={kind:"sheet",flags:v,sheet_id:h,symmetry:void 0},y={startSeqNumber:o.value(p),startInsCode:s.value(p),endSeqNumber:u.value(p),endInsCode:c.value(p),type:v,key:n.length};n[n.length]=b;var _=a.value(p);if(t.has(_)){var S=t.get(_);S.has(y.startSeqNumber)?S.get(y.startSeqNumber).push(y):S.set(y.startSeqNumber,[y])}else t.set(_,new Map([[y.startSeqNumber,[y]]]))}}(t,n,e._rowCount,s);var c=r.residues._rowCount,l={type:new Int32Array(c),key:new Int32Array(c),elements:s};return n.size>0&&function(e,t,r){for(var n=e.chainAtomSegments.count,i=e.chains.label_asym_id,o=e.residues,s=o.auth_seq_id,c=o.pdbx_PDB_ins_code,l=0;l<n;l++){var d=a.c.chainStartResidueIndex(e,l),f=a.c.chainEndResidueIndexExcl(e,l),p=i.value(l);if(t.has(p))for(var m=t.get(p),h=d;h<f;h++){var g=s.value(h);if(m.has(g))for(var v=m.get(g),b=0,y=v;b<y.length;b++){var _=y[b],S=c.value(h);_.startInsCode===S&&u(e,_,h,f,r)}}}}(r,n,l),Object(o.a)(l.type,l.key,l.elements,(function(e){return e}))}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"d",(function(){return u})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var n=r(0),i=r(99),a=Object(i.a)();function o(e){var t=e.createBuffer();if(null===t)throw new Error("Could not create WebGL buffer");return t}function s(e,t,r,n){var i=o(e),s=function(e,t){switch(t){case"static":return e.STATIC_DRAW;case"dynamic":return e.DYNAMIC_DRAW;case"stream":return e.STREAM_DRAW}}(e,r),u=function(e,t){switch(t){case"attribute":return e.ARRAY_BUFFER;case"elements":return e.ELEMENT_ARRAY_BUFFER;case"uniform":return e.UNIFORM_BUFFER}}(e,n),c=function(e,t){if(t instanceof Uint8Array)return e.UNSIGNED_BYTE;if(t instanceof Int8Array)return e.BYTE;if(t instanceof Uint16Array)return e.UNSIGNED_SHORT;if(t instanceof Int16Array)return e.SHORT;if(t instanceof Uint32Array)return e.UNSIGNED_INT;if(t instanceof Int32Array)return e.INT;if(t instanceof Float32Array)return e.FLOAT;throw new Error("Should nevver happen")}(e,t),l=t.BYTES_PER_ELEMENT,d=t.length;function f(t){e.bindBuffer(u,i),e.bufferData(u,t,s)}f(t);var p=!1;return{id:a(),_usageHint:s,_bufferType:u,_dataType:c,_bpe:l,length:d,getBuffer:function(){return i},updateData:f,updateSubData:function(t,r,n){e.bindBuffer(u,i),n-r===t.length?e.bufferSubData(u,0,t):e.bufferSubData(u,r*l,t.subarray(r,r+n))},reset:function(){i=o(e),f(t)},destroy:function(){p||(e.deleteBuffer(i),p=!0)}}}function u(e,t,r){switch(t){case"int32":switch(r){case 1:return e.INT;case 2:return e.INT_VEC2;case 3:return e.INT_VEC3;case 4:return e.INT_VEC4}break;case"float32":switch(r){case 1:return e.FLOAT;case 2:return e.FLOAT_VEC2;case 3:return e.FLOAT_VEC3;case 4:return e.FLOAT_VEC4;case 16:return e.FLOAT_MAT4}}throw new Error("unknown attribute type for kind '"+t+"' and itemSize '"+r+"'")}function c(e,t,r,i,a,o){void 0===o&&(o="dynamic");var u=t.instancedArrays,c=s(e,r,o,"attribute"),l=c._bufferType,d=c._dataType,f=c._bpe;return Object(n.__assign)(Object(n.__assign)({},c),{bind:function(t){if(e.bindBuffer(l,c.getBuffer()),16===i)for(var r=0;r<4;++r)e.enableVertexAttribArray(t+r),e.vertexAttribPointer(t+r,4,d,!1,16*f,4*r*f),u.vertexAttribDivisor(t+r,a);else e.enableVertexAttribArray(t),e.vertexAttribPointer(t,i,d,!1,0,0),u.vertexAttribDivisor(t,a)}})}function l(e,t,r){var n=[];return Object.keys(t).forEach((function(i){var a=t[i];"attribute"===a.type&&(n[n.length]=[i,e.resources.attribute(r[i].ref.value,a.itemSize,a.divisor)])})),n}function d(e,t,r){void 0===r&&(r="static");var i=s(e,t,r,"elements");return Object(n.__assign)(Object(n.__assign)({},i),{bind:function(){e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i.getBuffer())}})}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(157);!function(e){e.Descriptor={name:"atom_partial_charge"},e.Provider=i.a.create(e.Descriptor)}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return c}));var n=r(4),i=r(120),a=r(2),o={scale:a.ParamDefinition.Numeric(1,{min:.1,max:5,step:.1})};function s(e,t){return n.Unit.isAtomic(e)?Object(i.h)(e.model.atomicHierarchy.atoms.type_symbol.value(t)):n.Unit.isSpheres(e)?e.model.coarseConformation.spheres.radius[t]:0}function u(e,t){var r=void 0===t.scale?1:t.scale;return{factory:u,granularity:"group",size:function(e){return n.StructureElement.Location.is(e)?r*s(e.unit,e.element):n.Bond.isLocation(e)?r*Math.min(s(e.aUnit,e.aUnit.elements[e.aIndex]),s(e.bUnit,e.bUnit.elements[e.bIndex])):1*r},props:t,description:"Assigns a physical size, i.e. vdW radius for atoms or given radius for coarse spheres."}}var c={name:"physical",label:"Physical",category:"",factory:u,getParams:function(e){return o},defaultValues:a.ParamDefinition.getDefaultValues(o),isApplicable:function(e){return!!e.structure}}},function(e,t,r){"use strict";function n(e){return Object.keys(e)}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.r(t),r.d(t,"StateSnapshots",(function(){return v})),r.d(t,"StateExportImportControls",(function(){return b})),r.d(t,"LocalStateSnapshotParams",(function(){return y})),r.d(t,"LocalStateSnapshots",(function(){return _})),r.d(t,"LocalStateSnapshotList",(function(){return S})),r.d(t,"RemoteStateSnapshots",(function(){return x}));var n=r(0),i=r(102),a=r(3),o=r(27),s=r(78),u=r(382),c=r(5),l=r(75),d=r(2),f=r(267),p=r(33),m=r(18),h=r(15),g=r(73),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){var e;return a.createElement("div",null,a.createElement(m.SectionHeader,{icon:h.SaveOutlinedSvg,title:"Plugin State"}),a.createElement("div",{style:{marginBottom:"10px"}},a.createElement(m.ExpandGroup,{header:"Save Options",initiallyExpanded:!1},a.createElement(y,null))),a.createElement(_,null),a.createElement(S,null),a.createElement(m.SectionHeader,{title:"Save as File",accent:"blue"}),a.createElement(b,null),"none"!==(null===(e=this.plugin.spec.components)||void 0===e?void 0:e.remoteState)&&a.createElement(x,null))},t}(p.PluginUIComponent),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.downloadToFileJson=function(){var e,r;null===(r=(e=t.props).onAction)||void 0===r||r.call(e),o.PluginCommands.State.Snapshots.DownloadToFile(t.plugin,{type:"json"})},t.downloadToFileZip=function(){var e,r;null===(r=(e=t.props).onAction)||void 0===r||r.call(e),o.PluginCommands.State.Snapshots.DownloadToFile(t.plugin,{type:"zip"})},t.open=function(e){var r,n;e.target.files&&e.target.files[0]?(null===(n=(r=t.props).onAction)||void 0===n||n.call(r),o.PluginCommands.State.Snapshots.OpenFile(t.plugin,{file:e.target.files[0]})):t.plugin.log.error("No state file selected")},t}return Object(n.__extends)(t,e),t.prototype.render=function(){return a.createElement(a.Fragment,null,a.createElement("div",{className:"msp-flex-row"},a.createElement(m.Button,{icon:h.GetAppSvg,onClick:this.downloadToFileJson,title:"Save the state description. Input data are loaded using the provided sources. Does not work if local files are used as input."},"State"),a.createElement(m.Button,{icon:h.GetAppSvg,onClick:this.downloadToFileZip,title:"Save the state including the input data."},"Session"),a.createElement("div",{className:"msp-btn msp-btn-block msp-btn-action msp-loader-msp-btn-file"},a.createElement(h.Icon,{svg:h.OpenInBrowserSvg,inline:!0})," Open ",a.createElement("input",{onChange:this.open,type:"file",multiple:!1,accept:".molx,.molj"}))),a.createElement("div",{className:"msp-help-text",style:{padding:"10px"}},a.createElement(h.Icon,{svg:h.WarningSvg})," This is an experimental feature and stored states/sessions might not be openable in a future version."))},t}(p.PluginUIComponent),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.snapshotParams,(function(){return e.forceUpdate()}))},t.prototype.render=function(){return a.createElement(g.ParameterControls,{params:u.a.SnapshotParams,values:this.plugin.state.snapshotParams.value,onChangeValues:this.plugin.state.setSnapshotParams})},t}(p.PluginUIComponent),_=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.state={params:d.ParamDefinition.getDefaultValues(t.Params)},r.add=function(){o.PluginCommands.State.Snapshots.Add(r.plugin,{name:r.state.params.name,description:r.state.params.description})},r.updateParams=function(e){return r.setState({params:e})},r.clear=function(){o.PluginCommands.State.Snapshots.Clear(r.plugin,{})},r}return Object(n.__extends)(t,e),t.prototype.shouldComponentUpdate=function(e,t){return!Object(c.l)(this.props,e)||!Object(c.l)(this.state,t)},t.prototype.render=function(){return a.createElement("div",null,a.createElement(g.ParameterControls,{params:t.Params,values:this.state.params,onEnter:this.add,onChangeValues:this.updateParams}),a.createElement("div",{className:"msp-flex-row"},a.createElement(m.IconButton,{onClick:this.clear,svg:h.DeleteOutlinedSvg,title:"Remove All"}),a.createElement(m.Button,{onClick:this.add,icon:h.AddSvg,style:{textAlign:"right"},commit:!0},"Add")))},t.Params={name:d.ParamDefinition.Text(),description:d.ParamDefinition.Text()},t}(p.PluginUIComponent),S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.apply=function(e){var r=e.currentTarget.getAttribute("data-id");r&&o.PluginCommands.State.Snapshots.Apply(t.plugin,{id:r})},t.remove=function(e){var r=e.currentTarget.getAttribute("data-id");r&&o.PluginCommands.State.Snapshots.Remove(t.plugin,{id:r})},t.moveUp=function(e){var r=e.currentTarget.getAttribute("data-id");r&&o.PluginCommands.State.Snapshots.Move(t.plugin,{id:r,dir:-1})},t.moveDown=function(e){var r=e.currentTarget.getAttribute("data-id");r&&o.PluginCommands.State.Snapshots.Move(t.plugin,{id:r,dir:1})},t.replace=function(e){var r=e.currentTarget.getAttribute("data-id");r&&o.PluginCommands.State.Snapshots.Replace(t.plugin,{id:r})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.snapshot.events.changed,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e=this,t=this.plugin.managers.snapshot.state.current;return a.createElement("ul",{style:{listStyle:"none",marginTop:"10px"},className:"msp-state-list"},this.plugin.managers.snapshot.state.entries.map((function(r){return a.createElement("li",{key:r.snapshot.id,className:"msp-flex-row"},a.createElement(m.Button,{"data-id":r.snapshot.id,onClick:e.apply,className:"msp-no-overflow"},a.createElement("span",{style:{fontWeight:r.snapshot.id===t?"bold":void 0}},r.name||new Date(r.timestamp).toLocaleString())," ",a.createElement("small",null,(r.snapshot.durationInMs?Object(l.a)(r.snapshot.durationInMs,!1)+(r.description?", ":""):"")+(r.description?r.description:""))),a.createElement(m.IconButton,{svg:h.ArrowUpwardSvg,"data-id":r.snapshot.id,title:"Move Up",onClick:e.moveUp,flex:"20px"}),a.createElement(m.IconButton,{svg:h.ArrowDownwardSvg,"data-id":r.snapshot.id,title:"Move Down",onClick:e.moveDown,flex:"20px"}),a.createElement(m.IconButton,{svg:h.SwapHorizSvg,"data-id":r.snapshot.id,title:"Replace",onClick:e.replace,flex:"20px"}),a.createElement(m.IconButton,{svg:h.DeleteOutlinedSvg,"data-id":r.snapshot.id,title:"Remove",onClick:e.remove,flex:"20px"}))})))},t}(p.PluginUIComponent),x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.Params={name:d.ParamDefinition.Text(),options:d.ParamDefinition.Group({description:d.ParamDefinition.Text(),playOnLoad:d.ParamDefinition.Boolean(!1),serverUrl:d.ParamDefinition.Text(t.plugin.config.get(s.PluginConfig.State.CurrentServer))})},t.state={params:d.ParamDefinition.getDefaultValues(t.Params),entries:Object(i.OrderedMap)(),isBusy:!1},t.ListOnlyParams={options:d.ParamDefinition.Group({serverUrl:d.ParamDefinition.Text(t.plugin.config.get(s.PluginConfig.State.CurrentServer))},{isFlat:!0})},t._mounted=!1,t.refresh=function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){var e,t,r,a,o,u;return Object(n.__generator)(this,(function(c){switch(c.label){case 0:return c.trys.push([0,2,,3]),this.setState({isBusy:!0}),this.plugin.config.set(s.PluginConfig.State.CurrentServer,this.state.params.options.serverUrl),[4,this.plugin.runTask(this.plugin.fetch({url:this.serverUrl("list"),type:"json"}))];case 1:for((e=c.sent()||[]).sort((function(e,t){return e.isSticky===t.isSticky?e.timestamp-t.timestamp:e.isSticky?-1:1})),t=Object(i.OrderedMap)().asMutable(),r=0,a=e;r<a.length;r++)o=a[r],t.set(o.id,Object(n.__assign)(Object(n.__assign)({},o),{url:this.serverUrl("get/"+o.id),removeUrl:this.serverUrl("remove/"+o.id)}));return this._mounted&&this.setState({entries:t.asImmutable(),isBusy:!1}),[3,3];case 2:return u=c.sent(),this.plugin.log.error("Fetching Remote Snapshots: "+u),this._mounted&&this.setState({entries:Object(i.OrderedMap)(),isBusy:!1}),[3,3];case 3:return[2]}}))}))},t.upload=function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){return Object(n.__generator)(this,(function(e){switch(e.label){case 0:return this.setState({isBusy:!0}),this.plugin.config.set(s.PluginConfig.State.CurrentServer,this.state.params.options.serverUrl),[4,o.PluginCommands.State.Snapshots.Upload(this.plugin,{name:this.state.params.name,description:this.state.params.options.description,playOnLoad:this.state.params.options.playOnLoad,serverUrl:this.state.params.options.serverUrl})];case 1:return e.sent(),this.plugin.log.message("Snapshot uploaded."),this._mounted&&(this.setState({isBusy:!1}),this.refresh()),[2]}}))}))},t.fetch=function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(!(t=e.currentTarget.getAttribute("data-id")))return[2];if(!(r=this.state.entries.get(t)))return[2];this.setState({isBusy:!0}),n.label=1;case 1:return n.trys.push([1,,3,4]),[4,o.PluginCommands.State.Snapshots.Fetch(this.plugin,{url:r.url})];case 2:return n.sent(),[3,4];case 3:return this._mounted&&this.setState({isBusy:!1}),[7];case 4:return[2]}}))}))},t.remove=function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(!(t=e.currentTarget.getAttribute("data-id")))return[2];if(!(r=this.state.entries.get(t)))return[2];this.setState({entries:this.state.entries.remove(t)}),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,fetch(r.removeUrl)];case 2:return n.sent(),[3,4];case 3:return n.sent(),[3,4];case 4:return[2]}}))}))},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){this.refresh(),this._mounted=!0},t.prototype.componentWillUnmount=function(){this._mounted=!1},t.prototype.serverUrl=function(e){return e?Object(f.a)(this.state.params.options.serverUrl,e):this.state.params.options.serverUrl},t.prototype.render=function(){var e=this;return a.createElement(a.Fragment,null,a.createElement(m.SectionHeader,{title:"Remote States",accent:"blue"}),!this.props.listOnly&&a.createElement(a.Fragment,null,a.createElement(g.ParameterControls,{params:this.Params,values:this.state.params,onEnter:this.upload,onChange:function(t){var r;e.setState({params:Object(n.__assign)(Object(n.__assign)({},e.state.params),(r={},r[t.name]=t.value,r))})},isDisabled:this.state.isBusy}),a.createElement("div",{className:"msp-flex-row"},a.createElement(m.IconButton,{onClick:this.refresh,disabled:this.state.isBusy,svg:h.RefreshSvg}),a.createElement(m.Button,{icon:h.CloudUploadSvg,onClick:this.upload,disabled:this.state.isBusy,commit:!0},"Upload"))),a.createElement(O,{entries:this.state.entries,isBusy:this.state.isBusy,serverUrl:this.state.params.options.serverUrl,fetch:this.fetch,remove:this.props.listOnly?void 0:this.remove}),this.props.listOnly&&a.createElement("div",{style:{marginTop:"10px"}},a.createElement(g.ParameterControls,{params:this.ListOnlyParams,values:this.state.params,onEnter:this.upload,onChange:function(t){var r;e.setState({params:Object(n.__assign)(Object(n.__assign)({},e.state.params),(r={},r[t.name]=t.value,r))})},isDisabled:this.state.isBusy}),a.createElement("div",{className:"msp-flex-row"},a.createElement(m.Button,{onClick:this.refresh,disabled:this.state.isBusy,icon:h.RefreshSvg},"Refresh"))))},t}(p.PluginUIComponent),O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.open=function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,r,i,a;return Object(n.__generator)(this,(function(n){return(t=e.currentTarget.getAttribute("data-id"))&&(r=this.props.entries.get(t))?(e.preventDefault(),i=""+window.location,(a=i.indexOf("?"))>0&&(i=i.substr(0,a)),window.open(i+"?snapshot-url="+encodeURIComponent(r.url),"_blank"),[2]):[2]}))}))},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this;return a.createElement("ul",{style:{listStyle:"none",marginTop:"10px"},className:"msp-state-list"},this.props.entries.valueSeq().map((function(t){return a.createElement("li",{key:t.id,className:"msp-flex-row"},a.createElement(m.Button,{"data-id":t.id,onClick:e.props.fetch,disabled:e.props.isBusy,onContextMenu:e.open,title:"Click to download, right-click to open in a new tab."},t.name||new Date(t.timestamp).toLocaleString()," ",a.createElement("small",null,t.description)),!t.isSticky&&e.props.remove&&a.createElement(m.IconButton,{svg:h.DeleteOutlinedSvg,"data-id":t.id,title:"Remove",onClick:e.props.remove,disabled:e.props.isBusy,small:!0}))})))},t}(p.PurePluginUIComponent)},function(e,t,r){"use strict";r.d(t,"d",(function(){return P})),r.d(t,"c",(function(){return E})),r.d(t,"a",(function(){return A})),r.d(t,"b",(function(){return R}));var n=r(0),i=r(60),a=r(231),o=r(17),s=r(48);function u(e){var t=Object(i.h)(e);if(null===t)throw new Error('Could not find support for "instanced_arrays"');var r=Object(i.f)(e);if(null===r)throw new Error('Could not find support for "element_index_uint"');var n=Object(i.k)(e);s.a&&null===n&&console.log('Could not find support for "standard_derivatives"');var a=Object(i.l)(e);s.a&&null===a&&console.log('Could not find support for "texture_float"');var o=Object(i.m)(e);s.a&&null===o&&console.log('Could not find support for "texture_float_linear"');var u=Object(i.n)(e);s.a&&null===u&&console.log('Could not find support for "texture_half_float"');var c=Object(i.o)(e);s.a&&null===c&&console.log('Could not find support for "texture_half_float_linear"');var l=Object(i.d)(e);s.a&&null===l&&console.log('Could not find support for "depth_texture"');var d=Object(i.a)(e);s.a&&null===d&&console.log('Could not find support for "blend_minmax"');var f=Object(i.p)(e);s.a&&null===f&&console.log('Could not find support for "vertex_array_object"');var p=Object(i.g)(e);s.a&&null===p&&console.log('Could not find support for "frag_depth"');var m=Object(i.b)(e);s.a&&null===m&&console.log('Could not find support for "color_buffer_float"');var h=Object(i.c)(e);s.a&&null===h&&console.log('Could not find support for "color_buffer_half_float"');var g=Object(i.e)(e);s.a&&null===g&&console.log('Could not find support for "draw_buffers"');var v=Object(i.j)(e);s.a&&null===v&&console.log('Could not find support for "shader_texture_lod"');var b=Object(i.i)(e);return s.a&&null===b&&console.log('Could not find support for "sRGB"'),{instancedArrays:t,standardDerivatives:n,textureFloat:a,textureFloatLinear:o,textureHalfFloat:u,textureHalfFloatLinear:c,elementIndexUint:r,depthTexture:l,blendMinMax:d,vertexArrayObject:f,fragDepth:p,colorBufferFloat:m,colorBufferHalfFloat:h,drawBuffers:g,shaderTextureLod:v,sRGB:b}}var c=r(334),l=r(394),d=r(335),f=r(288);function p(e,t,r){var n=new Map;return{get:function(r){var i,a,o=e(r),s=n.get(o);return s||(i=t(r),void 0===a&&(a=0),s={value:i,usageCount:a},n.set(o,s)),s.usageCount+=1,function(e){return{free:function(){e.usageCount-=1},value:e.value}}(s)},clear:function(){n.forEach((function(e,t){e.usageCount<=0&&(e.usageCount<0&&console.warn("Reference usageCount below zero."),r(e.value),n.delete(t))}))},get count(){return n.size},dispose:function(){n.forEach((function(e){return r(e.value)})),n.clear()}}}var m=r(12),h=r(99),g=Object(h.a)();function v(e){var t=e.createRenderbuffer();if(null===t)throw new Error("Could not create WebGL renderbuffer");return t}var b=r(204),y=Object(h.a)();function _(e){var t=e.vertexArrayObject;if(!t)throw new Error("VertexArrayObject not supported");var r=t.createVertexArray();if(!r)throw new Error("Could not create WebGL vertex array");return r}function S(e){var t=e.vertexArrayObject;if(null===t)throw new Error("VertexArrayObject not supported");return t}function x(e){return Object(n.__assign)(Object(n.__assign)({},e.value),{destroy:function(){e.free()}})}function O(e,t,r,i){var o={attribute:new Set,elements:new Set,framebuffer:new Set,program:new Set,renderbuffer:new Set,shader:new Set,texture:new Set,vertexArray:new Set};function u(e,t){return o[e].add(t),r.resourceCounts[e]+=1,Object(n.__assign)(Object(n.__assign)({},t),{destroy:function(){t.destroy(),o[e].delete(t),r.resourceCounts[e]-=1}})}var c=p((function(e){return JSON.stringify(e)}),(function(t){return u("shader",Object(d.a)(e,t))}),(function(e){e.destroy()}));function h(e,t){return x(c.get({type:e,source:t}))}var O=p((function(e){var t=[e.shaderCode.id];return Object.keys(e.defineValues).forEach((function(r){return t.push(Object(m.m)(r),"boolean"==typeof(n=e.defineValues[r].ref.value)?n?1:0:"number"==typeof n?1e4*n:Object(m.m)(n));var n})),Object(m.l)(t).toString()}),(function(r){return u("program",Object(l.a)(e,t,i,h,r))}),(function(e){e.destroy()}));return{attribute:function(t,r,n,a){return u("attribute",Object(f.a)(e,i,t,r,n,a))},elements:function(t,r){return u("elements",Object(f.c)(e,t,r))},framebuffer:function(){return u("framebuffer",Object(a.b)(e))},program:function(e,t,r){return x(O.get({defineValues:e,shaderCode:t,schema:r}))},renderbuffer:function(t,r,n,i){return u("renderbuffer",function(e,t,r,n,i){var o=v(e),u=function(){return e.bindRenderbuffer(e.RENDERBUFFER,o)},c=function(e,t){switch(t){case"depth16":return e.DEPTH_COMPONENT16;case"stencil8":return e.STENCIL_INDEX8;case"rgba4":return e.RGBA4;case"depth-stencil":return e.DEPTH_STENCIL}}(e,t),l=function(e,t){switch(t){case"depth":return e.DEPTH_ATTACHMENT;case"stencil":return e.STENCIL_ATTACHMENT;case"depth-stencil":return e.DEPTH_STENCIL_ATTACHMENT;case"color0":return e.COLOR_ATTACHMENT0}}(e,r);function d(){u(),e.renderbufferStorage(e.RENDERBUFFER,c,n,i)}d();var f=!1;return{id:g(),bind:u,attachFramebuffer:function(t){t.bind(),u(),e.framebufferRenderbuffer(e.FRAMEBUFFER,l,e.RENDERBUFFER,o),s.a&&Object(a.a)(e)},setSize:function(e,t){n=e,i=t,d()},reset:function(){o=v(e),d()},destroy:function(){f||(e.deleteRenderbuffer(o),f=!0)}}}(e,t,r,n,i))},shader:h,texture:function(t,r,n,a){return u("texture",Object(b.b)(e,i,t,r,n,a))},vertexArray:function(e,t,r){return u("vertexArray",function(e,t,r,n){var i=y(),a=_(e),o=S(e);function s(){o.bindVertexArray(a),n&&n.bind(),t.bindAttributes(r),o.bindVertexArray(null)}s();var u=!1;return{id:i,bind:function(){o.bindVertexArray(a)},update:s,reset:function(){a=_(e),o=S(e),s()},destroy:function(){u||(o.deleteVertexArray(a),u=!0)}}}(i,e,t,r))},getByteCounts:function(){var e=0;o.texture.forEach((function(t){e+=t.getByteCount()}));var t=0;o.attribute.forEach((function(e){t+=4*e.length}));var r=0;return o.elements.forEach((function(e){r+=4*e.length})),{texture:e,attribute:t,elements:r}},reset:function(){o.attribute.forEach((function(e){return e.reset()})),o.elements.forEach((function(e){return e.reset()})),o.framebuffer.forEach((function(e){return e.reset()})),o.renderbuffer.forEach((function(e){return e.reset()})),o.shader.forEach((function(e){return e.reset()})),o.program.forEach((function(e){return e.reset()})),o.vertexArray.forEach((function(e){return e.reset()})),o.texture.forEach((function(e){return e.reset()}))},destroy:function(){o.attribute.forEach((function(e){return e.destroy()})),o.elements.forEach((function(e){return e.destroy()})),o.framebuffer.forEach((function(e){return e.destroy()})),o.renderbuffer.forEach((function(e){return e.destroy()})),o.shader.forEach((function(e){return e.destroy()})),o.program.forEach((function(e){return e.destroy()})),o.vertexArray.forEach((function(e){return e.destroy()})),o.texture.forEach((function(e){return e.destroy()})),c.clear(),O.clear()}}}var w=r(371),C=r(245),j=r(75);function P(e,t){function r(r){try{return e.getContext(r,t)}catch(e){return null}}var n=r("webgl2")||r("webgl")||r("experimental-webgl");return s.a&&console.log("isWebgl2: "+Object(i.q)(n)),n}function E(e,t){switch(t){case e.NO_ERROR:return"no error";case e.INVALID_ENUM:return"invalid enum";case e.INVALID_VALUE:return"invalid value";case e.INVALID_OPERATION:return"invalid operation";case e.INVALID_FRAMEBUFFER_OPERATION:return"invalid framebuffer operation";case e.OUT_OF_MEMORY:return"out of memory";case e.CONTEXT_LOST_WEBGL:return"context lost"}return"unknown error"}function A(e){var t=e.getError();if(t!==e.NO_ERROR)throw new Error("WebGL error: '"+E(e,t)+"'")}function D(e){e.bindFramebuffer(e.FRAMEBUFFER,null)}var T=new Uint8Array(4);function I(e,t,r){e.getSyncParameter(t,e.SYNC_STATUS)===e.SIGNALED?(e.deleteSync(t),r()):o.a.setImmediate(I,e,t,r)}function M(e,t){var r=e.fenceSync(e.SYNC_GPU_COMMANDS_COMPLETE,0);r?o.a.setImmediate(I,e,r,t):(console.warn("Could not create a WebGLSync object"),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,T),t())}var k=!1;function B(e){e.bindFramebuffer(e.FRAMEBUFFER,null),e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,T)}function V(e,t,r,n,o,u){if(s.a&&Object(a.a)(e),u instanceof Uint8Array)e.readPixels(t,r,n,o,e.RGBA,e.UNSIGNED_BYTE,u);else if(u instanceof Float32Array)e.readPixels(t,r,n,o,e.RGBA,e.FLOAT,u);else{if(!(u instanceof Int32Array&&Object(i.q)(e)))throw new Error("unsupported readPixels buffer type");e.readPixels(t,r,n,o,e.RGBA_INTEGER,e.INT,u)}s.a&&A(e)}function R(e,t){var r=this;void 0===t&&(t={});var a=u(e),o=function(e){var t={},r=e.getParameter(e.FRONT_FACE),n=e.getParameter(e.CULL_FACE_MODE),i=e.getParameter(e.DEPTH_WRITEMASK),a=e.getParameter(e.COLOR_WRITEMASK),o=e.getParameter(e.COLOR_CLEAR_VALUE),s=e.getParameter(e.BLEND_SRC_RGB),u=e.getParameter(e.BLEND_DST_RGB),c=e.getParameter(e.BLEND_SRC_ALPHA),l=e.getParameter(e.BLEND_DST_ALPHA),d=e.getParameter(e.BLEND_EQUATION_RGB),f=e.getParameter(e.BLEND_EQUATION_ALPHA);return{currentProgramId:-1,currentMaterialId:-1,currentRenderItemId:-1,enable:function(r){!0!==t[r]&&(e.enable(r),t[r]=!0)},disable:function(r){!1!==t[r]&&(e.disable(r),t[r]=!1)},frontFace:function(t){t!==r&&(e.frontFace(t),r=t)},cullFace:function(t){t!==n&&(e.cullFace(t),n=t)},depthMask:function(t){t!==i&&(e.depthMask(t),i=t)},colorMask:function(t,r,n,i){t===a[0]&&r===a[1]&&n===a[2]&&i===a[3]||(e.colorMask(t,r,n,i),a[0]=t,a[1]=r,a[2]=n,a[3]=i)},clearColor:function(t,r,n,i){t===o[0]&&r===o[1]&&n===o[2]&&i===o[3]||(e.clearColor(t,r,n,i),o[0]=t,o[1]=r,o[2]=n,o[3]=i)},blendFunc:function(t,r){t===s&&r===u&&t===c&&r===l||(e.blendFunc(t,r),s=t,u=r,c=t,l=r)},blendFuncSeparate:function(t,r,n,i){t===s&&r===u&&n===c&&i===l||(e.blendFuncSeparate(t,r,n,i),s=t,u=r,c=n,l=i)},blendEquation:function(t){t===d&&t===f||(e.blendEquation(t),d=t,f=t)},blendEquationSeparate:function(t,r){t===d&&r===f||(e.blendEquationSeparate(t,r),d=t,f=r)},reset:function(){t={},r=e.getParameter(e.FRONT_FACE),n=e.getParameter(e.CULL_FACE_MODE),i=e.getParameter(e.DEPTH_WRITEMASK),a=e.getParameter(e.COLOR_WRITEMASK),o=e.getParameter(e.COLOR_CLEAR_VALUE),s=e.getParameter(e.BLEND_SRC_RGB),u=e.getParameter(e.BLEND_DST_RGB),c=e.getParameter(e.BLEND_SRC_ALPHA),l=e.getParameter(e.BLEND_DST_ALPHA),d=e.getParameter(e.BLEND_EQUATION_RGB),f=e.getParameter(e.BLEND_EQUATION_ALPHA)}}}(e),s={resourceCounts:{attribute:0,elements:0,framebuffer:0,program:0,renderbuffer:0,shader:0,texture:0,vertexArray:0},drawCount:0,instanceCount:0,instancedDrawCount:0},l=O(e,o,s,a),d={maxTextureSize:e.getParameter(e.MAX_TEXTURE_SIZE),max3dTextureSize:Object(i.q)(e)?e.getParameter(e.MAX_3D_TEXTURE_SIZE):0,maxRenderbufferSize:e.getParameter(e.MAX_RENDERBUFFER_SIZE),maxDrawBuffers:a.drawBuffers?e.getParameter(a.drawBuffers.MAX_DRAW_BUFFERS):0,maxTextureImageUnits:e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),maxVertexTextureImageUnits:e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS)};if(d.maxVertexTextureImageUnits<8)throw new Error('Need "MAX_VERTEX_TEXTURE_IMAGE_UNITS" >= 8');var f,p=!1,m=new C.a(0);if(Object(i.q)(e)){var h=e.createBuffer(),g=void 0,v=void 0,b=!1,y=function(){e.bindBuffer(e.PIXEL_PACK_BUFFER,h),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,g),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),b=!1,v(),v=void 0,g=void 0};f=function(t,r,n,i,a){return new Promise((function(o,s){b?s("Can not call multiple readPixelsAsync at the same time"):(b=!0,e.bindBuffer(e.PIXEL_PACK_BUFFER,h),e.bufferData(e.PIXEL_PACK_BUFFER,n*i*4,e.STREAM_READ),e.readPixels(t,r,n,i,e.RGBA,e.UNSIGNED_BYTE,0),e.bindBuffer(e.PIXEL_PACK_BUFFER,null),v=o,g=a,M(e,y))}))}}else f=function(t,i,a,o,s){return Object(n.__awaiter)(r,void 0,void 0,(function(){return Object(n.__generator)(this,(function(r){return V(e,t,i,a,o,s),[2]}))}))};var _=new Set;return{gl:e,isWebGL2:Object(i.q)(e),get pixelRatio(){return("undefined"!=typeof window?window.devicePixelRatio:1)*(t.pixelScale||1)},extensions:a,state:o,stats:s,resources:l,get maxTextureSize(){return d.maxTextureSize},get max3dTextureSize(){return d.max3dTextureSize},get maxRenderbufferSize(){return d.maxRenderbufferSize},get maxDrawBuffers(){return d.maxDrawBuffers},get maxTextureImageUnits(){return d.maxTextureImageUnits},namedComputeRenderables:Object.create(null),namedFramebuffers:Object.create(null),namedTextures:Object.create(null),get isContextLost(){return p||e.isContextLost()},contextRestored:m,setContextLost:function(){p=!0},handleContextRestored:function(t){Object.assign(a,u(e)),o.reset(),o.currentMaterialId=-1,o.currentProgramId=-1,o.currentRenderItemId=-1,l.reset(),_.forEach((function(e){return e.reset()})),null==t||t(),p=!1,m.next(Object(j.b)())},createRenderTarget:function(t,r,i,a,o){var s=Object(w.b)(e,l,t,r,i,a,o);return _.add(s),Object(n.__assign)(Object(n.__assign)({},s),{destroy:function(){s.destroy(),_.delete(s)}})},unbindFramebuffer:function(){return D(e)},readPixels:function(t,r,n,i,a){V(e,t,r,n,i,a)},readPixelsAsync:f,waitForGpuCommandsComplete:function(){return function(e){return new Promise((function(t){Object(i.q)(e)?M(e,t):(k||(console.info("Sync object not supported in WebGL"),k=!0),B(e),t())}))}(e)},waitForGpuCommandsCompleteSync:function(){return B(e)},getDrawingBufferPixelData:function(){return function(e){var t=e.drawingBufferWidth,r=e.drawingBufferHeight,n=new Uint8Array(t*r*4);return D(e),e.viewport(0,0,t,r),V(e,0,0,t,r,n),c.a.flipY(c.a.create(n,t,r))}(e)},clear:function(t,r,n,i){D(e),o.enable(e.SCISSOR_TEST),o.depthMask(!0),o.colorMask(!0,!0,!0,!0),o.clearColor(t,r,n,i),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),e.scissor(0,0,e.drawingBufferWidth,e.drawingBufferHeight),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT)},destroy:function(t){var r;l.destroy(),function(e){for(var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),r=0;r<t;++r)e.activeTexture(e.TEXTURE0+r),e.bindTexture(e.TEXTURE_2D,null),e.bindTexture(e.TEXTURE_CUBE_MAP,null),Object(i.q)(e)&&(e.bindTexture(e.TEXTURE_2D_ARRAY,null),e.bindTexture(e.TEXTURE_3D,null));var n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n);var a=e.getParameter(e.MAX_VERTEX_ATTRIBS);for(r=0;r<a;++r)e.vertexAttribPointer(r,1,e.FLOAT,!1,0,0);e.bindBuffer(e.ARRAY_BUFFER,null),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null),e.bindRenderbuffer(e.RENDERBUFFER,null),D(e)}(e),(null==t?void 0:t.doNotForceWebGLContextLoss)||null===(r=e.getExtension("WEBGL_lose_context"))||void 0===r||r.loseContext()}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return f}));var n=r(0),i=r(3),a=r(33),o=r(73),s=r(2),u=r(62),c=r(15),l=r(18),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onChange=function(e){var r,i=e.name,a=e.value,o=Object(n.__assign)(Object(n.__assign)({},t.props.params),((r={})[i]=a,r));t.props.events.onChange(o,t.areInitial(o),t.validate(o))},t}return Object(n.__extends)(t,e),t.prototype.validate=function(e){},t.prototype.areInitial=function(e){return s.ParamDefinition.areEqual(this.props.info.params,e,this.props.info.initialValues)},t.prototype.render=function(){return i.createElement(o.ParameterControls,{params:this.props.info.params,values:this.props.params,onChange:this.onChange,onEnter:this.props.events.onEnter,isDisabled:this.props.isDisabled})},t}(a.PurePluginUIComponent);!function(e){function t(e){for(var t=0,r=Object.keys(e);t<r.length;t++){if(!e[r[t]].isHidden)return!1}return!0}e.infoFromAction=function(e,r,n,i){var a=r.cells.get(i).obj,o=n.definition.params?n.definition.params(a,e):{};return{initialValues:s.ParamDefinition.getDefaultValues(o),params:o,isEmpty:t(o)}},e.infoFromTransform=function(e,r,n){var i=r.cells.get(n.ref),a=i.params&&i.params.definition||{};return{initialValues:i.params&&i.params.values||{},params:a,isEmpty:t(a)}}}(d||(d={}));var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.busy=new u.a,t.onEnter=function(){t.state.error||t.apply()},t.autoApplyHandle=void 0,t.events={onEnter:t.onEnter,onChange:function(e,r,n){t.clearAutoApply(),t.setState({params:e,isInitial:r,error:n&&n[0]},(function(){r||t.state.error||!t.canAutoApply(e)||(t.clearAutoApply(),t.autoApplyHandle=setTimeout(t.apply,50))}))}},t.apply=function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){var e,t;return Object(n.__generator)(this,(function(r){switch(r.label){case 0:this.clearAutoApply(),this.setState({busy:!0}),r.label=1;case 1:return r.trys.push([1,3,4,5]),[4,this.applyAction()];case 2:return r.sent(),[3,5];case 3:return r.sent(),[3,5];case 4:return null===(t=(e=this.props).onApply)||void 0===t||t.call(e),this.busy.next(!1),[7];case 5:return[2]}}))}))},t.refresh=function(){t.setState({params:t.getInfo().initialValues,isInitial:!0,error:void 0})},t.setDefault=function(){var e=t.getInfo(),r=s.ParamDefinition.getDefaultValues(e.params);t.setState({params:r,isInitial:s.ParamDefinition.areEqual(e.params,r,e.initialValues),error:void 0})},t.toggleExpanded=function(){t.setState({isCollapsed:!t.state.isCollapsed})},t}return Object(n.__extends)(t,e),t.prototype.clearAutoApply=function(){void 0!==this.autoApplyHandle&&(clearTimeout(this.autoApplyHandle),this.autoApplyHandle=void 0)},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.state.busy!==t&&e.busy.next(t)})),this.subscribe(this.busy,(function(t){e.state.busy!==t&&e.setState({busy:t})}))},t.prototype.renderApply=function(){var e=this.canApply();return!this.props.autoHideApply||e&&!this.canAutoApply(this.state.params)?i.createElement("div",{className:"msp-transform-apply-wrap"},i.createElement(l.IconButton,{svg:c.RefreshSvg,className:"msp-transform-default-params",onClick:this.setDefault,disabled:this.state.busy,title:"Set default params"}),i.createElement("div",{className:"msp-transform-apply-wider"},i.createElement(l.Button,{icon:e?c.CheckSvg:void 0,className:"msp-btn-commit msp-btn-commit-"+(e?"on":"off"),onClick:this.apply,disabled:!e},this.props.applyLabel||this.applyText()))):null},t.prototype.renderDefault=function(){var e=this.getInfo(),t=e.isEmpty&&this.isUpdate(),r=this.getHeader(),n=this.getTransformerId(),a=this.plugin.customParamEditors.has(n)?this.plugin.customParamEditors.get(n):d,o=this.state.isCollapsed?"msp-transform-wrapper msp-transform-wrapper-collapsed":"msp-transform-wrapper",s=null;if(!t&&!this.state.isCollapsed){var u=this.getSourceAndTarget(),f=u.a,p=u.b,m=u.bCell,h=this.renderApply();s=i.createElement(i.Fragment,null,i.createElement(a,{info:e,a:f,b:p,bCell:m,events:this.events,params:this.state.params,isDisabled:this.state.busy}),h)}var g=i.createElement("div",{className:o,style:{marginBottom:this.props.noMargin?0:void 0}},"none"!==r&&!this.props.wrapInExpander&&i.createElement("div",{className:"msp-transform-header"},i.createElement(l.Button,{onClick:this.toggleExpanded,title:r.description},!t&&i.createElement(c.Icon,{svg:this.state.isCollapsed?c.ArrowRightSvg:c.ArrowDropDownSvg}),r.name)),s);return t||!this.props.wrapInExpander?g:i.createElement(l.ExpandGroup,{header:this.isUpdate()?"Update "+("none"===r?"":r.name):"Apply "+("none"===r?"":r.name),headerLeftMargin:this.props.expanderHeaderLeftMargin},g)},t.prototype.renderSimple=function(){var e,t,r,n=this.getInfo(),a=this.canApply(),o=i.createElement("div",{className:"msp-flex-row"},i.createElement(l.Button,{icon:null===(e=this.props.simpleApply)||void 0===e?void 0:e.icon,title:null===(t=this.props.simpleApply)||void 0===t?void 0:t.title,disabled:this.state.busy||!a,onClick:this.apply,className:"msp-btn-apply-simple"},null===(r=this.props.simpleApply)||void 0===r?void 0:r.header),!n.isEmpty&&i.createElement(l.ToggleButton,{icon:c.TuneSvg,label:"",title:"Options",toggle:this.toggleExpanded,isSelected:!this.state.isCollapsed,disabled:this.state.busy,style:{flex:"0 0 40px",padding:0}}));if(this.state.isCollapsed)return o;var s=this.getTransformerId(),u=this.plugin.customParamEditors.has(s)?this.plugin.customParamEditors.get(s):d,f=this.getSourceAndTarget(),p=f.a,m=f.b,h=f.bCell;return i.createElement(i.Fragment,null,o,i.createElement(u,{info:n,a:p,b:m,bCell:h,events:this.events,params:this.state.params,isDisabled:this.state.busy}))},t.prototype.render=function(){return this.props.simpleApply?this.renderSimple():this.renderDefault()},t}(a.PurePluginUIComponent)},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(36),i=r(2);function a(e,t,r){void 0===r&&(r={});var i=r;return"string"==typeof i.type||"string"==typeof i.color||"string"==typeof i.size?function(e,t,r){var n=r.type&&e.representation.volume.registry.get(r.type)||e.representation.volume.registry.default.provider,i=r.color&&e.representation.volume.themes.colorThemeRegistry.get(r.color)||e.representation.volume.themes.colorThemeRegistry.get(n.defaultColorTheme.name),a=r.size&&e.representation.volume.themes.sizeThemeRegistry.get(r.size)||e.representation.volume.themes.sizeThemeRegistry.get(n.defaultSizeTheme.name);return o(e,t,{type:n,typeParams:r.typeParams,color:i,colorParams:r.colorParams,size:a,sizeParams:r.sizeParams})}(e,t||n.b.One,r):o(e,t||n.b.One,r)}function o(e,t,r){void 0===r&&(r={});var n=e.representation.volume.themes,a={volume:t},o=r.type||e.representation.volume.registry.default.provider,s=i.ParamDefinition.getDefaultValues(o.getParams(n,t)),u=Object.assign(s,r.typeParams),c=r.color||n.colorThemeRegistry.get(o.defaultColorTheme.name),l=i.ParamDefinition.getDefaultValues(c.getParams(a));c.name===o.defaultColorTheme.name&&Object.assign(l,o.defaultColorTheme.props);var d=Object.assign(l,r.colorParams),f=r.size||n.sizeThemeRegistry.get(o.defaultSizeTheme.name),p=i.ParamDefinition.getDefaultValues(f.getParams(a));f.name===o.defaultSizeTheme.name&&Object.assign(p,o.defaultSizeTheme.props);var m=Object.assign(p,r.sizeParams);return{type:{name:o.name,params:u},colorTheme:{name:c.name,params:d},sizeTheme:{name:f.name,params:m}}}},function(e,t,r){"use strict";r.r(t),r.d(t,"Download",(function(){return Z})),r.d(t,"DownloadBlob",(function(){return J})),r.d(t,"RawData",(function(){return $})),r.d(t,"ReadFile",(function(){return ee})),r.d(t,"ParseBlob",(function(){return te})),r.d(t,"ParseCif",(function(){return re})),r.d(t,"ParseCube",(function(){return ne})),r.d(t,"ParsePsf",(function(){return ie})),r.d(t,"ParsePly",(function(){return ae})),r.d(t,"ParseCcp4",(function(){return oe})),r.d(t,"ParseDsn6",(function(){return se})),r.d(t,"ParseDx",(function(){return ue})),r.d(t,"ImportString",(function(){return ce})),r.d(t,"ImportJson",(function(){return le})),r.d(t,"ParseJson",(function(){return de}));var n=r(0),i=r(374),a=r(26),o=r(17),s=r(83),u=r(375),c=r(198);function l(e){var t=e.xExtent,r=e.yExtent,n=e.zExtent;return{xBlocks:Math.ceil(t/8),yBlocks:Math.ceil(r/8),zBlocks:Math.ceil(n/8)}}function d(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.readBuffer(0,512)];case 1:return t=n.sent().buffer,r=String.fromCharCode.apply(null,t),i=r.startsWith(":-)"),a=i||100===t.readInt16LE(36),[2,{header:i?(o=r,{xStart:parseInt(o.substr(10,5)),yStart:parseInt(o.substr(15,5)),zStart:parseInt(o.substr(20,5)),xExtent:parseInt(o.substr(32,5)),yExtent:parseInt(o.substr(38,5)),zExtent:parseInt(o.substr(42,5)),xRate:parseInt(o.substr(52,5)),yRate:parseInt(o.substr(58,5)),zRate:parseInt(o.substr(62,5)),xlen:parseFloat(o.substr(73,10)),ylen:parseFloat(o.substr(83,10)),zlen:parseFloat(o.substr(93,10)),alpha:parseFloat(o.substr(103,10)),beta:parseFloat(o.substr(113,10)),gamma:parseFloat(o.substr(123,10)),divisor:parseFloat(o.substr(138,12)),summand:parseInt(o.substr(155,8)),sigma:parseFloat(o.substr(170,12))}):function(e,t){var r=t?function(t){return e.readInt16LE(2*t)}:function(t){return e.readInt16BE(2*t)},n=1/r(17);return{xStart:r(0),yStart:r(1),zStart:r(2),xExtent:r(3),yExtent:r(4),zExtent:r(5),xRate:r(6),yRate:r(7),zRate:r(8),xlen:r(9)*n,ylen:r(10)*n,zlen:r(11)*n,alpha:r(12)*n,beta:r(13)*n,gamma:r(14)*n,divisor:r(15)/100,summand:r(16),sigma:void 0}}(t,a),littleEndian:a}]}var o}))}))}function f(e,t,r,i){return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,o,s,u,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C;return Object(n.__generator)(this,(function(n){for(i||c.a.flipByteOrderInPlace2(t.buffer),a=e.divisor,o=e.summand,s=e.xExtent,u=e.yExtent,d=e.zExtent,f=l(e),p=f.xBlocks,m=f.yBlocks,h=f.zBlocks,g=0,v=0;v<h;++v)for(b=0;b<m;++b)for(y=0;y<p;++y)for(_=0;_<8;++_)for(S=8*v+_,x=0;x<8;++x)for(O=8*b+x,w=0;w<8;++w){if(!((C=8*y+w)<s&&O<u&&S<d)){g+=8-w;break}r[(C*u+O)*d+S]=(t[g]-o)/a,++g}return[2]}))}))}function p(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,o,s,u,c;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,r.update({message:"Parsing DSN6/BRIX file..."})];case 1:return n.sent(),[4,d(e)];case 2:return i=n.sent(),a=i.header,o=i.littleEndian,[4,e.readBuffer(512,t-512)];case 3:return s=n.sent().buffer,u=function(e){var t=e.xExtent,r=e.yExtent,n=e.zExtent,i=l(e),a=8*i.xBlocks*i.yBlocks*8*i.zBlocks*8;return{count:a,byteCount:1*a,valueCount:t*r*n}}(a).valueCount,c=new Float32Array(u),[4,f(a,s,c,o)];case 4:return n.sent(),[2,{header:a,values:c,name:e.name}]}}))}))}function m(e,t){return function(e,t){var r=this;return o.b.create("Parse DSN6/BRIX",(function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),a=(r=s.a).success,[4,p(e,t,i)];case 1:return[2,a.apply(r,[n.sent()])];case 2:return o=n.sent(),[2,s.a.error(o)];case 3:return[2]}}))}))}))}(u.a.fromBuffer(c.a.fromUint8Array(e),t),e.length)}var h=new Set(Object.keys({char:1,uchar:1,short:2,ushort:2,int:4,uint:4,float:4,double:8,int8:1,uint8:1,int16:2,uint16:2,int32:4,uint32:4,float32:4,float64:8}));function g(e){if(!h.has(e))throw new Error("unknown ply type '"+e+"'");return e}var v=r(21),b=r(7),y=r(81);function _(e){var t=e.tokenizer,r=e.comments,n=e.elementSpecs;!function(e){var t=e.data.indexOf("end_header",e.position);if(-1===t)throw new Error("no 'end_header' record found");e.tokenStart=e.position,e.tokenEnd=t,e.position=t,v.b.eatLine(e)}(t);var i,a,o,s=v.b.getTokenString(t).split(/\r?\n/);if("ply"!==s[0])throw new Error("data not starting with 'ply'");if("format ascii 1.0"!==s[1])throw new Error("format not 'ascii 1.0'");function u(){if(void 0!==i&&void 0!==a&&void 0!==o){for(var e=!1,t=0,r=o.length;t<r;++t){if("list"===o[t].kind){e=!0;break}}e&&o.length,e?n.push({kind:"list",name:i,count:a,property:o[0]}):n.push({kind:"table",name:i,count:a,properties:o})}}for(var c=2,l=s.length;c<l;++c){var d=s[c],f=d.split(" ");if(d.startsWith("comment"))r.push(d.substr(8));else if(d.startsWith("element"))u(),o=[],i=f[1],a=parseInt(f[2]);else if(d.startsWith("property")){if(void 0===o)throw new Error("properties outside of element");"list"===f[1]?o.push({kind:"list",countType:g(f[2]),dataType:g(f[3]),name:f[4]}):o.push({kind:"column",type:g(f[1]),name:f[2]})}else d.startsWith("end_header")?u():console.warn("unknown header line")}}function S(e){switch(e){case"char":case"uchar":case"int8":case"uint8":case"short":case"ushort":case"int16":case"uint16":case"int":case"uint":case"int32":case"uint32":return b.a.Schema.int;case"float":case"double":case"float32":case"float64":return b.a.Schema.float}}function x(e,t){for(var r=e.elements,n=e.tokenizer,i=t.count,a=t.properties,o=a.length,s=[],u=[],c=[],l=new Map,d=0,f=o;d<f;++d){var p=v.a.create(n.data,2*i);c.push(p)}for(d=0,f=i;d<f;++d)for(var m=0,h=o;m<h;++m)v.b.skipWhitespace(n),v.b.markStart(n),v.b.eatValue(n),v.a.addUnchecked(c[m],n.tokenStart,n.tokenEnd);for(d=0,f=o;d<f;++d){var g=a[d],b=g.type,_=g.name,x=Object(y.a)(c[d],S(b));s.push(_),u.push(b),l.set(_,x)}r.push({kind:"table",rowCount:i,propertyNames:s,propertyTypes:u,getProperty:function(e){return l.get(e)}})}function O(e,t){for(var r=e.elements,n=e.tokenizer,i=t.count,a=t.property,o=v.a.create(n.data,2*i*3),s=new Uint32Array(i+1),u=0,c=0,l=i;c<l;++c){for(v.b.skipWhitespace(n),v.b.markStart(n);10!==v.b.skipWhitespace(n);)++u,v.b.markStart(n),v.b.eatValue(n),v.a.addToken(o,n);s[c+1]=u}var d={entries:[],count:0},f=Object(y.a)(o,S(a.dataType));r.push({kind:"list",rowCount:i,name:a.name,type:a.dataType,value:function(e){for(var t=s[e]+1,r=f.value(t-1),n=t,i=t+r;n<i;++n)d.entries[n-t]=f.value(n);return d.count=r,d}})}function w(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,u,c;return Object(n.__generator)(this,(function(n){return r=function(e,t){return{data:e,tokenizer:Object(v.b)(e),runtimeCtx:t,comments:[],elementSpecs:[],elements:[]}}(e,t),t.update({message:"Parsing...",current:0,max:e.length}),_(r),function(e){for(var t=e.elementSpecs,r=0,n=t.length;r<n;++r){var i=t[r];"table"===i.kind?x(e,i):"list"===i.kind&&O(e,i)}}(r),i=r.elements,a=r.elementSpecs,o=r.comments,u=a.map((function(e){return e.name})),c=function(e,t,r){for(var n=new Map,i=0,a=t.length;i<a;++i)n.set(t[i],e[i]);return{comments:r,elementNames:t,getElement:function(e){return n.get(e)}}}(i,u,o),[2,s.a.success(c)]}))}))}function C(e){var t=this;return o.b.create("Parse PLY",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){return Object(n.__generator)(this,(function(t){switch(t.label){case 0:return[4,w(e,r)];case 1:return[2,t.sent()]}}))}))}))}var j=v.b.readLine,P=v.b.skipWhitespace,E=v.b.eatValue,A=v.b.eatLine,D=v.b.markStart,T=/\s+/,I=/(^\*|REMARK)*/;function M(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,s,u,c,l,d,f,p,m;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=e.tokenizer,i=v.a.create(r.data,2*t),a=v.a.create(r.data,2*t),s=v.a.create(r.data,2*t),u=v.a.create(r.data,2*t),c=v.a.create(r.data,2*t),l=v.a.create(r.data,2*t),d=v.a.create(r.data,2*t),f=v.a.create(r.data,2*t),p=r.length,m=0,[4,Object(o.c)(e.runtimeCtx,10,void 0,(function(e){for(var n=Math.min(t-m,e),o=0;o<n;++o){for(var p=0;p<8;++p)switch(P(r),D(r),E(r),p){case 0:v.a.addUnchecked(i,r.tokenStart,r.tokenEnd);break;case 1:v.a.addUnchecked(a,r.tokenStart,r.tokenEnd);break;case 2:v.a.addUnchecked(s,r.tokenStart,r.tokenEnd);break;case 3:v.a.addUnchecked(u,r.tokenStart,r.tokenEnd);break;case 4:v.a.addUnchecked(c,r.tokenStart,r.tokenEnd);break;case 5:v.a.addUnchecked(l,r.tokenStart,r.tokenEnd);break;case 6:v.a.addUnchecked(d,r.tokenStart,r.tokenEnd);break;case 7:v.a.addUnchecked(f,r.tokenStart,r.tokenEnd)}A(r),D(r)}return m+=n,n}),(function(e){return e.update({message:"Parsing...",current:r.position,max:p})}))];case 1:return n.sent(),[2,{count:t,atomId:Object(y.c)(i)(b.a.Schema.int),segmentName:Object(y.c)(a)(b.a.Schema.str),residueId:Object(y.c)(s)(b.a.Schema.int),residueName:Object(y.c)(u)(b.a.Schema.str),atomName:Object(y.c)(c)(b.a.Schema.str),atomType:Object(y.c)(l)(b.a.Schema.str),charge:Object(y.c)(d)(b.a.Schema.float),mass:Object(y.c)(f)(b.a.Schema.float)}]}}))}))}function k(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=e.tokenizer,i=v.a.create(r.data,2*t),a=v.a.create(r.data,2*t),s=r.length,u=0,[4,Object(o.c)(e.runtimeCtx,10,void 0,(function(e){for(var n=Math.min(t-u,e),o=0;o<n;++o)for(var s=0;s<2;++s)switch(P(r),D(r),E(r),s){case 0:v.a.addUnchecked(i,r.tokenStart,r.tokenEnd);break;case 1:v.a.addUnchecked(a,r.tokenStart,r.tokenEnd)}return u+=n,n}),(function(e){return e.update({message:"Parsing...",current:r.position,max:s})}))];case 1:return n.sent(),[2,{count:t,atomIdA:Object(y.c)(i)(b.a.Schema.int),atomIdB:Object(y.c)(a)(b.a.Schema.int)}]}}))}))}function B(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,u,c,l,d,f,p,m;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:r=Object(v.b)(e),i=function(e,t){return{tokenizer:e,runtimeCtx:t}}(r,t),a=void 0,o=void 0,u=void 0,c=j(i.tokenizer).trim(),n.label=1;case 1:return r.tokenEnd<r.length?(l=j(i.tokenizer).trim()).includes("!NTITLE")?(d=parseInt(l.split(T)[0]),a=function(e,t){for(var r=[],n=0;n<t;++n){var i=j(e.tokenizer);r.push(i.replace(I,"").trim())}return r}(i,d),[3,7]):[3,2]:[3,8];case 2:return l.includes("!NATOM")?(f=parseInt(l.split(T)[0]),[4,M(i,f)]):[3,4];case 3:return o=n.sent(),[3,7];case 4:return l.includes("!NBOND")?(p=parseInt(l.split(T)[0]),[4,k(i,p)]):[3,6];case 5:return u=n.sent(),[3,8];case 6:l.includes("!NTHETA")||l.includes("!NPHI")||l.includes("!NIMPHI")||l.includes("!NDON")||l.includes("!NACC")||l.includes("!NNB")||l.includes("!NGRP NST2")||l.includes("!MOLNT")||l.includes("!NUMLP NUMLPH")||l.includes("!NCRTERM"),n.label=7;case 7:return[3,1];case 8:return void 0===a&&(a=[]),void 0===o?[2,s.a.error("no atoms data")]:void 0===u?[2,s.a.error("no bonds data")]:(m={id:c,title:a,atoms:o,bonds:u},[2,s.a.success(m)])}}))}))}function V(e){var t=this;return o.b.create("Parse PSF",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){return Object(n.__generator)(this,(function(t){switch(t.label){case 0:return[4,B(e,r)];case 1:return[2,t.sent()]}}))}))}))}var R=r(13),L=r(183),N=r(2),F=r(8),U=r(119),z=r(1),H=r(101);function G(e){var t=v.b.readLines(e,6),r=function(e,r){var n=+t[e].trim().split(/\s+/g)[r];return Number.isNaN(n)?0:n},n=function(e){var t=r(e+2,0),n=.529177210859;return[Math.abs(t),z.Vec3.create(r(e+2,1)*n,r(e+2,2)*n,r(e+2,3)*n),t]},i=t[0].trim(),a=t[1].trim(),o=n(0),s=o[0],u=o[1],c=o[2],l=n(1),d=l[0],f=l[1],p=n(2),m=p[0],h=p[1],g=n(3),y=g[0],_=g[1],S=function(e,t,r){for(var n=new Int32Array(t),i=new Float64Array(t),a=new Float32Array(t),o=new Float32Array(t),s=new Float32Array(t),u=0;u<t;u++){var c=v.b.readLine(e).trim().split(/\s+/g);n[u]=+c[0],i[u]=+c[1],a[u]=+c[2]*r,o[u]=+c[3]*r,s[u]=+c[4]*r}return{count:t,number:b.a.ofArray({array:n,schema:b.a.Schema.int}),nuclearCharge:b.a.ofArray({array:i,schema:b.a.Schema.float}),x:b.a.ofArray({array:a,schema:b.a.Schema.float}),y:b.a.ofArray({array:o,schema:b.a.Schema.float}),z:b.a.ofArray({array:s,schema:b.a.Schema.float})}}(e,s,.529177210859),x=[];if(c>=0){var O=r(2,4);0===O&&(O=1);for(var w=0;w<O;w++)x.push(w)}else for(var C=v.b.readLine(e).trim().split(/\s+/g),j=(w=0,+C[0]);w<j;w++)x.push(+C[w+1]);return{header:{orbitals:c<0,comment1:i,comment2:a,atomCount:s,origin:u,dim:z.Vec3.create(d,m,y),basisX:f,basisY:h,basisZ:_,dataSetIds:x},atoms:S}}function q(e,t,r){var n=r.dim[0]*r.dim[1]*r.dim[2]*r.dataSetIds.length,i=new Float64Array(n),a=0;return Object(o.c)(e,1e6,i,(function(e,r){for(var i=Math.min(n,a+e),o=a;o<i;o++)v.b.skipWhitespace(t),t.tokenStart=t.position,v.b.eatValue(t),r[o]=Object(H.b)(t.data,t.tokenStart,t.tokenEnd);return a=i,i===n?0:1e6}),(function(e,t,r){return e.update({current:Math.min(r,n),max:n})}))}function W(e,t){var r=this;return o.b.create("Parse Cube",(function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,o,u,c;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,i.update("Reading header...")];case 1:return n.sent(),r=Object(v.b)(e),a=G(r),o=a.header,u=a.atoms,[4,q(i,r,o)];case 2:return c=n.sent(),[2,s.a.success({header:o,atoms:u,values:c,name:t})]}}))}))}))}var X=r(161);function Y(e){for(var t={h:Object(z.Vec3)()},r=0,n=0,i=/\s+/g;;){var a=v.b.readLine(e),o=void 0;if(a.startsWith("object 1"))o=a.split(i),t.dim=z.Vec3.create(parseInt(o[5]),parseInt(o[6]),parseInt(o[7]));else if(a.startsWith("origin"))o=a.split(i),t.min=z.Vec3.create(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));else if(a.startsWith("delta"))o=a.split(i),0===n?t.h[0]=parseFloat(o[1]):1===n?t.h[1]=parseFloat(o[2]):2===n&&(t.h[2]=parseFloat(o[3])),n+=1;else if(a.startsWith("object 3")){r+=a.length+1;break}r+=a.length+1}return{header:t,headerByteCount:r}}function Q(e,t,r){var n=r.dim[0]*r.dim[1]*r.dim[2],i=new Float64Array(n),a=0;return Object(o.c)(e,1e6,i,(function(e,r){for(var i=Math.min(n,a+e),o=a;o<i;o++)v.b.skipWhitespace(t),t.tokenStart=t.position,v.b.eatValue(t),r[o]=Object(H.b)(t.data,t.tokenStart,t.tokenEnd);return a=i,i===n?0:1e6}),(function(e,t,r){return e.update({current:Math.min(r,n),max:n})}))}function K(e,t){return o.b.create("Parse Cube",(function(r){return"string"==typeof e?function(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.update("Reading header...")];case 1:return n.sent(),i=Object(v.b)(t),a=Y(i).header,[4,e.update("Reading values...")];case 2:return n.sent(),[4,Q(e,i,a)];case 3:return o=n.sent(),[2,s.a.success({header:a,values:o,name:r})]}}))}))}(r,e,t):function(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a,o,u,c,l,d,f,p;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,e.update("Reading header...")];case 1:return n.sent(),i=Object(X.b)(t,0,1e3),a=Object(v.b)(i),o=Y(a),u=o.header,c=o.headerByteCount,[4,e.update("Reading values...")];case 2:for(n.sent(),l=u.dim[0]*u.dim[1]*u.dim[2],d=new DataView(t.buffer,t.byteOffset+c),f=new Float64Array(l),p=0;p<l;p++)f[p]=d.getFloat64(8*p,!0);return[2,s.a.success({header:u,values:f,name:r})]}}))}))}(r,e,t)}))}var Z=F.b.BuiltIn({name:"download",display:{name:"Download",description:"Download string or binary data from the specified URL"},from:[F.a.Root],to:[F.a.Data.String,F.a.Data.Binary],params:{url:N.ParamDefinition.Url("https://www.ebi.ac.uk/pdbe/static/entry/1cbs_updated.cif",{description:"Resource URL. Must be the same domain or support CORS."}),label:N.ParamDefinition.Optional(N.ParamDefinition.Text("")),isBinary:N.ParamDefinition.Optional(N.ParamDefinition.Boolean(!1,{description:"If true, download data as binary (string otherwise)"}))}})({apply:function(e,t){var r=this,i=e.params,a=e.cache;return o.b.create("Download",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=U.Asset.getUrlAsset(t.managers.asset,i.url),[4,t.managers.asset.resolve(r,i.isBinary?"binary":"string").runInContext(e)];case 1:return o=n.sent(),a.asset=o,[2,i.isBinary?new F.a.Data.Binary(o.data,{label:i.label?i.label:r.url}):new F.a.Data.String(o.data,{label:i.label?i.label:r.url})]}}))}))}))},dispose:function(e){var t,r;null===(r=null===(t=e.cache)||void 0===t?void 0:t.asset)||void 0===r||r.dispose()},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.url!==r.url||t.isBinary!==r.isBinary?R.StateTransformer.UpdateResult.Recreate:t.label!==r.label?(n.label=r.label||("string"==typeof r.url?r.url:r.url.url),R.StateTransformer.UpdateResult.Updated):R.StateTransformer.UpdateResult.Unchanged}}),J=F.b.BuiltIn({name:"download-blob",display:{name:"Download Blob",description:"Download multiple string or binary data from the specified URLs."},from:F.a.Root,to:F.a.Data.Blob,params:{sources:N.ParamDefinition.ObjectList({id:N.ParamDefinition.Text("",{label:"Unique ID"}),url:N.ParamDefinition.Url("https://www.ebi.ac.uk/pdbe/static/entry/1cbs_updated.cif",{description:"Resource URL. Must be the same domain or support CORS."}),isBinary:N.ParamDefinition.Optional(N.ParamDefinition.Boolean(!1,{description:"If true, download data as binary (string otherwise)"})),canFail:N.ParamDefinition.Optional(N.ParamDefinition.Boolean(!1,{description:"Indicate whether the download can fail and not be included in the blob as a result."}))},(function(e){return e.id+": "+e.url})),maxConcurrency:N.ParamDefinition.Optional(N.ParamDefinition.Numeric(4,{min:1,max:12,step:1},{description:"The maximum number of concurrent downloads."}))}})({apply:function(e,t){var r=this,i=e.params,a=e.cache;return o.b.create("Download Blob",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,o,s,u,c,l;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=[],[4,Object(L.b)(e,t.managers.asset,i.sources,i.maxConcurrency||4)];case 1:for(o=n.sent(),s=[],u=0;u<o.length;u++)c=o[u],l=i.sources[u],"error"===c.kind?t.log.warn("Download "+c.id+" ("+l.url+") failed: "+c.error):(s.push(c.result),r.push(l.isBinary?{id:c.id,kind:"binary",data:c.result.data}:{id:c.id,kind:"string",data:c.result.data}));return a.assets=s,[2,new F.a.Data.Blob(r,{label:"Data Blob",description:r.length+" "+(1===r.length?"entry":"entries")})]}}))}))}))},dispose:function(e,t){var r,n=null===(r=e.cache)||void 0===r?void 0:r.assets;if(n)for(var i=0,a=n;i<a.length;i++){a[i].dispose()}}}),$=F.b.BuiltIn({name:"raw-data",display:{name:"Raw Data",description:"Raw data supplied by value."},from:[F.a.Root],to:[F.a.Data.String,F.a.Data.Binary],params:{data:N.ParamDefinition.Value("",{isHidden:!0}),label:N.ParamDefinition.Optional(N.ParamDefinition.Text(""))}})({apply:function(e){var t=this,r=e.params;return o.b.create("Raw Data",(function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){return Object(n.__generator)(this,(function(e){if("string"==typeof r.data)return[2,new F.a.Data.String(r.data,{label:r.label?r.label:"String"})];if(Array.isArray(r.data))return[2,new F.a.Data.Binary(new Uint8Array(r.data),{label:r.label?r.label:"Binary"})];if(r.data instanceof ArrayBuffer)return[2,new F.a.Data.Binary(new Uint8Array(r.data),{label:r.label?r.label:"Binary"})];if(r.data instanceof Uint8Array)return[2,new F.a.Data.Binary(r.data,{label:r.label?r.label:"Binary"})];throw new Error("Supplied binary data must be a plain array, ArrayBuffer, or Uint8Array.")}))}))}))},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.data!==r.data?R.StateTransformer.UpdateResult.Recreate:t.label!==r.label?(n.label=r.label||n.label,R.StateTransformer.UpdateResult.Updated):R.StateTransformer.UpdateResult.Unchanged},customSerialization:{toJSON:function(e){if("string"==typeof e.data||Array.isArray(e.data))return e;if(e.data instanceof ArrayBuffer){for(var t=new Uint8Array(e.data),r=new Array(t.length),n=0,i=t.length;n<i;n++)r[n]=t[n];return{data:r,label:e.label}}if(e.data instanceof Uint8Array){for(r=new Array(e.data.length),n=0,i=e.data.length;n<i;n++)r[n]=e.data[n];return{data:r,label:e.label}}},fromJSON:function(e){return e}}}),ee=F.b.BuiltIn({name:"read-file",display:{name:"Read File",description:"Read string or binary data from the specified file"},from:F.a.Root,to:[F.a.Data.String,F.a.Data.Binary],params:{file:N.ParamDefinition.File(),label:N.ParamDefinition.Optional(N.ParamDefinition.Text("")),isBinary:N.ParamDefinition.Optional(N.ParamDefinition.Boolean(!1,{description:"If true, open file as as binary (string otherwise)"}))}})({apply:function(e,t){var r=this,i=e.params,a=e.cache;return o.b.create("Open File",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return null===i.file?(t.log.error("No file(s) selected"),[2,R.StateObject.Null]):[4,t.managers.asset.resolve(i.file,i.isBinary?"binary":"string").runInContext(e)];case 1:return r=n.sent(),a.asset=r,[2,i.isBinary?new F.a.Data.Binary(r.data,{label:i.label?i.label:i.file.name}):new F.a.Data.String(r.data,{label:i.label?i.label:i.file.name})]}}))}))}))},dispose:function(e){var t,r;null===(r=null===(t=e.cache)||void 0===t?void 0:t.asset)||void 0===r||r.dispose()},update:function(e){var t,r=e.oldParams,n=e.newParams,i=e.b;return r.label!==n.label?(i.label=n.label||(null===(t=r.file)||void 0===t?void 0:t.name)||"",R.StateTransformer.UpdateResult.Updated):R.StateTransformer.UpdateResult.Unchanged},isSerializable:function(){return{isSerializable:!1,reason:"Cannot serialize user loaded files."}}}),te=F.b.BuiltIn({name:"parse-blob",display:{name:"Parse Blob",description:"Parse multiple data enties"},from:F.a.Data.Blob,to:F.a.Format.Blob,params:{formats:N.ParamDefinition.ObjectList({id:N.ParamDefinition.Text("",{label:"Unique ID"}),format:N.ParamDefinition.Select("cif",[["cif","cif"]])},(function(e){return e.id+": "+e.format}))}})({apply:function(e,t){var r=this,i=e.a,s=e.params;return o.b.create("Parse Blob",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var t,r,o,u,c,l,d,f,p;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(t=new Map,r=0,o=s.formats;r<o.length;r++)u=o[r],t.set(u.id,u.format);c=[],l=0,d=i.data,n.label=1;case 1:return l<d.length?(f=d[l],t.has(f.id)?[4,("string"===f.kind?a.a.parse(f.data):a.a.parseBinary(f.data)).runInContext(e)]:[3,3]):[3,4];case 2:if((p=n.sent()).isError)throw new Error(f.id+": "+p.message);c.push({id:f.id,kind:"cif",data:p.result}),n.label=3;case 3:return l++,[3,1];case 4:return[2,new F.a.Format.Blob(c,{label:"Format Blob",description:c.length+" "+(1===c.length?"entry":"entries")})]}}))}))}))}}),re=F.b.BuiltIn({name:"parse-cif",display:{name:"Parse CIF",description:"Parse CIF from String or Binary data"},from:[F.a.Data.String,F.a.Data.Binary],to:F.a.Format.Cif})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse CIF",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,(F.a.Data.String.is(r)?a.a.parse(r.data):a.a.parseBinary(r.data)).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[2,new F.a.Format.Cif(t.result)]}}))}))}))}}),ne=F.b.BuiltIn({name:"parse-cube",display:{name:"Parse Cube",description:"Parse Cube from String data"},from:F.a.Data.String,to:F.a.Format.Cube})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse Cube",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,W(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[2,new F.a.Format.Cube(t.result)]}}))}))}))}}),ie=F.b.BuiltIn({name:"parse-psf",display:{name:"Parse PSF",description:"Parse PSF from String data"},from:[F.a.Data.String],to:F.a.Format.Psf})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse PSF",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,V(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[2,new F.a.Format.Psf(t.result)]}}))}))}))}}),ae=F.b.BuiltIn({name:"parse-ply",display:{name:"Parse PLY",description:"Parse PLY from String data"},from:[F.a.Data.String],to:F.a.Format.Ply})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse PLY",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,C(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[2,new F.a.Format.Ply(t.result,{label:t.result.comments[0]||"PLY Data"})]}}))}))}))}}),oe=F.b.BuiltIn({name:"parse-ccp4",display:{name:"Parse CCP4/MRC/MAP",description:"Parse CCP4/MRC/MAP from Binary data"},from:[F.a.Data.Binary],to:F.a.Format.Ccp4})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse CCP4/MRC/MAP",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,i.b(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[2,new F.a.Format.Ccp4(t.result)]}}))}))}))}}),se=F.b.BuiltIn({name:"parse-dsn6",display:{name:"Parse DSN6/BRIX",description:"Parse CCP4/BRIX from Binary data"},from:[F.a.Data.Binary],to:F.a.Format.Dsn6})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse DSN6/BRIX",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,m(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[2,new F.a.Format.Dsn6(t.result)]}}))}))}))}}),ue=F.b.BuiltIn({name:"parse-dx",display:{name:"Parse DX",description:"Parse DX from Binary/String data"},from:[F.a.Data.Binary,F.a.Data.String],to:F.a.Format.Dx})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse DX",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,K(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[2,new F.a.Format.Dx(t.result)]}}))}))}))}}),ce=F.b.BuiltIn({name:"import-string",display:{name:"Import String",description:"Import given data as a string"},from:F.a.Root,to:F.a.Data.String,params:{data:N.ParamDefinition.Value(""),label:N.ParamDefinition.Optional(N.ParamDefinition.Text(""))}})({apply:function(e){var t=e.params,r=t.data,n=t.label;return new F.a.Data.String(r,{label:n||""})},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.data!==r.data?R.StateTransformer.UpdateResult.Recreate:t.label!==r.label?(n.label=r.label||"",R.StateTransformer.UpdateResult.Updated):R.StateTransformer.UpdateResult.Unchanged},isSerializable:function(){return{isSerializable:!1,reason:"Cannot serialize user imported strings."}}}),le=F.b.BuiltIn({name:"import-json",display:{name:"Import JSON",description:"Import given data as a JSON"},from:F.a.Root,to:F.a.Format.Json,params:{data:N.ParamDefinition.Value({}),label:N.ParamDefinition.Optional(N.ParamDefinition.Text(""))}})({apply:function(e){var t=e.params,r=t.data,n=t.label;return new F.a.Format.Json(r,{label:n||""})},update:function(e){var t=e.oldParams,r=e.newParams,n=e.b;return t.data!==r.data?R.StateTransformer.UpdateResult.Recreate:t.label!==r.label?(n.label=r.label||"",R.StateTransformer.UpdateResult.Updated):R.StateTransformer.UpdateResult.Unchanged},isSerializable:function(){return{isSerializable:!1,reason:"Cannot serialize user imported JSON."}}}),de=F.b.BuiltIn({name:"parse-json",display:{name:"Parse JSON",description:"Parse JSON from String data"},from:[F.a.Data.String],to:F.a.Format.Json})({apply:function(e){var t=this,r=e.a;return o.b.create("Parse JSON",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var e;return Object(n.__generator)(this,(function(t){switch(t.label){case 0:return[4,new Response(r.data).json()];case 1:return e=t.sent(),[2,new F.a.Format.Json(e)]}}))}))}))}})},function(e,t,r){"use strict";r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return f})),r.d(t,"d",(function(){return p}));var n,i=r(0),a=r(266),o=r(75),s=r(349),u=r(48),c="undefined"!=typeof performance&&performance.mark&&performance.measure&&!u.b;function l(e,t,r){void 0===r&&(r=250);var n=h(e,t,r);return b(e,new S(n,n.root))}function d(e,t,r){void 0===r&&(r=250);var n=h(e,t,r);return new S(n,n.root)}function f(e,t){return b(t,e)}function p(e,t,r){return e.runChild(t,r)}function m(e){return{taskId:e.id,taskName:e.name,message:"",startedTime:0,canAbort:!0,isIndeterminate:!0,current:0,max:0}}function h(e,t,r){var n,i={abortRequested:!1,treeAborted:!1,reason:""};return{updateRateMs:r,lastNotified:Object(o.b)(),observer:t,abortToken:i,taskId:e.id,root:{progress:m(e),children:[]},tryAbort:(n=i,function(e){n.abortRequested=!0,n.reason=e||n.reason})}}function g(e){return{progress:Object(i.__assign)({},e.progress),children:e.children.map(g)}}function v(e){return e.progress.canAbort&&e.children.every(v)}function b(e,t){return Object(i.__awaiter)(this,void 0,void 0,(function(){var r,s;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:n.markStart(e),t.node.progress.startedTime=Object(o.b)(),i.label=1;case 1:return i.trys.push([1,3,,7]),[4,e.f(t)];case 2:return r=i.sent(),n.markEnd(e),n.measure(e),t.info.abortToken.abortRequested&&y(t.info),[2,r];case 3:return s=i.sent(),a.a.isAbort(s)?(t.isAborted=!0,t.node.children.length>0?[4,new Promise((function(e){t.onChildrenFinished=e}))]:[3,5]):[3,6];case 4:i.sent(),i.label=5;case 5:e.onAbort&&e.onAbort(),i.label=6;case 6:throw u.a&&console.error(s),s;case 7:return[2]}}))}))}function y(e){throw e.abortToken.treeAborted||(e.abortToken.treeAborted=!0,function e(t){var r=t.progress;r.isIndeterminate=!0,r.canAbort=!1,r.message="Aborting...";for(var n=0,i=t.children;n<i.length;n++){var a=i[n];e(a)}}(e.root),_(e,Object(o.b)())),a.a.Aborted(e.abortToken.reason)}function _(e,t){e.lastNotified=t;var r=function(e){return{root:g(e.root),canAbort:v(e.root),requestAbort:e.tryAbort}}(e);e.observer(r)}!function(e){function t(e){return"startTask"+e.id}function r(e){return"endTask"+e.id}e.markStart=function(e){c&&performance.mark(t(e))},e.markEnd=function(e){c&&performance.mark(r(e))},e.measure=function(e){c&&performance.measure("✳️ "+e.name,t(e),r(e))}}(n||(n={}));var S=function(){function e(e,t){this.isSynchronous=!1,this.isExecuting=!0,this.lastUpdatedTime=0,this.onChildrenFinished=void 0,this.node=t,this.info=e}return e.prototype.checkAborted=function(){this.info.abortToken.abortRequested&&(this.isAborted=!0,y(this.info))},Object.defineProperty(e.prototype,"shouldUpdate",{get:function(){return this.checkAborted(),Object(o.b)()-this.lastUpdatedTime>this.info.updateRateMs},enumerable:!1,configurable:!0}),e.prototype.updateProgress=function(e){if(this.checkAborted(),e){var t=this.node.progress;"string"==typeof e?(t.message=e,t.isIndeterminate=!0):(void 0!==e.canAbort&&(t.canAbort=e.canAbort),void 0!==e.message&&(t.message=e.message),void 0!==e.current&&(t.current=e.current),void 0!==e.max&&(t.max=e.max),t.isIndeterminate=void 0===t.current||void 0===t.max,void 0!==e.isIndeterminate&&(t.isIndeterminate=e.isIndeterminate))}},e.prototype.update=function(e,t){if(this.lastUpdatedTime=Object(o.b)(),this.updateProgress(e),!t)return _(this.info,this.lastUpdatedTime),this.checkAborted(),s.a.immediatePromise()},e.prototype.runChild=function(t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var n,o,s,u,c,l,d;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:this.updateProgress(r),n={progress:m(t),children:[]},(o=this.node.children).push(n),s=new e(this.info,n),i.label=1;case 1:return i.trys.push([1,3,4,5]),[4,b(t,s)];case 2:return[2,i.sent()];case 3:if(u=i.sent(),a.a.isAbort(u)&&this.isAborted)return[2,void 0];throw u;case 4:if((c=o.indexOf(n))>=0){for(l=c,d=o.length-1;l<d;l++)o[l]=o[l+1];o.pop()}return 0===o.length&&this.onChildrenFinished&&this.onChildrenFinished(),[7];case 5:return[2]}}))}))},e}()},function(e,t,r){"use strict";var n,i=function(){function e(e){this.xs=[],this.index=-1,this.length=0,this.hasNext=!1,this.length=e.length,this.hasNext=e.length>0,this.xs=e,this.index=-1,this.lastValue=e.length>0?e[0]:void 0}return e.prototype.move=function(){return++this.index,this.lastValue=this.xs[this.index],this.hasNext=this.index<this.length-1,this.lastValue},e}(),a=function(){function e(e,t){this.max=t,this.value=0,this.hasNext=!1,this.value=e-1,this.hasNext=t>=e}return e.prototype.move=function(){return++this.value,this.hasNext=this.value<this.max,this.value},e}(),o=function(){function e(e){this.value=e,this.hasNext=!0}return e.prototype.move=function(){return this.hasNext=!1,this.value},e}(),s=function(){function e(e,t){this.base=e,this.f=t,this.hasNext=!1,this.hasNext=e.hasNext}return e.prototype.move=function(){var e=this.f(this.base.move());return this.hasNext=this.base.hasNext,e},e}(),u=function(){function e(e,t){this.base=e,this.p=t,this.hasNext=this.findNext()}return e.prototype.move=function(){var e=this.next;return this.hasNext=this.findNext(),e},e.prototype.findNext=function(){for(;this.base.hasNext;)if(this.next=this.base.move(),this.p(this.next))return!0;return!1},e}();!function(e){e.Empty=new a(0,-1),e.Array=function(e){return new i(e)},e.Value=function(e){return new o(e)},e.Range=function(e,t){return new a(e,t)},e.map=function(e,t){return new s(e,t)},e.filter=function(e,t){return new u(e,t)},e.forEach=function(e,t,r){for(;e.hasNext;){if(t(e.move(),r))return r}return r}}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return n}));var n,i=r(12),a=r(9),o=r(95),s=r(44),u=function(){function e(e,t,r){this.operatorsProvider=r,this.id=e,this.details=t}return Object.defineProperty(e.prototype,"operatorGroups",{get:function(){return this._operators||(this._operators=this.operatorsProvider()),this._operators},enumerable:!1,configurable:!0}),e}();!function(e){e.create=function(t,r,n){return new e(t,r,n)}}(u||(u={})),function(e){e.Default={assemblies:[],spacegroup:a.e.ZeroP1,isNonStandardCrystalFrame:!1},e.findAssembly=function(e,t){var r=t.toLocaleLowerCase(),n=o.a.Provider.get(e);return n?Object(i.c)(n.assemblies,(function(e){return e.id.toLowerCase()===r})):void 0},e.getUnitcellLabel=function(e){var t=e.spacegroup,r=t.cell,n=t.name,i=t.num,a=r.size,o=r.anglesInRadians,u=a[0].toFixed(2),c=a[1].toFixed(2),l=a[2].toFixed(2),d=Object(s.f)(o[0]).toFixed(2),f=Object(s.f)(o[1]).toFixed(2),p=Object(s.f)(o[2]).toFixed(2),m=[];return m.push("Unit Cell <b>"+n+"</b> #"+i),m.push(u+"×"+c+"×"+l+" Å"),m.push("α="+d+"° β="+f+"° γ="+p+"°"),m.join(" | ")}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(229),i=r(187);function a(e){return void 0===e&&(e=Number.POSITIVE_INFINITY),Object(n.b)(i.a,e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(20),i=r(34),a=r(222),o=r(143);function s(e){return function(t){return 0===e?Object(o.b)():t.lift(new u(e))}}var u=function(){function e(e){if(this.total=e,this.total<0)throw new a.a}return e.prototype.call=function(e,t){return t.subscribe(new c(e,this.total))},e}(),c=function(e){function t(t,r){var n=e.call(this,t)||this;return n.total=r,n.count=0,n}return n.a(t,e),t.prototype._next=function(e){var t=this.total,r=++this.count;r<=t&&(this.destination.next(e),r===t&&(this.destination.complete(),this.unsubscribe()))},t}(i.a)},function(e,t,r){"use strict";r.d(t,"b",(function(){return l})),r.d(t,"a",(function(){return d}));var n=r(20),i=r(131),a=r(104),o=r(194),s=r(178),u=r(235),c={};function l(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=void 0,n=void 0;return Object(i.a)(e[e.length-1])&&(n=e.pop()),"function"==typeof e[e.length-1]&&(r=e.pop()),1===e.length&&Object(a.a)(e[0])&&(e=e[0]),Object(u.a)(e,n).lift(new d(r))}var d=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new f(e,this.resultSelector))},e}(),f=function(e){function t(t,r){var n=e.call(this,t)||this;return n.resultSelector=r,n.active=0,n.values=[],n.observables=[],n}return n.a(t,e),t.prototype._next=function(e){this.values.push(c),this.observables.push(e)},t.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{this.active=t,this.toRespond=t;for(var r=0;r<t;r++){var n=e[r];this.add(Object(s.a)(this,n,void 0,r))}}},t.prototype.notifyComplete=function(e){0==(this.active-=1)&&this.destination.complete()},t.prototype.notifyNext=function(e,t,r){var n=this.values,i=n[r],a=this.toRespond?i===c?--this.toRespond:this.toRespond:0;n[r]=t,0===a&&(this.resultSelector?this._tryResultSelector(n):this.destination.next(n.slice()))},t.prototype._tryResultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(o.a)},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(45);function i(e,t){return t?new n.a((function(r){return t.schedule(a,0,{error:e,subscriber:r})})):new n.a((function(t){return t.error(e)}))}function a(e){var t=e.error;e.subscriber.error(t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(20),i=r(34);function a(){return function(e){return e.lift(new o(e))}}var o=function(){function e(e){this.connectable=e}return e.prototype.call=function(e,t){var r=this.connectable;r._refCount++;var n=new s(e,r),i=t.subscribe(n);return n.closed||(n.connection=r.connect()),i},e}(),s=function(e){function t(t,r){var n=e.call(this,t)||this;return n.connectable=r,n}return n.a(t,e),t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._refCount;if(t<=0)this.connection=null;else if(e._refCount=t-1,t>1)this.connection=null;else{var r=this.connection,n=e._connection;this.connection=null,!n||r&&n!==r||n.unsubscribe()}}else this.connection=null},t}(i.a)},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(20),i=r(62),a=r(326),o=r(76),s=r(357),u=r(215),c=r(362),l=function(e){function t(t,r,n){void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===r&&(r=Number.POSITIVE_INFINITY);var i=e.call(this)||this;return i.scheduler=n,i._events=[],i._infiniteTimeWindow=!1,i._bufferSize=t<1?1:t,i._windowTime=r<1?1:r,r===Number.POSITIVE_INFINITY?(i._infiniteTimeWindow=!0,i.next=i.nextInfiniteTimeWindow):i.next=i.nextTimeWindow,i}return n.a(t,e),t.prototype.nextInfiniteTimeWindow=function(t){if(!this.isStopped){var r=this._events;r.push(t),r.length>this._bufferSize&&r.shift()}e.prototype.next.call(this,t)},t.prototype.nextTimeWindow=function(t){this.isStopped||(this._events.push(new d(this._getNow(),t)),this._trimBufferThenGetEvents()),e.prototype.next.call(this,t)},t.prototype._subscribe=function(e){var t,r=this._infiniteTimeWindow,n=r?this._events:this._trimBufferThenGetEvents(),i=this.scheduler,a=n.length;if(this.closed)throw new u.a;if(this.isStopped||this.hasError?t=o.a.EMPTY:(this.observers.push(e),t=new c.a(this,e)),i&&e.add(e=new s.a(e,i)),r)for(var l=0;l<a&&!e.closed;l++)e.next(n[l]);else for(l=0;l<a&&!e.closed;l++)e.next(n[l].value);return this.hasError?e.error(this.thrownError):this.isStopped&&e.complete(),t},t.prototype._getNow=function(){return(this.scheduler||a.a).now()},t.prototype._trimBufferThenGetEvents=function(){for(var e=this._getNow(),t=this._bufferSize,r=this._windowTime,n=this._events,i=n.length,a=0;a<i&&!(e-n[a].time<r);)a++;return i>t&&(a=Math.max(a,i-t)),a>0&&n.splice(0,a),n},t}(i.a),d=function(){return function(e,t){this.time=e,this.value=t}}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(45),i=r(148),a=r(143);function o(e){return new n.a((function(t){var r;try{r=e()}catch(e){return void t.error(e)}return(r?Object(i.a)(r):Object(a.b)()).subscribe(t)}))}},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return l}));var n=r(20),i=r(235),a=r(104),o=r(34),s=r(205),u=r(40);function c(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=e[e.length-1];return"function"==typeof r&&e.pop(),Object(i.a)(e,void 0).lift(new l(r))}var l=function(){function e(e){this.resultSelector=e}return e.prototype.call=function(e,t){return t.subscribe(new d(e,this.resultSelector))},e}(),d=function(e){function t(t,r,n){void 0===n&&(n=Object.create(null));var i=e.call(this,t)||this;return i.resultSelector=r,i.iterators=[],i.active=0,i.resultSelector="function"==typeof r?r:void 0,i}return n.a(t,e),t.prototype._next=function(e){var t=this.iterators;Object(a.a)(e)?t.push(new p(e)):"function"==typeof e[s.a]?t.push(new f(e[s.a]())):t.push(new m(this.destination,this,e))},t.prototype._complete=function(){var e=this.iterators,t=e.length;if(this.unsubscribe(),0!==t){this.active=t;for(var r=0;r<t;r++){var n=e[r];if(n.stillUnsubscribed)this.destination.add(n.subscribe());else this.active--}}else this.destination.complete()},t.prototype.notifyInactive=function(){this.active--,0===this.active&&this.destination.complete()},t.prototype.checkIterators=function(){for(var e=this.iterators,t=e.length,r=this.destination,n=0;n<t;n++){if("function"==typeof(o=e[n]).hasValue&&!o.hasValue())return}var i=!1,a=[];for(n=0;n<t;n++){var o,s=(o=e[n]).next();if(o.hasCompleted()&&(i=!0),s.done)return void r.complete();a.push(s.value)}this.resultSelector?this._tryresultSelector(a):r.next(a),i&&r.complete()},t.prototype._tryresultSelector=function(e){var t;try{t=this.resultSelector.apply(this,e)}catch(e){return void this.destination.error(e)}this.destination.next(t)},t}(o.a),f=function(){function e(e){this.iterator=e,this.nextResult=e.next()}return e.prototype.hasValue=function(){return!0},e.prototype.next=function(){var e=this.nextResult;return this.nextResult=this.iterator.next(),e},e.prototype.hasCompleted=function(){var e=this.nextResult;return Boolean(e&&e.done)},e}(),p=function(){function e(e){this.array=e,this.index=0,this.length=0,this.length=e.length}return e.prototype[s.a]=function(){return this},e.prototype.next=function(e){var t=this.index++,r=this.array;return t<this.length?{value:r[t],done:!1}:{value:null,done:!0}},e.prototype.hasValue=function(){return this.array.length>this.index},e.prototype.hasCompleted=function(){return this.array.length===this.index},e}(),m=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.parent=r,i.observable=n,i.stillUnsubscribed=!0,i.buffer=[],i.isComplete=!1,i}return n.a(t,e),t.prototype[s.a]=function(){return this},t.prototype.next=function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}},t.prototype.hasValue=function(){return this.buffer.length>0},t.prototype.hasCompleted=function(){return 0===this.buffer.length&&this.isComplete},t.prototype.notifyComplete=function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()},t.prototype.notifyNext=function(e){this.buffer.push(e),this.parent.checkIterators()},t.prototype.subscribe=function(){return Object(u.c)(this.observable,new u.a(this))},t}(u.b)},function(e,t,r){"use strict";r.r(t),r.d(t,"InitVolumeStreaming",(function(){return O})),r.d(t,"BoxifyVolumeStreaming",(function(){return w})),r.d(t,"CreateVolumeStreamingInfo",(function(){return j})),r.d(t,"CreateVolumeStreamingBehavior",(function(){return P})),r.d(t,"VolumeStreamingVisual",(function(){return E}));var n,i=r(0),a=r(8),o=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(i.__extends)(t,e),t}(a.a.Create({name:"Volume Streaming",typeClass:"Object"}));!function(e){!function(e){e.Float32="float32",e.Int8="int8"}(e.ValueType||(e.ValueType={}))}(n||(n={}));var s=r(2),u=r(17),c=r(267),l=r(36),d=r(13),f=r(277),p=r(164),m=r(206),h=r(390),g=r(94),v=r(9),b=r(1),y=r(78),_=r(4),S=r(273);function x(e,t,r,n){e.push({source:"em"===t?{name:"em",params:{isoValue:l.b.IsoValue.absolute(n||0)}}:{name:"x-ray",params:{}},dataId:r})}var O=d.StateAction.build({display:{name:"Volume Streaming"},from:a.a.Molecule.Structure,params:function(e,t){var r=Object(f.e)(e&&e.data),n=Object(f.d)(r,e&&e.data);return{method:s.ParamDefinition.Select(r,[["em","EM"],["x-ray","X-Ray"]]),entries:s.ParamDefinition.ObjectList({id:s.ParamDefinition.Text(n[0]||"")},(function(e){return e.id}),{defaultValue:n.map((function(e){return{id:e}}))}),defaultView:s.ParamDefinition.Select("em"===r?"cell":"selection-box",p.a.ViewTypeOptions),options:s.ParamDefinition.Group({serverUrl:s.ParamDefinition.Text(t.config.get(y.PluginConfig.VolumeStreaming.DefaultServer)||"https://ds.litemol.org"),behaviorRef:s.ParamDefinition.Text("",{isHidden:!0}),emContourProvider:s.ParamDefinition.Select("emdb",[["emdb","EMDB"],["pdbe","PDBe"]],{isHidden:!0}),channelParams:s.ParamDefinition.Value({},{isHidden:!0})})}},isApplicable:function(e,t,r){var n=r.config.get(y.PluginConfig.VolumeStreaming.CanStream);return n?n(e.data,r):1===e.data.models.length&&_.Model.probablyHasDensityMap(e.data.models[0])}})((function(e,t){var r=e.ref,n=e.state,a=e.params;return u.b.create("Volume Streaming",(function(e){return Object(i.__awaiter)(void 0,void 0,void 0,(function(){var o,u,c,l,d,m,h,g,v,b,y,_,S,O,w,C,A;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:o=[],u=0,c=a.entries.length,i.label=1;case 1:return u<c?(l=a.entries[u].id.toLowerCase(),d=void 0,"em"!==a.method?[3,14]:l.toUpperCase().startsWith("EMD")?[3,11]:[4,e.update("Getting EMDB info...")]):[3,16];case 2:return i.sent(),[4,Object(f.c)(t,e,l)];case 3:m=i.sent(),h=0,g=m.length,i.label=4;case 4:if(!(h<g))return[3,10];v=m[h],b=void 0,i.label=5;case 5:return i.trys.push([5,7,,8]),[4,Object(f.a)(a.options.emContourProvider,t,e,v)];case 6:return b=i.sent(),[3,8];case 7:return y=i.sent(),console.info("Could not get map info for "+v+": "+y),[3,9];case 8:x(o,a.method,v,b||0),i.label=9;case 9:return++h,[3,4];case 10:return[3,15];case 11:return i.trys.push([11,13,,14]),[4,Object(f.a)(a.options.emContourProvider,t,e,l)];case 12:return d=i.sent(),[3,14];case 13:return _=i.sent(),console.info("Could not get map info for "+l+": "+_),[3,15];case 14:x(o,a.method,l,d||0),i.label=15;case 15:return++u,[3,1];case 16:return[4,(S=n.build().to(r).applyOrUpdateTagged(p.a.RootTag,j,{serverUrl:a.options.serverUrl,entries:o})).commit()];case 17:return i.sent(),(O=S.selector).isOk?(null==(w=n.tree.children.get(O.ref))?void 0:w.size)>0?[4,t.managers.structure.hierarchy.remove(null==w?void 0:w.toArray())]:[3,19]:[2];case 18:i.sent(),i.label=19;case 19:return C=O.cell.obj,A=n.build().to(S.ref).apply(P,s.ParamDefinition.getDefaultValues(p.a.createParams({data:C.data,defaultView:a.defaultView,channelParams:a.options.channelParams})),{ref:a.options.behaviorRef?a.options.behaviorRef:void 0}),"em"===a.method?A.apply(E,{channel:"em"},{state:{isGhost:!0},tags:"em"}):(A.apply(E,{channel:"2fo-fc"},{state:{isGhost:!0},tags:"2fo-fc"}),A.apply(E,{channel:"fo-fc(+ve)"},{state:{isGhost:!0},tags:"fo-fc(+ve)"}),A.apply(E,{channel:"fo-fc(-ve)"},{state:{isGhost:!0},tags:"fo-fc(-ve)"})),[4,n.updateTree(A).runInContext(e)];case 20:return i.sent(),[2]}}))}))}))})),w=d.StateAction.build({display:{name:"Boxify Volume Streaming",description:"Make the current box permanent."},from:p.a,isApplicable:function(e){return"selection-box"===e.data.params.entry.params.view.name}})((function(e,t){var r=e.a,n=e.ref,a=e.state,o=r.data.params;if("selection-box"===o.entry.params.view.name){var s=v.b.create(b.Vec3.clone(o.entry.params.view.params.bottomLeft),b.Vec3.clone(o.entry.params.view.params.topRight)),u=o.entry.params.view.params.radius;v.b.expand(s,s,b.Vec3.create(u,u,u));var c=Object(i.__assign)(Object(i.__assign)({},o),{entry:{name:o.entry.name,params:Object(i.__assign)(Object(i.__assign)({},o.entry.params),{view:{name:"box",params:{bottomLeft:s.min,topRight:s.max}}})}});return a.updateTree(a.build().to(n).update(c))}})),C={dataId:s.ParamDefinition.Text(""),source:s.ParamDefinition.MappedStatic("x-ray",{em:s.ParamDefinition.Group({isoValue:l.b.createIsoValueParam(l.b.IsoValue.relative(1))}),"x-ray":s.ParamDefinition.Group({})})},j=a.b.BuiltIn({name:"create-volume-streaming-info",display:{name:"Volume Streaming Info"},from:a.a.Molecule.Structure,to:o,params:function(e){return{serverUrl:s.ParamDefinition.Text("https://ds.litemol.org"),entries:s.ParamDefinition.ObjectList(C,(function(e){return e.dataId}),{defaultValue:[{dataId:"",source:{name:"x-ray",params:{}}}]})}}})({apply:function(e,t){var r=e.a,n=e.params;return u.b.create("",(function(e){return Object(i.__awaiter)(void 0,void 0,void 0,(function(){var a,s,u,d,f,p,m,h;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:a=[],s=0,u=n.entries.length,i.label=1;case 1:return s<u?(d=n.entries[s],f=d.dataId,p="em"===d.source.name?d.source.params.isoValue:l.b.IsoValue.relative(1),[4,e.update("Getting server header...")]):[3,5];case 2:return i.sent(),[4,t.fetch({url:Object(c.a)(n.serverUrl,d.source.name+"/"+f.toLocaleLowerCase()),type:"json"}).runInContext(e)];case 3:m=i.sent(),a.push({dataId:f,kind:d.source.name,header:m,emDefaultContourLevel:p}),i.label=4;case 4:return++s,[3,1];case 5:return h={serverUrl:n.serverUrl,entries:a,structure:r.data},[2,new o(h,{label:"Volume Server",description:""+a.map((function(e){return e.dataId})).join(", ")})]}}))}))}))}}),P=a.b.BuiltIn({name:"create-volume-streaming-behavior",display:{name:"Volume Streaming Behavior"},from:o,to:p.a,params:function(e){return p.a.createParams({data:e&&e.data})}})({canAutoUpdate:function(e){var t=e.oldParams,r=e.newParams;return t.entry.params.view===r.entry.params.view||"selection-box"===r.entry.params.view.name||"off"===r.entry.params.view.name},apply:function(e,t){var r=e.a,n=e.params;return u.b.create("Volume streaming",(function(e){return Object(i.__awaiter)(void 0,void 0,void 0,(function(){var e;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return[4,(e=new p.a.Behavior(t,r.data)).update(n)];case 1:return i.sent(),[2,new p.a(e,{label:"Volume Streaming",description:e.getDescription()})]}}))}))}))},update:function(e){var t=this,r=(e.a,e.b),n=e.oldParams,a=e.newParams;return u.b.create("Update Volume Streaming",(function(e){return Object(i.__awaiter)(t,void 0,void 0,(function(){var e,t;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return n.entry.name!==a.entry.name&&"em"in a.entry.params.channels&&(e=r.data.infoMap.get(a.entry.name).emDefaultContourLevel)&&(a.entry.params.channels.em.isoValue=e),[4,r.data.update(a)];case 1:return t=i.sent()?d.StateTransformer.UpdateResult.Updated:d.StateTransformer.UpdateResult.Unchanged,r.description=r.data.getDescription(),[2,t]}}))}))}))}}),E=a.b.BuiltIn({name:"create-volume-streaming-visual",display:{name:"Volume Streaming Visual"},from:p.a,to:a.a.Volume.Representation3D,params:{channel:s.ParamDefinition.Select("em",p.a.ChannelTypeOptions,{isHidden:!0})}})({apply:function(e,t){var r=e.a,n=e.params,o=e.spine;return u.b.create("Volume Representation",(function(e){return Object(i.__awaiter)(void 0,void 0,void 0,(function(){var s,u,c,l,f,p,m,v,b;return Object(i.__generator)(this,(function(y){switch(y.label){case 0:return(s=r.data.channels[n.channel])?(u=A(r.data,n.channel),c=h.a.BuiltIn.isosurface,l=u.type.params||{},(f=c.factory(Object(i.__assign)({webgl:null===(v=t.canvas3d)||void 0===v?void 0:v.webgl},t.representation.volume.themes),c.getParams)).setTheme(g.a.create(t.representation.volume.themes,{volume:s.data},u)),p=null===(b=o.getAncestorOfType(a.a.Molecule.Structure))||void 0===b?void 0:b.data,m=0===(null==p?void 0:p.models.length)?void 0:S.a.get(null==p?void 0:p.models[0]),[4,f.createOrUpdate(l,s.data).runInContext(e)]):[2,d.StateObject.Null];case 1:return y.sent(),m&&f.setState({transform:m}),[2,new a.a.Volume.Representation3D({repr:f,source:r},{label:Math.round(100*s.isoValue.relativeValue)/100+" σ ["+n.channel+"]"})]}}))}))}))},update:function(e,t){var r=e.a,n=e.b,a=e.newParams;e.spine;return u.b.create("Volume Representation",(function(e){return Object(i.__awaiter)(void 0,void 0,void 0,(function(){var o,s,u;return Object(i.__generator)(this,(function(c){switch(c.label){case 0:return(o=r.data.channels[a.channel])?(s=A(r.data,a.channel),u=Object(i.__assign)(Object(i.__assign)({},n.data.repr.props),s.type.params),n.data.repr.setTheme(g.a.create(t.representation.volume.themes,{volume:o.data},s)),[4,n.data.repr.createOrUpdate(u,o.data).runInContext(e)]):[2,d.StateTransformer.UpdateResult.Unchanged];case 1:return c.sent(),[2,d.StateTransformer.UpdateResult.Updated]}}))}))}))}});function A(e,t){var r=e.channels[t];return m.VolumeRepresentation3DHelpers.getDefaultParamsStatic(e.plugin,"isosurface",{isoValue:r.isoValue,alpha:r.opacity,visuals:r.wireframe?["wireframe"]:["solid"]},"uniform",{value:r.color})}},function(e,t,r){"use strict";function n(e){return null!==e&&"object"==typeof e}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(34);function i(e){for(;e;){var t=e,r=t.closed,i=t.destination,a=t.isStopped;if(r||a)return!1;e=i&&i instanceof n.a?i:null}return!0}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(84);!function(e){var t=function(){function e(e){this.cells=e,this._current=void 0}return Object.defineProperty(e.prototype,"current",{get:function(){return this._current},set:function(e){this._current=e},enumerable:!1,configurable:!0}),e.prototype.getAncestorOfType=function(e){if(this._current)for(var t=this._current;;){if(!(t=this.cells.get(t.transform.parent)).obj)return;if(t.obj.type===e.type)return t.obj;if(t.transform.ref===i.a.RootRef)return}},e.prototype.getRootOfType=function(e){if(this._current)for(var t=this._current,r=void 0;;){if(!t.obj)return;if(t.obj.type===e.type&&(r=t),t.transform.ref===i.a.RootRef)return r?r.obj:void 0;t=this.cells.get(t.transform.parent)}},e}();e.Impl=t,e.getDecoratorChain=function(e,t){for(var r=e.cells,n=r.get(t),i=[n];null==n?void 0:n.transform.transformer.definition.isDecorator;)n=r.get(n.transform.parent),i.push(n);return i},e.getRootOfType=function(e,t,r){var n=void 0,a=e.cells.get(r);if(a)for(;;){if(!a.obj)return;if(a.obj.type===t.type&&(n=a),a.transform.ref===i.a.RootRef)return n?n.obj:void 0;a=e.cells.get(a.transform.parent)}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(17),o=r(9),s=r(1),u=r(66);function c(e,t){var r=this;return a.b.create("Create Volume",(function(a){return Object(i.__awaiter)(r,void 0,void 0,(function(){var r,a,c,l,d,f,p,m,h,g;return Object(i.__generator)(this,(function(i){return r=e.volume_data_3d_info,a=e.volume_data_3d,c=o.f.create(r.spacegroup_number.value(0),s.Vec3.ofArray(r.spacegroup_cell_size.value(0)),s.Vec3.scale(s.Vec3.zero(),s.Vec3.ofArray(r.spacegroup_cell_angles.value(0)),Math.PI/180)),l=r.axis_order.value(0),d=s.Tensor.convertToCanonicalAxisIndicesFastToSlow(l),f=d(r.sample_count.value(0)),p=s.Tensor.Space(f,s.Tensor.invertAxisOrder(l),Float32Array),m=s.Tensor.create(p,s.Tensor.Data1(a.values.toArray({array:Float32Array}))),h=s.Vec3.ofArray(d(r.origin.value(0))),g=s.Vec3.ofArray(d(r.dimensions.value(0))),[2,{label:null==t?void 0:t.label,entryId:null==t?void 0:t.entryId,grid:{transform:{kind:"spacegroup",cell:c,fractionalBox:o.b.create(h,s.Vec3.add(s.Vec3.zero(),h,g))},cells:m,stats:{min:r.min_sampled.value(0),max:r.max_sampled.value(0),mean:r.mean_sampled.value(0),sigma:r.sigma_sampled.value(0)}},sourceData:n.create(e),customProperties:new u.CustomProperties,_propertyData:Object.create(null)}]}))}))}))}!function(e){e.is=function(e){return"dscif"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"dscif",name:e._name,data:e}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return s})),r.d(t,"e",(function(){return u})),r.d(t,"d",(function(){return c})),r.d(t,"b",(function(){return n})),r.d(t,"a",(function(){return i}));var n,i,a=r(7),o=r(59),s={type_symbol:a.a.Schema.Aliased(o.a.atom_site.type_symbol),label_atom_id:o.a.atom_site.label_atom_id,auth_atom_id:o.a.atom_site.auth_atom_id,label_alt_id:o.a.atom_site.label_alt_id,label_comp_id:o.a.atom_site.label_comp_id,auth_comp_id:o.a.atom_site.auth_comp_id,pdbx_formal_charge:o.a.atom_site.pdbx_formal_charge},u={group_PDB:o.a.atom_site.group_PDB,label_seq_id:o.a.atom_site.label_seq_id,auth_seq_id:o.a.atom_site.auth_seq_id,pdbx_PDB_ins_code:o.a.atom_site.pdbx_PDB_ins_code},c={label_asym_id:o.a.atom_site.label_asym_id,auth_asym_id:o.a.atom_site.auth_asym_id,label_entity_id:o.a.atom_site.label_entity_id};!function(e){e.EmptyResidueKey=function(){return{label_entity_id:"",label_asym_id:"",auth_seq_id:0,pdbx_PDB_ins_code:void 0}}}(n||(n={})),function(e){function t(e,t){return e.residueAtomSegments.index[e.chainAtomSegments.offsets[t]]}function r(e,t){return e.residueAtomSegments.index[e.chainAtomSegments.offsets[t+1]-1]+1}e.chainStartResidueIndex=t,e.chainEndResidueIndexExcl=r,e.chainResidueCount=function(e,n){return r(e,n)-t(e,n)}}(i||(i={}))},function(e,t,r){"use strict";r.d(t,"c",(function(){return n})),r.d(t,"d",(function(){return o})),r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return u}));var n={H:1,D:1,T:1,HE:2,LI:3,BE:4,B:5,C:6,N:7,O:8,F:9,NE:10,NA:11,MG:12,AL:13,SI:14,P:15,S:16,CL:17,AR:18,K:19,CA:20,SC:21,TI:22,V:23,CR:24,MN:25,FE:26,CO:27,NI:28,CU:29,ZN:30,GA:31,GE:32,AS:33,SE:34,BR:35,KR:36,RB:37,SR:38,Y:39,ZR:40,NB:41,MO:42,TC:43,RU:44,RH:45,PD:46,AG:47,CD:48,IN:49,SN:50,SB:51,TE:52,I:53,XE:54,CS:55,BA:56,LA:57,CE:58,PR:59,ND:60,PM:61,SM:62,EU:63,GD:64,TB:65,DY:66,HO:67,ER:68,TM:69,YB:70,LU:71,HF:72,TA:73,W:74,RE:75,OS:76,IR:77,PT:78,AU:79,HG:80,TL:81,PB:82,BI:83,PO:84,AT:85,RN:86,FR:87,RA:88,AC:89,TH:90,PA:91,U:92,NP:93,PU:94,AM:95,CM:96,BK:97,CF:98,ES:99,FM:100,MD:101,NO:102,LR:103,RF:104,DB:105,SG:106,BH:107,HS:108,MT:109},i={1:1.1,2:1.4,3:1.81,4:1.53,5:1.92,6:1.7,7:1.55,8:1.52,9:1.47,10:1.54,11:2.27,12:1.73,13:1.84,14:2.1,15:1.8,16:1.8,17:1.75,18:1.88,19:2.75,20:2.31,21:2.3,22:2.15,23:2.05,24:2.05,25:2.05,26:2.05,27:2,28:2,29:2,30:2.1,31:1.87,32:2.11,33:1.85,34:1.9,35:1.83,36:2.02,37:3.03,38:2.49,39:2.4,40:2.3,41:2.15,42:2.1,43:2.05,44:2.05,45:2,46:2.05,47:2.1,48:2.2,49:2.2,50:1.93,51:2.17,52:2.06,53:1.98,54:2.16,55:3.43,56:2.68,57:2.5,58:2.48,59:2.47,60:2.45,61:2.43,62:2.42,63:2.4,64:2.38,65:2.37,66:2.35,67:2.33,68:2.32,69:2.3,70:2.28,71:2.27,72:2.25,73:2.2,74:2.1,75:2.05,76:2,77:2,78:2.05,79:2.1,80:2.05,81:1.96,82:2.02,83:2.07,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:2.4,91:2,92:2.3,93:2,94:2,95:2,96:2,97:2,98:2,99:2,100:2,101:2,102:2,103:2,104:2,105:2,106:2,107:2,108:2,109:2},a={1:1.008,2:4.0026,3:6.94,4:9.0122,5:10.81,6:10.81,7:14.007,8:15.999,9:18.998,10:20.18,11:22.99,12:24.305,13:26.982,14:28.085,15:30.974,16:32.06,17:35.45,18:39.948,19:39.098,20:40.078,21:44.956,22:47.867,23:50.942,24:51.996,25:54.938,26:55.845,27:58.933,28:58.693,29:63.546,30:65.38,31:69.723,32:72.63,33:74.922,34:78.971,35:79.904,36:83.798,37:85.468,38:87.62,39:88.906,40:91.224,41:92.906,42:95.95,43:96.906,44:101.07,45:102.91,46:106.42,47:107.87,48:112.41,49:114.82,50:118.71,51:121.76,52:127.6,53:127.6,54:131.29,55:132.91,56:137.33,57:138.91,58:140.12,59:140.91,60:144.24,61:144.912,62:150.36,63:151.96,64:157.25,65:158.93,66:162.5,67:164.93,68:167.26,69:168.93,70:173.05,71:174.97,72:178.49,73:180.95,74:183.84,75:186.21,76:190.23,77:192.22,78:195.08,79:196.97,80:200.59,81:204.38,82:207.2,83:208.98,84:1.97,85:2.02,86:2.2,87:3.48,88:2.83,89:2,90:232.04,91:231.04,92:238.03,93:237.048,94:244.064,95:243.061,96:247.07,97:247.07,98:251.079,99:252.083,100:257.095,101:258.098,102:259.101,103:262.11,104:267.122,105:270.131,106:271.134,107:270.133,108:270.134,109:278.156};function o(e){var t=n[e];return void 0===t?1.7:i[t]}function s(e){var t=n[e];return void 0===t?10.81:a[t]}function u(e){var t=n[e];return void 0===t?0:t}},function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return s}));var n=r(22),i=new Map([["HIS|CD2|CG",2],["HIS|CE1|ND1",2],["ARG|CZ|NH2",2],["PHE|CE1|CZ",2],["PHE|CD2|CE2",2],["PHE|CD1|CG",2],["TRP|CD1|CG",2],["TRP|CD2|CE2",2],["TRP|CE3|CZ3",2],["TRP|CH2|CZ2",2],["ASN|CG|OD1",2],["GLN|CD|OE1",2],["TYR|CD1|CG",2],["TYR|CD2|CE2",2],["TYR|CE1|CZ",2],["ASP|CG|OD1",2],["GLU|CD|OE1",2],["G|C8|N7",2],["G|C4|C5",2],["G|C2|N3",2],["G|C6|O6",2],["C|C4|N3",2],["C|C5|C6",2],["C|C2|O2",2],["A|C2|N3",2],["A|C6|N1",2],["A|C4|C5",2],["A|C8|N7",2],["U|C5|C6",2],["U|C2|O2",2],["U|C4|O4",2],["DG|C8|N7",2],["DG|C4|C5",2],["DG|C2|N3",2],["DG|C6|O6",2],["DC|C4|N3",2],["DC|C5|C6",2],["DC|C2|O2",2],["DA|C2|N3",2],["DA|C6|N1",2],["DA|C4|C5",2],["DA|C8|N7",2],["DT|C5|C6",2],["DT|C2|O2",2],["DT|C4|O4",2]]);function a(e,t,r){var a;return t=(a=t<r?[t,r]:[r,t])[0],r=a[1],n.AminoAcidNames.has(e)&&"C"===t&&"O"===r||n.BaseNames.has(e)&&"OP1"===t&&"P"===r?2:i.get(e+"|"+t+"|"+r)||1}var o=new Map([["LYS|NZ|RET|C15",2]]);function s(e,t,r,n){var i,a;return e>r&&(e=(i=[r,e])[0],r=i[1],t=(a=[n,t])[0],n=a[1]),o.get(e+"|"+t+"|"+r+"|"+n)||1}},function(e,t,r){"use strict";r.r(t),r.d(t,"CustomModelProperty",(function(){return n}));var n,i=r(0),a=r(2),o=r(5),s=r(66),u=r(42);!function(e){function t(e){var t=this,r=e.descriptor.name,n="static"===e.type?"_staticPropertyData":"_dynamicPropertyData",s=function(t){return r in t[n]||(t[n][r]={props:Object(i.__assign)({},a.ParamDefinition.getDefaultValues(e.getParams(t))),data:o.d.create(void 0)}),t[n][r]},u=function(e,t,i){var a=s(e);e[n][r]={props:t,data:o.d.withValue(a.data,i)}};return{label:e.label,descriptor:e.descriptor,isHidden:e.isHidden,getParams:function(t){var r=a.ParamDefinition.clone(e.getParams(t));return a.ParamDefinition.setDefaultValues(r,s(t).props),r},defaultParams:e.defaultParams,isApplicable:e.isApplicable,attach:function(r,n,o,c){return void 0===o&&(o={}),Object(i.__awaiter)(t,void 0,void 0,(function(){var t,l,d,f,p;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:return c&&n.customProperties.reference(e.descriptor,!0),t=s(n),l=a.ParamDefinition.merge(e.defaultParams,t.props,o),t.data.value&&a.ParamDefinition.areEqual(e.defaultParams,t.props,l)?[2]:[4,e.obtain(r,n,l)];case 1:return d=i.sent(),f=d.value,p=d.assets,n.customProperties.add(e.descriptor),n.customProperties.assets(e.descriptor,p),u(n,l,f),[2]}}))}))},ref:function(t,r){return t.customProperties.reference(e.descriptor,r)},get:function(e){var t;return null===(t=s(e))||void 0===t?void 0:t.data},set:function(t,r){void 0===r&&(r={});var n=s(t),i=a.ParamDefinition.merge(e.defaultParams,n.props,r);a.ParamDefinition.areEqual(e.defaultParams,n.props,i)||(u(t,i,void 0),t.customProperties.assets(e.descriptor))},props:function(e){return s(e).props}}}e.createProvider=t,e.createSimple=function(e,r,n){var o=this,c={value:a.ParamDefinition.Value(n,{isHidden:!0})};return t({label:Object(u.d)(e),descriptor:Object(s.CustomPropertyDescriptor)({name:e}),isHidden:!0,type:r,defaultParams:c,getParams:function(){return{value:a.ParamDefinition.Value(n,{isHidden:!0})}},isApplicable:function(){return!0},obtain:function(e,t,r){return Object(i.__awaiter)(o,void 0,void 0,(function(){var e;return Object(i.__generator)(this,(function(t){return[2,{value:null!==(e=r.value)&&void 0!==e?e:n}]}))}))}})}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(1),i=r(35),a=r(82),o=n.Mat4.identity(),s=Object(n.Vec3)();function u(e,t,r,u,c,l){i.a.addPrimitive(e,function(e,t,r,i,a){return n.Vec3.add(s,t,r),n.Mat4.targetTo(e,t,s,i),n.Mat4.setTranslation(e,t),n.Mat4.scale(e,e,a)}(o,t,r,u,c),Object(a.b)(l))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(0),i=r(27),a=r(154),o=r(294),s=r(2),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._getInfo=Object(a.b)((function(e,r){return o.a.infoFromAction(t.plugin,t.props.state,t.props.action,t.props.nodeRef)})),t.state={plugin:t.plugin,ref:t.props.nodeRef,version:t.props.state.transforms.get(t.props.nodeRef).version,error:void 0,isInitial:!0,params:t.getInfo().initialValues,busy:!1,isCollapsed:t.props.initiallyCollapsed},t}return Object(n.__extends)(t,e),t.prototype.applyAction=function(){return i.PluginCommands.State.ApplyAction(this.plugin,{state:this.props.state,action:this.props.action.create(this.state.params),ref:this.props.nodeRef})},t.prototype.getInfo=function(){return this._getInfo(this.props.nodeRef,this.props.state.transforms.get(this.props.nodeRef).version)},t.prototype.getTransformerId=function(){return this.props.state.transforms.get(this.props.nodeRef).transformer.id},t.prototype.getHeader=function(){return this.props.hideHeader?"none":this.props.action.definition.display},t.prototype.canApply=function(){return!this.state.error&&!this.state.busy},t.prototype.canAutoApply=function(){return!1},t.prototype.applyText=function(){return"Apply"},t.prototype.isUpdate=function(){return!1},t.prototype.getSourceAndTarget=function(){return{a:this.props.state.cells.get(this.props.nodeRef).obj}},t.getDerivedStateFromProps=function(e,t){var r=e.state.transforms.get(e.nodeRef).version;if(e.nodeRef===t.ref&&r===t.version)return null;var n=e.state.cells.get(e.nodeRef).obj,i=e.action.definition.params?s.ParamDefinition.getDefaultValues(e.action.definition.params(n,t.plugin)):{};return{plugin:t.plugin,ref:e.nodeRef,version:r,params:i,isInitial:!0,error:void 0}},t}(o.b)},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(45),i=r(76);function a(e,t){return new n.a((function(r){var n=new i.a,a=0;return n.add(t.schedule((function(){a!==e.length?(r.next(e[a++]),r.closed||n.add(this.schedule())):r.complete()}))),n}))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=new(function(){function e(){this.shouldUpdate=!1,this.isSynchronous=!0}return e.prototype.update=function(e,t){},e}())},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(182),i=r(261),a={closed:!0,next:function(e){},error:function(e){if(n.a.useDeprecatedSynchronousErrorHandling)throw e;Object(i.a)(e)},complete:function(){}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return p}));var n=new ArrayBuffer(4);new Int32Array(n),new Float32Array(n);var i=new ArrayBuffer(4),a=new Int32Array(i),o=new Float32Array(i);function s(e){return function(e){var t=e<-126?-126:e;return a[0]=(1<<23)*(t+126.94269504),o[0]}(1.44269504*e)}var u=new ArrayBuffer(8);new Int32Array(u),new Float32Array(u);var c=new ArrayBuffer(4),l=new Int32Array(c),d=new Float32Array(c);function f(e){return d[0]=e,1.1920928955078125e-7*l[0]-126.94269504}function p(e){return.6931471805599453*f(e)}Math.PI,Math.PI,Math.PI,Math.PI,Math.PI,Math.PI,Math.PI,Math.PI,Math.PI;var m=new ArrayBuffer(16);new Int32Array(m),new Float32Array(m);var h=new ArrayBuffer(8);new Int32Array(h),new Float32Array(h);var g=new ArrayBuffer(4);new Int32Array(g),new Float32Array(g);Math.PI},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i}));var n="1.3.2",i=new Date(1623933361953)},function(e,t,r){"use strict";r.r(t),r.d(t,"CoordinatesFromDcd",(function(){return vt})),r.d(t,"CoordinatesFromXtc",(function(){return bt})),r.d(t,"TopologyFromPsf",(function(){return yt})),r.d(t,"TrajectoryFromModelAndCoordinates",(function(){return St})),r.d(t,"TrajectoryFromBlob",(function(){return xt})),r.d(t,"TrajectoryFromMmCif",(function(){return wt})),r.d(t,"TrajectoryFromPDB",(function(){return Ct})),r.d(t,"TrajectoryFromGRO",(function(){return jt})),r.d(t,"TrajectoryFromMOL",(function(){return Pt})),r.d(t,"TrajectoryFromMOL2",(function(){return Et})),r.d(t,"TrajectoryFromCube",(function(){return At})),r.d(t,"TrajectoryFromCifCore",(function(){return Dt})),r.d(t,"ModelFromTrajectory",(function(){return Mt})),r.d(t,"StructureFromTrajectory",(function(){return kt})),r.d(t,"StructureFromModel",(function(){return Bt})),r.d(t,"TransformStructureConformation",(function(){return Nt})),r.d(t,"StructureSelectionFromExpression",(function(){return Ft})),r.d(t,"MultiStructureSelectionFromExpression",(function(){return Ut})),r.d(t,"StructureSelectionFromScript",(function(){return zt})),r.d(t,"StructureSelectionFromBundle",(function(){return Ht})),r.d(t,"StructureComplexElement",(function(){return Wt})),r.d(t,"StructureComponent",(function(){return Xt})),r.d(t,"CustomModelProperties",(function(){return Yt})),r.d(t,"CustomStructureProperties",(function(){return Kt})),r.d(t,"ShapeFromPly",(function(){return Jt})),r.d(t,"StructureComplexElementTypes",(function(){return Gt}));var n=r(0),i=r(83),a=r(17),o=r(331);function s(e){var t=this;return a.b.create("Parse DCD",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(r){try{return t=function(e){var t=new DataView(e.buffer),r=Object.create(null),n=[],i=0,a=new Int32Array(e.buffer,0,23),s=a[0]!==t.getInt32(0);if(84!==a[0])for(var u=e.byteLength,c=0;c<u;c+=4)t.setFloat32(c,t.getFloat32(c),!0);if(84!==a[0])throw new Error("dcd bad format, header block start");if("CORD"!==String.fromCharCode(t.getUint8(4),t.getUint8(5),t.getUint8(6),t.getUint8(7)))throw new Error("dcd bad format, format string");var l=!1,d=!1,f=!1;if(0!==a[22]&&(l=!0,0!==a[12]&&(d=!0),1===a[13]&&(f=!0)),r.NSET=a[2],r.ISTART=a[3],r.NSAVC=a[4],r.NAMNF=a[10],r.DELTA=l?t.getFloat32(44,s):t.getFloat64(44,s),84!==a[22])throw new Error("dcd bad format, header block end");i=i+84+8;var p=t.getInt32(i,s),m=i+1;if((p-4)%80!=0)throw new Error("dcd bad format, title block start");if(r.TITLE=Object(o.c)(e.subarray(m,p)),t.getInt32(m+p+4-1,s)!==p)throw new Error("dcd bad format, title block end");if(i=i+p+8,4!==t.getInt32(i,s))throw new Error("dcd bad format, natom block start");if(r.NATOM=t.getInt32(i+4,s),4!==t.getInt32(i+8,s))throw new Error("dcd bad format, natom block end");if(i=i+4+8,r.NAMNF>0)throw new Error("dcd format with fixed atoms unsupported, aborting");var h=r.NATOM,g=4*h;for(c=0,u=r.NSET;c<u;++c){var v=Object.create(null);v.elementCount=h,d&&(i+=4,v.cell=[t.getFloat64(i,s),t.getFloat64(i+1,s),t.getFloat64(i+16,s),t.getFloat64(i+24,s),t.getFloat64(i+32,s),t.getFloat64(i+40,s)],i+=48,i+=4);for(var b=0;b<3;++b){if(t.getInt32(i,s)!==g)throw new Error("dcd bad format, coord block start: "+c+", "+b);i+=4;var y=new Float32Array(e.buffer,i,h);if(0===b?v.x=y:1===b?v.y=y:v.z=y,i+=g,t.getInt32(i,s)!==g)throw new Error("dcd bad format, coord block end: "+c+", "+b);i+=4}if(f)i+=4+t.getInt32(i,s)+4;n.push(v)}return{header:r,frames:n}}(e),[2,i.a.success(t)]}catch(e){return[2,i.a.error(e)]}return[2]}))}))}))}var u=r(7),c=r(21),l=r(101);function d(e){return function(t,r,n){return function(e,t,r,n){var i=e.data,a=e.indices,o=e.count,s=n.valueType,d="str"===s?function(e){var n=a[2*e]+t,o=a[2*e+1];if(n>=o)return"";var s=n+r;return s>o&&(s=o),Object(c.c)(i,n,s)}:"int"===s?function(e){var n=a[2*e]+t;return n>a[2*e+1]?0:Object(l.e)(i,n,n+r)}:function(e){var n=a[2*e]+t;return n>a[2*e+1]?0:Object(l.c)(i,n,n+r)};return{schema:n,__array:void 0,isDefined:!0,rowCount:o,value:d,valueKind:function(e){return 0},toArray:function(e){return u.b.createAndFillArray(o,d,e)},areValuesEqual:function(e,t){return d(e)===d(t)}}}(e,t,r,n)}}function f(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,o,s,l,f,p,m,h;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return t=e.tokenizer,r=e.numberOfAtoms,[4,c.b.readLinesAsync(t,r,e.runtimeCtx,1e5)];case 1:return i=n.sent(),a=t.data.substring(i.indices[0],i.indices[1]).substring(20),o=a.match(/\.\d+/g),s=6===o.length,e.header.hasVelocities=s,e.header.precision.position=o[0].length-1,e.header.precision.velocity=s?o[3].length-1:0,20,l=e.header.precision.position+5,f=20+3*l,p=e.header.precision.velocity+4,m=d(i),h=u.a.Undefined(e.numberOfAtoms,u.a.Schema.float),[2,{count:e.numberOfAtoms,residueNumber:m(0,5,u.a.Schema.int),residueName:m(5,5,u.a.Schema.str),atomName:m(10,5,u.a.Schema.str),atomNumber:m(15,5,u.a.Schema.int),x:m(20,l,u.a.Schema.float),y:m(20+l,l,u.a.Schema.float),z:m(20+2*l,l,u.a.Schema.float),vx:s?m(f,p,u.a.Schema.float):h,vy:s?m(f+p,p,u.a.Schema.float):h,vz:s?m(f+2*p,p,u.a.Schema.float):h}]}}))}))}function p(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,a,o,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=Object(c.b)(e),[4,t.update({message:"Parsing...",current:0,max:e.length})];case 1:n.sent(),a=[],n.label=2;case 2:return r.position<e.length?(function(e){var t=e.tokenizer,r=e.header,n=c.b.readLine(t);0===n.trim().length&&(n=c.b.readLine(t));var i=n.lastIndexOf("t=");i>=0?(r.timeInPs=parseFloat(n.substring(i+2)),r.title=n.substring(0,i).trim(),r.title&&","===r.title[r.title.length-1]&&(r.title=r.title.substring(0,r.title.length-1))):r.title=n}(o=function(e,t){return{tokenizer:e,header:{title:"",timeInPs:0,hasVelocities:!1,precision:{position:0,velocity:0},box:[0,0,0]},numberOfAtoms:0,runtimeCtx:t}}(r,t)),function(e){var t=e.tokenizer;c.b.markLine(t);var r=c.b.getTokenString(t);e.numberOfAtoms=parseInt(r)}(o),[4,f(o)]):[3,4];case 3:return s=n.sent(),function(e){var t=e.tokenizer,r=c.b.readLine(t).trim().split(/\s+/g);e.header.box=[+r[0],+r[1],+r[2]]}(o),a.push({header:o.header,atoms:s}),[3,2];case 4:return u={structures:a},[2,i.a.success(u)]}}))}))}function m(e){var t=this;return a.b.create("Parse GRO",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){return Object(n.__generator)(this,(function(t){switch(t.label){case 0:return[4,p(e,r)];case 1:return[2,t.sent()]}}))}))}))}function h(e,t,r){var o=this;return void 0===r&&(r=!1),a.b.create("Parse PDB",(function(a){return Object(n.__awaiter)(o,void 0,void 0,(function(){var o,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return s=(o=i.a).success,u={},[4,c.b.readAllLinesAsync(e,a)];case 1:return[2,s.apply(o,[(u.lines=n.sent(),u.id=t,u.isPdbqt=r,u)])]}}))}))}))}var g=r(1),v=r(24),b=r(35),y=r(38),_=r(54),S=r(12),x=r(29),O=r(2),w=r(47),C=r(87),j=r(42);function P(e){var t=e&&e.getElement("vertex"),r=e&&e.getElement("material"),i={group:"",vRed:"",vGreen:"",vBlue:"",mRed:"",mGreen:"",mBlue:""},a=[["",""]],o=[["",""]];if(t){for(var s=0,u=t.propertyNames.length;s<u;++s){var c=t.propertyNames[s];"uchar"!==(d=t.propertyTypes[s])&&"uint8"!==d&&"ushort"!==d&&"uint16"!==d&&"uint"!==d&&"uint32"!==d&&"int"!==d||a.push([c,c]),"uchar"!==d&&"uint8"!==d||o.push([c,c])}t.propertyNames.includes("atomid")?i.group="atomid":t.propertyNames.includes("material_index")&&(i.group="material_index"),t.propertyNames.includes("red")&&(i.vRed="red"),t.propertyNames.includes("green")&&(i.vGreen="green"),t.propertyNames.includes("blue")&&(i.vBlue="blue")}var l=[["",""]];if(r){for(s=0,u=r.propertyNames.length;s<u;++s){var d,f=r.propertyNames[s];"uchar"!==(d=r.propertyTypes[s])&&"uint8"!==d||l.push([f,f])}r.propertyNames.includes("red")&&(i.mRed="red"),r.propertyNames.includes("green")&&(i.mGreen="green"),r.propertyNames.includes("blue")&&(i.mBlue="blue")}var p=i.vRed&&i.vGreen&&i.vBlue?"vertex":i.mRed&&i.mGreen&&i.mBlue?"material":"uniform";return Object(n.__assign)(Object(n.__assign)({},y.a.Params),{coloring:O.ParamDefinition.MappedStatic(p,{vertex:O.ParamDefinition.Group({red:O.ParamDefinition.Select(i.vRed,o,{label:"Red Property"}),green:O.ParamDefinition.Select(i.vGreen,o,{label:"Green Property"}),blue:O.ParamDefinition.Select(i.vBlue,o,{label:"Blue Property"})},{isFlat:!0}),material:O.ParamDefinition.Group({red:O.ParamDefinition.Select(i.mRed,l,{label:"Red Property"}),green:O.ParamDefinition.Select(i.mGreen,l,{label:"Green Property"}),blue:O.ParamDefinition.Select(i.mBlue,l,{label:"Blue Property"})},{isFlat:!0}),uniform:O.ParamDefinition.Group({color:O.ParamDefinition.Color(w.a.grey)},{isFlat:!0})}),grouping:O.ParamDefinition.MappedStatic(i.group?"vertex":"none",{vertex:O.ParamDefinition.Group({group:O.ParamDefinition.Select(i.group,a,{label:"Group Property"})},{isFlat:!0}),none:O.ParamDefinition.Group({})})})}var E=P();function A(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var o,s,u,c,l,d,f,p,m,h,g,v;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(o=b.a.createState(t.rowCount,t.rowCount/4,a),s=t.getProperty("x"),u=t.getProperty("y"),c=t.getProperty("z"),!s||!u||!c)throw new Error("missing coordinate properties");l=t.getProperty("nx"),d=t.getProperty("ny"),f=t.getProperty("nz"),p=!!l&&!!d&&!!f,m=1e5,h=0,g=t.rowCount,n.label=1;case 1:return h<g?(function(e,t,r,n,i){var a=r.vertices,o=r.normals,s=r.groups,u=n.getProperty("x"),c=n.getProperty("y"),l=n.getProperty("z");if(!u||!c||!l)throw new Error("missing coordinate properties");for(var d=n.getProperty("nx"),f=n.getProperty("ny"),p=n.getProperty("nz"),m=!!d&&!!f&&!!p,h=e;h<t;++h)S.a.add3(a,u.value(h),c.value(h),l.value(h)),m&&S.a.add3(o,d.value(h),f.value(h),p.value(h)),S.a.add(s,i[h])}(h,Math.min(h+m,g),o,t,i),e.shouldUpdate?[4,e.update({message:"adding ply mesh vertices",current:h,max:g})]:[3,3]):[3,4];case 2:n.sent(),n.label=3;case 3:return h+=m,[3,1];case 4:h=0,g=r.rowCount,n.label=5;case 5:return h<g?(function(e,t,r,n){for(var i=r.indices,a=e;a<t;++a){var o=n.value(a),s=o.entries,u=o.count;3===u?S.a.add3(i,s[0],s[1],s[2]):4===u&&(S.a.add3(i,s[2],s[1],s[0]),S.a.add3(i,s[2],s[0],s[3]))}}(h,Math.min(h+m,g),o,r),e.shouldUpdate?[4,e.update({message:"adding ply mesh faces",current:h,max:g})]:[3,7]):[3,8];case 6:n.sent(),n.label=7;case 7:return h+=m,[3,5];case 8:return v=b.a.getMesh(o),p||y.a.computeNormals(v),[2,v]}}))}))}var D=u.a.Schema.int;function T(e,t,r){var n,i,a,o=r.coloring,s=e.rowCount;if("vertex"===o.name)n=e.getProperty(o.params.red)||u.a.ofConst(127,s,D),i=e.getProperty(o.params.green)||u.a.ofConst(127,s,D),a=e.getProperty(o.params.blue)||u.a.ofConst(127,s,D);else if("material"===o.name)n=t&&t.getProperty(o.params.red)||u.a.ofConst(127,s,D),i=t&&t.getProperty(o.params.green)||u.a.ofConst(127,s,D),a=t&&t.getProperty(o.params.blue)||u.a.ofConst(127,s,D);else{var c=v.Color.toRgb(o.params.color),l=c[0],d=c[1],f=c[2];n=u.a.ofConst(l,s,D),i=u.a.ofConst(d,s,D),a=u.a.ofConst(f,s,D)}return{kind:o.name,red:n,green:i,blue:a}}function I(e,t,r,n){var i=r.kind,a=r.red,o=r.green,s=r.blue,u=n.ids,c=n.map,l=n.label;return _.a.create("ply-mesh",e,t,(function(e){var t="material"===i?e:c[e];return v.Color.fromRgb(a.value(t),o.value(t),s.value(t))}),(function(){return 1}),(function(e){return l+" "+u[e]}))}function M(){var e,t,r,i,a,o,s=this;return function(u,c,l,d){return Object(n.__awaiter)(s,void 0,void 0,(function(){var s,f,p,m,h;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(!(s=c.getElement("vertex")))throw new Error("missing vertex element");if(!(f=c.getElement("face")))throw new Error("missing face element");return p=c.getElement("material"),m=!1,h=!1,e&&e===c||(m=!0),t&&O.ParamDefinition.isParamEqual(E.grouping,t.grouping,l.grouping)||(m=!0),t&&O.ParamDefinition.isParamEqual(E.coloring,t.coloring,l.coloring)||(h=!0),m?(a=T(s,p,l),o=function(e,t){for(var r=t.grouping,n=e.rowCount,i="vertex"===r.name?e.getProperty(r.params.group):void 0,a="vertex"===r.name?Object(j.d)(r.params.group):"Vertex",o=i?i.toArray({array:Uint32Array}):Object(x.fillSerial)(new Uint32Array(n)),s=i?Object(x.arrayMax)(o):n-1,u=new Uint32Array(s+1),c=0,l=o.length;c<l;++c)u[o[c]]=c;return{ids:o,map:u,label:a}}(s,l),[4,A(u,s,f,o.ids,d&&d.geometry)]):[3,2];case 1:return i=n.sent(),r=I(c,i,a,o),[3,3];case 2:h&&(a=T(s,p,l),r=I(c,i,a,o)),n.label=3;case 3:return e=c,t=Object(C.b)(l),[2,r]}}))}))}}function k(e,t){var r=this;return a.b.create("Shape Provider",(function(t){return Object(n.__awaiter)(r,void 0,void 0,(function(){return Object(n.__generator)(this,(function(t){return[2,{label:"Mesh",data:e,params:P(e),getShape:M(),geometryUtils:y.a.Utils}]}))}))}))}var B=r(171),V=r(44);function R(){return R.empty()}!function(e){function t(e,t){return{size:e,anglesInRadians:t}}function r(){return t(Object(g.Vec3)(),Object(g.Vec3)())}e.create=t,e.empty=r,e.fromBasis=function(e,n,i){var a=g.Vec3.magnitude(e),o=g.Vec3.magnitude(n),s=g.Vec3.magnitude(i),u=Math.acos(g.Vec3.dot(n,i)/(o*s)),c=Math.acos(g.Vec3.dot(e,i)/(a*s)),l=Math.acos(g.Vec3.dot(e,n)/(a*o));return a<=0||o<=0||s<=0||u>=Math.PI||c>=Math.PI||l>=Math.PI?r():t(g.Vec3.create(a,o,s),g.Vec3.create(u,c,l))}}(R||(R={}));function L(e){var t=this;return a.b.create("Parse DCD",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,a,o,s,u,c,l,d;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,r.update("Converting to coordinates")];case 1:for(n.sent(),t=e.header,i=t.DELTA?Object(B.b)(20.45482949774598*t.DELTA,"ps"):Object(B.b)(1,"step"),a=t.ISTART>=1?Object(B.b)((t.ISTART-1)*i.value,i.unit):Object(B.b)(0,i.unit),o=[],s=0,u=e.frames.length;s<u;++s)c=e.frames[s],l={elementCount:c.elementCount,time:Object(B.b)(a.value+i.value*s,i.unit),x:c.x,y:c.y,z:c.z},c.cell&&((d=c.cell)[1]>=-1&&d[1]<=1&&d[3]>=-1&&d[3]<=1&&d[4]>=-1&&d[4]<=1?l.cell=R.create(g.Vec3.create(d[0],d[2],d[5]),g.Vec3.create(Object(V.c)(90-90*Math.asin(d[1])/V.d),Object(V.c)(90-90*Math.asin(d[3])/V.d),Object(V.c)(90-90*Math.asin(d[4])/V.d))):d[0]<0||d[1]<0||d[2]<0||d[3]<0||d[4]<0||d[5]<0||d[3]>180||d[4]>180||d[5]>180?l.cell=R.fromBasis(g.Vec3.create(d[0],d[1],d[3]),g.Vec3.create(d[1],d[2],d[4]),g.Vec3.create(d[3],d[4],d[5])):l.cell=R.create(g.Vec3.create(d[0],d[2],d[5]),g.Vec3.create(Object(V.c)(d[1]),Object(V.c)(d[3]),Object(V.c)(d[4])))),o.push(l);return[2,B.a.create(o,i,a)]}}))}))}))}function N(e,t,r,n){for(var i=r,a=n-1,o=t.charCodeAt(i);(32===o||o>=48&&o<=57)&&i<=a;)o=t.charCodeAt(++i);for(o=t.charCodeAt(a);(32===o||o>=48&&o<=57)&&a>=i;)o=t.charCodeAt(--a);if(i===++a)return c.a.add(e,i,a);if(i+1===a)return c.a.add(e,i,a);if(o=t.charCodeAt(i),i+2===a){var s=t.charCodeAt(i+1);if(!((78!==o&&110!==o||65!==s&&97!==s)&&(67!==o&&99!==o||76!==s&&108!==s)&&(70!==o&&102!==o||69!==s&&101!==s)&&(83!==o&&115!==o||73!==s&&105!==s)&&(66!==o&&98!==o||82!==s&&114!==s)&&(65!==o&&97!==o||83!==s&&115!==s)))return c.a.add(e,i,i+2)}if(67===o||99===o||72===o||104===o||78===o||110===o||79===o||111===o||80===o||112===o||83===o||115===o)return c.a.add(e,i,i+1);c.a.add(e,i,i)}var F=/^[\s\d]+|[\s\d]+$/g;function U(e){var t=(e=e.replace(F,"").toUpperCase()).length;if(0===t)return e;if(1===t)return e;if(2===t&&("NA"===e||"CL"===e||"FE"===e||"SI"===e||"BR"===e||"AS"===e))return e;var r=e[0];return"C"===r||"H"===r||"N"===r||"O"===r||"P"===r||"S"===r?r:""}var z,H=r(22),G=r(96),q=r(111),W=[new Set(["CA"]),new Set(["C"]),new Set(["N"])],X=[new Set(["P","O3'","O3*"]),new Set(["C4'","C4*"]),new Set(["O2'","O2*","F2'","F2*"])],Y=[new Set(["P","O3'","O3*"]),new Set(["C3'","C3*"]),new Set(["O2'","O2*","F2'","F2*"])],Q=(z=new Map,[{id:"HIS",name:"HISTIDINE",type:"L-peptide linking"},{id:"ARG",name:"ARGININE",type:"L-peptide linking"},{id:"LYS",name:"LYSINE",type:"L-peptide linking"},{id:"ILE",name:"ISOLEUCINE",type:"L-peptide linking"},{id:"PHE",name:"PHENYLALANINE",type:"L-peptide linking"},{id:"LEU",name:"LEUCINE",type:"L-peptide linking"},{id:"TRP",name:"TRYPTOPHAN",type:"L-peptide linking"},{id:"ALA",name:"ALANINE",type:"L-peptide linking"},{id:"MET",name:"METHIONINE",type:"L-peptide linking"},{id:"CYS",name:"CYSTEINE",type:"L-peptide linking"},{id:"ASN",name:"ASPARAGINE",type:"L-peptide linking"},{id:"VAL",name:"VALINE",type:"L-peptide linking"},{id:"GLY",name:"GLYCINE",type:"peptide linking"},{id:"SER",name:"SERINE",type:"L-peptide linking"},{id:"GLN",name:"GLUTAMINE",type:"L-peptide linking"},{id:"TYR",name:"TYROSINE",type:"L-peptide linking"},{id:"ASP",name:"ASPARTIC ACID",type:"L-peptide linking"},{id:"GLU",name:"GLUTAMIC ACID",type:"L-peptide linking"},{id:"THR",name:"THREONINE",type:"L-peptide linking"},{id:"PRO",name:"PROLINE",type:"L-peptide linking"},{id:"SEC",name:"SELENOCYSTEINE",type:"L-peptide linking"},{id:"PYL",name:"PYRROLYSINE",type:"L-peptide linking"},{id:"A",name:"ADENOSINE-5'-MONOPHOSPHATE",type:"RNA linking"},{id:"C",name:"CYTIDINE-5'-MONOPHOSPHATE",type:"RNA linking"},{id:"T",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"RNA linking"},{id:"G",name:"GUANOSINE-5'-MONOPHOSPHATE",type:"RNA linking"},{id:"I",name:"INOSINIC ACID",type:"RNA linking"},{id:"U",name:"URIDINE-5'-MONOPHOSPHATE",type:"RNA linking"},{id:"DA",name:"2'-DEOXYADENOSINE-5'-MONOPHOSPHATE",type:"DNA linking"},{id:"DC",name:"2'-DEOXYCYTIDINE-5'-MONOPHOSPHATE",type:"DNA linking"},{id:"DT",name:"THYMIDINE-5'-MONOPHOSPHATE",type:"DNA linking"},{id:"DG",name:"2'-DEOXYGUANOSINE-5'-MONOPHOSPHATE",type:"DNA linking"},{id:"DI",name:"2'-DEOXYINOSINE-5'-MONOPHOSPHATE",type:"DNA linking"},{id:"DU",name:"2'-DEOXYURIDINE-5'-MONOPHOSPHATE",type:"DNA linking"}].forEach((function(e){return z.set(e.id,e)})),z),K=function(){var e=new Map;return[{id:"ZN2",name:"ZINC ION",type:"Ion"},{id:"SOD",name:"SODIUM ION",type:"Ion"},{id:"CES",name:"CESIUM ION",type:"Ion"},{id:"CLA",name:"CHLORIDE ION",type:"Ion"},{id:"CAL",name:"CALCIUM ION",type:"Ion"},{id:"POT",name:"POTASSIUM ION",type:"Ion"}].forEach((function(t){return e.set(t.id,t)})),e}(),Z=function(){function e(e,t){this.seqId=e,this.atomId=t,this.namesMap=new Map,this.comps=new Map,this.ids=[],this.names=[],this.types=[],this.mon_nstd_flags=[]}return e.prototype.set=function(e){this.comps.set(e.id,e),this.ids.push(e.id),this.names.push(e.name),this.types.push(e.type),this.mon_nstd_flags.push(H.PolymerNames.has(e.id)?"y":"n")},e.prototype.getAtomIds=function(e){for(var t=new Set,r=this.seqId.value(e);e<this.seqId.rowCount;){var n=this.seqId.value(e);if(n!==r)break;t.add(this.atomId.value(e)),e+=1}return t},e.prototype.hasAtomIds=function(e,t){for(var r=0,n=t.length;r<n;++r)if(!G.a.areIntersecting(e,t[r]))return!1;return!0},e.prototype.getType=function(e){return this.hasAtomIds(e,W)?"peptide linking":this.hasAtomIds(e,X)?"RNA linking":this.hasAtomIds(e,Y)?"DNA linking":"other"},e.prototype.has=function(e){return this.comps.has(e)},e.prototype.get=function(e){return this.comps.get(e)},e.prototype.add=function(e,t){if(!this.has(e))if(Q.has(e))this.set(Q.get(e));else if(H.WaterNames.has(e))this.set({id:e,name:"WATER",type:"non-polymer"});else{var r=this.getAtomIds(t);if(K.has(e)&&1===r.size)this.set(K.get(e));else{var n=this.getType(r);this.set({id:e,name:this.namesMap.get(e)||e,type:n})}}return this.get(e)},e.prototype.getChemCompTable=function(){return u.d.ofPartialColumns(q.a.chem_comp,{id:u.a.ofStringArray(this.ids),name:u.a.ofStringArray(this.names),type:u.a.ofStringAliasArray(this.types),mon_nstd_flag:u.a.ofStringAliasArray(this.mon_nstd_flags)},this.ids.length)},e.prototype.setNames=function(e){var t=this;e.forEach((function(e){return t.namesMap.set(e[0],e[1])}))},e}(),J=r(154);var $,ee=Object(J.a)((function(e){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZ".length,r=e,n=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[r%t];r>=t;)i+="ABCDEFGHIJKLMNOPQRSTUVWXYZ"[(r=Math.floor(r/t))%t],n+=1;return n>=5&&console.warn("getChainId overflow"),i})),te=function(){function e(){this.count=0,this.ids=[],this.types=[],this.descriptions=[],this.compoundsMap=new Map,this.namesMap=new Map,this.heteroMap=new Map,this.chainMap=new Map}return e.prototype.set=function(e,t){this.count+=1,this.ids.push(""+this.count),this.types.push(e),this.descriptions.push([t])},e.prototype.getEntityId=function(e,t,r,n){return 2===t?(void 0===this.waterId&&(this.set("water",(null==n?void 0:n.customName)||"Water"),this.waterId=""+this.count),this.waterId):Object(H.isPolymer)(t)?this.compoundsMap.has(r)?this.compoundsMap.get(r):(this.chainMap.has(r)||(this.set("polymer",(null==n?void 0:n.customName)||"Polymer "+(this.chainMap.size+1)),this.chainMap.set(r,""+this.count)),this.chainMap.get(r)):(this.heteroMap.has(e)||(this.set("non-polymer",(null==n?void 0:n.customName)||this.namesMap.get(e)||e),this.heteroMap.set(e,""+this.count)),this.heteroMap.get(e))},e.prototype.getEntityTable=function(){return u.d.ofPartialColumns(q.a.entity,{id:u.a.ofStringArray(this.ids),type:u.a.ofStringAliasArray(this.types),pdbx_description:u.a.ofStringListArray(this.descriptions)},this.count)},e.prototype.setCompounds=function(e){for(var t=0,r=e.length;t<r;++t){var n=e[t],i=n.chains,a=n.description;this.set("polymer",a);for(var o=0,s=i.length;o<s;++o)this.compoundsMap.set(i[o],""+this.count)}},e.prototype.setNames=function(e){var t=this;e.forEach((function(e){return t.namesMap.set(e[0],e[1])}))},e}(),re=r(175),ne=r(252);function ie(e){var t=this;return a.b.create("Parse GRO",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,a,o,s,c;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:t=$.fromGro(e),i=[],a=0,o=e.structures.length,n.label=1;case 1:return a<o?(s=function(e,t){for(var r=e.atomName,n=e.residueName,i=new Array(e.count),a=new Array(e.count),o=new Uint32Array(e.count),s=new Uint32Array(e.count),c=new te,l=new Z(e.residueNumber,e.atomName),d="",f=0,p="",m=0,h=0,g=-1,v=0,b=e.count;v<b;++v){var y=e.residueNumber.value(v);if(y!==g){var _=e.residueName.value(v),S=Object(H.getMoleculeType)(l.add(_,v).type,_);S===h&&(y===g+1||99999===g&&0===y)||(p=ee(f),f+=1,m=0),d=c.getEntityId(_,S,p),m+=1,g=y,h=S}i[v]=d,a[v]=p,o[v]=m,s[v]=v}var x=u.a.ofStringArray(a),O=u.d.ofPartialColumns(q.a.atom_site,{auth_asym_id:x,auth_atom_id:r,auth_comp_id:n,auth_seq_id:e.residueNumber,Cartn_x:u.a.ofFloatArray(u.a.mapToArray(e.x,(function(e){return 10*e}),Float32Array)),Cartn_y:u.a.ofFloatArray(u.a.mapToArray(e.y,(function(e){return 10*e}),Float32Array)),Cartn_z:u.a.ofFloatArray(u.a.mapToArray(e.z,(function(e){return 10*e}),Float32Array)),id:u.a.ofIntArray(s),label_asym_id:x,label_atom_id:r,label_comp_id:n,label_seq_id:u.a.ofIntArray(o),label_entity_id:u.a.ofStringArray(i),occupancy:u.a.ofConst(1,e.count,u.a.Schema.float),type_symbol:u.a.ofStringArray(u.a.mapToArray(e.atomName,(function(e){return U(e)}))),pdbx_PDB_model_num:u.a.ofConst(t,e.count,u.a.Schema.int)},e.count);return Object(q.b)({entity:c.getEntityTable(),chem_comp:l.getChemCompTable(),atom_site:O})}(e.structures[a].atoms,a+1),[4,Object(re.a)(s,t,r)]):[3,4];case 2:1===(c=n.sent()).frameCount&&i.push(c.representative),n.label=3;case 3:return++a,[3,1];case 4:return[2,new ne.a(i)]}}))}))}))}!function(e){e.is=function(e){return"gro"===(null==e?void 0:e.kind)},e.fromGro=function(e){return{kind:"gro",name:e.structures[0].header.title,data:e}}}($||($={}));var ae=r(74),oe=r(26);function se(e,t){var r=function(e,r){return(t.substr(e,r)||"").trim()},n={entry_id:oe.c.ofString(e),length_a:oe.c.ofString(r(6,9)),length_b:oe.c.ofString(r(15,9)),length_c:oe.c.ofString(r(24,9)),angle_alpha:oe.c.ofString(r(33,7)),angle_beta:oe.c.ofString(r(40,7)),angle_gamma:oe.c.ofString(r(47,7)),Z_PDB:oe.c.ofString(r(66,4)),pdbx_unique_axis:oe.c.ofString("?")},i={entry_id:oe.c.ofString(e),"space_group_name_H-M":oe.c.ofString(r(55,11)),Int_Tables_number:oe.c.ofString("?"),cell_setting:oe.c.ofString("?"),space_group_name_Hall:oe.c.ofString("?")};return[oe.b.ofFields("cell",n),oe.b.ofFields("symmetry",i)]}function ue(e,t){return{id:e,details:t,groups:[]}}function ce(e,t,r){for(var n,i,a,o=[],s=1,u=1,c=function(t){return e.data.substring(e.indices[2*t],e.indices[2*t+1])},l=t;l<r;l++){var d=c(l);if("BIOMOLECULE:"===d.substr(11,12)){var f=d.substr(23).trim(),p="Biomolecule "+f;"APPLY THE FOLLOWING TO CHAINS:"!==(d=c(l+1)).substr(11,30)&&(l++,p=d.substr(11).trim()),n=ue(f,p),o.push(n)}else if("BIOMT"===d.substr(13,5)){var m=d.split(/\s+/);0===(R=parseInt(d[18])-1)&&(a=g.Mat4.identity(),i.operators.push({id:s++,matrix:a})),g.Mat4.setValue(a,R,0,parseFloat(m[4])),g.Mat4.setValue(a,R,1,parseFloat(m[5])),g.Mat4.setValue(a,R,2,parseFloat(m[6])),g.Mat4.setValue(a,R,3,parseFloat(m[7]))}else if("APPLY THE FOLLOWING TO CHAINS:"===d.substr(11,30)||"                   AND CHAINS:"===d.substr(11,30)){"APPLY"===d.substr(11,5)&&(i={chains:[],operators:[]},n.groups.push(i));for(var h=0,v=(b=d.substr(41,30).split(",")).length;h<v;++h){(y=b[h].trim())&&i.chains.push(y)}}else if("APPLYING THE FOLLOWING TO CHAINS:"===d.substr(11,33)){n=ue(""+u,"Biomolecule "+u),o.push(n),u+=1,i={chains:[],operators:[]},n.groups.push(i);var b;for(h=0,v=(b=(d=c(++l)).substr(11,69).split(",")).length;h<v;++h){var y;(y=b[h].trim())&&i.chains.push(y)}}}if(0===o.length)return[];for(var _={id:oe.c.ofStrings(o.map((function(e){return e.id}))),details:oe.c.ofStrings(o.map((function(e){return e.details})))},S=[],x=0,O=o;x<O.length;x++)for(var w=0,C=(T=O[x]).groups;w<C.length;w++){var j=C[w];S.push({assembly_id:T.id,oper_expression:j.operators.map((function(e){return e.id})).join(","),asym_id_list:j.chains.join(",")})}for(var P={assembly_id:oe.c.ofStrings(S.map((function(e){return e.assembly_id}))),oper_expression:oe.c.ofStrings(S.map((function(e){return e.oper_expression}))),asym_id_list:oe.c.ofStrings(S.map((function(e){return e.asym_id_list})))},E=[],A=0,D=o;A<D.length;A++)for(var T,I=0,M=(T=D[A]).groups;I<M.length;I++)for(var k=0,B=M[I].operators;k<B.length;k++){var V=B[k],R={id:""+V.id,type:"?",name:"?",symmetry_operation:"?"};for(l=0;l<3;l++){for(h=0;h<3;h++)R["matrix["+(l+1)+"]["+(h+1)+"]"]=""+g.Mat4.getValue(V.matrix,l,h);R["vector["+(l+1)+"]"]=""+g.Mat4.getValue(V.matrix,l,3)}E.push(R)}var L={id:oe.c.ofStrings(E.map((function(e){return e.id}))),type:oe.c.ofStrings(E.map((function(e){return e.type}))),name:oe.c.ofStrings(E.map((function(e){return e.name}))),symmetry_operation:oe.c.ofStrings(E.map((function(e){return e.symmetry_operation})))},N=function(e){for(var t=function(t){var r="matrix["+(e+1)+"]["+(t+1)+"]";L[r]=oe.c.ofStrings(E.map((function(e){return e[r]})))},r=0;r<3;r++)t(r);var n="vector["+(e+1)+"]";L[n]=oe.c.ofStrings(E.map((function(e){return e[n]})))};for(l=0;l<3;l++)N(l);return[oe.b.ofFields("pdbx_struct_assembly",_),oe.b.ofFields("pdbx_struct_assembly_gen",P),oe.b.ofFields("pdbx_struct_oper_list",L)]}function le(e,t,r){for(var n,i,a=[],o=t;o<r;o++){var s=(i=o,e.data.substring(e.indices[2*i],e.indices[2*i+1])),u=s.split(/\s+/);0===(m=parseInt(s[5])-1)&&(n=g.Mat4.identity(),a.push(n)),g.Mat4.setValue(n,m,0,parseFloat(u[2])),g.Mat4.setValue(n,m,1,parseFloat(u[3])),g.Mat4.setValue(n,m,2,parseFloat(u[4])),g.Mat4.setValue(n,m,3,parseFloat(u[5]))}if(0===a.length)return[];for(var c=[],l=1,d=0,f=a;d<f.length;d++){var p=f[d],m={id:"ncsop"+l++,code:".",details:"."};for(o=0;o<3;o++){for(var h=0;h<3;h++)m["matrix["+(o+1)+"]["+(h+1)+"]"]=""+g.Mat4.getValue(p,o,h);m["vector["+(o+1)+"]"]=""+g.Mat4.getValue(p,o,3)}c.push(m)}var v={id:oe.c.ofStrings(c.map((function(e){return e.id}))),code:oe.c.ofStrings(c.map((function(e){return e.code}))),details:oe.c.ofStrings(c.map((function(e){return e.details})))},b=function(e){for(var t=function(t){var r="matrix["+(e+1)+"]["+(t+1)+"]";v[r]=oe.c.ofStrings(c.map((function(e){return e[r]})))},r=0;r<3;r++)t(r);var n="vector["+(e+1)+"]";v[n]=oe.c.ofStrings(c.map((function(e){return e[n]})))};for(o=0;o<3;o++)b(o);return[oe.b.ofFields("struct_ncs_oper",v)]}var de={1:"HELX_RH_AL_P",2:"HELX_RH_OM_P",3:"HELX_RH_PI_P",4:"HELX_RH_GA_P",5:"HELX_RH_3T_P",6:"HELX_LH_AL_P",7:"HELX_LH_OM_P",8:"HELX_LH_GA_P",9:"HELX_RH_27_P",10:"HELX_RH_PP_P"};function fe(e,t,r){for(var n,i=[],a=t;a<r;a++){var o=(n=a,e.data.substring(e.indices[2*n],e.indices[2*n+1]));i.push({serNum:o.substr(7,3).trim(),helixID:o.substr(11,3).trim(),initResName:o.substr(15,3).trim(),initChainID:o.substr(19,1).trim(),initSeqNum:o.substr(21,4).trim(),initICode:o.substr(25,1).trim(),endResName:o.substr(27,3).trim(),endChainID:o.substr(31,3).trim(),endSeqNum:o.substr(33,4).trim(),endICode:o.substr(37,1).trim(),helixClass:o.substr(38,2).trim(),comment:o.substr(40,30).trim(),length:o.substr(71,5).trim()})}var s=oe.c.ofStrings(i.map((function(e){return e.initChainID}))),c=oe.c.ofStrings(i.map((function(e){return e.initResName}))),l=oe.c.ofStrings(i.map((function(e){return e.endChainID}))),d=oe.c.ofStrings(i.map((function(e){return e.endResName}))),f={beg_label_asym_id:s,beg_label_comp_id:c,beg_label_seq_id:oe.c.ofUndefined(i.length,u.a.Schema.int),beg_auth_asym_id:s,beg_auth_comp_id:c,beg_auth_seq_id:oe.c.ofStrings(i.map((function(e){return e.initSeqNum}))),conf_type_id:oe.c.ofStrings(i.map((function(e){return t=e.helixClass,de[t]||"HELX_P";var t}))),details:oe.c.ofStrings(i.map((function(e){return e.comment}))),end_label_asym_id:l,end_label_comp_id:d,end_label_seq_id:oe.c.ofUndefined(i.length,u.a.Schema.int),end_auth_asym_id:l,end_auth_comp_id:d,end_auth_seq_id:oe.c.ofStrings(i.map((function(e){return e.endSeqNum}))),id:oe.c.ofStrings(i.map((function(e){return e.serNum}))),pdbx_beg_PDB_ins_code:oe.c.ofStrings(i.map((function(e){return e.initICode}))),pdbx_end_PDB_ins_code:oe.c.ofStrings(i.map((function(e){return e.endICode}))),pdbx_PDB_helix_class:oe.c.ofStrings(i.map((function(e){return e.helixClass}))),pdbx_PDB_helix_length:oe.c.ofStrings(i.map((function(e){return e.length}))),pdbx_PDB_helix_id:oe.c.ofStrings(i.map((function(e){return e.helixID})))};return oe.b.ofFields("struct_conf",f)}function pe(e,t,r){for(var n,i=[],a=t;a<r;a++){var o=(n=a,e.data.substring(e.indices[2*n],e.indices[2*n+1]));i.push({strand:o.substr(7,3).trim(),sheetID:o.substr(11,3).trim(),numStrands:o.substr(14,2).trim(),initResName:o.substr(17,3).trim(),initChainID:o.substr(21,1).trim(),initSeqNum:o.substr(22,4).trim(),initICode:o.substr(26,1).trim(),endResName:o.substr(28,3).trim(),endChainID:o.substr(32,1).trim(),endSeqNum:o.substr(33,4).trim(),endICode:o.substr(37,1).trim(),sense:o.substr(38,2).trim(),curAtom:o.substr(41,4).trim(),curResName:o.substr(45,3).trim(),curChainId:o.substr(49,1).trim(),curResSeq:o.substr(50,4).trim(),curICode:o.substr(54,1).trim(),prevAtom:o.substr(56,4).trim(),prevResName:o.substr(60,3).trim(),prevChainId:o.substr(64,1).trim(),prevResSeq:o.substr(65,4).trim(),prevICode:o.substr(69,1).trim()})}var s=oe.c.ofStrings(i.map((function(e){return e.initChainID}))),u=oe.c.ofStrings(i.map((function(e){return e.initResName}))),c=oe.c.ofStrings(i.map((function(e){return e.initSeqNum}))),l=oe.c.ofStrings(i.map((function(e){return e.endChainID}))),d=oe.c.ofStrings(i.map((function(e){return e.endResName}))),f=oe.c.ofStrings(i.map((function(e){return e.endSeqNum}))),p={beg_label_asym_id:s,beg_label_comp_id:u,beg_label_seq_id:c,beg_auth_asym_id:s,beg_auth_comp_id:u,beg_auth_seq_id:c,end_label_asym_id:l,end_label_comp_id:l,end_label_seq_id:f,end_auth_asym_id:l,end_auth_comp_id:d,end_auth_seq_id:f,id:oe.c.ofStrings(i.map((function(e){return e.strand}))),sheet_id:oe.c.ofStrings(i.map((function(e){return e.sheetID}))),pdbx_beg_PDB_ins_code:oe.c.ofStrings(i.map((function(e){return e.initICode}))),pdbx_end_PDB_ins_code:oe.c.ofStrings(i.map((function(e){return e.endICode})))};return oe.b.ofFields("struct_sheet_range",p)}var me={MOL_ID:"",MOLECULE:"",CHAIN:"",FRAGMENT:"",SYNONYM:"",EC:"",ENGINEERED:"",MUTATION:"",OTHER_DETAILS:""};function he(e,t,r){for(var n,i,a={chains:[],description:""},o=[],s=t;s<r;s++){var u=(i=s,e.data.substring(e.indices[2*i],e.indices[2*i+1])).substr(10,70).trim(),c=u.indexOf(":"),l=u.substring(0,c),d=void 0;l in me?(n=l,d=u.substring(c+2)):d=u,d=d.replace(/;$/,""),"MOL_ID"===n?(a={chains:[],description:""},o.push(a)):"MOLECULE"===n?(a.description&&(a.description+=" "),a.description+=d):"CHAIN"===n&&Array.prototype.push.apply(a.chains,d.split(/\s*,\s*/))}return o}function ge(e,t,r){for(var n,i=new Map,a=t;a<r;a++){var o=(n=a,e.data.substring(e.indices[2*n],e.indices[2*n+1])),s=o.substr(11,3).trim(),u=o.substr(15).trim();i.has(s)?i.set(s,i.get(s)+" "+u):i.set(s,u)}return i}function ve(e,t,r,n,i,a){var o=r.data,s=i-n;c.a.addToken(e.group_PDB,c.b.trim(r,n,n+6)),c.b.trim(r,n+6,n+11),e.id[e.index]=r.data.substring(r.tokenStart,r.tokenEnd),c.a.addToken(e.auth_atom_id,c.b.trim(r,n+12,n+16)),32===o.charCodeAt(n+16)?c.a.add(e.label_alt_id,0,0):c.a.add(e.label_alt_id,n+16,n+17),c.a.addToken(e.auth_comp_id,c.b.trim(r,n+17,n+20)),c.a.add(e.auth_asym_id,n+21,n+22),c.a.addToken(e.auth_seq_id,c.b.trim(r,n+22,n+26)),32===o.charCodeAt(n+26)?c.a.add(e.pdbx_PDB_ins_code,0,0):c.a.add(e.pdbx_PDB_ins_code,n+26,n+27),c.a.addToken(e.Cartn_x,c.b.trim(r,n+30,n+38)),c.a.addToken(e.Cartn_y,c.b.trim(r,n+38,n+46)),c.a.addToken(e.Cartn_z,c.b.trim(r,n+46,n+54)),c.a.addToken(e.occupancy,c.b.trim(r,n+54,n+60)),s>=66?c.a.addToken(e.B_iso_or_equiv,c.b.trim(r,n+60,n+66)):c.a.add(e.B_iso_or_equiv,0,0),a&&c.a.addToken(e.partial_charge,c.b.trim(r,n+70,n+76)),s>=78&&!a?(c.b.trim(r,n+76,n+78),r.tokenStart<r.tokenEnd?c.a.addToken(e.type_symbol,r):N(e.type_symbol,o,n+12,n+16)):N(e.type_symbol,o,n+12,n+16),e.pdbx_PDB_model_num[e.index]=t,e.index++}function be(e){var t=oe.c.ofTokens(e.pdbx_auth_seq_id),r=oe.c.ofTokens(e.pdbx_auth_comp_id),n=oe.c.ofTokens(e.pdbx_auth_asym_id),i=oe.c.ofTokens(e.pdbx_auth_atom_id),a={id:oe.c.ofStrings(e.id),type_symbol:oe.c.ofTokens(e.type_symbol),pdbx_label_atom_id:i,pdbx_label_alt_id:oe.c.ofTokens(e.pdbx_label_alt_id),pdbx_label_comp_id:r,pdbx_label_asym_id:n,pdbx_label_seq_id:t,pdbx_PDB_ins_code:oe.c.ofTokens(e.pdbx_PDB_ins_code),pdbx_auth_seq_id:t,pdbx_auth_comp_id:r,pdbx_auth_asym_id:n,pdbx_auth_atom_id:i};return a["U[1][1]"]=oe.c.ofNumbers(e["U[1][1]"]),a["U[2][2]"]=oe.c.ofNumbers(e["U[2][2]"]),a["U[3][3]"]=oe.c.ofNumbers(e["U[3][3]"]),a["U[1][2]"]=oe.c.ofNumbers(e["U[1][2]"]),a["U[1][3]"]=oe.c.ofNumbers(e["U[1][3]"]),a["U[2][3]"]=oe.c.ofNumbers(e["U[2][3]"]),a}function ye(e,t,r,n,i){var a=r.data,o=i-n;c.b.trim(r,n+6,n+11),e.id[e.index]=a.substring(r.tokenStart,r.tokenEnd),c.a.addToken(e.pdbx_auth_atom_id,c.b.trim(r,n+12,n+16)),32===a.charCodeAt(n+16)?c.a.add(e.pdbx_label_alt_id,0,0):c.a.add(e.pdbx_label_alt_id,n+16,n+17),c.a.addToken(e.pdbx_auth_comp_id,c.b.trim(r,n+17,n+20)),c.a.add(e.pdbx_auth_asym_id,n+21,n+22),c.a.addToken(e.pdbx_auth_seq_id,c.b.trim(r,n+22,n+26)),32===a.charCodeAt(n+26)?c.a.add(e.pdbx_PDB_ins_code,0,0):c.a.add(e.pdbx_PDB_ins_code,n+26,n+27),e["U[1][1]"][e.index]=Object(l.e)(a,n+28,n+35)/1e4,e["U[2][2]"][e.index]=Object(l.e)(a,n+35,n+42)/1e4,e["U[3][3]"][e.index]=Object(l.e)(a,n+42,n+49)/1e4,e["U[1][2]"][e.index]=Object(l.e)(a,n+49,n+56)/1e4,e["U[1][3]"][e.index]=Object(l.e)(a,n+56,n+63)/1e4,e["U[2][3]"][e.index]=Object(l.e)(a,n+63,n+70)/1e4,o>=78?(c.b.trim(r,n+76,n+78),r.tokenStart<r.tokenEnd?c.a.addToken(e.type_symbol,r):N(e.type_symbol,a,n+12,n+16)):N(e.type_symbol,a,n+12,n+16),e.index++}var _e=r(48);function Se(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,o,s,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C,P,E,A,D,T,I,M,k,B,V,R;return Object(n.__generator)(this,(function(n){for(t=e.lines,r=t.data,i=t.indices,a=Object(c.b)(r),o=!!e.isPdbqt,s=0,l=0,A=0,y=t.count;A<y;A++)switch(_=i[2*A],S=i[2*A+1],r[_]){case"A":Object(j.f)(r,_,S,"ATOM  ")?s++:Object(j.f)(r,_,S,"ANISOU")&&l++;break;case"H":Object(j.f)(r,_,S,"HETATM")&&s++}for(d=function(e,t){var r=function(){return c.a.create(e,2*t)};return{index:0,group_PDB:r(),id:[],auth_atom_id:r(),label_alt_id:r(),auth_comp_id:r(),auth_asym_id:r(),auth_seq_id:r(),pdbx_PDB_ins_code:r(),Cartn_x:r(),Cartn_y:r(),Cartn_z:r(),occupancy:r(),B_iso_or_equiv:r(),type_symbol:r(),pdbx_PDB_model_num:[],label_entity_id:[],partial_charge:r()}}(r,s),f=function(e,t){var r=function(){return new Float32Array(t)},n=function(){return c.a.create(e,2*t)};return{index:0,count:t,id:[],type_symbol:n(),pdbx_label_atom_id:n(),pdbx_label_alt_id:n(),pdbx_label_comp_id:n(),pdbx_label_asym_id:n(),pdbx_label_seq_id:n(),pdbx_PDB_ins_code:n(),"U[1][1]":r(),"U[2][2]":r(),"U[3][3]":r(),"U[1][2]":r(),"U[1][3]":r(),"U[2][3]":r(),pdbx_auth_seq_id:n(),pdbx_auth_comp_id:n(),pdbx_auth_asym_id:n(),pdbx_auth_atom_id:n()}}(r,l),p=new te,m=[],h=[],g=0,v="",b=void 0,A=0,y=t.count;A<y;A++)switch(_=i[2*A],S=i[2*A+1],r[_]){case"A":Object(j.f)(r,_,S,"ATOM  ")?(g||(g++,v=""+g),ve(d,v,a,_,S,o)):Object(j.f)(r,_,S,"ANISOU")&&ye(f,0,a,_,S);break;case"C":if(Object(j.f)(r,_,S,"CRYST1"))m.push.apply(m,se(e.id||"?",r.substring(_,S)));else if(Object(j.f)(r,_,S,"CONECT")){for(x=A+1;_=i[2*x],S=i[2*x+1],Object(j.f)(r,_,S,"CONECT");)x++;b?_e.a&&console.log("only single CONECT block allowed, ignoring others"):b=[A,x],A=x-1}else if(Object(j.f)(r,_,S,"COMPND")){for(x=A+1;_=i[2*x],S=i[2*x+1],Object(j.f)(r,_,S,"COMPND");)x++;p.setCompounds(he(t,A,x)),A=x-1}break;case"H":if(Object(j.f)(r,_,S,"HETATM"))g||(g++,v=""+g),ve(d,v,a,_,S,o);else if(Object(j.f)(r,_,S,"HELIX")){for(x=A+1;_=i[2*x],S=i[2*x+1],Object(j.f)(r,_,S,"HELIX");)x++;m.push(fe(t,A,x)),A=x-1}else if(Object(j.f)(r,_,S,"HETNAM")){for(x=A+1;_=i[2*x],S=i[2*x+1],Object(j.f)(r,_,S,"HETNAM");)x++;h.push.apply(h,Array.from(ge(t,A,x).entries())),A=x-1}break;case"M":if(Object(j.f)(r,_,S,"MODEL ")&&(g++,v=""+g),Object(j.f)(r,_,S,"MTRIX")){for(x=A+1;_=i[2*x],S=i[2*x+1],Object(j.f)(r,_,S,"MTRIX");)x++;m.push.apply(m,le(t,A,x)),A=x-1}break;case"O":break;case"R":if(Object(j.f)(r,_,S,"REMARK 350")){for(x=A+1;_=i[2*x],S=i[2*x+1],Object(j.f)(r,_,S,"REMARK 350");)x++;m.push.apply(m,ce(t,A,x)),A=x-1}break;case"S":if(Object(j.f)(r,_,S,"SHEET")){for(x=A+1;_=i[2*x],S=i[2*x+1],Object(j.f)(r,_,S,"SHEET");)x++;m.push(pe(t,A,x)),A=x-1}}for(O=u.a.ofIntTokens(d.auth_seq_id),w=u.a.ofStringTokens(d.auth_atom_id),C=u.a.ofStringTokens(d.auth_comp_id),P=u.a.ofStringTokens(d.auth_asym_id),(E=new Z(O,w)).setNames(h),p.setNames(h),A=0,D=C.rowCount;A<D;++A)T=C.value(A),I=Object(H.getMoleculeType)(E.add(T,A).type,T),d.label_entity_id[A]=p.getEntityId(T,I,P.value(A));var L,N,F,U;for(L=d,N=oe.c.ofTokens(L.auth_asym_id),F=oe.c.ofTokens(L.auth_atom_id),U=oe.c.ofTokens(L.auth_comp_id),M={auth_asym_id:N,auth_atom_id:F,auth_comp_id:U,auth_seq_id:oe.c.ofTokens(L.auth_seq_id),B_iso_or_equiv:oe.c.ofTokens(L.B_iso_or_equiv),Cartn_x:oe.c.ofTokens(L.Cartn_x),Cartn_y:oe.c.ofTokens(L.Cartn_y),Cartn_z:oe.c.ofTokens(L.Cartn_z),group_PDB:oe.c.ofTokens(L.group_PDB),id:oe.c.ofStrings(L.id),label_alt_id:oe.c.ofTokens(L.label_alt_id),label_asym_id:N,label_atom_id:F,label_comp_id:U,label_seq_id:oe.c.ofUndefined(L.index,u.a.Schema.int),label_entity_id:oe.c.ofStrings(L.label_entity_id),occupancy:oe.c.ofTokens(L.occupancy),type_symbol:oe.c.ofTokens(L.type_symbol),pdbx_PDB_ins_code:oe.c.ofTokens(L.pdbx_PDB_ins_code),pdbx_PDB_model_num:oe.c.ofStrings(L.pdbx_PDB_model_num),partial_charge:oe.c.ofTokens(L.partial_charge)},o||delete M.partial_charge,b&&m.push(function(e,t,r,n){for(var i={},a=0,o=n.id.rowCount;a<o;++a)i[n.id.str(a)]=a;var s,u=[],c=[],l=[],d=[],f=[],p=[],m=[],h=[],g=[],v=[],b=[11,16,21,26],y=1;for(a=t;a<r;a++){var _=(s=a,e.data.substring(e.indices[2*s],e.indices[2*s+1])),S=i[parseInt(_.substr(6,5))],x={};if(void 0!==S)for(var O=0;O<4;++O){var w=parseInt(_.substr(b[O],5));if(!Number.isNaN(w)){var C=i[w];void 0!==C&&(S>C||void 0===x[C]&&(u.push("covale"+y),c.push("covale"),l.push(n.label_asym_id.str(S)),f.push(n.auth_seq_id.int(S)),d.push(n.label_seq_id.int(S)),p.push(n.label_atom_id.str(S)),m.push(n.label_asym_id.str(C)),g.push(n.auth_seq_id.int(C)),h.push(n.label_seq_id.int(C)),v.push(n.label_atom_id.str(C)),y+=1))}}}var j={id:oe.c.ofStrings(u),conn_type_id:oe.c.ofStrings(c),ptnr1_label_asym_id:oe.c.ofStrings(l),ptnr1_auth_seq_id:oe.c.ofNumbers(f),ptnr1_label_seq_id:oe.c.ofNumbers(d),ptnr1_label_atom_id:oe.c.ofStrings(p),ptnr2_label_asym_id:oe.c.ofStrings(m),ptnr2_label_seq_id:oe.c.ofNumbers(h),ptnr2_auth_seq_id:oe.c.ofNumbers(g),ptnr2_label_atom_id:oe.c.ofStrings(v)};return oe.b.ofFields("struct_conn",j)}(t,b[0],b[1],M)),k={entity:oe.b.ofTable("entity",p.getEntityTable()),chem_comp:oe.b.ofTable("chem_comp",E.getChemCompTable()),atom_site:oe.b.ofFields("atom_site",M),atom_site_anisotrop:oe.b.ofFields("atom_site_anisotrop",be(f))},B=0,V=m;B<V.length;B++)R=V[B],k[R.name]=R;return[2,{header:e.id||"PDB",categoryNames:Object.keys(k),categories:k}]}))}))}var xe,Oe=r(289);function we(e){var t=this;return a.b.create("Parse PDB",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,a,o,s,c,l,d,f,p,m;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,r.update("Converting to mmCIF")];case 1:return n.sent(),[4,Se(e)];case 2:return t=n.sent(),i=ae.a.fromFrame(t,void 0,xe.create(e)),[4,Object(re.a)(i.data.db,i,r)];case 3:return a=n.sent(),(o=null===(m=t.categories.atom_site)||void 0===m?void 0:m.getField("partial_charge"))&&1===a.frameCount&&(s=a.representative,c=s.atomicHierarchy.atomSourceIndex,l=u.a.isIdentity(c),d=l?void 0:c.toArray({array:Int32Array}),f=o.toFloatArray(),p=d?u.a.ofFloatArray(u.a.mapToArray(c,(function(e){return f[e]}),Float32Array)):u.a.ofFloatArray(f),Oe.a.Provider.set(s,{data:p,type:"GASTEIGER"})),[2,a]}}))}))}))}!function(e){e.is=function(e){return"pdb"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"pdb",name:e.id||"",data:e}}}(xe||(xe={}));var Ce,je=r(351);function Pe(e){var t=this;return a.b.create("Parse PSF",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,r,i,a,o,s;return Object(n.__generator)(this,(function(n){return t=Ce.fromPsf(e),r=function(e){for(var t=new Array(e.count),r=new Array(e.count),n=new Uint32Array(e.count),i=new Uint32Array(e.count),a=new te,o=new Z(e.residueId,e.atomName),s="",c=0,l="",d=0,f=e.segmentName.value(0),p=!1,m=0,h=-1,g=0,v=e.count;g<v;++g){var b=e.residueId.value(g),y=e.segmentName.value(g);if(f!==y?(l=ee(c),c+=1,d=0,p=!0,f=y):p=!1,p||b!==h){var _=e.residueName.value(g),S=Object(H.getMoleculeType)(o.add(_,g).type,_);p||S===m&&b===h+1||(l=ee(c),c+=1,d=0),s=a.getEntityId(_,S,l),d+=1,h=b,m=S}t[g]=s,r[g]=l,n[g]=d,i[g]=g}var x=u.d.ofPartialColumns(q.a.atom_site,{auth_asym_id:e.segmentName,auth_atom_id:e.atomName,auth_comp_id:e.residueName,auth_seq_id:e.residueId,id:u.a.ofIntArray(i),label_asym_id:u.a.ofStringArray(r),label_atom_id:e.atomName,label_comp_id:e.residueName,label_seq_id:u.a.ofIntArray(n),label_entity_id:u.a.ofStringArray(t),occupancy:u.a.ofConst(1,e.count,u.a.Schema.float),type_symbol:u.a.ofStringArray(u.a.mapToArray(e.atomName,(function(e){return U(e)}))),pdbx_PDB_model_num:u.a.ofConst(1,e.count,u.a.Schema.int)},e.count);return Object(q.b)({entity:a.getEntityTable(),chem_comp:o.getChemCompTable(),atom_site:x})}(e.atoms),i=e.bonds,a=i.atomIdA,o=i.atomIdB,s={indexA:u.a.ofLambda({value:function(e){return a.value(e)-1},rowCount:a.rowCount,schema:a.schema}),indexB:u.a.ofLambda({value:function(e){return o.value(e)-1},rowCount:o.rowCount,schema:o.schema}),order:u.a.ofConst(1,e.bonds.count,u.a.Schema.int)},[2,je.a.create(e.id,r,s,t)]}))}))}))}!function(e){e.is=function(e){return"psf"===(null==e?void 0:e.kind)},e.fromPsf=function(e){return{kind:"psf",name:e.id,data:e}}}(Ce||(Ce={}));var Ee,Ae=r(4),De=r(10),Te=r(126),Ie=r(13),Me=r(5),ke=r(275),Be=r(169);!function(e){function t(e,t){var r=Te.Script.is(t)?t:void 0,n=Te.Script.is(t)?Te.Script.toExpression(t):t;return{script:r,expression:n,compiled:Object(Be.compile)(n),originalStructure:e,currentStructure:e}}function r(e,t){return e.compiled(new Ae.QueryContext(t))}e.isUnchanged=function(e,t,r){return e.currentStructure===r&&(Te.Script.is(t)?!!e.script&&Te.Script.areEqual(e.script,t):e.expression===t)},e.create=t,e.run=r,e.createAndRun=function(e,n){var i=t(e,n);return{entry:i,selection:r(i,e)}},e.updateStructure=function(e,t){return e.currentStructure=t,e.compiled(new Ae.QueryContext(t))},e.updateStructureObject=function(e,t,r){var n=Ae.StructureSelection.unionStructure(t);e.label=""+(r||"Selection"),e.description=Ae.Structure.elementDescription(n),e.data=n}}(Ee||(Ee={}));var Ve=r(8),Re=r(89),Le={type:O.ParamDefinition.MappedStatic("static",{static:O.ParamDefinition.Text("polymer"),expression:O.ParamDefinition.Value(De.MolScriptBuilder.struct.generator.all),bundle:O.ParamDefinition.Value(Ae.StructureElement.Bundle.Empty),script:O.ParamDefinition.Script({language:"mol-script",expression:"(sel.atom.all)"})},{isHidden:!0}),nullIfEmpty:O.ParamDefinition.Optional(O.ParamDefinition.Boolean(!0,{isHidden:!0})),label:O.ParamDefinition.Text("",{isHidden:!0})};var Ne=r(81);function Fe(e){var t=Object(c.b)(e),r=c.b.readLine(t).trim(),n=c.b.readLine(t).trim(),a=c.b.readLine(t).trim(),o=c.b.readLine(t),s=+o.substr(0,3),l=+o.substr(3,3),d={title:r,program:n,comment:a,atoms:function(e,t){for(var r=c.a.create(e.data,2*t),n=c.a.create(e.data,2*t),i=c.a.create(e.data,2*t),a=c.a.create(e.data,2*t),o=0;o<t;++o){c.b.markLine(e);var s=e.tokenStart,l=e.position;c.b.trim(e,s,s+10),c.a.addUnchecked(r,e.tokenStart,e.tokenEnd),c.b.trim(e,s+10,s+20),c.a.addUnchecked(n,e.tokenStart,e.tokenEnd),c.b.trim(e,s+20,s+30),c.a.addUnchecked(i,e.tokenStart,e.tokenEnd),c.b.trim(e,s+31,s+34),c.a.addUnchecked(a,e.tokenStart,e.tokenEnd),e.position=l}return{count:t,x:Object(Ne.c)(r)(u.a.Schema.float),y:Object(Ne.c)(n)(u.a.Schema.float),z:Object(Ne.c)(i)(u.a.Schema.float),type_symbol:Object(Ne.c)(a)(u.a.Schema.str)}}(t,s),bonds:function(e,t){for(var r=c.a.create(e.data,2*t),n=c.a.create(e.data,2*t),i=c.a.create(e.data,2*t),a=0;a<t;++a){c.b.markLine(e);var o=e.tokenStart,s=e.position;c.b.trim(e,o,o+3),c.a.addUnchecked(r,e.tokenStart,e.tokenEnd),c.b.trim(e,o+3,o+6),c.a.addUnchecked(n,e.tokenStart,e.tokenEnd),c.b.trim(e,o+6,o+9),c.a.addUnchecked(i,e.tokenStart,e.tokenEnd),e.position=s}return{count:t,atomIdxA:Object(Ne.c)(r)(u.a.Schema.int),atomIdxB:Object(Ne.c)(n)(u.a.Schema.int),order:Object(Ne.c)(i)(u.a.Schema.int)}}(t,l)};return i.a.success(d)}function Ue(e){var t=this;return a.b.create("Parse Mol",(function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){return Object(n.__generator)(this,(function(t){return[2,Fe(e)]}))}))}))}var ze,He=r(133);function Ge(e){return a.b.create("Parse MOL",(function(t){return function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,s,c,l,d,f,p,m,h,g,v,b;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=e.atoms,i=e.bonds,a=u.a.ofConst("MOL",e.atoms.count,u.a.Schema.str),o=u.a.ofConst("A",e.atoms.count,u.a.Schema.str),s=u.a.asArrayColumn(r.type_symbol),c=u.a.ofConst(1,r.count,u.a.Schema.int),l=u.d.ofPartialColumns(q.a.atom_site,{auth_asym_id:o,auth_atom_id:s,auth_comp_id:a,auth_seq_id:c,Cartn_x:u.a.asArrayColumn(r.x,Float32Array),Cartn_y:u.a.asArrayColumn(r.y,Float32Array),Cartn_z:u.a.asArrayColumn(r.z,Float32Array),id:u.a.range(0,r.count-1),label_asym_id:o,label_atom_id:s,label_comp_id:a,label_seq_id:c,label_entity_id:u.a.ofConst("1",r.count,u.a.Schema.str),occupancy:u.a.ofConst(1,r.count,u.a.Schema.float),type_symbol:s,pdbx_PDB_model_num:u.a.ofConst(1,r.count,u.a.Schema.int)},r.count),(d=new te).setNames([["MOL","Unknown Entity"]]),d.getEntityId("MOL",0,"A"),(f=new Z(c,s)).setNames([["MOL","Unknown Molecule"]]),f.add("MOL",0),p=Object(q.b)({entity:d.getEntityTable(),chem_comp:f.getChemCompTable(),atom_site:l}),[4,Object(re.a)(p,ze.create(e),t)];case 1:return(m=n.sent()).frameCount>0&&(h=u.a.ofIntArray(u.a.mapToArray(i.atomIdxA,(function(e){return e-1}),Int32Array)),g=u.a.ofIntArray(u.a.mapToArray(i.atomIdxB,(function(e){return e-1}),Int32Array)),v=u.a.asArrayColumn(i.order,Int32Array),b=He.a.fromData({pairs:{indexA:h,indexB:g,order:v},count:r.count}),He.a.Provider.set(m.representative,b)),[2,m]}}))}))}(e,t)}))}!function(e){e.is=function(e){return"mol"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"mol",name:e.title,data:e}}}(ze||(ze={}));var qe,We,Xe,Ye=r(9),Qe=r(95),Ke=r(218);function Ze(e,t,r){var i;return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,o,s,c,l,d,f,p,m,h,v,b,y,_,x,O,w,C,j,P,E,A,D,T,I,M,k,B,V,R,L,N,F,z,H,G,W,X,Y,Q,K,J,$,ee,ne,ie,ae,oe,se,ue,ce,le;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(a=e.atom_site._rowCount,o=u.a.ofConst("MOL",a,u.a.Schema.str),s=u.a.ofConst("A",a,u.a.Schema.str),c=u.a.ofConst(1,a,u.a.Schema.int),l=function(e){var t=e.cell,r=function(e){var t=e.IT_number.value(0),r=e["name_H-M_full"].value(0);return e.IT_number.isDefined?(e["name_H-M_full"].isDefined,t):r}(e.space_group),n=Ye.f.create(r,g.Vec3.create(t.length_a.value(0),t.length_b.value(0),t.length_c.value(0)),g.Vec3.scale(Object(g.Vec3)(),g.Vec3.create(t.angle_alpha.value(0),t.angle_beta.value(0),t.angle_gamma.value(0)),Math.PI/180));return{spacegroup:Ye.e.create(n),assemblies:[],isNonStandardCrystalFrame:!1,ncsOperators:[]}}(e),d=l.spacegroup.cell.fromFractional,f=e.atom_site,p=f.fract_x,m=f.fract_y,h=f.fract_z,v=new Float32Array(a),b=new Float32Array(a),y=new Float32Array(a),_=Object(g.Vec3)(),oe=0;oe<a;++oe)g.Vec3.set(_,p.value(oe),m.value(oe),h.value(oe)),g.Vec3.transformMat4(_,_,d),v[oe]=_[0],b[oe]=_[1],y[oe]=_[2];if(x=e.atom_site,O=x.type_symbol,w=x.label,O.isDefined){for(D=new Array(a),P=new Int8Array(a),oe=0;oe<a;++oe)E=O.value(oe),A=E.length,"+"===E[A-1]?(D[oe]=E.substring(0,A-2),P[oe]=parseInt(E[A-2])):"+"===E[A-2]?(D[oe]=E.substring(0,A-2),P[oe]=parseInt(E[A-1])):"-"===E[A-1]?(D[oe]=E.substring(0,A-2),P[oe]=-parseInt(E[A-2])):"-"===E[A-2]?(D[oe]=E.substring(0,A-2),P[oe]=-parseInt(E[A-1])):(D[oe]=E,P[oe]=0);C=u.a.ofStringArray(D),j=u.a.ofIntArray(P)}else{for(D=new Array(a),oe=0;oe<a;++oe)D[oe]=U(w.value(oe));C=u.a.ofStringArray(D),j=u.a.Undefined(a,u.a.Schema.int)}return T=u.d.ofPartialColumns(q.a.atom_site,{auth_asym_id:s,auth_atom_id:w,auth_comp_id:o,auth_seq_id:c,Cartn_x:u.a.ofFloatArray(v),Cartn_y:u.a.ofFloatArray(b),Cartn_z:u.a.ofFloatArray(y),id:u.a.range(0,a-1),label_asym_id:s,label_atom_id:w,label_comp_id:o,label_seq_id:c,label_entity_id:u.a.ofConst("1",a,u.a.Schema.str),occupancy:e.atom_site.occupancy.isDefined?e.atom_site.occupancy:u.a.ofConst(1,a,u.a.Schema.float),type_symbol:C,pdbx_formal_charge:j,pdbx_PDB_model_num:u.a.ofConst(1,a,u.a.Schema.int),B_iso_or_equiv:e.atom_site.U_iso_or_equiv},a),I=e.chemical.name_common.value(0)||e.chemical.name_systematic.value(0)||e.chemical_formula.sum.value(0),(M=new te).setNames([["MOL",I||"Unknown Entity"]]),M.getEntityId("MOL",0,"A"),(k=new Z(c,e.atom_site.type_symbol)).setNames([["MOL",I||"Unknown Molecule"]]),k.add("MOL",0),B=Object(q.b)({entity:M.getEntityTable(),chem_comp:k.getChemCompTable(),atom_site:T}),[4,Object(re.a)(B,t,r)];case 1:if((V=n.sent()).frameCount>0&&(R=V.representative,Qe.a.Provider.set(R,l),(L=e.geom_bond._rowCount)>0)){for(N={},F=e.atom_site.label,oe=0,z=F.rowCount;oe<z;++oe)N[F.value(oe)]=oe;for(H=null===(i=t.data.frame.categories.ccdc_geom_bond_type)||void 0===i?void 0:i.getField(""),G=[],W=[],X=[],Y=[],Q=[],K=new Set,J=0,$=e.geom_bond,ee=$.atom_site_label_1,ne=$.atom_site_label_2,ie=$.valence,ae=$.distance,oe=0;oe<L;++oe)se=N[ee.value(oe)],ue=N[ne.value(oe)],ce=se<ue?Object(S.f)(se,ue):Object(S.f)(ue,se),K.has(ce)||(K.add(ce),G[J]=se,W[J]=ue,Y[J]=ae.value(oe)||-1,H?"D"===(le=H.str(oe))?(X[J]=2,Q[J]=1):"A"===le?(X[J]=1,Q[J]=17):(X[J]=1,Q[J]=1):(Q[J]=1,X[J]=ie.isDefined?ie.value(oe):1),J+=1);He.a.Provider.set(R,He.a.fromData({pairs:{indexA:u.a.ofIntArray(G),indexB:u.a.ofIntArray(W),order:u.a.ofIntArray(X),distance:u.a.ofFloatArray(Y),flag:u.a.ofIntArray(Q)},count:a}))}return[2,V]}}))}))}function Je(e){return a.b.create("Parse Cube",(function(t){return function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,s,c,l,d,f;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r=e.atoms,i=u.a.ofConst("MOL",e.atoms.count,u.a.Schema.str),a=u.a.ofConst("A",e.atoms.count,u.a.Schema.str),o=u.a.ofArray({array:u.a.mapToArray(r.number,(function(e){return Object(H.getElementFromAtomicNumber)(e)})),schema:u.a.Schema.Aliased(u.a.Schema.str)}),s=u.a.ofConst(1,r.count,u.a.Schema.int),c=u.d.ofPartialColumns(q.a.atom_site,{auth_asym_id:a,auth_atom_id:o,auth_comp_id:i,auth_seq_id:s,Cartn_x:u.a.asArrayColumn(r.x,Float32Array),Cartn_y:u.a.asArrayColumn(r.y,Float32Array),Cartn_z:u.a.asArrayColumn(r.z,Float32Array),id:u.a.range(0,r.count-1),label_asym_id:a,label_atom_id:o,label_comp_id:i,label_seq_id:s,label_entity_id:u.a.ofConst("1",r.count,u.a.Schema.str),occupancy:u.a.ofConst(1,r.count,u.a.Schema.float),type_symbol:o,pdbx_PDB_model_num:u.a.ofConst(1,r.count,u.a.Schema.int)},r.count),(l=new te).setNames([["MOL","Unknown Entity"]]),l.getEntityId("MOL",0,"A"),(d=new Z(s,o)).setNames([["MOL","Unknown Molecule"]]),d.add("MOL",0),f=Object(q.b)({entity:l.getEntityTable(),chem_comp:d.getChemCompTable(),atom_site:c}),[4,Object(re.a)(f,Xe.create(e),t)];case 1:return[2,n.sent()]}}))}))}(e,t)}))}Ke.a.Provider.formatRegistry.add("cifCore",(function(e){if(qe.is(e.sourceData)){var t=e.sourceData.data.db,r=t.atom_site,n=t.atom_site_aniso;return{data:u.d.ofPartialColumns(Ke.a.Schema,{U:n.U,U_esd:n.U_su},n._rowCount),elementToAnsiotrop:Ke.a.getElementToAnsiotropFromLabel(r.label,n.label)}}}),(function(e){return!!qe.is(e.sourceData)&&e.sourceData.data.db.atom_site_aniso.U.isDefined})),(We=qe||(qe={})).is=function(e){return"cifCore"===(null==e?void 0:e.kind)},We.fromFrame=function(e,t){return t||(t=oe.a.schema.cifCore(e)),{kind:"cifCore",name:t.database_code.depnum_ccdc_archive.value(0)||t.database_code.depnum_ccdc_fiz.value(0)||t.database_code.ICSD.value(0)||t.database_code.MDF.value(0)||t.database_code.NBS.value(0)||t.database_code.CSD.value(0)||t.database_code.COD.value(0)||t._name,data:{db:t,frame:e}}},function(e){e.is=function(e){return"cube"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"cube",name:e.header.comment1,data:e}}}(Xe||(Xe={}));var $e=c.b.skipWhitespace,et=c.b.eatValue,tt=c.b.markLine,rt=c.b.getTokenString,nt=c.b.readLine;var it,at=/\s+/g;function ot(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,o,s,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C,j;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(t=e.tokenizer,r=e.molecule;"@<TRIPOS>ATOM"!==rt(t)&&t.position<t.data.length;)tt(t);return i=t.position,o=t.lineNumber,s=nt(t),l=s.trim().split(/\s+/g),d=l.length,f=c.a.create(t.data,2*r.num_atoms),p=c.a.create(t.data,2*r.num_atoms),m=c.a.create(t.data,2*r.num_atoms),h=c.a.create(t.data,2*r.num_atoms),g=c.a.create(t.data,2*r.num_atoms),v=c.a.create(t.data,2*r.num_atoms),b=c.a.create(t.data,2*r.num_atoms),y=c.a.create(t.data,2*r.num_atoms),_=c.a.create(t.data,2*r.num_atoms),S=c.a.create(t.data,2*r.num_atoms),x=u.a.Undefined(r.num_atoms,u.a.Schema.float),O=u.a.Undefined(r.num_atoms,u.a.Schema.int),w=u.a.Undefined(r.num_atoms,u.a.Schema.str),t.position=i,t.lineNumber=o,C=t.length,j=0,[4,Object(a.c)(e.runtimeCtx,1e5,void 0,(function(e){for(var n=Math.min(r.num_atoms-j,e),i=0;i<n;i++)for(var a=0;a<d;a++)switch($e(t),t.tokenStart=t.position,et(t),a){case 0:c.a.addUnchecked(f,t.tokenStart,t.tokenEnd);break;case 1:c.a.addUnchecked(p,t.tokenStart,t.tokenEnd);break;case 2:c.a.addUnchecked(m,t.tokenStart,t.tokenEnd);break;case 3:c.a.addUnchecked(h,t.tokenStart,t.tokenEnd);break;case 4:c.a.addUnchecked(g,t.tokenStart,t.tokenEnd);break;case 5:c.a.addUnchecked(v,t.tokenStart,t.tokenEnd);break;case 6:c.a.addUnchecked(b,t.tokenStart,t.tokenEnd);break;case 7:c.a.addUnchecked(y,t.tokenStart,t.tokenEnd);break;case 8:c.a.addUnchecked(_,t.tokenStart,t.tokenEnd);break;case 9:c.a.addUnchecked(S,t.tokenStart,t.tokenEnd)}return j+=n,n}),(function(e){return e.update({message:"Parsing...",current:t.position,max:C})}))];case 1:return n.sent(),[2,{count:r.num_atoms,atom_id:Object(Ne.c)(f)(u.a.Schema.int),atom_name:Object(Ne.c)(p)(u.a.Schema.str),x:Object(Ne.c)(m)(u.a.Schema.float),y:Object(Ne.c)(h)(u.a.Schema.float),z:Object(Ne.c)(g)(u.a.Schema.float),atom_type:d>5?Object(Ne.c)(v)(u.a.Schema.str):w,subst_id:d>6?Object(Ne.c)(b)(u.a.Schema.int):O,subst_name:d>7?Object(Ne.c)(y)(u.a.Schema.str):w,charge:d>8?Object(Ne.c)(_)(u.a.Schema.float):x,status_bit:d>9?Object(Ne.c)(S)(u.a.Schema.str):w}]}}))}))}function st(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,o,s,l,d,f,p,m,h,g,v,b;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(t=e.tokenizer,r=e.molecule;"@<TRIPOS>BOND"!==rt(t)&&t.position<t.data.length;)tt(t);return i=t.position,o=t.lineNumber,s=nt(t),l=s.trim().split(/\s+/g),d=l.length,f=c.a.create(t.data,2*r.num_bonds),p=c.a.create(t.data,2*r.num_bonds),m=c.a.create(t.data,2*r.num_bonds),h=c.a.create(t.data,2*r.num_bonds),g=c.a.create(t.data,2*r.num_bonds),t.position=i,t.lineNumber=o,v=t.length,b=0,[4,Object(a.c)(e.runtimeCtx,1e5,void 0,(function(e){for(var n=Math.min(r.num_bonds-b,e),i=0;i<n;i++)for(var a=0;a<d;a++)switch($e(t),t.tokenStart=t.position,et(t),a){case 0:c.a.addUnchecked(f,t.tokenStart,t.tokenEnd);break;case 1:c.a.addUnchecked(p,t.tokenStart,t.tokenEnd);break;case 2:c.a.addUnchecked(m,t.tokenStart,t.tokenEnd);break;case 3:c.a.addUnchecked(h,t.tokenStart,t.tokenEnd);break;default:c.a.addUnchecked(g,t.tokenStart,t.tokenEnd)}return b+=n,n}),(function(e){return e.update({message:"Parsing...",current:t.position,max:v})}))];case 1:return n.sent(),[2,{count:r.num_bonds,bond_id:Object(Ne.c)(f)(u.a.Schema.int),origin_atom_id:Object(Ne.c)(p)(u.a.Schema.int),target_atom_id:Object(Ne.c)(m)(u.a.Schema.int),bond_type:Object(Ne.c)(h)(u.a.Schema.str),status_bits:d>4?Object(Ne.c)(g)(u.a.Schema.str):u.a.Undefined(r.num_bonds,u.a.Schema.str)}]}}))}))}function ut(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,o,s,u,l,d;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:a=Object(c.b)(t),e.update({message:"Parsing...",current:0,max:t.length}),o=[],n.label=1;case 1:return a.position<t.length?(function(e){for(var t=e.tokenizer,r=e.molecule;"@<TRIPOS>MOLECULE"!==rt(t)&&t.position<t.data.length;)tt(t);tt(t),r.mol_name=rt(t),tt(t);var n=rt(t).trim().split(at);r.num_atoms=parseInt(n[0]),r.num_bonds=parseInt(n[1]),r.num_subst=parseInt(n[2]),r.num_feat=parseInt(n[3]),r.num_sets=parseInt(n[4]),tt(t);var i=rt(t);if(!i.startsWith("@<TRIPOS>")){r.mol_type=i,tt(t);var a=rt(t);if(!a.startsWith("@<TRIPOS>")){r.charge_type=a,tt(t);var o=rt(t);if(!o.startsWith("@<TRIPOS>")){r.status_bits=o,tt(t);var s=rt(t);s.startsWith("@<TRIPOS>")||(r.mol_comment=s)}}}}(s=function(e,t){return{tokenizer:e,molecule:{mol_name:"",num_atoms:0,num_bonds:0,num_subst:0,num_feat:0,num_sets:0,mol_type:"",charge_type:"",status_bits:"",mol_comment:""},runtimeCtx:t}}(a,e)),[4,ot(s)]):[3,4];case 2:return u=n.sent(),[4,st(s)];case 3:for(l=n.sent(),o.push({molecule:s.molecule,atoms:u,bonds:l}),$e(a);"@<TRIPOS>MOLECULE"!==rt(a)&&a.position<a.data.length;)tt(a);return[3,1];case 4:return d={name:r,structures:o},[2,i.a.success(d)]}}))}))}function ct(e,t){var r=this;return a.b.create("Parse MOL2",(function(i){return Object(n.__awaiter)(r,void 0,void 0,(function(){return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return[4,ut(i,e,t)];case 1:return[2,r.sent()]}}))}))}))}function lt(e){return a.b.create("Parse MOL2",(function(t){return function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,s,c,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:r=[],i=0,a=e.structures.length,n.label=1;case 1:if(!(i<a))return[3,4];for(o=e.structures[i],s=o.atoms,c=o.bonds,l=o.molecule,d=u.a.ofConst("A",s.count,u.a.Schema.str),f=new Array(s.count),p=0;p<s.count;++p)f[p]=U(s.atom_name.value(p));for(m=u.d.ofPartialColumns(q.a.atom_site,{auth_asym_id:d,auth_atom_id:u.a.asArrayColumn(s.atom_name),auth_comp_id:s.subst_name,auth_seq_id:s.subst_id,Cartn_x:u.a.asArrayColumn(s.x,Float32Array),Cartn_y:u.a.asArrayColumn(s.y,Float32Array),Cartn_z:u.a.asArrayColumn(s.z,Float32Array),id:u.a.asArrayColumn(s.atom_id),label_asym_id:d,label_atom_id:u.a.asArrayColumn(s.atom_name),label_comp_id:s.subst_name,label_seq_id:s.subst_id,label_entity_id:u.a.ofConst("1",s.count,u.a.Schema.str),occupancy:u.a.ofConst(1,s.count,u.a.Schema.float),type_symbol:u.a.ofStringArray(f),pdbx_PDB_model_num:u.a.ofConst(i,s.count,u.a.Schema.int)},s.count),(h=new te).setNames([["MOL",l.mol_name||"Unknown Entity"]]),h.getEntityId("MOL",0,"A"),g=new Z(s.subst_id,s.atom_name),v=0,b=s.subst_name.rowCount;v<b;++v)g.add(s.subst_name.value(v),v);return y=Object(q.b)({entity:h.getEntityTable(),chem_comp:g.getChemCompTable(),atom_site:m}),[4,Object(re.a)(y,it.create(e),t)];case 2:(_=n.sent()).frameCount>0&&(S=u.a.ofIntArray(u.a.mapToArray(c.origin_atom_id,(function(e){return e-1}),Int32Array)),x=u.a.ofIntArray(u.a.mapToArray(c.target_atom_id,(function(e){return e-1}),Int32Array)),O=u.a.ofIntArray(u.a.mapToArray(c.bond_type,(function(e){return"ar"===e?1:parseInt(e)}),Int8Array)),w=He.a.fromData({pairs:{indexA:S,indexB:x,order:O},count:s.count}),C=_.representative,He.a.Provider.set(C,w),Oe.a.Provider.set(C,{data:s.charge,type:l.charge_type}),r.push(C)),n.label=3;case 3:return++i,[3,1];case 4:return[2,new Ae.ArrayTrajectory(r)]}}))}))}(e,t)}))}!function(e){e.is=function(e){return"mol2"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"mol2",name:e.name,data:e}}}(it||(it={}));var dt,ft=new Uint32Array([0,0,0,0,0,0,0,0,0,8,10,12,16,20,25,32,40,50,64,80,101,128,161,203,256,322,406,512,645,812,1024,1290,1625,2048,2580,3250,4096,5060,6501,8192,10321,13003,16384,20642,26007,32768,41285,52015,65536,82570,104031,131072,165140,208063,262144,330280,416127,524287,660561,832255,1048576,1321122,1664510,2097152,2642245,3329021,4194304,5284491,6658042,8388607,10568983,13316085,16777216]);function pt(){throw new Error("(xdrfile error) Undefined error.")}function mt(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C,j,P,E,A,D,T,I,M,k,B;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:r=new DataView(t.buffer,t.byteOffset),a=(i={frames:[],boxes:[],times:[],timeOffset:0,deltaTime:0}).frames,o=i.boxes,s=i.times,u=[0,0,0,0,0,0],c=[0,0,0],l=[0,0,0],d=[0,0,0],f=[.1,.1,.1],p=[.1,.1,.1],m=0,h=dt.buf,n.label=1;case 1:for(g=void 0,v=r.getInt32(m+4),m+=12,s.push(r.getFloat32(m)),m+=4,b=new Float32Array(9),D=0;D<9;++D)b[D]=10*r.getFloat32(m),m+=4;if(o.push(b),v<=9)for(g={count:v/3,x:new Float32Array(v/3),y:new Float32Array(v/3),z:new Float32Array(v/3)},D=0;D<v/3;++D)g.x[D]=r.getFloat32(m),g.y[D]=r.getFloat32(m),g.z[D]=r.getFloat32(m),m+=4;else{for(h[0]=h[1]=h[2]=0,c[0]=c[1]=c[2]=0,d[0]=d[1]=d[2]=0,l[0]=l[1]=l[2]=0,f[0]=f[1]=f[2]=0,p[0]=p[1]=p[2]=0,g={count:v,x:new Float32Array(v),y:new Float32Array(v),z:new Float32Array(v)},y=0,_=r.getInt32(m),m+=4,S=r.getFloat32(m),m+=4,u[0]=r.getInt32(m),u[1]=r.getInt32(m+4),u[2]=r.getInt32(m+8),u[3]=r.getInt32(m+12),u[4]=r.getInt32(m+16),u[5]=r.getInt32(m+20),c[0]=u[3]-u[0]+1,c[1]=u[4]-u[1]+1,c[2]=u[5]-u[2]+1,m+=24,x=void 0,(c[0]|c[1]|c[2])>16777215?(l[0]=dt.sizeOfInt(c[0]),l[1]=dt.sizeOfInt(c[1]),l[2]=dt.sizeOfInt(c[2]),x=0):x=dt.sizeOfInts(3,c),O=r.getInt32(m),m+=4,C=ft[w=9>(w=O-1)?9:w]/2|0,j=ft[O]/2|0,d[0]=d[1]=d[2]=ft[O],P=4*Math.ceil(r.getInt32(m)/4),m+=4,E=1/S,A=0,D=0,f[0]=f[1]=f[2]=0;D<_;){if(0===x?(f[0]=dt.decodeBits(t,m,l[0]),f[1]=dt.decodeBits(t,m,l[1]),f[2]=dt.decodeBits(t,m,l[2])):dt.decodeInts(t,m,x,c,f),D++,f[0]+=u[0],f[1]+=u[1],f[2]+=u[2],p[0]=f[0],p[1]=f[1],p[2]=f[2],T=dt.decodeBits(t,m,1),I=0,1===T&&(A=dt.decodeBits(t,m,5),A-=I=A%3,I--),A>0)for(f[0]=f[1]=f[2]=0,M=0;M<A;M+=3)dt.decodeInts(t,m,O,d,f),D++,f[0]+=p[0]-j,f[1]+=p[1]-j,f[2]+=p[2]-j,0===M?(k=f[0],f[0]=p[0],p[0]=k,k=f[1],f[1]=p[1],p[1]=k,k=f[2],f[2]=p[2],p[2]=k,g.x[y]=p[0]*E,g.y[y]=p[1]*E,g.z[y]=p[2]*E,y++):(p[0]=f[0],p[1]=f[1],p[2]=f[2]),g.x[y]=f[0]*E,g.y[y]=f[1]*E,g.z[y]=f[2]*E,y++;else g.x[y]=f[0]*E,g.y[y]=f[1]*E,g.z[y]=f[2]*E,y++;O+=I,I<0?(j=C,C=O>9?ft[O-1]/2|0:0):I>0&&(C=j,j=ft[O]/2|0),d[0]=d[1]=d[2]=ft[O],0!==d[0]&&0!==d[1]&&0!==d[2]||pt()}m+=P}for(B=0;B<v;B++)g.x[B]*=10,g.y[B]*=10,g.z[B]*=10;return a.push(g),e.shouldUpdate?[4,e.update({current:m,max:t.length})]:[3,3];case 2:n.sent(),n.label=3;case 3:return m>=t.length?[3,4]:[3,1];case 4:return s.length>=1&&(i.timeOffset=s[0]),s.length>=2&&(i.deltaTime=s[1]-s[0]),[2,i]}}))}))}function ht(e){var t=this;return a.b.create("Parse XTC",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),r.update({canAbort:!0,message:"Parsing trajectory..."}),[4,mt(r,e)];case 1:return t=n.sent(),[2,i.a.success(t)];case 2:return a=n.sent(),[2,i.a.error(""+a)];case 3:return[2]}}))}))}))}function gt(e){var t=this;return a.b.create("Parse XTC",(function(r){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,a,o,s,u,c,l,d;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,r.update("Converting to coordinates")];case 1:for(n.sent(),t=Object(B.b)(e.deltaTime,"step"),i=Object(B.b)(e.timeOffset,t.unit),a=[],o=0,s=e.frames.length;o<s;++o)u=e.boxes[o],c=g.Vec3.fromArray(Object(g.Vec3)(),u,0),l=g.Vec3.fromArray(Object(g.Vec3)(),u,3),d=g.Vec3.fromArray(Object(g.Vec3)(),u,6),a.push({elementCount:e.frames[o].count,cell:R.fromBasis(c,l,d),x:e.frames[o].x,y:e.frames[o].y,z:e.frames[o].z,time:Object(B.b)(i.value+t.value*o,t.unit)});return[2,B.a.create(a,t,i)]}}))}))}))}!function(e){e.sizeOfInt=function(e){for(var t=1,r=0;e>=t&&r<32;)r++,t<<=1;return r};var t=new Uint8Array(32);e.sizeOfInts=function(e,r){var n=1,i=0;t[0]=1;for(var a=0;a<e;a++){var o=void 0,s=0;for(o=0;o<n;o++)s+=t[o]*r[a],t[o]=255&s,s>>=8;for(;0!==s;)t[o++]=255&s,s>>=8;n=o}var u=1;for(n--;t[n]>=u;)i++,u*=2;return i+8*n};var r=new ArrayBuffer(24);e.buf=new Int32Array(r);var n=new Uint32Array(r);function i(t,r,i){for(var a=i,o=(1<<a)-1,s=n[1],u=n[2],c=e.buf[0],l=0;a>=8;)l|=(u=u<<8|t[r+c++])>>s<<a-8,a-=8;return a>0&&(s<a&&(s+=8,u=u<<8|t[r+c++]),l|=u>>(s-=a)&(1<<a)-1),l&=o,e.buf[0]=c,e.buf[1]=s,e.buf[2]=u,l}function a(t,r){var i=n[2],a=e.buf[0];return i=i<<8|t[r+a],e.buf[0]=a+1,e.buf[2]=i,i>>n[1]&255}e.decodeBits=i;var o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];e.decodeInts=function(e,t,r,n,s){var u=r,c=0;for(o[0]=0,o[1]=0,o[2]=0,o[3]=0;u>8;)o[c++]=a(e,t),u-=8;u>0&&(o[c++]=i(e,t,u));for(var l=2;l>0;l--){for(var d=0,f=n[l],p=c-1;p>=0;p--){var m=(d=d<<8|o[p])/f|0;o[p]=m,d-=m*f}s[l]=d}s[0]=o[0]|o[1]<<8|o[2]<<16|o[3]<<24}}(dt||(dt={}));var vt=Ve.b.BuiltIn({name:"coordinates-from-dcd",display:{name:"Parse DCD",description:"Parse DCD binary data."},from:[Ve.a.Data.Binary],to:Ve.a.Molecule.Coordinates})({apply:function(e){var t=this,r=e.a;return a.b.create("Parse DCD",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,s(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[4,L(t.result).runInContext(e)];case 2:return i=n.sent(),[2,new Ve.a.Molecule.Coordinates(i,{label:r.label,description:"Coordinates"})]}}))}))}))}}),bt=Ve.b.BuiltIn({name:"coordinates-from-xtc",display:{name:"Parse XTC",description:"Parse XTC binary data."},from:[Ve.a.Data.Binary],to:Ve.a.Molecule.Coordinates})({apply:function(e){var t=this,r=e.a;return a.b.create("Parse XTC",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,ht(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[4,gt(t.result).runInContext(e)];case 2:return i=n.sent(),[2,new Ve.a.Molecule.Coordinates(i,{label:r.label,description:"Coordinates"})]}}))}))}))}}),yt=Ve.b.BuiltIn({name:"topology-from-psf",display:{name:"PSF Topology",description:"Parse PSF string data."},from:[Ve.a.Format.Psf],to:Ve.a.Molecule.Topology})({apply:function(e){var t=this,r=e.a;return a.b.create("Create Topology",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,Pe(r.data).runInContext(e)];case 1:return t=n.sent(),[2,new Ve.a.Molecule.Topology(t,{label:t.label||r.label,description:"Topology"})]}}))}))}))}});function _t(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return t.type!==Ve.a.Molecule.Topology.type?[3,2]:(i=t.data,[4,Ae.Model.trajectoryFromTopologyAndCoordinates(i,r).runInContext(e)]);case 1:return[2,n.sent()];case 2:if(t.type===Ve.a.Molecule.Model.type)return a=t.data,[2,Ae.Model.trajectoryFromModelAndCoordinates(a,r)];n.label=3;case 3:throw new Error("no model/topology found")}}))}))}var St=Ve.b.BuiltIn({name:"trajectory-from-model-and-coordinates",display:{name:"Trajectory from Topology & Coordinates",description:"Create a trajectory from existing model/topology and coordinates."},from:Ve.a.Root,to:Ve.a.Molecule.Trajectory,params:{modelRef:O.ParamDefinition.Text("",{isHidden:!0}),coordinatesRef:O.ParamDefinition.Text("",{isHidden:!0})}})({apply:function(e){var t=this,r=e.params,i=e.dependencies;return a.b.create("Create trajectory from model/topology and coordinates",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,a,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return t=i[r.coordinatesRef].data,[4,_t(e,i[r.modelRef],t)];case 1:return a=n.sent(),o={label:"Trajectory",description:a.frameCount+" model"+(1===a.frameCount?"":"s")},[2,new Ve.a.Molecule.Trajectory(a,o)]}}))}))}))}}),xt=Ve.b.BuiltIn({name:"trajectory-from-blob",display:{name:"Parse Blob",description:"Parse format blob into a single trajectory."},from:Ve.a.Format.Blob,to:Ve.a.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return a.b.create("Parse Format Blob",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,o,s,u,c,l,d,f;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:t=[],i=0,o=r.data,n.label=1;case 1:return i<o.length?"cif"!==(s=o[i]).kind?[3,6]:(u=s.data.blocks[0],[4,Object(ae.b)(u).runInContext(e)]):[3,7];case 2:if(0===(c=n.sent()).frameCount)throw new Error("No models found.");d=0,n.label=3;case 3:return d<c.frameCount?[4,a.b.resolveInContext(c.getFrameAtIndex(d),e)]:[3,6];case 4:l=n.sent(),t.push(l),n.label=5;case 5:return d++,[3,3];case 6:return i++,[3,1];case 7:for(d=0;d<t.length;d++)Ae.Model.TrajectoryInfo.set(t[d],{index:d,size:t.length});return f={label:"Trajectory",description:t.length+" model"+(1===t.length?"":"s")},[2,new Ve.a.Molecule.Trajectory(new Ae.ArrayTrajectory(t),f)]}}))}))}))}});function Ot(e){return{label:""+e.representative.entry,description:e.frameCount+" model"+(1===e.frameCount?"":"s")}}var wt=Ve.b.BuiltIn({name:"trajectory-from-mmcif",display:{name:"Trajectory from mmCIF",description:"Identify and create all separate models in the specified CIF data block"},from:Ve.a.Format.Cif,to:Ve.a.Molecule.Trajectory,params:function(e){if(!e)return{blockHeader:O.ParamDefinition.Optional(O.ParamDefinition.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."}))};var t=e.data.blocks;return{blockHeader:O.ParamDefinition.Optional(O.ParamDefinition.Select(t[0]&&t[0].header,t.map((function(e){return[e.header,e.header]})),{description:"Header of the block to parse"}))}}})({isApplicable:function(e){return e.data.blocks.length>0},apply:function(e){var t=this,r=e.a,i=e.params;return a.b.create("Parse mmCIF",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,a,o,s;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(t=i.blockHeader||r.data.blocks[0].header,!(a=r.data.blocks.find((function(e){return e.header===t}))))throw new Error("Data block '"+[t]+"' not found.");return[4,Object(ae.b)(a).runInContext(e)];case 1:if(0===(o=n.sent()).frameCount)throw new Error("No models found.");return s=Ot(o),[2,new Ve.a.Molecule.Trajectory(o,s)]}}))}))}))}}),Ct=Ve.b.BuiltIn({name:"trajectory-from-pdb",display:{name:"Parse PDB",description:"Parse PDB string and create trajectory."},from:[Ve.a.Data.String],to:Ve.a.Molecule.Trajectory,params:{isPdbqt:O.ParamDefinition.Boolean(!1)}})({apply:function(e){var t=this,r=e.a,i=e.params;return a.b.create("Parse PDB",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,a,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,h(r.data,r.label,i.isPdbqt).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[4,we(t.result).runInContext(e)];case 2:return a=n.sent(),o=Ot(a),[2,new Ve.a.Molecule.Trajectory(a,o)]}}))}))}))}}),jt=Ve.b.BuiltIn({name:"trajectory-from-gro",display:{name:"Parse GRO",description:"Parse GRO string and create trajectory."},from:[Ve.a.Data.String],to:Ve.a.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return a.b.create("Parse GRO",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,m(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[4,ie(t.result).runInContext(e)];case 2:return i=n.sent(),a=Ot(i),[2,new Ve.a.Molecule.Trajectory(i,a)]}}))}))}))}}),Pt=Ve.b.BuiltIn({name:"trajectory-from-mol",display:{name:"Parse MOL",description:"Parse MOL string and create trajectory."},from:[Ve.a.Data.String],to:Ve.a.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return a.b.create("Parse MOL",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,Ue(r.data).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[4,Ge(t.result).runInContext(e)];case 2:return i=n.sent(),a=Ot(i),[2,new Ve.a.Molecule.Trajectory(i,a)]}}))}))}))}}),Et=Ve.b.BuiltIn({name:"trajectory-from-mol2",display:{name:"Parse MOL2",description:"Parse MOL2 string and create trajectory."},from:[Ve.a.Data.String],to:Ve.a.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return a.b.create("Parse MOL2",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,ct(r.data,r.label).runInContext(e)];case 1:if((t=n.sent()).isError)throw new Error(t.message);return[4,lt(t.result).runInContext(e)];case 2:return i=n.sent(),a=Ot(i),[2,new Ve.a.Molecule.Trajectory(i,a)]}}))}))}))}}),At=Ve.b.BuiltIn({name:"trajectory-from-cube",display:{name:"Parse Cube",description:"Parse Cube file to create a trajectory."},from:Ve.a.Format.Cube,to:Ve.a.Molecule.Trajectory})({apply:function(e){var t=this,r=e.a;return a.b.create("Parse MOL",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,Je(r.data).runInContext(e)];case 1:return t=n.sent(),i=Ot(t),[2,new Ve.a.Molecule.Trajectory(t,i)]}}))}))}))}}),Dt=Ve.b.BuiltIn({name:"trajectory-from-cif-core",display:{name:"Parse CIF Core",description:"Identify and create all separate models in the specified CIF data block"},from:Ve.a.Format.Cif,to:Ve.a.Molecule.Trajectory,params:function(e){if(!e)return{blockHeader:O.ParamDefinition.Optional(O.ParamDefinition.Text(void 0,{description:"Header of the block to parse. If none is specifed, the 1st data block in the file is used."}))};var t=e.data.blocks;return{blockHeader:O.ParamDefinition.Optional(O.ParamDefinition.Select(t[0]&&t[0].header,t.map((function(e){return[e.header,e.header]})),{description:"Header of the block to parse"}))}}})({apply:function(e){var t=this,r=e.a,i=e.params;return a.b.create("Parse CIF Core",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,o,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(t=i.blockHeader||r.data.blocks[0].header,!(o=r.data.blocks.find((function(e){return e.header===t}))))throw new Error("Data block '"+[t]+"' not found.");return[4,(c=o,l=qe.fromFrame(c),a.b.create("Parse CIF Core",(function(e){return Ze(l.data.db,l,e)}))).runInContext(e)];case 1:if(0===(s=n.sent()).frameCount)throw new Error("No models found.");return u=Ot(s),[2,new Ve.a.Molecule.Trajectory(s,u)]}var c,l}))}))}))}}),Tt=function(e){return e+1},It=function(e){return e-1},Mt=Ve.b.BuiltIn({name:"model-from-trajectory",display:{name:"Molecular Model",description:"Create a molecular model from specified index in a trajectory."},from:Ve.a.Molecule.Trajectory,to:Ve.a.Molecule.Model,params:function(e){return e?{modelIndex:O.ParamDefinition.Converted(Tt,It,O.ParamDefinition.Numeric(1,{min:1,max:e.data.frameCount,step:1},{description:"Model Index"}))}:{modelIndex:O.ParamDefinition.Numeric(0,{},{description:"Zero-based index of the model"})}}})({isApplicable:function(e){return e.data.frameCount>0},apply:function(e){var t=this,r=e.a,i=e.params;return a.b.create("Model from Trajectory",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,o,s,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return(t=i.modelIndex%r.data.frameCount)<0&&(t+=r.data.frameCount),[4,a.b.resolveInContext(r.data.getFrameAtIndex(t),e)];case 1:return o=n.sent(),s="Model "+(t+1),u=1===r.data.frameCount?void 0:"of "+r.data.frameCount,[2,new Ve.a.Molecule.Model(o,{label:s,description:u})]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customProperties.dispose()}}),kt=Ve.b.BuiltIn({name:"structure-from-trajectory",display:{name:"Structure from Trajectory",description:"Create a molecular structure from a trajectory."},from:Ve.a.Molecule.Trajectory,to:Ve.a.Molecule.Structure})({apply:function(e){var t=this,r=e.a;return a.b.create("Build Structure",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,Ae.Structure.ofTrajectory(r.data,e)];case 1:return t=n.sent(),i={label:"Ensemble",description:Ae.Structure.elementDescription(t)},[2,new Ve.a.Molecule.Structure(t,i)]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Bt=Ve.b.BuiltIn({name:"structure-from-model",display:{name:"Structure",description:"Create a molecular structure (model, assembly, or symmetry) from the specified model."},from:Ve.a.Molecule.Model,to:Ve.a.Molecule.Structure,params:function(e){return ke.a.getParams(e&&e.data)}})({canAutoUpdate:function(e){var t=e.oldParams,r=e.newParams;return ke.a.canAutoUpdate(t.type,r.type)},apply:function(e,t){var r=this,i=e.a,o=e.params;return a.b.create("Build Structure",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){return Object(n.__generator)(this,(function(r){return[2,ke.a.create(t,e,i.data,o&&o.type)]}))}))}))},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams;return Object(Me.g)(n,i)?r.data.model===t.data?Ie.StateTransformer.UpdateResult.Unchanged:Ae.Model.areHierarchiesEqual(t.data,r.data.model)?(r.data=r.data.remapModel(t.data),Ie.StateTransformer.UpdateResult.Updated):Ie.StateTransformer.UpdateResult.Recreate:Ie.StateTransformer.UpdateResult.Recreate},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Vt=Object(g.Vec3)(),Rt=Object(g.Mat4)(),Lt=Object(g.Mat4)(),Nt=Ve.b.BuiltIn({name:"transform-structure-conformation",display:{name:"Transform Conformation"},isDecorator:!0,from:Ve.a.Molecule.Structure,to:Ve.a.Molecule.Structure,params:{transform:O.ParamDefinition.MappedStatic("components",{components:O.ParamDefinition.Group({axis:O.ParamDefinition.Vec3(g.Vec3.create(1,0,0)),angle:O.ParamDefinition.Numeric(0,{min:-180,max:180,step:.1}),translation:O.ParamDefinition.Vec3(g.Vec3.create(0,0,0))},{isFlat:!0}),matrix:O.ParamDefinition.Group({data:O.ParamDefinition.Mat4(g.Mat4.identity()),transpose:O.ParamDefinition.Boolean(!1)},{isFlat:!0})},{label:"Kind"})}})({canAutoUpdate:function(e){return"matrix"!==e.newParams.transform.name},apply:function(e){var t=e.a,r=e.params,n=Object(g.Mat4)();if("components"===r.transform.name){var i=r.transform.params,a=i.axis,o=i.angle,s=i.translation,u=t.data.boundary.sphere.center;g.Mat4.fromTranslation(Rt,g.Vec3.negate(Vt,u)),g.Mat4.fromTranslation(Lt,g.Vec3.add(Vt,u,s));var c=g.Mat4.fromRotation(Object(g.Mat4)(),Math.PI/180*o,g.Vec3.normalize(Object(g.Vec3)(),a));g.Mat4.mul3(n,Lt,c,Rt)}else"matrix"===r.transform.name&&(g.Mat4.copy(n,r.transform.params.data),r.transform.params.transpose&&g.Mat4.transpose(n,n));var l=Ae.Structure.transform(t.data,n);return new Ve.a.Molecule.Structure(l,{label:t.label,description:t.description+" [Transformed]"})},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Ft=Ve.b.BuiltIn({name:"structure-selection-from-expression",display:{name:"Selection",description:"Create a molecular structure from the specified expression."},from:Ve.a.Molecule.Structure,to:Ve.a.Molecule.Structure,params:{expression:O.ParamDefinition.Value(De.MolScriptBuilder.struct.generator.all,{isHidden:!0}),label:O.ParamDefinition.Optional(O.ParamDefinition.Text("",{isHidden:!0}))}})({apply:function(e){var t=e.a,r=e.params,n=e.cache,i=Ee.createAndRun(t.data,r.expression),a=i.selection,o=i.entry;if(n.entry=o,Ae.StructureSelection.isEmpty(a))return Ie.StateObject.Null;var s=Ae.StructureSelection.unionStructure(a),u={label:""+(r.label||"Selection"),description:Ae.Structure.elementDescription(s)};return new Ve.a.Molecule.Structure(s,u)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;if(n.expression!==i.expression)return Ie.StateTransformer.UpdateResult.Recreate;var o=a.entry;if(o.currentStructure===t.data)return Ie.StateTransformer.UpdateResult.Unchanged;var s=Ee.updateStructure(o,t.data);return Ae.StructureSelection.isEmpty(s)?Ie.StateTransformer.UpdateResult.Null:(Ee.updateStructureObject(r,s,i.label),Ie.StateTransformer.UpdateResult.Updated)},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Ut=Ve.b.BuiltIn({name:"structure-multi-selection-from-expression",display:{name:"Multi-structure Measurement Selection",description:"Create selection object from multiple structures."},from:Ve.a.Root,to:Ve.a.Molecule.Structure.Selections,params:{selections:O.ParamDefinition.ObjectList({key:O.ParamDefinition.Text(void 0,{description:"A unique key."}),ref:O.ParamDefinition.Text(),groupId:O.ParamDefinition.Optional(O.ParamDefinition.Text()),expression:O.ParamDefinition.Value(De.MolScriptBuilder.struct.generator.empty)},(function(e){return e.ref}),{isHidden:!0}),isTransitive:O.ParamDefinition.Optional(O.ParamDefinition.Boolean(!1,{isHidden:!0,description:"Remap the selections from the original structure if structurally equivalent."})),label:O.ParamDefinition.Optional(O.ParamDefinition.Text("",{isHidden:!0}))}})({apply:function(e){for(var t=e.params,r=e.cache,n=e.dependencies,i=new Map,a=[],o=0,s=0,u=t.selections;s<u.length;s++){var c=u[s],l=Ee.createAndRun(n[c.ref].data,c.expression),d=l.selection,f=l.entry;i.set(c.key,f);var p=Ae.StructureSelection.toLociWithSourceUnits(d);a.push({key:c.key,loci:p,groupId:c.groupId}),o+=Ae.StructureElement.Loci.size(p)}r.entries=i;var m={label:""+(t.label||"Multi-selection"),description:t.selections.length+" source(s), "+o+" element(s) total"};return new Ve.a.Molecule.Structure.Selections(a,m)},update:function(e){var t=e.b,r=e.oldParams,n=e.newParams,i=e.cache,a=e.dependencies;if(!!r.isTransitive!=!!n.isTransitive)return Ie.StateTransformer.UpdateResult.Recreate;for(var o=i.entries,s=new Map,u=new Map,c=0,l=t.data;c<l.length;c++){var d=l[c];u.set(d.key,d)}for(var f=!1,p=0,m=[],h=0,g=n.selections;h<g.length;h++){var v=g[h],b=a[v.ref].data,y=!1;if(o.has(v.key)){var _=o.get(v.key);if(Ee.isUnchanged(_,v.expression,b)&&u.has(v.key)){(O=u.get(v.key)).groupId!==v.groupId&&(O.groupId=v.groupId,f=!0),s.set(v.key,_),m.push(O),p+=Ae.StructureElement.Loci.size(O.loci);continue}if(_.expression!==v.expression)y=!0;else{var S=!1;if(n.isTransitive)if(Ae.Structure.areUnitIdsAndIndicesEqual(_.originalStructure,b)){var x=Ee.run(_,_.originalStructure);_.currentStructure=b,s.set(v.key,_);var O=Ae.StructureElement.Loci.remap(Ae.StructureSelection.toLociWithSourceUnits(x),b);m.push({key:v.key,loci:O,groupId:v.groupId}),p+=Ae.StructureElement.Loci.size(O),f=!0}else S=!0;else S=!0;if(S){f=!0;x=Ee.updateStructure(_,b);s.set(v.key,_);O=Ae.StructureSelection.toLociWithSourceUnits(x);m.push({key:v.key,loci:O,groupId:v.groupId}),p+=Ae.StructureElement.Loci.size(O)}}}else y=!0;if(y){f=!0;var w=Ee.createAndRun(b,v.expression);x=w.selection,_=w.entry;s.set(v.key,_);O=Ae.StructureSelection.toLociWithSourceUnits(x);m.push({key:v.key,loci:O}),p+=Ae.StructureElement.Loci.size(O)}}return f?(i.entries=s,t.data=m,t.label=""+(n.label||"Multi-selection"),t.description=m.length+" source(s), "+p+" element(s) total",Ie.StateTransformer.UpdateResult.Updated):Ie.StateTransformer.UpdateResult.Unchanged}}),zt=Ve.b.BuiltIn({name:"structure-selection-from-script",display:{name:"Selection",description:"Create a molecular structure from the specified script."},from:Ve.a.Molecule.Structure,to:Ve.a.Molecule.Structure,params:{script:O.ParamDefinition.Script({language:"mol-script",expression:"(sel.atom.atom-groups :residue-test (= atom.resname ALA))"}),label:O.ParamDefinition.Optional(O.ParamDefinition.Text(""))}})({apply:function(e){var t=e.a,r=e.params,n=e.cache,i=Ee.createAndRun(t.data,r.script),a=i.selection,o=i.entry;n.entry=o;var s=Ae.StructureSelection.unionStructure(a),u={label:""+(r.label||"Selection"),description:Ae.Structure.elementDescription(s)};return new Ve.a.Molecule.Structure(s,u)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;if(!Te.Script.areEqual(n.script,i.script))return Ie.StateTransformer.UpdateResult.Recreate;var o=a.entry;if(o.currentStructure===t.data)return Ie.StateTransformer.UpdateResult.Unchanged;var s=Ee.updateStructure(o,t.data);return Ee.updateStructureObject(r,s,i.label),Ie.StateTransformer.UpdateResult.Updated},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Ht=Ve.b.BuiltIn({name:"structure-selection-from-bundle",display:{name:"Selection",description:"Create a molecular structure from the specified structure-element bundle."},from:Ve.a.Molecule.Structure,to:Ve.a.Molecule.Structure,params:{bundle:O.ParamDefinition.Value(Ae.StructureElement.Bundle.Empty,{isHidden:!0}),label:O.ParamDefinition.Optional(O.ParamDefinition.Text("",{isHidden:!0}))}})({apply:function(e){var t=e.a,r=e.params,n=e.cache;if(r.bundle.hash!==t.data.hashCode)return Ie.StateObject.Null;n.source=t.data;var i=Ae.StructureElement.Bundle.toStructure(r.bundle,t.data);if(0===i.elementCount)return Ie.StateObject.Null;var a={label:""+(r.label||"Selection"),description:Ae.Structure.elementDescription(i)};return new Ve.a.Molecule.Structure(i,a)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;if(!Ae.StructureElement.Bundle.areEqual(n.bundle,i.bundle))return Ie.StateTransformer.UpdateResult.Recreate;if(i.bundle.hash!==t.data.hashCode)return Ie.StateTransformer.UpdateResult.Null;if(a.source===t.data)return Ie.StateTransformer.UpdateResult.Unchanged;a.source=t.data;var o=Ae.StructureElement.Bundle.toStructure(i.bundle,t.data);return 0===o.elementCount?Ie.StateTransformer.UpdateResult.Null:(r.label=""+(i.label||"Selection"),r.description=Ae.Structure.elementDescription(o),r.data=o,Ie.StateTransformer.UpdateResult.Updated)},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Gt={polymer:"polymer",protein:"protein",nucleic:"nucleic",water:"water",branched:"branched",ligand:"ligand","non-standard":"non-standard",coarse:"coarse","atomic-sequence":"atomic-sequence","atomic-het":"atomic-het",spheres:"spheres"},qt=O.ParamDefinition.objectToOptions(Gt),Wt=Ve.b.BuiltIn({name:"structure-complex-element",display:{name:"Complex Element",description:"Create a molecular structure from the specified model."},from:Ve.a.Molecule.Structure,to:Ve.a.Molecule.Structure,params:{type:O.ParamDefinition.Select("atomic-sequence",qt,{isHidden:!0})}})({apply:function(e){var t,r,n=e.a,i=e.params;switch(i.type){case"polymer":t=Re.b.polymer.query,r="Polymer";break;case"protein":t=Re.b.protein.query,r="Protein";break;case"nucleic":t=Re.b.nucleic.query,r="Nucleic";break;case"water":t=Ae.Queries.internal.water(),r="Water";break;case"branched":t=Re.b.branchedPlusConnected.query,r="Branched";break;case"ligand":t=Re.b.ligandPlusConnected.query,r="Ligand";break;case"non-standard":t=Re.b.nonStandardPolymer.query,r="Non-standard";break;case"coarse":t=Re.b.coarse.query,r="Coarse";break;case"atomic-sequence":t=Ae.Queries.internal.atomicSequence(),r="Sequence";break;case"atomic-het":t=Ae.Queries.internal.atomicHet(),r="HET Groups/Ligands";break;case"spheres":t=Ae.Queries.internal.spheres(),r="Coarse Spheres";break;default:throw new Error(i.type+" is a not valid complex element.")}var a=t(new Ae.QueryContext(n.data)),o=Ae.StructureSelection.unionStructure(a);return 0===o.elementCount?Ie.StateObject.Null:new Ve.a.Molecule.Structure(o,{label:r,description:Ae.Structure.elementDescription(o)})},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Xt=Ve.b.BuiltIn({name:"structure-component",display:{name:"Component",description:"A molecular structure component."},from:Ve.a.Molecule.Structure,to:Ve.a.Molecule.Structure,params:Le})({apply:function(e){var t=e.a,r=e.params,n=e.cache;return function(e,t,r){r.source=e;var n=Ae.Structure.Empty,i=void 0;switch(t.type.name){case"static":var a=void 0;switch(t.type.params){case"all":a=Re.b.all.query,i="All";break;case"polymer":a=Re.b.polymer.query,i="Polymer";break;case"protein":a=Re.b.protein.query,i="Protein";break;case"nucleic":a=Re.b.nucleic.query,i="Nucleic";break;case"water":a=Ae.Queries.internal.water(),i="Water";break;case"ion":a=Re.b.ion.query,i="Ion";break;case"lipid":a=Re.b.lipid.query,i="Lipid";break;case"branched":a=Re.b.branchedPlusConnected.query,i="Branched";break;case"ligand":a=Re.b.ligandPlusConnected.query,i="Ligand";break;case"non-standard":a=Re.b.nonStandardPolymer.query,i="Non-standard";break;case"coarse":a=Re.b.coarse.query,i="Coarse";break;default:throw new Error(t.type+" is a not valid complex element.")}var o=a(new Ae.QueryContext(e));n=Ae.StructureSelection.unionStructure(o);break;case"script":case"expression":var s=Ee.createAndRun(e,t.type.params),u=s.selection,c=s.entry;r.entry=c,n=Ae.StructureSelection.unionStructure(u);break;case"bundle":if(t.type.params.hash!==e.hashCode)break;n=Ae.StructureElement.Bundle.toStructure(t.type.params,e)}if(t.nullIfEmpty&&0===n.elementCount)return Ie.StateObject.Null;var l={label:""+(t.label||i||"Component"),description:Ae.Structure.elementDescription(n)};return new Ve.a.Molecule.Structure(n,l)}(t.data,r,n)},update:function(e){var t=e.a,r=e.b,n=e.oldParams,i=e.newParams,a=e.cache;return function(e,t,r,n,i){if(r.type.name!==n.type.name)return Ie.StateTransformer.UpdateResult.Recreate;var a=!1;switch(n.type.name){case"static":return r.type.params!==n.type.params?Ie.StateTransformer.UpdateResult.Recreate:Ae.Structure.areEquivalent(e,i.source)?t.data.model===e.model?Ie.StateTransformer.UpdateResult.Unchanged:Ae.Model.areHierarchiesEqual(e.model,t.data.model)?(t.data=t.data.remapModel(e.model),Ie.StateTransformer.UpdateResult.Updated):Ie.StateTransformer.UpdateResult.Recreate:Ie.StateTransformer.UpdateResult.Recreate;case"script":if(!Te.Script.areEqual(r.type.params,n.type.params))return Ie.StateTransformer.UpdateResult.Recreate;case"expression":if(r.type.params!==n.type.params)return Ie.StateTransformer.UpdateResult.Recreate;if(e===i.source)break;var o=i.entry,s=Ee.updateStructure(o,e);i.source=e,t.data=Ae.StructureSelection.unionStructure(s),Ee.updateStructureObject(t,s,n.label),a=!0;break;case"bundle":if(e===i.source&&Ae.StructureElement.Bundle.areEqual(r.type.params,n.type.params))break;i.source=e,n.type.params.hash!==e.hashCode?(a=0!==t.data.elementCount,t.data=0===t.data.elementCount?t.data:Ae.Structure.Empty):(a=!0,t.data=Ae.StructureElement.Bundle.toStructure(n.type.params,e))}if(a){if(n.nullIfEmpty&&0===t.data.elementCount)return Ie.StateTransformer.UpdateResult.Null;t.description=Ae.Structure.elementDescription(t.data)}return r.label!==n.label&&(a=!0,t.label=""+(n.label||t.label)),a?Ie.StateTransformer.UpdateResult.Updated:Ie.StateTransformer.UpdateResult.Unchanged}(t.data,r,n,i,a)},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}}),Yt=Ve.b.BuiltIn({name:"custom-model-properties",display:{name:"Custom Model Properties"},isDecorator:!0,from:Ve.a.Molecule.Model,to:Ve.a.Molecule.Model,params:function(e,t){return t.customModelProperties.getParams(null==e?void 0:e.data)}})({apply:function(e,t){var r=this,i=e.a,o=e.params;return a.b.create("Custom Props",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return[4,Qt(i.data,t,e,o)];case 1:return r.sent(),[2,new Ve.a.Molecule.Model(i.data,{label:i.label,description:i.description})]}}))}))}))},update:function(e,t){var r=this,i=e.a,o=e.b,s=e.oldParams,u=e.newParams;return a.b.create("Custom Props",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,c,l;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(o.data=i.data,o.label=i.label,o.description=i.description,r=0,a=s.autoAttach;r<a.length;r++)c=a[r],(l=t.customModelProperties.get(c))&&i.data.customProperties.reference(l.descriptor,!1);return[4,Qt(i.data,t,e,u)];case 1:return n.sent(),[2,Ie.StateTransformer.UpdateResult.Updated]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customProperties.dispose()}});function Qt(e,t,r,i){return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,o,s,u,c,l,d,f,p;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:a={runtime:r,assetManager:t.managers.asset},o=i.autoAttach,s=i.properties,u=0,c=Object.keys(s),n.label=1;case 1:if(!(u<c.length))return[3,8];if(l=c[u],d=t.customModelProperties.get(l),f=s[l],!o.includes(l)&&!d.isHidden)return[3,6];n.label=2;case 2:return n.trys.push([2,4,,5]),[4,d.attach(a,e,f,!0)];case 3:return n.sent(),[3,5];case 4:return p=n.sent(),t.log.warn("Error attaching model prop '"+l+"': "+p),[3,5];case 5:return[3,7];case 6:d.set(e,f),n.label=7;case 7:return u++,[3,1];case 8:return[2]}}))}))}var Kt=Ve.b.BuiltIn({name:"custom-structure-properties",display:{name:"Custom Structure Properties"},isDecorator:!0,from:Ve.a.Molecule.Structure,to:Ve.a.Molecule.Structure,params:function(e,t){return t.customStructureProperties.getParams(null==e?void 0:e.data.root)}})({apply:function(e,t){var r=this,i=e.a,o=e.params;return a.b.create("Custom Props",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return[4,Zt(i.data.root,t,e,o)];case 1:return r.sent(),[2,new Ve.a.Molecule.Structure(i.data,{label:i.label,description:i.description})]}}))}))}))},update:function(e,t){var r=this,i=e.a,o=e.b,s=e.oldParams,u=e.newParams;return i.data!==o.data?Ie.StateTransformer.UpdateResult.Recreate:a.b.create("Custom Props",(function(e){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,a,c,l;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(o.data=i.data,o.label=i.label,o.description=i.description,r=0,a=s.autoAttach;r<a.length;r++)c=a[r],(l=t.customStructureProperties.get(c))&&i.data.customPropertyDescriptors.reference(l.descriptor,!1);return[4,Zt(i.data.root,t,e,u)];case 1:return n.sent(),[2,Ie.StateTransformer.UpdateResult.Updated]}}))}))}))},dispose:function(e){var t=e.b;null==t||t.data.customPropertyDescriptors.dispose()}});function Zt(e,t,r,i){return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,o,s,u,c,l,d,f,p;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:a={runtime:r,assetManager:t.managers.asset},o=i.autoAttach,s=i.properties,u=0,c=Object.keys(s),n.label=1;case 1:if(!(u<c.length))return[3,8];if(l=c[u],d=t.customStructureProperties.get(l),f=s[l],!o.includes(l)&&!d.isHidden)return[3,6];n.label=2;case 2:return n.trys.push([2,4,,5]),[4,d.attach(a,e,f,!0)];case 3:return n.sent(),[3,5];case 4:return p=n.sent(),t.log.warn("Error attaching structure prop '"+l+"': "+p),[3,5];case 5:return[3,7];case 6:d.set(e,f),n.label=7;case 7:return u++,[3,1];case 8:return[2]}}))}))}var Jt=Ve.b.BuiltIn({name:"shape-from-ply",display:{name:"Shape from PLY",description:"Create Shape from PLY data"},from:Ve.a.Format.Ply,to:Ve.a.Shape.Provider,params:function(e){return{}}})({apply:function(e){var t=this,r=e.a;e.params;return a.b.create("Create shape from PLY",(function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,k(r.data).runInContext(e)];case 1:return t=n.sent(),i={label:"Shape"},[2,new Ve.a.Shape.Provider(t,i)]}}))}))}))}})},function(e,t,r){"use strict";r.d(t,"b",(function(){return N})),r.d(t,"a",(function(){return z})),r.d(t,"c",(function(){return G}));var n=r(0);function i(e,t){return e[t]|e[t+1]<<8}function a(e,t,r){e[t]=255&r,e[t+1]=r>>8&255}function o(e,t){return 16777216*e[t+3]+(e[t+2]<<16|e[t+1]<<8|e[t])}function s(e,t,r){e[t]=255&r,e[t+1]=r>>8&255,e[t+2]=r>>16&255,e[t+3]=r>>24&255}function u(e,t,r){for(var n,i,a="",o=0;o<r;o++)a+="%"+((i=e[t+o].toString(16)).length<2?"0"+i:i);try{n=decodeURIComponent(a)}catch(n){return function(e,t,r){for(var n="",i=0;i<r;i++)n+=String.fromCharCode(e[t+i]);return n}(e,t,r)}return n}function c(e){for(var t=e.length,r=0,n=0;n<t;n++){var i=e.charCodeAt(n);if(0==(4294967168&i))r++;else if(0==(4294965248&i))r+=2;else if(0==(4294901760&i))r+=3;else{if(0!=(4292870144&i))throw"e";r+=4}}return r}var l=function(){for(var e=new Uint32Array(256),t=0;t<256;t++){for(var r=t,n=0;n<8;n++)1&r?r=3988292384^r>>>1:r>>>=1;e[t]=r}return e}();function d(e,t,r){return 4294967295^function(e,t,r,n){for(var i=0;i<n;i++)e=l[255&(e^t[r+i])]^e>>>8;return e}(4294967295,e,t,r)}var f,p,m=(f=Uint16Array,p=Uint32Array,{next_code:new f(16),bl_count:new f(16),ordr:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],of0:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],exb:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],ldef:new f(32),df0:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],dxb:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],ddef:new p(32),flmap:new f(512),fltree:[],fdmap:new f(32),fdtree:[],lmap:new f(32768),ltree:[],ttree:[],dmap:new f(32768),dtree:[],imap:new f(512),itree:[],rev15:new f(32768),lhst:new p(286),dhst:new p(30),ihst:new p(19),lits:new p(15e3),strt:new f(65536),prev:new f(32768)});function h(e,t,r){for(var n=e.length,i=m.rev15,a=0;a<n;a+=2)if(0!==e[a+1])for(var o=a>>1,s=e[a+1],u=o<<4|s,c=t-s,l=e[a]<<c,d=l+(1<<c);l!==d;){r[i[l]>>>15-t]=u,l++}}function g(e,t){for(var r=e.length,n=m.bl_count,i=0;i<=t;i++)n[i]=0;for(i=1;i<r;i+=2)n[e[i]]++;var a=m.next_code,o=0;n[0]=0;for(var s=1;s<=t;s++)o=o+n[s-1]<<1,a[s]=o;for(var u=0;u<r;u+=2){var c=e[u+1];0!==c&&(e[u]=a[c],a[c]++)}}function v(e,t){for(var r=m.rev15,n=15-t,i=0;i<e.length;i+=2){var a=e[i]<<t-e[i+1];e[i]=r[a]>>>n}}function b(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(3===t[0]&&0===t[1])return[2,r||new Uint8Array(0)];i=function(e,t){var r=void 0===t;return void 0===t&&(t=new Uint8Array(e.length>>>2<<3)),{data:e,buf:t,noBuf:r,BFINAL:0,off:0,pos:0}}(t,r),n.label=1;case 1:return 0!==i.BFINAL?[3,4]:e.shouldUpdate?[4,e.update({message:"Inflating blocks...",current:i.pos,max:t.length})]:[3,3];case 2:n.sent(),n.label=3;case 3:return function(e,t){for(var r=e.data,n=e.noBuf,i=e.buf,a=e.BFINAL,o=e.off,s=e.pos,u=0;0===a&&u<t;){var c=void 0,l=void 0,d=0,f=0;a=O(r,s,1),u+=1;var p=O(r,s+1,2);if(s+=3,0!==p){if(n&&(i=y(i,o+(1<<17))),1===p)c=m.flmap,l=m.fdmap,d=511,f=31;else{if(2!==p)throw new Error("unknown BTYPE "+p);var v=x(r,s,5)+257,b=x(r,s+5,5)+1,C=x(r,s+10,4)+4;s+=14;for(var j=0;j<38;j+=2)m.itree[j]=0,m.itree[j+1]=0;var P=1;for(j=0;j<C;j++){var E=x(r,s+3*j,3);m.itree[1+(m.ordr[j]<<1)]=E,E>P&&(P=E)}s+=3*C,g(m.itree,P),h(m.itree,P,m.imap),c=m.lmap,l=m.dmap,s=_(m.imap,(1<<P)-1,v+b,r,s,m.ttree);var A=S(m.ttree,0,v,m.ltree);d=(1<<A)-1;var D=S(m.ttree,v,b,m.dtree);f=(1<<D)-1,g(m.ltree,A),h(m.ltree,A,c),g(m.dtree,D),h(m.dtree,D,l)}for(;;){var T=c[w(r,s)&d];s+=15&T;var I=T>>>4;if(I>>>8==0)i[o++]=I;else{if(256===I)break;var M=o+I-254;if(I>264){var k=m.ldef[I-257];M=o+(k>>>3)+x(r,s,7&k),s+=7&k}var B=l[w(r,s)&f];s+=15&B;var V=B>>>4,R=m.ddef[V],L=(R>>>4)+O(r,s,15&R);for(s+=15&R,n&&(i=y(i,o+(1<<17)));o<M;)i[o]=i[o++-L],i[o]=i[o++-L],i[o]=i[o++-L],i[o]=i[o++-L];o=M}}}else{0!=(7&s)&&(s+=8-(7&s));var N=4+(s>>>3),F=r[N-4]|r[N-3]<<8;n&&(i=y(i,o+F)),i.set(new Uint8Array(r.buffer,r.byteOffset+N,F),o),s=N+F<<3,o+=F}}e.buf=i,e.BFINAL=a,e.off=o,e.pos=s}(i,100),[3,1];case 4:return[2,i.buf.length===i.off?i.buf:i.buf.slice(0,i.off)]}}))}))}function y(e,t){var r=e.length;if(t<=r)return e;var n=new Uint8Array(Math.max(r<<1,t));return n.set(e,0),n}function _(e,t,r,n,i,a){for(var o=0;o<r;){var s=e[w(n,i)&t];i+=15&s;var u=s>>>4;if(u<=15)a[o]=u,o++;else{var c=0,l=0;16===u?(l=3+x(n,i,2),i+=2,c=a[o-1]):17===u?(l=3+x(n,i,3),i+=3):18===u&&(l=11+x(n,i,7),i+=7);for(var d=o+l;o<d;)a[o]=c,o++}}return i}function S(e,t,r,n){for(var i=0,a=0,o=n.length>>>1;a<r;){var s=e[a+t];n[a<<1]=0,n[1+(a<<1)]=s,s>i&&(i=s),a++}for(;a<o;)n[a<<1]=0,n[1+(a<<1)]=0,a++;return i}function x(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8)>>>(7&t)&(1<<r)-1}function O(e,t,r){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)&(1<<r)-1}function w(e,t){return(e[t>>>3]|e[1+(t>>>3)]<<8|e[2+(t>>>3)]<<16)>>>(7&t)}function C(e,t,r){for(var n=[],i=e.length,a=t.length,o=0;o<a;o+=2)t[o]=0,t[o+1]=0;for(o=0;o<i;o++)0!==e[o]&&n.push({lit:o,f:e[o],d:void 0});var s=n.length,u=n.slice(0);if(0===s)return 0;if(1===s){var c=n[0].lit,l=0===c?1:0;return t[1+(c<<1)]=1,t[1+(l<<1)]=1,1}n.sort((function(e,t){return e.f-t.f}));var d=n[0],f=n[1],p=0,m=1,h=2;for(n[0]={lit:-1,f:d.f+f.f,l:d,r:f,d:0};m!==s-1;)d=p!==m&&(h===s||n[p].f<n[h].f)?n[p++]:n[h++],f=p!==m&&(h===s||n[p].f<n[h].f)?n[p++]:n[h++],n[m++]={lit:-1,f:d.f+f.f,l:d,r:f,d:void 0};var g=function e(t,r){if(-1!==t.lit)return t.d=r,r;return Math.max(e(t.l,r+1),e(t.r,r+1))}(n[m-1],0);g>r&&(!function(e,t,r){var n=0,i=1<<r-t,a=0;for(e.sort((function(e,t){return t.d===e.d?e.f-t.f:t.d-e.d})),n=0;n<e.length&&e[n].d>t;n++){var o=e[n].d;e[n].d=t,a+=i-(1<<r-o)}a>>>=r-t;for(;a>0;){(o=e[n].d)<t?(e[n].d++,a-=1<<t-o-1):n++}for(;n>=0;n--)e[n].d===t&&a<0&&(e[n].d--,a++);0!==a&&console.log("debt left")}(u,r,g),g=r);for(o=0;o<s;o++)t[1+(u[o].lit<<1)]=u[o].d;return g}function j(e,t,r,n){var i=[[0,0,0,0,0],[4,4,8,4,0],[4,5,16,8,0],[4,6,16,16,0],[4,10,16,32,0],[8,16,32,32,0],[8,16,128,128,0],[8,32,128,256,0],[32,128,258,1024,1],[32,258,258,4096,1]][n],a=0,o=r<<3,s=0,u=e.length;if(0===n){for(;a<u;){R(t,o,a+(S=Math.min(65535,u-a))===u?1:0),o=T(e,a,S,t,o+8),a+=S}return o>>>3}var c=m.lits,l=m.strt,d=m.prev,f=0,p=0,h=0,g=0,v=0,b=0;for(u>2&&(l[b=A(e,0)]=0),a=0;a<u;a++){if(v=b,a+1<u-2){b=A(e,a+1);var y=a+1&32767;d[y]=l[b],l[b]=y}if(s<=a){(f>14e3||p>26697)&&u-a>100&&(s<a&&(c[f]=a-s,f+=2,s=a),o=D(a===u-1||s===u?1:0,c,f,g,e,h,a-h,t,o),f=p=g=0,h=a);var _=0;if(a<u-2&&(_=P(e,a,d,v,Math.min(i[2],u-a),i[3])),0!==_){var S,x=65535&_,O=B(S=_>>>16,m.of0);m.lhst[257+O]++;var w=B(x,m.df0);m.dhst[w]++,g+=m.exb[O]+m.dxb[w],c[f]=S<<23|a-s,c[f+1]=x<<16|O<<8|w,f+=2,s=a+S}else m.lhst[e[a]]++;p++}}for(h===a&&0!==e.length||(s<a&&(c[f]=a-s,f+=2,s=a),o=D(1,c,f,g,e,h,a-h,t,o),f=0,p=0,f=p=g=0,h=a);0!=(7&o);)o++;return o>>>3}function P(e,t,r,n,i,a){var o=32767&t,s=r[o],u=o-s+32768&32767;if(s===o||n!==A(e,t-u))return 0;for(var c=0,l=0,d=Math.min(32767,t);u<=d&&0!=--a&&s!==o;){if(0===c||e[t+c]===e[t+c-u]){var f=E(e,t,u);if(f>c){if(l=u,(c=f)>=i)break;u+2<f&&(f=u+2);for(var p=0,m=0;m<f-2;m++){var h=t-u+m+32768&32767,g=h-r[h]+32768&32767;g>p&&(p=g,s=h)}}}u+=(o=s)-(s=r[o])+32768&32767}return c<<16|l}function E(e,t,r){if(e[t]!==e[t-r]||e[t+1]!==e[t+1-r]||e[t+2]!==e[t+2-r])return 0;var n=t,i=Math.min(e.length,t+258);for(t+=3;t<i&&e[t]===e[t-r];)t++;return t-n}function A(e,t){return(e[t]<<8|e[t+1])+(e[t+2]<<4)&65535}function D(e,t,r,n,i,a,o,s,u){m.lhst[256]++;var c=function(){for(var e=C(m.lhst,m.ltree,15),t=C(m.dhst,m.dtree,15),r=[],n=k(m.ltree,r),i=[],a=k(m.dtree,i),o=0;o<r.length;o+=2)m.ihst[r[o]]++;for(o=0;o<i.length;o+=2)m.ihst[i[o]]++;var s=C(m.ihst,m.itree,7),u=19;for(;u>4&&0===m.itree[1+(m.ordr[u-1]<<1)];)u--;return[e,t,s,n,a,u,r,i]}(),l=c[0],d=c[1],f=c[2],p=c[3],h=c[4],b=c[5],y=c[6],_=c[7],S=32+(0==(u+3&7)?0:8-(u+3&7))+(o<<3),x=n+I(m.fltree,m.lhst)+I(m.fdtree,m.dhst),O=n+I(m.ltree,m.lhst)+I(m.dtree,m.dhst);O+=14+3*b+I(m.itree,m.ihst)+(2*m.ihst[16]+3*m.ihst[17]+7*m.ihst[18]);for(var w=0;w<286;w++)m.lhst[w]=0;for(w=0;w<30;w++)m.dhst[w]=0;for(w=0;w<19;w++)m.ihst[w]=0;var j=S<x&&S<O?0:x<O?1:2;if(L(s,u,e),L(s,u+1,j),u+=3,0===j){for(;0!=(7&u);)u++;u=T(i,a,o,s,u)}else{var P=void 0,E=void 0;if(1===j)P=m.fltree,E=m.fdtree;else{if(2!==j)throw new Error("unknown BTYPE "+j);g(m.ltree,l),v(m.ltree,l),g(m.dtree,d),v(m.dtree,d),g(m.itree,f),v(m.itree,f),P=m.ltree,E=m.dtree,R(s,u,p-257),R(s,u+=5,h-1),R(s,u+=5,b-4),u+=4;for(var A=0;A<b;A++)R(s,u+3*A,m.itree[1+(m.ordr[A]<<1)]);u+=3*b,u=M(y,m.itree,s,u),u=M(_,m.itree,s,u)}for(var D=a,B=0;B<r;B+=2){for(var N=t[B],F=N>>>23,U=D+(8388607&N);D<U;)u=V(i[D++],P,s,u);if(0!==F){var z=t[B+1],H=z>>16,G=z>>8&255,q=255&z;R(s,u=V(257+G,P,s,u),F-m.of0[G]),L(s,u=V(q,E,s,u+=m.exb[G]),H-m.df0[q]),u+=m.dxb[q],D+=F}}u=V(256,P,s,u)}return u}function T(e,t,r,n,i){var a=i>>>3;return n[a]=r,n[a+1]=r>>>8,n[a+2]=255-n[a],n[a+3]=255-n[a+1],a+=4,n.set(new Uint8Array(e.buffer,t,r),a),i+(r+4<<3)}function I(e,t){for(var r=0,n=0;n<t.length;n++)r+=t[n]*e[1+(n<<1)];return r}function M(e,t,r,n){for(var i=0;i<e.length;i+=2){var a=e[i],o=e[i+1];n=V(a,t,r,n);var s=16===a?2:17===a?3:7;a>15&&(R(r,n,o),n+=s)}return n}function k(e,t){for(var r=e.length;2!==r&&0===e[r-1];)r-=2;for(var n=0;n<r;n+=2){var i=e[n+1],a=n+3<r?e[n+3]:-1,o=n+5<r?e[n+5]:-1,s=0===n?-1:e[n-1];if(0===i&&a===i&&o===i){for(var u=n+5;u+2<r&&e[u+2]===i;)u+=2;(c=Math.min(u+1-n>>>1,138))<11?t.push(17,c-3):t.push(18,c-11),n+=2*c-2}else if(i===s&&a===i&&o===i){for(u=n+5;u+2<r&&e[u+2]===i;)u+=2;var c=Math.min(u+1-n>>>1,6);t.push(16,c-3),n+=2*c-2}else t.push(i,0)}return r>>>1}function B(e,t){var r=0;return t[16|r]<=e&&(r|=16),t[8|r]<=e&&(r|=8),t[4|r]<=e&&(r|=4),t[2|r]<=e&&(r|=2),t[1|r]<=e&&(r|=1),r}function V(e,t,r,n){return L(r,n,t[e<<1]),n+t[1+(e<<1)]}function R(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8}function L(e,t,r){r<<=7&t;var n=t>>>3;e[n]|=r,e[n+1]|=r>>>8,e[n+2]|=r>>>16}function N(e,t,r){return void 0===r&&(r=!1),Object(n.__awaiter)(this,void 0,void 0,(function(){var a,s,u,c,l,d,f,p,m,h,g,v,b;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(a=Object.create(null),s=new Uint8Array(t),u=s.length-4;101010256!==o(s,u);)u--;c=u,c+=4,l=i(s,c+=4),c+=2,c+=2,d=o(s,c+=4),c+=4,c=d,f=0,n.label=1;case 1:return f<l?(c+=4,c+=4,c+=4,c+=4,p=o(s,c+=4),m=o(s,c+=4),h=i(s,c+=4),g=i(s,c+2),v=i(s,c+4),c+=6,b=o(s,c+=8),c+=4,c+=h+g+v,[4,F(e,s,b,a,p,m,r)]):[3,4];case 2:n.sent(),n.label=3;case 3:return f++,[3,1];case 4:return[2,a]}}))}))}function F(e,t,r,a,o,s,c){return Object(n.__awaiter)(this,void 0,void 0,(function(){var l,d,f,p,m,h;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return r+=4,r+=2,l=i(t,r+=2),r+=2,r+=4,r+=4,d=i(t,r+=8),f=i(t,r+=2),p=u(t,r+=2,d),r+=d,r+=f,c?(a[p]={size:s,csize:o},[2]):(m=new Uint8Array(t.buffer,r),0!==l?[3,1]:(a[p]=new Uint8Array(m.buffer.slice(r,r+o)),[3,4]));case 1:return 8!==l?[3,3]:(h=new Uint8Array(s),[4,U(e,m,h)]);case 2:return n.sent(),a[p]=h,[3,4];case 3:throw"unknown compression method: "+l;case 4:return[2]}}))}))}function U(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){return Object(n.__generator)(this,(function(n){return[2,b(e,t,r)]}))}))}function z(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,s,u,c,l,f,p,m,h;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:if(a=t[3],s=10,4&a&&(u=i(t,s),s+=u),8&a){for(c=s;0!==t[c];)++c;s=c+1}if(16&a){for(c=s;0!==t[c];)++c;s=c+1}return 1&a&&(s+=2),g=o(t,t.length-8),l=g>>0,f=o(t,t.length-4),void 0===r&&(r=new Uint8Array(f)),p=new Uint8Array(t.buffer,t.byteOffset+s,t.length-s-8),[4,U(e,p,r)];case 1:return m=n.sent(),h=d(m,0,m.length),l!==h&&console.error("ungzip: checksums don't match"),[2,m]}var g}))}))}function H(e,t){void 0===t&&(t={level:6});var r=new Uint8Array(50+Math.floor(1.1*e.length)),n=j(e,r,0,t.level);return new Uint8Array(r.buffer,0,n)}function G(e,t){void 0===t&&(t=!1);var r,n,i=0,o={};for(var u in e){var l=!(r=u,n=void 0,n=r.split(".").pop().toLowerCase(),-1!=="png,jpg,jpeg,zip".indexOf(n)||t),f=e[u],p=d(f,0,f.length);o[u]={cpr:l,usize:f.length,crc:p,file:l?H(f):f}}for(var u in o)i+=o[u].file.length+30+46+2*c(u);i+=22;var m=new Uint8Array(i),h=0,g=[];for(var u in o){var v=o[u];g.push(h),h=q(m,h,u,v,0)}var b=0,y=h;for(var u in o){v=o[u];g.push(h),h=q(m,h,u,v,1,g[b++])}var _=h-y;return s(m,h,101010256),h+=4,a(m,h+=4,b),a(m,h+=2,b),s(m,h+=2,_),s(m,h+=4,y),h+=4,h+=2,m.buffer}function q(e,t,r,n,i,o){void 0===o&&(o=0);var u=n.file;return s(e,t,0===i?67324752:33639248),t+=4,1===i&&(t+=2),a(e,t,20),a(e,t+=2,0),a(e,t+=2,n.cpr?8:0),s(e,t+=2,0),s(e,t+=4,n.crc),s(e,t+=4,u.length),s(e,t+=4,n.usize),a(e,t+=4,c(r)),a(e,t+=2,0),t+=2,1===i&&(t+=2,t+=2,s(e,t+=6,o),t+=4),t+=function(e,t,r){for(var n=r.length,i=0,a=0;a<n;a++){var o=r.charCodeAt(a);if(0==(4294967168&o))e[t+i]=o,i++;else if(0==(4294965248&o))e[t+i]=192|o>>6,e[t+i+1]=128|o>>0&63,i+=2;else if(0==(4294901760&o))e[t+i]=224|o>>12,e[t+i+1]=128|o>>6&63,e[t+i+2]=128|o>>0&63,i+=3;else{if(0!=(4292870144&o))throw"e";e[t+i]=240|o>>18,e[t+i+1]=128|o>>12&63,e[t+i+2]=128|o>>6&63,e[t+i+3]=128|o>>0&63,i+=4}}return i}(e,t,r),0===i&&(e.set(u,t),t+=u.length),t}!function(){for(var e=0;e<32768;e++){var t=e;t=(4278255360&(t=(4042322160&(t=(3435973836&(t=(2863311530&t)>>>1|(1431655765&t)<<1))>>>2|(858993459&t)<<2))>>>4|(252645135&t)<<4))>>>8|(16711935&t)<<8,m.rev15[e]=(t>>>16|t<<16)>>>17}function r(e,t,r){for(;0!=t--;)e.push(0,r)}for(e=0;e<32;e++)m.ldef[e]=m.of0[e]<<3|m.exb[e],m.ddef[e]=m.df0[e]<<4|m.dxb[e];r(m.fltree,144,8),r(m.fltree,112,9),r(m.fltree,24,7),r(m.fltree,8,8),g(m.fltree,9),h(m.fltree,9,m.flmap),v(m.fltree,9),r(m.fdtree,32,5),g(m.fdtree,5),h(m.fdtree,5,m.fdmap),v(m.fdtree,5),r(m.itree,19,0),r(m.ltree,286,0),r(m.dtree,30,0),r(m.ttree,320,0)}()},function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return o}));var n=r(20),i=function(e){function t(t,r){var n=e.call(this,t,r)||this;return n.scheduler=t,n.work=r,n}return n.a(t,e),t.prototype.schedule=function(t,r){return void 0===r&&(r=0),r>0?e.prototype.schedule.call(this,t,r):(this.delay=r,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,r){return r>0||this.closed?e.prototype.execute.call(this,t,r):this._execute(t,r)},t.prototype.requestAsyncId=function(t,r,n){return void 0===n&&(n=0),null!==n&&n>0||null===n&&this.delay>0?e.prototype.requestAsyncId.call(this,t,r,n):t.flush(this)},t}(r(240).a),a=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.a(t,e),t}(r(236).a))(i),o=a},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureFocusRepresentationTags",(function(){return n})),r.d(t,"StructureFocusRepresentation",(function(){return y}));var n,i=r(0),a=r(342),o=r(338),s=r(4),u=r(167),c=r(31),l=r(177),d=r(10),f=r(13),p=r(135),m=r(2),h=r(27),g=["target","surroundings","interactions"];!function(e){e.TargetSel="structure-focus-target-sel",e.TargetRepr="structure-focus-target-repr",e.SurrSel="structure-focus-surr-sel",e.SurrRepr="structure-focus-surr-repr",e.SurrNciRepr="structure-focus-surr-nci-repr"}(n||(n={}));var v=new Set([n.TargetSel,n.TargetRepr,n.SurrSel,n.SurrRepr,n.SurrNciRepr]),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.currentSource=void 0,t}return Object(i.__extends)(t,e),Object.defineProperty(t.prototype,"surrLabel",{get:function(){return"[Focus] Surroundings ("+this.params.expandRadius+" Å)"},enumerable:!1,configurable:!0}),t.prototype.getReprParams=function(e){return Object(i.__assign)(Object(i.__assign)({},this.params.targetParams),{type:{name:e.type.name,params:Object(i.__assign)(Object(i.__assign)({},e.type.params),{ignoreHydrogens:this.params.ignoreHydrogens})}})},t.prototype.ensureShape=function(e){var t=this.plugin.state.data,r=t.tree,i=t.build(),a=f.StateSelection.findUniqueTagsInSubtree(r,e.transform.ref,v);a[n.TargetSel]||(a[n.TargetSel]=i.to(e).apply(c.StateTransforms.Model.StructureSelectionFromBundle,{bundle:s.StructureElement.Bundle.Empty,label:"[Focus] Target"},{tags:n.TargetSel}).ref),a[n.SurrSel]||(a[n.SurrSel]=i.to(e).apply(c.StateTransforms.Model.StructureSelectionFromExpression,{expression:d.MolScriptBuilder.struct.generator.empty(),label:this.surrLabel},{tags:n.SurrSel}).ref);var o=this.params.components;return o.indexOf("target")>=0&&!a[n.TargetRepr]&&(a[n.TargetRepr]=i.to(a[n.TargetSel]).apply(c.StateTransforms.Representation.StructureRepresentation3D,this.getReprParams(this.params.targetParams),{tags:n.TargetRepr}).ref),o.indexOf("surroundings")>=0&&!a[n.SurrRepr]&&(a[n.SurrRepr]=i.to(a[n.SurrSel]).apply(c.StateTransforms.Representation.StructureRepresentation3D,this.getReprParams(this.params.surroundingsParams),{tags:n.SurrRepr}).ref),o.indexOf("interactions")>=0&&!a[n.SurrNciRepr]&&(a[n.SurrNciRepr]=i.to(a[n.SurrSel]).apply(c.StateTransforms.Representation.StructureRepresentation3D,this.params.nciParams,{tags:n.SurrNciRepr}).ref),{state:t,builder:i,refs:a}},t.prototype.clear=function(e){var t=this.plugin.state.data;this.currentSource=void 0;var r=t.select(f.StateSelection.Generators.byRef(e).subtree().withTag(n.TargetSel)),a=t.select(f.StateSelection.Generators.byRef(e).subtree().withTag(n.SurrSel));if(0!==r.length||0!==a.length){for(var o=t.build(),u=s.StructureElement.Bundle.Empty,l=0,p=r;l<p.length;l++){var m=p[l];o.to(m).update(c.StateTransforms.Model.StructureSelectionFromBundle,(function(e){return Object(i.__assign)(Object(i.__assign)({},e),{bundle:u})}))}for(var g=d.MolScriptBuilder.struct.generator.empty(),v=0,b=a;v<b.length;v++){var y=b[v];o.to(y).update(c.StateTransforms.Model.StructureSelectionFromExpression,(function(e){return Object(i.__assign)(Object(i.__assign)({},e),{expression:g})}))}return h.PluginCommands.State.Update(this.plugin,{state:t,tree:o,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})}},t.prototype.focus=function(e){return Object(i.__awaiter)(this,void 0,void 0,(function(){var t,r,a,o,u,l,f,p,m,g,v=this;return Object(i.__generator)(this,(function(b){switch(b.label){case 0:return(t=this.plugin.helpers.substructureParent.get(e.structure))&&t.obj?(this.currentSource=e,r=s.StructureElement.Loci.remap(e,t.obj.data),a=s.StructureElement.Loci.extendToWholeResidues(r),o=s.StructureElement.Bundle.fromLoci(a),u=s.StructureElement.Bundle.toExpression(o),l=d.MolScriptBuilder.struct.modifier.includeSurroundings({0:u,radius:this.params.expandRadius,"as-whole-residues":!0}),this.params.excludeTargetFromSurroundings&&(l=d.MolScriptBuilder.struct.modifier.exceptBy({0:l,by:u})),f=this.ensureShape(t),p=f.state,m=f.builder,g=f.refs,m.to(g[n.TargetSel]).update(c.StateTransforms.Model.StructureSelectionFromBundle,(function(e){return Object(i.__assign)(Object(i.__assign)({},e),{bundle:o})})),m.to(g[n.SurrSel]).update(c.StateTransforms.Model.StructureSelectionFromExpression,(function(e){return Object(i.__assign)(Object(i.__assign)({},e),{expression:l,label:v.surrLabel})})),[4,h.PluginCommands.State.Update(this.plugin,{state:p,tree:m,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})]):[2];case 1:return b.sent(),[2]}}))}))},t.prototype.register=function(e){var t=this;this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,(function(e){e?t.focus(e.loci):t.clear(f.StateTransform.RootRef)}))},t.prototype.update=function(e){return Object(i.__awaiter)(this,void 0,void 0,(function(){var t,r,a,o,s,u,c,l,d,p,m,g,v;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if(t=this.params,this.params=e,t.excludeTargetFromSurroundings!==e.excludeTargetFromSurroundings)return this.currentSource&&this.focus(this.currentSource),[2,!0];for(r=this.plugin.state.data,a=r.build(),o=f.StateSelection.Generators.root.subtree(),s=this.params.components,u=s.indexOf("target")>=0,c=0,l=r.select(o.withTag(n.TargetRepr));c<l.length;c++)v=l[c],u?a.to(v).update(this.getReprParams(this.params.targetParams)):a.delete(v.transform.ref);for(u=s.indexOf("surroundings")>=0,d=0,p=r.select(o.withTag(n.SurrRepr));d<p.length;d++)v=p[d],u?a.to(v).update(this.getReprParams(this.params.surroundingsParams)):a.delete(v.transform.ref);for(u=s.indexOf("interactions")>=0,m=0,g=r.select(o.withTag(n.SurrNciRepr));m<g.length;m++)v=g[m],u?a.to(v).update(this.params.nciParams):a.delete(v.transform.ref);return[4,h.PluginCommands.State.Update(this.plugin,{state:r,tree:a,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})];case 1:return i.sent(),e.expandRadius!==t.expandRadius?(this.currentSource&&this.focus(this.currentSource),[2,!0]):[2,!0]}}))}))},t}(l.PluginBehavior.WithSubscribers),y=l.PluginBehavior.create({name:"create-structure-focus-representation",display:{name:"Structure Focus Representation"},category:"interaction",ctor:b,params:function(e,t){return function(e){var t=c.StateTransforms.Representation.StructureRepresentation3D.definition.params(void 0,e);return{expandRadius:m.ParamDefinition.Numeric(5,{min:1,max:10,step:1}),targetParams:m.ParamDefinition.Group(t,{label:"Target",customDefault:Object(u.createStructureRepresentationParams)(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.26,alpha:.51}})}),surroundingsParams:m.ParamDefinition.Group(t,{label:"Surroundings",customDefault:Object(u.createStructureRepresentationParams)(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.16}})}),nciParams:m.ParamDefinition.Group(t,{label:"Non-covalent Int.",customDefault:Object(u.createStructureRepresentationParams)(e,void 0,{type:a.a,color:o.a,size:p.a.BuiltIn.uniform})}),components:m.ParamDefinition.MultiSelect(g,m.ParamDefinition.arrayToOptions(g)),excludeTargetFromSurroundings:m.ParamDefinition.Boolean(!1,{label:"Exclude Target",description:'Exclude the focus "target" from the surroudings component.'}),ignoreHydrogens:m.ParamDefinition.Boolean(!1)}}(t)}})},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(t,r){void 0===r&&(r=e.now),this.SchedulerAction=t,this.now=r}return e.prototype.schedule=function(e,t,r){return void 0===t&&(t=0),new this.SchedulerAction(this,e).schedule(r,t)},e.now=function(){return Date.now()},e}()},function(e,t,r){"use strict";r.r(t),r.d(t,"ViewportControls",(function(){return C})),r.d(t,"Logo",(function(){return j})),r.d(t,"Viewport",(function(){return P}));var n=r(0),i=r(3),a=r(27),o=r(78),s=r(33),u=r(18),c=r(15),l=r(213),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.container=i.createRef(),t.canvas=i.createRef(),t.state={noWebGl:!1,showLogo:!0},t.handleLogo=function(){var e;t.setState({showLogo:!(null===(e=t.plugin.canvas3d)||void 0===e?void 0:e.reprCount.value)})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){this.canvas.current&&this.container.current&&this.plugin.initViewer(this.canvas.current,this.container.current)?(this.handleLogo(),this.subscribe(this.plugin.canvas3d.reprCount,this.handleLogo)):this.setState({noWebGl:!0})},t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this)},t.prototype.renderMissing=function(){if(this.props.noWebGl){var e=this.props.noWebGl;return i.createElement(e,null)}return i.createElement("div",{className:"msp-no-webgl"},i.createElement("div",null,i.createElement("p",null,i.createElement("b",null,"WebGL does not seem to be available.")),i.createElement("p",null,"This can be caused by an outdated browser, graphics card driver issue, or bad weather. Sometimes, just restarting the browser helps."),i.createElement("p",null,"For a list of supported browsers, refer to ",i.createElement("a",{href:"http://caniuse.com/#feat=webgl",target:"_blank"},"http://caniuse.com/#feat=webgl"),".")))},t.prototype.render=function(){if(this.state.noWebGl)return this.renderMissing();var e=this.props.logo;return i.createElement("div",{className:this.props.parentClassName||"msp-viewport",style:this.props.parentStyle},i.createElement("div",{className:this.props.hostClassName||"msp-viewport-host3d",style:this.props.hostStyle,ref:this.container},i.createElement("canvas",{ref:this.canvas})),this.state.showLogo&&e&&i.createElement(e,null))},t}(s.PluginUIComponent),f=r(73),p=r(87);function m(e){var t=Object(i.useState)(null==e?void 0:e.value),r=t[0],n=t[1];return Object(i.useEffect)((function(){if(e){var t=!0,i=e.subscribe((function(e){t?(t=!1,e!==r&&n(e)):n(e)}));return function(){i.unsubscribe()}}void 0!==r&&n(void 0)}),[e]),r}var h=i.memo((function(e){var t=e.plugin,r=e.cropFrameColor,a=t.helpers.viewportScreenshot,o=Object(i.useState)(null),s=o[0],u=o[1],c=Object(i.useRef)(null),l=Object(i.useRef)(e);return Object(i.useEffect)((function(){l.current=e}),Object.values(e)),Object(i.useEffect)((function(){s!==c.current&&u(c.current)})),Object(i.useEffect)((function(){var e,r=!1,n=[];function i(e,t){e&&n.push(e.subscribe(t))}function o(){var e=l.current;!e.suspend&&c.current&&g(a,c.current,e.customBackground,e.borderColor,e.borderWidth),c.current||(r=!0)}var s=setInterval((function(){r&&(r=!1,o())}),125);i(t.events.canvas3d.settingsUpdated,(function(){return r=!0})),i(null===(e=t.canvas3d)||void 0===e?void 0:e.didDraw,(function(){return r=!0})),i(t.state.data.behaviors.isUpdating,(function(e){e||(r=!0)})),i(a.behaviors.values,(function(){return r=!0})),i(a.behaviors.cropParams,(function(){return r=!0}));var u=void 0;"undefined"!=typeof ResizeObserver&&(u=new ResizeObserver((function(){return r=!0})));var d=c.current;return null==u||u.observe(d),o(),function(){clearInterval(s),n.forEach((function(e){return e.unsubscribe()})),null==u||u.unobserve(d)}}),[a]),Object(i.useLayoutEffect)((function(){c.current&&g(a,c.current,e.customBackground,e.borderColor,e.borderWidth)}),Object(n.__spreadArrays)(Object.values(e))),i.createElement(i.Fragment,null,i.createElement("div",{style:{position:"relative",width:"100%",height:"100%"}},i.createElement("canvas",{ref:c,onContextMenu:function(e){e.preventDefault(),e.stopPropagation()},style:{display:"block",width:"100%",height:"100%"}}),i.createElement(v,{plugin:t,canvas:s,color:r})))}),(function(e,t){return Object(p.d)(e,t)}));function g(e,t,r,n,i){var a=e.getPreview(),o=a.canvas,s=a.width,u=a.height,c=t.getContext("2d");if(c){var l=t.clientWidth,d=t.clientHeight;t.width=l,t.height=d,c.clearRect(0,0,l,d);var f=y(s,u,l,d);if(r)c.fillStyle=r,c.fillRect(f.x,f.y,f.width,f.height);else if(e.values.transparent)for(var p=13,m=0;m<f.width;m+=p)for(var h=0;h<f.height;h+=p){c.fillStyle=(m+h)%2?"#ffffff":"#bfbfbf";var g=f.x+m,v=f.y+h,b=m+p>f.width?f.width-m:p,_=h+p>f.height?f.height-h:p;c.fillRect(g,v,b,_)}if(c.drawImage(o,f.x,f.y,f.width,f.height),n&&i){var S=i;c.rect(f.x,f.y,f.width,f.height),c.rect(f.x+S,f.y+S,f.width-2*S,f.height-2*S),c.fillStyle=n,c.fill("evenodd")}}}function v(e){var t,r=e.plugin,a=e.canvas,o=e.color,s=void 0===o?"rgba(255, 87, 45, 0.75)":o,u=r.helpers.viewportScreenshot,c=m(null==u?void 0:u.behaviors.values),l=m(null==u?void 0:u.behaviors.cropParams),d=m(null==u?void 0:u.behaviors.relativeCrop),f=Object(i.useRef)({x:0,y:0,width:0,height:0});m("viewport"===(null==c?void 0:c.resolution.name)?null===(t=r.canvas3d)||void 0===t?void 0:t.resized:void 0);var p=i.useState(""),h=p[0],g=p[1],v=Object(i.useState)([0,0]),_=v[0],S=v[1],x=Object(i.useState)([0,0]),O=x[0],w=x[1];if(!u||!a)return null;var C=u.getSizeAndViewport(),j=y(C.width,C.height,a.clientWidth,a.clientHeight),P={x:j.x+Math.floor(j.width*d.x),y:j.y+Math.floor(j.height*d.y),width:Math.ceil(j.width*d.width),height:Math.ceil(j.height*d.height)},E=b(P),A=b(j);if("move"===h?(E.l+=O[0]-_[0],E.r+=O[0]-_[0],E.t+=O[1]-_[1],E.b+=O[1]-_[1]):h&&(h.indexOf("left")>=0?E.l+=O[0]-_[0]:h.indexOf("right")>=0&&(E.r+=O[0]-_[0]),h.indexOf("top")>=0?E.t+=O[1]-_[1]:h.indexOf("bottom")>=0&&(E.b+=O[1]-_[1])),E.l>E.r){var D=E.l;E.l=E.r,E.r=D}if(E.t>E.b){D=E.t;E.t=E.b,E.b=D}E.l=Math.min(A.r-40,Math.max(A.l,E.l)),E.r=Math.max(A.l+40,Math.min(A.r,E.r)),E.t=Math.min(A.b-40,Math.max(A.t,E.t)),E.b=Math.max(A.t+40,Math.min(A.b,E.b)),P.x=E.l,P.y=E.t,P.width=E.r-E.l+1,P.height=E.b-E.t+1,f.current=P;var T=function(e){e.preventDefault(),w([e.pageX,e.pageY])},I=function(e){e.preventDefault();var t=e.touches[0];w([t.pageX,t.pageY])},M=function(e){e.preventDefault(),g(e.currentTarget.getAttribute("data-drag"));var t=e.touches[0],r=[t.pageX,t.pageY];S(r),w(r),window.addEventListener("touchend",V),window.addEventListener("touchmove",I)},k=function(e){e.preventDefault(),g(e.currentTarget.getAttribute("data-drag"));var t=[e.pageX,e.pageY];S(t),w(t),window.addEventListener("mouseup",B),window.addEventListener("mousemove",T)},B=function(){window.removeEventListener("mouseup",B),window.removeEventListener("mousemove",T),R()},V=function(){window.removeEventListener("touchend",V),window.removeEventListener("touchmove",I),R()};function R(){var e=f.current;l.auto&&(null==u||u.behaviors.cropParams.next(Object(n.__assign)(Object(n.__assign)({},l),{auto:!1}))),null==u||u.behaviors.relativeCrop.next({x:(e.x-j.x)/j.width,y:(e.y-j.y)/j.height,width:e.width/j.width,height:e.height/j.height}),g("");var t=[0,0];S(t),w(t)}var L=function(e){e.preventDefault(),e.stopPropagation()},N="3px solid "+s;return i.createElement(i.Fragment,null,i.createElement("div",{"data-drag":"move",style:{position:"absolute",left:P.x,top:P.y,width:P.width,height:P.height,border:N,cursor:"move"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"left",style:{position:"absolute",left:P.x-4,top:P.y+4,width:16,height:P.height-4,background:"transparent",cursor:"w-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"right",style:{position:"absolute",left:E.r-8,top:P.y,width:16,height:P.height-4,background:"transparent",cursor:"w-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"top",style:{position:"absolute",left:P.x-4,top:P.y-4,width:P.width+8,height:16,background:"transparent",cursor:"n-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"bottom",style:{position:"absolute",left:P.x-4,top:E.b-8,width:P.width+8,height:16,background:"transparent",cursor:"n-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"top, left",style:{position:"absolute",left:E.l-4,top:E.t-4,width:16,height:16,background:"transparent",cursor:"nw-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"bottom, right",style:{position:"absolute",left:E.r-8,top:E.b-8,width:16,height:16,background:"transparent",cursor:"nw-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"top, right",style:{position:"absolute",left:E.r-8,top:E.t-4,width:16,height:16,background:"transparent",cursor:"ne-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}),i.createElement("div",{"data-drag":"bottom, left",style:{position:"absolute",left:E.l-4,top:E.b-8,width:16,height:16,background:"transparent",cursor:"ne-resize"},onMouseDown:k,onTouchStart:M,draggable:!1,onContextMenu:L}))}function b(e){return{l:e.x,t:e.y,r:e.x+e.width-1,b:e.y+e.height-1}}function y(e,t,r,n){var i=e/t;if(i<=r/n){var a=n*i;return{x:Math.round((r-a)/2),y:0,width:Math.round(a),height:n}}a=r/i;return{x:0,y:Math.round((n-a)/2),width:r,height:Math.round(a)}}var _=r(292),S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showPreview:!0,isDisabled:!1},t.download=function(){var e;null===(e=t.plugin.helpers.viewportScreenshot)||void 0===e||e.download(),t.props.close()},t.copy=function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){var e;return Object(n.__generator)(this,(function(t){switch(t.label){case 0:return[4,null===(e=this.plugin.helpers.viewportScreenshot)||void 0===e?void 0:e.copyToClipboard()];case 1:return t.sent(),a.PluginCommands.Toast.Show(this.plugin,{message:"Copied to clipboard.",title:"Screenshot",timeoutMs:1500}),[2]}}))}))},t.copyImg=function(){return Object(n.__awaiter)(t,void 0,void 0,(function(){var e,t;return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return[4,null===(t=this.plugin.helpers.viewportScreenshot)||void 0===t?void 0:t.getImageDataUri()];case 1:return e=r.sent(),this.setState({imageData:e}),[2]}}))}))},t.open=function(e){e.target.files&&e.target.files[0]&&a.PluginCommands.State.Snapshots.OpenFile(t.plugin,{file:e.target.files[0]})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.data.behaviors.isUpdating,(function(t){e.setState({isDisabled:t})}))},t.prototype.componentWillUnmount=function(){this.setState({imageData:void 0})},t.prototype.render=function(){var e,t=this,r=!!(null===(e=navigator.clipboard)||void 0===e?void 0:e.write);return i.createElement("div",null,this.state.showPreview&&i.createElement("div",{className:"msp-image-preview"},i.createElement(h,{plugin:this.plugin}),i.createElement(O,{plugin:this.plugin})),i.createElement("div",{className:"msp-flex-row"},r&&i.createElement(u.Button,{icon:c.CopySvg,onClick:this.copy,disabled:this.state.isDisabled},"Copy"),!r&&!this.state.imageData&&i.createElement(u.Button,{icon:c.CopySvg,onClick:this.copyImg,disabled:this.state.isDisabled},"Copy"),this.state.imageData&&i.createElement(u.Button,{onClick:function(){return t.setState({imageData:void 0})},disabled:this.state.isDisabled},"Clear"),i.createElement(u.Button,{icon:c.GetAppSvg,onClick:this.download,disabled:this.state.isDisabled},"Download")),this.state.imageData&&i.createElement("div",{className:"msp-row msp-copy-image-wrapper"},i.createElement("div",null,"Right click below + Copy Image"),i.createElement("img",{src:this.state.imageData,style:{width:"100%",height:32,display:"block"}})),i.createElement(x,{plugin:this.plugin,isDisabled:this.state.isDisabled}),i.createElement(u.ExpandGroup,{header:"State"},i.createElement(_.StateExportImportControls,{onAction:this.props.close}),i.createElement(u.ExpandGroup,{header:"Save Options",initiallyExpanded:!1,noOffset:!0},i.createElement(_.LocalStateSnapshotParams,null))))},t}(s.PluginUIComponent);function x(e){var t=e.plugin,r=e.isDisabled,n=t.helpers.viewportScreenshot,a=m(n.behaviors.values);return i.createElement(f.ParameterControls,{params:n.params,values:a,onChangeValues:function(e){return n.behaviors.values.next(e)},isDisabled:r})}function O(e){var t=e.plugin.helpers.viewportScreenshot,r=m(null==t?void 0:t.behaviors.cropParams);return m(null==t?void 0:t.behaviors.relativeCrop),t?i.createElement("div",{style:{width:"100%",height:"24px",marginTop:"8px"}},i.createElement(u.ToggleButton,{icon:c.CropOrginalSvg,title:"Auto-crop",inline:!0,isSelected:r.auto,style:{background:"transparent",float:"left",width:"auto",height:"24px",lineHeight:"24px"},toggle:function(){return t.toggleAutocrop()},label:"Auto-crop "+(r.auto?"On":"Off")}),!r.auto&&i.createElement(u.Button,{icon:c.CropSvg,title:"Crop",style:{background:"transparent",float:"right",height:"24px",lineHeight:"24px",width:"24px",padding:"0"},onClick:function(){return t.autocrop()}}),!r.auto&&!t.isFullFrame&&i.createElement(u.Button,{icon:c.CropFreeSvg,title:"Reset Crop",style:{background:"transparent",float:"right",height:"24px",lineHeight:"24px",width:"24px",padding:"0"},onClick:function(){return t.resetCrop()}})):null}var w=r(403),C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.allCollapsedState={isSettingsExpanded:!1,isScreenshotExpanded:!1},t.state=Object(n.__assign)({},t.allCollapsedState),t.resetCamera=function(){a.PluginCommands.Camera.Reset(t.plugin,{})},t.toggleSettingsExpanded=t.toggle("isSettingsExpanded"),t.toggleScreenshotExpanded=t.toggle("isScreenshotExpanded"),t.toggleControls=function(){a.PluginCommands.Layout.Update(t.plugin,{state:{showControls:!t.plugin.layout.state.showControls}})},t.toggleExpanded=function(){a.PluginCommands.Layout.Update(t.plugin,{state:{isExpanded:!t.plugin.layout.state.isExpanded}})},t.setSettings=function(e){var r;a.PluginCommands.Canvas3D.SetSettings(t.plugin,{settings:(r={},r[e.name]=e.value,r)})},t.setLayout=function(e){var r;a.PluginCommands.Layout.Update(t.plugin,{state:(r={},r[e.name]=e.value,r)})},t.screenshot=function(){var e;null===(e=t.plugin.helpers.viewportScreenshot)||void 0===e||e.download()},t.onMouseMove=function(e){0===e.buttons&&e.stopPropagation()},t}return Object(n.__extends)(t,e),t.prototype.toggle=function(e){var t=this;return function(r){var i;t.setState(Object(n.__assign)(Object(n.__assign)({},t.allCollapsedState),((i={})[e]=!t.state[e],i))),null==r||r.currentTarget.blur()}},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.layout.events.updated,(function(){return e.forceUpdate()}))},t.prototype.icon=function(e,t,r,n){return void 0===n&&(n=!0),i.createElement(u.IconButton,{svg:e,toggleState:n,onClick:t,title:r,style:{background:"transparent"}})},t.prototype.render=function(){return i.createElement("div",{className:"msp-viewport-controls",onMouseMove:this.onMouseMove},i.createElement("div",{className:"msp-viewport-controls-buttons"},i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),this.icon(c.AutorenewSvg,this.resetCamera,"Reset Camera")),i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),this.icon(c.CameraOutlinedSvg,this.toggleScreenshotExpanded,"Screenshot / State Snapshot",this.state.isScreenshotExpanded)),i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),this.plugin.config.get(o.PluginConfig.Viewport.ShowControls)&&this.icon(c.BuildOutlinedSvg,this.toggleControls,"Toggle Controls Panel",this.plugin.layout.state.showControls),this.plugin.config.get(o.PluginConfig.Viewport.ShowExpand)&&this.icon(c.FullscreenSvg,this.toggleExpanded,"Toggle Expanded Viewport",this.plugin.layout.state.isExpanded),this.plugin.config.get(o.PluginConfig.Viewport.ShowSettings)&&this.icon(c.TuneSvg,this.toggleSettingsExpanded,"Settings / Controls Info",this.state.isSettingsExpanded)),this.plugin.config.get(o.PluginConfig.Viewport.ShowSelectionMode)&&i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),i.createElement(l.ToggleSelectionModeButton,null))),this.state.isScreenshotExpanded&&i.createElement("div",{className:"msp-viewport-controls-panel"},i.createElement(u.ControlGroup,{header:"Screenshot / State",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleScreenshotExpanded,topRightIcon:c.CloseSvg,noTopMargin:!0,childrenClassName:"msp-viewport-controls-panel-controls"},i.createElement(S,{close:this.toggleScreenshotExpanded}))),this.state.isSettingsExpanded&&i.createElement("div",{className:"msp-viewport-controls-panel"},i.createElement(u.ControlGroup,{header:"Settings / Controls Info",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleSettingsExpanded,topRightIcon:c.CloseSvg,noTopMargin:!0,childrenClassName:"msp-viewport-controls-panel-controls"},i.createElement(w.SimpleSettingsControl,null))))},t}(s.PluginUIComponent),j=function(){return i.createElement("a",{className:"msp-logo",href:"https://molstar.org",target:"_blank"})},P=function(){return i.createElement(d,{logo:j})}},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureComponentControls",(function(){return y})),r.d(t,"AddComponentControls",(function(){return S}));var n=r(0),i=r(3),a=r(167),o=r(260),s=r(284),u=r(27),c=r(13),l=r(2),d=r(33),f=r(56),p=r(18),m=r(15),h=r(73),g=r(189),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"current",{get:function(){return this.plugin.managers.structure.hierarchy.behaviors.selection},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.current,(function(){return e.forceUpdate()}))},Object.defineProperty(t.prototype,"unitcell",{get:function(){var e,t=this.plugin.managers.structure.hierarchy.selection;if(0===t.structures.length)return null;for(var r=[],n=0,a=t.structures;n<a.length;n++){var o=a[n].model;(null==o?void 0:o.unitcell)&&(null===(e=o.unitcell)||void 0===e?void 0:e.cell.obj)&&r.push(o.unitcell)}return 0===r.length?null:i.createElement(b,{refs:r,labelMultiple:"Unit Cells"})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customControls",{get:function(){var e=this,t=[];return this.plugin.genericRepresentationControls.forEach((function(r,n){var a=r(e.plugin.managers.structure.hierarchy.selection),o=a[0],s=a[1];o.length>0&&t.push(i.createElement("div",{key:n},i.createElement(b,{refs:o,labelMultiple:s})))})),t.length>0?t:null},enumerable:!1,configurable:!0}),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{style:{marginTop:"6px"}},this.unitcell,this.customControls))},t}(d.PurePluginUIComponent),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showOptions:!1},t.toggleVisibility=function(e){e.preventDefault(),t.plugin.managers.structure.hierarchy.toggleVisibility(t.props.refs),e.currentTarget.blur()},t.highlight=function(e){e.preventDefault(),t.pivot.cell.parent&&u.PluginCommands.Interactivity.Object.Highlight(t.plugin,{state:t.pivot.cell.parent,ref:t.props.refs.map((function(e){return e.cell.transform.ref}))})},t.clearHighlight=function(e){e.preventDefault(),u.PluginCommands.Interactivity.ClearHighlights(t.plugin)},t.focus=function(e){var r;e.preventDefault();for(var n=!0,i=0,a=t.props.refs;i<a.length;i++){if(!(c=a[i]).cell.state.isHidden){n=!1;break}}n&&t.plugin.managers.structure.hierarchy.toggleVisibility(t.props.refs,"show");for(var o=[],s=0,u=t.props.refs;s<u.length;s++){var c;if(!(c=u[s]).cell.state.isHidden){var l=null===(r=c.cell.obj)||void 0===r?void 0:r.data.repr.getLoci();l&&o.push(l)}}t.plugin.managers.camera.focusLoci(o)},t.toggleOptions=function(){return t.setState({showOptions:!t.state.showOptions})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){var r;c.State.ObjectEvent.isCell(t,null===(r=e.pivot)||void 0===r?void 0:r.cell)&&e.forceUpdate()}))},Object.defineProperty(t.prototype,"pivot",{get:function(){return this.props.refs[0]},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props,t=e.refs,r=e.labelMultiple;if(0===t.length)return null;var n,a,o=t[0];if(1===t.length){var s=o.cell.obj;if(!s)return null;n=null==s?void 0:s.label,a=null==s?void 0:s.description}else n=t.length+" "+(r||"Objects");return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement("button",{className:"msp-form-control msp-control-button-label",title:n+". Click to focus.",onClick:this.focus,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlign:"left"}},n," ",i.createElement("small",null,a)),i.createElement(p.IconButton,{svg:o.cell.state.isHidden?m.VisibilityOffOutlinedSvg:m.VisibilityOutlinedSvg,toggleState:!1,className:"msp-form-control",onClick:this.toggleVisibility,title:o.cell.state.isHidden?"Show":"Hide",small:!0,flex:!0}),1===t.length&&i.createElement(p.IconButton,{svg:m.MoreHorizSvg,className:"msp-form-control",onClick:this.toggleOptions,title:"Options",toggleState:this.state.showOptions,flex:!0})),1===t.length&&this.state.showOptions&&o.cell.parent&&i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-control-offset"},i.createElement(g.UpdateTransformControl,{state:o.cell.parent,transform:o.cell.transform,customHeader:"none",autoHideApply:!0}))))},t}(d.PurePluginUIComponent),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.defaultState=function(){return{header:"Components",isCollapsed:!1,isDisabled:!1,brand:{accent:"blue",svg:m.CubeOutlineSvg}}},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(t){return e.setState({description:s.StructureHierarchyManager.getSelectedStructuresDescription(e.plugin)})}))},t.prototype.renderControls=function(){return i.createElement(i.Fragment,null,i.createElement(_,null),i.createElement(O,null),i.createElement(v,null))},t}(d.CollapsableControls),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isEmpty:!0,isBusy:!1,canUndo:!1},t.togglePreset=t.toggleAction("preset"),t.toggleAdd=t.toggleAction("add"),t.toggleOptions=t.toggleAction("options"),t.hideAction=function(){return t.setState({action:void 0})},t.applyPreset=function(e){if(t.hideAction(),e){var r=t.plugin.managers.structure,n=r.hierarchy.selection.structures;null===e.value?r.component.clear(n):r.component.applyPreset(n,e.value)}},t.undo=function(){var e=t.plugin.state.data.undo();e&&t.plugin.runTask(e)},t}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"isDisabled",{get:function(){return this.state.isBusy||this.state.isEmpty},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(t){return e.setState({action:"options"!==e.state.action||0===t.structures.length?void 0:"options",isEmpty:0===t.structures.length})})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t,action:"options"!==e.state.action?void 0:"options"})})),this.subscribe(this.plugin.state.data.events.historyUpdated,(function(t){var r=t.state;e.setState({canUndo:r.canUndo})}))},t.prototype.toggleAction=function(e){var t=this;return function(){return t.setState({action:t.state.action===e?void 0:e})}},Object.defineProperty(t.prototype,"presetControls",{get:function(){return i.createElement(f.a,{items:this.presetActions,onSelect:this.applyPreset})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"presetActions",{get:function(){var e=this.plugin.managers.structure.component.pivotStructure,t=this.plugin.builders.structure.representation.getPresets(null==e?void 0:e.cell.obj);return f.a.createItems(t,{label:function(e){return e.display.name},category:function(e){return e.display.group},description:function(e){return e.display.description}})},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.state.canUndo?"Undo "+this.plugin.state.data.latestUndoLabel:"Some mistakes of the past can be undone.";return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(p.ToggleButton,{icon:m.BookmarksOutlinedSvg,label:"Preset",title:"Apply a representation preset for the current structure(s).",toggle:this.togglePreset,isSelected:"preset"===this.state.action,disabled:this.isDisabled}),i.createElement(p.ToggleButton,{icon:m.AddSvg,label:"Add",title:"Add a new representation component for a selection.",toggle:this.toggleAdd,isSelected:"add"===this.state.action,disabled:this.isDisabled}),i.createElement(p.ToggleButton,{icon:m.TuneSvg,label:"",title:"Options that are applied to all applicable representations.",style:{flex:"0 0 40px",padding:0},toggle:this.toggleOptions,isSelected:"options"===this.state.action,disabled:this.isDisabled}),i.createElement(p.IconButton,{svg:m.RestoreSvg,className:"msp-flex-item",flex:"40px",onClick:this.undo,disabled:!this.state.canUndo||this.isDisabled,title:e})),"preset"===this.state.action&&this.presetControls,"add"===this.state.action&&i.createElement("div",{className:"msp-control-offset"},i.createElement(S,{onApply:this.hideAction})),"options"===this.state.action&&i.createElement("div",{className:"msp-control-offset"},i.createElement(x,{isDisabled:this.isDisabled})))},t}(d.PurePluginUIComponent),S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state=t.createState(),t.apply=function(){var e=t.props.forSelection?t.currentStructures:t.selectedStructures;t.props.onApply(),t.plugin.managers.structure.component.add(t.state.values,e)},t.paramsChanged=function(e){return t.setState({values:e})},t}return Object(n.__extends)(t,e),t.prototype.createState=function(){var e=o.StructureComponentManager.getAddParams(this.plugin);return{params:e,values:l.ParamDefinition.getDefaultValues(e)}},Object.defineProperty(t.prototype,"selectedStructures",{get:function(){return this.plugin.managers.structure.component.currentStructures},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currentStructures",{get:function(){return this.plugin.managers.structure.hierarchy.current.structures},enumerable:!1,configurable:!0}),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement(h.ParameterControls,{params:this.state.params,values:this.state.values,onChangeValues:this.paramsChanged}),i.createElement(p.Button,{icon:m.AddSvg,title:"Use Selection and optional Representation to create a new Component.",className:"msp-btn-commit msp-btn-commit-on",onClick:this.apply,style:{marginTop:"1px"}},"Create Component"))},t}(d.PurePluginUIComponent),x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.update=function(e){return t.plugin.managers.structure.component.setOptions(e)},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.component.events.optionsUpdated,(function(){return e.forceUpdate()}))},t.prototype.render=function(){return i.createElement(h.ParameterControls,{params:o.StructureComponentManager.OptionsParams,values:this.plugin.managers.structure.component.state.options,onChangeValues:this.update,isDisabled:this.props.isDisabled})},t}(d.PurePluginUIComponent),O=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(){e.forceUpdate()}))},t.prototype.render=function(){var e=this.plugin.managers.structure.hierarchy.currentComponentGroups;return 0===e.length?null:i.createElement("div",{style:{marginTop:"6px"}},e.map((function(e){return i.createElement(w,{key:e[0].cell.transform.ref,group:e})})))},t}(d.PurePluginUIComponent),w=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={action:void 0},t.toggleVisible=function(e){e.preventDefault(),e.currentTarget.blur(),t.plugin.managers.structure.component.toggleVisibility(t.props.group)},t.selectAction=function(e){e&&(t.setState({action:void 0}),(null==e?void 0:e.value)())},t.remove=function(){return t.plugin.managers.structure.hierarchy.remove(t.props.group,!0)},t.toggleAction=function(){return t.setState({action:"action"===t.state.action?void 0:"action"})},t.toggleLabel=function(){return t.setState({action:"label"===t.state.action?void 0:"label"})},t.highlight=function(e){e.preventDefault(),t.props.group[0].cell.parent&&u.PluginCommands.Interactivity.Object.Highlight(t.plugin,{state:t.props.group[0].cell.parent,ref:t.props.group.map((function(e){return e.cell.transform.ref}))})},t.clearHighlight=function(e){e.preventDefault(),u.PluginCommands.Interactivity.ClearHighlights(t.plugin)},t.focus=function(){for(var e=!0,r=0,n=t.props.group;r<n.length;r++){if(!n[r].cell.state.isHidden){e=!1;break}}e&&t.plugin.managers.structure.hierarchy.toggleVisibility(t.props.group,"show"),t.plugin.managers.camera.focusSpheres(t.props.group,(function(e){var t;if(!e.cell.state.isHidden)return null===(t=e.cell.obj)||void 0===t?void 0:t.data.boundary.sphere}))},t.updateLabel=function(e){t.plugin.managers.structure.component.updateLabel(t.pivot,e)},t}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"pivot",{get:function(){return this.props.group[0]},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){c.State.ObjectEvent.isCell(t,e.pivot.cell)&&e.forceUpdate()}))},Object.defineProperty(t.prototype,"colorByActions",{get:function(){var e,t,r=this,n=this.plugin.managers.structure.component,i=null===(e=this.pivot.representations[0].cell.transform.params)||void 0===e?void 0:e.colorTheme.name,o=Object(a.getStructureThemeTypes)(this.plugin,null===(t=this.pivot.cell.obj)||void 0===t?void 0:t.data);return f.a.createItemsFromSelectOptions(o,{value:function(e){return function(){return n.updateRepresentationsTheme(r.props.group,{color:e[0]})}},selected:function(e){return e[0]===i}})},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actions",{get:function(){var e=this,t=this.plugin.managers.structure.component,r=[Object(n.__spreadArrays)([f.a.Header("Add Representation")],o.StructureComponentManager.getRepresentationTypes(this.plugin,this.props.group[0]).map((function(r){return f.a.Item(r[1],(function(){return t.addRepresentation(e.props.group,r[0])}))})))];return this.pivot.representations.length>0&&r.push(Object(n.__spreadArrays)([f.a.Header("Set Coloring",{isIndependent:!0})],this.colorByActions)),t.canBeModified(this.props.group[0])&&r.push([f.a.Header("Modify by Selection"),f.a.Item("Include",(function(){return t.modifyByCurrentSelection(e.props.group,"union")}),{icon:m.UnionSvg}),f.a.Item("Subtract",(function(){return t.modifyByCurrentSelection(e.props.group,"subtract")}),{icon:m.SubtractSvg}),f.a.Item("Intersect",(function(){return t.modifyByCurrentSelection(e.props.group,"intersect")}),{icon:m.IntersectSvg})]),r.push(f.a.Item("Select This",(function(){return t.selectThis(e.props.group)}),{icon:m.SetSvg})),t.canBeModified(this.props.group[0])&&r.push(f.a.Item("Edit Label",this.toggleLabel)),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reprLabel",{get:function(){var e,t=this.pivot;return 0===t.representations.length?"No repr.":1===t.representations.length?null===(e=t.representations[0].cell.obj)||void 0===e?void 0:e.label:t.representations.length+" reprs"},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e,t=this,r=this.pivot,n=r.cell,a=null===(e=n.obj)||void 0===e?void 0:e.label,o=this.reprLabel;return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(p.Button,{noOverflow:!0,className:"msp-control-button-label",title:a+". Click to focus.",onClick:this.focus,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlign:"left"}},a,i.createElement("small",{className:"msp-25-lower-contrast-text",style:{float:"right"}},o)),i.createElement(p.IconButton,{svg:n.state.isHidden?m.VisibilityOffOutlinedSvg:m.VisibilityOutlinedSvg,toggleState:!1,onClick:this.toggleVisible,title:(n.state.isHidden?"Show":"Hide")+" component",small:!0,className:"msp-form-control",flex:!0}),i.createElement(p.IconButton,{svg:m.DeleteOutlinedSvg,toggleState:!1,onClick:this.remove,title:"Remove",small:!0,className:"msp-form-control",flex:!0}),i.createElement(p.IconButton,{svg:m.MoreHorizSvg,onClick:this.toggleAction,title:"Actions",toggleState:"action"===this.state.action,className:"msp-form-control",flex:!0})),"label"===this.state.action&&i.createElement("div",{className:"msp-control-offset",style:{marginBottom:"6px"}},i.createElement(p.ControlRow,{label:"Label",control:i.createElement("div",{style:{display:"flex",textAlignLast:"center"}},i.createElement(p.TextInput,{onChange:this.updateLabel,value:a,style:{flex:"1 1 auto",minWidth:0},className:"msp-form-control",blurOnEnter:!0,blurOnEscape:!0}),i.createElement(p.IconButton,{svg:m.CheckSvg,onClick:this.toggleLabel,className:"msp-form-control msp-control-button-label",flex:!0}))})),"action"===this.state.action&&i.createElement("div",{className:"msp-accent-offset"},i.createElement("div",{style:{marginBottom:"6px"}},i.createElement(f.a,{items:this.actions,onSelect:this.selectAction,noOffset:!0})),i.createElement("div",{style:{marginBottom:"6px"}},r.representations.map((function(e){return i.createElement(C,{group:t.props.group,key:e.cell.transform.ref,representation:e})})))))},t}(d.PurePluginUIComponent),C=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.remove=function(){return t.plugin.managers.structure.component.removeRepresentations(t.props.group,t.props.representation)},t.toggleVisible=function(e){e.preventDefault(),e.currentTarget.blur(),t.plugin.managers.structure.component.toggleVisibility(t.props.group,t.props.representation)},t.update=function(e){return t.plugin.managers.structure.component.updateRepresentations(t.props.group,t.props.representation,e)},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){c.State.ObjectEvent.isCell(t,e.props.representation.cell)&&e.forceUpdate()}))},t.prototype.render=function(){var e,t=this.props.representation.cell;return i.createElement("div",{className:"msp-representation-entry"},t.parent&&i.createElement(p.ExpandGroup,{header:((null===(e=t.obj)||void 0===e?void 0:e.label)||"")+" Representation",noOffset:!0},i.createElement(g.UpdateTransformControl,{state:t.parent,transform:t.transform,customHeader:"none",customUpdate:this.update,noMargin:!0})),i.createElement(p.IconButton,{svg:m.DeleteOutlinedSvg,onClick:this.remove,title:"Remove",small:!0,className:"msp-default-bg",toggleState:!1,style:{position:"absolute",top:0,right:"32px",lineHeight:"24px",height:"24px",textAlign:"right",width:"44px",paddingRight:"6px",background:"none"}}),i.createElement(p.IconButton,{svg:this.props.representation.cell.state.isHidden?m.VisibilityOffOutlinedSvg:m.VisibilityOutlinedSvg,toggleState:!1,onClick:this.toggleVisible,title:"Toggle Visibility",small:!0,className:"msp-default-bg",style:{position:"absolute",top:0,right:0,lineHeight:"24px",height:"24px",textAlign:"right",width:"32px",paddingRight:"6px",background:"none"}}))},t}(d.PurePluginUIComponent)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i})),r.d(t,"c",(function(){return a}));var n=13330===new Uint16Array(new Uint8Array([18,52]).buffer)[0];function i(e,t){for(var r=new ArrayBuffer(e.length),n=new Uint8Array(r),i=0,a=e.length;i<a;i+=t)for(var o=0;o<t;o++)n[i+t-o-1]=e[i+o];return r}function a(e){if(e.length>28672){for(var t=[],r=0;r<e.length;r+=28672)t.push(String.fromCharCode.apply(null,e.subarray(r,r+28672)));return t.join("")}return String.fromCharCode.apply(null,e)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(59),a=r(63),o=r(7),s=r(157);!function(e){e.Descriptor={name:"chem_comp_bond",cifExport:{prefix:"",categories:[{name:"chem_comp_bond",instance:function(t){var r=e.Provider.get(t.firstModel);if(!r)return a.a.Category.Empty;var n=r.data;if(!n)return a.a.Category.Empty;for(var i=t.structures[0].uniqueResidueNames,o=n.comp_id,s=n._rowCount,u=[],c=0;c<s;c++)i.has(o.value(c))&&(u[u.length]=c);return a.a.Category.ofTable(n,u)}}]}},e.Provider=s.a.create(e.Descriptor),e.chemCompBondFromTable=function(e,t){return o.d.pick(t,i.a.chem_comp_bond,(function(r){return e.properties.chemicalComponentMap.has(t.comp_id.value(r))}))},e.getEntriesFromChemCompBond=function(e){var r=new Map;function n(e){if(r.has(e))return r.get(e);var n=new t(e);return r.set(e,n),n}for(var i=e.comp_id,a=e.atom_id_1,o=e.atom_id_2,s=e.value_order,u=e.pdbx_aromatic_flag,c=e._rowCount,l=n(i.value(0)),d=0;d<c;d++){var f=i.value(d),p=a.value(d),m=o.value(d),h=s.value(d),g="Y"===u.value(d);l.id!==f&&(l=n(f));var v=1,b=1;switch(g&&(v|=16),h.toLowerCase()){case"doub":case"delo":b=2;break;case"trip":b=3;break;case"quad":b=4}l.add(p,m,b,v)}return r};var t=function(){function e(e){this.id=e,this.map=new Map}return e.prototype.add=function(e,t,r,n,i){void 0===i&&(i=!0);var a=this.map.get(e);if(void 0!==a){void 0===a.get(t)&&a.set(t,{order:r,flags:n})}else{var o=new Map;o.set(t,{order:r,flags:n}),this.map.set(e,o)}i&&this.add(t,e,r,n,!1)},e}();e.Entry=t}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return u}));var n=r(28),i=r(6),a=r(63),o=r(7);function s(e){var t=function(e){for(var t=new Set,r=[],a=0,o=e.structures;a<o.length;a++)for(var s=o[a],u=n.d.Location.create(s),c=0,l=s.units;c<l.length;c++){var d=l[c],f=d.conformation.operator;if(f.suffix&&0===d.kind){u.unit=d;for(var p=d.elements,m=i.Segmentation.transientSegments(d.model.atomicHierarchy.chainAtomSegments,p);m.hasNext;){var h=m.move();u.element=p[h.start];var g=n.e.chain.label_asym_id(u),v=""+g+f.suffix;if(!t.has(v)){t.add(v);var b=n.e.chain.label_asym_id(u);r.push({label_asym_id:g,auth_asym_id:b,operator:f})}}}}return r}(e);if(0!==t.length)return[f,t,{ignoreFilter:!0}]}var u={molstar_atom_site_operator_mapping:{label_asym_id:o.a.Schema.Str(),auth_asym_id:o.a.Schema.Str(),operator_name:o.a.Schema.Str(),suffix:o.a.Schema.Str(),assembly_id:o.a.Schema.Str(),assembly_operator_id:o.a.Schema.Int(),symmetry_operator_index:o.a.Schema.Int(),symmetry_hkl:o.a.Schema.Vector(3),ncs_id:o.a.Schema.Int()}},c=function(e,t){return void 0===t[e].operator.assembly?1:0},l=function(e,t){return-1===t[e].operator.spgrOp?1:0},d=a.a.fields().str("label_asym_id",(function(e,t){return t[e].label_asym_id})).str("auth_asym_id",(function(e,t){return t[e].auth_asym_id})).str("operator_name",(function(e,t){return t[e].operator.name})).str("suffix",(function(e,t){return t[e].operator.suffix})).str("assembly_id",(function(e,t){var r;return(null===(r=t[e].operator.assembly)||void 0===r?void 0:r.id)||""}),{valueKind:c}).int("assembly_operator_id",(function(e,t){var r;return(null===(r=t[e].operator.assembly)||void 0===r?void 0:r.operId)||0}),{valueKind:c}).int("symmetry_operator_index",(function(e,t){return t[e].operator.spgrOp}),{valueKind:l}).vec("symmetry_hkl",[function(e,t){return t[e].operator.hkl[0]},function(e,t){return t[e].operator.hkl[1]},function(e,t){return t[e].operator.hkl[2]}],{valueKind:l}).int("ncs_id",(function(e,t){return t[e].operator.ncsId}),{valueKind:l}).getFields(),f={name:"molstar_atom_site_operator_mapping",instance:function(e){return{fields:d,source:[{data:e,rowCount:e.length}]}}}},function(e,t,r){"use strict";var n;r.d(t,"a",(function(){return n})),function(e){e.create=function(e,t,r){return{array:e,width:t,height:r}},e.flipY=function(e){for(var t=e.array,r=e.width,n=e.height,i=4*r,a=0,o=n/2;a<o;++a)for(var s=0,u=i;s<u;++s){var c=a*i+s,l=(n-a-1)*i+s,d=t[c];t[c]=t[l],t[l]=d}return e}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return s}));var n=r(99),i=r(48),a=Object(n.a)();function o(e,t){var r=t.type,n=t.source,a=e.createShader("vert"===r?e.VERTEX_SHADER:e.FRAGMENT_SHADER);if(null===a)throw new Error("Error creating "+r+" shader");if(e.shaderSource(a,n),e.compileShader(a),i.a&&!1===e.getShaderParameter(a,e.COMPILE_STATUS))throw console.warn("'"+r+"' shader info log '"+e.getShaderInfoLog(a)+"'\n"+function(e){for(var t=e.split("\n"),r=0;r<t.length;++r)t[r]=r+1+": "+t[r];return t.join("\n")}(n)),new Error("Error compiling "+r+" shader");return a}function s(e,t){var r=o(e,t);return{id:a(),attach:function(t){e.attachShader(t,r)},reset:function(){r=o(e,t)},destroy:function(){e.deleteShader(r)}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return u}));var n=r(0),i=r(3),a=r(18),o=r(5),s=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isChanging:!1,current:0},t.begin=function(){t.setState({isChanging:!0})},t.end=function(e){t.setState({isChanging:!1}),t.props.onChange(e)},t.updateCurrent=function(e){var r,n;t.setState({current:e}),null===(n=(r=t.props).onChangeImmediate)||void 0===n||n.call(r,e)},t.updateManually=function(e){t.setState({isChanging:!0});var r=e;1===t.props.step&&(r=Math.round(r)),r<t.props.min&&(r=t.props.min),r>t.props.max&&(r=t.props.max),t.setState({current:r,isChanging:!0})},t.onManualBlur=function(){t.setState({isChanging:!1}),t.props.onChange(t.state.current)},t}return Object(n.__extends)(t,e),t.getDerivedStateFromProps=function(e,t){return t.isChanging||e.value===t.current?null:{current:e.value}},t.prototype.render=function(){var e=this.props.step;return void 0===e&&(e=1),i.createElement("div",{className:"msp-slider"},i.createElement("div",null,i.createElement(g,{min:this.props.min,max:this.props.max,step:e,value:this.state.current,disabled:this.props.disabled,onBeforeChange:this.begin,onChange:this.updateCurrent,onAfterChange:this.end})),i.createElement("div",null,i.createElement(a.TextInput,{numeric:!0,delayMs:50,value:this.state.current,blurOnEnter:!0,onBlur:this.onManualBlur,isDisabled:this.props.disabled,onChange:this.updateManually})))},t}(i.Component),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isChanging:!1,current:[0,1]},t.begin=function(){t.setState({isChanging:!0})},t.end=function(e){t.setState({isChanging:!1}),t.props.onChange(e)},t.updateCurrent=function(e){t.setState({current:e})},t.updateMax=function(e){var r=e;1===t.props.step&&(r=Math.round(r)),r<t.state.current[0]?r=t.state.current[0]:r<t.props.min&&(r=t.props.min),r>t.props.max&&(r=t.props.max),t.props.onChange([t.state.current[0],r])},t.updateMin=function(e){var r=e;1===t.props.step&&(r=Math.round(r)),r<t.props.min&&(r=t.props.min),r>t.state.current[1]?r=t.state.current[1]:r>t.props.max&&(r=t.props.max),t.props.onChange([r,t.state.current[1]])},t}return Object(n.__extends)(t,e),t.getDerivedStateFromProps=function(e,t){return t.isChanging||e.value[0]===t.current[0]&&e.value[1]===t.current[1]?null:{current:e.value}},t.prototype.render=function(){var e=this.props.step;return void 0===e&&(e=1),i.createElement("div",{className:"msp-slider2"},i.createElement("div",null,i.createElement(a.TextInput,{numeric:!0,delayMs:50,value:this.state.current[0],onEnter:this.props.onEnter,blurOnEnter:!0,isDisabled:this.props.disabled,onChange:this.updateMin})),i.createElement("div",null,i.createElement(g,{min:this.props.min,max:this.props.max,step:e,value:this.state.current,disabled:this.props.disabled,onBeforeChange:this.begin,onChange:this.updateCurrent,onAfterChange:this.end,range:!0,allowCross:!0})),i.createElement("div",null,i.createElement(a.TextInput,{numeric:!0,delayMs:50,value:this.state.current[1],onEnter:this.props.onEnter,blurOnEnter:!0,isDisabled:this.props.disabled,onChange:this.updateMax})))},t}(i.Component);function c(e){for(var t=[],r={}.hasOwnProperty,n=0;n<arguments.length;n++){var i=arguments[n];if(i){var a=typeof i;if("string"===a||"number"===a)t.push(i);else if(Array.isArray(i))t.push(c.apply(null,i));else if("object"===a)for(var o in i)r.call(i,o)&&i[o]&&t.push(o)}}return t.join(" ")}function l(e){return e.touches.length>1||"touchend"===e.type.toLowerCase()&&e.touches.length>0}function d(e,t){return e?t.touches[0].clientY:t.touches[0].pageX}function f(e,t){return e?t.clientY:t.pageX}function p(e,t){var r=t.getBoundingClientRect();return e?r.top+.5*r.height:r.left+.5*r.width}function m(e){e.stopPropagation(),e.preventDefault()}var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props,t=e.className,r=e.tipFormatter,n=e.vertical,a=e.offset,o=e.value,s=e.index,u=n?{bottom:a+"%"}:{left:a+"%"};return i.createElement("div",{className:t,style:u,title:r(o,s)})},t}(i.Component),g=function(e){function t(t){var r=e.call(this,t)||this;r.sliderElement=i.createRef(),r.handleElements=[],r.dragOffset=0,r.startPosition=0,r.startValue=0,r._getPointsCache=void 0,r.onMouseDown=function(e){if(0===e.button){var t=f(r.props.vertical,e);if(r.isEventFromHandle(e)){var n=p(r.props.vertical,e.target);r.dragOffset=t-n,t=n}else r.dragOffset=0;r.onStart(t),r.addDocumentEvents("mouse"),m(e)}},r.onTouchMove=function(e){if(l(e))r.end("touch");else{var t=d(r.props.vertical,e);r.onMove(e,t-r.dragOffset)}},r.onTouchStart=function(e){if(!l(e)){var t=d(r.props.vertical,e);if(r.isEventFromHandle(e)){var n=p(r.props.vertical,e.target);r.dragOffset=t-n,t=n}else r.dragOffset=0;r.onStart(t),r.addDocumentEvents("touch"),m(e)}},r.eventHandlers={touchmove:function(e){return r.onTouchMove(e)},touchend:function(e){return r.end("touch")},mousemove:function(e){return r.onMouseMove(e)},mouseup:function(e){return r.end("mouse")}},r.calcOffset=function(e){var t=r.props,n=t.min;return 100*((e-n)/(t.max-n))};var n,a=t.range,o=t.min,s=t.max,u=a?Array.apply(null,Array(+a+1)).map((function(){return o})):o,c="defaultValue"in t?t.defaultValue:u,h=void 0!==t.value?t.value:c,g=(a?h:[o,h]).map((function(e){return r.trimAlignValue(e)}));return n=a&&g[0]===g[g.length-1]&&g[0]===s?0:g.length-1,r.state={handle:null,recent:n,bounds:g},r}return Object(n.__extends)(t,e),t.prototype.componentDidUpdate=function(e){var t=this;if("value"in this.props||"min"in this.props||"max"in this.props){var r=this.state.bounds;if(e.range){var n=(i=this.props.value||r).map((function(e){return t.trimAlignValue(e,t.props)}));if(n.every((function(e,t){return e===r[t]})))return;this.setState({bounds:n}),r.some((function(e){return t.isValueOutOfBounds(e,t.props)}))&&this.props.onChange(n)}else{var i=void 0!==this.props.value?this.props.value:r[1],a=this.trimAlignValue(i,this.props);if(a===r[1]&&r[0]===e.min)return;this.setState({bounds:[e.min,a]}),this.isValueOutOfBounds(r[1],this.props)&&this.props.onChange(a)}}},t.prototype.onChange=function(e){var t=this.props;!("value"in t)?this.setState(e):void 0!==e.handle&&this.setState({handle:e.handle});var r=Object(n.__assign)(Object(n.__assign)({},this.state),e),i=t.range?r.bounds:r.bounds[1];t.onChange(i)},t.prototype.onMouseMove=function(e){var t=f(this.props.vertical,e);this.onMove(e,t-this.dragOffset)},t.prototype.onMove=function(e,t){m(e);var r=this.props,i=this.state,a=t-this.startPosition,o=(a=this.props.vertical?-a:a)/this.getSliderLength()*(r.max-r.min),s=this.trimAlignValue(this.startValue+o);if(s!==i.bounds[i.handle]){var u=Object(n.__spreadArrays)(i.bounds);u[i.handle]=s;var c=i.handle;if(r.pushable){var l=i.bounds[c];this.pushSurroundingHandles(u,c,l)}else r.allowCross&&(u.sort((function(e,t){return e-t})),c=u.indexOf(s));this.onChange({handle:c,bounds:u})}},t.prototype.onStart=function(e){this.props.onBeforeChange(this.getValue());var t=this.calcValueByPos(e);this.startValue=t,this.startPosition=e;var r=this.state,i=r.bounds,a=1;if(this.props.range){for(var o=0,s=1;s<i.length-1;++s)t>i[s]&&(o=s);Math.abs(i[o+1]-t)<Math.abs(i[o]-t)&&(o+=1),a=o;var u=i[o+1]===i[o];u&&(a=r.recent),u&&t!==i[o+1]&&(a=t<i[o+1]?o:o+1)}if(this.setState({handle:a,recent:a}),t!==r.bounds[a]){var c=Object(n.__spreadArrays)(r.bounds);c[a]=t,this.onChange({bounds:c})}},t.prototype.getPoints=function(){var e=this.props,t=e.marks,r=e.step,i=e.min,a=e.max,o=this._getPointsCache;if(!o||o.marks!==t||o.step!==r){var s=Object(n.__assign)({},t);if(null!==r)for(var u=i;u<=a;u+=r)s[u]=u;var c=Object.keys(s).map(parseFloat);c.sort((function(e,t){return e-t})),this._getPointsCache={marks:t,step:r,points:c}}return this._getPointsCache.points},t.prototype.getPrecision=function(e){var t=e.toString(),r=0;return t.indexOf(".")>=0&&(r=t.length-t.indexOf(".")-1),r},t.prototype.getSliderLength=function(){var e=this.sliderElement.current;return e?this.props.vertical?e.clientHeight:e.clientWidth:0},t.prototype.getSliderStart=function(){var e=this.sliderElement.current.getBoundingClientRect();return this.props.vertical?e.top:e.left},t.prototype.getValue=function(){var e=this.state.bounds;return this.props.range?e:e[1]},t.prototype.addDocumentEvents=function(e){"touch"===e?(document.addEventListener("touchmove",this.eventHandlers.touchmove),document.addEventListener("touchend",this.eventHandlers.touchend)):"mouse"===e&&(document.addEventListener("mousemove",this.eventHandlers.mousemove),document.addEventListener("mouseup",this.eventHandlers.mouseup))},t.prototype.calcValue=function(e){var t=this.props,r=t.vertical,n=t.min,i=t.max,a=Math.abs(e/this.getSliderLength());return r?(1-a)*(i-n)+n:a*(i-n)+n},t.prototype.calcValueByPos=function(e){var t=e-this.getSliderStart();return this.trimAlignValue(this.calcValue(t))},t.prototype.end=function(e){this.removeEvents(e),this.props.onAfterChange(this.getValue()),this.setState({handle:null})},t.prototype.isEventFromHandle=function(e){for(var t=0,r=this.handleElements;t<r.length;t++){if(r[t].current===e.target)return!0}return!1},t.prototype.isValueOutOfBounds=function(e,t){return e<t.min||e>t.max},t.prototype.pushHandle=function(e,t,r,n){for(var i=e[t],a=e[t];r*(a-i)<n;){if(!this.pushHandleOnePoint(e,t,r))return e[t]=i,!1;a=e[t]}return!0},t.prototype.pushHandleOnePoint=function(e,t,r){var n=this.getPoints(),i=n.indexOf(e[t])+r;if(i>=n.length||i<0)return!1;var a=t+r,o=n[i],s=this.props.pushable,u=r*(e[a]-o);return!!this.pushHandle(e,a,r,+s-u)&&(e[t]=o,!0)},t.prototype.pushSurroundingHandles=function(e,t,r){var n=this.props.pushable,i=e[t],a=0;if(e[t+1]-i<n?a=1:i-e[t-1]<n&&(a=-1),0!==a){var o=t+a,s=a*(e[o]-i);this.pushHandle(e,o,a,+n-s)||(e[t]=r)}},t.prototype.removeEvents=function(e){"touch"===e?(document.removeEventListener("touchmove",this.eventHandlers.touchmove),document.removeEventListener("touchend",this.eventHandlers.touchend)):"mouse"===e&&(document.removeEventListener("mousemove",this.eventHandlers.mousemove),document.removeEventListener("mouseup",this.eventHandlers.mouseup))},t.prototype.trimAlignValue=function(e,t){var r=this.state||{},i=r.handle,a=r.bounds,o=Object(n.__assign)(Object(n.__assign)({},this.props),t||{}),s=o.marks,u=o.step,c=o.min,l=o.max,d=o.allowCross,f=e;f<=c&&(f=c),f>=l&&(f=l),!d&&null!=i&&i>0&&f<=a[i-1]&&(f=a[i-1]),!d&&null!=i&&i<a.length-1&&f>=a[i+1]&&(f=a[i+1]);var p=Object.keys(s).map(parseFloat);if(null!==u){var m=Math.round((f-c)/u)*u+c;p.push(m)}var h=p.map((function(e){return Math.abs(f-e)})),g=p[h.indexOf(Math.min.apply(Math,h))];return null!==u?parseFloat(g.toFixed(this.getPrecision(u))):g},t.prototype.render=function(){var e,t=this,r=this.state,a=r.handle,s=r.bounds,u=this.props,l=u.className,d=u.prefixCls,f=u.disabled,p=u.vertical,m=u.range,h=u.step,g=u.marks,v=u.tipFormatter,b=this.props.handle,y=s.map(this.calcOffset),_=d+"-handle",S=s.map((function(e,t){var r;return c(((r={})[_]=!0,r[_+"-"+(t+1)]=!0,r[_+"-lower"]=0===t,r[_+"-upper"]=t===s.length-1,r))})),x={prefixCls:d,noTip:null===h||null===v,tipFormatter:v,vertical:p};if(this.handleElements.length!==s.length){this.handleElements=[];for(var O=0;O<s.length;O++)this.handleElements.push(i.createRef())}var w=s.map((function(e,r){return i.cloneElement(b,Object(n.__assign)(Object(n.__assign)({},x),{className:S[r],value:e,offset:y[r],dragging:a===r,index:r,key:r,ref:t.handleElements[r]}))}));m||w.shift();var C=c(((e={})[d]=!0,e[d+"-with-marks"]=Object.keys(g).length,e[d+"-disabled"]=f,e[d+"-vertical"]=this.props.vertical,e[l]=!!l,e));return i.createElement("div",{ref:this.sliderElement,className:C,onTouchStart:f?o.j:this.onTouchStart,onMouseDown:f?o.j:this.onMouseDown},i.createElement("div",{className:d+"-rail"}),w)},t.defaultProps={prefixCls:"msp-slider-base",className:"",min:0,max:100,step:1,marks:{},handle:i.createElement(h,{className:"",vertical:!1,offset:0,tipFormatter:function(e){return e},value:0,index:0}),onBeforeChange:o.j,onChange:o.j,onAfterChange:o.j,tipFormatter:function(e,t){return e},disabled:!1,range:!1,vertical:!1,allowCross:!0,pushable:!1},t}(i.Component)},function(e,t,r){"use strict";function n(e){return e.toISOString().replace(/T/," ").replace(/\..+/,"")}function i(){var e=new Date;return e.getFullYear()+"-"+(e.getMonth()+1)+"-"+e.getDate()+"-"+e.getHours()+"-"+e.getMinutes()+"-"+e.getSeconds()}r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return i}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(24),i=r(2),a=r(106),o=r(149),s=r(208),u=r(12),c=Object(n.Color)(13421772),l=Object(n.ColorMap)({HydrogenBond:2851770,Hydrophobic:8421504,HalogenBond:4259775,Ionic:15779860,MetalCoordination:9191577,CationPi:16744448,PiStacking:9220966,WeakHydrogenBond:12967404}),d=[["Hydrogen Bond",l.HydrogenBond],["Hydrophobic",l.Hydrophobic],["Halogen Bond",l.HalogenBond],["Ionic",l.Ionic],["Metal Coordination",l.MetalCoordination],["Cation Pi",l.CationPi],["Pi Stacking",l.PiStacking],["Weak HydrogenBond",l.WeakHydrogenBond]];function f(e){switch(e){case 4:return l.HydrogenBond;case 6:return l.Hydrophobic;case 5:return l.HalogenBond;case 1:return l.Ionic;case 7:return l.MetalCoordination;case 2:return l.CationPi;case 3:return l.PiStacking;case 8:return l.WeakHydrogenBond;case 0:return c}}var p={};var m={name:"interaction-type",label:"Interaction Type",category:"Miscellaneous",factory:function e(t,r){var n=t.structure?a.a.get(t.structure):void 0,i=n?Object(u.i)(n.id,n.version):-1;return{factory:e,granularity:"group",color:n&&n.value?function(e){if(s.a.isLocation(e)){var t=e.data.interactions,r=t.unitsContacts,n=t.contacts,i=e.element,a=i.unitA,o=i.unitB,u=i.indexA,l=i.indexB;if(a===o){var d=r.get(a.id),p=d.getDirectedEdgeIndex(u,l);return f(d.edgeProps.type[p])}p=n.getEdgeIndex(u,a.id,l,o.id);return f(n.edges[p].props.type)}return c}:function(){return c},props:r,contextHash:i,description:"Assigns colors according the interaction type of a link.",legend:Object(o.b)(d)}},getParams:function(e){return p},defaultValues:i.ParamDefinition.getDefaultValues(p),isApplicable:function(e){return!!e.structure},ensureCustomProperties:{attach:function(e,t){return t.structure?a.a.attach(e,t.structure,void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&e.structure.customPropertyDescriptors.reference(a.a.descriptor,!1)}}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return h})),r.d(t,"a",(function(){return g}));var n=r(0),i=r(121),a=r(35),o=r(82),s=r(38),u=r(2),c=r(271),l=r(9),d=r(47),f=r(272),p=r(5),m=r(125),h={sceneBoundingSpheres:u.ParamDefinition.Boolean(!1,{description:"Show full scene bounding spheres."}),visibleSceneBoundingSpheres:u.ParamDefinition.Boolean(!1,{description:"Show visible scene bounding spheres."}),objectBoundingSpheres:u.ParamDefinition.Boolean(!1,{description:"Show bounding spheres of visible render objects."}),instanceBoundingSpheres:u.ParamDefinition.Boolean(!1,{description:"Show bounding spheres of visible instances."})},g=function(){function e(e,t,r){this.objectsData=new Map,this.instancesData=new Map,this.scene=c.a.create(e),this.parent=t,this._props=Object(n.__assign)(Object(n.__assign)({},u.ParamDefinition.getDefaultValues(h)),r)}return e.prototype.update=function(){var e=this,t=v(this.scene,this.parent.boundingSphere,this.sceneData,d.a.lightgrey,b);t&&(this.sceneData=t);var r=v(this.scene,this.parent.boundingSphereVisible,this.visibleSceneData,d.a.black,y);r&&(this.visibleSceneData=r),this.parent.forEach((function(t,r){var n=e.objectsData.get(r),i=v(e.scene,t.values.boundingSphere.ref.value,n,d.a.tomato,_);i&&e.objectsData.set(r,i);var a=e.instancesData.get(r),o=v(e.scene,t.values.invariantBoundingSphere.ref.value,a,d.a.skyblue,S,{aTransform:r.values.aTransform,matrix:r.values.matrix,transform:r.values.transform,extraTransform:r.values.extraTransform,uInstanceCount:r.values.uInstanceCount,instanceCount:r.values.instanceCount,aInstance:r.values.aInstance,hasReflection:r.values.hasReflection});o&&e.instancesData.set(r,o)})),this.objectsData.forEach((function(t,r){e.parent.has(r)||(e.scene.remove(t.renderObject),e.objectsData.delete(r))})),this.instancesData.forEach((function(t,r){e.parent.has(r)||(e.scene.remove(t.renderObject),e.instancesData.delete(r))})),this.scene.update(void 0,!1),this.scene.commit()},e.prototype.syncVisibility=function(){var e=this;this.sceneData&&(this.sceneData.renderObject.state.visible=this._props.sceneBoundingSpheres),this.visibleSceneData&&(this.visibleSceneData.renderObject.state.visible=this._props.visibleSceneBoundingSpheres),this.parent.forEach((function(t,r){var n=e.objectsData.get(r);n&&(n.renderObject.state.visible=r.state.visible&&e._props.objectBoundingSpheres);var i=e.instancesData.get(r);i&&(i.renderObject.state.visible=r.state.visible&&e._props.instanceBoundingSpheres)}))},e.prototype.clear=function(){this.sceneData=void 0,this.objectsData.clear(),this.scene.clear()},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._props.sceneBoundingSpheres||this._props.visibleSceneBoundingSpheres||this._props.objectBoundingSpheres||this._props.instanceBoundingSpheres},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"props",{get:function(){return this._props},enumerable:!1,configurable:!0}),e.prototype.setProps=function(e){Object.assign(this._props,e),this.isEnabled&&this.update()},e}();function v(e,t,r,n,u,c){if(!r||!l.g.equals(r.boundingSphere,t)){var d=function(e,t){var r=Object(f.b)(2),n=a.a.createState(r,r/2,t);if(e.radius&&(Object(o.a)(n,e.center,e.radius,2),l.g.hasExtrema(e)))for(var i=0,s=e.extrema;i<s.length;i++){var u=s[i];Object(o.a)(n,u,1,0)}return a.a.getMesh(n)}(t,r&&r.mesh),h=r?r.renderObject:function(e,t,r,n){var a=s.a.Utils.createValuesSimple(e,{alpha:.1,doubleSided:!1},t,1,n);return Object(i.a)("mesh",a,{disposed:!1,visible:!0,alphaFactor:1,pickable:!1,colorOnly:!1,opaque:!1,writeDepth:!1,noClip:!1},r)}(d,n,u,c);return r?p.e.updateIfChanged(h.values.drawCount,m.a.getDrawCount(d)):e.add(h),{boundingSphere:l.g.clone(t),renderObject:h,mesh:d}}}var b=Object(i.c)(),y=Object(i.c)(),_=Object(i.c)(),S=Object(i.c)()},function(e,t,r){"use strict";r.d(t,"b",(function(){return S})),r.d(t,"a",(function(){return x}));var n=r(0),i=r(271),a=r(35),o=r(1),s=r(82),u=r(38),c=r(47),l=r(91),d=r(5),f=r(9),p=r(2),m=r(158),h=r(54),g=r(23),v=r(51),b=r(65),y=r(6),_=Object(n.__assign)(Object(n.__assign)({},u.a.Params),{alpha:Object(n.__assign)(Object(n.__assign)({},u.a.Params.alpha),{defaultValue:1}),ignoreLight:Object(n.__assign)(Object(n.__assign)({},u.a.Params.ignoreLight),{defaultValue:!0}),colorX:p.ParamDefinition.Color(c.a.red,{isEssential:!0}),colorY:p.ParamDefinition.Color(c.a.green,{isEssential:!0}),colorZ:p.ParamDefinition.Color(c.a.blue,{isEssential:!0}),scale:p.ParamDefinition.Numeric(.33,{min:.1,max:2,step:.1},{isEssential:!0})}),S={handle:p.ParamDefinition.MappedStatic("off",{on:p.ParamDefinition.Group(_),off:p.ParamDefinition.Group({})},{cycle:!0,description:"Show handle tool"})},x=function(){function e(e,t){var r=this;void 0===t&&(t={}),this.webgl=e,this.props={handle:{name:"off",params:{}}},this._transform=Object(o.Mat4)(),this.eachGroup=function(e,t){if(!r.renderObject)return!1;if(!w(e))return!1;for(var n=!1,i=r.renderObject.values.uGroupCount.ref.value,a=0,o=e.elements;a<o.length;a++){var s=o[a],u=s.groupId,c=s.instanceId*i+u;t(y.Interval.ofSingleton(c))&&(n=!0)}return n},this.scene=i.a.create(e),this.setProps(t)}return e.prototype.getBoundingSphere=function(e,t){return this.renderObject&&(f.g.copy(e,this.renderObject.values.invariantBoundingSphere.ref.value),o.Mat4.fromArray(this._transform,this.renderObject.values.aTransform.ref.value,16*t),f.g.transform(e,e,this._transform)),e},e.prototype.setProps=function(e){var t=this;this.props=Object(m.a)(this.props,(function(r){if(void 0!==e.handle&&(r.handle.name=e.handle.name,"on"===e.handle.name)){t.scene.clear();var i=Object(n.__assign)(Object(n.__assign)({},e.handle.params),{scale:e.handle.params.scale*t.webgl.pixelRatio});t.renderObject=function(e){var t=function(e,t){var r=10*e.scale,n=function(e,t){var r=a.a.createState(512,256,t),n=.05*e,i=o.Vec3.scale(Object(o.Vec3)(),o.Vec3.unitX,e),u=o.Vec3.scale(Object(o.Vec3)(),o.Vec3.unitY,e),c=o.Vec3.scale(Object(o.Vec3)(),o.Vec3.unitZ,e),d={radiusTop:n,radiusBottom:n,radialSegments:32};return r.currentGroup=O.TranslateScreenXY,Object(s.a)(r,o.Vec3.origin,3*n,2),r.currentGroup=O.TranslateObjectX,Object(s.a)(r,i,n,2),Object(l.a)(r,o.Vec3.origin,i,1,d),r.currentGroup=O.TranslateObjectY,Object(s.a)(r,u,n,2),Object(l.a)(r,o.Vec3.origin,u,1,d),r.currentGroup=O.TranslateObjectZ,Object(s.a)(r,c,n,2),Object(l.a)(r,o.Vec3.origin,c,1,d),a.a.getMesh(r)}(r,null==t?void 0:t.geometry);n.setBoundingSphere(f.g.create(o.Vec3.create(r/2,r/2,r/2),r+r/4));return h.a.create("handle",{},n,(function(t){switch(t){case O.TranslateObjectX:return e.colorX;case O.TranslateObjectY:return e.colorY;case O.TranslateObjectZ:return e.colorZ;default:return c.a.grey}}),(function(){return 1}),(function(){return""}))}(e);return h.a.createRenderObject(t,e)}(i),t.renderObject.state.noClip=!0,t.scene.add(t.renderObject),t.scene.commit(),r.handle.params=Object(n.__assign)({},e.handle.params)}}))},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return"on"===this.props.handle.name},enumerable:!1,configurable:!0}),e.prototype.update=function(e,t,r){this.renderObject&&(o.Mat4.setTranslation(this.renderObject.values.aTransform.ref.value,t),o.Mat4.fromMat3(this.renderObject.values.aTransform.ref.value,r),d.e.update(this.renderObject.values.aTransform,this.renderObject.values.aTransform.ref.value),this.scene.update([this.renderObject],!0))},e.prototype.getLoci=function(e){var t=e.objectId,r=e.groupId,n=e.instanceId;return this.renderObject&&t===this.renderObject.id?function(e,t,r){return Object(g.DataLoci)("handle",e,[{groupId:t,instanceId:r}],(function(t){return e.getBoundingSphere(t,r)}),(function(){return"Handle Helper | Group Id "+t+" | Instance Id "+r}))}(this,r,n):g.EmptyLoci},e.prototype.mark=function(e,t){return!!v.b.is(v.b.Highlighting,t)&&(!!w(e)&&(e.data===this&&b.a.mark(this.renderObject,e,t,this.eachGroup)))},e}();var O={None:0,TranslateScreenXY:1,TranslateObjectX:3,TranslateObjectY:4,TranslateObjectZ:5};function w(e){return"data-loci"===e.kind&&"handle"===e.tag}},function(e,t,r){"use strict";r.d(t,"a",(function(){return B}));var n=r(0),i=r(67),a=r(68),o=r(11),s=r(64),u=r(5),c=r(72),l=r(180),d=r(138),f=r(60),p=Object(n.__assign)(Object(n.__assign)({},c.b),{tTexture:Object(o.i)("texture","rgba","float","nearest")});function m(e,t){if(e.namedComputeRenderables["histopyramid-sum"]){var r=e.namedComputeRenderables["histopyramid-sum"].values;u.e.update(r.tTexture,t),e.namedComputeRenderables["histopyramid-sum"].update()}else e.namedComputeRenderables["histopyramid-sum"]=function(e,t){var r=Object(n.__assign)(Object(n.__assign)({},c.c),{tTexture:u.e.create(t)}),o=Object(n.__assign)({},p),l=Object(s.g)("sum",d.a,"\nprecision highp float;\nprecision highp int;\n\n#if __VERSION__ == 100\n    precision highp sampler2D;\n    uniform sampler2D tTexture;\n#else\n    precision highp isampler2D;\n    uniform isampler2D tTexture;\n#endif\n\nvoid main(void) {\n    #if __VERSION__ == 100\n        gl_FragColor = texture2D(tTexture, vec2(0.5));\n    #else\n        gl_FragColor = ivec4(texture2D(tTexture, vec2(0.5)).r);\n    #endif\n}\n",{},{0:"ivec4"}),f=Object(a.a)(e,"triangles",l,o,r);return Object(i.a)(f,r)}(e,t);return e.namedComputeRenderables["histopyramid-sum"]}var h=new Uint8Array(4),g=new Int32Array(4);var v=r(44),b=Object(n.__assign)(Object(n.__assign)({},c.b),{tInputLevel:Object(o.i)("texture","rgba","float","nearest"),tPreviousLevel:Object(o.i)("texture","rgba","float","nearest"),uSize:Object(o.j)("f"),uTexSize:Object(o.j)("f"),uFirst:Object(o.j)("b")});function y(e,t,r){if(e.namedComputeRenderables["histogram-pyramid"]){var o=e.namedComputeRenderables["histogram-pyramid"].values;u.e.update(o.tInputLevel,t),u.e.update(o.tPreviousLevel,r),e.namedComputeRenderables["histogram-pyramid"].update()}else e.namedComputeRenderables["histogram-pyramid"]=function(e,t,r){var o=Object(n.__assign)(Object(n.__assign)({},c.c),{tInputLevel:u.e.create(t),tPreviousLevel:u.e.create(r),uSize:u.e.create(0),uTexSize:u.e.create(0),uFirst:u.e.create(!0)}),l=Object(n.__assign)({},b),f=Object(s.g)("reduction",d.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tInputLevel;\n\n// previous level used to evaluate the new level\n#if __VERSION__ == 100\n    uniform sampler2D tPreviousLevel;\n#else\n    precision highp isampler2D;\n    uniform isampler2D tPreviousLevel;\n#endif\n\n// inverted size of the previous level texture.\nuniform float uSize;\nuniform float uTexSize;\nuniform bool uFirst;\n\n#include common\n\nvoid main(void) {\n    float k = 0.5 * uSize;\n    vec2 position = floor((gl_FragCoord.xy / uTexSize) / uSize) * uSize;\n\n    #if __VERSION__ == 100\n        float a, b, c, d;\n\n        if (uFirst) {\n            a = texture2D(tInputLevel, position).r * 255.0;\n            b = texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0;\n            c = texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0;\n            d = texture2D(tInputLevel, position + vec2(k, k)).r * 255.0;\n        } else {\n            a = decodeFloatRGB(texture2D(tPreviousLevel, position).rgb);\n            b = decodeFloatRGB(texture2D(tPreviousLevel, position + vec2(k, 0.0)).rgb);\n            c = decodeFloatRGB(texture2D(tPreviousLevel, position + vec2(0.0, k)).rgb);\n            d = decodeFloatRGB(texture2D(tPreviousLevel, position + vec2(k, k)).rgb);\n        }\n        gl_FragColor = vec4(encodeFloatRGB(a + b + c + d), 1.0);\n    #else\n        int a, b, c, d;\n\n        if (uFirst) {\n            a = int(texture2D(tInputLevel, position).r * 255.0);\n            b = int(texture2D(tInputLevel, position + vec2(k, 0.0)).r * 255.0);\n            c = int(texture2D(tInputLevel, position + vec2(0.0, k)).r * 255.0);\n            d = int(texture2D(tInputLevel, position + vec2(k, k)).r * 255.0);\n        } else {\n            a = texture2D(tPreviousLevel, position).r;\n            b = texture2D(tPreviousLevel, position + vec2(k, 0.0)).r;\n            c = texture2D(tPreviousLevel, position + vec2(0.0, k)).r;\n            d = texture2D(tPreviousLevel, position + vec2(k, k)).r;\n        }\n        gl_FragColor = ivec4(a + b + c + d);\n    #endif\n}\n",{},{0:"ivec4"}),p=Object(a.a)(e,"triangles",f,l,o);return Object(i.a)(p,o)}(e,t,r);return e.namedComputeRenderables["histogram-pyramid"]}var _=[];function S(e,t){var r=_[t],n=Math.pow(2,t);if(void 0===r){var i=e.isWebGL2?O("level"+t,e,"image-int32","alpha","int","nearest"):O("level"+t,e,"image-uint8","rgba","ubyte","nearest");i.define(n,n);var a=x("level"+t,e);i.attachFramebuffer(a,0),r={texture:i,framebuffer:a},_[t]=r}return r}function x(e,t){var r="histogram-pyramid-"+e;return t.namedFramebuffers[r]||(t.namedFramebuffers[r]=t.resources.framebuffer()),t.namedFramebuffers[r]}function O(e,t,r,n,i,a){var o="histogram-pyramid-"+e;return t.namedTextures[o]||(t.namedTextures[o]=t.resources.texture(r,n,i,a)),t.namedTextures[o]}function w(e,t,r,n){var i=e.gl,a=t.getWidth();if(a!==t.getHeight()||!Object(v.e)(a))throw new Error("inputTexture must be of square power-of-two size");var o=Math.ceil(Math.log(a)/Math.log(2)),s=Math.pow(2,o),c=Math.pow(2,o),d=Math.pow(2,o-1),p=e.isWebGL2?O("pyramid",e,"image-int32","alpha","int","nearest"):O("pyramid",e,"image-uint8","rgba","ubyte","nearest");p.define(c,d);var b=x("pyramid",e);p.attachFramebuffer(b,0),i.viewport(0,0,c,d),Object(f.q)(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT);for(var _=[],w=0;w<o;++w)_.push(S(e,w));var C=y(e,t,_[0].texture);e.state.currentRenderItemId=-1,function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e);var j=0;for(w=0;w<o;w++){var P=o-1-w;_[P].framebuffer.bind();var E=Math.pow(2,P);u.e.update(C.values.uSize,Math.pow(2,w+1)/s),u.e.update(C.values.uTexSize,E),u.e.updateIfChanged(C.values.uFirst,0===w),w>0&&(u.e.update(C.values.tPreviousLevel,_[o-w].texture),C.update()),e.state.currentRenderItemId=-1,i.viewport(0,0,E,E),i.scissor(0,0,E,E),Object(f.q)(i)?i.clearBufferiv(i.COLOR,0,[0,0,0,0]):i.clear(i.COLOR_BUFFER_BIT),i.scissor(0,0,n[0],n[1]),C.render(),p.bind(0),i.copyTexSubImage2D(i.TEXTURE_2D,0,j,0,0,0,E,E),p.unbind(0),j+=E}i.finish();var A=Math.max(1,function(e,t){var r=e.gl,n=e.resources,i=m(e,t);e.state.currentRenderItemId=-1,e.namedFramebuffers["histopyramid-sum"]||(e.namedFramebuffers["histopyramid-sum"]=n.framebuffer());var a=e.namedFramebuffers["histopyramid-sum"];return e.namedTextures["histopyramid-sum"]||(e.namedTextures["histopyramid-sum"]=Object(f.q)(r)?n.texture("image-int32","rgba","int","nearest"):n.texture("image-uint8","rgba","ubyte","nearest"),e.namedTextures["histopyramid-sum"].define(1,1)),e.namedTextures["histopyramid-sum"].attachFramebuffer(a,0),function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.disable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e),r.viewport(0,0,1,1),i.render(),r.finish(),e.readPixels(0,0,1,1,Object(f.q)(r)?g:h),e.unbindFramebuffer(),Object(f.q)(r)?g[0]:Object(l.a)(h[0],h[1],h[2])}(e,_[0].texture));return{pyramidTex:p,count:A,height:Math.ceil(A/Math.pow(2,o)),levels:o,scale:r}}var C,j,P=r(193),E=r(52);function A(){if(void 0!==C)return C;for(var e=(C=Object(E.c)(256,1,Uint8Array)).array,t=0,r=P.e.length;t<r;++t)e[t]=P.e[t].length/3;return C}function D(){if(void 0!==j)return j;for(var e=(j=Object(E.c)(4096,1,Uint8Array)).array,t=0,r=P.e.length;t<r;++t)for(var n=0;n<16;++n)n<P.e[t].length?e[16*t+n]=P.e[t][n]:e[16*t+n]=255;return j}var T=Object(n.__assign)(Object(n.__assign)({},c.b),{tTriCount:Object(o.i)("image-uint8","alpha","ubyte","nearest"),tVolumeData:Object(o.i)("texture","rgba","ubyte","nearest"),uIsoValue:Object(o.j)("f"),uGridDim:Object(o.j)("v3"),uGridTexDim:Object(o.j)("v3"),uScale:Object(o.j)("v2")});function I(e,t,r,o,l,f){if(e.namedComputeRenderables["active-voxels"]){var p=e.namedComputeRenderables["active-voxels"].values;u.e.update(p.uQuadScale,f),u.e.update(p.tVolumeData,t),u.e.updateIfChanged(p.uIsoValue,l),u.e.update(p.uGridDim,r),u.e.update(p.uGridTexDim,o),u.e.update(p.uScale,f),e.namedComputeRenderables["active-voxels"].update()}else e.namedComputeRenderables["active-voxels"]=function(e,t,r,o,l,f){var p=Object(n.__assign)(Object(n.__assign)({},c.c),{tTriCount:u.e.create(A()),uQuadScale:u.e.create(f),tVolumeData:u.e.create(t),uIsoValue:u.e.create(l),uGridDim:u.e.create(r),uGridTexDim:u.e.create(o),uScale:u.e.create(f)}),m=Object(n.__assign)({},T),h=Object(s.g)("active-voxels",d.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tTriCount;\nuniform sampler2D tVolumeData;\n\nuniform float uIsoValue;\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n    vec2 gridTexPos = coord * uGridTexDim.xy;\n    vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n    vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n    float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n    return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n    float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n    float row = intDiv(zSlice * gridDim.x, texDim.x);\n    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n    return texture2D(tex, coord);\n}\n\nvec4 voxel(vec3 pos) {\n    pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvoid main(void) {\n    vec2 uv = gl_FragCoord.xy / uGridTexDim.xy;\n    vec3 posXYZ = index3dFrom2d(uv);\n\n    // get MC case as the sum of corners that are below the given iso level\n    float c = step(voxel(posXYZ).a, uIsoValue)\n        + 2. * step(voxel(posXYZ + c1).a, uIsoValue)\n        + 4. * step(voxel(posXYZ + c2).a, uIsoValue)\n        + 8. * step(voxel(posXYZ + c3).a, uIsoValue)\n        + 16. * step(voxel(posXYZ + c4).a, uIsoValue)\n        + 32. * step(voxel(posXYZ + c5).a, uIsoValue)\n        + 64. * step(voxel(posXYZ + c6).a, uIsoValue)\n        + 128. * step(voxel(posXYZ + c7).a, uIsoValue);\n    c *= step(c, 254.);\n\n    // handle out of bounds positions\n    posXYZ += 1.0;\n    posXYZ.xy += 1.0; // pixel padding (usually ok even if the texture has no padding)\n    if (posXYZ.x >= uGridDim.x || posXYZ.y >= uGridDim.y || posXYZ.z >= uGridDim.z)\n        c = 0.0;\n\n    // get total triangles to generate for calculated MC case from triCount texture\n    float totalTrianglesToGenerate = texture2D(tTriCount, vec2(intMod(c, 16.), floor(c / 16.)) / 16.).a;\n    gl_FragColor = vec4(vec3(totalTrianglesToGenerate * 3.0), c / 255.0);\n}\n"),g=Object(a.a)(e,"triangles",h,m,p);return Object(i.a)(g,p)}(e,t,r,o,l,f);return e.namedComputeRenderables["active-voxels"]}var M=Object(n.__assign)(Object(n.__assign)({},c.b),{tTriIndices:Object(o.i)("image-uint8","alpha","ubyte","nearest"),tActiveVoxelsPyramid:Object(o.i)("texture","rgba","float","nearest"),tActiveVoxelsBase:Object(o.i)("texture","rgba","float","nearest"),tVolumeData:Object(o.i)("texture","rgba","ubyte","nearest"),uIsoValue:Object(o.j)("f"),uSize:Object(o.j)("f"),uLevels:Object(o.j)("f"),uCount:Object(o.j)("f"),uGridDim:Object(o.j)("v3"),uGridTexDim:Object(o.j)("v3"),uGridTransform:Object(o.j)("m4"),uScale:Object(o.j)("v2"),dPackedGroup:Object(o.c)("boolean")});function k(e,t,r,o,l,f,p,m,h,g,v,b){if(e.namedComputeRenderables.isosurface){var y=e.namedComputeRenderables.isosurface.values;u.e.update(y.tActiveVoxelsPyramid,t),u.e.update(y.tActiveVoxelsBase,r),u.e.update(y.tVolumeData,o),u.e.updateIfChanged(y.uIsoValue,m),u.e.updateIfChanged(y.uSize,Math.pow(2,h)),u.e.updateIfChanged(y.uLevels,h),u.e.updateIfChanged(y.uCount,v),u.e.update(y.uGridDim,l),u.e.update(y.uGridTexDim,f),u.e.update(y.uGridTransform,p),u.e.update(y.uScale,g),u.e.update(y.dPackedGroup,b),e.namedComputeRenderables.isosurface.update()}else e.namedComputeRenderables.isosurface=function(e,t,r,o,l,f,p,m,h,g,v,b){var y=Object(n.__assign)(Object(n.__assign)({},c.c),{tTriIndices:u.e.create(D()),tActiveVoxelsPyramid:u.e.create(t),tActiveVoxelsBase:u.e.create(r),tVolumeData:u.e.create(o),uIsoValue:u.e.create(m),uSize:u.e.create(Math.pow(2,h)),uLevels:u.e.create(h),uCount:u.e.create(v),uGridDim:u.e.create(l),uGridTexDim:u.e.create(f),uGridTransform:u.e.create(p),uScale:u.e.create(g),dPackedGroup:u.e.create(b)}),_=Object(n.__assign)({},M),S=Object(s.g)("isosurface",d.a,"\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\n#if __VERSION__ == 100\n    uniform sampler2D tActiveVoxelsPyramid;\n#else\n    precision highp isampler2D;\n    uniform isampler2D tActiveVoxelsPyramid;\n#endif\n\nuniform sampler2D tActiveVoxelsBase;\nuniform sampler2D tVolumeData;\nuniform sampler2D tTriIndices;\n\nuniform float uIsoValue;\nuniform float uLevels;\nuniform float uSize;\nuniform float uCount;\n\nuniform vec3 uGridDim;\nuniform vec3 uGridTexDim;\nuniform mat4 uGridTransform;\n\n// scale to volume data coord\nuniform vec2 uScale;\n\n#include common\n\n// cube corners (excluding origin)\nconst vec3 c1 = vec3(1., 0., 0.);\nconst vec3 c2 = vec3(1., 1., 0.);\nconst vec3 c3 = vec3(0., 1., 0.);\nconst vec3 c4 = vec3(0., 0., 1.);\nconst vec3 c5 = vec3(1., 0., 1.);\nconst vec3 c6 = vec3(1., 1., 1.);\nconst vec3 c7 = vec3(0., 1., 1.);\n\nvec3 index3dFrom2d(vec2 coord) {\n    vec2 gridTexPos = coord * uGridTexDim.xy;\n    vec2 columnRow = ivec2Div(gridTexPos, uGridDim.xy);\n    vec2 posXY = gridTexPos - columnRow * uGridDim.xy;\n    float posZ = columnRow.y * intDiv(uGridTexDim.x, uGridDim.x) + columnRow.x;\n    return vec3(posXY, posZ);\n}\n\nvec4 texture3dFrom2dNearest(sampler2D tex, vec3 pos, vec3 gridDim, vec2 texDim) {\n    float zSlice = floor(pos.z * gridDim.z + 0.5); // round to nearest z-slice\n    float column = intDiv(intMod(zSlice * gridDim.x, texDim.x), gridDim.x);\n    float row = intDiv(zSlice * gridDim.x, texDim.x);\n    vec2 coord = (vec2(column * gridDim.x, row * gridDim.y) + (pos.xy * gridDim.xy)) / (texDim / uScale);\n    return texture2D(tex, coord + 0.5 / (texDim / uScale));\n}\n\nvec4 voxel(vec3 pos) {\n    pos = min(max(vec3(0.0), pos), uGridDim - vec3(1.0));\n    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nvec4 voxelPadded(vec3 pos) {\n    pos = min(max(vec3(0.0), pos), uGridDim - vec3(vec2(2.0), 1.0)); // remove xy padding\n    return texture3dFrom2dNearest(tVolumeData, pos / uGridDim, uGridDim, uGridTexDim.xy);\n}\n\nint idot2(const in ivec2 a, const in ivec2 b) {\n    return a.x * b.x + a.y * b.y;\n}\n\nint idot4(const in ivec4 a, const in ivec4 b) {\n    return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w;\n}\n\n#if __VERSION__ == 100\n    int pyramidVoxel(vec2 pos) {\n        return int(decodeFloatRGB(texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).rgb));\n    }\n#else\n    int pyramidVoxel(vec2 pos) {\n        return texture2D(tActiveVoxelsPyramid, pos / (vec2(1.0, 0.5) * uSize)).r;\n    }\n#endif\n\nvec4 baseVoxel(vec2 pos) {\n    return texture2D(tActiveVoxelsBase, pos / uSize);\n}\n\nvoid main(void) {\n    // get 1D index\n    int vI = int(gl_FragCoord.x) + int(gl_FragCoord.y) * int(uSize);\n\n    // ignore 1D indices outside of the grid\n    if(vI >= int(uCount)) discard;\n\n    ivec2 offset = ivec2(int(uSize) - 2, 0);\n\n    int start = 0;\n    ivec4 starts = ivec4(0);\n    ivec4 ends = ivec4(0);\n    int diff = 2;\n    ivec4 m = ivec4(0);\n    ivec2 position = ivec2(0);\n    ivec4 vI4 = ivec4(vI);\n\n    ivec2 relativePosition = ivec2(0);\n    int end = 0;\n    ivec2 pos1 = ivec2(0);\n    ivec2 pos2 = ivec2(0);\n    ivec2 pos3 = ivec2(0);\n    ivec2 pos4 = ivec2(0);\n    ivec3 vI3 = ivec3(vI);\n    ivec3 mask = ivec3(0);\n\n    // traverse the different levels of the pyramid\n    for(int i = 1; i < 14; i++) {\n        if(float(i) >= uLevels) break;\n\n        offset.x -= diff;\n        diff *= 2;\n        relativePosition = position + offset;\n\n        end = start + pyramidVoxel(vec2(relativePosition));\n        pos1 = ivec2(relativePosition);\n        starts.x = start;\n        ends.x = end;\n        pos2 = ivec2(relativePosition + ivec2(1, 0));\n        starts.y = ends.x;\n        ends.y = ends.x + pyramidVoxel(vec2(pos2));\n        pos3 = relativePosition + ivec2(0, 1);\n        starts.z = ends.y;\n        ends.z = ends.y + pyramidVoxel(vec2(pos3));\n        pos4 = relativePosition + ivec2(1, 1);\n        starts.w = ends.z;\n        mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n        m = ivec4(mask, 1 - int(any(bvec3(mask))));\n\n        relativePosition = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n        start = idot4(m, starts);\n        position = 2 * (relativePosition - offset);\n    }\n\n    end = start + int(baseVoxel(vec2(position)).r * 255.0);\n    pos1 = position;\n    starts.x = start;\n    ends.x = end;\n    pos2 = position + ivec2(1, 0);\n    starts.y = ends.x;\n    ends.y = ends.x + int(baseVoxel(vec2(pos2)).r * 255.0);\n    pos3 = position + ivec2(0, 1);\n    starts.z = ends.y;\n    ends.z = ends.y + int(baseVoxel(vec2(pos3)).r * 255.0);\n    pos4 = position + ivec2(1, 1);\n    starts.w = ends.z;\n    mask = ivec3(greaterThanEqual(vI3, starts.rgb)) * ivec3(lessThan(vI3, ends.rgb));\n    m = ivec4(mask, 1 - int(any(bvec3(mask))));\n    position = m.x * pos1 + m.y * pos2 + m.z * pos3 + m.w * pos4;\n\n    vec2 coord2d = (vec2(position) / uSize) / uScale;\n    vec3 coord3d = floor(index3dFrom2d(coord2d) + 0.5);\n\n    float edgeIndex = floor(baseVoxel(vec2(position)).a * 255.0 + 0.5);\n\n    // current vertex for the up to 15 MC cases\n    int currentVertex = vI - idot4(m, starts);\n\n    // get index into triIndices table\n    int mcIndex = 16 * int(edgeIndex) + currentVertex;\n    vec4 mcData = texture2D(tTriIndices, vec2(imod(mcIndex, 64), mcIndex / 64) / 64.);\n\n    // bit mask to avoid conditionals (see comment below) for getting MC case corner\n    vec4 m0 = vec4(floor(mcData.a * 255.0 + 0.5));\n\n    // get edge value masks\n    vec4 m1 = vec4(equal(m0, vec4(0., 1., 2., 3.)));\n    vec4 m2 = vec4(equal(m0, vec4(4., 5., 6., 7.)));\n    vec4 m3 = vec4(equal(m0, vec4(8., 9., 10., 11.)));\n\n    // apply bit masks\n    vec3 b0 = coord3d +\n                m1.y * c1 +\n                m1.z * c2 +\n                m1.w * c3 +\n                m2.x * c4 +\n                m2.y * c5 +\n                m2.z * c6 +\n                m2.w * c7 +\n                m3.y * c1 +\n                m3.z * c2 +\n                m3.w * c3;\n    vec3 b1 = coord3d +\n                m1.x * c1 +\n                m1.y * c2 +\n                m1.z * c3 +\n                m2.x * c5 +\n                m2.y * c6 +\n                m2.z * c7 +\n                m2.w * c4 +\n                m3.x * c4 +\n                m3.y * c5 +\n                m3.z * c6 +\n                m3.w * c7;\n\n    // the conditionals that are avoided by above bitmasks\n    // vec3 b0 = coord3d;\n    // vec3 b1 = coord3d;\n    // if (mcIndex == 0.0) {\n    //     b1 += c1;\n    // } else if (mcIndex == 1.0) {\n    //     b0 += c1; b1 += c2;\n    // } else if (mcIndex == 2.0) {\n    //     b0 += c2; b1 += c3;\n    // } else if (mcIndex == 3.0) {\n    //     b0 += c3;\n    // } else if (mcIndex == 4.0) {\n    //     b0 += c4; b1 += c5;\n    // } else if (mcIndex == 5.0) {\n    //     b0 += c5; b1 += c6;\n    // } else if (mcIndex == 6.0) {\n    //     b0 += c6; b1 += c7;\n    // } else if (mcIndex == 7.0) {\n    //     b0 += c7; b1 += c4;\n    // } else if (mcIndex == 8.0) {\n    //     b1 += c4;\n    // } else if (mcIndex == 9.0) {\n    //     b0 += c1; b1 += c5;\n    // } else if (mcIndex == 10.0) {\n    //     b0 += c2; b1 += c6;\n    // } else if (mcIndex == 11.0) {\n    //     b0 += c3; b1 += c7;\n    // }\n    // b0 = floor(b0 + 0.5);\n    // b1 = floor(b1 + 0.5);\n\n    vec4 d0 = voxel(b0);\n    vec4 d1 = voxel(b1);\n\n    float v0 = d0.a;\n    float v1 = d1.a;\n\n    float t = (uIsoValue - v0) / (v0 - v1);\n    gl_FragData[0].xyz = (uGridTransform * vec4(b0 + t * (b0 - b1), 1.0)).xyz;\n\n    // group id\n    #if __VERSION__ == 100\n        // webgl1 does not support 'flat' interpolation (i.e. no interpolation)\n        // so we ensure a constant group id per triangle here\n        #ifdef dPackedGroup\n            gl_FragData[1] = vec4(voxel(coord3d).rgb, 1.0);\n        #else\n            vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n            float group = coord3d.z + coord3d.y * gridDim.z + coord3d.x * gridDim.z * gridDim.y;\n            gl_FragData[1] = vec4(group > 16777215.5 ? vec3(1.0) : encodeFloatRGB(group), 1.0);\n        #endif\n    #else\n        #ifdef dPackedGroup\n            gl_FragData[1] = vec4(t < 0.5 ? d0.rgb : d1.rgb, 1.0);\n        #else\n            vec3 b = t < 0.5 ? b0 : b1;\n            vec3 gridDim = uGridDim - vec3(1.0, 1.0, 0.0); // remove xy padding\n            float group = b.z + b.y * gridDim.z + b.x * gridDim.z * gridDim.y;\n            gl_FragData[1] = vec4(group > 16777215.5 ? vec3(1.0) : encodeFloatRGB(group), 1.0);\n        #endif\n    #endif\n\n    // normals from gradients\n    vec3 n0 = -normalize(vec3(\n        voxelPadded(b0 - c1).a - voxelPadded(b0 + c1).a,\n        voxelPadded(b0 - c3).a - voxelPadded(b0 + c3).a,\n        voxelPadded(b0 - c4).a - voxelPadded(b0 + c4).a\n    ));\n    vec3 n1 = -normalize(vec3(\n        voxelPadded(b1 - c1).a - voxelPadded(b1 + c1).a,\n        voxelPadded(b1 - c3).a - voxelPadded(b1 + c3).a,\n        voxelPadded(b1 - c4).a - voxelPadded(b1 + c4).a\n    ));\n    mat3 normalMatrix = transpose3(inverse3(mat3(uGridTransform)));\n    gl_FragData[2].xyz = normalMatrix * -vec3(\n        n0.x + t * (n0.x - n1.x),\n        n0.y + t * (n0.y - n1.y),\n        n0.z + t * (n0.z - n1.z)\n    );\n}\n",{drawBuffers:"required"}),x=Object(a.a)(e,"triangles",S,_,y);return Object(i.a)(x,y)}(e,t,r,o,l,f,p,m,h,g,v,b);return e.namedComputeRenderables.isosurface}function B(e,t,r,n,i,a,o,s,u,c,l){var d=function(e,t,r,n,i,a){var o=e.gl,s=e.resources,u=t.getWidth(),c=t.getHeight();e.namedFramebuffers["active-voxels"]||(e.namedFramebuffers["active-voxels"]=s.framebuffer());var l=e.namedFramebuffers["active-voxels"];l.bind(),e.namedTextures["active-voxels"]||(e.namedTextures["active-voxels"]=s.texture("image-uint8","rgba","ubyte","nearest"));var d=e.namedTextures["active-voxels"];d.define(u,c);var f=I(e,t,r,n,i,a);return e.state.currentRenderItemId=-1,d.attachFramebuffer(l,0),function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e),o.viewport(0,0,u,c),o.scissor(0,0,u,c),o.clear(o.COLOR_BUFFER_BIT),o.scissor(0,0,n[0],n[1]),f.render(),o.finish(),d}(e,t,r,n,o,i);return function(e,t,r,n,i,a,o,s,u,c,l,d){var p=e.gl,m=e.resources,h=e.extensions,g=n.pyramidTex,v=n.height,b=n.levels,y=n.scale,_=n.count,S=g.getWidth();e.namedFramebuffers.isosurface||(e.namedFramebuffers.isosurface=m.framebuffer());var x=e.namedFramebuffers.isosurface;Object(f.q)(p)?(c||(c=h.colorBufferHalfFloat&&h.textureHalfFloat?m.texture("image-float16","rgba","fp16","nearest"):m.texture("image-float32","rgba","float","nearest")),l||(l=m.texture("image-uint8","rgba","ubyte","nearest")),d||(d=h.colorBufferHalfFloat&&h.textureHalfFloat?m.texture("image-float16","rgba","fp16","nearest"):m.texture("image-float32","rgba","float","nearest"))):(c||(c=m.texture("image-float32","rgba","float","nearest")),l||(l=m.texture("image-float32","rgba","float","nearest")),d||(d=m.texture("image-float32","rgba","float","nearest"))),c.define(S,v),l.define(S,v),d.define(S,v),c.attachFramebuffer(x,0),l.attachFramebuffer(x,1),d.attachFramebuffer(x,2);var O=k(e,g,t,r,i,a,o,s,b,y,_,u);e.state.currentRenderItemId=-1;var w=e.extensions.drawBuffers;if(!w)throw new Error("need WebGL draw buffers");return x.bind(),w.drawBuffers([w.COLOR_ATTACHMENT0,w.COLOR_ATTACHMENT1,w.COLOR_ATTACHMENT2]),function(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.disable(t.BLEND),r.disable(t.DEPTH_TEST),r.disable(t.SCISSOR_TEST),r.depthMask(!1),r.colorMask(!0,!0,!0,!0),r.clearColor(0,0,0,0)}(e),p.viewport(0,0,S,v),p.clear(p.COLOR_BUFFER_BIT),O.render(),p.flush(),{vertexTexture:c,groupTexture:l,normalTexture:d,vertexCount:_}}(e,d,t,w(e,d,i,n),r,n,a,o,s,u,c,l)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return V}));var n=r(0),i=r(2),a=r(41),o=r(55),s=r(4),u=r(1),c=r(23),l=r(6),d=r(38),f=r(106),p=r(112),m=r(49),h=r(53),g=r(208),v=r(9);function b(e,t,r,i,a,o){return Object(n.__awaiter)(this,void 0,void 0,(function(){var c,l,m,h,g,b,y,_,S,x,O,w,C,j,P,E,A;return Object(n.__generator)(this,(function(n){return s.Unit.isAtomic(t)?(c=s.StructureElement.Location.create(r,t),l=f.a.get(r).value,m=l.unitsFeatures.get(t.id),h=l.unitsContacts.get(t.id),g=m.x,b=m.y,y=m.z,_=m.members,S=m.offsets,x=h.edgeCount,O=h.a,w=h.b,C=h.edgeProps.flag,j=a.sizeFactor,x?(P={linkCount:2*x,position:function(e,t,r){u.Vec3.set(e,g[O[r]],b[O[r]],y[O[r]]),u.Vec3.set(t,g[w[r]],b[w[r]],y[w[r]])},style:function(e){return 1},radius:function(e){c.element=t.elements[_[S[O[e]]]];var r=i.size.size(c);c.element=t.elements[_[S[w[e]]]];var n=i.size.size(c);return Math.min(r,n)*j},ignore:function(e){return 1===C[e]}},E=Object(p.d)(e,P,a,o),A=v.g.expand(Object(v.g)(),t.boundary.sphere,1*j),E.setBoundingSphere(A),[2,E]):[2,d.a.createEmpty(o)]):[2,d.a.createEmpty(o)]}))}))}var y=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},m.g),p.a),{sizeFactor:i.ParamDefinition.Numeric(.3,{min:0,max:10,step:.01}),dashCount:i.ParamDefinition.Numeric(6,{min:2,max:10,step:2}),dashScale:i.ParamDefinition.Numeric(.4,{min:0,max:2,step:.1})});function _(e){return Object(m.h)({defaultProps:i.ParamDefinition.getDefaultValues(y),createGeometry:b,createLocationIterator:O,getLoci:S,eachLocation:x,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.radialSegments!==r.radialSegments;var s=f.a.get(a.structure).version;e.info.interactionsHash!==s&&(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.info.interactionsHash=s)}},e)}function S(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group,u=o.unitMap.get(s.units[i].id),l=f.a.get(o).value,d=l.unitsContacts.get(u.id),p=d.a,m=d.b;return g.a.Loci(o,l,[{unitA:u,indexA:p[a],unitB:u,indexB:m[a]},{unitA:u,indexA:m[a],unitB:u,indexB:p[a]}])}return c.EmptyLoci}function x(e,t,r,n){var i=!1;if(g.a.isLoci(e)){var a=t.structure,o=t.group;if(!s.Structure.areEquivalent(e.data.structure,a))return!1;var u=f.a.get(a).value;if(e.data.interactions!==u)return!1;for(var c=o.units[0],d=2*(b=u.unitsContacts.get(c.id)).edgeCount,p=0,m=e.elements;p<m.length;p++){if((E=m[p]).unitA===E.unitB){var h=o.unitIndexMap.get(E.unitA.id);if(void 0!==h){var v=b.getDirectedEdgeIndex(E.indexA,E.indexB);-1!==v&&r(l.Interval.ofSingleton(h*d+v))&&(i=!0)}}}}else if(s.StructureElement.Loci.is(e)){a=t.structure,o=t.group;if(!s.Structure.areEquivalent(e.structure,a))return!1;if(!(u=f.a.get(a).value))return!1;c=o.units[0];for(var b=u.unitsContacts.get(c.id),y=u.unitsFeatures.get(c.id),_=2*b.edgeCount,S=b.offset,x=y.elementsIndex,O=x.offsets,w=x.indices,C=function(e){var t=o.unitIndexMap.get(e.unit.id);return void 0!==t||n&&1===l.OrderedSet.size(e.indices)?"continue":void l.OrderedSet.forEach(e.indices,(function(e){for(var n=O[e],a=O[e+1];n<a;++n)for(var o=w[n],s=S[o],u=S[o+1];s<u;++s)r(l.Interval.ofSingleton(t*_+s))&&(i=!0)}))},j=0,P=e.elements;j<P.length;j++){var E;C(E=P[j])}}return i}function O(e){var t=e.structure,r=e.group,n=r.units[0],i=f.a.get(t).value,a=i.unitsContacts.get(n.id),o=2*a.edgeCount,s=r.units.length,u=g.a.Location(i,t),c=u.element;return Object(h.a)(o,s,1,(function(e,t){var n=r.units[t];return c.unitA=n,c.indexA=a.a[e],c.unitB=n,c.indexB=a.b[e],u}))}var w=r(92),C=r(28),j=s.StructureElement.Location.create(void 0);function P(e,t,r,n,i){if(!t.hasAtomic)return d.a.createEmpty(i);var a=f.a.get(t).value,o=a.contacts,s=a.unitsFeatures,c=o.edgeCount,l=o.edges,m=n.sizeFactor;if(!c)return d.a.createEmpty(i);var h={linkCount:c,position:function(e,r,n){var i=l[n],a=i.unitA,o=i.indexA,c=i.unitB,d=i.indexB,f=s.get(a),p=s.get(c),m=t.unitMap.get(a),h=t.unitMap.get(c);u.Vec3.set(e,f.x[o],f.y[o],f.z[o]),u.Vec3.transformMat4(e,e,m.conformation.operator.matrix),u.Vec3.set(r,p.x[d],p.y[d],p.z[d]),u.Vec3.transformMat4(r,r,h.conformation.operator.matrix)},style:function(e){return 1},radius:function(e){var n=l[e],i=s.get(n.unitA);j.structure=t,j.unit=t.unitMap.get(n.unitA),j.element=j.unit.elements[i.members[i.offsets[n.indexA]]];var a=r.size.size(j),o=s.get(n.unitB);j.unit=t.unitMap.get(n.unitB),j.element=j.unit.elements[o.members[o.offsets[n.indexB]]];var u=r.size.size(j);return Math.min(a,u)*m},ignore:function(e){return 1===l[e].props.flag}},g=Object(p.d)(e,h,n,i),b=v.g.expand(Object(v.g)(),t.boundary.sphere,1*m);return g.setBoundingSphere(b),g}var E=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},w.g),p.a),{sizeFactor:i.ParamDefinition.Numeric(.3,{min:0,max:10,step:.01}),dashCount:i.ParamDefinition.Numeric(6,{min:2,max:10,step:2}),dashScale:i.ParamDefinition.Numeric(.4,{min:0,max:2,step:.1})});function A(e){return Object(w.h)({defaultProps:i.ParamDefinition.getDefaultValues(E),createGeometry:P,createLocationIterator:I,getLoci:D,eachLocation:T,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||t.radialSegments!==r.radialSegments;var s=f.a.get(a).version;e.info.interactionsHash!==s&&(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.info.interactionsHash=s)}},e)}function D(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=f.a.get(t).value,o=a.contacts.edges[i],s=t.unitMap.get(o.unitA),u=t.unitMap.get(o.unitB);return g.a.Loci(t,a,[{unitA:s,indexA:o.indexA,unitB:u,indexB:o.indexB},{unitA:u,indexA:o.indexB,unitB:s,indexB:o.indexA}])}return c.EmptyLoci}function T(e,t,r,n){var i,a=!1;if(g.a.isLoci(e)){if(!s.Structure.areEquivalent(e.data.structure,t))return!1;var o=f.a.get(t).value;if(e.data.interactions!==o)return!1;for(var u=o.contacts,c=0,d=e.elements;c<d.length;c++){var p=d[c],m=u.getEdgeIndex(p.indexA,p.unitA.id,p.indexB,p.unitB.id);-1!==m&&r(l.Interval.ofSingleton(m))&&(a=!0)}}else if(s.StructureElement.Loci.is(e)){if(!s.Structure.areEquivalent(e.structure,t))return!1;if(n&&1===e.elements.length)return!1;var h=null===(i=f.a.get(t).value)||void 0===i?void 0:i.contacts;if(!h)return!1;for(var v=function(e){var t=e.unit;return C.g.isAtomic(t)?n&&1===l.OrderedSet.size(e.indices)?"continue":void l.OrderedSet.forEach(e.indices,(function(e){for(var n=0,i=h.getContactIndicesForElement(e,t);n<i.length;n++){var o=i[n];r(l.Interval.ofSingleton(o))&&(a=!0)}})):"continue"},b=0,y=e.elements;b<y.length;b++){v(y[b])}}return a}function I(e){var t=f.a.get(e).value,r=t.contacts,n=r.edgeCount,i=g.a.Location(t,e),a=i.element;return Object(h.a)(n,1,1,(function(t){var n=r.edges[t];return a.unitA=e.unitMap.get(n.unitA),a.indexA=n.indexA,a.unitB=e.unitMap.get(n.unitB),a.indexB=n.indexB,i}),!0)}var M=r(86),k={"intra-unit":function(e,t){return Object(o.d)("Intra-unit interactions cylinder",e,t,_)},"inter-unit":function(e,t){return Object(o.a)("Inter-unit interactions cylinder",e,t,A)}},B=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},y),E),{unitKinds:Object(M.j)(["atomic"]),sizeFactor:i.ParamDefinition.Numeric(.2,{min:.01,max:1,step:.01}),visuals:i.ParamDefinition.MultiSelect(["intra-unit","inter-unit"],i.ParamDefinition.objectToOptions(k))});var V=Object(o.b)({name:"interactions",label:"Non-covalent Interactions",description:"Displays non-covalent interactions as dashed cylinders.",factory:function(e,t){return a.a.createMulti("Interactions",e,t,o.c,k)},getParams:function(e,t){return i.ParamDefinition.clone(B)},defaultValues:i.ParamDefinition.getDefaultValues(B),defaultColorTheme:{name:"interaction-type"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0},ensureCustomProperties:{attach:function(e,t){return f.a.attach(e,t,void 0,!0)},detach:function(e){return f.a.ref(e,!1)}}})},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n={HIS:"H",ARG:"R",LYS:"K",ILE:"I",PHE:"F",LEU:"L",TRP:"W",ALA:"A",MET:"M",PRO:"P",CYS:"C",ASN:"N",VAL:"V",GLY:"G",SER:"S",GLN:"Q",TYR:"Y",ASP:"D",GLU:"E",THR:"T",SEC:"U",PYL:"O"},i={DA:"A",DC:"C",DG:"G",DT:"T",DU:"U"},a={A:"A",C:"C",G:"G",T:"T",U:"U"};function o(e){return n[e]||"X"}function s(e){return a[e]||"X"}function u(e){return i[e]||"X"}var c,l=r(7);!function(e){e.getSequenceString=function(e){var t=e.code.toArray();return(t instanceof Array?t:Array.from(t)).join("")},e.ofResidueNames=function(e,r){if(0===r.rowCount)throw new Error("cannot be empty");var n=function(e){for(var t=0,r=Math.min(e.rowCount,10);t<r;t++){var n=e.value(t)||"";if("X"!==o(n))return"protein";if("X"!==s(n))return"RNA";if("X"!==u(n))return"DNA"}return"generic"}(e);return new t(n,e,r)};var t=function(){function e(e,t,r){this.kind=e,this.microHet=new Map;for(var n=function(e,t){var r;switch(e){case"protein":r=o;break;case"DNA":r=u;break;case"RNA":r=s;break;case"generic":r=function(){return"X"};break;default:throw new Error("unknown kind '"+e+"'")}return t&&t.size>0?function(e){var n=r(e);return"X"===n&&t.has(e)?r(t.get(e)):n}:r}(e),i=[],a=[],c=[],d=new Map,f=0,p=new Map,m=0,h=r.rowCount;m<h;++m){var g=r.value(m);if(p.has(g))d.has(g)?d.get(g).push(t.value(m)):d.set(g,[a[p.get(g)],t.value(m)]);else{p.set(g,f);var v=t.value(m);a[f]=v,c[f]=g,i[f]=n(v),f+=1}}var b=[];for(m=0,h=f;m<h;++m){var y=d.get(c[m]);if(y){var _=y.map((function(e){var t=n(e);return"X"===t?e:t}));b[m]="("+_.join("|")+")"}else b[m]="X"===i[m]?a[m]:i[m]}this.length=f,this.code=l.a.ofStringArray(i),this.compId=l.a.ofStringArray(a),this.seqId=l.a.ofIntArray(c),this.label=l.a.ofStringArray(b),this.microHet=d,this.indexMap=p}return e.prototype.index=function(e){return this.indexMap.get(e)},e}();e.ofSequenceRanges=function(e,t){return new r("generic",e,t)};var r=function(){function e(e,t,r){this.kind=e,this.seqIdStart=t,this.seqIdEnd=r,this.microHet=new Map;for(var n=0,i=Number.MAX_SAFE_INTEGER,a=0,o=this.seqIdStart.rowCount;a<o;a++){var s=this.seqIdStart.value(a),u=this.seqIdEnd.value(a);s<i&&(i=s),n<u&&(n=u)}var c=n-i+1;this.code=l.a.ofConst("X",c,l.a.Schema.str),this.label=l.a.ofConst("",c,l.a.Schema.str),this.seqId=l.a.ofLambda({value:function(e){return e+i+1},rowCount:c,schema:l.a.Schema.int}),this.compId=l.a.ofConst("",c,l.a.Schema.str),this.length=c,this.minSeqId=i}return e.prototype.index=function(e){return e-this.minSeqId},e}()}(c||(c={}))},function(e,t){var r,n,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}}();var u,c=[],l=!1,d=-1;function f(){l&&u&&(l=!1,u.length?c=u.concat(c):d=-1,c.length&&p())}function p(){if(!l){var e=s(f);l=!0;for(var t=c.length;t;){for(u=c,c=[];++d<t;)u&&u[d].run();d=-1,t=c.length}u=null,l=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function h(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new m(e,t)),1!==c.length||l||s(p)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=h,i.addListener=h,i.once=h,i.off=h,i.removeListener=h,i.removeAllListeners=h,i.emit=h,i.prependListener=h,i.prependOnceListener=h,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,r){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function a(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new a(i.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new a(i.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},a.prototype.unref=a.prototype.ref=function(){},a.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},r(430),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,r(395))},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return f}));var n=r(20),i=r(34),a=r(76),o=r(45),s=r(62);function u(e,t,r,n){return function(i){return i.lift(new c(e,t,r,n))}}var c=function(){function e(e,t,r,n){this.keySelector=e,this.elementSelector=t,this.durationSelector=r,this.subjectSelector=n}return e.prototype.call=function(e,t){return t.subscribe(new l(e,this.keySelector,this.elementSelector,this.durationSelector,this.subjectSelector))},e}(),l=function(e){function t(t,r,n,i,a){var o=e.call(this,t)||this;return o.keySelector=r,o.elementSelector=n,o.durationSelector=i,o.subjectSelector=a,o.groups=null,o.attemptedToUnsubscribe=!1,o.count=0,o}return n.a(t,e),t.prototype._next=function(e){var t;try{t=this.keySelector(e)}catch(e){return void this.error(e)}this._group(e,t)},t.prototype._group=function(e,t){var r=this.groups;r||(r=this.groups=new Map);var n,i=r.get(t);if(this.elementSelector)try{n=this.elementSelector(e)}catch(e){this.error(e)}else n=e;if(!i){i=this.subjectSelector?this.subjectSelector():new s.a,r.set(t,i);var a=new f(t,i,this);if(this.destination.next(a),this.durationSelector){var o=void 0;try{o=this.durationSelector(new f(t,i))}catch(e){return void this.error(e)}this.add(o.subscribe(new d(t,i,this)))}}i.closed||i.next(n)},t.prototype._error=function(e){var t=this.groups;t&&(t.forEach((function(t,r){t.error(e)})),t.clear()),this.destination.error(e)},t.prototype._complete=function(){var e=this.groups;e&&(e.forEach((function(e,t){e.complete()})),e.clear()),this.destination.complete()},t.prototype.removeGroup=function(e){this.groups.delete(e)},t.prototype.unsubscribe=function(){this.closed||(this.attemptedToUnsubscribe=!0,0===this.count&&e.prototype.unsubscribe.call(this))},t}(i.a),d=function(e){function t(t,r,n){var i=e.call(this,r)||this;return i.key=t,i.group=r,i.parent=n,i}return n.a(t,e),t.prototype._next=function(e){this.complete()},t.prototype._unsubscribe=function(){var e=this.parent,t=this.key;this.key=this.parent=null,e&&e.removeGroup(t)},t}(i.a),f=function(e){function t(t,r,n){var i=e.call(this)||this;return i.key=t,i.groupSubject=r,i.refCountSubscription=n,i}return n.a(t,e),t.prototype._subscribe=function(e){var t=new a.a,r=this.refCountSubscription,n=this.groupSubject;return r&&!r.closed&&t.add(new p(r)),t.add(n.subscribe(e)),t},t}(o.a),p=function(e){function t(t){var r=e.call(this)||this;return r.parent=t,t.count++,r}return n.a(t,e),t.prototype.unsubscribe=function(){var t=this.parent;t.closed||this.closed||(e.prototype.unsubscribe.call(this),t.count-=1,0===t.count&&t.attemptedToUnsubscribe&&t.unsubscribe())},t}(a.a)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(46),o=r(100),s=r(5),u=r(149),c=r(6),l=r(70),d={domain:[0,1],reverse:!1,listOrName:"red-yellow-blue",minLabel:"",maxLabel:""};!function(e){e.create=function(e){var t=Object(i.__assign)(Object(i.__assign)({},d),e),r=t.domain,n=t.reverse,f=t.listOrName,p="string"==typeof f?Object(o.getColorListFromName)(f).list:f,m=n?p.slice().reverse():p,h=m.length-1,g=0,v=0,b=0;function y(e,t){g=(b=t)-(v=e)||1}y(r[0],r[1]);var _,S=Object(s.h)(e.minLabel,v.toString()),x=Object(s.h)(e.maxLabel,b.toString());if(m.every((function(e){return Array.isArray(e)}))){var O=Object(i.__spreadArrays)(m);O.sort((function(e,t){return e[1]-t[1]}));var w=O.map((function(e){return e[0]})),C=c.SortedArray.ofSortedArray(O.map((function(e){return e[1]}))),j=w.length-1;_=function(e){var t=Object(l.a)((e-v)/g,0,1),r=c.SortedArray.findPredecessorIndex(C,t);if(0===r)return w[v];if(r>j)return w[j];var n=C[r-1],i=C[r],o=Object(l.a)((t-n)/(i-n),0,1);return a.Color.interpolate(w[r-1],w[r],o)}}else _=function(e){var t=Math.min(m.length-1,Math.max(0,(e-v)/g*h)),r=Math.floor(t),n=m[r],i=m[Math.ceil(t)];return a.Color.interpolate(n,i,t-r)};return{color:_,colorToArray:function(e,t,r){a.Color.toArray(_(e),t,r)},normalizedColorToArray:function(e,t,r){a.Color.toArrayNormalized(_(e),t,r)},setDomain:y,get legend(){return Object(u.a)(S,x,m)}}}}(n||(n={}))},function(e,t,r){"use strict";function n(e,t){for(var r=0,n=e.length;r<n;r++)if(t(e[r]))return e[r]}function i(e){if(Array.from)return Array.from(e);for(var t=[];;){var r=e.next(),n=r.done,i=r.value;if(n)break;t[t.length]=i}return t}function a(e,t,r){for(var n=t-e+1,i=r?new r(n):new Int32Array(n),a=0;a<n;a++)i[a]=a+e;return i}function o(e,t){for(var r=new(function(e){var t=e.constructor;if(!t)throw new Error("data does not define a constructor and it should");return t}(e))(t.length),n=0,i=t.length;n<i;n++)r[n]=e[t[n]];return r}r.d(t,"a",(function(){return n})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return a})),r.d(t,"b",(function(){return o}))},function(e,t,r){"use strict";(function(e,n,i){r.d(t,"a",(function(){return u}));var a=r(0);var o=void 0!==n?"undefined"!=typeof window?{setImmediate:function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return(t=window).setImmediate.apply(t,Object(a.__spreadArrays)([e],r))},clearImmediate:function(e){return window.clearImmediate(e)}}:{setImmediate:n,clearImmediate:i}:function(){var t,r,n,i,a,o,s,u=(t="undefined"!=typeof window&&window,r="undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self,t||void 0!==u&&u||r),c={},l="undefined"!=typeof document?document:void 0,d=1;function f(e){delete c[e]}function p(e){var t=c[e];f(e),function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}return void 0!==e&&"[object process]"==={}.toString.call(e)?n=function(t){e.nextTick((function(){p(t)}))}:function(){if(u&&u.postMessage&&!u.importScripts){var e=!0,t=u.onmessage;return u.onmessage=function(){e=!1},u.postMessage("","*"),u.onmessage=t,e}}()?(o="setImmediate$"+Math.random()+"$",s=function(e){e.source===u&&"string"==typeof e.data&&0===e.data.indexOf(o)&&p(+e.data.slice(o.length))},window.addEventListener?window.addEventListener("message",s,!1):window.attachEvent("onmessage",s),n=function(e){window.postMessage(o+e,"*")}):"undefined"!=typeof MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){p(e.data)},n=function(e){a.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,n=function(e){var t=l.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(p,0,e)},{setImmediate:function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];"function"!=typeof e&&(e=new Function(""+e));var i={callback:e,args:t};return c[d]=i,n(d),d++},clearImmediate:f}}();function s(e){o.setImmediate(e)}var u={setImmediate:o.setImmediate,clearImmediate:o.clearImmediate,immediatePromise:function(){return new Promise(s)},delay:function(e,t){return void 0===t&&(t=void 0),new Promise((function(r){return setTimeout(r,e,t)}))}}}).call(this,r(344),r(345).setImmediate,r(345).clearImmediate)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(5),o=r(2);!function(e){function t(e){var t={create:function(e){return{action:t,params:e}},id:a.c.create22(),definition:e,createDefaultParams:function(t,r){return e.params?o.ParamDefinition.getDefaultValues(e.params(t,r)):{}}};return t}var r;e.create=t,e.fromTransformer=function(e){var r=e.definition;return t({from:r.from,display:r.display,params:r.params,isApplicable:e.definition.isApplicable?function(t,r,n){return e.definition.isApplicable(t,n)}:void 0,run:function(t){var r=t.cell,n=t.state,i=t.params,a=n.build().to(r.transform.ref).apply(e,i);return n.updateTree(a)}})},function(e){e.build=function(e){return function(e){return function(r){return t(Object(i.__assign)({from:e.from instanceof Array?e.from:e.from?[e.from]:[],display:"string"==typeof e.display?{name:e.display}:e.display?e.display:{name:"Unnamed State Action"},params:"object"==typeof e.params?function(){return e.params}:e.params?e.params:void 0,isApplicable:e.isApplicable},"function"==typeof r?{run:r}:r))}}(e)}}(r=e.Builder||(e.Builder={})),e.build=r.build}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(5);!function(e){e.create=function(e,t,r,n){return{id:i.c.create22(),label:e,basic:t,sourceData:n,bonds:r}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(6),a=r(118),o=r(12),s=r(88),u=r(282),c=r(10),l=r(173);!function(e){function t(e){for(var t=[],r=0,n=e.elements;r<n.length;r++){var a=(y=n[r]).unit,u=y.indices;if(0!==i.OrderedSet.size(u)){var c=[],l=[];if(i.OrderedSet.isInterval(u))1===i.OrderedSet.size(u)?l.push(i.Interval.min(u)):c.push(i.Interval.min(u),i.Interval.max(u));else for(var d=0,f=u.length;d<f;){var p=d;for(d++;d<f&&u[d-1]+1===u[d];)d++;var m=d;if(m-p>2)c.push(u[p],u[m-1]);else for(var h=p;h<m;h++)l[l.length]=u[h]}t.push({unit:a,set:i.SortedArray.ofSortedArray(l),ranges:s.a.ofSortedRanges(c)})}}for(var g=new Map,v=(d=0,t.length);d<v;++d){var b,y=t[d],_=Object(o.i)(Object(o.l)(y.ranges),Object(o.l)(y.set));if(g.has(_))(b=g.get(_).groupedUnits).has(y.unit.invariantId)?b.get(y.unit.invariantId).push(y.unit.id):b.set(y.unit.invariantId,[y.unit.id]);else(b=new Map).set(y.unit.invariantId,[y.unit.id]),g.set(_,{groupedUnits:b,set:y.set,ranges:y.ranges})}var S=[];return g.forEach((function(e){var t=[];e.groupedUnits.forEach((function(e){return t.push(i.SortedArray.ofUnsortedArray(e))})),t.sort((function(e,t){return e[0]-t[0]})),S.push({groupedUnits:t,set:e.set,ranges:e.ranges})})),{hash:e.structure.hashCode,elements:S}}function r(e,t){for(var r=[],n=0,i=e.length;n<i;++n){var a=e[n];t.unitMap.has(a)&&r.push(t.unitMap.get(a))}return r}function n(e){return c.MolScriptBuilder.internal.generator.bundleElement({groupedUnits:c.MolScriptBuilder.core.type.list(e.groupedUnits.map((function(e){return c.MolScriptBuilder.core.type.list(e)}))),ranges:c.MolScriptBuilder.core.type.list(e.ranges),set:c.MolScriptBuilder.core.type.list(e.set)})}e.Empty={hash:-1,elements:[]},e.fromSubStructure=function(e,r){return t(l.d.toLociWithSourceUnits(l.d.Singletons(e,r)))},e.fromSelection=function(e){return t(l.d.toLociWithSourceUnits(e))},e.fromLoci=t,e.toLoci=function(e,t){-1!==e.hash&&e.hash!==t.hashCode&&new Error("Bundle not compatible with given structure");for(var n=[],a=0,o=e.elements;a<o.length;a++)for(var c=o[a],l=function(e){var a=r(e,t);if(0===a.length)return"continue";var o=void 0;if(0===c.ranges.length)o=c.set;else if(0===c.set.length)if(2===c.ranges.length)o=i.Interval.ofRange(c.ranges[0],c.ranges[1]);else{var u=new Int32Array(s.a.size(c.ranges));s.a.forEach(c.ranges,(function(e,t){return u[t]=e})),o=i.SortedArray.ofSortedArray(u)}else{var l=s.a.size(c.ranges),d=new Int32Array(c.set.length+l);s.a.forEach(c.ranges,(function(e,t){return d[t]=e})),d.set(c.set,l),o=i.SortedArray.ofUnsortedArray(d)}for(var f=0,p=a;f<p.length;f++){var m=p[f];n.push({unit:m,indices:o})}},d=0,f=c.groupedUnits;d<f.length;d++){l(f[d])}return Object(u.a)(t,n)},e.toStructure=function(e,t){-1!==e.hash&&e.hash!==t.hashCode&&new Error("Bundle not compatible with given structure");for(var n=[],o=0,u=e.elements;o<u.length;o++)for(var c=u[o],l=function(e){var a=r(e,t);if(0===a.length)return"continue";var o=a[0].elements,u=s.a.size(c.ranges),l=c.set.length,d=new Int32Array(l+u),f=void 0;if(0===u){for(var p=0,m=l;p<m;++p)d[p]=o[c.set[p]];f=i.SortedArray.ofSortedArray(d)}else if(0===l)s.a.forEach(c.ranges,(function(e,t){return d[t]=o[e]})),f=i.SortedArray.ofSortedArray(d);else if(i.SortedArray.min(c.set)>s.a.max(c.ranges)){s.a.forEach(c.ranges,(function(e,t){return d[t]=o[e]}));for(p=0,m=l;p<m;++p)d[p+u]=o[c.set[p]];f=i.SortedArray.ofSortedArray(d)}else if(s.a.min(c.ranges)>i.SortedArray.max(c.set)){for(p=0,m=l;p<m;++p)d[p]=o[c.set[p]];s.a.forEach(c.ranges,(function(e,t){return d[t+l]=o[e]})),f=i.SortedArray.ofSortedArray(d)}else{s.a.forEach(c.ranges,(function(e,t){return d[t]=o[e]}));for(p=0,m=l;p<m;++p)d[p+u]=o[c.set[p]];f=i.SortedArray.ofUnsortedArray(d)}for(var h=0,g=a;h<g.length;h++){var v=g[h];n.push(v.getChild(f))}},d=0,f=c.groupedUnits;d<f.length;d++){l(f[d])}return a.a.create(n,{parent:t})},e.toExpression=function(e){return c.MolScriptBuilder.internal.generator.bundle({elements:c.MolScriptBuilder.core.type.list(e.elements.map(n))})},e.areEqual=function(e,t){if(e.elements.length!==t.elements.length)return!1;for(var r=0,n=e.elements.length;r<n;++r){var a=e.elements[r],o=t.elements[r];if(a.groupedUnits.length!==o.groupedUnits.length)return!1;for(var u=0,c=o.groupedUnits.length;u<c;++u)if(!i.SortedArray.areEqual(a.groupedUnits[u],o.groupedUnits[u]))return!1;if(!i.SortedArray.areEqual(a.set,o.set))return!1;if(!s.a.areEqual(a.ranges,o.ranges))return!1}return!0}}(n||(n={}))},function(e,t,r){"use strict";var n,i=r(7),a=r(343);!function(e){var t={byEntityKey:{},sequences:[]};function r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=[],n={},i=0,a=e.length;i<a;++i)r.push.apply(r,e[i].sequences),Object.assign(n,e[i].byEntityKey);return{sequences:r,byEntityKey:n}}function n(e,t){var r=t.atoms.label_comp_id,n=t.residues.label_seq_id,o=t.chainAtomSegments,s=t.residueAtomSegments,u=o.count,c=o.offsets,l={},d=[];if(1===u&&0===c[0]&&0===c[1])return{byEntityKey:l,sequences:d};for(var f=0,p=t.chains._rowCount;f<p;f++){var m=t.index.getEntityFromChain(f);if(void 0===l[m]&&"polymer"===e.data.type.value(m)){var h=f;for(f++;f<p&&m===t.index.getEntityFromChain(f)&&"polymer"!==e.data.type.value(m);)f++;f--;for(var g=s.index[c[h]],v=s.index[c[f+1]-1]+1,b=i.a.window(n,g,v),y=[],_=g;_<v;++_)y.push(r.value(s.offsets[_]));var S=i.a.ofStringArray(y);l[m]={entityId:e.data.id.value(m),sequence:a.a.ofResidueNames(S,b)},d.push(l[m])}}return{byEntityKey:l,sequences:d}}function o(e,t){return r(s(e,t.spheres),s(e,t.gaussians))}function s(e,t){var r=t.chainElementSegments,n=t.seq_id_begin,o=t.seq_id_end,s=r.count,u=r.offsets,c={},l=[];if(1===s&&0===u[0]&&0===u[1])return{byEntityKey:c,sequences:l};for(var d=0,f=s;d<f;d++){var p=t.getEntityFromChain(d);if(void 0===c[p]){var m=d;for(d++;d<f&&p===t.getEntityFromChain(d);)d++;d--;var h=u[m],g=u[d+1]-1,v=i.a.window(n,h,g),b=i.a.window(o,h,g);c[p]={entityId:e.data.id.value(p),sequence:a.a.ofSequenceRanges(v,b)},l.push(c[p])}}return{byEntityKey:c,sequences:l}}e.fromHierarchy=function(e,i,a){return r(n(e,i),a.isDefined?o(e,a):t)},e.fromAtomicHierarchy=n,e.fromCoarseHierarchy=o,e.fromCoarseElements=s}(n||(n={})),t.a=n},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(45),i=r(103),a=r(243),o=r(131);function s(e,t,r){void 0===e&&(e=0);var s=-1;return Object(a.a)(t)?s=Number(t)<1?1:Number(t):Object(o.a)(t)&&(r=t),Object(o.a)(r)||(r=i.a),new n.a((function(t){var n=Object(a.a)(e)?e:+e-r.now();return r.schedule(u,n,{index:0,period:s,subscriber:t})}))}function u(e){var t=e.index,r=e.period,n=e.subscriber;if(n.next(t),!n.closed){if(-1===r)return n.complete();e.index=t+1,this.schedule(e,r)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(300);function i(){return Object(n.a)(1)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l}));var n=r(20),i=r(62),a=r(45),o=r(34),s=r(76),u=r(304),c=function(e){function t(t,r){var n=e.call(this)||this;return n.source=t,n.subjectFactory=r,n._refCount=0,n._isComplete=!1,n}return n.a(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype.connect=function(){var e=this._connection;return e||(this._isComplete=!1,(e=this._connection=new s.a).add(this.source.subscribe(new d(this.getSubject(),this))),e.closed&&(this._connection=null,e=s.a.EMPTY)),e},t.prototype.refCount=function(){return Object(u.a)()(this)},t}(a.a),l=function(){var e=c.prototype;return{operator:{value:null},_refCount:{value:0,writable:!0},_subject:{value:null,writable:!0},_connection:{value:null,writable:!0},_subscribe:{value:e._subscribe},_isComplete:{value:e._isComplete,writable:!0},getSubject:{value:e.getSubject},connect:{value:e.connect},refCount:{value:e.refCount}}}(),d=function(e){function t(t,r){var n=e.call(this,t)||this;return n.connectable=r,n}return n.a(t,e),t.prototype._error=function(t){this._unsubscribe(),e.prototype._error.call(this,t)},t.prototype._complete=function(){this.connectable._isComplete=!0,this._unsubscribe(),e.prototype._complete.call(this)},t.prototype._unsubscribe=function(){var e=this.connectable;if(e){this.connectable=null;var t=e._connection;e._refCount=0,e._subject=null,e._connection=null,t&&t.unsubscribe()}},t}(i.b);o.a},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return u}));var n=r(20),i=r(34),a=r(196);function o(e,t){return void 0===t&&(t=0),function(r){return r.lift(new s(e,t))}}var s=function(){function e(e,t){void 0===t&&(t=0),this.scheduler=e,this.delay=t}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.scheduler,this.delay))},e}(),u=function(e){function t(t,r,n){void 0===n&&(n=0);var i=e.call(this,t)||this;return i.scheduler=r,i.delay=n,i}return n.a(t,e),t.dispatch=function(e){var t=e.notification,r=e.destination;t.observe(r),this.unsubscribe()},t.prototype.scheduleMessage=function(e){this.destination.add(this.scheduler.schedule(t.dispatch,this.delay,new c(e,this.destination)))},t.prototype._next=function(e){this.scheduleMessage(a.a.createNext(e))},t.prototype._error=function(e){this.scheduleMessage(a.a.createError(e)),this.unsubscribe()},t.prototype._complete=function(){this.scheduleMessage(a.a.createComplete()),this.unsubscribe()},t}(i.a),c=function(){return function(e,t){this.notification=e,this.destination=t}}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(20),i=r(104),a=r(235),o=r(194),s=r(178);function u(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(1===e.length){if(!Object(i.a)(e[0]))return e[0];e=e[0]}return Object(a.a)(e,void 0).lift(new c)}var c=function(){function e(){}return e.prototype.call=function(e,t){return t.subscribe(new l(e))},e}(),l=function(e){function t(t){var r=e.call(this,t)||this;return r.hasFirst=!1,r.observables=[],r.subscriptions=[],r}return n.a(t,e),t.prototype._next=function(e){this.observables.push(e)},t.prototype._complete=function(){var e=this.observables,t=e.length;if(0===t)this.destination.complete();else{for(var r=0;r<t&&!this.hasFirst;r++){var n=e[r],i=Object(s.a)(this,n,void 0,r);this.subscriptions&&this.subscriptions.push(i),this.add(i)}this.observables=null}},t.prototype.notifyNext=function(e,t,r){if(!this.hasFirst){this.hasFirst=!0;for(var n=0;n<this.subscriptions.length;n++)if(n!==r){var i=this.subscriptions[n];i.unsubscribe(),this.remove(i)}this.subscriptions=null}this.destination.next(t)},t}(o.a)},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(){function e(){return Error.call(this),this.message="Timeout has occurred",this.name="TimeoutError",this}return e.prototype=Object.create(Error.prototype),e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(45),i=r(76),a=r(211);var o=r(319),s=r(205);var u=r(385),c=r(383);function l(e,t){if(null!=e){if(function(e){return e&&"function"==typeof e[a.a]}(e))return function(e,t){return new n.a((function(r){var n=new i.a;return n.add(t.schedule((function(){var i=e[a.a]();n.add(i.subscribe({next:function(e){n.add(t.schedule((function(){return r.next(e)})))},error:function(e){n.add(t.schedule((function(){return r.error(e)})))},complete:function(){n.add(t.schedule((function(){return r.complete()})))}}))}))),n}))}(e,t);if(Object(u.a)(e))return function(e,t){return new n.a((function(r){var n=new i.a;return n.add(t.schedule((function(){return e.then((function(e){n.add(t.schedule((function(){r.next(e),n.add(t.schedule((function(){return r.complete()})))})))}),(function(e){n.add(t.schedule((function(){return r.error(e)})))}))}))),n}))}(e,t);if(Object(c.a)(e))return Object(o.a)(e,t);if(function(e){return e&&"function"==typeof e[s.a]}(e)||"string"==typeof e)return function(e,t){if(!e)throw new Error("Iterable cannot be null");return new n.a((function(r){var n,a=new i.a;return a.add((function(){n&&"function"==typeof n.return&&n.return()})),a.add(t.schedule((function(){n=e[s.a](),a.add(t.schedule((function(){if(!r.closed){var e,t;try{var i=n.next();e=i.value,t=i.done}catch(e){return void r.error(e)}t?r.complete():(r.next(e),this.schedule())}})))}))),a}))}(e,t)}throw new TypeError((null!==e&&typeof e||e)+" is not observable")}},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(0),i=r(200),a=r(66),o=r(1),s=r(29);var u,c=r(171),l=r(17),d=r(133),f=r(175),p=r(74),m=r(95),h=r(7),g=r(316),v=r(252);!function(e){function t(e,t){for(var r=[],o=t.frames,s=e.atomicHierarchy.atomSourceIndex,u=h.a.isIdentity(s),l=u?void 0:s.toArray({array:Int32Array}),d=0,f=o.length;d<f;++d){var p=o[d],g=Object(n.__assign)(Object(n.__assign)({},e),{id:i.a.create22(),modelNum:d,atomicConformation:u?c.a.getAtomicConformation(p,e.atomicConformation.atomId):c.a.getAtomicConformationReordered(p,e.atomicConformation.atomId,l),customProperties:new a.CustomProperties,_staticPropertyData:Object.create(null),_dynamicPropertyData:Object.create(null)});if(p.cell){var v=m.a.fromCell(p.cell.size,p.cell.anglesInRadians);m.a.Provider.set(g,v)}r.push(g)}return{trajectory:r,srcIndexArray:l}}function r(e){for(var t=new Int32Array(e.length),r=0,n=e.length;r<n;r++)t[e[r]]=r;return t}e.trajectoryFromModelAndCoordinates=function(e,r){return new v.a(t(e,r).trajectory)},e.invertIndex=r,e.trajectoryFromTopologyAndCoordinates=function(i,a){var o=this;return l.b.create("Create Trajectory",(function(s){return Object(n.__awaiter)(o,void 0,void 0,(function(){var o,u,c,l,p,m,g,b,y,_,S,x,O;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,Object(f.a)(i.basic,i.sourceData,s)];case 1:if(0===(o=n.sent()).frameCount)throw new Error("found no model");for(u=o.representative,c=t(u,a),l=c.trajectory,p=c.srcIndexArray,m=p?r(p):void 0,g=p?{indexA:h.a.ofIntArray(h.a.mapToArray(i.bonds.indexA,(function(e){return m[e]}),Int32Array)),indexB:h.a.ofIntArray(h.a.mapToArray(i.bonds.indexB,(function(e){return m[e]}),Int32Array)),order:i.bonds.order}:i.bonds,b={pairs:g,count:u.atomicHierarchy.atoms._rowCount},y=d.a.fromData(b),_=0,S=0,x=l;S<x.length;S++)O=x[S],d.a.Provider.set(O,y),e.TrajectoryInfo.set(O,{index:_++,size:l.length});return[2,new v.a(l)]}}))}))}))};e.getCenter=function(e){if(e._dynamicPropertyData.__Center__)return e._dynamicPropertyData.__Center__;var t=function(e,t){var r=[],n=[],i=[];e.x.length&&(r.push.apply(r,Object(s.arrayMinMax)(e.x)),n.push.apply(n,Object(s.arrayMinMax)(e.y)),i.push.apply(i,Object(s.arrayMinMax)(e.z))),t&&(t.spheres.x.length&&(r.push.apply(r,Object(s.arrayMinMax)(t.spheres.x)),n.push.apply(n,Object(s.arrayMinMax)(t.spheres.y)),i.push.apply(i,Object(s.arrayMinMax)(t.spheres.z))),t.gaussians.x.length&&(r.push.apply(r,Object(s.arrayMinMax)(t.gaussians.x)),n.push.apply(n,Object(s.arrayMinMax)(t.gaussians.y)),i.push.apply(i,Object(s.arrayMinMax)(t.gaussians.z))));var a=Object(s.arrayMinMax)(r),u=a[0],c=a[1],l=Object(s.arrayMinMax)(n),d=l[0],f=l[1],p=Object(s.arrayMinMax)(i),m=p[0],h=u+(c-u)/2,g=d+(f-d)/2,v=m+(p[1]-m)/2;return o.Vec3.create(h,g,v)}(e.atomicConformation,e.coarseConformation);return e._dynamicPropertyData.__Center__=t,t};e.TrajectoryInfo={get:function(e){return e._dynamicPropertyData.__TrajectoryInfo__||{index:0,size:1}},set:function(e,t){return e._dynamicPropertyData.__TrajectoryInfo__=t}};e.AsymIdCount={get:function(e){if(e._dynamicPropertyData.__AsymIdCount__)return e._dynamicPropertyData.__AsymIdCount__;var t=function(e){var t=new Set,r=new Set;return e.properties.structAsymMap.forEach((function(e,n){var i=e.auth_id;t.add(i),r.add(n)})),{auth:t.size,label:r.size}}(e);return e._dynamicPropertyData.__AsymIdCount__=t,t}},e.AsymIdOffset=g.CustomModelProperty.createSimple("asym_id_offset","static"),e.Index=g.CustomModelProperty.createSimple("index","static"),e.getRoot=function(e){return e.parent||e},e.areHierarchiesEqual=function(e,t){return e.atomicHierarchy===t.atomicHierarchy&&e.coarseHierarchy===t.coarseHierarchy};function u(e){return!!p.a.is(e.sourceData)&&(e.sourceData.data.db.database_2.database_id.isDefined||null!==e.entryId.match(/^[1-9][a-z0-9]{3,3}$/i)||null!==e.entryId.match(/^pdb_[0-9]{4,4}[1-9][a-z0-9]{3,3}$/i))}e.CoordinatesHistory={get:function(e){return e._staticPropertyData.__CoordinatesHistory__},set:function(e,t){return e._staticPropertyData.__CoordinatesHistory__=t}},e.hasCarbohydrate=function(e){return e.properties.saccharideComponentMap.size>0},e.hasProtein=function(e){for(var t=e.entities.subtype,r=0,n=t.rowCount;r<n;++r)if(t.value(r).startsWith("polypeptide"))return!0;return!1},e.hasNucleic=function(e){for(var t=e.entities.subtype,r=0,n=t.rowCount;r<n;++r){var i=t.value(r);if(i.endsWith("ribonucleotide hybrid")||i.endsWith("ribonucleotide"))return!0}return!1},e.isFromPdbArchive=u,e.hasSecondaryStructure=function(e){if(!p.a.is(e.sourceData))return!1;var t=e.sourceData.data.db;return t.struct_conf.id.isDefined||t.struct_sheet_range.id.isDefined};var b=o.Vec3.create(1.5707963,1.5707963,1.5707963),y=o.Vec3.create(1,1,1);function _(e){if(!p.a.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=0;r<t.exptl.method.rowCount;r++){if(t.exptl.method.value(r).toUpperCase().indexOf("DIFFRACTION")>=0)return!0}return!1}function S(e){if(!p.a.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=0;r<t.exptl.method.rowCount;r++){if(t.exptl.method.value(r).toUpperCase().indexOf("MICROSCOPY")>=0)return!0}return!1}function x(e){if(!p.a.is(e.sourceData))return!1;if(!_(e))return!1;var t=e.sourceData.data.db.pdbx_database_status.status_code_sf;return t.isDefined&&"REL"===t.value(0)}function O(e){if(!p.a.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=t.pdbx_database_related,n=r.db_name,i=r.content_type,a=0,o=t.pdbx_database_related._rowCount;a<o;++a)if("EMDB"===n.value(a).toUpperCase()&&"associated EM volume"===i.value(a))return!0;return!1}function w(e){return!!p.a.is(e.sourceData)&&(x(e)||O(e))}e.hasCrystalSymmetry=function(e){var t,r=null===(t=m.a.Provider.get(e))||void 0===t?void 0:t.spacegroup;return!(!r||1===r.num&&o.Vec3.equals(r.cell.anglesInRadians,b)&&o.Vec3.equals(r.cell.size,y))},e.isFromXray=_,e.isFromEm=S,e.isFromNmr=function(e){if(!p.a.is(e.sourceData))return!1;for(var t=e.sourceData.data.db,r=0;r<t.exptl.method.rowCount;r++){if(t.exptl.method.value(r).toUpperCase().indexOf("NMR")>=0)return!0}return!1},e.hasXrayMap=x,e.hasEmMap=O,e.hasDensityMap=w,e.probablyHasDensityMap=function(e){if(!p.a.is(e.sourceData))return!1;var t=e.sourceData.data.db;return w(e)||u(e)&&(!t.exptl.method.isDefined||_(e)&&(!t.pdbx_database_status.status_code_sf.isDefined||2===t.pdbx_database_status.status_code_sf.valueKind(0))||S(e)&&!t.pdbx_database_related.db_name.isDefined)}}(u||(u={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(20),i=function(e){function t(t,r){var n=e.call(this)||this;return n.subject=t,n.subscriber=r,n.closed=!1,n}return n.a(t,e),t.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var e=this.subject,t=e.observers;if(this.subject=null,t&&0!==t.length&&!e.isStopped&&!e.closed){var r=t.indexOf(this.subscriber);-1!==r&&t.splice(r,1)}}},t}(r(76).a)},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(1),o=r(17),s=r(29),u=r(66);function c(e,t){var r=this;return o.b.create("Create Volume",(function(){return Object(i.__awaiter)(r,void 0,void 0,(function(){var r,o,c,l,d,f,p,m,h,g,v,b,y,_,S,x,O;return Object(i.__generator)(this,(function(i){if(r=e.header,o=e.values,c=a.Tensor.Space(r.dim,[0,1,2],Float64Array),0===r.dataSetIds.length)l=o;else for(d=r.dim,f=d[0],p=d[1],m=d[2],h=((null==t?void 0:t.dataIndex)||0)+1,g=0,v=0,l=new Float64Array(f*p*m),b=0;b<f;b++)for(y=0;y<p;y++)for(_=0;_<m;_++)l[g++]=o[v],v+=h;return S=a.Tensor.create(c,a.Tensor.Data1(l)),x=a.Mat4.fromTranslation(Object(a.Mat4)(),r.origin),O=a.Mat4.fromBasis(Object(a.Mat4)(),r.basisX,r.basisY,r.basisZ),a.Mat4.mul(x,x,O),[2,{label:null==t?void 0:t.label,entryId:null==t?void 0:t.entryId,grid:{transform:{kind:"matrix",matrix:x},cells:S,stats:{min:Object(s.arrayMin)(l),max:Object(s.arrayMax)(l),mean:Object(s.arrayMean)(l),sigma:Object(s.arrayRms)(l)}},sourceData:n.create(e),customProperties:new u.CustomProperties,_propertyData:Object.create(null)}]}))}))}))}!function(e){e.is=function(e){return"cube"===(null==e?void 0:e.kind)},e.create=function(e){return{kind:"cube",name:e.name,data:e}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(161);function i(e){return c({buffer:e,offset:0,dataView:new DataView(e.buffer)})}function a(e,t){for(var r={},n=0;n<t;n++){r[c(e)]=c(e)}return r}function o(e,t){for(var r=new Uint8Array(t),n=e.offset,i=0;i<t;i++)r[i]=e.buffer[i+n];return e.offset+=t,r}function s(e,t){var r=Object(n.b)(e.buffer,e.offset,t);return e.offset+=t,r}function u(e,t){for(var r=new Array(t),n=0;n<t;n++)r[n]=c(e);return r}function c(e){var t,r,n=e.buffer[e.offset];if(0==(128&n))return e.offset++,n;if(128==(240&n))return r=15&n,e.offset++,a(e,r);if(144==(240&n))return r=15&n,e.offset++,u(e,r);if(160==(224&n))return r=31&n,e.offset++,s(e,r);if(224==(224&n))return t=e.dataView.getInt8(e.offset),e.offset++,t;switch(n){case 192:return e.offset++,null;case 194:return e.offset++,!1;case 195:return e.offset++,!0;case 196:return r=e.dataView.getUint8(e.offset+1),e.offset+=2,o(e,r);case 197:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,o(e,r);case 198:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,o(e,r);case 202:return t=e.dataView.getFloat32(e.offset+1),e.offset+=5,t;case 203:return t=e.dataView.getFloat64(e.offset+1),e.offset+=9,t;case 204:return t=e.buffer[e.offset+1],e.offset+=2,t;case 205:return t=e.dataView.getUint16(e.offset+1),e.offset+=3,t;case 206:return t=e.dataView.getUint32(e.offset+1),e.offset+=5,t;case 208:return t=e.dataView.getInt8(e.offset+1),e.offset+=2,t;case 209:return t=e.dataView.getInt16(e.offset+1),e.offset+=3,t;case 210:return t=e.dataView.getInt32(e.offset+1),e.offset+=5,t;case 217:return r=e.dataView.getUint8(e.offset+1),e.offset+=2,s(e,r);case 218:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,s(e,r);case 219:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,s(e,r);case 220:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,u(e,r);case 221:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,u(e,r);case 222:return r=e.dataView.getUint16(e.offset+1),e.offset+=3,a(e,r);case 223:return r=e.dataView.getUint32(e.offset+1),e.offset+=5,a(e,r)}throw new Error("Unknown type 0x"+n.toString(16))}},function(e,t,r){"use strict";function n(e,t,r,n){return{type:e,key:t,elements:r,getIndex:n}}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return s}));var n=r(0),i=r(59),a=r(7),o={label_comp_id:i.a.atom_site.label_comp_id,label_seq_id:i.a.atom_site.label_seq_id,pdbx_PDB_ins_code:i.a.atom_site.pdbx_PDB_ins_code,label_asym_id:i.a.atom_site.label_asym_id,label_entity_id:i.a.atom_site.label_entity_id,auth_comp_id:i.a.atom_site.auth_atom_id,auth_seq_id:i.a.atom_site.auth_seq_id,auth_asym_id:i.a.atom_site.auth_asym_id},s=(Object(n.__assign)(Object(n.__assign)({},i.a.chem_comp_bond),{molstar_protonation_variant:a.a.Schema.Str()}),Object(n.__assign)(Object(n.__assign)({},i.a.chem_comp),{type:a.a.Schema.Aliased(a.a.Schema.str)}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l}));var n=r(24),i=r(2),a=r(149),o=r(5),s=Object(n.Color)(13421772),u={value:i.ParamDefinition.Color(s)};function c(e,t){var r=Object(o.h)(t.value,s);return{factory:c,granularity:"uniform",color:function(){return r},props:t,description:"Gives everything the same, uniform color.",legend:Object(a.b)([["uniform",r]])}}var l={name:"uniform",label:"Uniform",category:"Miscellaneous",factory:c,getParams:function(e){return u},defaultValues:i.ParamDefinition.getDefaultValues(u),isApplicable:function(e){return!0}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a})),r.d(t,"b",(function(){return o}));var n=r(2),i={value:n.ParamDefinition.Numeric(1,{min:0,max:20,step:.1})};function a(e,t){var r=t.value;return{factory:a,granularity:"uniform",size:function(){return r},props:t,description:"Gives everything the same, uniform size."}}var o={name:"uniform",label:"Uniform",category:"",factory:a,getParams:function(e){return i},defaultValues:n.ParamDefinition.getDefaultValues(i),isApplicable:function(e){return!0}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(54),i=r(2),a={};function o(e,t){return{factory:o,granularity:"groupInstance",size:function(e){return n.b.isLocation(e)?e.shape.getSize(e.group,e.instance):1},props:t,description:"Assigns sizes as defined by the shape object."}}var s={name:"shape-group",label:"Shape Group",category:"",factory:o,getParams:function(e){return a},defaultValues:i.ParamDefinition.getDefaultValues(a),isApplicable:function(e){return!!e.shape}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return u})),r.d(t,"b",(function(){return c}));var n=r(24),i=r(54),a=r(2),o=Object(n.Color)(13421772),s={};function u(e,t){return{factory:u,granularity:"groupInstance",color:function(e){return i.b.isLocation(e)?e.shape.getColor(e.group,e.instance):o},props:t,description:"Assigns colors as defined by the shape object."}}var c={name:"shape-group",label:"Shape Group",category:"Miscellaneous",factory:u,getParams:function(e){return s},defaultValues:a.ParamDefinition.getDefaultValues(s),isApplicable:function(e){return!!e.shape}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return s})),r.d(t,"a",(function(){return u}));var n=r(99),i=r(204),a=r(231),o=Object(n.a)();function s(e,t,r,n,i,a,s){void 0===i&&(i=!0),void 0===a&&(a="uint8"),void 0===s&&(s="nearest");var u=t.framebuffer(),c="fp16"===a?t.texture("image-float16","rgba","fp16",s):"float32"===a?t.texture("image-float32","rgba","float",s):t.texture("image-uint8","rgba","ubyte",s),l=i?t.renderbuffer("depth16","depth",r,n):null;function d(){c.define(r,n),c.attachFramebuffer(u,"color0"),l&&l.attachFramebuffer(u)}d();var f=!1;return{id:o(),texture:c,framebuffer:u,getWidth:function(){return r},getHeight:function(){return n},bind:function(){u.bind()},setSize:function(e,t){r===e&&n===t||(r=e,n=t,c.define(r,n),l&&l.setSize(r,n))},reset:function(){d()},destroy:function(){f||(c.destroy(),u.destroy(),l&&l.destroy(),f=!0)}}}function u(e){return{id:o(),texture:Object(i.a)(e,"image-uint8"),framebuffer:Object(a.c)(),getWidth:function(){return 0},getHeight:function(){return 0},bind:function(){e.bindFramebuffer(e.FRAMEBUFFER,null)},setSize:function(){},reset:function(){},destroy:function(){}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d}));var n=r(0),i=r(102),a=r(116),o=r(161),s=r(325),u=r(183),c=r(87),l=r(323),d=function(e){function t(r){var a=e.call(this,{current:void 0,entries:Object(i.List)(),isPlaying:!1,nextSnapshotDelayInMs:t.DefaultNextSnapshotDelayInMs})||this;return a.plugin=r,a.entryMap=new Map,a.events={changed:a.ev()},a.timeoutHandle=void 0,a.next=function(){return Object(n.__awaiter)(a,void 0,void 0,(function(){var e,t,r;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return this.timeoutHandle=void 0,(e=this.getNextId(this.state.current,1))&&e!==this.state.current?(t=this.setCurrent(e),[4,this.plugin.state.setSnapshot(t)]):(this.stop(),[2]);case 1:return n.sent(),r=void 0!==t.durationInMs?t.durationInMs:this.state.nextSnapshotDelayInMs,this.state.isPlaying&&(this.timeoutHandle=setTimeout(this.next,r)),[2]}}))}))},a}return Object(n.__extends)(t,e),t.prototype.getIndex=function(e){return this.state.entries.indexOf(e)},t.prototype.getEntry=function(e){if(e)return this.entryMap.get(e)},t.prototype.remove=function(e){var t=this.entryMap.get(e);t&&(this.entryMap.delete(e),this.updateState({current:this.state.current===e?void 0:this.state.current,entries:this.state.entries.delete(this.getIndex(t))}),this.events.changed.next())},t.prototype.add=function(e){this.entryMap.set(e.snapshot.id,e),this.updateState({current:e.snapshot.id,entries:this.state.entries.push(e)}),this.events.changed.next()},t.prototype.replace=function(e,r){var n=this.getEntry(e);if(n){var i=this.getIndex(n),a=t.Entry(r,{name:n.name,description:n.description});this.entryMap.set(r.id,a),this.updateState({current:a.snapshot.id,entries:this.state.entries.set(i,a)}),this.events.changed.next()}},t.prototype.move=function(e,t){var r=this.state.entries.size;if(!(r<2)){var n=this.getEntry(e);if(n){var i=this.getIndex(n),a=(i+t)%r;a<0&&(a+=r);var o=this.state.entries.get(a),s=this.state.entries.asMutable();s.set(a,n),s.set(i,o),this.updateState({current:n.snapshot.id,entries:s.asImmutable()}),this.events.changed.next()}}},t.prototype.clear=function(){0!==this.state.entries.size&&(this.entryMap.clear(),this.updateState({current:void 0,entries:Object(i.List)()}),this.events.changed.next())},t.prototype.setCurrent=function(e){var t=this.getEntry(e);return t&&(this.updateState({current:e}),this.events.changed.next()),t&&t.snapshot},t.prototype.getNextId=function(e,t){var r=this.state.entries.size;if(!e){if(0===r)return;var n=-1===t?r-1:0;return this.state.entries.get(n).snapshot.id}var i=this.getEntry(e);if(i){var a=this.getIndex(i);if(!(a<0))return(a=(a+t)%r)<0&&(a+=r),this.state.entries.get(a).snapshot.id}},t.prototype.setStateSnapshot=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,a,o,s,u,c,d;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(e.version,l.a,this.clear(),r=Object(i.List)().asMutable(),a=0,o=e.entries;a<o.length;a++)s=o[a],this.entryMap.set(s.snapshot.id,s),r.push(s);return u=e.current?e.current:e.entries.length>0?e.entries[0].snapshot.id:void 0,this.updateState({current:u,entries:r.asImmutable(),isPlaying:!1,nextSnapshotDelayInMs:e.playback?e.playback.nextSnapshotDelayInMs:t.DefaultNextSnapshotDelayInMs}),this.events.changed.next(),u?(c=this.getEntry(u),(d=c&&c.snapshot)?[4,this.plugin.state.setSnapshot(d)]:[2]):[2];case 1:return n.sent(),e.playback&&e.playback.isPlaying&&this.play(!0),[2,d]}}))}))},t.prototype.syncCurrent=function(e){var r=this.plugin.state.getSnapshot(null==e?void 0:e.params);0!==this.state.entries.size&&this.state.current?this.replace(this.state.current,r):this.add(t.Entry(r,{name:null==e?void 0:e.name,description:null==e?void 0:e.description}))},t.prototype.getStateSnapshot=function(e){return this.syncCurrent(e),{timestamp:+new Date,version:l.a,name:e&&e.name,description:e&&e.description,current:this.state.current,playback:{isPlaying:!(!e||!e.playOnLoad),nextSnapshotDelayInMs:this.state.nextSnapshotDelayInMs},entries:this.state.entries.valueSeq().toArray()}},t.prototype.serialize=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,u,c,l,d,f,p,m,h,g,v,b;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return t=JSON.stringify(this.getStateSnapshot({params:null==e?void 0:e.params}),null,2),(null==e?void 0:e.type)&&"json"!==e.type&&"molj"!==e.type?[3,1]:[2,new Blob([t],{type:"application/json;charset=utf-8"})];case 1:r=new Uint8Array(Object(o.a)(t)),Object(o.c)(r,0,t),i={"state.json":r},a=[],u=0,c=this.plugin.managers.asset.assets,n.label=2;case 2:return u<c.length?(l=c[u],d=l.asset,f=l.file,a.push([d.id,d]),p=i,m="assets/"+d.id,h=Uint8Array.bind,[4,f.arrayBuffer()]):[3,5];case 3:p[m]=new(h.apply(Uint8Array,[void 0,n.sent()])),n.label=4;case 4:return u++,[3,2];case 5:return a.length>0&&(g=JSON.stringify(a,null,2),v=new Uint8Array(Object(o.a)(g)),Object(o.c)(v,0,g),i["assets.json"]=v),b=Object(s.c)(i),[2,new Blob([b],{type:"application/zip"})]}}))}))},t.prototype.open=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,i,a,o,s,l,d,f,p,m,h,g,v,b,y,_;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,8,,9]),(r=e.name.toLowerCase()).endsWith("json")||r.endsWith("molj")?[4,this.plugin.runTask(Object(u.c)(e,"string"))]:[3,2];case 1:return i=n.sent(),y=JSON.parse(i),t.isStateSnapshot(y)?[2,this.setStateSnapshot(y)]:t.isStateSnapshot(y.data)?[2,this.setStateSnapshot(y.data)]:(this.plugin.state.setSnapshot(y),[3,7]);case 2:return[4,this.plugin.runTask(Object(u.c)(e,"zip"))];case 3:return i=n.sent(),a=Object.create(null),Object(c.c)(i,(function(e,t){if("state.json"!==t&&"assets.json"!==t){var r=t.substring(t.indexOf("/")+1);a[r]=new File([e],r)}})),o=new File([i["state.json"]],"state.json"),[4,this.plugin.runTask(Object(u.c)(o,"string"))];case 4:return s=n.sent(),i["assets.json"]?(l=new File([i["assets.json"]],"assets.json"),p=(f=JSON).parse,[4,this.plugin.runTask(Object(u.c)(l,"string"))]):[3,6];case 5:for(d=p.apply(f,[n.sent()]),m=0,h=d;m<h.length;m++)g=h[m],v=g[0],b=g[1],this.plugin.managers.asset.set(b,a[v]);n.label=6;case 6:return y=JSON.parse(s),[2,this.setStateSnapshot(y)];case 7:return[3,9];case 8:return _=n.sent(),this.plugin.log.error("Reading state: "+_),[3,9];case 9:return[2]}}))}))},t.prototype.play=function(e){if(void 0===e&&(e=!1),this.updateState({isPlaying:!0}),e){var t=this.getEntry(this.state.current);if(!t)return void this.next();this.events.changed.next();var r=t.snapshot,n=void 0!==r.durationInMs?r.durationInMs:this.state.nextSnapshotDelayInMs;this.timeoutHandle=setTimeout(this.next,n)}else this.next()},t.prototype.stop=function(){this.updateState({isPlaying:!1}),void 0!==this.timeoutHandle&&clearTimeout(this.timeoutHandle),this.timeoutHandle=void 0,this.events.changed.next()},t.prototype.togglePlay=function(){this.state.isPlaying?(this.stop(),this.plugin.managers.animation.stop()):this.play()},t.DefaultNextSnapshotDelayInMs=1500,t}(a.b);!function(e){e.Entry=function(e,t){return Object(n.__assign)({timestamp:+new Date,snapshot:e},t)},e.isStateSnapshot=function(e){var t=e;return!!t&&!!t.timestamp&&!!t.entries}}(d||(d={}))},function(e,t,r){"use strict";function n(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(r){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}function i(e,t){if(void 0===t&&(t="download"),e)if("download"in HTMLAnchorElement.prototype){var r=document.createElement("a");r.download=t,r.rel="noopener","string"==typeof e?(r.href=e,n(r)):(r.href=URL.createObjectURL(e),setTimeout((function(){return URL.revokeObjectURL(r.href)}),4e4),setTimeout((function(){return n(r)})))}else if("undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(e,t);else{var i=window.navigator.userAgent,a=/Safari/i.test(i),o=/CriOS\/[\d]+/.test(i),s=function(e){var t;t=o?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),window.open(t,"_blank")||(window.location.href=t)};if((a||o)&&FileReader)if(e instanceof Blob){var u=new FileReader;u.onloadend=function(){return s(u.result)},u.readAsDataURL(e)}else s(e);else{var c=URL.createObjectURL(e);location.href=c,setTimeout((function(){return URL.revokeObjectURL(c)}),4e4)}}}r.d(t,"a",(function(){return i}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return f})),r.d(t,"b",(function(){return m}));var n=r(0),i=r(17),a=r(83),o=r(375),s=r(198),u=r(199);function c(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,o,s;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return 1024,[4,e.readBuffer(0,1024)];case 1:if(t=n.sent().buffer,"MAP "!==(r=String.fromCharCode(t.readUInt8(208),t.readUInt8(209),t.readUInt8(210),t.readUInt8(211))))throw new Error('ccp4 format error, missing "MAP " string');return i=[t.readUInt8(212),t.readUInt8(213)],a=!1,68===i[0]&&65===i[1]?a=!0:17===i[0]&&17===i[1]?a=!1:t.readInt32LE(12)<=16&&(a=!0),s=a?function(e){return t.readFloatLE(4*e)}:function(e){return t.readFloatBE(4*e)},[2,{header:{NC:(o=a?function(e){return t.readInt32LE(4*e)}:function(e){return t.readInt32BE(4*e)})(0),NR:o(1),NS:o(2),MODE:o(3),NCSTART:o(4),NRSTART:o(5),NSSTART:o(6),NX:o(7),NY:o(8),NZ:o(9),xLength:s(10),yLength:s(11),zLength:s(12),alpha:s(13),beta:s(14),gamma:s(15),MAPC:o(16),MAPR:o(17),MAPS:o(18),AMIN:s(19),AMAX:s(20),AMEAN:s(21),ISPG:o(22),NSYMBT:o(23),LSKFLG:o(24),SKWMAT:[],SKWTRN:[],userFlag1:o(39),userFlag2:o(40),originX:s(49),originY:s(50),originZ:s(51),MAP:r,MACHST:i,ARMS:s(54)},littleEndian:a}]}}))}))}function l(e){switch(e){case 0:return u.a.Int8;case 1:return u.a.Int16;case 2:return u.a.Float32;case 3:throw new Error("mode 3 unsupported, complex 16-bit integers");case 4:throw new Error("mode 4 unsupported, complex 32-bit reals");case 6:u.a.Uint16;case 16:throw new Error("mode 16 unsupported, unsigned char * 3 (for rgb data, non-standard)")}throw new Error("unknown mode '"+e+"'")}function d(e){return-128===e.userFlag1&&127===e.userFlag2}function f(e){return d(e)?u.a.Float32:l(e.MODE)}function p(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,i,a,o,s,p,m,h,g,v;return Object(n.__generator)(this,(function(b){switch(b.label){case 0:return[4,r.update({message:"Parsing CCP4/MRC/MAP file..."})];case 1:return b.sent(),[4,c(e)];case 2:return t=b.sent(),i=t.header,a=t.littleEndian,o=function(e){return 1024+e.NSYMBT}(i),s=l(i.MODE),p=f(i),m=i.NC*i.NR*i.NS,h=Object(u.c)(s),g=m*h,v=Object(u.b)(m,p),function(e,t,r,i,a,o){Object(n.__awaiter)(this,void 0,void 0,(function(){var s,c,l,f,p,m;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return d(e)?(s=3*a,[4,r.readBuffer(i,t.readBuffer,a,s)]):[3,2];case 1:for(n.sent(),c=new Int8Array(t.valuesBuffer.buffer,s),l=(e.AMAX-e.AMIN)/255,f=.5*(e.AMIN+e.AMAX+l),p=0,m=a;p<m;++p)t.values[p]=l*c[p]+f;return[3,4];case 2:return[4,Object(u.d)(t,r,i,a,0,o)];case 3:n.sent(),n.label=4;case 4:return[2]}}))}))}(i,v,e,o,g,a),[2,{header:i,values:v.values,name:e.name}]}}))}))}function m(e,t){return function(e,t){var r=this;return i.b.create("Parse CCP4/MRC/MAP",(function(t){return Object(n.__awaiter)(r,void 0,void 0,(function(){var r,i,o;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),i=(r=a.a).success,[4,p(e,0,t)];case 1:return[2,i.apply(r,[n.sent()])];case 2:return o=n.sent(),[2,a.a.error(o)];case 3:return[2]}}))}))}))}(o.a.fromBuffer(s.a.fromUint8Array(e),t),e.length)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n,i=r(5),a=r(198),o="undefined"==typeof document?r(432):void 0;!function(e){e.fromBuffer=function(e,t){return{name:t,readBuffer:function(t,r,n,o){var s,u;if("number"==typeof r){n=Object(i.h)(n,r);var c=t;s=(l=Math.min(e.length,c+n))-c,u=a.a.fromUint8Array(new Uint8Array(e.buffer,c,l-c))}else{n=Object(i.h)(n,r.length);c=t;var l=Math.min(e.length,c+n);r.set(e.subarray(c,l),o),s=l-c,u=r}return n!==s&&console.warn("byteCount "+n+" and bytesRead "+s+" differ"),Promise.resolve({bytesRead:s,buffer:u})},writeBuffer:function(e,t,r){return r=Object(i.h)(r,t.length),console.error(".writeBuffer not implemented for FileHandle.fromBuffer"),Promise.resolve(0)},writeBufferSync:function(e,t,r){return r=Object(i.h)(r,t.length),console.error(".writeSync not implemented for FileHandle.fromBuffer"),0},close:i.j}},e.fromDescriptor=function(e,t){if(void 0===o)throw new Error("fs module not available");return{name:t,readBuffer:function(t,r,n,s){return new Promise((function(u,c){var l;"number"==typeof r?(s=Object(i.h)(s,0),n=Object(i.h)(n,r),l=a.a.fromArrayBuffer(new ArrayBuffer(r))):(s=Object(i.h)(s,0),n=Object(i.h)(n,r.length),l=r),o.read(e,l,s,n,t,(function(e,t,r){e?c(e):(n!==t&&console.warn("byteCount "+n+" and bytesRead "+t+" differ"),u({bytesRead:t,buffer:r}))}))}))},writeBuffer:function(t,r,n){return n=Object(i.h)(n,r.length),new Promise((function(i,a){o.write(e,r,0,n,t,(function(e,t){e?a(e):i(t)}))}))},writeBufferSync:function(t,r,n){return n=Object(i.h)(n,r.length),o.writeSync(e,r,0,n,t)},close:function(){try{void 0!==e&&o.close(e,i.j)}catch(e){}}}}}(n||(n={}))},function(e,t,r){"use strict";r.d(t,"b",(function(){return u})),r.d(t,"a",(function(){return c}));var n=r(1),i=r(180),a=r(276),o=r(105),s=Math.pow(2,24)-2,u=function(){function e(e,t,r){this.webgl=e,this.drawPass=t,this.pickBaseScale=r;var n=r/e.pixelRatio;this.pickWidth=Math.ceil(t.colorTarget.getWidth()*n),this.pickHeight=Math.ceil(t.colorTarget.getHeight()*n),this.objectPickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight),this.instancePickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight),this.groupPickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight),this.depthPickTarget=e.createRenderTarget(this.pickWidth,this.pickHeight)}return Object.defineProperty(e.prototype,"drawingBufferHeight",{get:function(){return this.drawPass.colorTarget.getHeight()},enumerable:!1,configurable:!0}),e.prototype.syncSize=function(){var e=this.pickBaseScale/this.webgl.pixelRatio,t=Math.ceil(this.drawPass.colorTarget.getWidth()*e),r=Math.ceil(this.drawPass.colorTarget.getHeight()*e);t===this.pickWidth&&r===this.pickHeight||(this.pickWidth=t,this.pickHeight=r,this.objectPickTarget.setSize(this.pickWidth,this.pickHeight),this.instancePickTarget.setSize(this.pickWidth,this.pickHeight),this.groupPickTarget.setSize(this.pickWidth,this.pickHeight),this.depthPickTarget.setSize(this.pickWidth,this.pickHeight))},e.prototype.renderVariant=function(e,t,r,n,i){var a=this.drawPass.depthTexturePrimitives;e.clear(!1),e.renderPick(r.primitives,t,i,null),e.renderPick(r.volumes,t,i,a),e.renderPick(n.handle.scene,t,i,null)},e.prototype.render=function(e,t,r,n){e.update(t),this.objectPickTarget.bind(),this.renderVariant(e,t,r,n,"pickObject"),this.instancePickTarget.bind(),this.renderVariant(e,t,r,n,"pickInstance"),this.groupPickTarget.bind(),this.renderVariant(e,t,r,n,"pickGroup"),this.depthPickTarget.bind(),this.renderVariant(e,t,r,n,"depth")},e}(),c=function(){function e(e,t,r,n,i,a){this.webgl=e,this.renderer=t,this.scene=r,this.helper=n,this.pickPass=i,this.dirty=!0,this.viewport=Object(o.a)(),this.setViewport(a.x,a.y,a.width,a.height)}return e.prototype.setupBuffers=function(){var e=this.pickWidth*this.pickHeight*4;this.objectBuffer&&this.objectBuffer.length===e||(this.objectBuffer=new Uint8Array(e),this.instanceBuffer=new Uint8Array(e),this.groupBuffer=new Uint8Array(e),this.depthBuffer=new Uint8Array(e))},e.prototype.setViewport=function(e,t,r,n){o.a.set(this.viewport,e,t,r,n),this.pickScale=this.pickPass.pickBaseScale/this.webgl.pixelRatio,this.pickX=Math.ceil(e*this.pickScale),this.pickY=Math.ceil(t*this.pickScale);var i=Math.ceil(r*this.pickScale),a=Math.ceil(n*this.pickScale);i===this.pickWidth&&a===this.pickHeight||(this.pickWidth=i,this.pickHeight=a,this.halfPickWidth=Math.floor(this.pickWidth/2),this.setupBuffers())},e.prototype.syncBuffers=function(){var e=this.pickX,t=this.pickY,r=this.pickWidth,n=this.pickHeight;this.pickPass.objectPickTarget.bind(),this.webgl.readPixels(e,t,r,n,this.objectBuffer),this.pickPass.instancePickTarget.bind(),this.webgl.readPixels(e,t,r,n,this.instanceBuffer),this.pickPass.groupPickTarget.bind(),this.webgl.readPixels(e,t,r,n,this.groupBuffer),this.pickPass.depthPickTarget.bind(),this.webgl.readPixels(e,t,r,n,this.depthBuffer)},e.prototype.getBufferIdx=function(e,t){return 4*(t*this.pickWidth+e)},e.prototype.getDepth=function(e,t){var r=this.getBufferIdx(e,t),n=this.depthBuffer;return Object(i.c)(n[r],n[r+1],n[r+2],n[r+3])},e.prototype.getId=function(e,t,r){var n=this.getBufferIdx(e,t);return Object(i.a)(r[n],r[n+1],r[n+2])},e.prototype.render=function(e){var t=this,r=t.pickX,n=t.pickY,i=t.pickWidth,o=t.pickHeight,s=t.halfPickWidth,u=this.renderer,c=this.scene,l=this.helper;u.setTransparentBackground(!1),u.setDrawingBufferSize(this.pickPass.objectPickTarget.getWidth(),this.pickPass.objectPickTarget.getHeight()),a.a.is(e)?(u.setViewport(r,n,s,o),this.pickPass.render(u,e.left,c,l),u.setViewport(r+s,n,i-s,o),this.pickPass.render(u,e.right,c,l)):(u.setViewport(r,n,i,o),this.pickPass.render(u,e,c,l)),this.dirty=!1},e.prototype.identify=function(e,t,r){var i=this.webgl,u=this.pickScale;if(!i.isContextLost){e*=i.pixelRatio,t*=i.pixelRatio,t=this.pickPass.drawingBufferHeight-t;var c=this.viewport;if(!(e<c.x||t<c.y||e>c.x+c.width||t>c.y+c.height)){this.dirty&&(this.render(r),this.syncBuffers());var l=e-c.x,d=t-c.y,f=Math.floor(l*u),p=Math.floor(d*u),m=this.getId(f,p,this.objectBuffer);if(-1!==m&&m!==s){var h=this.getId(f,p,this.instanceBuffer);if(-1!==h&&h!==s){var g=this.getId(f,p,this.groupBuffer);if(-1!==g&&g!==s){var v=this.getDepth(f,p),b=n.Vec3.create(e,c.height-t,v);if(a.a.is(r)){var y=Math.floor(c.width/2);e>c.x+y?(b[0]=c.x+2*(l-y),Object(o.c)(b,b,c,r.right.inverseProjectionView)):(b[0]=c.x+2*l,Object(o.c)(b,b,c,r.left.inverseProjectionView))}else Object(o.c)(b,b,c,r.inverseProjectionView);return{id:{objectId:m,instanceId:h,groupId:g},position:b}}}}}}},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(0),i=r(31),a=r(185);function o(e,t){return e.builders.structure.hierarchy.applyPreset(t.trajectory,"default")}function s(e,t){var r=this;return function(i,a,o){return Object(n.__awaiter)(r,void 0,void 0,(function(){return Object(n.__generator)(this,(function(r){switch(r.label){case 0:return[4,i.state.data.build().to(a).apply(e,t,{tags:null==o?void 0:o.trajectoryTags}).commit({revertOnError:!0})];case 1:return[2,{trajectory:r.sent()}]}}))}))}}var u=[["mmcif",{label:"mmCIF",description:"mmCIF",category:"Trajectory",stringExtensions:["cif","mmcif","mcif"],binaryExtensions:["bcif"],isApplicable:function(e,t){return"mmcif"===e.ext||"mcif"===e.ext||("cif"===e.ext||"bcif"===e.ext)&&-1===Object(a.b)(e,t)},parse:function(e,t,r){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var a,o,s,u,c;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return a=e.state.data,[4,(o=a.build().to(t).apply(i.StateTransforms.Data.ParseCif,void 0,{state:{isGhost:!0}})).apply(i.StateTransforms.Model.TrajectoryFromMmCif,void 0,{tags:null==r?void 0:r.trajectoryTags}).commit({revertOnError:!0})];case 1:return s=n.sent(),((null===(c=null===(u=o.selector.cell)||void 0===u?void 0:u.obj)||void 0===c?void 0:c.data.blocks.length)||0)>1&&e.state.data.updateCellState(o.ref,{isGhost:!1}),[2,{trajectory:s}]}}))}))},visuals:o}],["cifCore",{label:"cifCore",description:"CIF Core",category:"Trajectory",stringExtensions:["cif"],isApplicable:function(e,t){return"cif"===e.ext&&"coreCif"===Object(a.b)(e,t)},parse:function(e,t,r){return Object(n.__awaiter)(void 0,void 0,void 0,(function(){var a,o,s,u,c;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return a=e.state.data,[4,(o=a.build().to(t).apply(i.StateTransforms.Data.ParseCif,void 0,{state:{isGhost:!0}})).apply(i.StateTransforms.Model.TrajectoryFromCifCore,void 0,{tags:null==r?void 0:r.trajectoryTags}).commit({revertOnError:!0})];case 1:return s=n.sent(),((null===(c=null===(u=o.selector.cell)||void 0===u?void 0:u.obj)||void 0===c?void 0:c.data.blocks.length)||0)>1&&e.state.data.updateCellState(o.ref,{isGhost:!1}),[2,{trajectory:s}]}}))}))},visuals:o}],["pdb",{label:"PDB",description:"PDB",category:"Trajectory",stringExtensions:["pdb","ent"],parse:s(i.StateTransforms.Model.TrajectoryFromPDB),visuals:o}],["pdbqt",{label:"PDBQT",description:"PDBQT",category:"Trajectory",stringExtensions:["pdbqt"],parse:s(i.StateTransforms.Model.TrajectoryFromPDB,{isPdbqt:!0}),visuals:o}],["gro",{label:"GRO",description:"GRO",category:"Trajectory",stringExtensions:["gro"],binaryExtensions:[],parse:s(i.StateTransforms.Model.TrajectoryFromGRO),visuals:o}],["mol",{label:"MOL/SDF",description:"MOL/SDF",category:"Trajectory",stringExtensions:["mol","sdf","sd"],parse:s(i.StateTransforms.Model.TrajectoryFromMOL),visuals:o}],["mol2",{label:"MOL2",description:"MOL2",category:"Trajectory",stringExtensions:["mol2"],parse:s(i.StateTransforms.Model.TrajectoryFromMOL2),visuals:o}]]},function(e,t,r){"use strict";r.r(t),r.d(t,"setStructureOverpaint",(function(){return l})),r.d(t,"clearStructureOverpaint",(function(){return d}));var n=r(0),i=r(4),a=r(31),o=r(13),s=r(140),u=r(24),c=r(23);function l(e,t,r,o,l){return Object(n.__awaiter)(this,void 0,void 0,(function(){var d=this;return Object(n.__generator)(this,(function(m){switch(m.label){case 0:return[4,f(e,t,(function(e,t,f){return Object(n.__awaiter)(d,void 0,void 0,(function(){var d,m,h,g,v;return Object(n.__generator)(this,(function(b){switch(b.label){case 0:return l&&l.length>0&&!l.includes(t.params.values.type.name)?[2]:(d=t.obj.data.source.data,[4,o(d.root)]);case 1:return m=b.sent(),c.Loci.isEmpty(m)?[2]:(h={bundle:i.StructureElement.Bundle.fromLoci(m),color:-1===r?Object(u.Color)(0):r,clear:-1===r},f?(g=Object(n.__spreadArrays)(f.params.values.layers,[h]),v=p(g,d),e.to(f).update(s.a.toBundle(v))):(v=p([h],d),e.to(t.transform.ref).apply(a.StateTransforms.Representation.OverpaintStructureRepresentation3DFromBundle,s.a.toBundle(v),{tags:"overpaint-controls"})),[2])}}))}))}))];case 1:return m.sent(),[2]}}))}))}function d(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i=this;return Object(n.__generator)(this,(function(a){switch(a.label){case 0:return[4,f(e,t,(function(e,t,a){return Object(n.__awaiter)(i,void 0,void 0,(function(){return Object(n.__generator)(this,(function(n){return r&&r.length>0&&!r.includes(t.params.values.type.name)||a&&e.delete(a.transform.ref),[2]}))}))}))];case 1:return a.sent(),[2]}}))}))}function f(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var i,s,u,c,l,d,f,p,m;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:i=e.state.data,s=i.build(),u=0,c=t,n.label=1;case 1:if(!(u<c.length))return[3,6];l=c[u],d=0,f=l.representations,n.label=2;case 2:return d<f.length?(p=f[d],m=i.select(o.StateSelection.Generators.ofTransformer(a.StateTransforms.Representation.OverpaintStructureRepresentation3DFromBundle,p.cell.transform.ref).withTag("overpaint-controls")),[4,r(s,p.cell,m[0])]):[3,5];case 3:n.sent(),n.label=4;case 4:return d++,[3,2];case 5:return u++,[3,1];case 6:return[2,s.commit({doNotUpdateCurrent:!0})]}}))}))}function p(e,t){var r=s.a.ofBundle(e,t.root),n=s.a.merge(r);return s.a.filter(n,t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return m})),r.d(t,"b",(function(){return f}));var n=r(0),i=r(4),a=r(13),o=r(31),s=r(27),u=r(29),c=r(116),l=r(2),d=r(232),f={distanceUnitLabel:l.ParamDefinition.Text("Å",{isEssential:!0}),textColor:d.b.textColor},p=l.ParamDefinition.getDefaultValues(f),m=function(e){function t(t){var r=e.call(this,{labels:[],distances:[],angles:[],dihedrals:[],orientations:[],options:p})||this;return r.plugin=t,r.behaviors={state:r.ev.behavior(r.state)},r._empty=[],t.state.data.events.changed.subscribe((function(e){e.inTransaction||t.behaviors.state.isAnimating.value||r.sync()})),t.behaviors.state.isAnimating.subscribe((function(e){e||t.behaviors.state.isUpdating.value||r.sync()})),r}return Object(n.__extends)(t,e),t.prototype.stateUpdated=function(){this.behaviors.state.next(this.state)},t.prototype.getGroup=function(){var e=this.plugin.state.data,t=a.StateSelection.findTagInSubtree(e.tree,a.StateTransform.RootRef,"measurement-group"),r=this.plugin.state.data.build();return t?r.to(t):r.toRoot().group(o.StateTransforms.Misc.CreateGroup,{label:"Measurements"},{tags:"measurement-group"})},t.prototype.setOptions=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,i,a,o,u,c,l,d,f;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:for(this.updateState({options:e})&&this.stateUpdated(),t=this.plugin.state.data.build(),r=0,i=this.state.distances;r<i.length;r++)f=i[r],t.to(f).update((function(t){t.unitLabel=e.distanceUnitLabel,t.textColor=e.textColor}));for(a=0,o=this.state.labels;a<o.length;a++)f=o[a],t.to(f).update((function(t){t.textColor=e.textColor}));for(u=0,c=this.state.angles;u<c.length;u++)f=c[u],t.to(f).update((function(t){t.textColor=e.textColor}));for(l=0,d=this.state.dihedrals;l<d.length;l++)f=d[l],t.to(f).update((function(t){t.textColor=e.textColor}));return 0===t.editInfo.count?[2]:[4,s.PluginCommands.State.Update(this.plugin,{state:this.plugin.state.data,tree:t,options:{doNotLogTiming:!0}})];case 1:return n.sent(),[2]}}))}))},t.prototype.addDistance=function(e,t,r){return Object(n.__awaiter)(this,void 0,void 0,(function(){var a,c,l,d,f;return Object(n.__generator)(this,(function(p){switch(p.label){case 0:return a=this.plugin.helpers.substructureParent.get(e.structure),c=this.plugin.helpers.substructureParent.get(t.structure),a&&c?(l=[a.transform.ref],Object(u.arraySetAdd)(l,c.transform.ref),(d=this.getGroup()).apply(o.StateTransforms.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",groupId:"a",ref:a.transform.ref,expression:i.StructureElement.Loci.toExpression(e)},{key:"b",groupId:"b",ref:c.transform.ref,expression:i.StructureElement.Loci.toExpression(t)}],isTransitive:!0,label:"Distance"},{dependsOn:l,tags:null==r?void 0:r.selectionTags}).apply(o.StateTransforms.Representation.StructureSelectionsDistance3D,Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({customText:(null==r?void 0:r.customText)||"",unitLabel:this.state.options.distanceUnitLabel,textColor:this.state.options.textColor},null==r?void 0:r.lineParams),null==r?void 0:r.labelParams),null==r?void 0:r.visualParams),{tags:null==r?void 0:r.reprTags}),f=this.plugin.state.data,[4,s.PluginCommands.State.Update(this.plugin,{state:f,tree:d,options:{doNotLogTiming:!0}})]):[2];case 1:return p.sent(),[2]}}))}))},t.prototype.addAngle=function(e,t,r,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var c,l,d,f,p,m;return Object(n.__generator)(this,(function(h){switch(h.label){case 0:return c=this.plugin.helpers.substructureParent.get(e.structure),l=this.plugin.helpers.substructureParent.get(t.structure),d=this.plugin.helpers.substructureParent.get(r.structure),c&&l&&d?(f=[c.transform.ref],Object(u.arraySetAdd)(f,l.transform.ref),Object(u.arraySetAdd)(f,d.transform.ref),(p=this.getGroup()).apply(o.StateTransforms.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:c.transform.ref,expression:i.StructureElement.Loci.toExpression(e)},{key:"b",ref:l.transform.ref,expression:i.StructureElement.Loci.toExpression(t)},{key:"c",ref:d.transform.ref,expression:i.StructureElement.Loci.toExpression(r)}],isTransitive:!0,label:"Angle"},{dependsOn:f,tags:null==a?void 0:a.selectionTags}).apply(o.StateTransforms.Representation.StructureSelectionsAngle3D,Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({customText:(null==a?void 0:a.customText)||"",textColor:this.state.options.textColor},null==a?void 0:a.lineParams),null==a?void 0:a.labelParams),null==a?void 0:a.visualParams),{tags:null==a?void 0:a.reprTags}),m=this.plugin.state.data,[4,s.PluginCommands.State.Update(this.plugin,{state:m,tree:p,options:{doNotLogTiming:!0}})]):[2];case 1:return h.sent(),[2]}}))}))},t.prototype.addDihedral=function(e,t,r,a,c){return Object(n.__awaiter)(this,void 0,void 0,(function(){var l,d,f,p,m,h,g;return Object(n.__generator)(this,(function(v){switch(v.label){case 0:return l=this.plugin.helpers.substructureParent.get(e.structure),d=this.plugin.helpers.substructureParent.get(t.structure),f=this.plugin.helpers.substructureParent.get(r.structure),p=this.plugin.helpers.substructureParent.get(a.structure),l&&d&&f&&p?(m=[l.transform.ref],Object(u.arraySetAdd)(m,d.transform.ref),Object(u.arraySetAdd)(m,f.transform.ref),Object(u.arraySetAdd)(m,p.transform.ref),(h=this.getGroup()).apply(o.StateTransforms.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:l.transform.ref,expression:i.StructureElement.Loci.toExpression(e)},{key:"b",ref:d.transform.ref,expression:i.StructureElement.Loci.toExpression(t)},{key:"c",ref:f.transform.ref,expression:i.StructureElement.Loci.toExpression(r)},{key:"d",ref:p.transform.ref,expression:i.StructureElement.Loci.toExpression(a)}],isTransitive:!0,label:"Dihedral"},{dependsOn:m,tags:null==c?void 0:c.selectionTags}).apply(o.StateTransforms.Representation.StructureSelectionsDihedral3D,Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({customText:(null==c?void 0:c.customText)||"",textColor:this.state.options.textColor},null==c?void 0:c.lineParams),null==c?void 0:c.labelParams),null==c?void 0:c.visualParams),{tags:null==c?void 0:c.reprTags}),g=this.plugin.state.data,[4,s.PluginCommands.State.Update(this.plugin,{state:g,tree:h,options:{doNotLogTiming:!0}})]):[2];case 1:return v.sent(),[2]}}))}))},t.prototype.addLabel=function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,a,u,c;return Object(n.__generator)(this,(function(l){switch(l.label){case 0:return(r=this.plugin.helpers.substructureParent.get(e.structure))?(a=[r.transform.ref],(u=this.getGroup()).apply(o.StateTransforms.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:r.transform.ref,expression:i.StructureElement.Loci.toExpression(e)}],isTransitive:!0,label:"Label"},{dependsOn:a,tags:null==t?void 0:t.selectionTags}).apply(o.StateTransforms.Representation.StructureSelectionsLabel3D,Object(n.__assign)(Object(n.__assign)({textColor:this.state.options.textColor},null==t?void 0:t.labelParams),null==t?void 0:t.visualParams),{tags:null==t?void 0:t.reprTags}),c=this.plugin.state.data,[4,s.PluginCommands.State.Update(this.plugin,{state:c,tree:u,options:{doNotLogTiming:!0}})]):[2];case 1:return l.sent(),[2]}}))}))},t.prototype.addOrientation=function(e){return Object(n.__awaiter)(this,void 0,void 0,(function(){var t,r,a,u;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return(t=this.plugin.helpers.substructureParent.get(e.structure))?(r=[t.transform.ref],(a=this.getGroup()).apply(o.StateTransforms.Model.MultiStructureSelectionFromExpression,{selections:[{key:"a",ref:t.transform.ref,expression:i.StructureElement.Loci.toExpression(e)}],isTransitive:!0,label:"Orientation"},{dependsOn:r}).apply(o.StateTransforms.Representation.StructureSelectionsOrientation3D),u=this.plugin.state.data,[4,s.PluginCommands.State.Update(this.plugin,{state:u,tree:a,options:{doNotLogTiming:!0}})]):[2];case 1:return n.sent(),[2]}}))}))},t.prototype.getTransforms=function(e){var t=this.plugin.state.data,r=a.StateSelection.findTagInSubtree(t.tree,a.StateTransform.RootRef,"measurement-group"),n=r?t.select(a.StateSelection.Generators.ofTransformer(e,r)):this._empty;return 0===n.length?this._empty:n},t.prototype.sync=function(){this.updateState({labels:this.getTransforms(o.StateTransforms.Representation.StructureSelectionsLabel3D),distances:this.getTransforms(o.StateTransforms.Representation.StructureSelectionsDistance3D),angles:this.getTransforms(o.StateTransforms.Representation.StructureSelectionsAngle3D),dihedrals:this.getTransforms(o.StateTransforms.Representation.StructureSelectionsDihedral3D),orientations:this.getTransforms(o.StateTransforms.Representation.StructureSelectionsOrientation3D)})&&this.stateUpdated()},t}(c.b)},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),i=r(23),a=r(4),o=r(41),s=r(51),u=r(87),c=r(2),l=function(e){function t(r,i){void 0===i&&(i={});var a=e.call(this,{props:Object(n.__assign)(Object(n.__assign)({},c.ParamDefinition.getDefaultValues(t.Params)),i)})||this;return a.plugin=r,a._props=c.ParamDefinition.getDefaultValues(t.Params),a.events={propsUpdated:a.ev()},a.lociSelects=new t.LociSelectManager(r,a._props),a.lociHighlights=new t.LociHighlightManager(r,a._props),a}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"props",{get:function(){return Object(n.__assign)({},this.state.props)},enumerable:!1,configurable:!0}),t.prototype.setProps=function(e){var t=this.props,r=Object(n.__assign)(Object(n.__assign)({},this.state.props),e);Object(u.d)(t,r)||(this.updateState({props:r}),this.lociSelects.setProps(r),this.lociHighlights.setProps(r),this.events.propsUpdated.next())},t}(r(116).b);!function(e){e.Params={granularity:c.ParamDefinition.Select("residue",i.Loci.GranularityOptions,{label:"Picking Level",description:"Controls if selections are expanded upon picking to whole residues, chains, structures, instances, or left as atoms and coarse elements"})};var t=function(){function t(t,r){void 0===r&&(r={}),this.ctx=t,this.providers=[],this.props=c.ParamDefinition.getDefaultValues(e.Params),this.sel=t.managers.structure.selection,this.setProps(r)}return t.prototype.setProps=function(e){Object.assign(this.props,e)},t.prototype.addProvider=function(e){this.providers.push(e)},t.prototype.removeProvider=function(e){this.providers=this.providers.filter((function(t){return t!==e}))},t.prototype.normalizedLoci=function(e,t){void 0===t&&(t=!0);var r=e.loci,n=e.repr,a=t?this.props.granularity:void 0;return{loci:i.Loci.normalize(r,a),repr:n}},t.prototype.mark=function(e,t){if(!i.Loci.isEmpty(e.loci))for(var r=0,n=this.providers;r<n.length;r++){(0,n[r])(e,t)}},t}();e.LociMarkManager=t;var r=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.prev=[],t.clearHighlights=function(){for(var e=0,r=t.prev;e<r.length;e++){var n=r[e];t.mark(n,s.a.RemoveHighlight)}t.prev.length=0},t}return Object(n.__extends)(t,e),t.prototype.isHighlighted=function(e){for(var t=0,r=this.prev;t<r.length;t++){var n=r[t];if(o.a.Loci.areEqual(n,e))return!0}return!1},t.prototype.addHighlight=function(e){this.mark(e,s.a.Highlight),this.prev.push(e)},t.prototype.highlight=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);this.isHighlighted(r)||this.addHighlight(r)},t.prototype.highlightOnly=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);this.isHighlighted(r)||(this.clearHighlights(),this.addHighlight(r))},t.prototype.highlightOnlyExtend=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);if(a.StructureElement.Loci.is(r.loci)){var n={loci:this.sel.tryGetRange(r.loci)||r.loci,repr:r.repr};this.isHighlighted(n)||(this.clearHighlights(),this.addHighlight(n))}},t}(t);e.LociHighlightManager=r;var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.toggle=function(t,r){if(void 0===r&&(r=!0),!i.Loci.isEmpty(t.loci)){var n=this.normalizedLoci(t,r);a.StructureElement.Loci.is(n.loci)?this.toggleSel(n):e.prototype.mark.call(this,n,s.a.Toggle)}},t.prototype.toggleExtend=function(e,t){if(void 0===t&&(t=!0),!i.Loci.isEmpty(e.loci)){var r=this.normalizedLoci(e,t);if(a.StructureElement.Loci.is(r.loci)){var n=this.sel.tryGetRange(r.loci)||r.loci;this.toggleSel({loci:n,repr:r.repr})}}},t.prototype.select=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);a.StructureElement.Loci.is(r.loci)&&this.sel.modify("add",r.loci),this.mark(r,s.a.Select)},t.prototype.selectJoin=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);a.StructureElement.Loci.is(r.loci)&&this.sel.modify("intersect",r.loci),this.mark(r,s.a.Select)},t.prototype.selectOnly=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);a.StructureElement.Loci.is(r.loci)&&(this.deselect({loci:a.Structure.toStructureElementLoci(r.loci.structure),repr:r.repr},!1),this.sel.modify("set",r.loci)),this.mark(r,s.a.Select)},t.prototype.deselect=function(e,t){void 0===t&&(t=!0);var r=this.normalizedLoci(e,t);a.StructureElement.Loci.is(r.loci)&&this.sel.modify("remove",r.loci),this.mark(r,s.a.Deselect)},t.prototype.deselectAll=function(){this.sel.clear(),this.mark({loci:i.EveryLoci},s.a.Deselect)},t.prototype.deselectAllOnEmpty=function(e){Object(i.isEmptyLoci)(e.loci)&&this.deselectAll()},t.prototype.mark=function(t,r){var n=t.loci;i.Loci.isEmpty(n)||(a.StructureElement.Loci.is(n)?(e.prototype.mark.call(this,{loci:a.Structure.Loci(n.structure)},s.a.Deselect),e.prototype.mark.call(this,{loci:this.sel.getLoci(n.structure)},s.a.Select)):e.prototype.mark.call(this,t,r))},t.prototype.toggleSel=function(e){this.sel.has(e.loci)?(this.sel.modify("remove",e.loci),this.mark(e,s.a.Deselect)):(this.sel.modify("add",e.loci),this.mark(e,s.a.Select))},t}(t);e.LociSelectManager=u}(l||(l={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"VolumeStreamingControls",(function(){return y})),r.d(t,"VolumeSourceControls",(function(){return _}));var n=r(0),i=r(3),a=r(284),o=r(392),s=r(234),u=r(164),c=r(308),l=r(13),d=r(33),f=r(56),p=r(18),m=r(318),h=r(189),g=r(195),v=r(27),b=r(15),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.defaultState=function(){return{header:"Volume Streaming",isCollapsed:!1,isBusy:!1,isHidden:!0,brand:{accent:"cyan",svg:b.BlurOnSvg}}},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(){e.setState({isHidden:!e.canEnable(),description:a.StructureHierarchyManager.getSelectedStructuresDescription(e.plugin)})})),this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){l.StateTransform.hasTag(t.cell.transform,u.a.RootTag)&&e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})}))},Object.defineProperty(t.prototype,"pivot",{get:function(){return this.plugin.managers.structure.hierarchy.selection.structures[0]},enumerable:!1,configurable:!0}),t.prototype.canEnable=function(){var e,t;if(1!==this.plugin.managers.structure.hierarchy.selection.structures.length)return!1;var r=this.pivot.cell;return!!r.obj&&!!(null===(t=(e=c.InitVolumeStreaming.definition).isApplicable)||void 0===t?void 0:t.call(e,r.obj,r.transform,this.plugin))},t.prototype.renderEnable=function(){var e,t=this.pivot;if(!t.cell.parent)return null;var r=l.StateSelection.findTagInSubtree(t.cell.parent.tree,this.pivot.cell.transform.ref,u.a.RootTag),n=r&&t.cell.parent.cells.get(r),a=n&&"error"===n.status?{header:"Error enabling",icon:b.ErrorSvg,title:n.errorText}:n&&0===(null===(e=n.obj)||void 0===e?void 0:e.data.entries.length)?{header:"Error enabling",icon:b.ErrorSvg,title:"No entry for streaming found"}:{header:"Enable",icon:b.CheckSvg,title:"Enable"};return i.createElement(m.a,{state:t.cell.parent,action:c.InitVolumeStreaming,initiallyCollapsed:!0,nodeRef:t.cell.transform.ref,simpleApply:a})},t.prototype.renderParams=function(){var e,t,r,n,a,o=this.pivot;if(!o.cell.parent)return null;var u="selection-box"===(null===(t=null===(e=o.volumeStreaming)||void 0===e?void 0:e.cell.transform.params)||void 0===t?void 0:t.entry.params.view.name)&&(null===(a=null===(n=null===(r=this.plugin.state.behaviors.cells.get(s.FocusLoci.id))||void 0===r?void 0:r.params)||void 0===n?void 0:n.values)||void 0===a?void 0:a.bindings);return i.createElement(i.Fragment,null,i.createElement(h.UpdateTransformControl,{state:o.cell.parent,transform:o.volumeStreaming.cell.transform,customHeader:"none",noMargin:!0}),u&&i.createElement(p.ExpandGroup,{header:"Controls Help"},i.createElement(g.BindingsHelp,{bindings:u})))},t.prototype.renderControls=function(){var e=this.pivot;return e?e.volumeStreaming?this.renderParams():this.renderEnable():null},t}(d.CollapsableControls),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.item=function(e){var r,n=t.plugin.managers.volume.hierarchy.selection;return{kind:"item",label:(null===(r=e.cell.obj)||void 0===r?void 0:r.label)||"Volume"||e.kind,selected:n===e,value:e}},t.selectCurrent=function(e){t.toggleHierarchy(),e&&t.plugin.managers.volume.hierarchy.setCurrent(e.value)},t.selectAdd=function(e){e&&(t.setState({show:void 0}),e.value())},t.toggleHierarchy=function(){return t.setState({show:"hierarchy"!==t.state.show?"hierarchy":void 0})},t.toggleAddRepr=function(){return t.setState({show:"add-repr"!==t.state.show?"add-repr":void 0})},t}return Object(n.__extends)(t,e),t.prototype.defaultState=function(){return{header:"Volume",isCollapsed:!1,isBusy:!1,isHidden:!0,brand:{accent:"purple",svg:b.BlurOnSvg}}},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.volume.hierarchy.behaviors.selection,(function(t){e.setState({isHidden:0===t.hierarchy.volumes.length})})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})}))},Object.defineProperty(t.prototype,"hierarchyItems",{get:function(){for(var e=[],t=0,r=this.plugin.managers.volume.hierarchy.current.volumes;t<r.length;t++){var n=r[t];e.push(this.item(n))}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"addActions",{get:function(){var e=this.plugin.managers.volume.hierarchy,t=e.selection;return Object(n.__spreadArrays)(o.a.getRepresentationTypes(this.plugin,t).map((function(r){return f.a.Item(r[1],(function(){return e.addRepresentation(t,r[0])}))})))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0===this.plugin.managers.volume.hierarchy.current.volumes.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){var e,t=this.plugin.managers.volume.hierarchy.selection;return t?(null===(e=null==t?void 0:t.cell.obj)||void 0===e?void 0:e.label)||"Volume":"Nothing Selected"},enumerable:!1,configurable:!0}),t.prototype.renderControls=function(){var e=this.state.isBusy||this.isEmpty,t=this.label,r=this.plugin.managers.volume.hierarchy.selection;return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row",style:{marginTop:"1px"}},i.createElement(p.Button,{noOverflow:!0,flex:!0,onClick:this.toggleHierarchy,disabled:e,title:t},t),!this.isEmpty&&i.createElement(p.IconButton,{svg:b.AddSvg,onClick:this.toggleAddRepr,title:"Apply a structure presets to the current hierarchy.",toggleState:"add-repr"===this.state.show,disabled:e})),"hierarchy"===this.state.show&&i.createElement(f.a,{items:this.hierarchyItems,onSelect:this.selectCurrent}),"add-repr"===this.state.show&&i.createElement(f.a,{items:this.addActions,onSelect:this.selectAdd}),r&&r.representations.length>0&&i.createElement("div",{style:{marginTop:"6px"}},r.representations.map((function(e){return i.createElement(S,{key:e.cell.transform.ref,representation:e})}))))},t}(d.CollapsableControls),S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={action:void 0},t.remove=function(){return t.plugin.managers.volume.hierarchy.remove([t.props.representation],!0)},t.toggleVisible=function(e){e.preventDefault(),e.currentTarget.blur(),t.plugin.managers.volume.hierarchy.toggleVisibility([t.props.representation])},t.toggleUpdate=function(){return t.setState({action:"update"===t.state.action?void 0:"update"})},t.highlight=function(e){e.preventDefault(),t.props.representation.cell.parent&&v.PluginCommands.Interactivity.Object.Highlight(t.plugin,{state:t.props.representation.cell.parent,ref:t.props.representation.cell.transform.ref})},t.clearHighlight=function(e){e.preventDefault(),v.PluginCommands.Interactivity.ClearHighlights(t.plugin)},t.focus=function(){var e,r=t.props.representation,n=null===(e=t.props.representation.cell.obj)||void 0===e?void 0:e.data.repr.renderObjects;r.cell.state.isHidden&&t.plugin.managers.volume.hierarchy.toggleVisibility([t.props.representation],"show"),t.plugin.managers.camera.focusRenderObjects(n,{extraRadius:1})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){l.State.ObjectEvent.isCell(t,e.props.representation.cell)&&e.forceUpdate()}))},t.prototype.render=function(){var e,t,r,n=this.props.representation.cell;return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(p.Button,{noOverflow:!0,className:"msp-control-button-label",title:(null===(e=n.obj)||void 0===e?void 0:e.label)+". Click to focus.",onClick:this.focus,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:{textAlign:"left"}},null===(t=n.obj)||void 0===t?void 0:t.label,i.createElement("small",{className:"msp-25-lower-contrast-text",style:{float:"right"}},null===(r=n.obj)||void 0===r?void 0:r.description)),i.createElement(p.IconButton,{svg:n.state.isHidden?b.VisibilityOffOutlinedSvg:b.VisibilityOutlinedSvg,toggleState:!1,onClick:this.toggleVisible,title:(n.state.isHidden?"Show":"Hide")+" component",small:!0,className:"msp-form-control",flex:!0}),i.createElement(p.IconButton,{svg:b.DeleteOutlinedSvg,onClick:this.remove,title:"Remove",small:!0}),i.createElement(p.IconButton,{svg:b.MoreHorizSvg,onClick:this.toggleUpdate,title:"Actions",toggleState:"update"===this.state.action})),"update"===this.state.action&&!!n.parent&&i.createElement("div",{style:{marginBottom:"6px"},className:"msp-accent-offset"},i.createElement(h.UpdateTransformControl,{state:n.parent,transform:n.transform,customHeader:"none",noMargin:!0})))},t}(d.PurePluginUIComponent)},function(e,t,r){"use strict";r.d(t,"a",(function(){return h}));var n=r(0),i=r(13),a=r(8),o=r(177),s=r(146),u=r(27),c=r(2),l=r(5),d=r(158),f=r(247),p=r(116),m=r(78),h=function(e){function t(r){var s=e.call(this)||this;return s.plugin=r,s.data=i.State.create(new a.a.Root({}),{runTask:s.plugin.runTask,globalContext:s.plugin,historyCapacity:s.plugin.config.get(m.PluginConfig.State.HistoryCapacity)}),s.behaviors=i.State.create(new o.PluginBehavior.Root({}),{runTask:s.plugin.runTask,globalContext:s.plugin,rootState:{isLocked:!0}}),s.events={cell:{stateUpdated:Object(f.a)(s.data.events.cell.stateUpdated,s.behaviors.events.cell.stateUpdated),created:Object(f.a)(s.data.events.cell.created,s.behaviors.events.cell.created),removed:Object(f.a)(s.data.events.cell.removed,s.behaviors.events.cell.removed)},object:{created:Object(f.a)(s.data.events.object.created,s.behaviors.events.object.created),removed:Object(f.a)(s.data.events.object.removed,s.behaviors.events.object.removed),updated:Object(f.a)(s.data.events.object.updated,s.behaviors.events.object.updated)}},s.snapshotParams=s.ev.behavior(t.DefaultSnapshotParams),s.setSnapshotParams=function(e){s.snapshotParams.next(Object(n.__assign)(Object(n.__assign)({},t.DefaultSnapshotParams),e))},s}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"animation",{get:function(){return this.plugin.managers.animation},enumerable:!1,configurable:!0}),t.prototype.getSnapshot=function(e){var t,r,i=Object(n.__assign)(Object(n.__assign)({},this.snapshotParams.value),e);return{id:l.c.create22(),data:i.data?this.data.getSnapshot():void 0,behaviour:i.behavior?this.behaviors.getSnapshot():void 0,animation:i.animation?this.animation.getSnapshot():void 0,startAnimation:i.startAnimation?!!i.startAnimation:void 0,camera:i.camera?{current:this.plugin.canvas3d.camera.getSnapshot(),transitionStyle:i.cameraTransition.name,transitionDurationInMs:"animate"===(null===(t=null==i?void 0:i.cameraTransition)||void 0===t?void 0:t.name)?i.cameraTransition.params.durationInMs:void 0}:void 0,canvas3d:i.canvas3d?{props:null===(r=this.plugin.canvas3d)||void 0===r?void 0:r.props}:void 0,interactivity:i.interactivity?{props:this.plugin.managers.interactivity.props}:void 0,structureFocus:this.plugin.managers.structure.focus.getSnapshot(),durationInMs:null==i?void 0:i.durationInMs}},t.prototype.setSnapshot=function(e){var t;return Object(n.__awaiter)(this,void 0,void 0,(function(){var r;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.animation.stop()];case 1:return n.sent(),e.behaviour?[4,this.plugin.runTask(this.behaviors.setSnapshot(e.behaviour))]:[3,3];case 2:n.sent(),n.label=3;case 3:return e.data?[4,this.plugin.runTask(this.data.setSnapshot(e.data))]:[3,5];case 4:n.sent(),n.label=5;case 5:return(null===(t=e.canvas3d)||void 0===t?void 0:t.props)?(r=c.ParamDefinition.normalizeParams(s.Canvas3DParams,e.canvas3d.props,"children"),[4,u.PluginCommands.Canvas3D.SetSettings(this.plugin,{settings:r})]):[3,7];case 6:n.sent(),n.label=7;case 7:return e.interactivity&&e.interactivity.props&&this.plugin.managers.interactivity.setProps(e.interactivity.props),e.structureFocus&&this.plugin.managers.structure.focus.setSnapshot(e.structureFocus),e.animation&&this.animation.setSnapshot(e.animation),e.camera&&u.PluginCommands.Camera.Reset(this.plugin,{snapshot:e.camera.current,durationMs:"animate"===e.camera.transitionStyle?e.camera.transitionDurationInMs:void 0}),e.startAnimation&&this.animation.start(),[2]}}))}))},t.prototype.updateTransform=function(e,t,r,n){var i=e.build().to(t).update(r);return u.PluginCommands.State.Update(this.plugin,{state:e,tree:i,options:{canUndo:n}})},t.prototype.updateBehavior=function(e,t){var r=this.behaviors.build();if(this.behaviors.tree.transforms.has(e.id))r.to(e.id).update(t);else{var n=e.createDefaultParams(void 0,this.plugin);r.to(o.PluginBehavior.getCategoryId(e)).apply(e,Object(d.b)(n,t),{ref:e.id})}return this.plugin.runTask(this.behaviors.updateTree(r))},t.prototype.dispose=function(){this.behaviors.cells.forEach((function(e){o.PluginBehavior.Behavior.is(e.obj)&&e.obj.data.unregister()})),e.prototype.dispose.call(this),this.data.dispose(),this.behaviors.dispose(),this.animation.dispose()},t}(p.a);!function(e){e.SnapshotParams={durationInMs:c.ParamDefinition.Numeric(1500,{min:100,max:15e3,step:100},{label:"Duration in ms"}),data:c.ParamDefinition.Boolean(!0),behavior:c.ParamDefinition.Boolean(!1),animation:c.ParamDefinition.Boolean(!0),startAnimation:c.ParamDefinition.Boolean(!1),canvas3d:c.ParamDefinition.Boolean(!0),interactivity:c.ParamDefinition.Boolean(!0),camera:c.ParamDefinition.Boolean(!0),cameraTransition:c.ParamDefinition.MappedStatic("animate",{animate:c.ParamDefinition.Group({durationInMs:c.ParamDefinition.Numeric(250,{min:100,max:5e3,step:500},{label:"Duration in ms"})}),instant:c.ParamDefinition.Group({})},{options:[["animate","Animate"],["instant","Instant"]]})},e.DefaultSnapshotParams=c.ParamDefinition.getDefaultValues(e.SnapshotParams)}(h||(h={}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));var n=function(e){return function(t){for(var r=0,n=e.length;r<n&&!t.closed;r++)t.next(e[r]);t.complete()}}},function(e,t,r){"use strict";function n(e){return!!e&&"function"!=typeof e.subscribe&&"function"==typeof e.then}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.r(t),r.d(t,"StateTree",(function(){return g}));var n=r(0),i=r(3),a=r(168),o=r(400),s=r(27),u=r(13),c=r(311),l=r(33),d=r(56),f=r(18),p=r(15),m=r(318),h=r(189),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showActions:!0},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.created,(function(t){t.cell.transform.parent===u.StateTransform.RootRef&&e.forceUpdate()})),this.subscribe(this.plugin.state.events.cell.removed,(function(t){t.parent===u.StateTransform.RootRef&&e.forceUpdate()}))},t.getDerivedStateFromProps=function(e,t){var r=e.state.tree.root.ref,n=0===e.state.tree.children.get(r).size;return t.showActions===n?null:{showActions:n}},t.prototype.render=function(){var e=this.props.state.tree.root.ref;return this.state.showActions?i.createElement("div",{style:{margin:"10px",cursor:"default"}},i.createElement("p",null,"Nothing to see here yet."),i.createElement("p",null,"Structures and Volumes can be loaded from the ",i.createElement(p.Icon,{svg:p.HomeOutlinedSvg})," tab.")):i.createElement(v,{cell:this.props.state.cells.get(e),depth:0})},t}(l.PluginUIComponent),v=function(e){function t(){var r=null!==e&&e.apply(this,arguments)||this;return r.state={isCollapsed:!!r.props.cell.state.isCollapsed,isNull:t.isNull(r.props.cell),showLabel:t.showLabel(r.props.cell)},r}return Object(n.__extends)(t,e),t.prototype.is=function(e){return e.ref===this.ref&&e.state===this.props.cell.parent},Object.defineProperty(t.prototype,"ref",{get:function(){return this.props.cell.transform.ref},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(r){e.props.cell===r.cell&&e.is(r)&&r.state.cells.has(e.ref)&&(e.state.isCollapsed===!!r.cell.state.isCollapsed&&e.state.isNull===t.isNull(r.cell)&&e.state.showLabel===t.showLabel(r.cell)||e.forceUpdate())})),this.subscribe(this.plugin.state.events.cell.created,(function(t){e.props.cell.parent===t.state&&e.ref===t.cell.transform.parent&&e.forceUpdate()})),this.subscribe(this.plugin.state.events.cell.removed,(function(t){e.props.cell.parent===t.state&&e.ref===t.parent&&e.forceUpdate()}))},t.getDerivedStateFromProps=function(e,r){var n=t.isNull(e.cell),i=t.showLabel(e.cell);return!!e.cell.state.isCollapsed===r.isCollapsed&&r.isNull===n&&r.showLabel===i?null:{isCollapsed:!!e.cell.state.isCollapsed,isNull:n,showLabel:i}},t.hasDecorator=function(e){var t,r=e.parent.tree.children.get(e.transform.ref);return 1===r.size&&!!(null===(t=e.parent)||void 0===t?void 0:t.tree.transforms.get(r.first()).transformer.definition.isDecorator)},t.isNull=function(e){return!e||!e.parent||e.obj===u.StateObject.Null||!e.parent.tree.transforms.has(e.transform.ref)},t.showLabel=function(e){return e.transform.ref!==u.StateTransform.RootRef&&("ok"!==e.status||!e.state.isGhost&&!t.hasDecorator(e))},t.prototype.render=function(){var e=this;if(this.state.isNull)return null;var r=this.props.cell,n=r.parent.tree.children.get(this.ref);if(!this.state.showLabel)return 0===n.size?null:i.createElement(i.Fragment,null,n.map((function(n){return i.createElement(t,{cell:r.parent.cells.get(n),key:n,depth:e.props.depth})})));var a=this.props.depth+1;return i.createElement(i.Fragment,null,i.createElement(b,{cell:r,depth:this.props.depth}),0===n.size?void 0:i.createElement("div",{style:{display:this.state.isCollapsed?"none":"block"}},n.map((function(e){return i.createElement(t,{cell:r.parent.cells.get(e),key:e,depth:a})}))))},t}(l.PluginUIComponent),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isCurrent:t.props.cell.parent.current===t.ref,isCollapsed:!!t.props.cell.state.isCollapsed,action:void 0,currentAction:void 0},t.setCurrent=function(e){null==e||e.preventDefault(),null==e||e.currentTarget.blur(),s.PluginCommands.State.SetCurrentObject(t.plugin,{state:t.props.cell.parent,ref:t.ref})},t.setCurrentRoot=function(e){null==e||e.preventDefault(),null==e||e.currentTarget.blur(),s.PluginCommands.State.SetCurrentObject(t.plugin,{state:t.props.cell.parent,ref:u.StateTransform.RootRef})},t.remove=function(e){null==e||e.preventDefault(),s.PluginCommands.State.RemoveObject(t.plugin,{state:t.props.cell.parent,ref:t.ref,removeParentGhosts:!0})},t.toggleVisible=function(e){e.preventDefault(),s.PluginCommands.State.ToggleVisibility(t.plugin,{state:t.props.cell.parent,ref:t.ref}),e.currentTarget.blur()},t.toggleExpanded=function(e){e.preventDefault(),s.PluginCommands.State.ToggleExpanded(t.plugin,{state:t.props.cell.parent,ref:t.ref}),e.currentTarget.blur()},t.highlight=function(e){e.preventDefault(),s.PluginCommands.Interactivity.Object.Highlight(t.plugin,{state:t.props.cell.parent,ref:t.ref}),e.currentTarget.blur()},t.clearHighlight=function(e){e.preventDefault(),s.PluginCommands.Interactivity.ClearHighlights(t.plugin),e.currentTarget.blur()},t.hideApply=function(){t.setCurrentRoot()},t.selectAction=function(e){e&&(null==e?void 0:e.value)()},t}return Object(n.__extends)(t,e),t.prototype.is=function(e){return e.ref===this.ref&&e.state===this.props.cell.parent},Object.defineProperty(t.prototype,"ref",{get:function(){return this.props.cell.transform.ref},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe(Object(a.a)((function(t){return e.is(t)})),Object(o.a)(33)),(function(t){e.forceUpdate()})),this.subscribe(this.props.cell.parent.behaviors.currentObject,(function(t){e.is(t)?t.state.transforms.has(e.ref)&&e._setCurrent(e.props.cell.parent.current===e.ref,!!e.props.cell.state.isCollapsed):e.state.isCurrent&&t.state.transforms.has(e.ref)&&e._setCurrent(e.props.cell.parent.current===e.ref,e.state.isCollapsed)}))},t.prototype._setCurrent=function(e,t){e?this.setState({isCurrent:e,action:"options",currentAction:void 0,isCollapsed:t}):this.setState({isCurrent:e,action:void 0,currentAction:void 0,isCollapsed:t})},t.getDerivedStateFromProps=function(e,t){var r=e.cell.parent.current===e.cell.transform.ref,n=!!e.cell.state.isCollapsed;return t.isCollapsed===n&&t.isCurrent===r?null:{isCurrent:r,isCollapsed:n,action:void 0,currentAction:void 0}},Object.defineProperty(t.prototype,"actions",{get:function(){var e=this,t=this.props.cell,r=Object(n.__spreadArrays)(t.parent.actions.fromCell(t,this.plugin));if(0!==r.length)return r.sort((function(e,t){return e.definition.display.name<t.definition.display.name?-1:e.definition.display.name===t.definition.display.name?0:1})),Object(n.__spreadArrays)([d.a.Header("Apply Action")],r.map((function(t){return d.a.Item(t.definition.display.name,(function(){return e.setState({action:"apply",currentAction:t})}))})))},enumerable:!1,configurable:!0}),t.prototype.updates=function(e){for(var t=this.props.cell,r=c.a.getDecoratorChain(t.parent,t.transform.ref),n=[],a=r.length-1;a>=0;a--){var o=r[a];n.push(i.createElement(h.UpdateTransformControl,{key:o.transform.transformer.id+"-"+a,state:t.parent,transform:o.transform,noMargin:!0,wrapInExpander:!0,expanderHeaderLeftMargin:e}))}return i.createElement("div",{className:"msp-tree-updates-wrapper"},n)},t.prototype.render=function(){var e=this.props.cell,t=e.transform;if(!e)return null;var r,n=this.is(e.parent.behaviors.currentObject.value),a="error"!==e.status&&"ok"!==e.status;if("error"!==e.status&&e.obj){var o=e.obj,s=o.label+" "+(o.description?o.description:"");r=i.createElement(f.Button,{className:"msp-btn-tree-label msp-type-class-"+o.type.typeClass,noOverflow:!0,disabled:a,title:s,onClick:this.state.isCurrent?this.setCurrentRoot:this.setCurrent},i.createElement("span",null,o.label)," ",o.description?i.createElement("small",null,o.description):void 0)}else{var u="error"===e.status?e.errorText:t.transformer.definition.display.name;r=i.createElement(f.Button,{className:"msp-btn-tree-label msp-no-hover-outline",noOverflow:!0,title:u,onClick:this.state.isCurrent?this.setCurrentRoot:this.setCurrent,disabled:a},"error"===e.status&&i.createElement("b",null,"[",e.status,"]")," ",i.createElement("span",null,u))}var c=e.parent.tree.children.get(this.ref),l=e.state,h=i.createElement(f.IconButton,{svg:l.isCollapsed?p.ArrowRightSvg:p.ArrowDropDownSvg,flex:"20px",disabled:a,onClick:this.toggleExpanded,transparent:!0,className:"msp-no-hover-outline",style:{visibility:c.size>0?"visible":"hidden"}}),g=e.state.isLocked?void 0:i.createElement(f.IconButton,{svg:p.DeleteOutlinedSvg,onClick:this.remove,disabled:a,small:!0,toggleState:!1}),v=i.createElement(f.IconButton,{svg:l.isHidden?p.VisibilityOffOutlinedSvg:p.VisibilityOutlinedSvg,toggleState:!1,disabled:a,small:!0,onClick:this.toggleVisible}),b={marginLeft:8*this.props.depth+"px"},y=i.createElement("div",{className:"msp-flex-row msp-tree-row"+(n?" msp-tree-row-current":""),onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight,style:b},h,r,g,v);if(!n)return y;if("apply"===this.state.action&&this.state.currentAction)return i.createElement("div",{style:{marginBottom:"1px"}},y,i.createElement(f.ControlGroup,{header:"Apply "+this.state.currentAction.definition.display.name,initialExpanded:!0,hideExpander:!0,hideOffset:!1,onHeaderClick:this.hideApply,topRightIcon:p.CloseSvg,headerLeftMargin:8*this.props.depth+21+"px"},i.createElement(m.a,{onApply:this.hideApply,state:this.props.cell.parent,action:this.state.currentAction,nodeRef:this.props.cell.transform.ref,hideHeader:!0,noMargin:!0})));if("options"===this.state.action){var _=this.actions,S=this.updates(8*this.props.depth+21+"px");return i.createElement("div",{style:{marginBottom:"1px"}},y,S,_&&i.createElement("div",{style:{marginLeft:8*this.props.depth+21+"px",marginTop:"-1px"}},i.createElement(d.a,{items:_,onSelect:this.selectAction})))}return y},t}(l.PluginUIComponent)},function(e,t,r){"use strict";r.r(t),r.d(t,"BackgroundTaskProgress",(function(){return l})),r.d(t,"OverlayTaskProgress",(function(){return f}));var n=r(0),i=r(3),a=r(33),o=r(102),s=r(168),u=r(18),c=r(15),l=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={tracked:Object(o.OrderedMap)()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e,t=this,r=!!(null===(e=this.plugin.spec.components)||void 0===e?void 0:e.hideTaskOverlay);this.subscribe(this.plugin.events.task.progress.pipe(Object(s.a)((function(e){return"background"===e.level&&(r||!e.useOverlay)}))),(function(e){t.setState({tracked:t.state.tracked.set(e.id,e)})})),this.subscribe(this.plugin.events.task.finished,(function(e){var r=e.id;t.setState({tracked:t.state.tracked.delete(r)})}))},t.prototype.render=function(){return i.createElement("div",{className:"msp-background-tasks"},this.state.tracked.valueSeq().map((function(e){return i.createElement(d,{key:e.id,event:e})})))},t}(a.PluginUIComponent),d=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.abort=function(){t.plugin.managers.task.requestAbort(t.props.event.progress.root.progress.taskId,"User Request")},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this.props.event.progress.root,t=function e(t){if(0===t.children.length)return 1;for(var r=0,n=0,i=t.children;n<i.length;n++){var a=i[n];r+=e(a)}return r}(this.props.event.progress.root)-1,r=e.progress.isIndeterminate?void 0:i.createElement(i.Fragment,null,"[",e.progress.current,"/",e.progress.max,"]"),n=t>0?i.createElement(i.Fragment,null,"[",t," subtask(s)]"):void 0;return i.createElement("div",{className:"msp-task-state"},i.createElement("div",null,e.progress.canAbort&&i.createElement(u.IconButton,{svg:c.CancelSvg,onClick:this.abort,title:"Abort"}),i.createElement("div",null,e.progress.message," ",r," ",n)))},t}(a.PluginUIComponent);var f=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={tracked:Object(o.OrderedMap)()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.task.progress.pipe(Object(s.a)((function(e){return!!e.useOverlay}))),(function(t){e.setState({tracked:e.state.tracked.set(t.id,t)})})),this.subscribe(this.plugin.events.task.finished,(function(t){var r=t.id;e.setState({tracked:e.state.tracked.delete(r)})}))},t.prototype.render=function(){return 0===this.state.tracked.size?null:i.createElement("div",{className:"msp-overlay-tasks"},this.state.tracked.valueSeq().map((function(e){return i.createElement(d,{key:e.id,event:e})})))},t}(a.PluginUIComponent)},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureQualityReportColorThemeParams",(function(){return l})),r.d(t,"StructureQualityReportColorTheme",(function(){return d})),r.d(t,"StructureQualityReportColorThemeProvider",(function(){return f}));var n=r(221),i=r(4),a=r(24),o=r(149),s=r(2),u=[a.Color.fromRgb(170,170,170),a.Color.fromRgb(0,255,0),a.Color.fromRgb(255,255,0),a.Color.fromRgb(255,128,0),a.Color.fromRgb(255,0,0)],c=[["No Issues",u[1]],["One Issue",u[2]],["Two Issues",u[3]],["Three Or More Issues",u[4]],["Not Applicable",u[9]]],l={type:s.ParamDefinition.MappedStatic("issue-count",{"issue-count":s.ParamDefinition.Group({}),"specific-issue":s.ParamDefinition.Group({kind:s.ParamDefinition.Text()})})};function d(e,t){var r;if(e.structure&&!e.structure.isEmpty&&e.structure.models[0].customProperties.has(n.b.descriptor)){var a=n.a.getIssues,s=i.StructureElement.Location.create(e.structure);if("issue-count"===t.type.name)r=function(e){return i.StructureElement.Location.is(e)?u[Math.min(3,a(e).length)+1]:i.Bond.isLocation(e)?(s.unit=e.aUnit,s.element=e.aUnit.elements[e.aIndex],u[Math.min(3,a(s).length)+1]):u[0]};else{var l=t.type.params.kind;r=function(e){return i.StructureElement.Location.is(e)&&a(e).indexOf(l)>=0?u[4]:i.Bond.isLocation(e)?(s.unit=e.aUnit,s.element=e.aUnit.elements[e.aIndex],u[Math.min(3,a(s).length)+1]):u[0]}}}else r=function(){return u[0]};return{factory:d,granularity:"group",color:r,props:t,description:"Assigns residue colors according to the number of quality issues or a specific quality issue. Data from wwPDB Validation Report, obtained via PDBe.",legend:Object(o.b)(c)}}var f={name:"pdbe-structure-quality-report",label:"Structure Quality Report",category:"Validation",factory:d,getParams:function(e){var t=n.a.getIssueTypes(e.structure);return 0===t.length?{type:s.ParamDefinition.MappedStatic("issue-count",{"issue-count":s.ParamDefinition.Group({})})}:{type:s.ParamDefinition.MappedStatic("issue-count",{"issue-count":s.ParamDefinition.Group({}),"specific-issue":s.ParamDefinition.Group({kind:s.ParamDefinition.Select(t[0],s.ParamDefinition.arrayToOptions(t))},{isFlat:!0})})}},defaultValues:s.ParamDefinition.getDefaultValues(l),isApplicable:function(e){var t;return n.a.isApplicable(null===(t=e.structure)||void 0===t?void 0:t.models[0])},ensureCustomProperties:{attach:function(e,t){return t.structure?n.b.attach(e,t.structure.models[0],void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&e.structure.models[0].customProperties.reference(n.b.descriptor,!1)}}}},function(e,t,r){"use strict";function n(e,t){function r(){return!r.pred.apply(r.thisArg,arguments)}return r.pred=e,r.thisArg=t,r}r.d(t,"a",(function(){return n}))},function(e,t,r){"use strict";r.d(t,"a",(function(){return Ve}));var n=r(0),i=r(41),a=r(2),o=r(36),s=r(38),u=r(217),c=r(65),l=r(125),d=r(94),f=r(188),p=r(121),m=r(23),h=r(6),g=r(160),v=r(202),b=r(5),y=r(132),_=r(115),S=r(30),x=r(62),O=r(17);function w(e,t){var r,i,a,s,u,S,x,O,w=e.defaultProps,C=e.createGeometry,j=e.createLocationIterator,P=e.getLoci,E=e.eachLocation,A=e.setUpdateState,D=e.mustRecreate,T=e.dispose,I=e.geometryUtils,M=I.updateValues,k=I.updateBoundingSphere,B=I.updateRenderableState,V=I.createPositionIterator,R=g.a.create(),L=Object.assign({},w),N=d.a.createEmpty();function F(e){if(R.createNew){if(x=j(s),!e)throw new Error("expected geometry to be given");r=function(e,t,r,n,i,a){var o=l.a.getUtils(t),s=o.createValues,u=o.createRenderableState,c=s(t,Object(f.a)(),r,n,i),d=u(i);return Object(p.a)(t.kind,c,d,a)}(0,e,x,a,i,t),O=V(e,r.values)}else{if(!r)throw new Error("expected renderObject to be available");if(x.reset(),R.createGeometry){if(!e)throw new Error("expected geometry to be given");b.e.updateIfChanged(r.values.drawCount,l.a.getDrawCount(e)),b.e.updateIfChanged(r.values.uVertexCount,l.a.getVertexCount(e))}(R.updateTransform||R.createGeometry)&&(k(r.values,e||S),O=V(e||S,r.values)),R.updateSize&&"uSize"in r.values&&Object(y.a)(x,a.size,r.values),R.updateColor&&Object(_.a)(x,O,a.color,r.values),M(r.values,i),B(r.state,i)}L=i,N=a,u=s,e&&(S=e)}function U(e,t){return Object(m.isEveryLoci)(e)?t(h.Interval.ofBounds(0,x.groupCount*x.instanceCount)):E(e,u,L,t)}return{get groupCount(){return x?x.count:0},get renderObject(){return r},createOrUpdate:function(e,t,c,l){return void 0===c&&(c={}),Object(n.__awaiter)(this,void 0,void 0,(function(){var d;return Object(n.__generator)(this,(function(n){return function(e,t,n){if(!n&&!u)throw new Error("missing volume");i=Object.assign({},L,t),a=e,s=n,g.a.reset(R),r&&u&&o.b.areEquivalent(s,u)||(R.createNew=!0),R.createNew?R.createGeometry=!0:(A(R,n,i,L,a,N),v.a.areEqual(e.color,N.color)||(R.updateColor=!0),R.createGeometry&&(R.updateColor=!0))}(t,c,l||u),R.createGeometry?[2,(d=C(e,s,a,i,S))instanceof Promise?d.then(F):F(d)]:(F(),[2])}))}))},getLoci:function(e){return r?P(e,u,L,r.id):m.EmptyLoci},mark:function(e,t){return c.a.mark(r,e,t,U)},setVisibility:function(e){c.a.setVisibility(r,e)},setAlphaFactor:function(e){c.a.setAlphaFactor(r,e)},setPickable:function(e){c.a.setPickable(r,e)},setColorOnly:function(e){c.a.setColorOnly(r,e)},setTransform:function(e,t){c.a.setTransform(r,e,t)},setOverpaint:function(e){return c.a.setOverpaint(r,e,U,!0)},setTransparency:function(e){return c.a.setTransparency(r,e,U,!0)},setClipping:function(e){return c.a.setClipping(r,e,U,!0)},destroy:function(){null==T||T(S),r&&(r.state.disposed=!0,r=void 0)},mustRecreate:D}}Object(n.__assign)({},S.a.Params);function C(e,t,r,o,s){var u,c,l,f,h=0,v=t.webgl,b=new x.a,y=Object(p.c)(),_=[],S=i.a.createState(),w=d.a.createEmpty();return{label:e,get groupCount(){return u?u.groupCount:0},get props(){return f},get params(){return l},get state(){return S},get theme(){return w},renderObjects:_,updated:b,createOrUpdate:function(e,i){var s=this;void 0===e&&(e={}),i&&i!==c&&(l=r(t,i),c=i,f||(f=a.ParamDefinition.getDefaultValues(l)));var d=Object(g.b)(Object.assign({},f,e),c);return Object.assign(f,e,d),O.b.create("Creating or updating VolumeRepresentation",(function(e){return Object(n.__awaiter)(s,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return u?(null===(r=u.mustRecreate)||void 0===r?void 0:r.call(u,c,f,v))&&(u.destroy(),u=o(y,c,f,v)):u=o(y,c,f,v),(t=u.createOrUpdate({webgl:v,runtime:e},w,f,i))?[4,t]:[3,2];case 1:n.sent(),n.label=2;case 2:return _.length=0,u&&u.renderObject&&_.push(u.renderObject),b.next(h++),[2]}}))}))}))},setState:function(e){void 0!==e.visible&&u&&u.setVisibility(e.visible),void 0!==e.alphaFactor&&u&&u.setAlphaFactor(e.alphaFactor),void 0!==e.pickable&&u&&u.setPickable(e.pickable),void 0!==e.overpaint&&u&&u.setOverpaint(e.overpaint),void 0!==e.transparency&&u&&u.setTransparency(e.transparency),void 0!==e.transform&&u&&u.setTransform(e.transform),i.a.updateState(S,e)},setTheme:function(e){w=e},getLoci:function(e){return void 0===e?s(c,f):u?u.getLoci(e):m.EmptyLoci},mark:function(e,t){return!!u&&u.mark(e,t)},destroy:function(){u&&u.destroy()}}}var j=r(53),P=r(117),E=r(80),A=r(1),D=r(29),T=r(69),I=r(97),M=r(180),k=I.a.set,B=I.a.normalize,V=I.a.sub,R=I.a.addScalar,L=I.a.scale,N=I.a.toArray;function F(e,t,r,n){var i=!1;if(o.b.isLoci(e)){if(!o.b.areEquivalent(e.volume,t))return!1;n(h.Interval.ofLength(t.grid.cells.data.length))&&(i=!0)}else if(o.b.Isosurface.isLoci(e)){if(!o.b.areEquivalent(e.volume,t))return!1;if(r){if(!o.b.IsoValue.areSame(e.isoValue,r,t.grid.stats))return!1;n(h.Interval.ofLength(t.grid.cells.data.length))&&(i=!0)}else for(var a=t.grid,s=a.stats,u=a.cells.data,c=s.sigma,l=o.b.IsoValue.toAbsolute(e.isoValue,s).absoluteValue,d=0,f=u.length;d<f;++d)Object(T.b)(l,u[d],c)&&n(h.Interval.ofSingleton(d))&&(i=!0)}else if(o.b.Cell.isLoci(e)){if(!o.b.areEquivalent(e.volume,t))return!1;h.Interval.is(e.indices)?n(e.indices)&&(i=!0):h.OrderedSet.forEach(e.indices,(function(e){n(h.Interval.ofSingleton(e))&&(i=!0)}))}return i}function U(e,t){void 0===t&&(t=0);var r=e[0]*e[1]*e[2],n=Math.sqrt(r),i=Math.pow(2,Math.ceil(Math.log(n)/Math.log(2))),a=e[0]+t,o=e[1]+t,s=1,u=a;return i<a*e[2]?(a*=u=Math.floor(i/a),o*=s=Math.ceil(e[2]/u)):a*=e[2],{width:a,height:o,columns:u,rows:s,powerOfTwoSize:o<i?i:2*i}}function z(e,t,r){void 0===r&&(r=0);for(var n=e.grid,i=n.cells,a=i.space,o=i.data,s=n.stats,u=s.max,c=s.min,l=a.dimensions,d=a.dataOffset,f=U(l,r),p=f.width,m=f.height,h="data"===t?1:4,g=new Uint8Array(p*m*h),v={array:g,width:p,height:m},b=u-c,y=l[0],_=l[1],S=l[2],x=y+r,O=_+r,w=Object(I.a)(),C=Object(I.a)(),j=y-1,P=_-1,E=S-1,A=0;A<S;++A)for(var D=0;D<_;++D)for(var T=0;T<y;++T){var F=Math.floor(A*x%p/x),z=h*(Math.floor(A*x/p)*O*p+D*p+(F*x+T)),H=d(T,D,A);"data"===t?g[z]=Math.round((o[H]-c)/b*255):("groups"===t?Object(M.b)(H,g,z):(k(w,o[d(Math.max(0,T-1),D,A)],o[d(T,Math.max(0,D-1),A)],o[d(T,D,Math.max(0,A-1))]),k(C,o[d(Math.min(j,T+1),D,A)],o[d(T,Math.min(P,D+1),A)],o[d(T,D,Math.min(E,A+1))]),B(w,V(w,w,C)),R(w,L(w,w,.5),.5),N(L(w,w,255),g,z)),g[z+3]=Math.round((o[H]-c)/b*255))}return v}var H=r(191),G=r(341),q=r(66),W={isoValue:o.b.IsoValueParam};function X(e,t){return U(e.grid.cells.space.dimensions,1).powerOfTwoSize<=t.maxTextureSize/2}function Y(e,t,r,n){return r.tryUseGpu&&n&&function(e){return e.extensions.colorBufferFloat&&e.extensions.textureFloat&&e.extensions.drawBuffers}(n)&&X(t,n)?function(e){return w({defaultProps:a.ParamDefinition.getDefaultValues(re),createGeometry:ne,createLocationIterator:function(e){return Object(j.a)(e.grid.cells.data.length,1,1,(function(){return P.b}))},getLoci:K,eachLocation:Z,setUpdateState:function(e,t,r,n){o.b.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||(e.createGeometry=!0)},geometryUtils:H.a.Utils,mustRecreate:function(e,t,r){return!t.tryUseGpu||!r||!X(e,r)},dispose:function(e){e.vertexTexture.ref.value.destroy(),e.groupTexture.ref.value.destroy(),e.normalTexture.ref.value.destroy()}},e)}(e):function(e){return w({defaultProps:a.ParamDefinition.getDefaultValues(re),createGeometry:J,createLocationIterator:function(e){return Object(j.a)(e.grid.cells.data.length,1,1,(function(){return P.b}))},getLoci:K,eachLocation:Z,setUpdateState:function(e,t,r,n){o.b.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||(e.createGeometry=!0)},geometryUtils:s.a.Utils,mustRecreate:function(e,t,r){return t.tryUseGpu&&!!r&&X(e,r)}},e)}(e)}function Q(e,t){return o.b.Isosurface.Loci(e,t.isoValue)}function K(e,t,r,n){var i=e.objectId,a=e.groupId;return n===i?o.b.Cell.Loci(t,h.Interval.ofSingleton(a)):m.EmptyLoci}function Z(e,t,r,n){return F(e,t,r.isoValue,n)}function J(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,c,l;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return e.runtime.update({message:"Marching cubes..."}),r=Object(D.fillSerial)(new Int32Array(t.grid.cells.data.length)),[4,Object(u.b)({isoLevel:o.b.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:A.Tensor.create(t.grid.cells.space,A.Tensor.Data1(r))},a).runAsChild(e.runtime)];case 1:return c=n.sent(),l=o.a.getGridToCartesianTransform(t.grid),s.a.transform(c,l),e.webgl&&!e.webgl.isWebGL2&&s.a.uniformTriangleGroup(c,!1),c.setBoundingSphere(o.b.getBoundingSphere(t)),[2,c]}}))}))}var $,ee,te,re=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},s.a.Params),H.a.Params),W),{quality:Object(n.__assign)(Object(n.__assign)({},s.a.Params.quality),{isEssential:!1}),tryUseGpu:a.ParamDefinition.Boolean(!0)});function ne(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,s,u,c,l,d,f,p,m,h,g,v,b;return Object(n.__generator)(this,(function(n){if(!e.webgl)throw new Error("webgl context required to create volume isosurface texture-mesh");return r=t.grid.stats,s=r.max,u=r.min,c=s-u,l=o.b.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,d=(l-u)/c,f=$.get(t,e.webgl),p=f.texture,m=f.gridDimension,h=f.gridTexDim,g=f.gridTexScale,v=f.transform,b=Object(G.a)(e.webgl,p,m,h,g,v,d,!1,null==a?void 0:a.vertexTexture.ref.value,null==a?void 0:a.groupTexture.ref.value,null==a?void 0:a.normalTexture.ref.value),[2,H.a.create(b.vertexCount,1,b.vertexTexture,b.groupTexture,b.normalTexture,o.b.getBoundingSphere(t),a)]}))}))}function ie(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,s,c;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return e.runtime.update({message:"Marching cubes..."}),r=Object(D.fillSerial)(new Int32Array(t.grid.cells.data.length)),[4,Object(u.a)({isoLevel:o.b.IsoValue.toAbsolute(i.isoValue,t.grid.stats).absoluteValue,scalarField:t.grid.cells,idField:A.Tensor.create(t.grid.cells.space,A.Tensor.Data1(r))},a).runAsChild(e.runtime)];case 1:return s=n.sent(),c=o.a.getGridToCartesianTransform(t.grid),E.a.transform(s,c),s.setBoundingSphere(o.b.getBoundingSphere(t)),[2,s]}}))}))}ee=$||($={}),te="volume-isosurface-texture",ee.descriptor=Object(q.CustomPropertyDescriptor)({name:te}),ee.get=function(e,t){var r=t.resources,n=o.a.getGridToCartesianTransform(e.grid),i=A.Vec3.clone(e.grid.cells.space.dimensions),a=U(i,1),s=a.width,u=a.height,c=a.powerOfTwoSize,l=A.Vec3.create(s,u,0),d=A.Vec2.create(s/c,u/c);if(c>t.maxTextureSize/2)throw new Error("volume too large for gpu isosurface extraction");if(!e._propertyData[te]){e._propertyData[te]=r.texture("image-uint8","alpha","ubyte","linear");var f=e._propertyData[te];f.define(c,c),f.load(z(e,"data",1),!0),e.customProperties.add(ee.descriptor),e.customProperties.assets(ee.descriptor,[{dispose:function(){return f.destroy()}}])}return i[0]+=1,i[1]+=1,{texture:e._propertyData[te],transform:n,gridDimension:i,gridTexDim:l,gridTexScale:d}};var ae=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},E.a.Params),W),{quality:Object(n.__assign)(Object(n.__assign)({},E.a.Params.quality),{isEssential:!1}),sizeFactor:a.ParamDefinition.Numeric(3,{min:0,max:10,step:.1})});function oe(e){return w({defaultProps:a.ParamDefinition.getDefaultValues(ae),createGeometry:ie,createLocationIterator:function(e){return Object(j.a)(e.grid.cells.data.length,1,1,(function(){return P.b}))},getLoci:K,eachLocation:Z,setUpdateState:function(e,t,r,n){o.b.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||(e.createGeometry=!0)},geometryUtils:E.a.Utils},e)}var se={solid:function(e,t){return C("Isosurface mesh",e,t,Y,Q)},wireframe:function(e,t){return C("Isosurface wireframe",e,t,oe,Q)}},ue=Object(n.__assign)(Object(n.__assign)(Object(n.__assign)({},re),ae),{visuals:a.ParamDefinition.MultiSelect(["solid"],a.ParamDefinition.objectToOptions(se))});var ce={name:"isosurface",label:"Isosurface",description:"Displays a triangulated isosurface of volumetric data.",factory:function(e,t){return i.a.createMulti("Isosurface",e,t,i.a.StateBuilder,se)},getParams:function(e,t){var r=a.ParamDefinition.clone(ue);return r.isoValue=o.b.createIsoValueParam(o.b.IsoValue.relative(2),t.grid.stats),r},defaultValues:a.ParamDefinition.getDefaultValues(ue),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return!o.b.isEmpty(e)}},le=r(87),de=r(226),fe=r(122),pe=r(24);function me(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var e,s,u,c,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C,j,E,A,D,T,I,k,B,V,R,L,N,F,U,z,H,G,q;return Object(n.__generator)(this,(function(n){for(e=i.dimension.name,s=i.isoValue,u=t.grid.cells,c=u.space,l=u.data,d=t.grid.stats,f=d.min,p=d.max,m=o.b.IsoValue.toAbsolute(s,t.grid.stats).absoluteValue,h=r.color.color(P.b,!1),g=pe.Color.toRgbNormalized(h),v=g[0],b=g[1],y=g[2],_=he(t.grid,i),S=_.width,x=_.height,O=_.x,w=_.y,C=_.z,j=_.x0,E=_.y0,A=_.z0,D=_.nx,T=_.ny,I=_.nz,k=new Float32Array("x"===e?[O,0,0,O,w,0,O,0,C,O,w,C]:"y"===e?[0,w,0,O,w,0,0,w,C,O,w,C]:[0,0,C,0,w,C,O,0,C,O,w,C]),B=new Uint8Array(S*x*4),V=function(e,t){for(var r=e.cells.space,n=he(e,t),i=n.width,a=n.height,o=n.x0,s=n.y0,u=n.z0,c=n.nx,l=n.ny,d=n.nz,f=new Uint8Array(i*a*4),p=0,m=s;m<l;++m)for(var h=o;h<c;++h)for(var g=u;g<d;++g)Object(M.b)(r.dataOffset(h,m,g),f,p),p+=4;return f}(t.grid,i),R=0,L=E;L<T;++L)for(N=j;N<D;++N)for(F=A;F<I;++F)U=c.get(l,N,L,F),z=(U-f)/(p-f),B[R]=v*z*2*255,B[R+1]=b*z*2*255,B[R+2]=y*z*2*255,B[R+3]=U>=m?255:0,R+=4;return H={width:S,height:x,array:B,flipY:!0},G={width:S,height:x,array:V,flipY:!0},q=o.a.getGridToCartesianTransform(t.grid),Object(fe.e)(q,k,0,4),[2,de.a.create(H,k,G,a)]}))}))}function he(e,t){var r,n,i,a,o,s=t.dimension,u=s.name,c=s.params,l=0,d=0,f=0,p=e.cells.space.dimensions,m=p[0],h=p[1],g=p[2];return"x"===u?(a=h-1,o=g-1,r=g,n=h,m=(l=i=c)+1):"y"===u?(i=m-1,o=g-1,r=g,n=m,h=(d=a=c)+1):(i=m-1,a=h-1,r=m,n=h,g=(f=o=c)+1),{width:r,height:n,x:i,y:a,z:o,x0:l,y0:d,z0:f,nx:m,ny:h,nz:g}}function ge(e,t){var r=function(e,t){for(var r=e.cells.space,n=he(e,t),i=n.width,a=n.height,o=n.x0,s=n.y0,u=n.z0,c=n.nx,l=n.ny,d=n.nz,f=new Uint32Array(i*a),p=0,m=s;m<l;++m)for(var h=o;h<c;++h)for(var g=u;g<d;++g)f[p]=r.dataOffset(h,m,g),p+=1;return f}(e.grid,t);return o.b.Cell.Loci(e,h.SortedArray.ofUnsortedArray(r))}function ve(e,t,r,n){var i=e.objectId,a=e.groupId;return n===i?o.b.Cell.Loci(t,h.Interval.ofSingleton(a)):m.EmptyLoci}function be(e,t,r,n){return F(e,t,void 0,n)}var ye=Object(n.__assign)(Object(n.__assign)({},de.a.Params),{quality:Object(n.__assign)(Object(n.__assign)({},de.a.Params.quality),{isEssential:!1}),dimension:a.ParamDefinition.MappedStatic("x",{x:a.ParamDefinition.Numeric(0,{min:0,max:0,step:1}),y:a.ParamDefinition.Numeric(0,{min:0,max:0,step:1}),z:a.ParamDefinition.Numeric(0,{min:0,max:0,step:1})},{isEssential:!0}),isoValue:o.b.IsoValueParam});function _e(e){return w({defaultProps:a.ParamDefinition.getDefaultValues(ye),createGeometry:me,createLocationIterator:function(e){return Object(j.a)(e.grid.cells.data.length,1,1,(function(){return P.b}))},getLoci:ve,eachLocation:be,setUpdateState:function(e,t,r,n,i,a){e.createGeometry=r.dimension.name!==n.dimension.name||r.dimension.params!==n.dimension.params||!o.b.IsoValue.areSame(r.isoValue,n.isoValue,t.grid.stats)||!v.a.areEqual(i.color,a.color)},geometryUtils:Object(n.__assign)(Object(n.__assign)({},de.a.Utils),{createRenderableState:function(e){var t=de.a.Utils.createRenderableState(e);return Se(t,e),t},updateRenderableState:Se})},e)}function Se(e,t){de.a.Utils.updateRenderableState(e,t),e.opaque=!1,e.writeDepth=!0}var xe={name:"slice",label:"Slice",description:"Slice of volume rendered as image with interpolation.",factory:function(e,t){return C("Slice",e,t,_e,ge)},getParams:function(e,t){var r=a.ParamDefinition.clone(ye),n=t.grid.cells.space.dimensions;return r.dimension=a.ParamDefinition.MappedStatic("x",{x:a.ParamDefinition.Numeric(0,{min:0,max:n[0]-1,step:1}),y:a.ParamDefinition.Numeric(0,{min:0,max:n[1]-1,step:1}),z:a.ParamDefinition.Numeric(0,{min:0,max:n[2]-1,step:1})},{isEssential:!0}),r.isoValue=o.b.createIsoValueParam(o.b.IsoValue.absolute(t.grid.stats.min),t.grid.stats),r},defaultValues:a.ParamDefinition.getDefaultValues(ye),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return!o.b.isEmpty(e)}},Oe=r(9),we=r(151);function Ce(e,t){var r=Object(Oe.b)();return Oe.b.add(r,e),Oe.b.transform(r,r,t),r}function je(e,t,r,n){var i=r.grid.cells.space.dimensions,a=U(i),s=a.width,u=a.height;if(Math.max(s,u)>t.maxTextureSize/2)throw new Error("volume too large for direct-volume rendering");var c=z(r,"normals"),l=o.a.getGridToCartesianTransform(r.grid),d=Ce(i,l),f=n?n.gridTexture.ref.value:t.resources.texture("image-uint8","rgba","ubyte","linear");f.load(c);var p=Pe(r.grid),m=p.unitToCartn,h=p.cellDim;return we.a.create(d,i,l,m,h,f,r.grid.stats,!1,n)}function Pe(e){if("matrix"===e.transform.kind)return{unitToCartn:A.Mat4.mul(Object(A.Mat4)(),e.transform.matrix,A.Mat4.fromScaling(Object(A.Mat4)(),e.cells.space.dimensions)),cellDim:A.Mat4.getScaling(Object(A.Vec3)(),e.transform.matrix)};var t=e.transform.fractionalBox,r=Oe.b.size(Object(A.Vec3)(),t);return{unitToCartn:A.Mat4.mul3(Object(A.Mat4)(),e.transform.cell.fromFractional,A.Mat4.fromTranslation(Object(A.Mat4)(),t.min),A.Mat4.fromScaling(Object(A.Mat4)(),r)),cellDim:A.Vec3.div(Object(A.Vec3)(),e.transform.cell.size,e.cells.space.dimensions)}}function Ee(e,t,r,n){var i=r.grid.cells.space.dimensions;if(Math.max.apply(Math,i)>t.max3dTextureSize/2)throw new Error("volume too large for direct-volume rendering");var a=function(e){for(var t=e.grid,r=t.cells,n=r.space,i=r.data,a=t.stats,o=a.max,s=a.min,u=n.dimensions,c=u[0],l=u[1],d=u[2],f=n.dataOffset,p=new Uint8Array(c*l*d*4),m={array:p,width:c,height:l,depth:d},h=o-s,g=Object(I.a)(),v=Object(I.a)(),b=c-1,y=l-1,_=d-1,S=0,x=0;x<d;++x)for(var O=0;O<l;++O)for(var w=0;w<c;++w){var C=f(w,O,x);k(g,i[f(Math.max(0,w-1),O,x)],i[f(w,Math.max(0,O-1),x)],i[f(w,O,Math.max(0,x-1))]),k(v,i[f(Math.min(b,w+1),O,x)],i[f(w,Math.min(y,O+1),x)],i[f(w,O,Math.min(_,x+1))]),B(g,V(g,g,v)),R(g,L(g,g,.5),.5),N(L(g,g,255),p,S),p[S+3]=Math.round((i[C]-s)/h*255),S+=4}return m}(r),s=o.a.getGridToCartesianTransform(r.grid),u=Ce(i,s),c=n?n.gridTexture.ref.value:t.resources.texture("volume-uint8","rgba","ubyte","linear");c.load(a);var l=Pe(r.grid),d=l.unitToCartn,f=l.cellDim;return we.a.create(u,i,s,d,f,c,r.grid.stats,!1,n)}function Ae(e,t,r,i,a){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r;return Object(n.__generator)(this,(function(n){if(e.runtime,void 0===(r=e.webgl))throw new Error("DirectVolumeVisual requires `webgl` in props");return[2,r.isWebGL2?Ee(0,r,t,a):je(0,r,t,a)]}))}))}function De(e,t){return"isosurface"===t.renderMode.name?o.b.Isosurface.Loci(e,t.renderMode.params.isoValue):o.b.Loci(e)}function Te(e,t,r,n){var i=e.objectId,a=e.groupId;return n===i?o.b.Cell.Loci(t,h.Interval.ofSingleton(a)):m.EmptyLoci}function Ie(e,t,r,n){return F(e,t,"isosurface"===r.renderMode.name?r.renderMode.params.isoValue:void 0,n)}var Me=Object(n.__assign)(Object(n.__assign)({},we.a.Params),{quality:Object(n.__assign)(Object(n.__assign)({},we.a.Params.quality),{isEssential:!1})});function ke(e){return w({defaultProps:a.ParamDefinition.getDefaultValues(Me),createGeometry:Ae,createLocationIterator:function(e){return Object(j.a)(e.grid.cells.data.length,1,1,(function(){return P.b}))},getLoci:Te,eachLocation:Ie,setUpdateState:function(e,t,r,n){},geometryUtils:we.a.Utils,dispose:function(e){e.gridTexture.ref.value.destroy()}},e)}var Be={name:"direct-volume",label:"Direct Volume",description:"Direct rendering of volumetric data.",factory:function(e,t){return C("Direct Volume",e,t,ke,De)},getParams:function(e,t){var r=a.ParamDefinition.clone(Me);return r.renderMode=we.a.createRenderModeParam(t.grid.stats),r},defaultValues:a.ParamDefinition.getDefaultValues(Me),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return!o.b.isEmpty(e)}},Ve=function(e){function t(){var r=e.call(this)||this;return Object(le.c)(t.BuiltIn,(function(e,t){if(e.name!==t)throw new Error("Fix BuiltInVolumeRepresentations to have matching names. "+e.name+" "+t);r.add(e)})),r}return Object(n.__extends)(t,e),t}(i.b);(Ve||(Ve={})).BuiltIn={isosurface:ce,slice:xe,"direct-volume":Be}},function(e,t,r){"use strict";r.d(t,"a",(function(){return w}));var n=r(0),i=r(371),a=r(72),o=r(11),s=r(67),u=r(64),c=r(68),l=r(5),d=r(1),f=r(138),p=r(276),m=r(48),h=Object(n.__assign)(Object(n.__assign)({},a.b),{tWboitA:Object(o.i)("texture","rgba","float","nearest"),tWboitB:Object(o.i)("texture","rgba","float","nearest"),uTexSize:Object(o.j)("v2")}),g=Object(u.g)("evaluate-wboit",f.a,"\nprecision highp float;\n\nuniform sampler2D tWboitA;\nuniform sampler2D tWboitB;\nuniform vec2 uTexSize;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n\n    vec4 accum = texture2D(tWboitA, coords);\n    float r = 1.0 - accum.a;\n\n    accum.a = texture2D(tWboitB, coords).r;\n    // divisor needs to allow very small values for nice fading\n    gl_FragColor = vec4(accum.rgb / clamp(accum.a, 0.00000001, 50000.0), r);\n}\n");var v=function(){function e(t,r,i){if(this.webgl=t,this._supported=!1,e.isSupported(t)){var o,u,f,p,m,v,b=t.resources;this.textureA=b.texture("image-float32","rgba","float","nearest"),this.textureA.define(r,i),this.textureB=b.texture("image-float32","rgba","float","nearest"),this.textureB.define(r,i),this.renderable=(o=t,u=this.textureA,f=this.textureB,p=Object(n.__assign)(Object(n.__assign)({},a.c),{tWboitA:l.e.create(u),tWboitB:l.e.create(f),uTexSize:l.e.create(d.Vec2.create(u.getWidth(),u.getHeight()))}),m=Object(n.__assign)({},h),v=Object(c.a)(o,"triangles",g,m,p),Object(s.a)(v,p)),this.framebuffer=b.framebuffer(),this._supported=!0,this._init()}}return Object.defineProperty(e.prototype,"supported",{get:function(){return this._supported},enumerable:!1,configurable:!0}),e.prototype.bind=function(){var e=this.webgl,t=e.state,r=e.gl;this.framebuffer.bind(),t.clearColor(0,0,0,1),r.clear(r.COLOR_BUFFER_BIT),t.disable(r.DEPTH_TEST),t.blendFuncSeparate(r.ONE,r.ONE,r.ZERO,r.ONE_MINUS_SRC_ALPHA),t.enable(r.BLEND)},e.prototype.render=function(){var e=this.webgl,t=e.state,r=e.gl;t.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),t.enable(r.BLEND),this.renderable.update(),this.renderable.render()},e.prototype.setSize=function(e,t){var r=this.renderable.values.uTexSize.ref.value,n=r[0],i=r[1];e===n&&t===i||(this.textureA.define(e,t),this.textureB.define(e,t),l.e.update(this.renderable.values.uTexSize,d.Vec2.set(this.renderable.values.uTexSize.ref.value,e,t)))},e.prototype.reset=function(){this._supported&&this._init()},e.prototype._init=function(){var e=this.webgl.extensions.drawBuffers;this.framebuffer.bind(),e.drawBuffers([e.COLOR_ATTACHMENT0,e.COLOR_ATTACHMENT1]),this.textureA.attachFramebuffer(this.framebuffer,"color0"),this.textureB.attachFramebuffer(this.framebuffer,"color1")},e.isSupported=function(e){var t=e.extensions,r=t.drawBuffers,n=t.textureFloat,i=t.colorBufferFloat,a=t.depthTexture;if(n&&i&&a&&r)return!0;if(m.a){var o=[];n||o.push("textureFloat"),i||o.push("colorBufferFloat"),a||o.push("depthTexture"),r||o.push("drawBuffers"),console.log('Missing "'+o.join('", "')+'" extensions required for "wboit"')}return!1},e}(),b=r(174),y=Object(n.__assign)(Object(n.__assign)({},a.b),{tDepthPrimitives:Object(o.i)("texture","depth","ushort","nearest"),tDepthVolumes:Object(o.i)("texture","depth","ushort","nearest"),uTexSize:Object(o.j)("v2"),dPackedDepth:Object(o.c)("boolean")}),_=Object(u.g)("depth-merge",f.a,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tDepthPrimitives;\nuniform sampler2D tDepthVolumes;\nuniform vec2 uTexSize;\n\n#include common\n\nfloat getDepth(const in vec2 coords, sampler2D tDepth) {\n    #ifdef dPackedDepth\n        return unpackRGBAToDepth(texture2D(tDepth, coords));\n    #else\n        return texture2D(tDepth, coords).r;\n    #endif\n}\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    float depth = min(getDepth(coords, tDepthPrimitives), getDepth(coords, tDepthVolumes));\n    gl_FragColor = packDepthToRGBA(depth);\n}\n");var S=Object(n.__assign)(Object(n.__assign)({},a.b),{tColor:Object(o.i)("texture","rgba","ubyte","nearest"),uTexSize:Object(o.j)("v2")}),x=Object(u.g)("copy",f.a,"\nprecision highp float;\nprecision highp sampler2D;\n\nuniform sampler2D tColor;\nuniform vec2 uTexSize;\n\nvoid main() {\n    vec2 coords = gl_FragCoord.xy / uTexSize;\n    gl_FragColor = texture2D(tColor, coords);\n}\n");function O(e,t){var r=Object(n.__assign)(Object(n.__assign)({},a.c),{tColor:l.e.create(t),uTexSize:l.e.create(d.Vec2.create(t.getWidth(),t.getHeight()))}),i=Object(n.__assign)({},S),o=Object(c.a)(e,"triangles",x,i,r);return Object(s.a)(o,r)}var w=function(){function e(e,t,r,o){this.webgl=e;var u,f,p,m,h,g,S,x=e.extensions,w=e.resources;this.drawTarget=Object(i.a)(e.gl),this.colorTarget=e.createRenderTarget(t,r,!0,"uint8","linear"),this.packedDepth=!x.depthTexture,this.depthTarget=e.createRenderTarget(t,r),this.depthTexture=this.depthTarget.texture,this.depthTargetPrimitives=this.packedDepth?e.createRenderTarget(t,r):null,this.depthTargetVolumes=this.packedDepth?e.createRenderTarget(t,r):null,this.depthTexturePrimitives=this.depthTargetPrimitives?this.depthTargetPrimitives.texture:w.texture("image-depth","depth","ushort","nearest"),this.depthTextureVolumes=this.depthTargetVolumes?this.depthTargetVolumes.texture:w.texture("image-depth","depth","ushort","nearest"),this.packedDepth||(this.depthTexturePrimitives.define(t,r),this.depthTextureVolumes.define(t,r)),this.depthMerge=(u=e,f=this.depthTexturePrimitives,p=this.depthTextureVolumes,m=this.packedDepth,h=Object(n.__assign)(Object(n.__assign)({},a.c),{tDepthPrimitives:l.e.create(f),tDepthVolumes:l.e.create(p),uTexSize:l.e.create(d.Vec2.create(f.getWidth(),f.getHeight())),dPackedDepth:l.e.create(m)}),g=Object(n.__assign)({},y),S=Object(c.a)(u,"triangles",_,g,h),Object(s.a)(S,h)),this.wboit=o?new v(e,t,r):void 0,this.postprocessing=new b.c(e,this),this.antialiasing=new b.a(e,this),this.copyFboTarget=O(e,this.colorTarget.texture),this.copyFboPostprocessing=O(e,this.postprocessing.target.texture)}return Object.defineProperty(e.prototype,"wboitEnabled",{get:function(){var e;return!!(null===(e=this.wboit)||void 0===e?void 0:e.supported)},enumerable:!1,configurable:!0}),e.prototype.reset=function(){var e;null===(e=this.wboit)||void 0===e||e.reset()},e.prototype.setSize=function(e,t){var r,n=this.colorTarget.getWidth(),i=this.colorTarget.getHeight();e===n&&t===i||(this.colorTarget.setSize(e,t),this.depthTarget.setSize(e,t),this.depthTargetPrimitives?this.depthTargetPrimitives.setSize(e,t):this.depthTexturePrimitives.define(e,t),this.depthTargetVolumes?this.depthTargetVolumes.setSize(e,t):this.depthTextureVolumes.define(e,t),l.e.update(this.depthMerge.values.uTexSize,d.Vec2.set(this.depthMerge.values.uTexSize.ref.value,e,t)),l.e.update(this.copyFboTarget.values.uTexSize,d.Vec2.set(this.copyFboTarget.values.uTexSize.ref.value,e,t)),l.e.update(this.copyFboPostprocessing.values.uTexSize,d.Vec2.set(this.copyFboPostprocessing.values.uTexSize.ref.value,e,t)),(null===(r=this.wboit)||void 0===r?void 0:r.supported)&&this.wboit.setSize(e,t),this.postprocessing.setSize(e,t),this.antialiasing.setSize(e,t))},e.prototype._depthMerge=function(){var e=this.webgl,t=e.state,r=e.gl;this.depthMerge.update(),this.depthTarget.bind(),t.disable(r.BLEND),t.disable(r.DEPTH_TEST),t.disable(r.CULL_FACE),t.depthMask(!1),t.clearColor(1,1,1,1),r.clear(r.COLOR_BUFFER_BIT),this.depthMerge.render()},e.prototype._renderWboit=function(e,t,r,n,i){var a;if(!(null===(a=this.wboit)||void 0===a?void 0:a.supported))throw new Error("expected wboit to be supported");this.colorTarget.bind(),e.clear(!0),this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer,"depth"),this.colorTarget.bind(),e.clearDepth(),e.renderWboitOpaque(r.primitives,t,null),this.depthTextureVolumes.attachFramebuffer(this.colorTarget.framebuffer,"depth"),this.colorTarget.bind(),e.clearDepth(),e.renderWboitOpaque(r.volumes,t,this.depthTexturePrimitives),this._depthMerge(),b.c.isEnabled(i)&&this.postprocessing.render(t,!1,n,e.props.backgroundColor,i),this.wboit.bind(),e.renderWboitTransparent(r.primitives,t,this.depthTexture),e.renderWboitTransparent(r.volumes,t,this.depthTexture),b.c.isEnabled(i)?(this.depthTexturePrimitives.attachFramebuffer(this.postprocessing.target.framebuffer,"depth"),this.postprocessing.target.bind()):(this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer,"depth"),this.colorTarget.bind()),this.wboit.render()},e.prototype._renderBlended=function(e,t,r,n,i,a){if(n?this.drawTarget.bind():(this.colorTarget.bind(),this.packedDepth||this.depthTexturePrimitives.attachFramebuffer(this.colorTarget.framebuffer,"depth")),e.clear(!0),e.renderBlendedOpaque(r.primitives,t,null),!n){this.depthTargetPrimitives&&(this.depthTargetPrimitives.bind(),e.clear(!1),e.renderDepth(r.primitives,t,null),this.colorTarget.bind()),this.packedDepth||(this.depthTextureVolumes.attachFramebuffer(this.colorTarget.framebuffer,"depth"),e.clearDepth()),e.renderBlendedVolumeOpaque(r.volumes,t,this.depthTexturePrimitives),this.depthTargetVolumes&&(this.depthTargetVolumes.bind(),e.clear(!1),e.renderDepth(r.volumes,t,this.depthTexturePrimitives),this.colorTarget.bind()),this._depthMerge(),this.colorTarget.bind(),b.c.isEnabled(a)&&this.postprocessing.render(t,!1,i,e.props.backgroundColor,a),e.renderBlendedVolumeTransparent(r.volumes,t,this.depthTexturePrimitives);var o=b.c.isEnabled(a)?this.postprocessing.target:this.colorTarget;this.packedDepth||this.depthTexturePrimitives.attachFramebuffer(o.framebuffer,"depth"),o.bind()}e.renderBlendedTransparent(r.primitives,t,null)},e.prototype._render=function(e,t,r,n,i,a,o){var s=r.volumes.renderables.length>0,u=b.c.isEnabled(o),c=b.a.isEnabled(o),l=t.viewport,d=l.x,f=l.y,p=l.width,m=l.height;e.setViewport(d,f,p,m),e.update(t),this.wboitEnabled?this._renderWboit(e,t,r,a,o):this._renderBlended(e,t,r,!s&&!u&&!c&&i,a,o),b.c.isEnabled(o)?this.postprocessing.target.bind():!i||s||this.wboitEnabled?this.colorTarget.bind():this.drawTarget.bind(),n.debug.isEnabled&&(n.debug.syncVisibility(),e.renderBlended(n.debug.scene,t,null)),n.handle.isEnabled&&e.renderBlended(n.handle.scene,t,null),n.camera.isEnabled&&(n.camera.update(t),e.update(n.camera.camera),e.renderBlended(n.camera.scene,n.camera.camera,null)),c?this.antialiasing.render(t,i,o):i&&(this.drawTarget.bind(),this.webgl.state.disable(this.webgl.gl.DEPTH_TEST),b.c.isEnabled(o)?this.copyFboPostprocessing.render():(s||this.wboitEnabled)&&this.copyFboTarget.render()),this.webgl.gl.flush()},e.prototype.render=function(e,t,r,n,i,a,o){e.setTransparentBackground(a),e.setDrawingBufferSize(this.colorTarget.getWidth(),this.colorTarget.getHeight()),p.a.is(t)?(this._render(e,t.left,r,n,i,a,o),this._render(e,t.right,r,n,i,a,o)):this._render(e,t,r,n,i,a,o)},e.prototype.getColorTarget=function(e){return b.a.isEnabled(e)?this.antialiasing.target:b.c.isEnabled(e)?this.postprocessing.target:this.colorTarget},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return _}));var n=r(0),i=r(224),a=r(116),o=r(8),s=r(13);function u(e,t){var r=function(e,t){return{state:e,oldHierarchy:t,hierarchy:c(),changed:!1,added:new Set}}(e,t||c());return function(e,t){var r={tree:e,state:t};v(r,e.root)}(e.tree,r),t&&t.refs.forEach(h,r),{hierarchy:r.hierarchy,added:r.added,changed:r.changed}}function c(){return{volumes:[],refs:new Map}}function l(e){return{kind:"volume",cell:e,version:e.transform.version,representations:[]}}function d(e,t){return{kind:"volume-representation",cell:e,version:e.transform.version,volume:t}}function f(e,t,r,n){for(var i=[],a=4;a<arguments.length;a++)i[a-4]=arguments[a];var o=n.apply(void 0,i);r.push(o),e.hierarchy.refs.set(t.transform.ref,o);var s=e.oldHierarchy.refs.get(t.transform.ref);return s?s.version!==t.transform.version&&(e.changed=!0):(e.added.add(o.cell.transform.ref),e.changed=!0),o}var p=[[function(e,t){return function(r,n){return!t(n)&&e.is(r.obj)}}(o.a.Volume.Data,(function(e){return e.currentVolume})),function(e,t){e.currentVolume=f(e,t,e.hierarchy.volumes,l,t)},function(e){return e.currentVolume=void 0}],[function(e,t){return!e.state.isGhost&&!!t.currentVolume&&o.a.Volume.Representation3D.is(e.obj)},function(e,t){return e.currentVolume&&f(e,t,e.currentVolume.representations,d,t,e.currentVolume),!1},function(){}]];function m(e){if(!e||!(null==e?void 0:e.parent)||!e.parent.cells.has(e.transform.ref))return!1;var t=e.obj;return!(!t||t===s.StateObject.Null||"ok"!==e.status&&"error"!==e.status)}function h(e){m(e.cell)||(this.changed=!0)}function g(e){v(this,this.tree.transforms.get(e))}function v(e,t){var r=e.state,n=r.state.cells.get(t.ref);if(m(n)){for(var i=void 0,a=!1,o=0,s=p;o<s.length;o++){var u=s[o],c=u[0],l=u[1],d=u[2];if(c(n,r)){if(!1===l(r,n)){a=!0;break}i=d;break}}if(!a){var f=e.tree.children.get(t.ref);f&&f.size&&f.forEach(g,e),i&&i(r)}}}var b=r(295),y=r(31),_=function(e){function t(t){var r=e.call(this)||this;return r.plugin=t,r.state={syncedTree:r.dataState.tree,notified:!1,hierarchy:c(),selection:void 0},r.behaviors={selection:r.ev.behavior({hierarchy:r.current,volume:r.selection})},r.subscribe(t.state.data.events.changed,(function(e){e.inTransaction||t.behaviors.state.isAnimating.value||r.sync(!0)})),r.subscribe(t.behaviors.state.isAnimating,(function(e){e||t.behaviors.state.isUpdating.value||r.sync(!0)})),r}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"current",{get:function(){return this.sync(!1),this.state.hierarchy},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selection",{get:function(){return this.sync(!1),this.state.selection},enumerable:!1,configurable:!0}),t.prototype.sync=function(e){if(e||!this.dataState.inUpdate)if(this.state.syncedTree!==this.dataState.tree){this.state.syncedTree=this.dataState.tree;var t=u(this.plugin.state.data,this.current);if(t.changed){var r=t.hierarchy;this.state.hierarchy=r,this.state.selection?this.state.selection=r.refs.has(this.state.selection.cell.transform.ref)?r.refs.get(this.state.selection.cell.transform.ref):r.volumes[0]:this.state.selection=r.volumes[0],e?(this.state.notified=!0,this.behaviors.selection.next({hierarchy:r,volume:this.state.selection})):this.state.notified=!1}}else e&&!this.state.notified&&(this.state.notified=!0,this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:this.state.selection}))},t.prototype.setCurrent=function(e){this.state.selection=e||this.state.hierarchy.volumes[0],this.behaviors.selection.next({hierarchy:this.state.hierarchy,volume:e||this.state.hierarchy.volumes[0]})},t.prototype.remove=function(e,t){if(0!==e.length){for(var r=this.plugin.state.data.build(),n=0,i=e;n<i.length;n++){var a=i[n];r.delete("string"==typeof a?a:a.cell.transform.ref)}return r.commit({canUndo:!!t&&"Remove"})}},t.prototype.toggleVisibility=function(e,t){if(0!==e.length)for(var r=void 0!==t?"show"!==t:!e[0].cell.state.isHidden,n=0,a=e;n<a.length;n++){var o=a[n];Object(i.setSubtreeVisibility)(this.dataState,o.cell.transform.ref,r)}},t.prototype.addRepresentation=function(e,t){var r;return this.dataState.build().to(e.cell).apply(y.StateTransforms.Representation.VolumeRepresentation3D,Object(b.a)(this.plugin,null===(r=e.cell.obj)||void 0===r?void 0:r.data,{type:t})).commit({canUndo:"Add Representation"})},t}(a.a);(_||(_={})).getRepresentationTypes=function(e,t){var r,n;return(null===(r=null==t?void 0:t.cell.obj)||void 0===r?void 0:r.data)?e.representation.volume.registry.getApplicableTypes(null===(n=t.cell.obj)||void 0===n?void 0:n.data):e.representation.volume.registry.types}},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return l}));var n=r(0),i=r(2);function a(e,t,r,n,i,a,s){for(var u=0;u<t;u++){for(var c=0;c<r;c++)n[c]=e[c*t+u];o(n,i,a,s,r);for(c=0;c<r;c++)e[c*t+u]=i[c]}for(c=0;c<r;c++){for(u=0;u<t;u++)n[u]=e[c*t+u];o(n,i,a,s,t);for(u=0;u<t;u++)e[c*t+u]=Math.sqrt(i[u])}}function o(e,t,r,n,i){r[0]=0,n[0]=Number.MIN_SAFE_INTEGER,n[1]=Number.MAX_SAFE_INTEGER;for(var a=1,o=0;a<i;a++){for(var s=(e[a]+a*a-(e[r[o]]+r[o]*r[o]))/(2*a-2*r[o]);s<=n[o];)o--,s=(e[a]+a*a-(e[r[o]]+r[o]*r[o]))/(2*a-2*r[o]);r[++o]=a,n[o]=s,n[o+1]=Number.MAX_SAFE_INTEGER}for(a=0,o=0;a<i;a++){for(;n[o+1]<a;)o++;t[a]=(a-r[o])*(a-r[o])+e[r[o]]}}var s=r(52),u={};function c(e){var t=JSON.stringify(e);return void 0===u[t]&&(u[t]=new d(e)),u[t]}var l={fontFamily:i.ParamDefinition.Select("sans-serif",[["sans-serif","Sans Serif"],["monospace","Monospace"],["serif","Serif"],["cursive","Cursive"]]),fontQuality:i.ParamDefinition.Select(3,[[0,"lower"],[1,"low"],[2,"medium"],[3,"high"],[4,"higher"]]),fontStyle:i.ParamDefinition.Select("normal",[["normal","Normal"],["italic","Italic"],["oblique","Oblique"]]),fontVariant:i.ParamDefinition.Select("normal",[["normal","Normal"],["small-caps","Small Caps"]]),fontWeight:i.ParamDefinition.Select("normal",[["normal","Normal"],["bold","Bold"]])},d=function(){function e(e){void 0===e&&(e={}),this.mapped={},this.scratchW=0,this.scratchH=0,this.currentX=0,this.currentY=0,this.cutoff=.5;var t=Object(n.__assign)(Object(n.__assign)({},i.ParamDefinition.getDefaultValues(l)),e);this.props=t;var r=32*(t.fontQuality+1);this.buffer=r/8,this.radius=r/3,this.lineHeight=Math.round(r+2*this.buffer+this.radius),this.maxWidth=Math.round(.75*this.lineHeight),this.texture=Object(s.c)(350*this.lineHeight*this.maxWidth,1,Uint8Array),this.scratchCanvas=document.createElement("canvas"),this.scratchCanvas.width=this.maxWidth,this.scratchCanvas.height=this.lineHeight,this.scratchContext=this.scratchCanvas.getContext("2d"),this.scratchContext.font=t.fontStyle+" "+t.fontVariant+" "+t.fontWeight+" "+r+"px "+t.fontFamily,this.scratchContext.fillStyle="black",this.scratchContext.textBaseline="middle",this.scratchData=new Uint8Array(this.lineHeight*this.maxWidth),this.gridOuter=new Float64Array(this.lineHeight*this.maxWidth),this.gridInner=new Float64Array(this.lineHeight*this.maxWidth),this.f=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.d=new Float64Array(Math.max(this.lineHeight,this.maxWidth)),this.z=new Float64Array(Math.max(this.lineHeight,this.maxWidth)+1),this.v=new Int16Array(Math.max(this.lineHeight,this.maxWidth)),this.middle=Math.ceil(this.lineHeight/2),this.placeholder=this.get(String.fromCharCode(65533))}return e.prototype.get=function(e){if(void 0===this.mapped[e]){this.draw(e);var t=this.texture,r=t.array,n=t.width,i=t.height,a=this.scratchData;if(this.currentX+this.scratchW>n&&(this.currentX=0,this.currentY+=this.scratchH),this.currentY+this.scratchH>i)return console.warn("canvas to small"),this.placeholder;this.mapped[e]={x:this.currentX,y:this.currentY,w:this.scratchW,h:this.scratchH,nw:this.scratchW/this.lineHeight,nh:this.scratchH/this.lineHeight};for(var o=0;o<this.scratchH;++o)for(var s=0;s<this.scratchW;++s)r[n*(this.currentY+o)+this.currentX+s]=a[o*this.scratchW+s];this.currentX+=this.scratchW}return this.mapped[e]},e.prototype.draw=function(e){var t=this.lineHeight,r=this.scratchContext,n=this.scratchData,i=r.measureText(e),o=Math.min(this.maxWidth,Math.ceil(i.width+2*this.buffer)),s=o*t;r.clearRect(0,0,o,t),r.fillText(e,this.buffer,this.middle);for(var u=r.getImageData(0,0,o,t),c=0;c<s;c++){var l=u.data[4*c+3]/255;this.gridOuter[c]=1===l?0:0===l?Number.MAX_SAFE_INTEGER:Math.pow(Math.max(0,.5-l),2),this.gridInner[c]=1===l?Number.MAX_SAFE_INTEGER:0===l?0:Math.pow(Math.max(0,l-.5),2)}a(this.gridOuter,o,t,this.f,this.d,this.v,this.z),a(this.gridInner,o,t,this.f,this.d,this.v,this.z);for(c=0;c<s;c++){var d=this.gridOuter[c]-this.gridInner[c];n[c]=Math.max(0,Math.min(255,Math.round(255-255*(d/this.radius+this.cutoff))))}this.scratchW=o,this.scratchH=t},e}()},function(e,t,r){"use strict";r.d(t,"b",(function(){return y})),r.d(t,"a",(function(){return _}));var n=r(64);function i(e,t){switch(t){case"b":case"b[]":return e.BOOL;case"f":case"f[]":return e.FLOAT;case"i":case"i[]":return e.INT;case"v2":case"v2[]":return e.FLOAT_VEC2;case"v3":case"v3[]":return e.FLOAT_VEC3;case"v4":case"v4[]":return e.FLOAT_VEC4;case"m3":case"m3[]":return e.FLOAT_MAT3;case"m4":case"m4[]":return e.FLOAT_MAT4;default:console.error("unknown uniform kind '"+t+"'")}}function a(e,t,r){e.uniform1f(t,r)}function o(e,t,r){e.uniform1fv(t,r)}function s(e,t,r){e.uniform1i(t,r)}function u(e,t,r){e.uniform1iv(t,r)}function c(e,t,r){e.uniform2fv(t,r)}function l(e,t,r){e.uniform3fv(t,r)}function d(e,t,r){e.uniform4fv(t,r)}function f(e,t,r){e.uniformMatrix3fv(t,!1,r)}function p(e,t,r){e.uniformMatrix4fv(t,!1,r)}function m(e){switch(e){case"f":return a;case"f[]":return o;case"i":case"t":case"b":return s;case"i[]":case"t[]":case"b[]":return u;case"v2":case"v2[]":return c;case"v3":case"v3[]":return l;case"v4":case"v4[]":return d;case"m3":case"m3[]":return f;case"m4":case"m4[]":return p}}var h=r(288),g=r(99),v=r(48),b=Object(g.a)();function y(e){var t=e.createProgram();if(null===t)throw new Error("Could not create WebGL program");return t}function _(e,t,r,a,o){var s,u,c=o.defineValues,l=o.shaderCode,d=o.schema,f=y(e),p=b(),g=Object(n.j)(e,r,c,l),_=a("vert",g.vert),S=a("frag",g.frag);function x(){_.attach(f),S.attach(f),e.linkProgram(f),v.a&&function(e,t){if(!e.getProgramParameter(t,e.LINK_STATUS))throw new Error("Could not compile WebGL program. \n\n"+e.getProgramInfoLog(t))}(e,f),s=function(e,t,r){var n={};return Object.keys(r).forEach((function(i){var a=r[i];if("attribute"===a.type){var o=e.getAttribLocation(t,i);n[i]=o}else if("uniform"===a.type||"texture"===a.type){o=e.getUniformLocation(t,i);n[i]=o}})),n}(e,f,d),u=function(e){var t={};return Object.keys(e).forEach((function(r){var n=e[r];"uniform"===n.type?t[r]=m(n.kind):"texture"===n.type&&(t[r]=m("t"))})),t}(d),v.a&&(function(e,t,r){for(var n=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;i<n;++i){var a=e.getActiveAttrib(t,i);if(a){var o=a.name,s=a.type;if(o.startsWith("__activeAttribute"))continue;if("gl_InstanceID"===o)continue;if("gl_VertexID"===o)continue;var u=r[o];if(void 0===u)throw new Error("missing 'uniform' or 'texture' with name '"+o+"' in schema");if("attribute"!==u.type)throw new Error("'"+o+"' must be of type 'attribute' but is '"+u.type+"'");if(Object(h.d)(e,u.kind,u.itemSize)!==s)throw new Error("unexpected attribute type for "+o)}}}(e,f,d),function(e,t,r){for(var n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),a=0;a<n;++a){var o=e.getActiveUniform(t,a);if(o){var s=o.name,u=o.type;if(s.startsWith("__activeUniform"))continue;var c=r[s.replace(/[[0-9]+\]$/,"")];if(void 0===c)throw new Error("missing 'uniform' or 'texture' with name '"+s+"' in schema");if("uniform"===c.type){if(i(e,c.kind)!==u)throw new Error("unexpected uniform type for "+s)}else{if("texture"!==c.type)throw new Error("'"+s+"' must be of type 'uniform' or 'texture' but is '"+c.type+"'");if("image-float32"===c.kind||"image-uint8"===c.kind){if(u!==e.SAMPLER_2D)throw new Error("unexpected sampler type for '"+s+"'")}else if(("volume-float32"===c.kind||"volume-uint8"===c.kind)&&u!==e.SAMPLER_3D)throw new Error("unexpected sampler type for '"+s+"'")}}}}(e,f,d))}x();var O=!1;return{id:p,use:function(){t.currentProgramId=p,e.useProgram(f)},setUniforms:function(t){for(var r=0,n=t.length;r<n;++r){var i=t[r],a=i[0],o=i[1];if(o){var c=s[a];null!==c&&u[a](e,c,o.ref.value)}}},bindAttributes:function(e){for(var t=0,r=e.length;t<r;++t){var n=e[t],i=n[0],a=n[1],o=s[i];-1!==o&&a.bind(o)}},bindTextures:function(t,r){for(var n=0,i=t.length;n<i;++n){var a=t[n],o=a[0],c=a[1],l=s[o];null!=l&&(c.bind(n+r),u[o](e,l,n+r))}},reset:function(){f=y(e),x()},destroy:function(){O||(_.destroy(),S.destroy(),e.deleteProgram(f),O=!0)}}}},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(e){"object"==typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";r.r(t),r.d(t,"PDBeStructureQualityReport",(function(){return l}));var n=r(0),i=r(6),a=r(221),o=r(388),s=r(4),u=r(2),c=r(79),l=c.a.create({name:"pdbe-structure-quality-report-prop",category:"custom-props",display:{name:"Structure Quality Report",description:"Data from wwPDB Validation Report, obtained via PDBe."},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=a.b,t.labelPDBeValidation={label:function(e){if(t.params.showTooltip)switch(e.kind){case"element-loci":if(0===e.elements.length)return;var r=e.elements[0],n=r.unit;if(!n.model.customProperties.hasReference(a.b.descriptor))return;var o=s.StructureElement.Location.create(e.structure,n,n.elements[i.OrderedSet.getAt(r.indices,0)]),u=a.a.getIssues(o);return 0===u.length?"Validation: No Issues":"Validation: "+u.join(", ");default:return}}},t}return Object(n.__extends)(t,e),t.prototype.register=function(){this.ctx.customModelProperties.register(this.provider,this.params.autoAttach),this.ctx.managers.lociLabels.addProvider(this.labelPDBeValidation),this.ctx.representation.structure.themes.colorThemeRegistry.add(o.StructureQualityReportColorThemeProvider)},t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customModelProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.unregister=function(){this.ctx.customModelProperties.unregister(a.b.descriptor.name),this.ctx.managers.lociLabels.removeProvider(this.labelPDBeValidation),this.ctx.representation.structure.themes.colorThemeRegistry.remove(o.StructureQualityReportColorThemeProvider)},t}(c.a.Handler),params:function(){return{autoAttach:u.ParamDefinition.Boolean(!1),showTooltip:u.ParamDefinition.Boolean(!0)}}})},function(e,t,r){"use strict";r.r(t),r.d(t,"ElementSymbolColors",(function(){return d})),r.d(t,"ElementSymbolColorThemeParams",(function(){return p})),r.d(t,"getElementSymbolColorThemeParams",(function(){return m})),r.d(t,"elementSymbolColor",(function(){return h})),r.d(t,"ElementSymbolColorTheme",(function(){return g})),r.d(t,"ElementSymbolColorThemeProvider",(function(){return v}));var n=r(0),i=r(24),a=r(4),o=r(2),s=r(149),u=r(46),c=r(241),l=r(257),d=Object(i.ColorMap)({H:16777215,D:16777152,T:16777120,HE:14286847,LI:13402367,BE:12779264,B:16758197,C:9474192,N:3166456,O:16715021,F:9494608,NE:11789301,NA:11230450,MG:9109248,AL:12560038,SI:1578e4,P:16744448,S:16777008,CL:2093087,AR:8442339,K:9388244,CA:4062976,SC:15132390,TI:12567239,V:10921643,CR:9083335,MN:10255047,FE:14706227,CO:15765664,NI:5296208,CU:13140019,ZN:8224944,GA:12750735,GE:6721423,AS:12419299,SE:16752896,BR:10889513,KR:6076625,RB:7351984,SR:65280,Y:9764863,ZR:9756896,NB:7586505,MO:5551541,TC:3907230,RU:2396047,RH:687500,PD:27013,AG:12632256,CD:16767375,IN:10909043,SN:6717568,SB:10380213,TE:13924864,I:9699476,XE:9699476,CS:5707663,BA:51456,LA:7394559,CE:16777159,PR:14286791,ND:13107143,PM:10747847,SM:9437127,EU:6422471,GD:4587463,TB:3211207,DY:2097095,HO:65436,ER:58997,TM:54354,YB:48952,LU:43812,HF:5096191,TA:5089023,W:2200790,RE:2522539,OS:2516630,IR:1528967,PT:13684960,AU:16765219,HG:12105936,TL:10900557,PB:5724513,BI:10375093,PO:11230208,AT:7688005,RN:4358806,FR:4325478,RA:32e3,AC:7384058,TH:47871,PA:41471,U:36863,NP:33023,PU:27647,AM:5528818,CM:7888099,BK:9064419,CF:10565332,ES:11739092,FM:11739066,MD:11734438,NO:12389767,LR:13041766,RF:13369433,DB:13697103,SG:14221381,BH:14680120,HS:15073326,MT:15400998,DS:16777215,RG:16777215,CN:16777215,UUT:16777215,FL:16777215,UUP:16777215,LV:16777215,UUH:16777215}),f=Object(i.Color)(16777215),p={carbonColor:o.ParamDefinition.MappedStatic("chain-id",{"chain-id":o.ParamDefinition.Group(Object(n.__assign)({},c.b)),"operator-name":o.ParamDefinition.Group(Object(n.__assign)({},l.b)),"element-symbol":o.ParamDefinition.Group({})},{description:"Use chain-id coloring for carbon atoms."}),saturation:o.ParamDefinition.Numeric(0,{min:-6,max:6,step:.1}),lightness:o.ParamDefinition.Numeric(.2,{min:-6,max:6,step:.1})};function m(e){return p}function h(e,t){var r=e[t];return void 0===r?f:r}function g(e,t){var r=Object(u.getAdjustedColorMap)(d,t.saturation,t.lightness),n="chain-id"===t.carbonColor.name?Object(c.a)(e,t.carbonColor.params).color:"operator-name"===t.carbonColor.name?Object(l.a)(e,t.carbonColor.params).color:void 0;function i(e,t){return n&&"C"===e?n(t,!1):h(r,e)}return{factory:g,granularity:"element-symbol"===t.carbonColor.name?"group":"groupInstance",color:function(e){if(a.StructureElement.Location.is(e)){if(a.Unit.isAtomic(e.unit))return i(e.unit.model.atomicHierarchy.atoms.type_symbol.value(e.element),e)}else if(a.Bond.isLocation(e)){if(a.Unit.isAtomic(e.aUnit))return i(e.aUnit.model.atomicHierarchy.atoms.type_symbol.value(e.aUnit.elements[e.aIndex]),e)}return f},props:t,description:"Assigns a color to every atom according to its chemical element.",legend:Object(s.b)(Object.keys(d).map((function(e){return[e,d[e]]})))}}var v={name:"element-symbol",label:"Element Symbol",category:"Atom Property",factory:g,getParams:m,defaultValues:o.ParamDefinition.getDefaultValues(p),isApplicable:function(e){return!!e.structure}}},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureMeasurementsControls",(function(){return g})),r.d(t,"MeasurementList",(function(){return v})),r.d(t,"MeasurementControls",(function(){return b}));var n=r(0),i=r(3),a=r(23),o=r(379),s=r(27),u=r(77),c=r(33),l=r(56),d=r(18),f=r(15),p=r(73),m=r(189),h=r(213),g=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.defaultState=function(){return{isCollapsed:!1,header:"Measurements",brand:{accent:"gray",svg:f.PencilRulerSvg}}},t.prototype.renderControls=function(){return i.createElement(i.Fragment,null,i.createElement(b,null),i.createElement(v,null))},t}(c.CollapsableControls),v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.measurement.behaviors.state,(function(){e.forceUpdate()}))},t.prototype.renderGroup=function(e,t){for(var r=[],n=0,a=e;n<a.length;n++){var o=a[n];o.obj&&r.push(i.createElement(_,{key:o.obj.id,cell:o}))}return r.length?i.createElement(d.ExpandGroup,{header:t,initiallyExpanded:!0},r):null},t.prototype.render=function(){var e=this.plugin.managers.structure.measurement.state;return i.createElement("div",{style:{marginTop:"6px"}},this.renderGroup(e.labels,"Labels"),this.renderGroup(e.distances,"Distances"),this.renderGroup(e.angles,"Angles"),this.renderGroup(e.dihedrals,"Dihedrals"))},t}(c.PurePluginUIComponent),b=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isBusy:!1,action:void 0},t.measureDistance=function(){var e=t.plugin.managers.structure.selection.additionsHistory;t.plugin.managers.structure.measurement.addDistance(e[0].loci,e[1].loci)},t.measureAngle=function(){var e=t.plugin.managers.structure.selection.additionsHistory;t.plugin.managers.structure.measurement.addAngle(e[0].loci,e[1].loci,e[2].loci)},t.measureDihedral=function(){var e=t.plugin.managers.structure.selection.additionsHistory;t.plugin.managers.structure.measurement.addDihedral(e[0].loci,e[1].loci,e[2].loci,e[3].loci)},t.addLabel=function(){var e=t.plugin.managers.structure.selection.additionsHistory;t.plugin.managers.structure.measurement.addLabel(e[0].loci)},t.selectAction=function(e){t.toggleAdd(),e&&(null==e?void 0:e.value)()},t.toggleAdd=function(){return t.setState({action:"add"===t.state.action?void 0:"add"})},t.toggleOptions=function(){return t.setState({action:"options"===t.state.action?void 0:"options"})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.selection.events.additionsHistoryUpdated,(function(){e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})}))},Object.defineProperty(t.prototype,"selection",{get:function(){return this.plugin.managers.structure.selection},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actions",{get:function(){var e=this.selection.additionsHistory;return[{kind:"item",label:"Label "+(0===e.length?" (1 selection required)":" (1st selection)"),value:this.addLabel,disabled:0===e.length},{kind:"item",label:"Distance "+(e.length<2?" (2 selections required)":" (top 2 selections)"),value:this.measureDistance,disabled:e.length<2},{kind:"item",label:"Angle "+(e.length<3?" (3 selections required)":" (top 3 selections)"),value:this.measureAngle,disabled:e.length<3},{kind:"item",label:"Dihedral "+(e.length<4?" (4 selections required)":" (top 4 selections)"),value:this.measureDihedral,disabled:e.length<4}]},enumerable:!1,configurable:!0}),t.prototype.highlight=function(e){this.plugin.managers.interactivity.lociHighlights.highlightOnly({loci:e},!1)},t.prototype.moveHistory=function(e,t){this.plugin.managers.structure.selection.modifyHistory(e,t,4)},t.prototype.focusLoci=function(e){this.plugin.managers.camera.focusLoci(e)},t.prototype.historyEntry=function(e,t){var r=this,n=this.plugin.managers.structure.selection.additionsHistory;return i.createElement("div",{className:"msp-flex-row",key:e.id},i.createElement(d.Button,{noOverflow:!0,title:"Click to focus. Hover to highlight.",onClick:function(){return r.focusLoci(e.loci)},style:{width:"auto",textAlign:"left"},onMouseEnter:function(){return r.highlight(e.loci)},onMouseLeave:this.plugin.managers.interactivity.lociHighlights.clearHighlights},t,". ",i.createElement("span",{dangerouslySetInnerHTML:{__html:e.label}})),n.length>1&&i.createElement(d.IconButton,{svg:f.ArrowUpwardSvg,small:!0,className:"msp-form-control",onClick:function(){return r.moveHistory(e,"up")},flex:"20px",title:"Move up"}),n.length>1&&i.createElement(d.IconButton,{svg:f.ArrowDownwardSvg,small:!0,className:"msp-form-control",onClick:function(){return r.moveHistory(e,"down")},flex:"20px",title:"Move down"}),i.createElement(d.IconButton,{svg:f.DeleteOutlinedSvg,small:!0,className:"msp-form-control",onClick:function(){return r.plugin.managers.structure.selection.modifyHistory(e,"remove")},flex:!0,title:"Remove"}))},t.prototype.add=function(){for(var e=this.plugin.managers.structure.selection.additionsHistory,t=[],r=0,n=Math.min(e.length,4);r<n;r++)t.push(this.historyEntry(e[r],r+1));return i.createElement(i.Fragment,null,i.createElement(l.a,{items:this.actions,onSelect:this.selectAction}),t.length>0&&i.createElement("div",{className:"msp-control-offset"},t),0===t.length&&i.createElement("div",{className:"msp-control-offset msp-help-text"},i.createElement("div",{className:"msp-help-description"},i.createElement(f.Icon,{svg:f.HelpOutlineSvg,inline:!0}),"Add one or more selections (toggle ",i.createElement(h.ToggleSelectionModeButton,{inline:!0})," mode)")))},t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(d.ToggleButton,{icon:f.AddSvg,label:"Add",toggle:this.toggleAdd,isSelected:"add"===this.state.action,disabled:this.state.isBusy,className:"msp-btn-apply-simple"}),i.createElement(d.ToggleButton,{icon:f.TuneSvg,label:"",title:"Options",toggle:this.toggleOptions,isSelected:"options"===this.state.action,disabled:this.state.isBusy,style:{flex:"0 0 40px",padding:0}})),"add"===this.state.action&&this.add(),"options"===this.state.action&&i.createElement(y,null))},t}(c.PurePluginUIComponent),y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isDisabled:!1},t.changed=function(e){t.plugin.managers.structure.measurement.setOptions(e)},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.measurement.behaviors.state,(function(){e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isDisabled:t})}))},t.prototype.render=function(){var e=this.plugin.managers.structure.measurement.state;return i.createElement("div",{className:"msp-control-offset"},i.createElement(p.ParameterControls,{params:o.b,values:e.options,onChangeValues:this.changed,isDisabled:this.state.isDisabled}))},t}(c.PurePluginUIComponent),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showUpdate:!1},t.delete=function(){s.PluginCommands.State.RemoveObject(t.plugin,{state:t.props.cell.parent,ref:t.props.cell.transform.parent,removeParentGhosts:!0})},t.toggleVisibility=function(e){e.preventDefault(),s.PluginCommands.State.ToggleVisibility(t.plugin,{state:t.props.cell.parent,ref:t.props.cell.transform.parent}),e.currentTarget.blur()},t.highlight=function(){var e,r=t.selections;if(r){t.plugin.managers.interactivity.lociHighlights.clearHighlights();for(var n=0,i=r.data;n<i.length;n++){var a=i[n];t.plugin.managers.interactivity.lociHighlights.highlight({loci:a.loci},!1)}t.plugin.managers.interactivity.lociHighlights.highlight({loci:null===(e=t.props.cell.obj)||void 0===e?void 0:e.data.repr.getLoci()},!1)}},t.clearHighlight=function(){t.plugin.managers.interactivity.lociHighlights.clearHighlights()},t.toggleUpdate=function(){return t.setState({showUpdate:!t.state.showUpdate})},t.focus=function(){var e=t.selections;if(e){var r=a.Loci.getBundleBoundingSphere(S(e.data));r&&t.plugin.managers.camera.focusSphere(r)}},t.selectAction=function(e){e&&(t.setState({showUpdate:!1}),(null==e?void 0:e.value)())},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){e.forceUpdate()}))},Object.defineProperty(t.prototype,"selections",{get:function(){var e;return null===(e=this.props.cell.obj)||void 0===e?void 0:e.data.source},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){var e=this.selections;switch(null==e?void 0:e.data.length){case 1:return Object(u.lociLabel)(e.data[0].loci,{condensed:!0});case 2:return Object(u.distanceLabel)(S(e.data),{condensed:!0,unitLabel:this.plugin.managers.structure.measurement.state.options.distanceUnitLabel});case 3:return Object(u.angleLabel)(S(e.data),{condensed:!0});case 4:return Object(u.dihedralLabel)(S(e.data),{condensed:!0});default:return""}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actions",{get:function(){var e=this;return this.props.cell.sourceRef,[l.a.Item("Select This",(function(){return e.plugin.managers.structure.selection.fromSelections(e.props.cell.sourceRef)}),{icon:f.SetSvg})]},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.props.cell,t=e.obj;return t?i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row",key:t.id,onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight},i.createElement("button",{className:"msp-form-control msp-control-button-label msp-no-overflow",title:"Click to focus. Hover to highlight.",onClick:this.focus,style:{width:"auto",textAlign:"left"}},i.createElement("span",{dangerouslySetInnerHTML:{__html:this.label}})),i.createElement(d.IconButton,{svg:e.state.isHidden?f.VisibilityOffOutlinedSvg:f.VisibilityOutlinedSvg,toggleState:!1,small:!0,className:"msp-form-control",onClick:this.toggleVisibility,flex:!0,title:e.state.isHidden?"Show":"Hide"}),i.createElement(d.IconButton,{svg:f.DeleteOutlinedSvg,small:!0,className:"msp-form-control",onClick:this.delete,flex:!0,title:"Delete",toggleState:!1}),i.createElement(d.IconButton,{svg:f.MoreHorizSvg,className:"msp-form-control",onClick:this.toggleUpdate,flex:!0,title:"Actions",toggleState:this.state.showUpdate})),this.state.showUpdate&&e.parent&&i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-accent-offset"},i.createElement(l.a,{items:this.actions,onSelect:this.selectAction,noOffset:!0}),i.createElement(d.ExpandGroup,{header:"Options",noOffset:!0},i.createElement(m.UpdateTransformControl,{state:e.parent,transform:e.transform,customHeader:"none",autoHideApply:!0}))))):null},t}(c.PurePluginUIComponent);function S(e){return{loci:e.map((function(e){return e.loci}))}}},function(e,t,r){"use strict";r.r(t),r.d(t,"StateObjectActions",(function(){return u}));var n=r(0),i=r(3),a=r(33),o=r(15),s=r(318),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"current",{get:function(){return this.props.state.behaviors.currentObject.value},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.object.updated,(function(t){var r=t.ref,n=t.state,i=e.current;i.ref===r&&i.state===n&&e.forceUpdate()})),this.subscribe(this.plugin.state.data.actions.events.added,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.state.data.actions.events.removed,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e=this,t=this.props,r=t.state,n=t.nodeRef,a=r.cells.get(n),u=r.actions.fromCell(a,this.plugin);if(0===u.length)return null;var c=a.transform.transformer.definition,l=a.obj?a.obj.label:c.display&&c.display.name||c.name;return i.createElement("div",{className:"msp-state-actions"},!this.props.hideHeader&&i.createElement("div",{className:"msp-section-header"},i.createElement(o.Icon,{svg:o.CodeSvg})," ","Actions ("+l+")"),u.map((function(t,a){return i.createElement(s.a,{key:""+t.id,state:r,action:t,nodeRef:n,initiallyCollapsed:0===a?!e.props.alwaysExpandFirst&&e.props.initiallyCollapsed:e.props.initiallyCollapsed})})))},t}(a.PluginUIComponent)},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(20),i=r(34),a=r(103);function o(e,t){return void 0===t&&(t=a.a),function(r){return r.lift(new s(e,t))}}var s=function(){function e(e,t){this.dueTime=e,this.scheduler=t}return e.prototype.call=function(e,t){return t.subscribe(new u(e,this.dueTime,this.scheduler))},e}(),u=function(e){function t(t,r,n){var i=e.call(this,t)||this;return i.dueTime=r,i.scheduler=n,i.debouncedSubscription=null,i.lastValue=null,i.hasValue=!1,i}return n.a(t,e),t.prototype._next=function(e){this.clearDebounce(),this.lastValue=e,this.hasValue=!0,this.add(this.debouncedSubscription=this.scheduler.schedule(c,this.dueTime,this))},t.prototype._complete=function(){this.debouncedNext(),this.destination.complete()},t.prototype.debouncedNext=function(){if(this.clearDebounce(),this.hasValue){var e=this.lastValue;this.lastValue=null,this.hasValue=!1,this.destination.next(e)}},t.prototype.clearDebounce=function(){var e=this.debouncedSubscription;null!==e&&(this.remove(e),e.unsubscribe(),this.debouncedSubscription=null)},t}(i.a);function c(e){e.debouncedNext()}},function(e,t,r){"use strict";r.r(t),r.d(t,"Toasts",(function(){return c}));var n=r(0),i=r(3),a=r(33),o=r(18),s=r(15),u=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.hide=function(){(t.props.entry.hide||function(){}).call(null)},t}return Object(n.__extends)(t,e),t.prototype.render=function(){var e=this,t=this.props.entry,r="string"==typeof t.message?i.createElement("div",{dangerouslySetInnerHTML:{__html:t.message}}):i.createElement("div",null,i.createElement(t.message,null));return i.createElement("div",{className:"msp-toast-entry"},i.createElement("div",{className:"msp-toast-title",onClick:function(){return e.hide()}},t.title),i.createElement("div",{className:"msp-toast-message"},r),i.createElement("div",{className:"msp-toast-clear"}),i.createElement("div",{className:"msp-toast-hide"},i.createElement(o.IconButton,{svg:s.CancelSvg,onClick:this.hide,title:"Hide",className:"msp-no-hover-outline"})))},t}(a.PluginUIComponent),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.toast.events.changed,(function(){return e.forceUpdate()}))},t.prototype.render=function(){var e=this.plugin.managers.toast.state;if(!e.entries.count())return null;var t=[];return e.entries.forEach((function(e,r){return t.push(e)})),t.sort((function(e,t){return e.serialNumber-t.serialNumber})),i.createElement("div",{className:"msp-toast-container"},t.map((function(e){return i.createElement(u,{key:e.serialNumber,entry:e})})))},t}(a.PluginUIComponent)},function(e,t,r){"use strict";r.r(t),r.d(t,"StructureSourceControls",(function(){return O}));var n=r(0),i=r(3),a=r(31),o=r(33),s=r(56),u=r(18),c=r(73),l=r(6),d=r(4),f=r(234),p=r(77),m=r(61),h=r(154),g=r(15);function v(e,t,r,n){for(var i=l.SortedArray.indexOf(t.unit.elements,t.element),a=d.StructureElement.Loci(t.structure,[{unit:t.unit,indices:l.OrderedSet.ofSingleton(i)}]),o="residue"===n?d.StructureElement.Loci.extendToWholeResidues(a):d.StructureElement.Loci.extendToWholeChains(a),s=d.StructureProperties.entity.pdbx_description(t).join(", "),u=0,c=r.units;u<c.length;u++){var f=c[u],m=d.StructureElement.Loci(o.structure,[{unit:f,indices:o.elements[0].indices}]),h=Object(p.lociLabel)(m,{reverse:!0,hidePrefix:!0,htmlStyling:!1,granularity:n});h||(h=Object(p.lociLabel)(m,{hidePrefix:!1,htmlStyling:!1})),r.units.length>1&&(h+=" | "+m.elements[0].unit.conformation.operator.name);var g={label:h,category:s,loci:m};e.has(s)?e.get(s).push(g):e.set(s,[g])}}function b(e){for(var t=new Map,r=d.StructureElement.Location.create(e),n=0,i=e.unitSymmetryGroups;n<i.length;n++){var a=i[n];if(d.Unit.isAtomic(a.units[0])){r.unit=a.units[0],r.element=a.elements[0];var o=d.Unit.Traits.is(r.unit.traits,1),s=d.StructureProperties.entity.type(r),u="non-polymer"===s,c="branched"===s;if(!!d.StructureProperties.entity.prd_id(r))v(t,r,a,"chain");else if(u&&!o)v(t,r,a,"residue");else if(c||u&&o)for(var l=r.unit,f=l.model.atomicHierarchy.residueAtomSegments.index,p=-1,m=0,h=l.elements.length;m<h;++m){var g=l.elements[m],b=f[g];b!==p&&(r.element=g,v(t,r,a,"residue"),p=b)}}}var y=[];return t.forEach((function(e,t){1===e.length?y.push({label:t+": "+e[0].label,loci:e[0].loci}):e.length<2e3&&y.push.apply(y,e)})),y}var y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isBusy:!1,showAction:!1},t.getSelectionItems=Object(h.b)((function(e){for(var t,r=[],i=0,a=e;i<a.length;i++){var o=null===(t=a[i].cell.obj)||void 0===t?void 0:t.data;if(o){var u=b(o);u.length>0&&r.push(Object(n.__spreadArrays)([s.a.Header(o.label,{description:o.label})],s.a.createItems(u,{label:function(e){return e.label},category:function(e){return e.category},description:function(e){return e.label}})))}}return r})),t.selectAction=function(e,r){if(e&&t.state.showAction){var n=e.value;(null==r?void 0:r.shiftKey)?t.plugin.managers.structure.focus.addFromLoci(n.loci):t.plugin.managers.structure.focus.set(n),t.focusCamera()}else t.setState({showAction:!1})},t.toggleAction=function(){return t.setState({showAction:!t.state.showAction})},t.focusCamera=function(){var e=t.plugin.managers.structure.focus.current;e&&t.plugin.managers.camera.focusLoci(e.loci)},t.clear=function(){t.plugin.managers.structure.focus.clear(),t.plugin.managers.camera.reset()},t.highlightCurrent=function(){var e=t.plugin.managers.structure.focus.current;e&&t.plugin.managers.interactivity.lociHighlights.highlightOnly({loci:e.loci},!1)},t.clearHighlights=function(){t.plugin.managers.interactivity.lociHighlights.clearHighlights()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.focus.behaviors.current,(function(t){e.getSelectionItems([]),e.forceUpdate()})),this.subscribe(this.plugin.managers.structure.focus.events.historyUpdated,(function(t){e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t,showAction:!1})}))},Object.defineProperty(t.prototype,"isDisabled",{get:function(){return this.state.isBusy||0===this.actionItems.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actionItems",{get:function(){var e=[],t=this.plugin.managers.structure.focus.history;t.length>0&&e.push(Object(n.__spreadArrays)([s.a.Header("History",{description:"Previously focused on items."})],s.a.createItems(t,{label:function(e){return e.label},description:function(e){return e.category&&e.label!==e.category?e.category+" | "+e.label:e.label}})));var r=this.getSelectionItems(this.plugin.managers.structure.hierarchy.selection.structures);1===r.length&&(r[0][0].initiallyExpanded=!0);var i=[];return r.length>0&&i.push.apply(i,r),e.length>0&&i.push.apply(i,e),i},enumerable:!1,configurable:!0}),t.prototype.getToggleBindingLabel=function(){var e,t=this.plugin.state.behaviors.transforms.get(f.FocusLoci.id);if(!t)return"";var r=null===(e=t.params)||void 0===e?void 0:e.bindings.clickFocus;return!r||m.a.isEmpty(r)?"":m.a.formatTriggers(r)},t.prototype.render=function(){var e=this.plugin.managers.structure.focus.current,t=(null==e?void 0:e.label)||"Nothing Focused",r="Click to Center Camera";if(!e){r="Select focus using the menu";var n=this.getToggleBindingLabel();n&&(r+="\nor use '"+n+"' on element")}return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(u.Button,{noOverflow:!0,onClick:this.focusCamera,title:r,onMouseEnter:this.highlightCurrent,onMouseLeave:this.clearHighlights,disabled:this.isDisabled||!e,style:{textAlignLast:e?"left":void 0}},t),e&&i.createElement(u.IconButton,{svg:g.CancelOutlinedSvg,onClick:this.clear,title:"Clear",className:"msp-form-control",flex:!0,disabled:this.isDisabled}),i.createElement(u.ToggleButton,{icon:g.CenterFocusStrongSvg,title:"Select a focus target to center on an show its surroundings. Hold shift to focus on multiple targets.",toggle:this.toggleAction,isSelected:this.state.showAction,disabled:this.isDisabled,style:{flex:"0 0 40px",padding:0}})),this.state.showAction&&i.createElement(s.a,{items:this.actionItems,onSelect:this.selectAction}))},t}(o.PluginUIComponent),_=r(189),S=r(213),x=r(13),O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.item=function(e){var r,n,i,a,o,s,u,c,l,f,p=t.plugin.managers.structure.hierarchy.seletionSet;switch(e.kind){case"model":(m=null===(r=e.cell.obj)||void 0===r?void 0:r.data)&&d.Model.TrajectoryInfo.get(m).size>1&&(f=(null===(n=e.cell.obj)||void 0===n?void 0:n.data.entryId)+" | Model "+(d.Model.TrajectoryInfo.get(m).index+1)+" of "+d.Model.TrajectoryInfo.get(m).size),f=(null===(i=e.cell.obj)||void 0===i?void 0:i.data.entryId)+" | "+(null===(a=e.cell.obj)||void 0===a?void 0:a.label);break;case"structure":var m;if((m=null===(o=e.cell.obj)||void 0===o?void 0:o.data.models[0])&&d.Model.TrajectoryInfo.get(m).size>1){f=m.entryId+" | "+(null===(s=e.cell.obj)||void 0===s?void 0:s.label)+" (Model "+(d.Model.TrajectoryInfo.get(m).index+1)+" of "+d.Model.TrajectoryInfo.get(m).size+")";break}if(m){f=m.entryId+" | "+(null===(u=e.cell.obj)||void 0===u?void 0:u.label);break}f=""+(null===(c=e.cell.obj)||void 0===c?void 0:c.label);break;default:f=null===(l=e.cell.obj)||void 0===l?void 0:l.label}return{kind:"item",label:f||e.kind,selected:p.has(e.cell.transform.ref),value:[e]}},t.getTrajectoryItems=function(e){var r;return 0===e.models.length?t.item(e):Object(n.__spreadArrays)([s.a.Header(null===(r=e.cell.obj)||void 0===r?void 0:r.label)],e.models.map(t.getModelItems))},t.getModelItems=function(e){var r,i,a;if(0===e.structures.length)return t.item(e);if(1===e.structures.length){var o=t.plugin.managers.structure.hierarchy.seletionSet,u=e.structures[0];return{label:(null===(r=e.cell.obj)||void 0===r?void 0:r.label)+" | "+(null===(i=u.cell.obj)||void 0===i?void 0:i.label),selected:o.has(u.cell.transform.ref),value:[e,u]}}return Object(n.__spreadArrays)([s.a.Header(null===(a=e.cell.obj)||void 0===a?void 0:a.label)],e.structures.map(t.item))},t.selectHierarchy=function(e){if(e&&0!==e.length){for(var r=[],n=0,i=e;n<i.length;n++)for(var a=0,o=i[n].value;a<o.length;a++){var s=o[a];r.push(s)}t.plugin.managers.structure.hierarchy.updateCurrent(r,e[0].selected?"remove":"add")}},t.toggleHierarchy=function(){return t.setState({show:"hierarchy"!==t.state.show?"hierarchy":void 0})},t.togglePreset=function(){return t.setState({show:"presets"!==t.state.show?"presets":void 0})},t.applyPreset=function(e){if(t.setState({show:void 0}),e){var r=t.plugin.managers.structure,n=r.hierarchy.selection.trajectories;r.hierarchy.applyPreset(n,e.value)}},t.updateStructureModel=function(e){return Object(n.__awaiter)(t,void 0,void 0,(function(){var t,r;return Object(n.__generator)(this,(function(n){return t=this.plugin.managers.structure.hierarchy.selection,r=t.structures[0].model,this.plugin.state.updateTransform(this.plugin.state.data,r.cell.transform.ref,e,"Model Index"),[2]}))}))},t.updateStructure=function(e){var r=t.plugin.managers.structure.hierarchy.selection.structures[0];return t.plugin.managers.structure.hierarchy.updateStructure(r,e)},t}return Object(n.__extends)(t,e),t.prototype.defaultState=function(){return{header:"Structure",isCollapsed:!1,isBusy:!1,brand:{accent:"purple",svg:g.MoleculeSvg}}},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})}))},Object.defineProperty(t.prototype,"hierarchyItems",{get:function(){var e=this.plugin.managers.structure.hierarchy.current,t=[];return e.trajectories.length>1&&t.push(Object(n.__spreadArrays)([s.a.Header("Trajectories")],e.trajectories.map(this.item))),(e.models.length>1||e.trajectories.length>1)&&t.push(Object(n.__spreadArrays)([s.a.Header("Models")],e.models.map(this.item))),1===e.trajectories.length&&1===e.models.length?t.push.apply(t,e.structures.map(this.item)):e.structures.length>0&&t.push(Object(n.__spreadArrays)([s.a.Header("Structures")],e.structures.map(this.item))),t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isEmpty",{get:function(){var e=this.plugin.managers.structure.hierarchy.current,t=e.structures,r=e.models;return 0===e.trajectories.length&&0===r.length&&0===t.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){var e,t,r,n,i,a,o,s,u,c,l,f,p,m,h=this.plugin.managers.structure.hierarchy.selection,g=h.structures,v=h.models,b=h.trajectories;if(1===g.length)return(null===(t=null===(e=(w=g[0]).model)||void 0===e?void 0:e.trajectory)||void 0===t?void 0:t.models)&&1===w.model.trajectory.models.length?null===(r=w.cell.obj)||void 0===r?void 0:r.data.label:w.model?(null===(n=w.model.cell.obj)||void 0===n?void 0:n.label)+" | "+(null===(i=w.cell.obj)||void 0===i?void 0:i.data.label):null===(a=w.cell.obj)||void 0===a?void 0:a.data.label;if(g.length>1){for(var y=g[0],_=null===(o=null==y?void 0:y.model)||void 0===o?void 0:o.trajectory,S=!0,x=0,O=g;x<O.length;x++){var w;if((null===(s=null==(w=O[x])?void 0:w.model)||void 0===s?void 0:s.trajectory)!==_){S=!1;break}}return S&&_?(null===(u=_.cell.obj)||void 0===u?void 0:u.label)+" | "+g.length+" structures":g.length+" structures"}if(v.length>0){_=v[0].trajectory;if(1===v.length){var C=null===(c=v[0].cell.obj)||void 0===c?void 0:c.data;return C&&d.Model.TrajectoryInfo.get(C).size>1?(null===(l=null==_?void 0:_.cell.obj)||void 0===l?void 0:l.label)+" | Model "+(d.Model.TrajectoryInfo.get(C).index+1)+" of "+d.Model.TrajectoryInfo.get(C).size:(null===(f=null==_?void 0:_.cell.obj)||void 0===f?void 0:f.label)+" | Model"}S=!0;for(var j=0,P=v;j<P.length;j++){if(P[j].trajectory!==_){S=!1;break}}return S?(null===(p=null==_?void 0:_.cell.obj)||void 0===p?void 0:p.label)+" | "+v.length+" models":v.length+" models"}return b.length>0?1===b.length?(null===(m=b[0].cell.obj)||void 0===m?void 0:m.label)+" trajectory":b.length+" trajectories":0===b.length&&0===v.length&&0===g.length?"Nothing Loaded":"Nothing Selected"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"presetActions",{get:function(){var e=[],t=this.plugin.managers.structure.hierarchy.selection.trajectories;if(1!==t.length)return e;for(var r=0,n=this.plugin.builders.structure.hierarchy.getPresets(t[0].cell.obj);r<n.length;r++){var i=n[r];e.push(s.a.Item(i.display.name,i,{description:i.display.description}))}return e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelIndex",{get:function(){var e,t,r=this.plugin.managers.structure.hierarchy.selection;if(1!==r.structures.length)return null;var n=r.structures[0].model;if(!n||n.cell.transform.transformer!==a.StateTransforms.Model.ModelFromTrajectory)return null;if(!n.cell.obj||d.Model.TrajectoryInfo.get(n.cell.obj.data).size<=1)return null;var o=null===(e=n.cell.params)||void 0===e?void 0:e.definition;return o?i.createElement(c.ParameterControls,{params:o,values:null===(t=n.cell.params)||void 0===t?void 0:t.values,onChangeValues:this.updateStructureModel,isDisabled:this.state.isBusy}):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"structureType",{get:function(){var e,t=this.plugin.managers.structure.hierarchy.selection;if(1!==t.structures.length)return null;var r=t.structures[0];return(null===(e=r.cell.params)||void 0===e?void 0:e.definition)&&r.cell.parent?i.createElement(_.UpdateTransformControl,{state:r.cell.parent,transform:r.cell.transform,customHeader:"none",customUpdate:this.updateStructure,noMargin:!0,autoHideApply:!0}):null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"transform",{get:function(){var e=this.plugin.managers.structure.hierarchy.selection;if(1!==e.structures.length)return null;var t=e.structures[0];if(!t.cell.parent)return null;var r=x.StateSelection.tryFindDecorator(this.plugin.state.data,t.cell.transform.ref,a.StateTransforms.Model.TransformStructureConformation);return r?i.createElement(u.ExpandGroup,{header:"Conformation Transform"},i.createElement(_.UpdateTransformControl,{state:r.parent,transform:r.transform,customHeader:"none",noMargin:!0,autoHideApply:!0})):void 0},enumerable:!1,configurable:!0}),t.prototype.renderControls=function(){var e=this.state.isBusy||this.isEmpty,t=this.presetActions,r=this.label;return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row",style:{marginTop:"1px"}},i.createElement(u.Button,{noOverflow:!0,flex:!0,onClick:this.toggleHierarchy,disabled:e,title:r},r),t.length>0&&i.createElement(u.IconButton,{svg:g.BookmarksOutlinedSvg,className:"msp-form-control",flex:"40px",onClick:this.togglePreset,title:"Apply a structure presets to the current hierarchy.",toggleState:"presets"===this.state.show,disabled:e})),"hierarchy"===this.state.show&&i.createElement(s.a,{items:this.hierarchyItems,onSelect:this.selectHierarchy,multiselect:!0}),"presets"===this.state.show&&i.createElement(s.a,{items:t,onSelect:this.applyPreset}),this.modelIndex,this.structureType,this.transform,i.createElement("div",{style:{marginTop:"6px"}},i.createElement(y,null),i.createElement(S.StructureSelectionStatsControls,{hideOnEmpty:!0})))},t}(o.CollapsableControls)},function(e,t,r){"use strict";r.r(t),r.d(t,"SimpleSettingsControl",(function(){return h}));var n=r(0),i=r(158),a=r(3),o=r(146),s=r(27),u=r(13),c=r(24),l=r(2);var d,f=r(33),p=r(73),m=r(195),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.canvas3d.camera.stateChanged,(function(t){void 0===t.radiusMax&&void 0===t.radius||e.forceUpdate()}))},t.prototype.render=function(){return this.plugin.canvas3d?a.createElement(a.Fragment,null,a.createElement(p.ParameterMappingControl,{mapping:b}),a.createElement(m.ViewportHelpContent,null)):null},t}(f.PluginUIComponent),g={sequence:"Sequence",log:"Log",left:"Left Panel"},v={spin:l.ParamDefinition.Group({spin:o.Canvas3DParams.trackball.params.spin,speed:o.Canvas3DParams.trackball.params.spinSpeed},{pivot:"spin"}),camera:o.Canvas3DParams.camera,background:l.ParamDefinition.Group({color:l.ParamDefinition.Color(Object(c.Color)(16579577),{label:"Background",description:"Custom background color"}),transparent:l.ParamDefinition.Boolean(!1)},{pivot:"color"}),lighting:l.ParamDefinition.Group({renderStyle:o.Canvas3DParams.renderer.params.style,occlusion:o.Canvas3DParams.postprocessing.params.occlusion,outline:o.Canvas3DParams.postprocessing.params.outline,fog:o.Canvas3DParams.cameraFog},{pivot:"renderStyle"}),clipping:l.ParamDefinition.Group(Object(n.__assign)(Object(n.__assign)({},o.Canvas3DParams.cameraClipping.params),o.Canvas3DParams.renderer.params.clip.params),{pivot:"radius"}),layout:l.ParamDefinition.MultiSelect([],l.ParamDefinition.objectToOptions(g))},b=(d={params:function(e){var t,r=l.ParamDefinition.clone(v),n=null===(t=e.spec.layout)||void 0===t?void 0:t.controls;if(n){var i=[];"none"!==n.top&&i.push(["sequence",g.sequence]),"none"!==n.bottom&&i.push(["log",g.log]),"none"!==n.left&&i.push(["left",g.left]),r.layout.options=i}return r},target:function(e){var t,r,n=null===(t=e.spec.layout)||void 0===t?void 0:t.controls,i=e.layout.state.regionState,a=[];return"hidden"===i.top||n&&"none"===n.top||a.push("sequence"),"hidden"===i.bottom||n&&"none"===n.bottom||a.push("log"),"hidden"===i.left||n&&"none"===n.left||a.push("left"),{canvas:null===(r=e.canvas3d)||void 0===r?void 0:r.props,layout:a}}},function(e){var t=e.values,r=e.update,n=e.apply;return{params:"function"==typeof d.params?d.params:function(e){return d.params},getTarget:d.target,getValues:t,update:function(e,t){var n=d.target(t);return Object(i.b)(n,(function(n){return r(e,n,t)}))},apply:n||function(){}}})({values:function(e,t){var r=e.canvas,i=r.renderer;return{layout:e.layout,spin:{spin:!!r.trackball.spin,speed:r.trackball.spinSpeed},camera:r.camera,background:{color:i.backgroundColor,transparent:r.transparentBackground},lighting:{renderStyle:i.style,occlusion:r.postprocessing.occlusion,outline:r.postprocessing.outline,fog:r.cameraFog},clipping:Object(n.__assign)(Object(n.__assign)({},r.cameraClipping),r.renderer.clip)}},update:function(e,t){var r=t.canvas;r.trackball.spin=e.spin.spin,r.trackball.spinSpeed=e.spin.speed,r.camera=e.camera,r.transparentBackground=e.background.transparent,r.renderer.backgroundColor=e.background.color,r.renderer.style=e.lighting.renderStyle,r.postprocessing.occlusion=e.lighting.occlusion,r.postprocessing.outline=e.lighting.outline,r.cameraFog=e.lighting.fog,r.cameraClipping={radius:e.clipping.radius,far:e.clipping.far},r.renderer.clip={variant:e.clipping.variant,objects:e.clipping.objects},t.layout=e.layout},apply:function(e,t){return Object(n.__awaiter)(this,void 0,void 0,(function(){var r,a;return Object(n.__generator)(this,(function(n){switch(n.label){case 0:return[4,s.PluginCommands.Canvas3D.SetSettings(t,{settings:e.canvas})];case 1:return n.sent(),r=e.layout.indexOf("left")<0,a=Object(i.b)(t.layout.state,(function(n){n.regionState.top=e.layout.indexOf("sequence")>=0?"full":"hidden",n.regionState.bottom=e.layout.indexOf("log")>=0?"full":"hidden",n.regionState.left=r?"hidden":"none"===t.behaviors.layout.leftPanelTabName.value?"collapsed":"full"})),[4,s.PluginCommands.Layout.Update(t,{state:a})];case 2:return n.sent(),r&&s.PluginCommands.State.SetCurrentObject(t,{state:t.state.data,ref:u.StateTransform.RootRef}),[2]}}))}))}})},function(e,t,r){"use strict";r.d(t,"a",(function(){return m}));var n=r(105),i=r(1),a=r(24),o=r(5),s=r(2),u=r(85),c=r(42),l=r(44),d=r(204),f=r(29),p=r(70),m={backgroundColor:s.ParamDefinition.Color(Object(a.Color)(0),{description:"Background color of the 3D canvas"}),pickingAlphaThreshold:s.ParamDefinition.Numeric(.5,{min:0,max:1,step:.01},{description:"The minimum opacity value needed for an object to be pickable."}),interiorDarkening:s.ParamDefinition.Numeric(.5,{min:0,max:1,step:.01}),interiorColorFlag:s.ParamDefinition.Boolean(!0,{label:"Use Interior Color"}),interiorColor:s.ParamDefinition.Color(a.Color.fromNormalizedRgb(.3,.3,.3)),highlightColor:s.ParamDefinition.Color(a.Color.fromNormalizedRgb(1,.4,.6)),selectColor:s.ParamDefinition.Color(a.Color.fromNormalizedRgb(.2,1,.1)),xrayEdgeFalloff:s.ParamDefinition.Numeric(1,{min:0,max:3,step:.1}),style:s.ParamDefinition.MappedStatic("matte",{custom:s.ParamDefinition.Group({lightIntensity:s.ParamDefinition.Numeric(.6,{min:0,max:1,step:.01}),ambientIntensity:s.ParamDefinition.Numeric(.4,{min:0,max:1,step:.01}),metalness:s.ParamDefinition.Numeric(0,{min:0,max:1,step:.01}),roughness:s.ParamDefinition.Numeric(1,{min:0,max:1,step:.01}),reflectivity:s.ParamDefinition.Numeric(.5,{min:0,max:1,step:.01})},{isExpanded:!0}),flat:s.ParamDefinition.Group({}),matte:s.ParamDefinition.Group({}),glossy:s.ParamDefinition.Group({}),metallic:s.ParamDefinition.Group({}),plastic:s.ParamDefinition.Group({})},{label:"Lighting",description:"Style in which the 3D scene is rendered/lighted"}),clip:s.ParamDefinition.Group({variant:s.ParamDefinition.Select("instance",s.ParamDefinition.arrayToOptions(["instance","pixel"])),objects:s.ParamDefinition.ObjectList({type:s.ParamDefinition.Select("plane",s.ParamDefinition.objectToOptions(u.a.Type,(function(e){return Object(c.d)(e)}))),invert:s.ParamDefinition.Boolean(!1),position:s.ParamDefinition.Vec3(Object(i.Vec3)()),rotation:s.ParamDefinition.Group({axis:s.ParamDefinition.Vec3(i.Vec3.create(1,0,0)),angle:s.ParamDefinition.Numeric(0,{min:-180,max:180,step:1},{description:"Angle in Degrees"})},{isExpanded:!0}),scale:s.ParamDefinition.Vec3(i.Vec3.create(1,1,1))},(function(e){return Object(c.d)(e.type)}))})};function h(e){switch(e.name){case"custom":return e.params;case"flat":return{lightIntensity:0,ambientIntensity:1,metalness:0,roughness:.4,reflectivity:.5};case"matte":return{lightIntensity:.7,ambientIntensity:.3,metalness:0,roughness:1,reflectivity:.5};case"glossy":return{lightIntensity:.7,ambientIntensity:.3,metalness:0,roughness:.4,reflectivity:.5};case"metallic":return{lightIntensity:.7,ambientIntensity:.7,metalness:.6,roughness:.6,reflectivity:.5};case"plastic":return{lightIntensity:.7,ambientIntensity:.3,metalness:0,roughness:.2,reflectivity:.5}}}var g,v=Object(i.Quat)();function b(e,t){for(var r=(null==t?void 0:t.objects)||{type:new Array(5).fill(1),invert:new Array(5).fill(!1),position:new Array(15).fill(0),rotation:new Array(20).fill(0),scale:new Array(15).fill(1)},n=r.type,a=r.invert,o=r.position,s=r.rotation,c=r.scale,d=0,f=e.objects.length;d<f;++d){var p=e.objects[d];n[d]=u.a.Type[p.type],a[d]=p.invert,i.Vec3.toArray(p.position,o,3*d),i.Quat.toArray(i.Quat.setAxisAngle(v,p.rotation.axis,Object(l.c)(p.rotation.angle)),s,4*d),i.Vec3.toArray(p.scale,c,3*d)}return{variant:e.variant,objects:{count:e.objects.length,type:n,invert:a,position:o,rotation:s,scale:c}}}!function(e){e.create=function(e,t){void 0===t&&(t={});var r=e.gl,u=e.state,c=e.stats,l=e.extensions.fragDepth,g=s.ParamDefinition.merge(m,s.ParamDefinition.getDefaultValues(m),t),v=h(g.style),y=b(g.clip),_=Object(n.a)(),S=i.Vec2.create(r.drawingBufferWidth,r.drawingBufferHeight),x=a.Color.toVec3Normalized(Object(i.Vec3)(),g.backgroundColor),O=!1,w=Object(d.a)(r,"image-depth"),C=[["tDepth",w]],j=Object(i.Mat4)(),P=Object(i.Mat4)(),E=Object(i.Mat4)(),A=Object(i.Mat4)(),D=Object(i.Mat4)(),T=Object(i.Mat4)(),I=Object(i.Mat4)(),M=Object(i.Vec3)(),k=Object(i.Vec2)(),B={uModel:o.e.create(i.Mat4.identity()),uView:o.e.create(j),uInvView:o.e.create(P),uModelView:o.e.create(E),uInvModelView:o.e.create(A),uInvProjection:o.e.create(D),uProjection:o.e.create(Object(i.Mat4)()),uModelViewProjection:o.e.create(T),uInvModelViewProjection:o.e.create(I),uIsOrtho:o.e.create(1),uViewOffset:o.e.create(k),uPixelRatio:o.e.create(e.pixelRatio),uViewportHeight:o.e.create(_.height),uViewport:o.e.create(n.a.toVec4(Object(i.Vec4)(),_)),uDrawingBufferSize:o.e.create(S),uCameraPosition:o.e.create(Object(i.Vec3)()),uCameraDir:o.e.create(M),uNear:o.e.create(1),uFar:o.e.create(1e4),uFogNear:o.e.create(1),uFogFar:o.e.create(1e4),uFogColor:o.e.create(x),uRenderWboit:o.e.create(!1),uTransparentBackground:o.e.create(!1),uClipObjectType:o.e.create(y.objects.type),uClipObjectInvert:o.e.create(y.objects.invert),uClipObjectPosition:o.e.create(y.objects.position),uClipObjectRotation:o.e.create(y.objects.rotation),uClipObjectScale:o.e.create(y.objects.scale),uLightIntensity:o.e.create(v.lightIntensity),uAmbientIntensity:o.e.create(v.ambientIntensity),uMetalness:o.e.create(v.metalness),uRoughness:o.e.create(v.roughness),uReflectivity:o.e.create(v.reflectivity),uPickingAlphaThreshold:o.e.create(g.pickingAlphaThreshold),uInteriorDarkening:o.e.create(g.interiorDarkening),uInteriorColorFlag:o.e.create(g.interiorColorFlag),uInteriorColor:o.e.create(a.Color.toVec3Normalized(Object(i.Vec3)(),g.interiorColor)),uHighlightColor:o.e.create(a.Color.toVec3Normalized(Object(i.Vec3)(),g.highlightColor)),uSelectColor:o.e.create(a.Color.toVec3Normalized(Object(i.Vec3)(),g.selectColor)),uXrayEdgeFalloff:o.e.create(g.xrayEdgeFalloff)},V=Object.entries(B),R=!0,L=function(e,t){if(!e.state.disposed&&e.state.visible&&(e.state.pickable||"p"!==t[0])){var n=!1;e.state.noClip?0!==e.values.dClipObjectCount.ref.value&&(o.e.update(e.values.dClipObjectCount,0),n=!0):(e.values.dClipObjectCount.ref.value!==y.objects.count&&(o.e.update(e.values.dClipObjectCount,y.objects.count),n=!0),e.values.dClipVariant.ref.value!==y.variant&&(o.e.update(e.values.dClipVariant,y.variant),n=!0)),n&&e.update();var i=e.getProgram(t);u.currentProgramId!==i.id&&(R=!0,i.use()),R&&(i.setUniforms(V),R=!1),e.values.dRenderMode?(u.disable(r.CULL_FACE),u.frontFace(r.CCW),"colorBlended"===t&&("volume"!==e.values.dRenderMode.ref.value&&l?(u.enable(r.DEPTH_TEST),u.depthMask(1===e.values.uAlpha.ref.value)):(u.disable(r.DEPTH_TEST),u.depthMask(!1)))):(e.values.dDoubleSided?e.values.dDoubleSided.ref.value||e.values.hasReflection.ref.value?u.disable(r.CULL_FACE):u.enable(r.CULL_FACE):u.disable(r.CULL_FACE),e.values.dFlipSided&&e.values.dFlipSided.ref.value?(u.frontFace(r.CW),u.cullFace(r.FRONT)):(u.frontFace(r.CCW),u.cullFace(r.BACK))),e.render(t,C)}},N=function(e,t,n,a){Object(f.arrayMapUpsert)(C,"tDepth",n||w),o.e.update(B.uModel,e.view),o.e.update(B.uModelView,i.Mat4.mul(E,e.view,t.view)),o.e.update(B.uInvModelView,i.Mat4.invert(A,E)),o.e.update(B.uModelViewProjection,i.Mat4.mul(T,E,t.projection)),o.e.update(B.uInvModelViewProjection,i.Mat4.invert(I,T)),o.e.updateIfChanged(B.uRenderWboit,a),u.enable(r.SCISSOR_TEST),u.colorMask(!0,!0,!0,!0);var s=_.x,c=_.y,l=_.width,d=_.height;r.viewport(s,c,l,d),r.scissor(s,c,l,d),R=!0,u.currentRenderItemId=-1},F=function(e,t,n){u.disable(r.BLEND),u.enable(r.DEPTH_TEST),u.depthMask(!0),N(e,t,n,!1);for(var i=e.renderables,a=0,o=i.length;a<o;++a){var s=i[a];s.state.opaque&&L(s,"colorBlended")}},U=function(e,t,n){u.enable(r.DEPTH_TEST),N(e,t,n,!1);var i=e.renderables;O?u.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA):u.blendFuncSeparate(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA),u.enable(r.BLEND),u.depthMask(!0);for(var a=0,o=i.length;a<o;++a){!(s=i[a]).state.opaque&&s.state.writeDepth&&L(s,"colorBlended")}u.depthMask(!1);for(a=0,o=i.length;a<o;++a){var s;(s=i[a]).state.opaque||s.state.writeDepth||L(s,"colorBlended")}};return{clear:function(e){u.enable(r.SCISSOR_TEST),u.enable(r.DEPTH_TEST),u.colorMask(!0,!0,!0,!0),u.depthMask(!0),O?u.clearColor(0,0,0,0):e?u.clearColor(x[0],x[1],x[2],1):u.clearColor(1,1,1,1),r.clear(r.COLOR_BUFFER_BIT|r.DEPTH_BUFFER_BIT)},clearDepth:function(){u.enable(r.SCISSOR_TEST),u.enable(r.DEPTH_TEST),u.depthMask(!0),r.clear(r.DEPTH_BUFFER_BIT)},update:function(e){o.e.update(B.uView,e.view),o.e.update(B.uInvView,i.Mat4.invert(P,e.view)),o.e.update(B.uProjection,e.projection),o.e.update(B.uInvProjection,i.Mat4.invert(D,e.projection)),o.e.updateIfChanged(B.uIsOrtho,"orthographic"===e.state.mode?1:0),o.e.update(B.uViewOffset,e.viewOffset.enabled?i.Vec2.set(k,16*e.viewOffset.offsetX,16*e.viewOffset.offsetY):i.Vec2.set(k,0,0)),o.e.update(B.uCameraPosition,e.state.position),o.e.update(B.uCameraDir,i.Vec3.normalize(M,i.Vec3.sub(M,e.state.target,e.state.position))),o.e.updateIfChanged(B.uFar,e.far),o.e.updateIfChanged(B.uNear,e.near),o.e.updateIfChanged(B.uFogFar,e.fogFar),o.e.updateIfChanged(B.uFogNear,e.fogNear),o.e.updateIfChanged(B.uTransparentBackground,O)},renderPick:function(e,t,n,i){u.disable(r.BLEND),u.enable(r.DEPTH_TEST),u.depthMask(!0),N(e,t,i,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o)a[o].state.colorOnly||L(a[o],n)},renderDepth:function(e,t,n){u.disable(r.BLEND),u.enable(r.DEPTH_TEST),u.depthMask(!0),N(e,t,n,!1);for(var i=e.renderables,a=0,o=i.length;a<o;++a)L(i[a],"depth")},renderBlended:function(e,t,r){F(e,t,r),U(e,t,r)},renderBlendedOpaque:F,renderBlendedTransparent:U,renderBlendedVolumeOpaque:function(e,t,n){var i;u.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),u.enable(r.BLEND),N(e,t,n,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var c=a[o];1!==Object(p.a)(c.values.alpha.ref.value*c.state.alphaFactor,0,1)||1===c.values.transparencyAverage.ref.value||(null===(i=c.values.dXrayShaded)||void 0===i?void 0:i.ref.value)||L(c,"colorBlended")}},renderBlendedVolumeTransparent:function(e,t,n){var i;u.blendFunc(r.ONE,r.ONE_MINUS_SRC_ALPHA),u.enable(r.BLEND),N(e,t,n,!1);for(var a=e.renderables,o=0,s=a.length;o<s;++o){var c=a[o];(Object(p.a)(c.values.alpha.ref.value*c.state.alphaFactor,0,1)<1||c.values.transparencyAverage.ref.value>0||(null===(i=c.values.dXrayShaded)||void 0===i?void 0:i.ref.value))&&L(c,"colorBlended")}},renderWboitOpaque:function(e,t,n){var i,a,o;u.disable(r.BLEND),u.enable(r.DEPTH_TEST),u.depthMask(!0),N(e,t,n,!1);for(var s=e.renderables,c=0,l=s.length;c<l;++c){var d=s[c];1!==Object(p.a)(d.values.alpha.ref.value*d.state.alphaFactor,0,1)||1===d.values.transparencyAverage.ref.value||"volume"===(null===(i=d.values.dRenderMode)||void 0===i?void 0:i.ref.value)||(null===(a=d.values.dPointFilledCircle)||void 0===a?void 0:a.ref.value)||(null===(o=d.values.dXrayShaded)||void 0===o?void 0:o.ref.value)||L(d,"colorWboit")}},renderWboitTransparent:function(e,t,r){var n,i,a;N(e,t,r,!0);for(var o=e.renderables,s=0,u=o.length;s<u;++s){var c=o[s];(Object(p.a)(c.values.alpha.ref.value*c.state.alphaFactor,0,1)<1||c.values.transparencyAverage.ref.value>0||"volume"===(null===(n=c.values.dRenderMode)||void 0===n?void 0:n.ref.value)||(null===(i=c.values.dPointFilledCircle)||void 0===i?void 0:i.ref.value)||c.values.uBackgroundColor||(null===(a=c.values.dXrayShaded)||void 0===a?void 0:a.ref.value))&&L(c,"colorWboit")}},setProps:function(e){void 0!==e.backgroundColor&&e.backgroundColor!==g.backgroundColor&&(g.backgroundColor=e.backgroundColor,a.Color.toVec3Normalized(x,g.backgroundColor),o.e.update(B.uFogColor,i.Vec3.copy(B.uFogColor.ref.value,x))),void 0!==e.pickingAlphaThreshold&&e.pickingAlphaThreshold!==g.pickingAlphaThreshold&&(g.pickingAlphaThreshold=e.pickingAlphaThreshold,o.e.update(B.uPickingAlphaThreshold,g.pickingAlphaThreshold)),void 0!==e.interiorDarkening&&e.interiorDarkening!==g.interiorDarkening&&(g.interiorDarkening=e.interiorDarkening,o.e.update(B.uInteriorDarkening,g.interiorDarkening)),void 0!==e.interiorColorFlag&&e.interiorColorFlag!==g.interiorColorFlag&&(g.interiorColorFlag=e.interiorColorFlag,o.e.update(B.uInteriorColorFlag,g.interiorColorFlag)),void 0!==e.interiorColor&&e.interiorColor!==g.interiorColor&&(g.interiorColor=e.interiorColor,o.e.update(B.uInteriorColor,a.Color.toVec3Normalized(B.uInteriorColor.ref.value,g.interiorColor))),void 0!==e.highlightColor&&e.highlightColor!==g.highlightColor&&(g.highlightColor=e.highlightColor,o.e.update(B.uHighlightColor,a.Color.toVec3Normalized(B.uHighlightColor.ref.value,g.highlightColor))),void 0!==e.selectColor&&e.selectColor!==g.selectColor&&(g.selectColor=e.selectColor,o.e.update(B.uSelectColor,a.Color.toVec3Normalized(B.uSelectColor.ref.value,g.selectColor))),void 0!==e.xrayEdgeFalloff&&e.xrayEdgeFalloff!==g.xrayEdgeFalloff&&(g.xrayEdgeFalloff=e.xrayEdgeFalloff,o.e.update(B.uXrayEdgeFalloff,g.xrayEdgeFalloff)),void 0!==e.style&&(g.style=e.style,Object.assign(v,h(e.style)),o.e.updateIfChanged(B.uLightIntensity,v.lightIntensity),o.e.updateIfChanged(B.uAmbientIntensity,v.ambientIntensity),o.e.updateIfChanged(B.uMetalness,v.metalness),o.e.updateIfChanged(B.uRoughness,v.roughness),o.e.updateIfChanged(B.uReflectivity,v.reflectivity)),void 0===e.clip||Object(o.g)(e.clip,g.clip)||(g.clip=e.clip,Object.assign(y,b(e.clip,y)),o.e.update(B.uClipObjectPosition,y.objects.position),o.e.update(B.uClipObjectRotation,y.objects.rotation),o.e.update(B.uClipObjectScale,y.objects.scale),o.e.update(B.uClipObjectType,y.objects.type))},setViewport:function(e,t,a,s){r.viewport(e,t,a,s),r.scissor(e,t,a,s),e===_.x&&t===_.y&&a===_.width&&s===_.height||(n.a.set(_,e,t,a,s),o.e.update(B.uViewportHeight,s),o.e.update(B.uViewport,i.Vec4.set(B.uViewport.ref.value,e,t,a,s)))},setTransparentBackground:function(e){O=e},setDrawingBufferSize:function(e,t){e===S[0]&&t===S[1]||o.e.update(B.uDrawingBufferSize,i.Vec2.set(S,e,t))},props:g,get stats(){return{programCount:e.stats.resourceCounts.program,shaderCount:e.stats.resourceCounts.shader,attributeCount:e.stats.resourceCounts.attribute,elementsCount:e.stats.resourceCounts.elements,framebufferCount:e.stats.resourceCounts.framebuffer,renderbufferCount:e.stats.resourceCounts.renderbuffer,textureCount:e.stats.resourceCounts.texture,vertexArrayCount:e.stats.resourceCounts.vertexArray,drawCount:c.drawCount,instanceCount:c.instanceCount,instancedDrawCount:c.instancedDrawCount}},dispose:function(){}}}}(g||(g={})),t.b=g},function(e,t,r){"use strict";r.d(t,"b",(function(){return m})),r.d(t,"a",(function(){return n}));var n,i=r(0),a=r(1),o=r(105),s=r(90),u=r(2),c=r(44),l=r(61),d=(s.a,s.b),f=l.a.Trigger,p={dragRotate:Object(l.a)([f(1,d.create())],"Rotate","Drag using ${triggers}"),dragRotateZ:Object(l.a)([f(1,d.create({shift:!0}))],"Rotate around z-axis","Drag using ${triggers}"),dragPan:Object(l.a)([f(2,d.create()),f(1,d.create({control:!0}))],"Pan","Drag using ${triggers}"),dragZoom:l.a.Empty,dragFocus:Object(l.a)([f(8,d.create())],"Focus","Drag using ${triggers}"),dragFocusZoom:Object(l.a)([f(4,d.create())],"Focus and zoom","Drag using ${triggers}"),scrollZoom:Object(l.a)([f(4,d.create())],"Zoom","Scroll using ${triggers}"),scrollFocus:Object(l.a)([f(4,d.create({shift:!0}))],"Clip","Scroll using ${triggers}"),scrollFocusZoom:l.a.Empty},m={noScroll:u.ParamDefinition.Boolean(!0,{isHidden:!0}),rotateSpeed:u.ParamDefinition.Numeric(5,{min:1,max:10,step:1}),zoomSpeed:u.ParamDefinition.Numeric(7,{min:1,max:15,step:1}),panSpeed:u.ParamDefinition.Numeric(1,{min:.1,max:5,step:.1}),spin:u.ParamDefinition.Boolean(!1,{description:"Spin the 3D scene around the x-axis in view space"}),spinSpeed:u.ParamDefinition.Numeric(1,{min:-20,max:20,step:1}),staticMoving:u.ParamDefinition.Boolean(!0,{isHidden:!0}),dynamicDampingFactor:u.ParamDefinition.Numeric(.2,{},{isHidden:!0}),minDistance:u.ParamDefinition.Numeric(.01,{},{isHidden:!0}),maxDistance:u.ParamDefinition.Numeric(1e150,{},{isHidden:!0}),bindings:u.ParamDefinition.Value(p,{isHidden:!0})};!function(e){e.create=function(e,t,r){void 0===r&&(r={});var n=Object(i.__assign)(Object(i.__assign)({},u.ParamDefinition.getDefaultValues(m)),r),s=o.a.clone(t.viewport),d=!1,f=e.drag.subscribe((function(e){var r=e.x,i=e.y,o=e.pageX,u=e.pageY,c=e.buttons,d=e.modifiers,f=e.isStart,p=Y(r,i);if(f&&p)return;if(!f&&!v)return;v=!0;var m=l.a.match(n.bindings.dragRotate,c,d),h=l.a.match(n.bindings.dragRotateZ,c,d),g=l.a.match(n.bindings.dragPan,c,d),b=l.a.match(n.bindings.dragZoom,c,d),y=l.a.match(n.bindings.dragFocus,c,d),x=l.a.match(n.bindings.dragFocusZoom,c,d);(function(e,t){a.Vec2.set(R,(e-.5*s.width-s.x)/(.5*s.width),(s.height+2*(s.y-t))/s.width)})(o,u),function(e,t){a.Vec2.set(V,(e-s.x)/s.width,(t-s.y)/s.height)}(o,u),f&&(m&&(a.Vec2.copy(S,R),a.Vec2.copy(_,S)),h&&(a.Vec2.copy(C,R),a.Vec2.copy(w,C)),(b||x)&&(a.Vec2.copy(P,V),a.Vec2.copy(E,P)),y&&(a.Vec2.copy(A,V),a.Vec2.copy(D,A)),g&&(a.Vec2.copy(T,V),a.Vec2.copy(I,T)));m&&a.Vec2.copy(S,R);h&&a.Vec2.copy(C,R);(b||x)&&a.Vec2.copy(E,V);y&&a.Vec2.copy(D,V);if(x){var O=a.Vec3.distance(t.state.position,t.state.target);t.setState({radius:O/5})}g&&a.Vec2.copy(I,V)})),p=e.interactionEnd.subscribe((function(){v=!1})),h=e.wheel.subscribe((function(e){var t=e.x,r=e.y,i=e.dx,a=e.dy,o=e.dz,s=e.buttons,u=e.modifiers;if(Y(t,r))return;var d=Object(c.a)(i,a,o);l.a.match(n.bindings.scrollZoom,s,u)&&(E[1]+=1e-4*d);l.a.match(n.bindings.scrollFocus,s,u)&&(D[1]+=1e-4*d)})),g=e.pinch.subscribe((function(e){var t=e.fraction,r=e.buttons,i=e.modifiers;l.a.match(n.bindings.scrollZoom,r,i)&&(v=!0,E[1]+=.1*(t-1))})),v=!1,b=Object(a.Vec3)(),y=Object(a.Vec3)(),_=Object(a.Vec2)(),S=Object(a.Vec2)(),x=Object(a.Vec3)(),O=0,w=Object(a.Vec2)(),C=Object(a.Vec2)(),j=0,P=Object(a.Vec2)(),E=Object(a.Vec2)(),A=Object(a.Vec2)(),D=Object(a.Vec2)(),T=Object(a.Vec2)(),I=Object(a.Vec2)(),M=a.Vec3.clone(t.target),k=a.Vec3.clone(t.position),B=a.Vec3.clone(t.up),V=Object(a.Vec2)(),R=Object(a.Vec2)(),L=Object(a.Vec3)(),N=Object(a.Quat)(),F=Object(a.Vec3)(),U=Object(a.Vec3)(),z=Object(a.Vec3)(),H=Object(a.Vec3)(),G=Object(a.Quat)(),q=Object(a.Vec2)(),W=Object(a.Vec3)(),X=Object(a.Vec3)();function Y(t,r){return t*=e.pixelRatio,r*=e.pixelRatio,t>s.x+s.width||e.height-r>s.y+s.height||t<s.x||e.height-r<s.y}var Q=-1;function K(r){var i,o,s,u,c;Q!==r&&(n.spin&&Q>0&&function(e){if(0===n.spinSpeed)return;var t=(n.spinSpeed||0)/1e3;Z[0]=60*Math.min(Math.abs(e),125)/1e3*t,v||a.Vec2.add(S,_,Z)}(r-Q),a.Vec3.sub(y,t.position,t.target),function(){var r=S[0]-_[0],i=S[1]-_[1];a.Vec3.set(H,r,i,0);var o=e.width/e.height,s=a.Vec3.magnitude(H)*n.rotateSpeed*e.pixelRatio*o;s?(a.Vec3.sub(y,t.position,t.target),a.Vec3.normalize(F,y),a.Vec3.normalize(U,t.up),a.Vec3.normalize(z,a.Vec3.cross(z,U,F)),a.Vec3.setMagnitude(U,U,i),a.Vec3.setMagnitude(z,z,r),a.Vec3.add(H,U,z),a.Vec3.normalize(L,a.Vec3.cross(L,H,y)),a.Quat.setAxisAngle(N,L,s),a.Vec3.transformQuat(y,y,N),a.Vec3.transformQuat(t.up,t.up,N),a.Vec3.copy(x,L),O=s):!n.staticMoving&&O&&(O*=Math.sqrt(1-n.dynamicDampingFactor),a.Vec3.sub(y,t.position,t.target),a.Quat.setAxisAngle(N,x,O),a.Vec3.transformQuat(y,y,N),a.Vec3.transformQuat(t.up,t.up,N)),a.Vec2.copy(_,S)}(),i=C[0]-w[0],o=C[1]-w[1],(s=n.rotateSpeed*(-i+o)*-.05)?(a.Vec3.sub(y,t.position,t.target),a.Quat.setAxisAngle(G,y,s),a.Vec3.transformQuat(t.up,t.up,G),j=s):!n.staticMoving&&j&&(j*=Math.sqrt(1-n.dynamicDampingFactor),a.Vec3.sub(y,t.position,t.target),a.Quat.setAxisAngle(G,y,j),a.Vec3.transformQuat(t.up,t.up,G)),a.Vec2.copy(w,C),1!==(u=1+(E[1]-P[1])*n.zoomSpeed)&&u>0&&a.Vec3.scale(y,y,u),n.staticMoving?a.Vec2.copy(P,E):P[1]+=(E[1]-P[1])*n.dynamicDampingFactor,function(){var e=(D[1]-A[1])*n.zoomSpeed;if(0!==e){var r=Math.max(1,t.state.radius+t.state.radius*e);t.setState({radius:r})}n.staticMoving?a.Vec2.copy(A,D):A[1]+=(D[1]-A[1])*n.dynamicDampingFactor}(),function(){if(a.Vec2.sub(q,a.Vec2.copy(q,I),T),a.Vec2.squaredMagnitude(q)){var r=e.pixelRatio*n.panSpeed;q[0]*=1/t.zoom*t.viewport.width*r,q[1]*=1/t.zoom*t.viewport.height*r,a.Vec3.cross(X,a.Vec3.copy(X,y),t.up),a.Vec3.setMagnitude(X,X,q[0]),a.Vec3.setMagnitude(W,t.up,q[1]),a.Vec3.add(X,X,W),a.Vec3.add(t.position,t.position,X),a.Vec3.add(t.target,t.target,X),n.staticMoving?a.Vec2.copy(T,I):(a.Vec2.sub(q,I,T),a.Vec2.scale(q,q,n.dynamicDampingFactor),a.Vec2.add(T,T,q))}}(),a.Vec3.add(t.position,t.target,y),c=Math.min(Math.max(1e3*t.state.radiusMax,.01),n.maxDistance),a.Vec3.squaredMagnitude(y)>c*c&&(a.Vec3.setMagnitude(y,y,c),a.Vec3.add(t.position,t.target,y),a.Vec2.copy(P,E),a.Vec2.copy(A,D)),a.Vec3.squaredMagnitude(y)<n.minDistance*n.minDistance&&(a.Vec3.setMagnitude(y,y,n.minDistance),a.Vec3.add(t.position,t.target,y),a.Vec2.copy(P,E),a.Vec2.copy(A,D)),a.Vec3.squaredDistance(b,t.position)>a.EPSILON&&a.Vec3.copy(b,t.position),Q=r)}var Z=a.Vec2.create(.005,0);return{viewport:s,get props(){return n},setProps:function(e){Object.assign(n,e)},start:function(e){Q=-1,K(e)},update:K,reset:function(){a.Vec3.copy(t.target,M),a.Vec3.copy(t.position,k),a.Vec3.copy(t.up,B),a.Vec3.sub(y,t.position,t.target),a.Vec3.copy(b,t.position)},dispose:function(){d||(d=!0,f.unsubscribe(),h.unsubscribe(),g.unsubscribe(),p.unsubscribe())}}}}(n||(n={}))},function(e,t,r){"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;function o(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var r,s,u=o(e),c=1;c<arguments.length;c++){for(var l in r=Object(arguments[c]))i.call(r,l)&&(u[l]=r[l]);if(n){s=n(r);for(var d=0;d<s.length;d++)a.call(r,s[d])&&(u[s[d]]=r[s[d]])}}return u}},function(e,t,r){"use strict";var n;r.r(t),r.d(t,"PluginSpec",(function(){return n})),function(e){e.Action=function(e,t){return{action:e,customControl:t&&t.customControl,autoUpdate:t&&t.autoUpdate}},e.Behavior=function(e,t){return void 0===t&&(t={}),{transformer:e,defaultParams:t}}}(n||(n={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ModelInfo=t.QueryHelper=t.LigandView=t.PDBeVolumes=void 0;var n=r(0),i=r(27),a=r(10),o=r(13),s=r(4),u=r(308),c=r(169);!function(e){e.mapParams=function(e,t,r){var i=n.__assign({},e);return i.options.behaviorRef="volume-streaming"+Math.floor(Math.random()*Math.floor(100)),i.options.emContourProvider="pdbe",i.options.serverUrl="https://www.ebi.ac.uk/pdbe/densities",i.options.channelParams.em={opacity:t&&t.em&&t.em.opacity?t.em.opacity:.49,wireframe:!!(t&&t.em&&t.em.wireframe)&&t.em.wireframe},i.options.channelParams["2fo-fc"]={opacity:t&&t["2fo-fc"]&&t["2fo-fc"].opacity?t["2fo-fc"].opacity:.49,wireframe:!!(t&&t["2fo-fc"]&&t["2fo-fc"].wireframe)&&t["2fo-fc"].wireframe},i.options.channelParams["fo-fc(+ve)"]={opacity:t&&t["fo-fc(+ve)"]&&t["fo-fc(+ve)"].opacity?t["fo-fc(+ve)"].opacity:.3,wireframe:!(t&&t["fo-fc(+ve)"]&&t["fo-fc(+ve)"].wireframe)||t["fo-fc(+ve)"].wireframe},i.options.channelParams["fo-fc(-ve)"]={opacity:t&&t["fo-fc(-ve)"]&&t["fo-fc(-ve)"].opacity?t["fo-fc(-ve)"].opacity:.3,wireframe:!(t&&t["fo-fc(-ve)"]&&t["fo-fc(-ve)"].wireframe)||t["fo-fc(-ve)"].wireframe},i},e.displayUsibilityMessage=function(e){i.PluginCommands.Toast.Show(e,{title:"Volume",message:"Streaming enabled, click on a residue or an atom to view the data.",key:"toast-1",timeoutMs:7e3})},e.toggle=function(e){var t=e.state.data,r=t.select(o.StateSelection.Generators.ofTransformer(u.CreateVolumeStreamingInfo))[0];r&&i.PluginCommands.State.ToggleVisibility(e,{state:t,ref:r.transform.ref})}}(t.PDBeVolumes||(t.PDBeVolumes={})),function(e){e.query=function(e){var t,r={"group-by":a.MolScriptBuilder.core.str.concat([a.MolScriptBuilder.struct.atomProperty.core.operatorName(),a.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])};e.auth_seq_id?t=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.auth_seq_id]):e.label_comp_id&&(t=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_comp_id(),e.label_comp_id])),t&&(r["residue-test"]=t),e.auth_asym_id?r["chain-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(),e.auth_asym_id]):e.struct_asym_id&&(r["chain-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(),e.struct_asym_id]));var n=e.show_all?a.MolScriptBuilder.struct.generator.atomGroups(r):a.MolScriptBuilder.struct.filter.first([a.MolScriptBuilder.struct.generator.atomGroups(r)]);return{core:n,surroundings:a.MolScriptBuilder.struct.modifier.includeSurroundings({0:n,radius:5,"as-whole-residues":!0})}},e.branchedQuery=function(e){var t=[];e.atom_site.forEach((function(e){var r={"group-by":a.MolScriptBuilder.core.str.concat([a.MolScriptBuilder.struct.atomProperty.core.operatorName(),a.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()]),"residue-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.auth_seq_id])};t.push(r)}));var r=[];t.forEach((function(e){r.push(a.MolScriptBuilder.struct.generator.atomGroups(e))}));var n=a.MolScriptBuilder.struct.modifier.union([1===r.length?r[0]:a.MolScriptBuilder.struct.combinator.merge(r.map((function(e){return a.MolScriptBuilder.struct.modifier.union([e])})))]);return{core:n,surroundings:a.MolScriptBuilder.struct.modifier.includeSurroundings({0:n,radius:5,"as-whole-residues":!0})}}}(t.LigandView||(t.LigandView={})),function(e){e.getQueryObject=function(e){var t=[];e.forEach((function(e){var r={};if(e.entity_id&&(r["entity-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_entity_id(),e.entity_id])),e.struct_asym_id?r["chain-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(),e.struct_asym_id]):e.auth_asym_id&&(r["chain-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(),e.auth_asym_id])),e.label_comp_id?r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_comp_id(),e.label_comp_id]):e.residue_number?r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_seq_id(),e.residue_number]):e.start_residue_number&&e.end_residue_number&&e.end_residue_number>e.start_residue_number?r["residue-test"]=a.MolScriptBuilder.core.rel.inRange([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_seq_id(),e.start_residue_number,e.end_residue_number]):e.start_residue_number&&e.end_residue_number&&e.end_residue_number===e.start_residue_number?r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_seq_id(),e.start_residue_number]):e.auth_seq_id?r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.auth_seq_id]):e.auth_residue_number&&!e.auth_ins_code_id?r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.auth_residue_number]):e.auth_residue_number&&e.auth_ins_code_id?r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.authResidueId(),a.MolScriptBuilder.struct.type.authResidueId([void 0,e.auth_residue_number,e.auth_ins_code_id])]):e.start_auth_residue_number&&e.end_auth_residue_number&&e.end_auth_residue_number>e.start_auth_residue_number?e.start_auth_ins_code_id&&e.end_auth_ins_code_id?r["residue-test"]=a.MolScriptBuilder.core.rel.inRange([a.MolScriptBuilder.struct.atomProperty.macromolecular.authResidueId(),a.MolScriptBuilder.struct.type.authResidueId([void 0,e.start_auth_residue_number,e.start_auth_ins_code_id]),a.MolScriptBuilder.struct.type.authResidueId([void 0,e.start_auth_residue_number,e.start_auth_ins_code_id])]):r["residue-test"]=a.MolScriptBuilder.core.rel.inRange([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.start_auth_residue_number,e.end_auth_residue_number]):e.start_auth_residue_number&&e.end_auth_residue_number&&e.end_auth_residue_number===e.start_auth_residue_number&&(e.start_auth_ins_code_id?r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.authResidueId(),a.MolScriptBuilder.struct.type.authResidueId([void 0,e.start_auth_residue_number,e.start_auth_ins_code_id])]):r["residue-test"]=a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),e.start_auth_residue_number])),e.atoms){var n=[];e.atoms.forEach((function(e){n.push(a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.ammp("label_atom_id"),e]))})),r["atom-test"]=a.MolScriptBuilder.core.logic.or(n)}t.push(r)}));var r=[];return t.forEach((function(e){r.push(a.MolScriptBuilder.struct.generator.atomGroups(e))})),a.MolScriptBuilder.struct.modifier.union([1===r.length?r[0]:a.MolScriptBuilder.struct.combinator.merge(r.map((function(e){return a.MolScriptBuilder.struct.modifier.union([e])})))])},e.getInteractivityLoci=function(t,r){var n=c.compile(e.getQueryObject(t))(new s.QueryContext(r));return s.StructureSelection.toLociWithSourceUnits(n)},e.getHetLoci=function(e,t){var r=c.compile(e)(new s.QueryContext(t));return s.StructureSelection.toLociWithSourceUnits(r)}}(t.QueryHelper||(t.QueryHelper={})),function(e){e.get=function(e,t){return n.__awaiter(this,void 0,void 0,(function(){var t,r,i,a,o,s,u,c,l,d;return n.__generator(this,(function(n){for(t=e.atomicHierarchy.residues._rowCount,r=e.atomicHierarchy.residueAtomSegments.offsets,i=e.atomicHierarchy.chainAtomSegments.index,a=[],o=0,s=0;s<t;s++)u=i[r[s]],c=e.atomicHierarchy.index.getEntityFromChain(u),"non-polymer"!==(l=e.entities.data.type.value(c))&&"branched"!==l||(d=e.atomicHierarchy.atoms.label_comp_id.value(r[s]),"branched"===l?o++:-1===a.indexOf(d)&&a.push(d));return[2,{hetNames:a,carbEntityCount:o}]}))}))}}(t.ModelInfo||(t.ModelInfo={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DomainAnnotationsColorThemeProvider=t.DomainAnnotationsColorTheme=t.DomainAnnotationsColorThemeParams=void 0;var n=r(410),i=r(4),a=r(24),o=r(2),s=[a.Color.fromRgb(170,170,170),a.Color.fromRgb(255,112,3)];function u(e,t){var r;if(e.structure&&!e.structure.isEmpty&&e.structure.models[0].customProperties.has(n.DomainAnnotationsProvider.descriptor)){var a=n.DomainAnnotations.getDomains,o=t.type.params.kind;r=function(e){return i.StructureElement.Location.is(e)&&a(e).indexOf(o)>=0?s[1]:s[0]}}else r=function(){return s[0]};return{factory:u,granularity:"group",color:r,props:t,description:"Highlights Sequnece and Structure Domain Annotations. Data obtained via PDBe."}}t.DomainAnnotationsColorThemeParams={type:o.ParamDefinition.MappedStatic("",{"":o.ParamDefinition.EmptyGroup()})},t.DomainAnnotationsColorTheme=u,t.DomainAnnotationsColorThemeProvider={name:"pdbe-domain-annotations",label:"Domain annotations",category:"Miscellaneous",factory:u,getParams:function(e){var t=n.DomainAnnotations.getDomainNames(e.structure),r=n.DomainAnnotations.getDomainTypes(e.structure),i={};return r.forEach((function(e,r){t[r].length>0&&(i[e]=o.ParamDefinition.Group({kind:o.ParamDefinition.Select(t[r][0],o.ParamDefinition.arrayToOptions(t[r]))},{isFlat:!0}))})),Object.keys(i).length>0?{type:o.ParamDefinition.MappedStatic(i[0],i)}:{type:o.ParamDefinition.MappedStatic("",{"":o.ParamDefinition.EmptyGroup()})}},defaultValues:o.ParamDefinition.getDefaultValues(t.DomainAnnotationsColorThemeParams),isApplicable:function(e){var t;return n.DomainAnnotations.isApplicable(null===(t=e.structure)||void 0===t?void 0:t.models[0])},ensureCustomProperties:{attach:function(e,t){return t.structure?n.DomainAnnotationsProvider.attach(e,t.structure.models[0],void 0,!0):Promise.resolve()},detach:function(e){return e.structure&&e.structure.models[0].customProperties.reference(n.DomainAnnotationsProvider.descriptor,!1)}}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DomainAnnotationsProvider=t.DomainAnnotationsParams=t.DomainAnnotations=void 0;var n,i=r(0),a=r(4),o=r(248),s=r(316),u=r(2),c=r(29),l=r(119),d=r(66);function f(e,t,r,n,i){var a=function(e,t,r){var n=(0,e.entities.getEntityIndex)(t);if(n<0||!e.entity_index_label_asym_id.has(n))return-1;var i=e.entity_index_label_asym_id.get(n);return i&&i.has(r)?i.get(r):-1}(t,r,n);if(a<0)return-1;var o=t.chain_index_auth_seq_id.get(a);return o.has(i)?o.get(i):-1}!function(e){function r(e,t){return t+"/"+e.toLowerCase()}function n(e,t){return{info:o.PropertyWrapper.createInfo(),data:function(e,t){for(var r=[],n=[],i=new Map,o=["Pfam","InterPro","CATH","SCOP"],s=0,u=Object.keys(t);s<u.length;s++){var l=u[s];if(-1!==o.indexOf(l)){var d=[];r.push(l);for(var p=t[l],m=0,h=Object.keys(p);m<h.length;m++)for(var g=h[m],v=p[g],b=0,y=v.mappings;b<y.length;b++){var _=y[b];c.arraySetAdd(d,v.identifier);for(var S=e.atomicHierarchy.index.map,x=_.start.residue_number;x<=_.end.residue_number;x++){var O=x,w=f(e,S,_.entity_id+"",_.chain_id,O),C=[v.identifier],j=i.get(w);j&&(j.push(v.identifier),C=j),i.set(w,C)}}n.push(d)}}return{domains:a.IndexedCustomProperty.fromResidueMap(i),domainNames:n,domainTypes:r}}(e,t)}}e.DefaultServerUrl="https://www.ebi.ac.uk/pdbe/api/mappings",e.getEntryUrl=r,e.isApplicable=function(e){return!!e&&a.Model.isFromPdbArchive(e)},e.fromJson=n,e.fromServer=function(e,t,a){return i.__awaiter(this,void 0,void 0,(function(){var o,s,u;return i.__generator(this,(function(i){switch(i.label){case 0:return o=l.Asset.getUrlAsset(e.assetManager,r(t.entryId,a.serverUrl)),[4,e.assetManager.resolve(o,"json").runInContext(e.runtime)];case 1:if(s=i.sent(),!(u=s.data[t.entryId.toLowerCase()]))throw new Error("missing data");return[2,{value:n(t,u),assets:[s]}]}}))}))};var s=[];e.getDomains=function(e){if(!a.Unit.isAtomic(e.unit))return s;var r=t.DomainAnnotationsProvider.get(e.unit.model).value;if(!r||!r.data)return s;var n=e.unit.residueIndex[e.element];return r.data.domains.has(n)?r.data.domains.get(n):s},e.getDomainTypes=function(e){if(!e)return s;var r=t.DomainAnnotationsProvider.get(e.models[0]).value;return r&&r.data?r.data.domainTypes:s},e.getDomainNames=function(e){if(!e)return s;var r=t.DomainAnnotationsProvider.get(e.models[0]).value;return r&&r.data?r.data.domainNames:s}}(n||(n={})),t.DomainAnnotations=n,t.DomainAnnotationsParams={serverUrl:u.ParamDefinition.Text(n.DefaultServerUrl,{description:"JSON API Server URL"})},t.DomainAnnotationsProvider=s.CustomModelProperty.createProvider({label:"Domain annotations",descriptor:d.CustomPropertyDescriptor({name:"domain_annotations"}),type:"static",defaultParams:t.DomainAnnotationsParams,getParams:function(e){return t.DomainAnnotationsParams},isApplicable:function(e){return n.isApplicable(e)},obtain:function(e,r,a){return i.__awaiter(void 0,void 0,void 0,(function(){var o;return i.__generator(this,(function(s){switch(s.label){case 0:return o=i.__assign(i.__assign({},u.ParamDefinition.getDefaultValues(t.DomainAnnotationsParams)),a),[4,n.fromServer(e,r,o)];case 1:return[2,s.sent()]}}))}))}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDBeDomainAnnotations=void 0;var n=r(0),i=r(410),a=r(409),o=r(2),s=r(177);t.PDBeDomainAnnotations=s.PluginBehavior.create({name:"pdbe-domain-annotations-prop",category:"custom-props",display:{name:"Domain annotations",description:"Data for domain annotations, obtained via PDBe."},ctor:function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.provider=i.DomainAnnotationsProvider,t.labelDomainAnnotations={label:function(e){}},t}return n.__extends(t,e),t.prototype.register=function(){this.ctx.customModelProperties.register(this.provider,this.params.autoAttach),this.ctx.managers.lociLabels.addProvider(this.labelDomainAnnotations),this.ctx.representation.structure.themes.colorThemeRegistry.add(a.DomainAnnotationsColorThemeProvider)},t.prototype.update=function(e){var t=this.params.autoAttach!==e.autoAttach;return this.params.autoAttach=e.autoAttach,this.params.showTooltip=e.showTooltip,this.ctx.customModelProperties.setDefaultAutoAttach(this.provider.descriptor.name,this.params.autoAttach),t},t.prototype.unregister=function(){this.ctx.customModelProperties.unregister(i.DomainAnnotationsProvider.descriptor.name),this.ctx.managers.lociLabels.removeProvider(this.labelDomainAnnotations),this.ctx.representation.structure.themes.colorThemeRegistry.remove(a.DomainAnnotationsColorThemeProvider)},t}(s.PluginBehavior.Handler),params:function(){return{autoAttach:o.ParamDefinition.Boolean(!1),showTooltip:o.ParamDefinition.Boolean(!0)}}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.renderSuperposition=t.initSuperposition=void 0;var n=r(0),i=r(1),a=r(10),o=r(31),s=r(119),u=r(408),c=r(100),l=r(46),d=r(126);function f(e,t){var r=c.ColorLists,n=e.customState.superpositionState,i=n.colorState[t].palleteIndex,a=n.colorState[t].colorIndex;r[n.colorPalette[i]].list[a+1]?a+=1:(a=0,i=n.colorPalette[i+1]?i+1:0);var o=n.colorPalette[i];return e.customState.superpositionState.colorState[t].palleteIndex=i,e.customState.superpositionState.colorState[t].colorIndex=a,r[o].list[a]}function p(e,t,r){return n.__awaiter(this,void 0,void 0,(function(){var o,s,u,c=this;return n.__generator(this,(function(p){return o=e.customState,s=o.initParams.superpositionParams,u=!1,r.length>1&&(u=!0,o.events.isBusy.next(!0)),[2,e.dataTransaction((function(){return n.__awaiter(c,void 0,void 0,(function(){var c,p,v,b,y,S,x,O,w,C,j,P,E,A,D,T,I,M,k,B,V,R,L,N,F,U,z,H,G,q,W,X,Y,Q,K,Z,J,$,ee,te,re,ne,ie,ae,oe,se,ue,ce,le,de,fe,pe,me,he,ge,ve,be,ye;return n.__generator(this,(function(_e){switch(_e.label){case 0:c=e.customState.superpositionState,_e.label=1;case 1:_e.trys.push([1,41,42,47]),p=n.__asyncValues(r),_e.label=2;case 2:return[4,p.next()];case 3:return(v=_e.sent()).done?[3,40]:(b=v.value,c.matrixData[b.pdb_id+"_"+b.auth_asym_id]?(c.loadedStructs[t].push(b.pdb_id+"_"+b.struct_asym_id),y=o.initParams.pdbeUrl+"model-server/v1/"+b.pdb_id+"/atoms?auth_asym_id="+b.auth_asym_id+"&encoding="+o.initParams.encoding,s&&s.ligandView&&(y="https://www.ebi.ac.uk/pdbe/entry-files/download/"+b.pdb_id+".bcif"),S=void 0,x=void 0,!0,s&&s.ligandView&&c.entries[b.pdb_id]?(O=e.state.data.select(c.entries[b.pdb_id])[0],x=O.transform.parent,w=e.state.data.select(x)[0],[4,e.builders.structure.createStructure(w,{name:"model",params:{}})]):[3,5]):(c.noMatrixStruct.push(b.pdb_id+"_"+b.struct_asym_id),c.invalidStruct.push(b.pdb_id+"_"+b.struct_asym_id),[3,39]));case 4:return S=_e.sent(),!1,[3,7];case 5:return C="bcif"===o.initParams.encoding,[4,h(e,y,"mmcif",C)];case 6:j=_e.sent(),P=j.model,E=j.structure,S=E,x=P.ref,_e.label=7;case 7:return S?(c.models[b.pdb_id+"_"+b.struct_asym_id]||(c.models[b.pdb_id+"_"+b.struct_asym_id]=null==S?void 0:S.ref),s&&s.ligandView&&!c.entries[b.pdb_id]&&(c.entries[b.pdb_id]=null==S?void 0:S.ref),A=i.Mat4.ofRows(e.customState.superpositionState.matrixData[b.pdb_id+"_"+b.auth_asym_id].matrix),[4,g(e,S,A)]):[3,39];case 8:return _e.sent(),D=void 0,s&&s.ligandView&&b.is_representative?(T=f(e,t),[4,e.builders.structure.tryCreateComponentFromExpression(S,(Se=b.struct_asym_id,a.MolScriptBuilder.struct.generator.atomGroups({"chain-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(),Se])})),"Chain-"+t,{label:"Chain",tags:["superposition-sel"]})]):[3,12];case 9:return(D=_e.sent())?[4,e.builders.structure.representation.addRepresentation(D,{type:"putty",color:"uniform",colorParams:{value:T},size:"uniform"},{tag:"superposition-visual"})]:[3,11];case 10:_e.sent(),c.refMaps[D.ref]=b.pdb_id+"_"+b.struct_asym_id,_e.label=11;case 11:return[3,16];case 12:return s&&s.ligandView&&!b.is_representative?[3,16]:[3,13];case 13:return I=f(e,t),[4,e.builders.structure.tryCreateComponentStatic(S,"polymer",{label:"Chain",tags:["Chain-"+t,"superposition-sel"]})];case 14:return(D=_e.sent())?[4,e.builders.structure.representation.addRepresentation(D,{type:"putty",color:"uniform",colorParams:{value:I},size:"uniform"},{tag:"superposition-visual"})]:[3,16];case 15:_e.sent(),c.refMaps[D.ref]=b.pdb_id+"_"+b.struct_asym_id,_e.label=16;case 16:return M=!D,s&&s.ligandView?(k=e.state.data,[4,m(e,k,x)]):[3,39];case 17:if(B=_e.sent(),!((V=B?B.hetNames:[])&&V.length>0))return[3,31];_e.label=18;case 18:_e.trys.push([18,25,26,31]),be=void 0,R=n.__asyncValues(V),_e.label=19;case 19:return[4,R.next()];case 20:return(L=_e.sent()).done?[3,24]:(N=L.value,F=a.MolScriptBuilder.struct.generator.atomGroups({"chain-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(),b.auth_asym_id]),"residue-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.label_comp_id(),N]),"group-by":a.MolScriptBuilder.core.str.concat([a.MolScriptBuilder.struct.atomProperty.core.operatorName(),a.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])}),fe={label:""+N,tags:["superposition-ligand-sel"]},U=l.Color.fromRgb(253,3,253),s&&s.ligandColor&&(z=s.ligandColor,H=z.r,G=z.g,q=z.b,U=l.Color.fromRgb(H,G,q)),[4,e.builders.structure.tryCreateComponentFromExpression(S,F,N+"-"+t,fe)]);case 21:return(pe=_e.sent())?[4,e.builders.structure.representation.addRepresentation(pe,{type:"ball-and-stick",color:"uniform",colorParams:{value:U}},{tag:"superposition-ligand-visual"})]:[3,23];case 22:_e.sent(),c.refMaps[pe.ref]=b.pdb_id+"_"+b.struct_asym_id,M=!1,_e.label=23;case 23:return[3,19];case 24:return[3,31];case 25:return W=_e.sent(),be={error:W},[3,31];case 26:return _e.trys.push([26,,29,30]),L&&!L.done&&(ye=R.return)?[4,ye.call(R)]:[3,28];case 27:_e.sent(),_e.label=28;case 28:return[3,30];case 29:if(be)throw be.error;return[7];case 30:return[7];case 31:return(B?B.carbEntityCount:0)>0?[4,_(e,b.pdb_id)]:[3,38];case 32:X=_e.sent(),Y=a.MolScriptBuilder.struct.modifier.includeSurroundings({0:a.MolScriptBuilder.struct.generator.atomGroups({"entity-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.ammp("entityType"),"polymer"]),"chain-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(),b.auth_asym_id]),"group-by":a.MolScriptBuilder.core.str.concat([a.MolScriptBuilder.struct.atomProperty.core.operatorName(),a.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])}),radius:5,"as-whole-residues":!0}),Q=0,K=0,Z=X.branchedChains,_e.label=33;case 33:if(!(K<Z.length))return[3,38];if(J=Z[K],$=a.MolScriptBuilder.struct.generator.atomGroups({"entity-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.ammp("entityType"),"branched"]),"chain-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(),J]),"group-by":a.MolScriptBuilder.core.str.concat([a.MolScriptBuilder.struct.atomProperty.core.operatorName(),a.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()])}),ee=a.MolScriptBuilder.struct.filter.intersectedBy({0:Y,by:$}),te=e.state.data.select(S.ref)[0].obj.data,!(re=d.Script.getStructureSelection(ee,te))||"sequence"!==re.kind)return[3,36];for(ne=[],ie={},ae=[],oe=0,se=X.branchedLigands[Q];oe<se.length;oe++)ue=se[oe],ce=ue.split("-"),ne.push(a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_seq_id(),+ce[1]])),ie[ce[0]]?ie[ce[0]]++:ie[ce[0]]=1,ae.push(ce[0]);return le=function(e){var t=[];for(var r in e)t.push(r+" ("+e[r]+")");return t.join(", ")}(ie),de=a.MolScriptBuilder.struct.generator.atomGroups({"entity-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.ammp("entityType"),"branched"]),"group-by":a.MolScriptBuilder.core.str.concat([a.MolScriptBuilder.struct.atomProperty.core.operatorName(),a.MolScriptBuilder.struct.atomProperty.macromolecular.residueKey()]),"chain-test":a.MolScriptBuilder.core.rel.eq([a.MolScriptBuilder.struct.atomProperty.macromolecular.auth_asym_id(),J]),"residue-test":a.MolScriptBuilder.core.logic.or(ne)}),fe={label:""+le,tags:["superposition-carb-sel"]},[4,e.builders.structure.tryCreateComponentFromExpression(S,de,ae.join("-")+"-"+t,fe)];case 34:return(pe=_e.sent())?[4,e.builders.structure.representation.addRepresentation(pe,{type:"carbohydrate"},{tag:"superposition-carb-visual"})]:[3,36];case 35:_e.sent(),c.refMaps[pe.ref]=b.pdb_id+"_"+b.struct_asym_id,M=!1,_e.label=36;case 36:Q++,_e.label=37;case 37:return K++,[3,33];case 38:M&&(c.invalidStruct.push(b.pdb_id+"_"+b.struct_asym_id),(me=c.loadedStructs[t].indexOf(b.pdb_id+"_"+b.struct_asym_id))>-1&&c.loadedStructs[t].splice(me,1)),_e.label=39;case 39:return[3,2];case 40:return[3,47];case 41:return he=_e.sent(),ge={error:he},[3,47];case 42:return _e.trys.push([42,,45,46]),v&&!v.done&&(ve=p.return)?[4,ve.call(p)]:[3,44];case 43:_e.sent(),_e.label=44;case 44:return[3,46];case 45:if(ge)throw ge.error;return[7];case 46:return[7];case 47:return u&&(u=!1,o.events.isBusy.next(!1)),[2]}var Se}))}))}))]}))}))}function m(e,t,r){var i;return n.__awaiter(this,void 0,void 0,(function(){var a,o,s,c,l,d,f;return n.__generator(this,(function(n){switch(n.label){case 0:if(!(a=t.select(r)[0])||!a.obj)return[2,void 0];if(!(o=a.obj.data))return[2];for(s=[],c=0,l=e.managers.structure.hierarchy.selection.structures;c<l.length;c++)d=l[c],(f=null===(i=d.cell.obj)||void 0===i?void 0:i.data)&&s.push(f);return[4,u.ModelInfo.get(o,s)];case 1:return[2,n.sent()]}}))}))}function h(e,t,r,i){return n.__awaiter(this,void 0,void 0,(function(){var a,o,u,c;return n.__generator(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),[4,e.builders.data.download({url:s.Asset.Url(t),isBinary:i})];case 1:return a=n.sent(),[4,e.builders.structure.parseTrajectory(a,r)];case 2:return o=n.sent(),[4,e.builders.structure.createModel(o)];case 3:return u=n.sent(),[4,e.builders.structure.createStructure(u,{name:"model",params:{}})];case 4:return c=n.sent(),[2,{data:a,trajectory:o,model:u,structure:c}];case 5:return n.sent(),[2,{structure:void 0}];case 6:return[2]}}))}))}function g(e,t,r){var n=e.state.data.build().to(t).insert(o.StateTransforms.Model.TransformStructureConformation,{transform:{name:"matrix",params:{data:r,transpose:!1}}});return e.runTask(e.state.data.updateTree(n))}function v(e){return n.__awaiter(this,void 0,void 0,(function(){var t,r,i,a,o,u;return n.__generator(this,(function(n){switch(n.label){case 0:t=e.customState,r=t.initParams.superpositionParams.matrixAccession?t.initParams.superpositionParams.matrixAccession:t.initParams.moleculeId,i=t.initParams.pdbeUrl+"static/superpose/matrices/"+r,a=e.managers.asset,o=s.Asset.getUrlAsset(a,i),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.runTask(a.resolve(o,"json",!1))];case 2:return(u=n.sent())&&u.data&&(e.customState.superpositionState.matrixData=u.data),[3,4];case 3:return n.sent(),t.superpositionError="Matrix data not available for "+r,e.customState.events.superpositionInit.next(!0),[3,4];case 4:return[2]}}))}))}function b(e){return n.__awaiter(this,void 0,void 0,(function(){var t,r,i,a,o;return n.__generator(this,(function(n){switch(n.label){case 0:t=e.customState,r=t.initParams.pdbeUrl+"graph-api/uniprot/superposition/"+t.initParams.moleculeId,i=e.managers.asset,a=s.Asset.getUrlAsset(i,r),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.runTask(i.resolve(a,"json",!1))];case 2:return(o=n.sent())&&o.data&&(t.superpositionState.segmentData=o.data[t.initParams.moleculeId]),[3,4];case 3:return n.sent(),t.superpositionError="Superposition data not available for "+t.initParams.moleculeId,e.customState.events.superpositionInit.next(!0),[3,4];case 4:return[2]}}))}))}function y(e){for(var t,r=[],n=[],i=[],a=[],o=0,s=e.chem_comp_list;o<s.length;o++){var u=s[o];a.push(u.chem_comp_id+" ("+u.count+")")}t=a.join(", ");for(var c=0,l=e.chains;c<l.length;c++){var d=l[c];r.push(d.chain_id),n.push(t);for(var f=[],p=0,m=d.residues;p<m.length;p++){var h=m[p];f.push(h.chem_comp_id+"-"+h.residue_number)}i.push(f)}return{ligands:i,ligandChain:r,ligandLabels:n}}function _(e,t){return n.__awaiter(this,void 0,void 0,(function(){var r,i,a,o,u,c,l,d,f,p,m,h,g;return n.__generator(this,(function(n){switch(n.label){case 0:r=e.customState,i=r.initParams.pdbeUrl+"api/pdb/entry/carbohydrate_polymer/"+t,a=e.managers.asset,o=s.Asset.getUrlAsset(a,i),u=[],c=[],l=[],n.label=1;case 1:return n.trys.push([1,3,,4]),[4,e.runTask(a.resolve(o,"json",!1))];case 2:if((d=n.sent())&&d.data)for(f=d.data[t],p=0,m=f;p<m.length;p++)h=m[p],g=y(h),u=u.concat(g.ligands),c=c.concat(g.ligandChain),l=l.concat(g.ligandLabels);return[3,4];case 3:return n.sent(),[3,4];case 4:return[2,{branchedChains:c,branchedLigands:u,branchedlabels:l}]}}))}))}t.initSuperposition=function(e){return n.__awaiter(this,void 0,void 0,(function(){var t,r,i,a,o,s;return n.__generator(this,(function(n){switch(n.label){case 0:return[4,e.clear()];case 1:return n.sent(),t=e.customState,r=t.initParams.superpositionParams,e.customState.superpositionState={models:{},entries:{},refMaps:{},segmentData:void 0,matrixData:{},activeSegment:0,loadedStructs:[],visibleRefs:[],invalidStruct:[],noMatrixStruct:[],hets:{},colorPalette:["dark-2","red-yellow-green","paired","set-1","accent","set-2","rainbow"],colorState:[]},[4,b(e)];case 2:return n.sent(),(i=e.customState.superpositionState.segmentData)?[4,v(e)]:[2];case 3:return n.sent(),e.customState.superpositionState.segmentData?(i.forEach((function(){e.customState.superpositionState.loadedStructs.push([]),e.customState.superpositionState.visibleRefs.push([]),e.customState.superpositionState.colorState.push({palleteIndex:0,colorIndex:-1})})),a=r&&r.segment?r.segment-1:0,e.customState.superpositionState.activeSegment=a+1,o=r&&r.cluster?r.cluster:void 0,e.customState.events.superpositionInit.next(!0),s=[],i[a].clusters.forEach((function(e,t){o&&-1===o.indexOf(t)||(r&&r.superposeAll?s=s.concat(e):s.push(e[0]))})),[4,p(e,a,s)]):[2];case 4:return n.sent(),[2]}}))}))},t.renderSuperposition=p},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t._bundleLabel=t.bondLabel=t.lociDetails=void 0;var n=r(0),i=r(4),a=r(6);function o(e){switch(e.kind){case"structure-loci":return{models:e.structure.models.map((function(e){return e.entry})).filter((function(e){return!!e}))};case"element-loci":return r=i.StructureElement.Stats.ofLoci(e),n=r.chainCount,a=r.residueCount,1===(o=r.elementCount)&&0===a&&0===n?s(r.firstElementLoc,"element"):0===o&&1===a&&0===n?s(r.firstResidueLoc,"residue"):void 0;case"bond-loci":var t=e.bonds[0];return t?u(t,"element"):"";default:return}var r,n,a,o}function s(e,t){void 0===t&&(t="element");var r,a={},o=e.unit.model.entry;return o.length>30&&(o=o.substr(0,27)+"…"),a.entry_id=o,"structure"!==t&&(a.model=e.unit.model.modelNum,a.instance=e.unit.conformation.operator.name),i.Unit.isAtomic(e.unit)?r=function(e,t){var r={entity_id:i.StructureProperties.chain.label_entity_id(e),label_asym_id:i.StructureProperties.chain.label_asym_id(e),auth_asym_id:i.StructureProperties.chain.auth_asym_id(e),seq_id:i.StructureProperties.residue.label_seq_id(e),auth_seq_id:i.StructureProperties.residue.auth_seq_id(e),ins_code:i.StructureProperties.residue.pdbx_PDB_ins_code(e),comp_id:i.StructureProperties.atom.label_comp_id(e),atom_id:[i.StructureProperties.atom.label_atom_id(e)],alt_id:i.StructureProperties.atom.label_alt_id(e)},n=i.StructureProperties.residue.microheterogeneityCompIds(e);return r.micro_het_comp_ids="residue"===t&&n.length>1?n:[r.comp_id],r}(e,t):i.Unit.isCoarse(e.unit)&&(r=function(e,t){var r={asym_id:i.StructureProperties.coarse.asym_id(e),seq_id_begin:i.StructureProperties.coarse.seq_id_begin(e),seq_id_end:i.StructureProperties.coarse.seq_id_end(e)};if("residue"===t&&r.seq_id_begin===r.seq_id_end){var n=i.StructureProperties.coarse.entityKey(e),a=e.unit.model.sequence.byEntityKey[n];r.comp_id=a.sequence.compId.value(r.seq_id_begin-1)}return r}(e,t)),n.__assign(n.__assign({},a),r)}function u(e,t){return c({loci:[i.StructureElement.Loci(e.aStructure,[{unit:e.aUnit,indices:a.OrderedSet.ofSingleton(e.aIndex)}]),i.StructureElement.Loci(e.bStructure,[{unit:e.bUnit,indices:a.OrderedSet.ofSingleton(e.bIndex)}])]},t)}function c(e,t){for(var r=!0,n=0,u=e.loci;n<u.length;n++){var c=u[n];if(!i.StructureElement.Loci.is(c)||1!==i.StructureElement.Loci.size(c)){r=!1;break}}if(r){var l,d=e.loci.map((function(e){var t=e.elements[0],r=t.unit,n=t.indices;return i.StructureElement.Location.create(e.structure,r,r.elements[a.OrderedSet.start(n)])})).map((function(e){return s(e,t)})),f=[d[0].atom_id[0],d[1].atom_id[0]];return(l=d[0]).atom_id=f,l}return l=e.loci.map((function(e){return o(e)}))}t.lociDetails=o,t.bondLabel=u,t._bundleLabel=c},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(41),i=r(90),a=r(186),o=r(1),s=function(){function e(e,t,r,o,s){var u=this;void 0===s&&(s=30),this.canvasIdentify=e,this.getLoci=t,this.input=r,this.camera=o,this.maxFps=s,this.ev=a.RxEventHelper.create(),this.events={hover:this.ev(),drag:this.ev(),click:this.ev()},this.startX=-1,this.startY=-1,this.endX=-1,this.endY=-1,this.id=void 0,this.position=void 0,this.currentIdentifyT=0,this.isInteracting=!1,this.prevLoci=n.a.Loci.Empty,this.prevT=0,this.inside=!1,this.buttons=i.a.create(0),this.button=i.a.create(0),this.modifiers=i.b.None,r.drag.subscribe((function(e){var t=e.x,r=e.y,n=e.buttons,i=e.button,a=e.modifiers;u.isInteracting=!0,u.drag(t,r,n,i,a)})),r.move.subscribe((function(e){var t=e.x,r=e.y,n=e.inside,i=e.buttons,a=e.button,o=e.modifiers;n&&!u.isInteracting&&u.move(t,r,i,a,o)})),r.leave.subscribe((function(){u.leave()})),r.click.subscribe((function(e){var t=e.x,r=e.y,n=e.buttons,i=e.button,a=e.modifiers;u.outsideViewport(t,r)||u.click(t,r,n,i,a)})),r.interactionEnd.subscribe((function(){u.isInteracting=!1})),r.modifiers.subscribe((function(e){u.modify(e)}))}return e.prototype.identify=function(e,t){var r=this.startX!==this.endX||this.startY!==this.endY;if(2!==e){if(r){var i=this.canvasIdentify(this.endX,this.endY);this.id=null==i?void 0:i.id,this.position=null==i?void 0:i.position,this.startX=this.endX,this.startY=this.endY}if(1===e){var a=this.getLoci(this.id);return this.events.click.next({current:a,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:o.Vec2.create(this.endX,this.endY),position:this.position}),void(this.prevLoci=a)}if(this.inside&&this.currentIdentifyT===t&&r&&!this.outsideViewport(this.endX,this.endY)){var s=this.getLoci(this.id);this.events.hover.next({current:s,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:o.Vec2.create(this.endX,this.endY),position:this.position}),this.prevLoci=s}}else r&&!n.a.Loci.isEmpty(this.prevLoci)&&(this.events.drag.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,pageStart:o.Vec2.create(this.startX,this.startY),pageEnd:o.Vec2.create(this.endX,this.endY)}),this.startX=this.endX,this.startY=this.endY)},e.prototype.tick=function(e){this.inside&&e-this.prevT>1e3/this.maxFps&&(this.prevT=e,this.currentIdentifyT=e,this.identify(this.isInteracting?2:0,e))},e.prototype.leave=function(){this.inside=!1,n.a.Loci.isEmpty(this.prevLoci)||(this.prevLoci=n.a.Loci.Empty,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers}))},e.prototype.move=function(e,t,r,n,i){this.inside=!0,this.buttons=r,this.button=n,this.modifiers=i,this.endX=e,this.endY=t},e.prototype.click=function(e,t,r,n,i){this.endX=e,this.endY=t,this.buttons=r,this.button=n,this.modifiers=i,this.identify(1,0)},e.prototype.drag=function(e,t,r,n,i){this.endX=e,this.endY=t,this.buttons=r,this.button=n,this.modifiers=i,this.identify(2,0)},e.prototype.modify=function(e){i.b.areEqual(e,this.modifiers)||(this.modifiers=e,this.events.hover.next({current:this.prevLoci,buttons:this.buttons,button:this.button,modifiers:this.modifiers,page:o.Vec2.create(this.endX,this.endY),position:this.position}))},e.prototype.outsideViewport=function(e,t){var r=this.input,n=this.camera.viewport;return e*=r.pixelRatio,t*=r.pixelRatio,e>n.x+n.width||r.height-t>n.y+n.height||e<n.x||r.height-t<n.y},e.prototype.dispose=function(){this.ev.dispose()},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(0),i=r(2),a=r(391),o=r(174),s=r(228),u=r(172),c=r(105),l=r(334),d=r(242),f={transparentBackground:i.ParamDefinition.Boolean(!1),multiSample:i.ParamDefinition.Group(s.b),postprocessing:i.ParamDefinition.Group(o.b),cameraHelper:i.ParamDefinition.Group(d.b)},p=function(){function e(e,t,r,o,c,l,p){this.webgl=e,this.renderer=t,this.scene=r,this.camera=o,this._width=0,this._height=0,this._camera=new u.a,this.props=Object(n.__assign)(Object(n.__assign)({},i.ParamDefinition.getDefaultValues(f)),p),this.drawPass=new a.a(e,128,128,l),this.multiSamplePass=new s.c(e,this.drawPass),this.multiSampleHelper=new s.a(this.multiSamplePass),this.helper={camera:new d.a(e,this.props.cameraHelper),debug:c.debug,handle:c.handle},this.setSize(1024,768)}return Object.defineProperty(e.prototype,"colorTarget",{get:function(){return this._colorTarget},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),e.prototype.setSize=function(e,t){e===this._width&&t===this._height||(this._width=e,this._height=t,this.drawPass.setSize(e,t),this.multiSamplePass.syncSize())},e.prototype.setProps=function(e){void 0===e&&(e={}),Object.assign(this.props,e),e.cameraHelper&&this.helper.camera.setProps(e.cameraHelper)},e.prototype.render=function(){u.a.copySnapshot(this._camera.state,this.camera.state),c.a.set(this._camera.viewport,0,0,this._width,this._height),this._camera.update(),s.c.isEnabled(this.props.multiSample)?(this.multiSampleHelper.render(this.renderer,this._camera,this.scene,this.helper,!1,this.props.transparentBackground,this.props),this._colorTarget=this.multiSamplePass.colorTarget):(this.drawPass.render(this.renderer,this._camera,this.scene,this.helper,!1,this.props.transparentBackground,this.props.postprocessing),this._colorTarget=this.drawPass.getColorTarget(this.props.postprocessing))},e.prototype.getImageData=function(e,t,r){var n,i;this.setSize(e,t),this.render(),this.colorTarget.bind();var a=null!==(n=null==r?void 0:r.width)&&void 0!==n?n:e,o=null!==(i=null==r?void 0:r.height)&&void 0!==i?i:t,s=new Uint8Array(a*o*4);return r?this.webgl.readPixels(r.x,t-r.y-r.height,a,o,s):this.webgl.readPixels(0,0,a,o,s),l.a.flipY({array:s,width:a,height:o}),new ImageData(new Uint8ClampedArray(s),a,o)},e}()},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),i=r(2),a=r(339),o=r(242),s=r(340),u={debug:i.ParamDefinition.Group(a.b),camera:i.ParamDefinition.Group({helper:i.ParamDefinition.Group(o.b)}),handle:i.ParamDefinition.Group(s.b)},c=i.ParamDefinition.getDefaultValues(u),l=function(e,t,r){void 0===r&&(r={});var i=Object(n.__assign)(Object(n.__assign)({},c),r);this.debug=new a.a(e,t,i.debug),this.camera=new o.a(e,i.camera.helper),this.handle=new s.a(e,i.handle)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(391),i=r(376),a=r(228),o=function(){function e(e,t){void 0===t&&(t={}),this.webgl=e;var r=e.gl;this.draw=new n.a(e,r.drawingBufferWidth,r.drawingBufferHeight,t.enableWboit||!1),this.pick=new i.b(e,this.draw,t.pickScale||.25),this.multiSample=new a.c(e,this.draw)}return e.prototype.updateSize=function(){var e=this.webgl.gl;this.draw.setSize(e.drawingBufferWidth,e.drawingBufferHeight),this.pick.syncSize(),this.multiSample.syncSize()},e}()},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),i=r(419),a=r(27),o=r(13),s=r(23),u=r(186),c=r(408),l=r(434),d=r(437),f=r(13),p=r(327),m=r(407),h=r(308),g=r(167),v=r(439),b=r(440),y=r(412),_=r(442),S=r(119),x=r(78),O=r(46),w=r(260),C=r(2),j=r(411),P=r(448),E=r(449),A=r(378),D=r(397),T=r(443),I=r(444);r(445),D.ElementSymbolColorThemeParams.carbonColor.defaultValue={name:"element-symbol",params:{}};var M=function(){function e(){var e=this;this.assemblyRef="",this.isHighlightColorUpdated=!1,this.isSelectedColorUpdated=!1,this.canvas={toggleControls:function(t){void 0===t&&(t=!e.plugin.layout.state.showControls),a.PluginCommands.Layout.Update(e.plugin,{state:{showControls:t}})},toggleExpanded:function(t){void 0===t&&(t=!e.plugin.layout.state.isExpanded),a.PluginCommands.Layout.Update(e.plugin,{state:{isExpanded:t}})},setBgColor:function(t){if(t){var r=e.plugin.canvas3d.props.renderer;a.PluginCommands.Canvas3D.SetSettings(e.plugin,{settings:{renderer:n.__assign(n.__assign({},r),{backgroundColor:O.Color.fromRgb(t.r,t.g,t.b)})}})}}},this.visual={highlight:function(t){var r=e.getLociForParams(t.data);s.Loci.isEmpty(r)||(t.color&&e.visual.setColor({highlight:t.color}),e.plugin.managers.interactivity.lociHighlights.highlightOnly({loci:r}),t.focus&&e.plugin.managers.camera.focusLoci(r))},clearHighlight:function(){return n.__awaiter(e,void 0,void 0,(function(){return n.__generator(this,(function(e){return this.plugin.managers.interactivity.lociHighlights.highlightOnly({loci:s.EmptyLoci}),this.isHighlightColorUpdated&&this.visual.reset({highlightColor:!0}),[2]}))}))},select:function(t){return n.__awaiter(e,void 0,void 0,(function(){var e,r,i,a,o,u,c,l,d,f,p,m,h,g,v,b,y,_,S,x,j,P,E,A;return n.__generator(this,(function(D){switch(D.label){case 0:return this.selectedParams?[4,this.visual.clearSelection()]:[3,2];case 1:D.sent(),D.label=2;case 2:if(!t.nonSelectedColor)return[3,15];D.label=3;case 3:D.trys.push([3,9,10,15]),e=n.__asyncValues(this.plugin.managers.structure.hierarchy.current.structures),D.label=4;case 4:return[4,e.next()];case 5:return(r=D.sent()).done?[3,8]:(i=r.value,[4,this.plugin.managers.structure.component.updateRepresentationsTheme(i.components,{color:"uniform",colorParams:{value:this.normalizeColor(t.nonSelectedColor)}})]);case 6:D.sent(),D.label=7;case 7:return[3,4];case 8:return[3,15];case 9:return a=D.sent(),j={error:a},[3,15];case 10:return D.trys.push([10,,13,14]),r&&!r.done&&(P=e.return)?[4,P.call(e)]:[3,12];case 11:D.sent(),D.label=12;case 12:return[3,14];case 13:if(j)throw j.error;return[7];case 14:return[7];case 15:D.trys.push([15,23,24,29]),o=n.__asyncValues(t.data),D.label=16;case 16:return[4,o.next()];case 17:return(u=D.sent()).done?[3,22]:(c=u.value,l=this.getLociForParams([c]),s.Loci.isEmpty(l)?[2]:(this.visual.setColor({select:c.color?c.color:{r:255,g:112,b:3}}),this.plugin.managers.interactivity.lociSelects.selectOnly({loci:l}),d=w.StructureComponentManager.getThemeParams(this.plugin,this.plugin.managers.structure.component.pivotStructure),(f=C.ParamDefinition.getDefaultValues(d)).action.params={color:c.color?this.normalizeColor(c.color):O.Color.fromRgb(255,112,3),opacity:1},[4,this.plugin.managers.structure.component.applyTheme(f,this.plugin.managers.structure.hierarchy.current.structures)]));case 18:return D.sent(),c.sideChain||c.representation?(p="ball-and-stick",c.representation&&(p=c.representation),m=w.StructureComponentManager.getAddParams(this.plugin,{allowNone:!1,hideSelection:!0,checkExisting:!0}),(h=C.ParamDefinition.getDefaultValues(m)).options={label:"selection-by-script",checkExisting:!0},g=n.__assign(n.__assign({},h),{representation:p}),v=this.plugin.managers.structure.hierarchy.getStructuresWithSelection(),[4,this.plugin.managers.structure.component.add(g,v)]):[3,20];case 19:D.sent(),c.representationColor&&(b=this.plugin.managers.structure.hierarchy.current.structures[0].components,y=b.length-1,_=[b[y]],S=c.representationColor?this.normalizeColor(c.representationColor):O.Color.fromRgb(255,112,3),this.plugin.managers.structure.component.updateRepresentationsTheme(_,{color:"uniform",colorParams:{value:S}})),t.addedRepr=!0,D.label=20;case 20:c.focus&&this.plugin.managers.camera.focusLoci(l),this.plugin.managers.interactivity.lociSelects.deselect({loci:l}),D.label=21;case 21:return[3,16];case 22:return[3,29];case 23:return x=D.sent(),E={error:x},[3,29];case 24:return D.trys.push([24,,27,28]),u&&!u.done&&(A=o.return)?[4,A.call(o)]:[3,26];case 25:D.sent(),D.label=26;case 26:return[3,28];case 27:if(E)throw E.error;return[7];case 28:return[7];case 29:return this.visual.reset({selectColor:!0}),this.selectedParams=t,[2]}}))}))},clearSelection:function(){return n.__awaiter(e,void 0,void 0,(function(){var e,t,r,i,o,s,u,c,l,d;return n.__generator(this,(function(f){switch(f.label){case 0:return this.plugin.managers.interactivity.lociSelects.deselectAll(),this.selectedParams&&this.selectedParams.nonSelectedColor&&this.visual.reset({theme:!0}),[4,A.clearStructureOverpaint(this.plugin,this.plugin.managers.structure.hierarchy.current.structures[0].components)];case 1:if(f.sent(),!this.selectedParams||!this.selectedParams.addedRepr)return[3,15];for(e=[],t=0,r=this.plugin.managers.structure.hierarchy.current.structures[0].components;t<r.length;t++)(i=r[t]).cell&&i.cell.params&&i.cell.params.values&&"selection-by-script"===i.cell.params.values.label&&e.push(i.cell);if(!(e.length>0))return[3,15];f.label=2;case 2:f.trys.push([2,8,9,14]),o=n.__asyncValues(e),f.label=3;case 3:return[4,o.next()];case 4:return(s=f.sent()).done?[3,7]:(u=s.value,[4,a.PluginCommands.State.RemoveObject(this.plugin,{state:u.parent,ref:u.transform.ref})]);case 5:f.sent(),f.label=6;case 6:return[3,3];case 7:return[3,14];case 8:return c=f.sent(),l={error:c},[3,14];case 9:return f.trys.push([9,,12,13]),s&&!s.done&&(d=o.return)?[4,d.call(o)]:[3,11];case 10:f.sent(),f.label=11;case 11:return[3,13];case 12:if(l)throw l.error;return[7];case 13:return[7];case 14:f.label=15;case 15:return this.selectedParams=void 0,[2]}}))}))},update:function(t,r){return n.__awaiter(e,void 0,void 0,(function(){var e,a;return n.__generator(this,(function(o){if(!t)return[2];for(e in this.initParams=n.__assign({},i.DefaultParams),i.DefaultParams)void 0!==t[e]&&(this.initParams[e]=t[e]);return this.initParams.moleculeId||this.initParams.customData?this.initParams.customData&&this.initParams.customData.url&&!this.initParams.customData.format?[2,!1]:(this.plugin.customState.initParams=this.initParams,this.initParams.bgColor&&this.canvas.setBgColor(this.initParams.bgColor),(a=this.getMoleculeSrcUrl())&&this.load({url:a.url,format:a.format,assemblyId:this.initParams.assemblyId,isBinary:a.isBinary},r),[2]):[2,!1]}))}))},visibility:function(t){if(t){var r={polymer:"structure-component-static-polymer",het:"structure-component-static-ligand",water:"structure-component-static-water",carbs:"structure-component-static-branched",maps:"volume-streaming-info"};for(var n in t){var i=r[n],s=f.StateSelection.findTagInSubtree(e.plugin.state.data.tree,o.StateTransform.RootRef,i);if(s){var u=e.plugin.state.data.select(s)[0];if(u&&u.obj){var c=!u.state||!u.state.isHidden;t[n]!==c&&a.PluginCommands.State.ToggleVisibility(e.plugin,{state:e.state,ref:s})}}}}},toggleSpin:function(t,r){if(e.plugin.canvas3d){var i=e.plugin.canvas3d.props.trackball;void 0===t&&(t=!i.spin),a.PluginCommands.Canvas3D.SetSettings(e.plugin,{settings:{trackball:n.__assign(n.__assign({},i),{spin:t})}}),r&&a.PluginCommands.Camera.Reset(e.plugin,{})}},focus:function(t){return n.__awaiter(e,void 0,void 0,(function(){var e;return n.__generator(this,(function(r){return e=this.getLociForParams(t),this.plugin.managers.camera.focusLoci(e),[2]}))}))},setColor:function(t){if(e.plugin.canvas3d){var r=e.plugin.canvas3d.props.renderer,i={};t.highlight&&(i.highlightColor=e.normalizeColor(t.highlight)),t.select&&(i.selectColor=e.normalizeColor(t.select)),a.PluginCommands.Canvas3D.SetSettings(e.plugin,{settings:{renderer:n.__assign(n.__assign({},r),i)}}),i.highlightColor&&(e.isHighlightColorUpdated=!0)}},reset:function(t){return n.__awaiter(e,void 0,void 0,(function(){var e,r,i=this;return n.__generator(this,(function(o){switch(o.label){case 0:return t.camera?[4,a.PluginCommands.Camera.Reset(this.plugin,{durationMs:250})]:[3,2];case 1:o.sent(),o.label=2;case 2:if(t.theme&&this.plugin.managers.structure.hierarchy.currentComponentGroups.forEach((function(e){i.plugin.managers.structure.component.updateRepresentationsTheme(e,{color:"default"})})),t.highlightColor||t.selectColor){if(!this.plugin.canvas3d)return[2];e=this.plugin.canvas3d.props.renderer,r={},t.highlightColor&&(r.highlightColor=this.defaultRendererProps.highlightColor),t.selectColor&&(r.selectColor=this.defaultRendererProps.selectColor),a.PluginCommands.Canvas3D.SetSettings(this.plugin,{settings:{renderer:n.__assign(n.__assign({},e),r)}}),r.highlightColor&&(this.isHighlightColorUpdated=!1)}return[2]}}))}))}},this._ev=u.RxEventHelper.create(),this.events={loadComplete:this._ev()},this.applyVisualParams=function(){var t={"structure-component-static-polymer":"polymer","structure-component-static-ligand":"het","structure-component-static-branched":"carbs","structure-component-static-water":"water","structure-component-static-coarse":"coarse","non-standard":"nonStandard"};e.plugin.managers.structure.hierarchy.currentComponentGroups.forEach((function(r){var n,i=r[0].key,a=!1;if(i&&e.initParams.hideStructure){var o=t[i];o&&(null===(n=e.initParams.hideStructure)||void 0===n?void 0:n.indexOf(o))>-1&&(a=!0)}a&&e.plugin.managers.structure.hierarchy.remove(r),!a&&e.initParams.visualStyle&&r[0]&&r[0].representations&&r[0].representations.forEach((function(t){var n=g.createStructureRepresentationParams(e.plugin,void 0,{type:e.initParams.visualStyle});e.plugin.managers.structure.component.updateRepresentations(r,t,n)}))}))}}return Object.defineProperty(e.prototype,"state",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),e.prototype.render=function(e,t){if(t){for(var r in this.initParams=n.__assign({},i.DefaultParams),i.DefaultParams)void 0!==t[r]&&(this.initParams[r]=t[r]);if(!this.initParams.moleculeId&&!this.initParams.customData)return!1;if(this.initParams.customData&&this.initParams.customData.url&&!this.initParams.customData.format)return!1;var o={actions:n.__spreadArrays(i.DefaultPluginSpec.actions),behaviors:n.__spreadArrays(i.DefaultPluginSpec.behaviors),animations:n.__spreadArrays(i.DefaultPluginSpec.animations||[]),customParamEditors:i.DefaultPluginSpec.customParamEditors,config:i.DefaultPluginSpec.config};if(this.initParams.ligandView||this.initParams.superposition||!this.initParams.selectInteraction||o.behaviors.push(m.PluginSpec.Behavior(p.StructureFocusRepresentation)),this.initParams.superposition){o.behaviors.push(m.PluginSpec.Behavior(T.SuperpositionFocusRepresentation))}if(this.initParams.domainAnnotation&&o.behaviors.push(m.PluginSpec.Behavior(j.PDBeDomainAnnotations,{autoAttach:!0,showTooltip:!1})),this.initParams.validationAnnotation&&o.behaviors.push(m.PluginSpec.Behavior(P.PDBeStructureQualityReport,{autoAttach:!0,showTooltip:!1})),o.layout={initial:{isExpanded:!this.initParams.landscape&&this.initParams.expanded,showControls:!this.initParams.hideControls},controls:{left:b.LeftPanelControls,top:"none",bottom:"none"}},o.components={viewport:{controls:d.PDBeViewportControls,view:this.initParams.superposition?I.SuperpostionViewport:void 0},remoteState:"none",structureTools:this.initParams.superposition?l.PDBeSuperpositionStructureTools:this.initParams.ligandView?l.PDBeLigandViewStructureTools:l.PDBeStructureTools},o.config=[[x.PluginConfig.Structure.DefaultRepresentationPresetParams,{theme:{carbonByChainId:!1,focus:{name:"element-symbol",params:{carbonByChainId:!1}}}}]],this.initParams.ligandView||this.initParams.superposition||(o.animations=[E.AnimateModelIndex]),this.initParams.hideCanvasControls&&(this.initParams.hideCanvasControls.indexOf("expand")>-1&&o.config.push([x.PluginConfig.Viewport.ShowExpand,!1]),this.initParams.hideCanvasControls.indexOf("selection")>-1&&o.config.push([x.PluginConfig.Viewport.ShowSelectionMode,!1]),this.initParams.hideCanvasControls.indexOf("animation")>-1&&o.config.push([x.PluginConfig.Viewport.ShowAnimation,!1])),this.initParams.landscape&&o.layout&&o.layout.initial&&(o.layout.initial.controlsDisplay="landscape"),this.targetElement="string"==typeof e?document.getElementById(e):e,this.plugin=i.createPlugin(this.targetElement,o),this.plugin.customState.initParams=n.__assign({},this.initParams),this.plugin.customState.events={segmentUpdate:this._ev(),superpositionInit:this._ev(),isBusy:this._ev()},this.initParams.bgColor&&this.canvas.setBgColor(this.initParams.bgColor),this.initParams.granularity&&this.plugin.managers.interactivity.setProps({granularity:this.initParams.granularity}),(this.initParams.highlightColor||this.initParams.selectColor)&&this.visual.setColor({highlight:this.initParams.highlightColor,select:this.initParams.selectColor}),this.defaultRendererProps=n.__assign({},this.plugin.canvas3d.props.renderer),this.initParams.superposition)this.plugin.behaviors.layout.leftPanelTabName.next("segments"),y.initSuperposition(this.plugin);else{a.PluginCommands.Layout.Update(this.plugin,{state:{regionState:n.__assign(n.__assign({},this.plugin.layout.state.regionState),{left:"collapsed"})}}),this.plugin.behaviors.layout.leftPanelTabName.next("none");var s=this.getMoleculeSrcUrl();s&&this.load({url:s.url,format:s.format,assemblyId:this.initParams.assemblyId,isBinary:s.isBinary}),this.initParams.subscribeEvents&&v.subscribeToComponentEvents(this),_.CustomEvents.add(this.plugin,this.targetElement)}}},e.prototype.getMoleculeSrcUrl=function(){var e=this.initParams.moleculeId;if(!e&&!this.initParams.customData)throw new Error("Mandatory parameters missing!");var t="full",r="?";if(this.initParams.ligandView){var n=["data_source=pdb-h"];this.initParams.ligandView.label_comp_id_list||(this.initParams.ligandView.label_comp_id?n.push("label_comp_id="+this.initParams.ligandView.label_comp_id):this.initParams.ligandView.auth_seq_id&&n.push("auth_seq_id="+this.initParams.ligandView.auth_seq_id),this.initParams.ligandView.auth_asym_id&&n.push("auth_asym_id="+this.initParams.ligandView.auth_asym_id)),t="residueSurroundings?"+n.join("&"),r="&"}var i=this.initParams.pdbeUrl+"model-server/v1/"+e+"/"+t+r+"encoding="+this.initParams.encoding+(this.initParams.lowPrecisionCoords?"&lowPrecisionCoords=1":""),a="bcif"===this.initParams.encoding,o="mmcif";if(this.initParams.customData){if(!this.initParams.customData.url||!this.initParams.customData.format)throw new Error("Provide all custom data parameters");if(i=this.initParams.customData.url,"cif"!==(o=this.initParams.customData.format)&&"bcif"!==o||(o="mmcif"),-1===["mmcif","pdb","sdf"].indexOf(o))throw new Error(o+" not supported.");a=!!this.initParams.customData.binary&&this.initParams.customData.binary}return{url:i,format:o,isBinary:a}},e.prototype.createLigandStructure=function(e){var t,r,i;return n.__awaiter(this,void 0,void 0,(function(){var s,u,l,d,p,m,h,g,v,b,y,_=this;return n.__generator(this,(function(S){switch(S.label){case 0:if(""===this.assemblyRef)return[2];S.label=1;case 1:S.trys.push([1,7,8,13]),s=n.__asyncValues(this.plugin.managers.structure.hierarchy.currentComponentGroups),S.label=2;case 2:return[4,s.next()];case 3:return(u=S.sent()).done?[3,6]:(l=u.value,[4,a.PluginCommands.State.RemoveObject(this.plugin,{state:l[0].cell.parent,ref:l[0].cell.transform.ref,removeParentGhosts:!0})]);case 4:S.sent(),S.label=5;case 5:return[3,2];case 6:return[3,13];case 7:return d=S.sent(),t={error:d},[3,13];case 8:return S.trys.push([8,,11,12]),u&&!u.done&&(r=s.return)?[4,r.call(s)]:[3,10];case 9:S.sent(),S.label=10;case 10:return[3,12];case 11:if(t)throw t.error;return[7];case 12:return[7];case 13:return p=this.state.select(this.assemblyRef)[0],m=e?c.LigandView.branchedQuery(null===(i=this.initParams.ligandView)||void 0===i?void 0:i.label_comp_id_list):c.LigandView.query(this.initParams.ligandView),[4,this.plugin.builders.structure.tryCreateComponentFromExpression(p,m.core,"pivot",{label:"Ligand"})];case 14:return(h=S.sent())?[4,this.plugin.builders.structure.representation.addRepresentation(h,{type:"ball-and-stick",color:"element-symbol",colorParams:{carbonByChainId:!1},size:"uniform",sizeParams:{value:2.5}},{tag:"ligand-vis"})]:[3,16];case 15:S.sent(),S.label=16;case 16:return[4,this.plugin.builders.structure.tryCreateComponentFromExpression(p,m.surroundings,"rest",{label:"Surroundings"})];case 17:return(g=S.sent())?[4,this.plugin.builders.structure.representation.addRepresentation(g,{type:"ball-and-stick",color:"element-symbol",colorParams:{carbonByChainId:!1},size:"uniform",sizeParams:{value:.8}})]:[3,19];case 18:S.sent(),S.label=19;case 19:return(v=f.StateSelection.findTagInSubtree(this.plugin.state.data.tree,o.StateTransform.RootRef,"ligand-vis"))?((b=this.plugin.state.data.cells.get(v))&&(y=b.obj.data.repr.getLoci(),this.plugin.managers.structure.focus.setFromLoci(y),setTimeout((function(){var e,t=null===(e=_.plugin.managers.structure.focus.current)||void 0===e?void 0:e.loci;t&&_.plugin.managers.camera.focusLoci(t)}),500)),[2]):[2]}}))}))},e.prototype.load=function(e,t){var r=e.url,i=e.format,a=void 0===i?"mmcif":i,o=e.isBinary,s=void 0!==o&&o,u=e.assemblyId,l=void 0===u?"":u;return void 0===t&&(t=!0),n.__awaiter(this,void 0,void 0,(function(){var e,i,o,u,d,f,p,m,g,v,b;return n.__generator(this,(function(n){switch(n.label){case 0:return t&&this.clear(),e=!!this.initParams.ligandView,i=void 0,o=!1,this.initParams.ligandView&&this.initParams.ligandView.label_comp_id_list&&(o=!0,i={body:JSON.stringify(this.initParams.ligandView.label_comp_id_list),headers:[["Content-type","application/json"]]}),[4,this.plugin.builders.data.download({url:S.Asset.Url(r,i),isBinary:s},{state:{isGhost:!0}})];case 1:return u=n.sent(),[4,this.plugin.builders.structure.parseTrajectory(u,a)];case 2:return d=n.sent(),e?[3,4]:[4,this.plugin.builders.structure.hierarchy.applyPreset(d,"default",{structure:l?"preferred"===l?void 0:{name:"assembly",params:{id:l}}:{name:"model",params:{}},showUnitcell:!1,representationPreset:"auto"})];case 3:return n.sent(),(this.initParams.hideStructure||this.initParams.visualStyle)&&this.applyVisualParams(),[3,7];case 4:return[4,this.plugin.builders.structure.createModel(d)];case 5:return f=n.sent(),[4,this.plugin.builders.structure.createStructure(f,{name:"model",params:{}})];case 6:n.sent(),n.label=7;case 7:return this.initParams.selection&&this.visual.select(this.initParams.selection),p=this.plugin.managers.structure.hierarchy.selection.structures.length-1,(m=this.plugin.managers.structure.hierarchy.selection.structures[p])&&m.cell.parent&&(this.assemblyRef=m.cell.transform.ref),this.initParams.loadMaps?""===this.assemblyRef?[2]:(g=this.state.select(this.assemblyRef)[0].obj,v=h.InitVolumeStreaming.createDefaultParams(g,this.plugin),(b=c.PDBeVolumes.mapParams(v,this.initParams.mapSettings,""))?[4,this.plugin.runTask(this.state.applyAction(h.InitVolumeStreaming,b,this.assemblyRef))]:[3,9]):[3,9];case 8:n.sent(),"em"===b.method||this.initParams.ligandView||c.PDBeVolumes.displayUsibilityMessage(this.plugin),n.label=9;case 9:return e?[4,this.createLigandStructure(o)]:[3,11];case 10:n.sent(),n.label=11;case 11:return this.events.loadComplete.next(!0),[2]}}))}))},e.prototype.getLociForParams=function(e){if(""===this.assemblyRef)return s.EmptyLoci;var t=this.plugin.state.data.select(this.assemblyRef)[0].obj.data;return t?c.QueryHelper.getInteractivityLoci(e,t):s.EmptyLoci},e.prototype.normalizeColor=function(e,t){var r=O.Color.fromRgb(170,170,170);try{r=e.r?O.Color.fromRgb(e.r,e.g,e.b):"#"===e[0]?O.Color(Number("0x"+e.substr(1))):O.Color(e)}catch(e){t&&(r=t)}return r},e.prototype.clear=function(){return n.__awaiter(this,void 0,void 0,(function(){return n.__generator(this,(function(e){return this.plugin.clear(),this.assemblyRef="",this.selectedParams=void 0,this.isHighlightColorUpdated=!1,this.isSelectedColorUpdated=!1,[2]}))}))},e}();window.PDBeMolstarPlugin=M},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultParams=t.createPlugin=t.DefaultPluginSpec=void 0;var n=r(0),i=n.__importStar(r(3)),a=n.__importStar(r(421)),o=r(425),s=r(447),u=r(177),c=r(308),l=r(446),d=r(407),f=r(78),p=r(433);t.DefaultPluginSpec={actions:[],behaviors:[d.PluginSpec.Behavior(u.PluginBehaviors.Representation.HighlightLoci),d.PluginSpec.Behavior(u.PluginBehaviors.Representation.SelectLoci),d.PluginSpec.Behavior(p.PDBeLociLabelProvider),d.PluginSpec.Behavior(u.PluginBehaviors.Representation.FocusLoci),d.PluginSpec.Behavior(u.PluginBehaviors.Camera.FocusLoci),d.PluginSpec.Behavior(u.PluginBehaviors.CustomProps.AccessibleSurfaceArea),d.PluginSpec.Behavior(u.PluginBehaviors.CustomProps.Interactions),d.PluginSpec.Behavior(u.PluginBehaviors.CustomProps.SecondaryStructure),d.PluginSpec.Behavior(u.PluginBehaviors.CustomProps.ValenceModel),d.PluginSpec.Behavior(u.PluginBehaviors.CustomProps.CrossLinkRestraint)],customParamEditors:[[c.CreateVolumeStreamingBehavior,o.VolumeStreamingCustomControls]],config:[[f.PluginConfig.VolumeStreaming.DefaultServer,"https://www.ebi.ac.uk/pdbe/densities"]]},t.createPlugin=function(e,r){var n=new l.PluginContext(r||t.DefaultPluginSpec);return a.render(i.createElement(s.Plugin,{plugin:n}),e),n},t.DefaultParams={moleculeId:void 0,superposition:void 0,superpositionParams:void 0,customData:void 0,ligandView:void 0,assemblyId:void 0,visualStyle:void 0,highlightColor:void 0,selectColor:void 0,hideStructure:void 0,hideCanvasControls:void 0,granularity:void 0,selection:void 0,mapSettings:void 0,pdbeUrl:"https://www.ebi.ac.uk/pdbe/",bgColor:{r:0,g:0,b:0},encoding:"bcif",selectInteraction:!0,loadMaps:!1,validationAnnotation:!1,domainAnnotation:!1,lowPrecisionCoords:!1,expanded:!1,hideControls:!1,pdbeLink:!0,loadCartoonsOnly:!1,landscape:!1,subscribeEvents:!1}},function(e,t,r){"use strict";
/** @license React v17.0.2
 * react.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var n=r(406),i=60103,a=60106;t.Fragment=60107,t.StrictMode=60108,t.Profiler=60114;var o=60109,s=60110,u=60112;t.Suspense=60113;var c=60115,l=60116;if("function"==typeof Symbol&&Symbol.for){var d=Symbol.for;i=d("react.element"),a=d("react.portal"),t.Fragment=d("react.fragment"),t.StrictMode=d("react.strict_mode"),t.Profiler=d("react.profiler"),o=d("react.provider"),s=d("react.context"),u=d("react.forward_ref"),t.Suspense=d("react.suspense"),c=d("react.memo"),l=d("react.lazy")}var f="function"==typeof Symbol&&Symbol.iterator;function p(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h={};function g(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||m}function v(){}function b(e,t,r){this.props=e,this.context=t,this.refs=h,this.updater=r||m}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){if("object"!=typeof e&&"function"!=typeof e&&null!=e)throw Error(p(85));this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},v.prototype=g.prototype;var y=b.prototype=new v;y.constructor=b,n(y,g.prototype),y.isPureReactComponent=!0;var _={current:null},S=Object.prototype.hasOwnProperty,x={key:!0,ref:!0,__self:!0,__source:!0};function O(e,t,r){var n,a={},o=null,s=null;if(null!=t)for(n in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(o=""+t.key),t)S.call(t,n)&&!x.hasOwnProperty(n)&&(a[n]=t[n]);var u=arguments.length-2;if(1===u)a.children=r;else if(1<u){for(var c=Array(u),l=0;l<u;l++)c[l]=arguments[l+2];a.children=c}if(e&&e.defaultProps)for(n in u=e.defaultProps)void 0===a[n]&&(a[n]=u[n]);return{$$typeof:i,type:e,key:o,ref:s,props:a,_owner:_.current}}function w(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var C=/\/+/g;function j(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}(""+e.key):t.toString(36)}function P(e,t,r,n,o){var s=typeof e;"undefined"!==s&&"boolean"!==s||(e=null);var u=!1;if(null===e)u=!0;else switch(s){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case i:case a:u=!0}}if(u)return o=o(u=e),e=""===n?"."+j(u,0):n,Array.isArray(o)?(r="",null!=e&&(r=e.replace(C,"$&/")+"/"),P(o,t,r,"",(function(e){return e}))):null!=o&&(w(o)&&(o=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(o,r+(!o.key||u&&u.key===o.key?"":(""+o.key).replace(C,"$&/")+"/")+e)),t.push(o)),1;if(u=0,n=""===n?".":n+":",Array.isArray(e))for(var c=0;c<e.length;c++){var l=n+j(s=e[c],c);u+=P(s,t,r,l,o)}else if("function"==typeof(l=function(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=f&&e[f]||e["@@iterator"])?e:null}(e)))for(e=l.call(e),c=0;!(s=e.next()).done;)u+=P(s=s.value,t,r,l=n+j(s,c++),o);else if("object"===s)throw t=""+e,Error(p(31,"[object Object]"===t?"object with keys {"+Object.keys(e).join(", ")+"}":t));return u}function E(e,t,r){if(null==e)return e;var n=[],i=0;return P(e,n,"","",(function(e){return t.call(r,e,i++)})),n}function A(e){if(-1===e._status){var t=e._result;t=t(),e._status=0,e._result=t,t.then((function(t){0===e._status&&(t=t.default,e._status=1,e._result=t)}),(function(t){0===e._status&&(e._status=2,e._result=t)}))}if(1===e._status)return e._result;throw e._result}var D={current:null};function T(){var e=D.current;if(null===e)throw Error(p(321));return e}var I={ReactCurrentDispatcher:D,ReactCurrentBatchConfig:{transition:0},ReactCurrentOwner:_,IsSomeRendererActing:{current:!1},assign:n};t.Children={map:E,forEach:function(e,t,r){E(e,(function(){t.apply(this,arguments)}),r)},count:function(e){var t=0;return E(e,(function(){t++})),t},toArray:function(e){return E(e,(function(e){return e}))||[]},only:function(e){if(!w(e))throw Error(p(143));return e}},t.Component=g,t.PureComponent=b,t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=I,t.cloneElement=function(e,t,r){if(null==e)throw Error(p(267,e));var a=n({},e.props),o=e.key,s=e.ref,u=e._owner;if(null!=t){if(void 0!==t.ref&&(s=t.ref,u=_.current),void 0!==t.key&&(o=""+t.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(l in t)S.call(t,l)&&!x.hasOwnProperty(l)&&(a[l]=void 0===t[l]&&void 0!==c?c[l]:t[l])}var l=arguments.length-2;if(1===l)a.children=r;else if(1<l){c=Array(l);for(var d=0;d<l;d++)c[d]=arguments[d+2];a.children=c}return{$$typeof:i,type:e.type,key:o,ref:s,props:a,_owner:u}},t.createContext=function(e,t){return void 0===t&&(t=null),(e={$$typeof:s,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null}).Provider={$$typeof:o,_context:e},e.Consumer=e},t.createElement=O,t.createFactory=function(e){var t=O.bind(null,e);return t.type=e,t},t.createRef=function(){return{current:null}},t.forwardRef=function(e){return{$$typeof:u,render:e}},t.isValidElement=w,t.lazy=function(e){return{$$typeof:l,_payload:{_status:-1,_result:e},_init:A}},t.memo=function(e,t){return{$$typeof:c,type:e,compare:void 0===t?null:t}},t.useCallback=function(e,t){return T().useCallback(e,t)},t.useContext=function(e,t){return T().useContext(e,t)},t.useDebugValue=function(){},t.useEffect=function(e,t){return T().useEffect(e,t)},t.useImperativeHandle=function(e,t,r){return T().useImperativeHandle(e,t,r)},t.useLayoutEffect=function(e,t){return T().useLayoutEffect(e,t)},t.useMemo=function(e,t){return T().useMemo(e,t)},t.useReducer=function(e,t,r){return T().useReducer(e,t,r)},t.useRef=function(e){return T().useRef(e)},t.useState=function(e){return T().useState(e)},t.version="17.0.2"},function(e,t,r){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){0;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}}(),e.exports=r(422)},function(e,t,r){"use strict";
/** @license React v17.0.2
 * react-dom.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var n=r(3),i=r(406),a=r(423);function o(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r<arguments.length;r++)t+="&args[]="+encodeURIComponent(arguments[r]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!n)throw Error(o(227));var s=new Set,u={};function c(e,t){l(e,t),l(e+"Capture",t)}function l(e,t){for(u[e]=t,e=0;e<t.length;e++)s.add(t[e])}var d=!("undefined"==typeof window||void 0===window.document||void 0===window.document.createElement),f=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,p=Object.prototype.hasOwnProperty,m={},h={};function g(e,t,r,n,i,a,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var v={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach((function(e){v[e]=new g(e,0,!1,e,null,!1,!1)})),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach((function(e){var t=e[0];v[t]=new g(t,1,!1,e[1],null,!1,!1)})),["contentEditable","draggable","spellCheck","value"].forEach((function(e){v[e]=new g(e,2,!1,e.toLowerCase(),null,!1,!1)})),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach((function(e){v[e]=new g(e,2,!1,e,null,!1,!1)})),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach((function(e){v[e]=new g(e,3,!1,e.toLowerCase(),null,!1,!1)})),["checked","multiple","muted","selected"].forEach((function(e){v[e]=new g(e,3,!0,e,null,!1,!1)})),["capture","download"].forEach((function(e){v[e]=new g(e,4,!1,e,null,!1,!1)})),["cols","rows","size","span"].forEach((function(e){v[e]=new g(e,6,!1,e,null,!1,!1)})),["rowSpan","start"].forEach((function(e){v[e]=new g(e,5,!1,e.toLowerCase(),null,!1,!1)}));var b=/[\-:]([a-z])/g;function y(e){return e[1].toUpperCase()}function _(e,t,r,n){var i=v.hasOwnProperty(t)?v[t]:null;(null!==i?0===i.type:!n&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,r,n){if(null==t||function(e,t,r,n){if(null!==r&&0===r.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!n&&(null!==r?!r.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,r,n))return!0;if(n)return!1;if(null!==r)switch(r.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,r,i,n)&&(r=null),n||null===i?function(e){return!!p.call(h,e)||!p.call(m,e)&&(f.test(e)?h[e]=!0:(m[e]=!0,!1))}(t)&&(null===r?e.removeAttribute(t):e.setAttribute(t,""+r)):i.mustUseProperty?e[i.propertyName]=null===r?3!==i.type&&"":r:(t=i.attributeName,n=i.attributeNamespace,null===r?e.removeAttribute(t):(r=3===(i=i.type)||4===i&&!0===r?"":""+r,n?e.setAttributeNS(n,t,r):e.setAttribute(t,r))))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach((function(e){var t=e.replace(b,y);v[t]=new g(t,1,!1,e,null,!1,!1)})),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach((function(e){var t=e.replace(b,y);v[t]=new g(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)})),["xml:base","xml:lang","xml:space"].forEach((function(e){var t=e.replace(b,y);v[t]=new g(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)})),["tabIndex","crossOrigin"].forEach((function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!1,!1)})),v.xlinkHref=new g("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach((function(e){v[e]=new g(e,1,!1,e.toLowerCase(),null,!0,!0)}));var S=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,x=60103,O=60106,w=60107,C=60108,j=60114,P=60109,E=60110,A=60112,D=60113,T=60120,I=60115,M=60116,k=60121,B=60128,V=60129,R=60130,L=60131;if("function"==typeof Symbol&&Symbol.for){var N=Symbol.for;x=N("react.element"),O=N("react.portal"),w=N("react.fragment"),C=N("react.strict_mode"),j=N("react.profiler"),P=N("react.provider"),E=N("react.context"),A=N("react.forward_ref"),D=N("react.suspense"),T=N("react.suspense_list"),I=N("react.memo"),M=N("react.lazy"),k=N("react.block"),N("react.scope"),B=N("react.opaque.id"),V=N("react.debug_trace_mode"),R=N("react.offscreen"),L=N("react.legacy_hidden")}var F,U="function"==typeof Symbol&&Symbol.iterator;function z(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=U&&e[U]||e["@@iterator"])?e:null}function H(e){if(void 0===F)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);F=t&&t[1]||""}return"\n"+F+e}var G=!1;function q(e,t){if(!e||G)return"";G=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(t,[])}catch(e){var n=e}Reflect.construct(e,[],t)}else{try{t.call()}catch(e){n=e}e.call(t.prototype)}else{try{throw Error()}catch(e){n=e}e()}}catch(e){if(e&&n&&"string"==typeof e.stack){for(var i=e.stack.split("\n"),a=n.stack.split("\n"),o=i.length-1,s=a.length-1;1<=o&&0<=s&&i[o]!==a[s];)s--;for(;1<=o&&0<=s;o--,s--)if(i[o]!==a[s]){if(1!==o||1!==s)do{if(o--,0>--s||i[o]!==a[s])return"\n"+i[o].replace(" at new "," at ")}while(1<=o&&0<=s);break}}}finally{G=!1,Error.prepareStackTrace=r}return(e=e?e.displayName||e.name:"")?H(e):""}function W(e){switch(e.tag){case 5:return H(e.type);case 16:return H("Lazy");case 13:return H("Suspense");case 19:return H("SuspenseList");case 0:case 2:case 15:return e=q(e.type,!1);case 11:return e=q(e.type.render,!1);case 22:return e=q(e.type._render,!1);case 1:return e=q(e.type,!0);default:return""}}function X(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case w:return"Fragment";case O:return"Portal";case j:return"Profiler";case C:return"StrictMode";case D:return"Suspense";case T:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case E:return(e.displayName||"Context")+".Consumer";case P:return(e._context.displayName||"Context")+".Provider";case A:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef");case I:return X(e.type);case k:return X(e._render);case M:t=e._payload,e=e._init;try{return X(e(t))}catch(e){}}return null}function Y(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function Q(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function K(e){e._valueTracker||(e._valueTracker=function(e){var t=Q(e)?"checked":"value",r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),n=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==r&&"function"==typeof r.get&&"function"==typeof r.set){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=""+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function Z(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var r=t.getValue(),n="";return e&&(n=Q(e)?e.checked?"true":"false":e.value),(e=n)!==r&&(t.setValue(e),!0)}function J(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function $(e,t){var r=t.checked;return i({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=r?r:e._wrapperState.initialChecked})}function ee(e,t){var r=null==t.defaultValue?"":t.defaultValue,n=null!=t.checked?t.checked:t.defaultChecked;r=Y(null!=t.value?t.value:r),e._wrapperState={initialChecked:n,initialValue:r,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function te(e,t){null!=(t=t.checked)&&_(e,"checked",t,!1)}function re(e,t){te(e,t);var r=Y(t.value),n=t.type;if(null!=r)"number"===n?(0===r&&""===e.value||e.value!=r)&&(e.value=""+r):e.value!==""+r&&(e.value=""+r);else if("submit"===n||"reset"===n)return void e.removeAttribute("value");t.hasOwnProperty("value")?ie(e,t.type,r):t.hasOwnProperty("defaultValue")&&ie(e,t.type,Y(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function ne(e,t,r){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var n=t.type;if(!("submit"!==n&&"reset"!==n||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,r||t===e.value||(e.value=t),e.defaultValue=t}""!==(r=e.name)&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,""!==r&&(e.name=r)}function ie(e,t,r){"number"===t&&J(e.ownerDocument)===e||(null==r?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+r&&(e.defaultValue=""+r))}function ae(e,t){return e=i({children:void 0},t),(t=function(e){var t="";return n.Children.forEach(e,(function(e){null!=e&&(t+=e)})),t}(t.children))&&(e.children=t),e}function oe(e,t,r,n){if(e=e.options,t){t={};for(var i=0;i<r.length;i++)t["$"+r[i]]=!0;for(r=0;r<e.length;r++)i=t.hasOwnProperty("$"+e[r].value),e[r].selected!==i&&(e[r].selected=i),i&&n&&(e[r].defaultSelected=!0)}else{for(r=""+Y(r),t=null,i=0;i<e.length;i++){if(e[i].value===r)return e[i].selected=!0,void(n&&(e[i].defaultSelected=!0));null!==t||e[i].disabled||(t=e[i])}null!==t&&(t.selected=!0)}}function se(e,t){if(null!=t.dangerouslySetInnerHTML)throw Error(o(91));return i({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function ue(e,t){var r=t.value;if(null==r){if(r=t.children,t=t.defaultValue,null!=r){if(null!=t)throw Error(o(92));if(Array.isArray(r)){if(!(1>=r.length))throw Error(o(93));r=r[0]}t=r}null==t&&(t=""),r=t}e._wrapperState={initialValue:Y(r)}}function ce(e,t){var r=Y(t.value),n=Y(t.defaultValue);null!=r&&((r=""+r)!==e.value&&(e.value=r),null==t.defaultValue&&e.defaultValue!==r&&(e.defaultValue=r)),null!=n&&(e.defaultValue=""+n)}function le(e){var t=e.textContent;t===e._wrapperState.initialValue&&""!==t&&null!==t&&(e.value=t)}var de="http://www.w3.org/1999/xhtml",fe="http://www.w3.org/2000/svg";function pe(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function me(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?pe(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var he,ge=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,r,n,i){MSApp.execUnsafeLocalFunction((function(){return e(t,r)}))}:e}((function(e,t){if(e.namespaceURI!==fe||"innerHTML"in e)e.innerHTML=t;else{for((he=he||document.createElement("div")).innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=he.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}));function ve(e,t){if(t){var r=e.firstChild;if(r&&r===e.lastChild&&3===r.nodeType)return void(r.nodeValue=t)}e.textContent=t}var be={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ye=["Webkit","ms","Moz","O"];function _e(e,t,r){return null==t||"boolean"==typeof t||""===t?"":r||"number"!=typeof t||0===t||be.hasOwnProperty(e)&&be[e]?(""+t).trim():t+"px"}function Se(e,t){for(var r in e=e.style,t)if(t.hasOwnProperty(r)){var n=0===r.indexOf("--"),i=_e(r,t[r],n);"float"===r&&(r="cssFloat"),n?e.setProperty(r,i):e[r]=i}}Object.keys(be).forEach((function(e){ye.forEach((function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),be[t]=be[e]}))}));var xe=i({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Oe(e,t){if(t){if(xe[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML))throw Error(o(137,e));if(null!=t.dangerouslySetInnerHTML){if(null!=t.children)throw Error(o(60));if("object"!=typeof t.dangerouslySetInnerHTML||!("__html"in t.dangerouslySetInnerHTML))throw Error(o(61))}if(null!=t.style&&"object"!=typeof t.style)throw Error(o(62))}}function we(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function Ce(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var je=null,Pe=null,Ee=null;function Ae(e){if(e=Jn(e)){if("function"!=typeof je)throw Error(o(280));var t=e.stateNode;t&&(t=ei(t),je(e.stateNode,e.type,t))}}function De(e){Pe?Ee?Ee.push(e):Ee=[e]:Pe=e}function Te(){if(Pe){var e=Pe,t=Ee;if(Ee=Pe=null,Ae(e),t)for(e=0;e<t.length;e++)Ae(t[e])}}function Ie(e,t){return e(t)}function Me(e,t,r,n,i){return e(t,r,n,i)}function ke(){}var Be=Ie,Ve=!1,Re=!1;function Le(){null===Pe&&null===Ee||(ke(),Te())}function Ne(e,t){var r=e.stateNode;if(null===r)return null;var n=ei(r);if(null===n)return null;r=n[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(n=!n.disabled)||(n=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!n;break e;default:e=!1}if(e)return null;if(r&&"function"!=typeof r)throw Error(o(231,t,typeof r));return r}var Fe=!1;if(d)try{var Ue={};Object.defineProperty(Ue,"passive",{get:function(){Fe=!0}}),window.addEventListener("test",Ue,Ue),window.removeEventListener("test",Ue,Ue)}catch(e){Fe=!1}function ze(e,t,r,n,i,a,o,s,u){var c=Array.prototype.slice.call(arguments,3);try{t.apply(r,c)}catch(e){this.onError(e)}}var He=!1,Ge=null,qe=!1,We=null,Xe={onError:function(e){He=!0,Ge=e}};function Ye(e,t,r,n,i,a,o,s,u){He=!1,Ge=null,ze.apply(Xe,arguments)}function Qe(e){var t=e,r=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do{0!=(1026&(t=e).flags)&&(r=t.return),e=t.return}while(e)}return 3===t.tag?r:null}function Ke(e){if(13===e.tag){var t=e.memoizedState;if(null===t&&(null!==(e=e.alternate)&&(t=e.memoizedState)),null!==t)return t.dehydrated}return null}function Ze(e){if(Qe(e)!==e)throw Error(o(188))}function Je(e){if(!(e=function(e){var t=e.alternate;if(!t){if(null===(t=Qe(e)))throw Error(o(188));return t!==e?null:e}for(var r=e,n=t;;){var i=r.return;if(null===i)break;var a=i.alternate;if(null===a){if(null!==(n=i.return)){r=n;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===r)return Ze(i),e;if(a===n)return Ze(i),t;a=a.sibling}throw Error(o(188))}if(r.return!==n.return)r=i,n=a;else{for(var s=!1,u=i.child;u;){if(u===r){s=!0,r=i,n=a;break}if(u===n){s=!0,n=i,r=a;break}u=u.sibling}if(!s){for(u=a.child;u;){if(u===r){s=!0,r=a,n=i;break}if(u===n){s=!0,n=a,r=i;break}u=u.sibling}if(!s)throw Error(o(189))}}if(r.alternate!==n)throw Error(o(190))}if(3!==r.tag)throw Error(o(188));return r.stateNode.current===r?e:t}(e)))return null;for(var t=e;;){if(5===t.tag||6===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}function $e(e,t){for(var r=e.alternate;null!==t;){if(t===e||t===r)return!0;t=t.return}return!1}var et,tt,rt,nt,it=!1,at=[],ot=null,st=null,ut=null,ct=new Map,lt=new Map,dt=[],ft="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function pt(e,t,r,n,i){return{blockedOn:e,domEventName:t,eventSystemFlags:16|r,nativeEvent:i,targetContainers:[n]}}function mt(e,t){switch(e){case"focusin":case"focusout":ot=null;break;case"dragenter":case"dragleave":st=null;break;case"mouseover":case"mouseout":ut=null;break;case"pointerover":case"pointerout":ct.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":lt.delete(t.pointerId)}}function ht(e,t,r,n,i,a){return null===e||e.nativeEvent!==a?(e=pt(t,r,n,i,a),null!==t&&(null!==(t=Jn(t))&&tt(t)),e):(e.eventSystemFlags|=n,t=e.targetContainers,null!==i&&-1===t.indexOf(i)&&t.push(i),e)}function gt(e){var t=Zn(e.target);if(null!==t){var r=Qe(t);if(null!==r)if(13===(t=r.tag)){if(null!==(t=Ke(r)))return e.blockedOn=t,void nt(e.lanePriority,(function(){a.unstable_runWithPriority(e.priority,(function(){rt(r)}))}))}else if(3===t&&r.stateNode.hydrate)return void(e.blockedOn=3===r.tag?r.stateNode.containerInfo:null)}e.blockedOn=null}function vt(e){if(null!==e.blockedOn)return!1;for(var t=e.targetContainers;0<t.length;){var r=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==r)return null!==(t=Jn(r))&&tt(t),e.blockedOn=r,!1;t.shift()}return!0}function bt(e,t,r){vt(e)&&r.delete(t)}function yt(){for(it=!1;0<at.length;){var e=at[0];if(null!==e.blockedOn){null!==(e=Jn(e.blockedOn))&&et(e);break}for(var t=e.targetContainers;0<t.length;){var r=Jt(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(null!==r){e.blockedOn=r;break}t.shift()}null===e.blockedOn&&at.shift()}null!==ot&&vt(ot)&&(ot=null),null!==st&&vt(st)&&(st=null),null!==ut&&vt(ut)&&(ut=null),ct.forEach(bt),lt.forEach(bt)}function _t(e,t){e.blockedOn===t&&(e.blockedOn=null,it||(it=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,yt)))}function St(e){function t(t){return _t(t,e)}if(0<at.length){_t(at[0],e);for(var r=1;r<at.length;r++){var n=at[r];n.blockedOn===e&&(n.blockedOn=null)}}for(null!==ot&&_t(ot,e),null!==st&&_t(st,e),null!==ut&&_t(ut,e),ct.forEach(t),lt.forEach(t),r=0;r<dt.length;r++)(n=dt[r]).blockedOn===e&&(n.blockedOn=null);for(;0<dt.length&&null===(r=dt[0]).blockedOn;)gt(r),null===r.blockedOn&&dt.shift()}function xt(e,t){var r={};return r[e.toLowerCase()]=t.toLowerCase(),r["Webkit"+e]="webkit"+t,r["Moz"+e]="moz"+t,r}var Ot={animationend:xt("Animation","AnimationEnd"),animationiteration:xt("Animation","AnimationIteration"),animationstart:xt("Animation","AnimationStart"),transitionend:xt("Transition","TransitionEnd")},wt={},Ct={};function jt(e){if(wt[e])return wt[e];if(!Ot[e])return e;var t,r=Ot[e];for(t in r)if(r.hasOwnProperty(t)&&t in Ct)return wt[e]=r[t];return e}d&&(Ct=document.createElement("div").style,"AnimationEvent"in window||(delete Ot.animationend.animation,delete Ot.animationiteration.animation,delete Ot.animationstart.animation),"TransitionEvent"in window||delete Ot.transitionend.transition);var Pt=jt("animationend"),Et=jt("animationiteration"),At=jt("animationstart"),Dt=jt("transitionend"),Tt=new Map,It=new Map,Mt=["abort","abort",Pt,"animationEnd",Et,"animationIteration",At,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",Dt,"transitionEnd","waiting","waiting"];function kt(e,t){for(var r=0;r<e.length;r+=2){var n=e[r],i=e[r+1];i="on"+(i[0].toUpperCase()+i.slice(1)),It.set(n,t),Tt.set(n,i),c(i,[n])}}(0,a.unstable_now)();var Bt=8;function Vt(e){if(0!=(1&e))return Bt=15,1;if(0!=(2&e))return Bt=14,2;if(0!=(4&e))return Bt=13,4;var t=24&e;return 0!==t?(Bt=12,t):0!=(32&e)?(Bt=11,32):0!==(t=192&e)?(Bt=10,t):0!=(256&e)?(Bt=9,256):0!==(t=3584&e)?(Bt=8,t):0!=(4096&e)?(Bt=7,4096):0!==(t=4186112&e)?(Bt=6,t):0!==(t=62914560&e)?(Bt=5,t):67108864&e?(Bt=4,67108864):0!=(134217728&e)?(Bt=3,134217728):0!==(t=805306368&e)?(Bt=2,t):0!=(1073741824&e)?(Bt=1,1073741824):(Bt=8,e)}function Rt(e,t){var r=e.pendingLanes;if(0===r)return Bt=0;var n=0,i=0,a=e.expiredLanes,o=e.suspendedLanes,s=e.pingedLanes;if(0!==a)n=a,i=Bt=15;else if(0!==(a=134217727&r)){var u=a&~o;0!==u?(n=Vt(u),i=Bt):0!==(s&=a)&&(n=Vt(s),i=Bt)}else 0!==(a=r&~o)?(n=Vt(a),i=Bt):0!==s&&(n=Vt(s),i=Bt);if(0===n)return 0;if(n=r&((0>(n=31-Ht(n))?0:1<<n)<<1)-1,0!==t&&t!==n&&0==(t&o)){if(Vt(t),i<=Bt)return t;Bt=i}if(0!==(t=e.entangledLanes))for(e=e.entanglements,t&=n;0<t;)i=1<<(r=31-Ht(t)),n|=e[r],t&=~i;return n}function Lt(e){return 0!==(e=-1073741825&e.pendingLanes)?e:1073741824&e?1073741824:0}function Nt(e,t){switch(e){case 15:return 1;case 14:return 2;case 12:return 0===(e=Ft(24&~t))?Nt(10,t):e;case 10:return 0===(e=Ft(192&~t))?Nt(8,t):e;case 8:return 0===(e=Ft(3584&~t))&&(0===(e=Ft(4186112&~t))&&(e=512)),e;case 2:return 0===(t=Ft(805306368&~t))&&(t=268435456),t}throw Error(o(358,e))}function Ft(e){return e&-e}function Ut(e){for(var t=[],r=0;31>r;r++)t.push(e);return t}function zt(e,t,r){e.pendingLanes|=t;var n=t-1;e.suspendedLanes&=n,e.pingedLanes&=n,(e=e.eventTimes)[t=31-Ht(t)]=r}var Ht=Math.clz32?Math.clz32:function(e){return 0===e?32:31-(Gt(e)/qt|0)|0},Gt=Math.log,qt=Math.LN2;var Wt=a.unstable_UserBlockingPriority,Xt=a.unstable_runWithPriority,Yt=!0;function Qt(e,t,r,n){Ve||ke();var i=Zt,a=Ve;Ve=!0;try{Me(i,e,t,r,n)}finally{(Ve=a)||Le()}}function Kt(e,t,r,n){Xt(Wt,Zt.bind(null,e,t,r,n))}function Zt(e,t,r,n){var i;if(Yt)if((i=0==(4&t))&&0<at.length&&-1<ft.indexOf(e))e=pt(null,e,t,r,n),at.push(e);else{var a=Jt(e,t,r,n);if(null===a)i&&mt(e,n);else{if(i){if(-1<ft.indexOf(e))return e=pt(a,e,t,r,n),void at.push(e);if(function(e,t,r,n,i){switch(t){case"focusin":return ot=ht(ot,e,t,r,n,i),!0;case"dragenter":return st=ht(st,e,t,r,n,i),!0;case"mouseover":return ut=ht(ut,e,t,r,n,i),!0;case"pointerover":var a=i.pointerId;return ct.set(a,ht(ct.get(a)||null,e,t,r,n,i)),!0;case"gotpointercapture":return a=i.pointerId,lt.set(a,ht(lt.get(a)||null,e,t,r,n,i)),!0}return!1}(a,e,t,r,n))return;mt(e,n)}Dn(e,t,n,null,r)}}}function Jt(e,t,r,n){var i=Ce(n);if(null!==(i=Zn(i))){var a=Qe(i);if(null===a)i=null;else{var o=a.tag;if(13===o){if(null!==(i=Ke(a)))return i;i=null}else if(3===o){if(a.stateNode.hydrate)return 3===a.tag?a.stateNode.containerInfo:null;i=null}else a!==i&&(i=null)}}return Dn(e,t,n,i,r),null}var $t=null,er=null,tr=null;function rr(){if(tr)return tr;var e,t,r=er,n=r.length,i="value"in $t?$t.value:$t.textContent,a=i.length;for(e=0;e<n&&r[e]===i[e];e++);var o=n-e;for(t=1;t<=o&&r[n-t]===i[a-t];t++);return tr=i.slice(e,1<t?1-t:void 0)}function nr(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}function ir(){return!0}function ar(){return!1}function or(e){function t(t,r,n,i,a){for(var o in this._reactName=t,this._targetInst=n,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(null!=i.defaultPrevented?i.defaultPrevented:!1===i.returnValue)?ir:ar,this.isPropagationStopped=ar,this}return i(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=ir)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=ir)},persist:function(){},isPersistent:ir}),t}var sr,ur,cr,lr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},dr=or(lr),fr=i({},lr,{view:0,detail:0}),pr=or(fr),mr=i({},fr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cr,button:0,buttons:0,relatedTarget:function(e){return void 0===e.relatedTarget?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==cr&&(cr&&"mousemove"===e.type?(sr=e.screenX-cr.screenX,ur=e.screenY-cr.screenY):ur=sr=0,cr=e),sr)},movementY:function(e){return"movementY"in e?e.movementY:ur}}),hr=or(mr),gr=or(i({},mr,{dataTransfer:0})),vr=or(i({},fr,{relatedTarget:0})),br=or(i({},lr,{animationName:0,elapsedTime:0,pseudoElement:0})),yr=or(i({},lr,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}})),_r=or(i({},lr,{data:0})),Sr={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},xr={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Or={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Or[e])&&!!t[e]}function Cr(){return wr}var jr=or(i({},fr,{key:function(e){if(e.key){var t=Sr[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=nr(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?xr[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cr,charCode:function(e){return"keypress"===e.type?nr(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?nr(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}})),Pr=or(i({},mr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Er=or(i({},fr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cr})),Ar=or(i({},lr,{propertyName:0,elapsedTime:0,pseudoElement:0})),Dr=or(i({},mr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Tr=[9,13,27,32],Ir=d&&"CompositionEvent"in window,Mr=null;d&&"documentMode"in document&&(Mr=document.documentMode);var kr=d&&"TextEvent"in window&&!Mr,Br=d&&(!Ir||Mr&&8<Mr&&11>=Mr),Vr=String.fromCharCode(32),Rr=!1;function Lr(e,t){switch(e){case"keyup":return-1!==Tr.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Nr(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Fr=!1;var Ur={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function zr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Ur[e.type]:"textarea"===t}function Hr(e,t,r,n){De(n),0<(t=In(t,"onChange")).length&&(r=new dr("onChange","change",null,r,n),e.push({event:r,listeners:t}))}var Gr=null,qr=null;function Wr(e){wn(e,0)}function Xr(e){if(Z($n(e)))return e}function Yr(e,t){if("change"===e)return t}var Qr=!1;if(d){var Kr;if(d){var Zr="oninput"in document;if(!Zr){var Jr=document.createElement("div");Jr.setAttribute("oninput","return;"),Zr="function"==typeof Jr.oninput}Kr=Zr}else Kr=!1;Qr=Kr&&(!document.documentMode||9<document.documentMode)}function $r(){Gr&&(Gr.detachEvent("onpropertychange",en),qr=Gr=null)}function en(e){if("value"===e.propertyName&&Xr(qr)){var t=[];if(Hr(t,qr,e,Ce(e)),e=Wr,Ve)e(t);else{Ve=!0;try{Ie(e,t)}finally{Ve=!1,Le()}}}}function tn(e,t,r){"focusin"===e?($r(),qr=r,(Gr=t).attachEvent("onpropertychange",en)):"focusout"===e&&$r()}function rn(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return Xr(qr)}function nn(e,t){if("click"===e)return Xr(t)}function an(e,t){if("input"===e||"change"===e)return Xr(t)}var on="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},sn=Object.prototype.hasOwnProperty;function un(e,t){if(on(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(n=0;n<r.length;n++)if(!sn.call(t,r[n])||!on(e[r[n]],t[r[n]]))return!1;return!0}function cn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function ln(e,t){var r,n=cn(e);for(e=0;n;){if(3===n.nodeType){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=cn(n)}}function dn(){for(var e=window,t=J();t instanceof e.HTMLIFrameElement;){try{var r="string"==typeof t.contentWindow.location.href}catch(e){r=!1}if(!r)break;t=J((e=t.contentWindow).document)}return t}function fn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var pn=d&&"documentMode"in document&&11>=document.documentMode,mn=null,hn=null,gn=null,vn=!1;function bn(e,t,r){var n=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;vn||null==mn||mn!==J(n)||("selectionStart"in(n=mn)&&fn(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},gn&&un(gn,n)||(gn=n,0<(n=In(hn,"onSelect")).length&&(t=new dr("onSelect","select",null,t,r),e.push({event:t,listeners:n}),t.target=mn)))}kt("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0),kt("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1),kt(Mt,2);for(var yn="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),_n=0;_n<yn.length;_n++)It.set(yn[_n],0);l("onMouseEnter",["mouseout","mouseover"]),l("onMouseLeave",["mouseout","mouseover"]),l("onPointerEnter",["pointerout","pointerover"]),l("onPointerLeave",["pointerout","pointerover"]),c("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),c("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),c("onBeforeInput",["compositionend","keypress","textInput","paste"]),c("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),c("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Sn="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xn=new Set("cancel close invalid load scroll toggle".split(" ").concat(Sn));function On(e,t,r){var n=e.type||"unknown-event";e.currentTarget=r,function(e,t,r,n,i,a,s,u,c){if(Ye.apply(this,arguments),He){if(!He)throw Error(o(198));var l=Ge;He=!1,Ge=null,qe||(qe=!0,We=l)}}(n,t,void 0,e),e.currentTarget=null}function wn(e,t){t=0!=(4&t);for(var r=0;r<e.length;r++){var n=e[r],i=n.event;n=n.listeners;e:{var a=void 0;if(t)for(var o=n.length-1;0<=o;o--){var s=n[o],u=s.instance,c=s.currentTarget;if(s=s.listener,u!==a&&i.isPropagationStopped())break e;On(i,s,c),a=u}else for(o=0;o<n.length;o++){if(u=(s=n[o]).instance,c=s.currentTarget,s=s.listener,u!==a&&i.isPropagationStopped())break e;On(i,s,c),a=u}}}if(qe)throw e=We,qe=!1,We=null,e}function Cn(e,t){var r=ti(t),n=e+"__bubble";r.has(n)||(An(t,e,2,!1),r.add(n))}var jn="_reactListening"+Math.random().toString(36).slice(2);function Pn(e){e[jn]||(e[jn]=!0,s.forEach((function(t){xn.has(t)||En(t,!1,e,null),En(t,!0,e,null)})))}function En(e,t,r,n){var i=4<arguments.length&&void 0!==arguments[4]?arguments[4]:0,a=r;if("selectionchange"===e&&9!==r.nodeType&&(a=r.ownerDocument),null!==n&&!t&&xn.has(e)){if("scroll"!==e)return;i|=2,a=n}var o=ti(a),s=e+"__"+(t?"capture":"bubble");o.has(s)||(t&&(i|=4),An(a,e,i,t),o.add(s))}function An(e,t,r,n){var i=It.get(t);switch(void 0===i?2:i){case 0:i=Qt;break;case 1:i=Kt;break;default:i=Zt}r=i.bind(null,t,r,e),i=void 0,!Fe||"touchstart"!==t&&"touchmove"!==t&&"wheel"!==t||(i=!0),n?void 0!==i?e.addEventListener(t,r,{capture:!0,passive:i}):e.addEventListener(t,r,!0):void 0!==i?e.addEventListener(t,r,{passive:i}):e.addEventListener(t,r,!1)}function Dn(e,t,r,n,i){var a=n;if(0==(1&t)&&0==(2&t)&&null!==n)e:for(;;){if(null===n)return;var o=n.tag;if(3===o||4===o){var s=n.stateNode.containerInfo;if(s===i||8===s.nodeType&&s.parentNode===i)break;if(4===o)for(o=n.return;null!==o;){var u=o.tag;if((3===u||4===u)&&((u=o.stateNode.containerInfo)===i||8===u.nodeType&&u.parentNode===i))return;o=o.return}for(;null!==s;){if(null===(o=Zn(s)))return;if(5===(u=o.tag)||6===u){n=a=o;continue e}s=s.parentNode}}n=n.return}!function(e,t,r){if(Re)return e(t,r);Re=!0;try{Be(e,t,r)}finally{Re=!1,Le()}}((function(){var n=a,i=Ce(r),o=[];e:{var s=Tt.get(e);if(void 0!==s){var u=dr,c=e;switch(e){case"keypress":if(0===nr(r))break e;case"keydown":case"keyup":u=jr;break;case"focusin":c="focus",u=vr;break;case"focusout":c="blur",u=vr;break;case"beforeblur":case"afterblur":u=vr;break;case"click":if(2===r.button)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":u=hr;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":u=gr;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":u=Er;break;case Pt:case Et:case At:u=br;break;case Dt:u=Ar;break;case"scroll":u=pr;break;case"wheel":u=Dr;break;case"copy":case"cut":case"paste":u=yr;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":u=Pr}var l=0!=(4&t),d=!l&&"scroll"===e,f=l?null!==s?s+"Capture":null:s;l=[];for(var p,m=n;null!==m;){var h=(p=m).stateNode;if(5===p.tag&&null!==h&&(p=h,null!==f&&(null!=(h=Ne(m,f))&&l.push(Tn(m,h,p)))),d)break;m=m.return}0<l.length&&(s=new u(s,c,null,r,i),o.push({event:s,listeners:l}))}}if(0==(7&t)){if(u="mouseout"===e||"pointerout"===e,(!(s="mouseover"===e||"pointerover"===e)||0!=(16&t)||!(c=r.relatedTarget||r.fromElement)||!Zn(c)&&!c[Qn])&&(u||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,u?(u=n,null!==(c=(c=r.relatedTarget||r.toElement)?Zn(c):null)&&(c!==(d=Qe(c))||5!==c.tag&&6!==c.tag)&&(c=null)):(u=null,c=n),u!==c)){if(l=hr,h="onMouseLeave",f="onMouseEnter",m="mouse","pointerout"!==e&&"pointerover"!==e||(l=Pr,h="onPointerLeave",f="onPointerEnter",m="pointer"),d=null==u?s:$n(u),p=null==c?s:$n(c),(s=new l(h,m+"leave",u,r,i)).target=d,s.relatedTarget=p,h=null,Zn(i)===n&&((l=new l(f,m+"enter",c,r,i)).target=p,l.relatedTarget=d,h=l),d=h,u&&c)e:{for(f=c,m=0,p=l=u;p;p=Mn(p))m++;for(p=0,h=f;h;h=Mn(h))p++;for(;0<m-p;)l=Mn(l),m--;for(;0<p-m;)f=Mn(f),p--;for(;m--;){if(l===f||null!==f&&l===f.alternate)break e;l=Mn(l),f=Mn(f)}l=null}else l=null;null!==u&&kn(o,s,u,l,!1),null!==c&&null!==d&&kn(o,d,c,l,!0)}if("select"===(u=(s=n?$n(n):window).nodeName&&s.nodeName.toLowerCase())||"input"===u&&"file"===s.type)var g=Yr;else if(zr(s))if(Qr)g=an;else{g=rn;var v=tn}else(u=s.nodeName)&&"input"===u.toLowerCase()&&("checkbox"===s.type||"radio"===s.type)&&(g=nn);switch(g&&(g=g(e,n))?Hr(o,g,r,i):(v&&v(e,s,n),"focusout"===e&&(v=s._wrapperState)&&v.controlled&&"number"===s.type&&ie(s,"number",s.value)),v=n?$n(n):window,e){case"focusin":(zr(v)||"true"===v.contentEditable)&&(mn=v,hn=n,gn=null);break;case"focusout":gn=hn=mn=null;break;case"mousedown":vn=!0;break;case"contextmenu":case"mouseup":case"dragend":vn=!1,bn(o,r,i);break;case"selectionchange":if(pn)break;case"keydown":case"keyup":bn(o,r,i)}var b;if(Ir)e:{switch(e){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else Fr?Lr(e,r)&&(y="onCompositionEnd"):"keydown"===e&&229===r.keyCode&&(y="onCompositionStart");y&&(Br&&"ko"!==r.locale&&(Fr||"onCompositionStart"!==y?"onCompositionEnd"===y&&Fr&&(b=rr()):(er="value"in($t=i)?$t.value:$t.textContent,Fr=!0)),0<(v=In(n,y)).length&&(y=new _r(y,e,null,r,i),o.push({event:y,listeners:v}),b?y.data=b:null!==(b=Nr(r))&&(y.data=b))),(b=kr?function(e,t){switch(e){case"compositionend":return Nr(t);case"keypress":return 32!==t.which?null:(Rr=!0,Vr);case"textInput":return(e=t.data)===Vr&&Rr?null:e;default:return null}}(e,r):function(e,t){if(Fr)return"compositionend"===e||!Ir&&Lr(e,t)?(e=rr(),tr=er=$t=null,Fr=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Br&&"ko"!==t.locale?null:t.data;default:return null}}(e,r))&&(0<(n=In(n,"onBeforeInput")).length&&(i=new _r("onBeforeInput","beforeinput",null,r,i),o.push({event:i,listeners:n}),i.data=b))}wn(o,t)}))}function Tn(e,t,r){return{instance:e,listener:t,currentTarget:r}}function In(e,t){for(var r=t+"Capture",n=[];null!==e;){var i=e,a=i.stateNode;5===i.tag&&null!==a&&(i=a,null!=(a=Ne(e,r))&&n.unshift(Tn(e,a,i)),null!=(a=Ne(e,t))&&n.push(Tn(e,a,i))),e=e.return}return n}function Mn(e){if(null===e)return null;do{e=e.return}while(e&&5!==e.tag);return e||null}function kn(e,t,r,n,i){for(var a=t._reactName,o=[];null!==r&&r!==n;){var s=r,u=s.alternate,c=s.stateNode;if(null!==u&&u===n)break;5===s.tag&&null!==c&&(s=c,i?null!=(u=Ne(r,a))&&o.unshift(Tn(r,u,s)):i||null!=(u=Ne(r,a))&&o.push(Tn(r,u,s))),r=r.return}0!==o.length&&e.push({event:t,listeners:o})}function Bn(){}var Vn=null,Rn=null;function Ln(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function Nn(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}var Fn="function"==typeof setTimeout?setTimeout:void 0,Un="function"==typeof clearTimeout?clearTimeout:void 0;function zn(e){1===e.nodeType?e.textContent="":9===e.nodeType&&(null!=(e=e.body)&&(e.textContent=""))}function Hn(e){for(;null!=e;e=e.nextSibling){var t=e.nodeType;if(1===t||3===t)break}return e}function Gn(e){e=e.previousSibling;for(var t=0;e;){if(8===e.nodeType){var r=e.data;if("$"===r||"$!"===r||"$?"===r){if(0===t)return e;t--}else"/$"===r&&t++}e=e.previousSibling}return null}var qn=0;var Wn=Math.random().toString(36).slice(2),Xn="__reactFiber$"+Wn,Yn="__reactProps$"+Wn,Qn="__reactContainer$"+Wn,Kn="__reactEvents$"+Wn;function Zn(e){var t=e[Xn];if(t)return t;for(var r=e.parentNode;r;){if(t=r[Qn]||r[Xn]){if(r=t.alternate,null!==t.child||null!==r&&null!==r.child)for(e=Gn(e);null!==e;){if(r=e[Xn])return r;e=Gn(e)}return t}r=(e=r).parentNode}return null}function Jn(e){return!(e=e[Xn]||e[Qn])||5!==e.tag&&6!==e.tag&&13!==e.tag&&3!==e.tag?null:e}function $n(e){if(5===e.tag||6===e.tag)return e.stateNode;throw Error(o(33))}function ei(e){return e[Yn]||null}function ti(e){var t=e[Kn];return void 0===t&&(t=e[Kn]=new Set),t}var ri=[],ni=-1;function ii(e){return{current:e}}function ai(e){0>ni||(e.current=ri[ni],ri[ni]=null,ni--)}function oi(e,t){ni++,ri[ni]=e.current,e.current=t}var si={},ui=ii(si),ci=ii(!1),li=si;function di(e,t){var r=e.type.contextTypes;if(!r)return si;var n=e.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===t)return n.__reactInternalMemoizedMaskedChildContext;var i,a={};for(i in r)a[i]=t[i];return n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function fi(e){return null!=(e=e.childContextTypes)}function pi(){ai(ci),ai(ui)}function mi(e,t,r){if(ui.current!==si)throw Error(o(168));oi(ui,t),oi(ci,r)}function hi(e,t,r){var n=e.stateNode;if(e=t.childContextTypes,"function"!=typeof n.getChildContext)return r;for(var a in n=n.getChildContext())if(!(a in e))throw Error(o(108,X(t)||"Unknown",a));return i({},r,n)}function gi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||si,li=ui.current,oi(ui,e),oi(ci,ci.current),!0}function vi(e,t,r){var n=e.stateNode;if(!n)throw Error(o(169));r?(e=hi(e,t,li),n.__reactInternalMemoizedMergedChildContext=e,ai(ci),ai(ui),oi(ui,e)):ai(ci),oi(ci,r)}var bi=null,yi=null,_i=a.unstable_runWithPriority,Si=a.unstable_scheduleCallback,xi=a.unstable_cancelCallback,Oi=a.unstable_shouldYield,wi=a.unstable_requestPaint,Ci=a.unstable_now,ji=a.unstable_getCurrentPriorityLevel,Pi=a.unstable_ImmediatePriority,Ei=a.unstable_UserBlockingPriority,Ai=a.unstable_NormalPriority,Di=a.unstable_LowPriority,Ti=a.unstable_IdlePriority,Ii={},Mi=void 0!==wi?wi:function(){},ki=null,Bi=null,Vi=!1,Ri=Ci(),Li=1e4>Ri?Ci:function(){return Ci()-Ri};function Ni(){switch(ji()){case Pi:return 99;case Ei:return 98;case Ai:return 97;case Di:return 96;case Ti:return 95;default:throw Error(o(332))}}function Fi(e){switch(e){case 99:return Pi;case 98:return Ei;case 97:return Ai;case 96:return Di;case 95:return Ti;default:throw Error(o(332))}}function Ui(e,t){return e=Fi(e),_i(e,t)}function zi(e,t,r){return e=Fi(e),Si(e,t,r)}function Hi(){if(null!==Bi){var e=Bi;Bi=null,xi(e)}Gi()}function Gi(){if(!Vi&&null!==ki){Vi=!0;var e=0;try{var t=ki;Ui(99,(function(){for(;e<t.length;e++){var r=t[e];do{r=r(!0)}while(null!==r)}})),ki=null}catch(t){throw null!==ki&&(ki=ki.slice(e+1)),Si(Pi,Hi),t}finally{Vi=!1}}}var qi=S.ReactCurrentBatchConfig;function Wi(e,t){if(e&&e.defaultProps){for(var r in t=i({},t),e=e.defaultProps)void 0===t[r]&&(t[r]=e[r]);return t}return t}var Xi=ii(null),Yi=null,Qi=null,Ki=null;function Zi(){Ki=Qi=Yi=null}function Ji(e){var t=Xi.current;ai(Xi),e.type._context._currentValue=t}function $i(e,t){for(;null!==e;){var r=e.alternate;if((e.childLanes&t)===t){if(null===r||(r.childLanes&t)===t)break;r.childLanes|=t}else e.childLanes|=t,null!==r&&(r.childLanes|=t);e=e.return}}function ea(e,t){Yi=e,Ki=Qi=null,null!==(e=e.dependencies)&&null!==e.firstContext&&(0!=(e.lanes&t)&&(Io=!0),e.firstContext=null)}function ta(e,t){if(Ki!==e&&!1!==t&&0!==t)if("number"==typeof t&&1073741823!==t||(Ki=e,t=1073741823),t={context:e,observedBits:t,next:null},null===Qi){if(null===Yi)throw Error(o(308));Qi=t,Yi.dependencies={lanes:0,firstContext:t,responders:null}}else Qi=Qi.next=t;return e._currentValue}var ra=!1;function na(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function ia(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function aa(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oa(e,t){if(null!==(e=e.updateQueue)){var r=(e=e.shared).pending;null===r?t.next=t:(t.next=r.next,r.next=t),e.pending=t}}function sa(e,t){var r=e.updateQueue,n=e.alternate;if(null!==n&&r===(n=n.updateQueue)){var i=null,a=null;if(null!==(r=r.firstBaseUpdate)){do{var o={eventTime:r.eventTime,lane:r.lane,tag:r.tag,payload:r.payload,callback:r.callback,next:null};null===a?i=a=o:a=a.next=o,r=r.next}while(null!==r);null===a?i=a=t:a=a.next=t}else i=a=t;return r={baseState:n.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:n.shared,effects:n.effects},void(e.updateQueue=r)}null===(e=r.lastBaseUpdate)?r.firstBaseUpdate=t:e.next=t,r.lastBaseUpdate=t}function ua(e,t,r,n){var a=e.updateQueue;ra=!1;var o=a.firstBaseUpdate,s=a.lastBaseUpdate,u=a.shared.pending;if(null!==u){a.shared.pending=null;var c=u,l=c.next;c.next=null,null===s?o=l:s.next=l,s=c;var d=e.alternate;if(null!==d){var f=(d=d.updateQueue).lastBaseUpdate;f!==s&&(null===f?d.firstBaseUpdate=l:f.next=l,d.lastBaseUpdate=c)}}if(null!==o){for(f=a.baseState,s=0,d=l=c=null;;){u=o.lane;var p=o.eventTime;if((n&u)===u){null!==d&&(d=d.next={eventTime:p,lane:0,tag:o.tag,payload:o.payload,callback:o.callback,next:null});e:{var m=e,h=o;switch(u=t,p=r,h.tag){case 1:if("function"==typeof(m=h.payload)){f=m.call(p,f,u);break e}f=m;break e;case 3:m.flags=-4097&m.flags|64;case 0:if(null==(u="function"==typeof(m=h.payload)?m.call(p,f,u):m))break e;f=i({},f,u);break e;case 2:ra=!0}}null!==o.callback&&(e.flags|=32,null===(u=a.effects)?a.effects=[o]:u.push(o))}else p={eventTime:p,lane:u,tag:o.tag,payload:o.payload,callback:o.callback,next:null},null===d?(l=d=p,c=f):d=d.next=p,s|=u;if(null===(o=o.next)){if(null===(u=a.shared.pending))break;o=u.next,u.next=null,a.lastBaseUpdate=u,a.shared.pending=null}}null===d&&(c=f),a.baseState=c,a.firstBaseUpdate=l,a.lastBaseUpdate=d,ks|=s,e.lanes=s,e.memoizedState=f}}function ca(e,t,r){if(e=t.effects,t.effects=null,null!==e)for(t=0;t<e.length;t++){var n=e[t],i=n.callback;if(null!==i){if(n.callback=null,n=r,"function"!=typeof i)throw Error(o(191,i));i.call(n)}}}var la=(new n.Component).refs;function da(e,t,r,n){r=null==(r=r(n,t=e.memoizedState))?t:i({},t,r),e.memoizedState=r,0===e.lanes&&(e.updateQueue.baseState=r)}var fa={isMounted:function(e){return!!(e=e._reactInternals)&&Qe(e)===e},enqueueSetState:function(e,t,r){e=e._reactInternals;var n=au(),i=ou(e),a=aa(n,i);a.payload=t,null!=r&&(a.callback=r),oa(e,a),su(e,i,n)},enqueueReplaceState:function(e,t,r){e=e._reactInternals;var n=au(),i=ou(e),a=aa(n,i);a.tag=1,a.payload=t,null!=r&&(a.callback=r),oa(e,a),su(e,i,n)},enqueueForceUpdate:function(e,t){e=e._reactInternals;var r=au(),n=ou(e),i=aa(r,n);i.tag=2,null!=t&&(i.callback=t),oa(e,i),su(e,n,r)}};function pa(e,t,r,n,i,a,o){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(n,a,o):!t.prototype||!t.prototype.isPureReactComponent||(!un(r,n)||!un(i,a))}function ma(e,t,r){var n=!1,i=si,a=t.contextType;return"object"==typeof a&&null!==a?a=ta(a):(i=fi(t)?li:ui.current,a=(n=null!=(n=t.contextTypes))?di(e,i):si),t=new t(r,a),e.memoizedState=null!==t.state&&void 0!==t.state?t.state:null,t.updater=fa,e.stateNode=t,t._reactInternals=e,n&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=a),t}function ha(e,t,r,n){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(r,n),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(r,n),t.state!==e&&fa.enqueueReplaceState(t,t.state,null)}function ga(e,t,r,n){var i=e.stateNode;i.props=r,i.state=e.memoizedState,i.refs=la,na(e);var a=t.contextType;"object"==typeof a&&null!==a?i.context=ta(a):(a=fi(t)?li:ui.current,i.context=di(e,a)),ua(e,r,i,n),i.state=e.memoizedState,"function"==typeof(a=t.getDerivedStateFromProps)&&(da(e,t,a,r),i.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof i.getSnapshotBeforeUpdate||"function"!=typeof i.UNSAFE_componentWillMount&&"function"!=typeof i.componentWillMount||(t=i.state,"function"==typeof i.componentWillMount&&i.componentWillMount(),"function"==typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount(),t!==i.state&&fa.enqueueReplaceState(i,i.state,null),ua(e,r,i,n),i.state=e.memoizedState),"function"==typeof i.componentDidMount&&(e.flags|=4)}var va=Array.isArray;function ba(e,t,r){if(null!==(e=r.ref)&&"function"!=typeof e&&"object"!=typeof e){if(r._owner){if(r=r._owner){if(1!==r.tag)throw Error(o(309));var n=r.stateNode}if(!n)throw Error(o(147,e));var i=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===i?t.ref:((t=function(e){var t=n.refs;t===la&&(t=n.refs={}),null===e?delete t[i]:t[i]=e})._stringRef=i,t)}if("string"!=typeof e)throw Error(o(284));if(!r._owner)throw Error(o(290,e))}return e}function ya(e,t){if("textarea"!==e.type)throw Error(o(31,"[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t))}function _a(e){function t(t,r){if(e){var n=t.lastEffect;null!==n?(n.nextEffect=r,t.lastEffect=r):t.firstEffect=t.lastEffect=r,r.nextEffect=null,r.flags=8}}function r(r,n){if(!e)return null;for(;null!==n;)t(r,n),n=n.sibling;return null}function n(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function i(e,t){return(e=Nu(e,t)).index=0,e.sibling=null,e}function a(t,r,n){return t.index=n,e?null!==(n=t.alternate)?(n=n.index)<r?(t.flags=2,r):n:(t.flags=2,r):r}function s(t){return e&&null===t.alternate&&(t.flags=2),t}function u(e,t,r,n){return null===t||6!==t.tag?((t=Hu(r,e.mode,n)).return=e,t):((t=i(t,r)).return=e,t)}function c(e,t,r,n){return null!==t&&t.elementType===r.type?((n=i(t,r.props)).ref=ba(e,t,r),n.return=e,n):((n=Fu(r.type,r.key,r.props,null,e.mode,n)).ref=ba(e,t,r),n.return=e,n)}function l(e,t,r,n){return null===t||4!==t.tag||t.stateNode.containerInfo!==r.containerInfo||t.stateNode.implementation!==r.implementation?((t=Gu(r,e.mode,n)).return=e,t):((t=i(t,r.children||[])).return=e,t)}function d(e,t,r,n,a){return null===t||7!==t.tag?((t=Uu(r,e.mode,n,a)).return=e,t):((t=i(t,r)).return=e,t)}function f(e,t,r){if("string"==typeof t||"number"==typeof t)return(t=Hu(""+t,e.mode,r)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case x:return(r=Fu(t.type,t.key,t.props,null,e.mode,r)).ref=ba(e,null,t),r.return=e,r;case O:return(t=Gu(t,e.mode,r)).return=e,t}if(va(t)||z(t))return(t=Uu(t,e.mode,r,null)).return=e,t;ya(e,t)}return null}function p(e,t,r,n){var i=null!==t?t.key:null;if("string"==typeof r||"number"==typeof r)return null!==i?null:u(e,t,""+r,n);if("object"==typeof r&&null!==r){switch(r.$$typeof){case x:return r.key===i?r.type===w?d(e,t,r.props.children,n,i):c(e,t,r,n):null;case O:return r.key===i?l(e,t,r,n):null}if(va(r)||z(r))return null!==i?null:d(e,t,r,n,null);ya(e,r)}return null}function m(e,t,r,n,i){if("string"==typeof n||"number"==typeof n)return u(t,e=e.get(r)||null,""+n,i);if("object"==typeof n&&null!==n){switch(n.$$typeof){case x:return e=e.get(null===n.key?r:n.key)||null,n.type===w?d(t,e,n.props.children,i,n.key):c(t,e,n,i);case O:return l(t,e=e.get(null===n.key?r:n.key)||null,n,i)}if(va(n)||z(n))return d(t,e=e.get(r)||null,n,i,null);ya(t,n)}return null}function h(i,o,s,u){for(var c=null,l=null,d=o,h=o=0,g=null;null!==d&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var v=p(i,d,s[h],u);if(null===v){null===d&&(d=g);break}e&&d&&null===v.alternate&&t(i,d),o=a(v,o,h),null===l?c=v:l.sibling=v,l=v,d=g}if(h===s.length)return r(i,d),c;if(null===d){for(;h<s.length;h++)null!==(d=f(i,s[h],u))&&(o=a(d,o,h),null===l?c=d:l.sibling=d,l=d);return c}for(d=n(i,d);h<s.length;h++)null!==(g=m(d,i,h,s[h],u))&&(e&&null!==g.alternate&&d.delete(null===g.key?h:g.key),o=a(g,o,h),null===l?c=g:l.sibling=g,l=g);return e&&d.forEach((function(e){return t(i,e)})),c}function g(i,s,u,c){var l=z(u);if("function"!=typeof l)throw Error(o(150));if(null==(u=l.call(u)))throw Error(o(151));for(var d=l=null,h=s,g=s=0,v=null,b=u.next();null!==h&&!b.done;g++,b=u.next()){h.index>g?(v=h,h=null):v=h.sibling;var y=p(i,h,b.value,c);if(null===y){null===h&&(h=v);break}e&&h&&null===y.alternate&&t(i,h),s=a(y,s,g),null===d?l=y:d.sibling=y,d=y,h=v}if(b.done)return r(i,h),l;if(null===h){for(;!b.done;g++,b=u.next())null!==(b=f(i,b.value,c))&&(s=a(b,s,g),null===d?l=b:d.sibling=b,d=b);return l}for(h=n(i,h);!b.done;g++,b=u.next())null!==(b=m(h,i,g,b.value,c))&&(e&&null!==b.alternate&&h.delete(null===b.key?g:b.key),s=a(b,s,g),null===d?l=b:d.sibling=b,d=b);return e&&h.forEach((function(e){return t(i,e)})),l}return function(e,n,a,u){var c="object"==typeof a&&null!==a&&a.type===w&&null===a.key;c&&(a=a.props.children);var l="object"==typeof a&&null!==a;if(l)switch(a.$$typeof){case x:e:{for(l=a.key,c=n;null!==c;){if(c.key===l){switch(c.tag){case 7:if(a.type===w){r(e,c.sibling),(n=i(c,a.props.children)).return=e,e=n;break e}break;default:if(c.elementType===a.type){r(e,c.sibling),(n=i(c,a.props)).ref=ba(e,c,a),n.return=e,e=n;break e}}r(e,c);break}t(e,c),c=c.sibling}a.type===w?((n=Uu(a.props.children,e.mode,u,a.key)).return=e,e=n):((u=Fu(a.type,a.key,a.props,null,e.mode,u)).ref=ba(e,n,a),u.return=e,e=u)}return s(e);case O:e:{for(c=a.key;null!==n;){if(n.key===c){if(4===n.tag&&n.stateNode.containerInfo===a.containerInfo&&n.stateNode.implementation===a.implementation){r(e,n.sibling),(n=i(n,a.children||[])).return=e,e=n;break e}r(e,n);break}t(e,n),n=n.sibling}(n=Gu(a,e.mode,u)).return=e,e=n}return s(e)}if("string"==typeof a||"number"==typeof a)return a=""+a,null!==n&&6===n.tag?(r(e,n.sibling),(n=i(n,a)).return=e,e=n):(r(e,n),(n=Hu(a,e.mode,u)).return=e,e=n),s(e);if(va(a))return h(e,n,a,u);if(z(a))return g(e,n,a,u);if(l&&ya(e,a),void 0===a&&!c)switch(e.tag){case 1:case 22:case 0:case 11:case 15:throw Error(o(152,X(e.type)||"Component"))}return r(e,n)}}var Sa=_a(!0),xa=_a(!1),Oa={},wa=ii(Oa),Ca=ii(Oa),ja=ii(Oa);function Pa(e){if(e===Oa)throw Error(o(174));return e}function Ea(e,t){switch(oi(ja,t),oi(Ca,e),oi(wa,Oa),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:me(null,"");break;default:t=me(t=(e=8===e?t.parentNode:t).namespaceURI||null,e=e.tagName)}ai(wa),oi(wa,t)}function Aa(){ai(wa),ai(Ca),ai(ja)}function Da(e){Pa(ja.current);var t=Pa(wa.current),r=me(t,e.type);t!==r&&(oi(Ca,e),oi(wa,r))}function Ta(e){Ca.current===e&&(ai(wa),ai(Ca))}var Ia=ii(0);function Ma(e){for(var t=e;null!==t;){if(13===t.tag){var r=t.memoizedState;if(null!==r&&(null===(r=r.dehydrated)||"$?"===r.data||"$!"===r.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(64&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ka=null,Ba=null,Va=!1;function Ra(e,t){var r=Ru(5,null,null,0);r.elementType="DELETED",r.type="DELETED",r.stateNode=t,r.return=e,r.flags=8,null!==e.lastEffect?(e.lastEffect.nextEffect=r,e.lastEffect=r):e.firstEffect=e.lastEffect=r}function La(e,t){switch(e.tag){case 5:var r=e.type;return null!==(t=1!==t.nodeType||r.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 6:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);case 13:default:return!1}}function Na(e){if(Va){var t=Ba;if(t){var r=t;if(!La(e,t)){if(!(t=Hn(r.nextSibling))||!La(e,t))return e.flags=-1025&e.flags|2,Va=!1,void(ka=e);Ra(ka,r)}ka=e,Ba=Hn(t.firstChild)}else e.flags=-1025&e.flags|2,Va=!1,ka=e}}function Fa(e){for(e=e.return;null!==e&&5!==e.tag&&3!==e.tag&&13!==e.tag;)e=e.return;ka=e}function Ua(e){if(e!==ka)return!1;if(!Va)return Fa(e),Va=!0,!1;var t=e.type;if(5!==e.tag||"head"!==t&&"body"!==t&&!Nn(t,e.memoizedProps))for(t=Ba;t;)Ra(e,t),t=Hn(t.nextSibling);if(Fa(e),13===e.tag){if(!(e=null!==(e=e.memoizedState)?e.dehydrated:null))throw Error(o(317));e:{for(e=e.nextSibling,t=0;e;){if(8===e.nodeType){var r=e.data;if("/$"===r){if(0===t){Ba=Hn(e.nextSibling);break e}t--}else"$"!==r&&"$!"!==r&&"$?"!==r||t++}e=e.nextSibling}Ba=null}}else Ba=ka?Hn(e.stateNode.nextSibling):null;return!0}function za(){Ba=ka=null,Va=!1}var Ha=[];function Ga(){for(var e=0;e<Ha.length;e++)Ha[e]._workInProgressVersionPrimary=null;Ha.length=0}var qa=S.ReactCurrentDispatcher,Wa=S.ReactCurrentBatchConfig,Xa=0,Ya=null,Qa=null,Ka=null,Za=!1,Ja=!1;function $a(){throw Error(o(321))}function eo(e,t){if(null===t)return!1;for(var r=0;r<t.length&&r<e.length;r++)if(!on(e[r],t[r]))return!1;return!0}function to(e,t,r,n,i,a){if(Xa=a,Ya=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,qa.current=null===e||null===e.memoizedState?Eo:Ao,e=r(n,i),Ja){a=0;do{if(Ja=!1,!(25>a))throw Error(o(301));a+=1,Ka=Qa=null,t.updateQueue=null,qa.current=Do,e=r(n,i)}while(Ja)}if(qa.current=Po,t=null!==Qa&&null!==Qa.next,Xa=0,Ka=Qa=Ya=null,Za=!1,t)throw Error(o(300));return e}function ro(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return null===Ka?Ya.memoizedState=Ka=e:Ka=Ka.next=e,Ka}function no(){if(null===Qa){var e=Ya.alternate;e=null!==e?e.memoizedState:null}else e=Qa.next;var t=null===Ka?Ya.memoizedState:Ka.next;if(null!==t)Ka=t,Qa=e;else{if(null===e)throw Error(o(310));e={memoizedState:(Qa=e).memoizedState,baseState:Qa.baseState,baseQueue:Qa.baseQueue,queue:Qa.queue,next:null},null===Ka?Ya.memoizedState=Ka=e:Ka=Ka.next=e}return Ka}function io(e,t){return"function"==typeof t?t(e):t}function ao(e){var t=no(),r=t.queue;if(null===r)throw Error(o(311));r.lastRenderedReducer=e;var n=Qa,i=n.baseQueue,a=r.pending;if(null!==a){if(null!==i){var s=i.next;i.next=a.next,a.next=s}n.baseQueue=i=a,r.pending=null}if(null!==i){i=i.next,n=n.baseState;var u=s=a=null,c=i;do{var l=c.lane;if((Xa&l)===l)null!==u&&(u=u.next={lane:0,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null}),n=c.eagerReducer===e?c.eagerState:e(n,c.action);else{var d={lane:l,action:c.action,eagerReducer:c.eagerReducer,eagerState:c.eagerState,next:null};null===u?(s=u=d,a=n):u=u.next=d,Ya.lanes|=l,ks|=l}c=c.next}while(null!==c&&c!==i);null===u?a=n:u.next=s,on(n,t.memoizedState)||(Io=!0),t.memoizedState=n,t.baseState=a,t.baseQueue=u,r.lastRenderedState=n}return[t.memoizedState,r.dispatch]}function oo(e){var t=no(),r=t.queue;if(null===r)throw Error(o(311));r.lastRenderedReducer=e;var n=r.dispatch,i=r.pending,a=t.memoizedState;if(null!==i){r.pending=null;var s=i=i.next;do{a=e(a,s.action),s=s.next}while(s!==i);on(a,t.memoizedState)||(Io=!0),t.memoizedState=a,null===t.baseQueue&&(t.baseState=a),r.lastRenderedState=a}return[a,n]}function so(e,t,r){var n=t._getVersion;n=n(t._source);var i=t._workInProgressVersionPrimary;if(null!==i?e=i===n:(e=e.mutableReadLanes,(e=(Xa&e)===e)&&(t._workInProgressVersionPrimary=n,Ha.push(t))),e)return r(t._source);throw Ha.push(t),Error(o(350))}function uo(e,t,r,n){var i=js;if(null===i)throw Error(o(349));var a=t._getVersion,s=a(t._source),u=qa.current,c=u.useState((function(){return so(i,t,r)})),l=c[1],d=c[0];c=Ka;var f=e.memoizedState,p=f.refs,m=p.getSnapshot,h=f.source;f=f.subscribe;var g=Ya;return e.memoizedState={refs:p,source:t,subscribe:n},u.useEffect((function(){p.getSnapshot=r,p.setSnapshot=l;var e=a(t._source);if(!on(s,e)){e=r(t._source),on(d,e)||(l(e),e=ou(g),i.mutableReadLanes|=e&i.pendingLanes),e=i.mutableReadLanes,i.entangledLanes|=e;for(var n=i.entanglements,o=e;0<o;){var u=31-Ht(o),c=1<<u;n[u]|=e,o&=~c}}}),[r,t,n]),u.useEffect((function(){return n(t._source,(function(){var e=p.getSnapshot,r=p.setSnapshot;try{r(e(t._source));var n=ou(g);i.mutableReadLanes|=n&i.pendingLanes}catch(e){r((function(){throw e}))}}))}),[t,n]),on(m,r)&&on(h,t)&&on(f,n)||((e={pending:null,dispatch:null,lastRenderedReducer:io,lastRenderedState:d}).dispatch=l=jo.bind(null,Ya,e),c.queue=e,c.baseQueue=null,d=so(i,t,r),c.memoizedState=c.baseState=d),d}function co(e,t,r){return uo(no(),e,t,r)}function lo(e){var t=ro();return"function"==typeof e&&(e=e()),t.memoizedState=t.baseState=e,e=(e=t.queue={pending:null,dispatch:null,lastRenderedReducer:io,lastRenderedState:e}).dispatch=jo.bind(null,Ya,e),[t.memoizedState,e]}function fo(e,t,r,n){return e={tag:e,create:t,destroy:r,deps:n,next:null},null===(t=Ya.updateQueue)?(t={lastEffect:null},Ya.updateQueue=t,t.lastEffect=e.next=e):null===(r=t.lastEffect)?t.lastEffect=e.next=e:(n=r.next,r.next=e,e.next=n,t.lastEffect=e),e}function po(e){return e={current:e},ro().memoizedState=e}function mo(){return no().memoizedState}function ho(e,t,r,n){var i=ro();Ya.flags|=e,i.memoizedState=fo(1|t,r,void 0,void 0===n?null:n)}function go(e,t,r,n){var i=no();n=void 0===n?null:n;var a=void 0;if(null!==Qa){var o=Qa.memoizedState;if(a=o.destroy,null!==n&&eo(n,o.deps))return void fo(t,r,a,n)}Ya.flags|=e,i.memoizedState=fo(1|t,r,a,n)}function vo(e,t){return ho(516,4,e,t)}function bo(e,t){return go(516,4,e,t)}function yo(e,t){return go(4,2,e,t)}function _o(e,t){return"function"==typeof t?(e=e(),t(e),function(){t(null)}):null!=t?(e=e(),t.current=e,function(){t.current=null}):void 0}function So(e,t,r){return r=null!=r?r.concat([e]):null,go(4,2,_o.bind(null,t,e),r)}function xo(){}function Oo(e,t){var r=no();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&eo(t,n[1])?n[0]:(r.memoizedState=[e,t],e)}function wo(e,t){var r=no();t=void 0===t?null:t;var n=r.memoizedState;return null!==n&&null!==t&&eo(t,n[1])?n[0]:(e=e(),r.memoizedState=[e,t],e)}function Co(e,t){var r=Ni();Ui(98>r?98:r,(function(){e(!0)})),Ui(97<r?97:r,(function(){var r=Wa.transition;Wa.transition=1;try{e(!1),t()}finally{Wa.transition=r}}))}function jo(e,t,r){var n=au(),i=ou(e),a={lane:i,action:r,eagerReducer:null,eagerState:null,next:null},o=t.pending;if(null===o?a.next=a:(a.next=o.next,o.next=a),t.pending=a,o=e.alternate,e===Ya||null!==o&&o===Ya)Ja=Za=!0;else{if(0===e.lanes&&(null===o||0===o.lanes)&&null!==(o=t.lastRenderedReducer))try{var s=t.lastRenderedState,u=o(s,r);if(a.eagerReducer=o,a.eagerState=u,on(u,s))return}catch(e){}su(e,i,n)}}var Po={readContext:ta,useCallback:$a,useContext:$a,useEffect:$a,useImperativeHandle:$a,useLayoutEffect:$a,useMemo:$a,useReducer:$a,useRef:$a,useState:$a,useDebugValue:$a,useDeferredValue:$a,useTransition:$a,useMutableSource:$a,useOpaqueIdentifier:$a,unstable_isNewReconciler:!1},Eo={readContext:ta,useCallback:function(e,t){return ro().memoizedState=[e,void 0===t?null:t],e},useContext:ta,useEffect:vo,useImperativeHandle:function(e,t,r){return r=null!=r?r.concat([e]):null,ho(4,2,_o.bind(null,t,e),r)},useLayoutEffect:function(e,t){return ho(4,2,e,t)},useMemo:function(e,t){var r=ro();return t=void 0===t?null:t,e=e(),r.memoizedState=[e,t],e},useReducer:function(e,t,r){var n=ro();return t=void 0!==r?r(t):t,n.memoizedState=n.baseState=t,e=(e=n.queue={pending:null,dispatch:null,lastRenderedReducer:e,lastRenderedState:t}).dispatch=jo.bind(null,Ya,e),[n.memoizedState,e]},useRef:po,useState:lo,useDebugValue:xo,useDeferredValue:function(e){var t=lo(e),r=t[0],n=t[1];return vo((function(){var t=Wa.transition;Wa.transition=1;try{n(e)}finally{Wa.transition=t}}),[e]),r},useTransition:function(){var e=lo(!1),t=e[0];return po(e=Co.bind(null,e[1])),[e,t]},useMutableSource:function(e,t,r){var n=ro();return n.memoizedState={refs:{getSnapshot:t,setSnapshot:null},source:e,subscribe:r},uo(n,e,t,r)},useOpaqueIdentifier:function(){if(Va){var e=!1,t=function(e){return{$$typeof:B,toString:e,valueOf:e}}((function(){throw e||(e=!0,r("r:"+(qn++).toString(36))),Error(o(355))})),r=lo(t)[1];return 0==(2&Ya.mode)&&(Ya.flags|=516,fo(5,(function(){r("r:"+(qn++).toString(36))}),void 0,null)),t}return lo(t="r:"+(qn++).toString(36)),t},unstable_isNewReconciler:!1},Ao={readContext:ta,useCallback:Oo,useContext:ta,useEffect:bo,useImperativeHandle:So,useLayoutEffect:yo,useMemo:wo,useReducer:ao,useRef:mo,useState:function(){return ao(io)},useDebugValue:xo,useDeferredValue:function(e){var t=ao(io),r=t[0],n=t[1];return bo((function(){var t=Wa.transition;Wa.transition=1;try{n(e)}finally{Wa.transition=t}}),[e]),r},useTransition:function(){var e=ao(io)[0];return[mo().current,e]},useMutableSource:co,useOpaqueIdentifier:function(){return ao(io)[0]},unstable_isNewReconciler:!1},Do={readContext:ta,useCallback:Oo,useContext:ta,useEffect:bo,useImperativeHandle:So,useLayoutEffect:yo,useMemo:wo,useReducer:oo,useRef:mo,useState:function(){return oo(io)},useDebugValue:xo,useDeferredValue:function(e){var t=oo(io),r=t[0],n=t[1];return bo((function(){var t=Wa.transition;Wa.transition=1;try{n(e)}finally{Wa.transition=t}}),[e]),r},useTransition:function(){var e=oo(io)[0];return[mo().current,e]},useMutableSource:co,useOpaqueIdentifier:function(){return oo(io)[0]},unstable_isNewReconciler:!1},To=S.ReactCurrentOwner,Io=!1;function Mo(e,t,r,n){t.child=null===e?xa(t,null,r,n):Sa(t,e.child,r,n)}function ko(e,t,r,n,i){r=r.render;var a=t.ref;return ea(t,i),n=to(e,t,r,n,a,i),null===e||Io?(t.flags|=1,Mo(e,t,n,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,es(e,t,i))}function Bo(e,t,r,n,i,a){if(null===e){var o=r.type;return"function"!=typeof o||Lu(o)||void 0!==o.defaultProps||null!==r.compare||void 0!==r.defaultProps?((e=Fu(r.type,null,n,t,t.mode,a)).ref=t.ref,e.return=t,t.child=e):(t.tag=15,t.type=o,Vo(e,t,o,n,i,a))}return o=e.child,0==(i&a)&&(i=o.memoizedProps,(r=null!==(r=r.compare)?r:un)(i,n)&&e.ref===t.ref)?es(e,t,a):(t.flags|=1,(e=Nu(o,n)).ref=t.ref,e.return=t,t.child=e)}function Vo(e,t,r,n,i,a){if(null!==e&&un(e.memoizedProps,n)&&e.ref===t.ref){if(Io=!1,0==(a&i))return t.lanes=e.lanes,es(e,t,a);0!=(16384&e.flags)&&(Io=!0)}return No(e,t,r,n,a)}function Ro(e,t,r){var n=t.pendingProps,i=n.children,a=null!==e?e.memoizedState:null;if("hidden"===n.mode||"unstable-defer-without-hiding"===n.mode)if(0==(4&t.mode))t.memoizedState={baseLanes:0},hu(t,r);else{if(0==(1073741824&r))return e=null!==a?a.baseLanes|r:r,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e},hu(t,e),null;t.memoizedState={baseLanes:0},hu(t,null!==a?a.baseLanes:r)}else null!==a?(n=a.baseLanes|r,t.memoizedState=null):n=r,hu(t,n);return Mo(e,t,i,r),t.child}function Lo(e,t){var r=t.ref;(null===e&&null!==r||null!==e&&e.ref!==r)&&(t.flags|=128)}function No(e,t,r,n,i){var a=fi(r)?li:ui.current;return a=di(t,a),ea(t,i),r=to(e,t,r,n,a,i),null===e||Io?(t.flags|=1,Mo(e,t,r,i),t.child):(t.updateQueue=e.updateQueue,t.flags&=-517,e.lanes&=~i,es(e,t,i))}function Fo(e,t,r,n,i){if(fi(r)){var a=!0;gi(t)}else a=!1;if(ea(t,i),null===t.stateNode)null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),ma(t,r,n),ga(t,r,n,i),n=!0;else if(null===e){var o=t.stateNode,s=t.memoizedProps;o.props=s;var u=o.context,c=r.contextType;"object"==typeof c&&null!==c?c=ta(c):c=di(t,c=fi(r)?li:ui.current);var l=r.getDerivedStateFromProps,d="function"==typeof l||"function"==typeof o.getSnapshotBeforeUpdate;d||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s!==n||u!==c)&&ha(t,o,n,c),ra=!1;var f=t.memoizedState;o.state=f,ua(t,n,o,i),u=t.memoizedState,s!==n||f!==u||ci.current||ra?("function"==typeof l&&(da(t,r,l,n),u=t.memoizedState),(s=ra||pa(t,r,s,n,f,u,c))?(d||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||("function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount()),"function"==typeof o.componentDidMount&&(t.flags|=4)):("function"==typeof o.componentDidMount&&(t.flags|=4),t.memoizedProps=n,t.memoizedState=u),o.props=n,o.state=u,o.context=c,n=s):("function"==typeof o.componentDidMount&&(t.flags|=4),n=!1)}else{o=t.stateNode,ia(e,t),s=t.memoizedProps,c=t.type===t.elementType?s:Wi(t.type,s),o.props=c,d=t.pendingProps,f=o.context,"object"==typeof(u=r.contextType)&&null!==u?u=ta(u):u=di(t,u=fi(r)?li:ui.current);var p=r.getDerivedStateFromProps;(l="function"==typeof p||"function"==typeof o.getSnapshotBeforeUpdate)||"function"!=typeof o.UNSAFE_componentWillReceiveProps&&"function"!=typeof o.componentWillReceiveProps||(s!==d||f!==u)&&ha(t,o,n,u),ra=!1,f=t.memoizedState,o.state=f,ua(t,n,o,i);var m=t.memoizedState;s!==d||f!==m||ci.current||ra?("function"==typeof p&&(da(t,r,p,n),m=t.memoizedState),(c=ra||pa(t,r,c,n,f,m,u))?(l||"function"!=typeof o.UNSAFE_componentWillUpdate&&"function"!=typeof o.componentWillUpdate||("function"==typeof o.componentWillUpdate&&o.componentWillUpdate(n,m,u),"function"==typeof o.UNSAFE_componentWillUpdate&&o.UNSAFE_componentWillUpdate(n,m,u)),"function"==typeof o.componentDidUpdate&&(t.flags|=4),"function"==typeof o.getSnapshotBeforeUpdate&&(t.flags|=256)):("function"!=typeof o.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=256),t.memoizedProps=n,t.memoizedState=m),o.props=n,o.state=m,o.context=u,n=c):("function"!=typeof o.componentDidUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),"function"!=typeof o.getSnapshotBeforeUpdate||s===e.memoizedProps&&f===e.memoizedState||(t.flags|=256),n=!1)}return Uo(e,t,r,n,a,i)}function Uo(e,t,r,n,i,a){Lo(e,t);var o=0!=(64&t.flags);if(!n&&!o)return i&&vi(t,r,!1),es(e,t,a);n=t.stateNode,To.current=t;var s=o&&"function"!=typeof r.getDerivedStateFromError?null:n.render();return t.flags|=1,null!==e&&o?(t.child=Sa(t,e.child,null,a),t.child=Sa(t,null,s,a)):Mo(e,t,s,a),t.memoizedState=n.state,i&&vi(t,r,!0),t.child}function zo(e){var t=e.stateNode;t.pendingContext?mi(0,t.pendingContext,t.pendingContext!==t.context):t.context&&mi(0,t.context,!1),Ea(e,t.containerInfo)}var Ho,Go,qo,Wo={dehydrated:null,retryLane:0};function Xo(e,t,r){var n,i=t.pendingProps,a=Ia.current,o=!1;return(n=0!=(64&t.flags))||(n=(null===e||null!==e.memoizedState)&&0!=(2&a)),n?(o=!0,t.flags&=-65):null!==e&&null===e.memoizedState||void 0===i.fallback||!0===i.unstable_avoidThisFallback||(a|=1),oi(Ia,1&a),null===e?(void 0!==i.fallback&&Na(t),e=i.children,a=i.fallback,o?(e=Yo(t,e,a,r),t.child.memoizedState={baseLanes:r},t.memoizedState=Wo,e):"number"==typeof i.unstable_expectedLoadTime?(e=Yo(t,e,a,r),t.child.memoizedState={baseLanes:r},t.memoizedState=Wo,t.lanes=33554432,e):((r=zu({mode:"visible",children:e},t.mode,r,null)).return=t,t.child=r)):(e.memoizedState,o?(i=Ko(e,t,i.children,i.fallback,r),o=t.child,a=e.child.memoizedState,o.memoizedState=null===a?{baseLanes:r}:{baseLanes:a.baseLanes|r},o.childLanes=e.childLanes&~r,t.memoizedState=Wo,i):(r=Qo(e,t,i.children,r),t.memoizedState=null,r))}function Yo(e,t,r,n){var i=e.mode,a=e.child;return t={mode:"hidden",children:t},0==(2&i)&&null!==a?(a.childLanes=0,a.pendingProps=t):a=zu(t,i,0,null),r=Uu(r,i,n,null),a.return=e,r.return=e,a.sibling=r,e.child=a,r}function Qo(e,t,r,n){var i=e.child;return e=i.sibling,r=Nu(i,{mode:"visible",children:r}),0==(2&t.mode)&&(r.lanes=n),r.return=t,r.sibling=null,null!==e&&(e.nextEffect=null,e.flags=8,t.firstEffect=t.lastEffect=e),t.child=r}function Ko(e,t,r,n,i){var a=t.mode,o=e.child;e=o.sibling;var s={mode:"hidden",children:r};return 0==(2&a)&&t.child!==o?((r=t.child).childLanes=0,r.pendingProps=s,null!==(o=r.lastEffect)?(t.firstEffect=r.firstEffect,t.lastEffect=o,o.nextEffect=null):t.firstEffect=t.lastEffect=null):r=Nu(o,s),null!==e?n=Nu(e,n):(n=Uu(n,a,i,null)).flags|=2,n.return=t,r.return=t,r.sibling=n,t.child=r,n}function Zo(e,t){e.lanes|=t;var r=e.alternate;null!==r&&(r.lanes|=t),$i(e.return,t)}function Jo(e,t,r,n,i,a){var o=e.memoizedState;null===o?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i,lastEffect:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=i,o.lastEffect=a)}function $o(e,t,r){var n=t.pendingProps,i=n.revealOrder,a=n.tail;if(Mo(e,t,n.children,r),0!=(2&(n=Ia.current)))n=1&n|2,t.flags|=64;else{if(null!==e&&0!=(64&e.flags))e:for(e=t.child;null!==e;){if(13===e.tag)null!==e.memoizedState&&Zo(e,r);else if(19===e.tag)Zo(e,r);else if(null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;null===e.sibling;){if(null===e.return||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}n&=1}if(oi(Ia,n),0==(2&t.mode))t.memoizedState=null;else switch(i){case"forwards":for(r=t.child,i=null;null!==r;)null!==(e=r.alternate)&&null===Ma(e)&&(i=r),r=r.sibling;null===(r=i)?(i=t.child,t.child=null):(i=r.sibling,r.sibling=null),Jo(t,!1,i,r,a,t.lastEffect);break;case"backwards":for(r=null,i=t.child,t.child=null;null!==i;){if(null!==(e=i.alternate)&&null===Ma(e)){t.child=i;break}e=i.sibling,i.sibling=r,r=i,i=e}Jo(t,!0,r,null,a,t.lastEffect);break;case"together":Jo(t,!1,null,null,void 0,t.lastEffect);break;default:t.memoizedState=null}return t.child}function es(e,t,r){if(null!==e&&(t.dependencies=e.dependencies),ks|=t.lanes,0!=(r&t.childLanes)){if(null!==e&&t.child!==e.child)throw Error(o(153));if(null!==t.child){for(r=Nu(e=t.child,e.pendingProps),t.child=r,r.return=t;null!==e.sibling;)e=e.sibling,(r=r.sibling=Nu(e,e.pendingProps)).return=t;r.sibling=null}return t.child}return null}function ts(e,t){if(!Va)switch(e.tailMode){case"hidden":t=e.tail;for(var r=null;null!==t;)null!==t.alternate&&(r=t),t=t.sibling;null===r?e.tail=null:r.sibling=null;break;case"collapsed":r=e.tail;for(var n=null;null!==r;)null!==r.alternate&&(n=r),r=r.sibling;null===n?t||null===e.tail?e.tail=null:e.tail.sibling=null:n.sibling=null}}function rs(e,t,r){var n=t.pendingProps;switch(t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return fi(t.type)&&pi(),null;case 3:return Aa(),ai(ci),ai(ui),Ga(),(n=t.stateNode).pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),null!==e&&null!==e.child||(Ua(t)?t.flags|=4:n.hydrate||(t.flags|=256)),null;case 5:Ta(t);var a=Pa(ja.current);if(r=t.type,null!==e&&null!=t.stateNode)Go(e,t,r,n),e.ref!==t.ref&&(t.flags|=128);else{if(!n){if(null===t.stateNode)throw Error(o(166));return null}if(e=Pa(wa.current),Ua(t)){n=t.stateNode,r=t.type;var s=t.memoizedProps;switch(n[Xn]=t,n[Yn]=s,r){case"dialog":Cn("cancel",n),Cn("close",n);break;case"iframe":case"object":case"embed":Cn("load",n);break;case"video":case"audio":for(e=0;e<Sn.length;e++)Cn(Sn[e],n);break;case"source":Cn("error",n);break;case"img":case"image":case"link":Cn("error",n),Cn("load",n);break;case"details":Cn("toggle",n);break;case"input":ee(n,s),Cn("invalid",n);break;case"select":n._wrapperState={wasMultiple:!!s.multiple},Cn("invalid",n);break;case"textarea":ue(n,s),Cn("invalid",n)}for(var c in Oe(r,s),e=null,s)s.hasOwnProperty(c)&&(a=s[c],"children"===c?"string"==typeof a?n.textContent!==a&&(e=["children",a]):"number"==typeof a&&n.textContent!==""+a&&(e=["children",""+a]):u.hasOwnProperty(c)&&null!=a&&"onScroll"===c&&Cn("scroll",n));switch(r){case"input":K(n),ne(n,s,!0);break;case"textarea":K(n),le(n);break;case"select":case"option":break;default:"function"==typeof s.onClick&&(n.onclick=Bn)}n=e,t.updateQueue=n,null!==n&&(t.flags|=4)}else{switch(c=9===a.nodeType?a:a.ownerDocument,e===de&&(e=pe(r)),e===de?"script"===r?((e=c.createElement("div")).innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):"string"==typeof n.is?e=c.createElement(r,{is:n.is}):(e=c.createElement(r),"select"===r&&(c=e,n.multiple?c.multiple=!0:n.size&&(c.size=n.size))):e=c.createElementNS(e,r),e[Xn]=t,e[Yn]=n,Ho(e,t),t.stateNode=e,c=we(r,n),r){case"dialog":Cn("cancel",e),Cn("close",e),a=n;break;case"iframe":case"object":case"embed":Cn("load",e),a=n;break;case"video":case"audio":for(a=0;a<Sn.length;a++)Cn(Sn[a],e);a=n;break;case"source":Cn("error",e),a=n;break;case"img":case"image":case"link":Cn("error",e),Cn("load",e),a=n;break;case"details":Cn("toggle",e),a=n;break;case"input":ee(e,n),a=$(e,n),Cn("invalid",e);break;case"option":a=ae(e,n);break;case"select":e._wrapperState={wasMultiple:!!n.multiple},a=i({},n,{value:void 0}),Cn("invalid",e);break;case"textarea":ue(e,n),a=se(e,n),Cn("invalid",e);break;default:a=n}Oe(r,a);var l=a;for(s in l)if(l.hasOwnProperty(s)){var d=l[s];"style"===s?Se(e,d):"dangerouslySetInnerHTML"===s?null!=(d=d?d.__html:void 0)&&ge(e,d):"children"===s?"string"==typeof d?("textarea"!==r||""!==d)&&ve(e,d):"number"==typeof d&&ve(e,""+d):"suppressContentEditableWarning"!==s&&"suppressHydrationWarning"!==s&&"autoFocus"!==s&&(u.hasOwnProperty(s)?null!=d&&"onScroll"===s&&Cn("scroll",e):null!=d&&_(e,s,d,c))}switch(r){case"input":K(e),ne(e,n,!1);break;case"textarea":K(e),le(e);break;case"option":null!=n.value&&e.setAttribute("value",""+Y(n.value));break;case"select":e.multiple=!!n.multiple,null!=(s=n.value)?oe(e,!!n.multiple,s,!1):null!=n.defaultValue&&oe(e,!!n.multiple,n.defaultValue,!0);break;default:"function"==typeof a.onClick&&(e.onclick=Bn)}Ln(r,n)&&(t.flags|=4)}null!==t.ref&&(t.flags|=128)}return null;case 6:if(e&&null!=t.stateNode)qo(0,t,e.memoizedProps,n);else{if("string"!=typeof n&&null===t.stateNode)throw Error(o(166));r=Pa(ja.current),Pa(wa.current),Ua(t)?(n=t.stateNode,r=t.memoizedProps,n[Xn]=t,n.nodeValue!==r&&(t.flags|=4)):((n=(9===r.nodeType?r:r.ownerDocument).createTextNode(n))[Xn]=t,t.stateNode=n)}return null;case 13:return ai(Ia),n=t.memoizedState,0!=(64&t.flags)?(t.lanes=r,t):(n=null!==n,r=!1,null===e?void 0!==t.memoizedProps.fallback&&Ua(t):r=null!==e.memoizedState,n&&!r&&0!=(2&t.mode)&&(null===e&&!0!==t.memoizedProps.unstable_avoidThisFallback||0!=(1&Ia.current)?0===Ts&&(Ts=3):(0!==Ts&&3!==Ts||(Ts=4),null===js||0==(134217727&ks)&&0==(134217727&Bs)||du(js,Es))),(n||r)&&(t.flags|=4),null);case 4:return Aa(),null===e&&Pn(t.stateNode.containerInfo),null;case 10:return Ji(t),null;case 17:return fi(t.type)&&pi(),null;case 19:if(ai(Ia),null===(n=t.memoizedState))return null;if(s=0!=(64&t.flags),null===(c=n.rendering))if(s)ts(n,!1);else{if(0!==Ts||null!==e&&0!=(64&e.flags))for(e=t.child;null!==e;){if(null!==(c=Ma(e))){for(t.flags|=64,ts(n,!1),null!==(s=c.updateQueue)&&(t.updateQueue=s,t.flags|=4),null===n.lastEffect&&(t.firstEffect=null),t.lastEffect=n.lastEffect,n=r,r=t.child;null!==r;)e=n,(s=r).flags&=2,s.nextEffect=null,s.firstEffect=null,s.lastEffect=null,null===(c=s.alternate)?(s.childLanes=0,s.lanes=e,s.child=null,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,e=c.dependencies,s.dependencies=null===e?null:{lanes:e.lanes,firstContext:e.firstContext}),r=r.sibling;return oi(Ia,1&Ia.current|2),t.child}e=e.sibling}null!==n.tail&&Li()>Ns&&(t.flags|=64,s=!0,ts(n,!1),t.lanes=33554432)}else{if(!s)if(null!==(e=Ma(c))){if(t.flags|=64,s=!0,null!==(r=e.updateQueue)&&(t.updateQueue=r,t.flags|=4),ts(n,!0),null===n.tail&&"hidden"===n.tailMode&&!c.alternate&&!Va)return null!==(t=t.lastEffect=n.lastEffect)&&(t.nextEffect=null),null}else 2*Li()-n.renderingStartTime>Ns&&1073741824!==r&&(t.flags|=64,s=!0,ts(n,!1),t.lanes=33554432);n.isBackwards?(c.sibling=t.child,t.child=c):(null!==(r=n.last)?r.sibling=c:t.child=c,n.last=c)}return null!==n.tail?(r=n.tail,n.rendering=r,n.tail=r.sibling,n.lastEffect=t.lastEffect,n.renderingStartTime=Li(),r.sibling=null,t=Ia.current,oi(Ia,s?1&t|2:1&t),r):null;case 23:case 24:return gu(),null!==e&&null!==e.memoizedState!=(null!==t.memoizedState)&&"unstable-defer-without-hiding"!==n.mode&&(t.flags|=4),null}throw Error(o(156,t.tag))}function ns(e){switch(e.tag){case 1:fi(e.type)&&pi();var t=e.flags;return 4096&t?(e.flags=-4097&t|64,e):null;case 3:if(Aa(),ai(ci),ai(ui),Ga(),0!=(64&(t=e.flags)))throw Error(o(285));return e.flags=-4097&t|64,e;case 5:return Ta(e),null;case 13:return ai(Ia),4096&(t=e.flags)?(e.flags=-4097&t|64,e):null;case 19:return ai(Ia),null;case 4:return Aa(),null;case 10:return Ji(e),null;case 23:case 24:return gu(),null;default:return null}}function is(e,t){try{var r="",n=t;do{r+=W(n),n=n.return}while(n);var i=r}catch(e){i="\nError generating stack: "+e.message+"\n"+e.stack}return{value:e,source:t,stack:i}}function as(e,t){try{console.error(t.value)}catch(e){setTimeout((function(){throw e}))}}Ho=function(e,t){for(var r=t.child;null!==r;){if(5===r.tag||6===r.tag)e.appendChild(r.stateNode);else if(4!==r.tag&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===t)break;for(;null===r.sibling;){if(null===r.return||r.return===t)return;r=r.return}r.sibling.return=r.return,r=r.sibling}},Go=function(e,t,r,n){var a=e.memoizedProps;if(a!==n){e=t.stateNode,Pa(wa.current);var o,s=null;switch(r){case"input":a=$(e,a),n=$(e,n),s=[];break;case"option":a=ae(e,a),n=ae(e,n),s=[];break;case"select":a=i({},a,{value:void 0}),n=i({},n,{value:void 0}),s=[];break;case"textarea":a=se(e,a),n=se(e,n),s=[];break;default:"function"!=typeof a.onClick&&"function"==typeof n.onClick&&(e.onclick=Bn)}for(d in Oe(r,n),r=null,a)if(!n.hasOwnProperty(d)&&a.hasOwnProperty(d)&&null!=a[d])if("style"===d){var c=a[d];for(o in c)c.hasOwnProperty(o)&&(r||(r={}),r[o]="")}else"dangerouslySetInnerHTML"!==d&&"children"!==d&&"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&"autoFocus"!==d&&(u.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in n){var l=n[d];if(c=null!=a?a[d]:void 0,n.hasOwnProperty(d)&&l!==c&&(null!=l||null!=c))if("style"===d)if(c){for(o in c)!c.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(r||(r={}),r[o]="");for(o in l)l.hasOwnProperty(o)&&c[o]!==l[o]&&(r||(r={}),r[o]=l[o])}else r||(s||(s=[]),s.push(d,r)),r=l;else"dangerouslySetInnerHTML"===d?(l=l?l.__html:void 0,c=c?c.__html:void 0,null!=l&&c!==l&&(s=s||[]).push(d,l)):"children"===d?"string"!=typeof l&&"number"!=typeof l||(s=s||[]).push(d,""+l):"suppressContentEditableWarning"!==d&&"suppressHydrationWarning"!==d&&(u.hasOwnProperty(d)?(null!=l&&"onScroll"===d&&Cn("scroll",e),s||c===l||(s=[])):"object"==typeof l&&null!==l&&l.$$typeof===B?l.toString():(s=s||[]).push(d,l))}r&&(s=s||[]).push("style",r);var d=s;(t.updateQueue=d)&&(t.flags|=4)}},qo=function(e,t,r,n){r!==n&&(t.flags|=4)};var os="function"==typeof WeakMap?WeakMap:Map;function ss(e,t,r){(r=aa(-1,r)).tag=3,r.payload={element:null};var n=t.value;return r.callback=function(){Hs||(Hs=!0,Gs=n),as(0,t)},r}function us(e,t,r){(r=aa(-1,r)).tag=3;var n=e.type.getDerivedStateFromError;if("function"==typeof n){var i=t.value;r.payload=function(){return as(0,t),n(i)}}var a=e.stateNode;return null!==a&&"function"==typeof a.componentDidCatch&&(r.callback=function(){"function"!=typeof n&&(null===qs?qs=new Set([this]):qs.add(this),as(0,t));var e=t.stack;this.componentDidCatch(t.value,{componentStack:null!==e?e:""})}),r}var cs="function"==typeof WeakSet?WeakSet:Set;function ls(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(t){Mu(e,t)}else t.current=null}function ds(e,t){switch(t.tag){case 0:case 11:case 15:case 22:return;case 1:if(256&t.flags&&null!==e){var r=e.memoizedProps,n=e.memoizedState;t=(e=t.stateNode).getSnapshotBeforeUpdate(t.elementType===t.type?r:Wi(t.type,r),n),e.__reactInternalSnapshotBeforeUpdate=t}return;case 3:return void(256&t.flags&&zn(t.stateNode.containerInfo));case 5:case 6:case 4:case 17:return}throw Error(o(163))}function fs(e,t,r){switch(r.tag){case 0:case 11:case 15:case 22:if(null!==(t=null!==(t=r.updateQueue)?t.lastEffect:null)){e=t=t.next;do{if(3==(3&e.tag)){var n=e.create;e.destroy=n()}e=e.next}while(e!==t)}if(null!==(t=null!==(t=r.updateQueue)?t.lastEffect:null)){e=t=t.next;do{var i=e;n=i.next,0!=(4&(i=i.tag))&&0!=(1&i)&&(Du(r,e),Au(r,e)),e=n}while(e!==t)}return;case 1:return e=r.stateNode,4&r.flags&&(null===t?e.componentDidMount():(n=r.elementType===r.type?t.memoizedProps:Wi(r.type,t.memoizedProps),e.componentDidUpdate(n,t.memoizedState,e.__reactInternalSnapshotBeforeUpdate))),void(null!==(t=r.updateQueue)&&ca(r,t,e));case 3:if(null!==(t=r.updateQueue)){if(e=null,null!==r.child)switch(r.child.tag){case 5:e=r.child.stateNode;break;case 1:e=r.child.stateNode}ca(r,t,e)}return;case 5:return e=r.stateNode,void(null===t&&4&r.flags&&Ln(r.type,r.memoizedProps)&&e.focus());case 6:case 4:case 12:return;case 13:return void(null===r.memoizedState&&(r=r.alternate,null!==r&&(r=r.memoizedState,null!==r&&(r=r.dehydrated,null!==r&&St(r)))));case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(o(163))}function ps(e,t){for(var r=e;;){if(5===r.tag){var n=r.stateNode;if(t)"function"==typeof(n=n.style).setProperty?n.setProperty("display","none","important"):n.display="none";else{n=r.stateNode;var i=r.memoizedProps.style;i=null!=i&&i.hasOwnProperty("display")?i.display:null,n.style.display=_e("display",i)}}else if(6===r.tag)r.stateNode.nodeValue=t?"":r.memoizedProps;else if((23!==r.tag&&24!==r.tag||null===r.memoizedState||r===e)&&null!==r.child){r.child.return=r,r=r.child;continue}if(r===e)break;for(;null===r.sibling;){if(null===r.return||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}}function ms(e,t){if(yi&&"function"==typeof yi.onCommitFiberUnmount)try{yi.onCommitFiberUnmount(bi,t)}catch(e){}switch(t.tag){case 0:case 11:case 14:case 15:case 22:if(null!==(e=t.updateQueue)&&null!==(e=e.lastEffect)){var r=e=e.next;do{var n=r,i=n.destroy;if(n=n.tag,void 0!==i)if(0!=(4&n))Du(t,r);else{n=t;try{i()}catch(e){Mu(n,e)}}r=r.next}while(r!==e)}break;case 1:if(ls(t),"function"==typeof(e=t.stateNode).componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){Mu(t,e)}break;case 5:ls(t);break;case 4:bs(e,t)}}function hs(e){e.alternate=null,e.child=null,e.dependencies=null,e.firstEffect=null,e.lastEffect=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.return=null,e.updateQueue=null}function gs(e){return 5===e.tag||3===e.tag||4===e.tag}function vs(e){e:{for(var t=e.return;null!==t;){if(gs(t))break e;t=t.return}throw Error(o(160))}var r=t;switch(t=r.stateNode,r.tag){case 5:var n=!1;break;case 3:case 4:t=t.containerInfo,n=!0;break;default:throw Error(o(161))}16&r.flags&&(ve(t,""),r.flags&=-17);e:t:for(r=e;;){for(;null===r.sibling;){if(null===r.return||gs(r.return)){r=null;break e}r=r.return}for(r.sibling.return=r.return,r=r.sibling;5!==r.tag&&6!==r.tag&&18!==r.tag;){if(2&r.flags)continue t;if(null===r.child||4===r.tag)continue t;r.child.return=r,r=r.child}if(!(2&r.flags)){r=r.stateNode;break e}}n?function e(t,r,n){var i=t.tag,a=5===i||6===i;if(a)t=a?t.stateNode:t.stateNode.instance,r?8===n.nodeType?n.parentNode.insertBefore(t,r):n.insertBefore(t,r):(8===n.nodeType?(r=n.parentNode).insertBefore(t,n):(r=n).appendChild(t),null!==(n=n._reactRootContainer)&&void 0!==n||null!==r.onclick||(r.onclick=Bn));else if(4!==i&&null!==(t=t.child))for(e(t,r,n),t=t.sibling;null!==t;)e(t,r,n),t=t.sibling}(e,r,t):function e(t,r,n){var i=t.tag,a=5===i||6===i;if(a)t=a?t.stateNode:t.stateNode.instance,r?n.insertBefore(t,r):n.appendChild(t);else if(4!==i&&null!==(t=t.child))for(e(t,r,n),t=t.sibling;null!==t;)e(t,r,n),t=t.sibling}(e,r,t)}function bs(e,t){for(var r,n,i=t,a=!1;;){if(!a){a=i.return;e:for(;;){if(null===a)throw Error(o(160));switch(r=a.stateNode,a.tag){case 5:n=!1;break e;case 3:case 4:r=r.containerInfo,n=!0;break e}a=a.return}a=!0}if(5===i.tag||6===i.tag){e:for(var s=e,u=i,c=u;;)if(ms(s,c),null!==c.child&&4!==c.tag)c.child.return=c,c=c.child;else{if(c===u)break e;for(;null===c.sibling;){if(null===c.return||c.return===u)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}n?(s=r,u=i.stateNode,8===s.nodeType?s.parentNode.removeChild(u):s.removeChild(u)):r.removeChild(i.stateNode)}else if(4===i.tag){if(null!==i.child){r=i.stateNode.containerInfo,n=!0,i.child.return=i,i=i.child;continue}}else if(ms(e,i),null!==i.child){i.child.return=i,i=i.child;continue}if(i===t)break;for(;null===i.sibling;){if(null===i.return||i.return===t)return;4===(i=i.return).tag&&(a=!1)}i.sibling.return=i.return,i=i.sibling}}function ys(e,t){switch(t.tag){case 0:case 11:case 14:case 15:case 22:var r=t.updateQueue;if(null!==(r=null!==r?r.lastEffect:null)){var n=r=r.next;do{3==(3&n.tag)&&(e=n.destroy,n.destroy=void 0,void 0!==e&&e()),n=n.next}while(n!==r)}return;case 1:return;case 5:if(null!=(r=t.stateNode)){n=t.memoizedProps;var i=null!==e?e.memoizedProps:n;e=t.type;var a=t.updateQueue;if(t.updateQueue=null,null!==a){for(r[Yn]=n,"input"===e&&"radio"===n.type&&null!=n.name&&te(r,n),we(e,i),t=we(e,n),i=0;i<a.length;i+=2){var s=a[i],u=a[i+1];"style"===s?Se(r,u):"dangerouslySetInnerHTML"===s?ge(r,u):"children"===s?ve(r,u):_(r,s,u,t)}switch(e){case"input":re(r,n);break;case"textarea":ce(r,n);break;case"select":e=r._wrapperState.wasMultiple,r._wrapperState.wasMultiple=!!n.multiple,null!=(a=n.value)?oe(r,!!n.multiple,a,!1):e!==!!n.multiple&&(null!=n.defaultValue?oe(r,!!n.multiple,n.defaultValue,!0):oe(r,!!n.multiple,n.multiple?[]:"",!1))}}}return;case 6:if(null===t.stateNode)throw Error(o(162));return void(t.stateNode.nodeValue=t.memoizedProps);case 3:return void((r=t.stateNode).hydrate&&(r.hydrate=!1,St(r.containerInfo)));case 12:return;case 13:return null!==t.memoizedState&&(Ls=Li(),ps(t.child,!0)),void _s(t);case 19:return void _s(t);case 17:return;case 23:case 24:return void ps(t,null!==t.memoizedState)}throw Error(o(163))}function _s(e){var t=e.updateQueue;if(null!==t){e.updateQueue=null;var r=e.stateNode;null===r&&(r=e.stateNode=new cs),t.forEach((function(t){var n=Bu.bind(null,e,t);r.has(t)||(r.add(t),t.then(n,n))}))}}function Ss(e,t){return null!==e&&(null===(e=e.memoizedState)||null!==e.dehydrated)&&(null!==(t=t.memoizedState)&&null===t.dehydrated)}var xs=Math.ceil,Os=S.ReactCurrentDispatcher,ws=S.ReactCurrentOwner,Cs=0,js=null,Ps=null,Es=0,As=0,Ds=ii(0),Ts=0,Is=null,Ms=0,ks=0,Bs=0,Vs=0,Rs=null,Ls=0,Ns=1/0;function Fs(){Ns=Li()+500}var Us,zs=null,Hs=!1,Gs=null,qs=null,Ws=!1,Xs=null,Ys=90,Qs=[],Ks=[],Zs=null,Js=0,$s=null,eu=-1,tu=0,ru=0,nu=null,iu=!1;function au(){return 0!=(48&Cs)?Li():-1!==eu?eu:eu=Li()}function ou(e){if(0==(2&(e=e.mode)))return 1;if(0==(4&e))return 99===Ni()?1:2;if(0===tu&&(tu=Ms),0!==qi.transition){0!==ru&&(ru=null!==Rs?Rs.pendingLanes:0),e=tu;var t=4186112&~ru;return 0===(t&=-t)&&(0===(t=(e=4186112&~e)&-e)&&(t=8192)),t}return e=Ni(),0!=(4&Cs)&&98===e?e=Nt(12,tu):e=Nt(e=function(e){switch(e){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}(e),tu),e}function su(e,t,r){if(50<Js)throw Js=0,$s=null,Error(o(185));if(null===(e=uu(e,t)))return null;zt(e,t,r),e===js&&(Bs|=t,4===Ts&&du(e,Es));var n=Ni();1===t?0!=(8&Cs)&&0==(48&Cs)?fu(e):(cu(e,r),0===Cs&&(Fs(),Hi())):(0==(4&Cs)||98!==n&&99!==n||(null===Zs?Zs=new Set([e]):Zs.add(e)),cu(e,r)),Rs=e}function uu(e,t){e.lanes|=t;var r=e.alternate;for(null!==r&&(r.lanes|=t),r=e,e=e.return;null!==e;)e.childLanes|=t,null!==(r=e.alternate)&&(r.childLanes|=t),r=e,e=e.return;return 3===r.tag?r.stateNode:null}function cu(e,t){for(var r=e.callbackNode,n=e.suspendedLanes,i=e.pingedLanes,a=e.expirationTimes,s=e.pendingLanes;0<s;){var u=31-Ht(s),c=1<<u,l=a[u];if(-1===l){if(0==(c&n)||0!=(c&i)){l=t,Vt(c);var d=Bt;a[u]=10<=d?l+250:6<=d?l+5e3:-1}}else l<=t&&(e.expiredLanes|=c);s&=~c}if(n=Rt(e,e===js?Es:0),t=Bt,0===n)null!==r&&(r!==Ii&&xi(r),e.callbackNode=null,e.callbackPriority=0);else{if(null!==r){if(e.callbackPriority===t)return;r!==Ii&&xi(r)}15===t?(r=fu.bind(null,e),null===ki?(ki=[r],Bi=Si(Pi,Gi)):ki.push(r),r=Ii):14===t?r=zi(99,fu.bind(null,e)):r=zi(r=function(e){switch(e){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(o(358,e))}}(t),lu.bind(null,e)),e.callbackPriority=t,e.callbackNode=r}}function lu(e){if(eu=-1,ru=tu=0,0!=(48&Cs))throw Error(o(327));var t=e.callbackNode;if(Eu()&&e.callbackNode!==t)return null;var r=Rt(e,e===js?Es:0);if(0===r)return null;var n=r,i=Cs;Cs|=16;var a=yu();for(js===e&&Es===n||(Fs(),vu(e,n));;)try{xu();break}catch(t){bu(e,t)}if(Zi(),Os.current=a,Cs=i,null!==Ps?n=0:(js=null,Es=0,n=Ts),0!=(Ms&Bs))vu(e,0);else if(0!==n){if(2===n&&(Cs|=64,e.hydrate&&(e.hydrate=!1,zn(e.containerInfo)),0!==(r=Lt(e))&&(n=_u(e,r))),1===n)throw t=Is,vu(e,0),du(e,r),cu(e,Li()),t;switch(e.finishedWork=e.current.alternate,e.finishedLanes=r,n){case 0:case 1:throw Error(o(345));case 2:Cu(e);break;case 3:if(du(e,r),(62914560&r)===r&&10<(n=Ls+500-Li())){if(0!==Rt(e,0))break;if(((i=e.suspendedLanes)&r)!==r){au(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Fn(Cu.bind(null,e),n);break}Cu(e);break;case 4:if(du(e,r),(4186112&r)===r)break;for(n=e.eventTimes,i=-1;0<r;){var s=31-Ht(r);a=1<<s,(s=n[s])>i&&(i=s),r&=~a}if(r=i,10<(r=(120>(r=Li()-r)?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*xs(r/1960))-r)){e.timeoutHandle=Fn(Cu.bind(null,e),r);break}Cu(e);break;case 5:Cu(e);break;default:throw Error(o(329))}}return cu(e,Li()),e.callbackNode===t?lu.bind(null,e):null}function du(e,t){for(t&=~Vs,t&=~Bs,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var r=31-Ht(t),n=1<<r;e[r]=-1,t&=~n}}function fu(e){if(0!=(48&Cs))throw Error(o(327));if(Eu(),e===js&&0!=(e.expiredLanes&Es)){var t=Es,r=_u(e,t);0!=(Ms&Bs)&&(r=_u(e,t=Rt(e,t)))}else r=_u(e,t=Rt(e,0));if(0!==e.tag&&2===r&&(Cs|=64,e.hydrate&&(e.hydrate=!1,zn(e.containerInfo)),0!==(t=Lt(e))&&(r=_u(e,t))),1===r)throw r=Is,vu(e,0),du(e,t),cu(e,Li()),r;return e.finishedWork=e.current.alternate,e.finishedLanes=t,Cu(e),cu(e,Li()),null}function pu(e,t){var r=Cs;Cs|=1;try{return e(t)}finally{0===(Cs=r)&&(Fs(),Hi())}}function mu(e,t){var r=Cs;Cs&=-2,Cs|=8;try{return e(t)}finally{0===(Cs=r)&&(Fs(),Hi())}}function hu(e,t){oi(Ds,As),As|=t,Ms|=t}function gu(){As=Ds.current,ai(Ds)}function vu(e,t){e.finishedWork=null,e.finishedLanes=0;var r=e.timeoutHandle;if(-1!==r&&(e.timeoutHandle=-1,Un(r)),null!==Ps)for(r=Ps.return;null!==r;){var n=r;switch(n.tag){case 1:null!=(n=n.type.childContextTypes)&&pi();break;case 3:Aa(),ai(ci),ai(ui),Ga();break;case 5:Ta(n);break;case 4:Aa();break;case 13:case 19:ai(Ia);break;case 10:Ji(n);break;case 23:case 24:gu()}r=r.return}js=e,Ps=Nu(e.current,null),Es=As=Ms=t,Ts=0,Is=null,Vs=Bs=ks=0}function bu(e,t){for(;;){var r=Ps;try{if(Zi(),qa.current=Po,Za){for(var n=Ya.memoizedState;null!==n;){var i=n.queue;null!==i&&(i.pending=null),n=n.next}Za=!1}if(Xa=0,Ka=Qa=Ya=null,Ja=!1,ws.current=null,null===r||null===r.return){Ts=1,Is=t,Ps=null;break}e:{var a=e,o=r.return,s=r,u=t;if(t=Es,s.flags|=2048,s.firstEffect=s.lastEffect=null,null!==u&&"object"==typeof u&&"function"==typeof u.then){var c=u;if(0==(2&s.mode)){var l=s.alternate;l?(s.updateQueue=l.updateQueue,s.memoizedState=l.memoizedState,s.lanes=l.lanes):(s.updateQueue=null,s.memoizedState=null)}var d=0!=(1&Ia.current),f=o;do{var p;if(p=13===f.tag){var m=f.memoizedState;if(null!==m)p=null!==m.dehydrated;else{var h=f.memoizedProps;p=void 0!==h.fallback&&(!0!==h.unstable_avoidThisFallback||!d)}}if(p){var g=f.updateQueue;if(null===g){var v=new Set;v.add(c),f.updateQueue=v}else g.add(c);if(0==(2&f.mode)){if(f.flags|=64,s.flags|=16384,s.flags&=-2981,1===s.tag)if(null===s.alternate)s.tag=17;else{var b=aa(-1,1);b.tag=2,oa(s,b)}s.lanes|=1;break e}u=void 0,s=t;var y=a.pingCache;if(null===y?(y=a.pingCache=new os,u=new Set,y.set(c,u)):void 0===(u=y.get(c))&&(u=new Set,y.set(c,u)),!u.has(s)){u.add(s);var _=ku.bind(null,a,c,s);c.then(_,_)}f.flags|=4096,f.lanes=t;break e}f=f.return}while(null!==f);u=Error((X(s.type)||"A React component")+" suspended while rendering, but no fallback UI was specified.\n\nAdd a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.")}5!==Ts&&(Ts=2),u=is(u,s),f=o;do{switch(f.tag){case 3:a=u,f.flags|=4096,t&=-t,f.lanes|=t,sa(f,ss(0,a,t));break e;case 1:a=u;var S=f.type,x=f.stateNode;if(0==(64&f.flags)&&("function"==typeof S.getDerivedStateFromError||null!==x&&"function"==typeof x.componentDidCatch&&(null===qs||!qs.has(x)))){f.flags|=4096,t&=-t,f.lanes|=t,sa(f,us(f,a,t));break e}}f=f.return}while(null!==f)}wu(r)}catch(e){t=e,Ps===r&&null!==r&&(Ps=r=r.return);continue}break}}function yu(){var e=Os.current;return Os.current=Po,null===e?Po:e}function _u(e,t){var r=Cs;Cs|=16;var n=yu();for(js===e&&Es===t||vu(e,t);;)try{Su();break}catch(t){bu(e,t)}if(Zi(),Cs=r,Os.current=n,null!==Ps)throw Error(o(261));return js=null,Es=0,Ts}function Su(){for(;null!==Ps;)Ou(Ps)}function xu(){for(;null!==Ps&&!Oi();)Ou(Ps)}function Ou(e){var t=Us(e.alternate,e,As);e.memoizedProps=e.pendingProps,null===t?wu(e):Ps=t,ws.current=null}function wu(e){var t=e;do{var r=t.alternate;if(e=t.return,0==(2048&t.flags)){if(null!==(r=rs(r,t,As)))return void(Ps=r);if(24!==(r=t).tag&&23!==r.tag||null===r.memoizedState||0!=(1073741824&As)||0==(4&r.mode)){for(var n=0,i=r.child;null!==i;)n|=i.lanes|i.childLanes,i=i.sibling;r.childLanes=n}null!==e&&0==(2048&e.flags)&&(null===e.firstEffect&&(e.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==e.lastEffect&&(e.lastEffect.nextEffect=t.firstEffect),e.lastEffect=t.lastEffect),1<t.flags&&(null!==e.lastEffect?e.lastEffect.nextEffect=t:e.firstEffect=t,e.lastEffect=t))}else{if(null!==(r=ns(t)))return r.flags&=2047,void(Ps=r);null!==e&&(e.firstEffect=e.lastEffect=null,e.flags|=2048)}if(null!==(t=t.sibling))return void(Ps=t);Ps=t=e}while(null!==t);0===Ts&&(Ts=5)}function Cu(e){var t=Ni();return Ui(99,ju.bind(null,e,t)),null}function ju(e,t){do{Eu()}while(null!==Xs);if(0!=(48&Cs))throw Error(o(327));var r=e.finishedWork;if(null===r)return null;if(e.finishedWork=null,e.finishedLanes=0,r===e.current)throw Error(o(177));e.callbackNode=null;var n=r.lanes|r.childLanes,i=n,a=e.pendingLanes&~i;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=i,e.mutableReadLanes&=i,e.entangledLanes&=i,i=e.entanglements;for(var s=e.eventTimes,u=e.expirationTimes;0<a;){var c=31-Ht(a),l=1<<c;i[c]=0,s[c]=-1,u[c]=-1,a&=~l}if(null!==Zs&&0==(24&n)&&Zs.has(e)&&Zs.delete(e),e===js&&(Ps=js=null,Es=0),1<r.flags?null!==r.lastEffect?(r.lastEffect.nextEffect=r,n=r.firstEffect):n=r:n=r.firstEffect,null!==n){if(i=Cs,Cs|=32,ws.current=null,Vn=Yt,fn(s=dn())){if("selectionStart"in s)u={start:s.selectionStart,end:s.selectionEnd};else e:if(u=(u=s.ownerDocument)&&u.defaultView||window,(l=u.getSelection&&u.getSelection())&&0!==l.rangeCount){u=l.anchorNode,a=l.anchorOffset,c=l.focusNode,l=l.focusOffset;try{u.nodeType,c.nodeType}catch(e){u=null;break e}var d=0,f=-1,p=-1,m=0,h=0,g=s,v=null;t:for(;;){for(var b;g!==u||0!==a&&3!==g.nodeType||(f=d+a),g!==c||0!==l&&3!==g.nodeType||(p=d+l),3===g.nodeType&&(d+=g.nodeValue.length),null!==(b=g.firstChild);)v=g,g=b;for(;;){if(g===s)break t;if(v===u&&++m===a&&(f=d),v===c&&++h===l&&(p=d),null!==(b=g.nextSibling))break;v=(g=v).parentNode}g=b}u=-1===f||-1===p?null:{start:f,end:p}}else u=null;u=u||{start:0,end:0}}else u=null;Rn={focusedElem:s,selectionRange:u},Yt=!1,nu=null,iu=!1,zs=n;do{try{Pu()}catch(e){if(null===zs)throw Error(o(330));Mu(zs,e),zs=zs.nextEffect}}while(null!==zs);nu=null,zs=n;do{try{for(s=e;null!==zs;){var y=zs.flags;if(16&y&&ve(zs.stateNode,""),128&y){var _=zs.alternate;if(null!==_){var S=_.ref;null!==S&&("function"==typeof S?S(null):S.current=null)}}switch(1038&y){case 2:vs(zs),zs.flags&=-3;break;case 6:vs(zs),zs.flags&=-3,ys(zs.alternate,zs);break;case 1024:zs.flags&=-1025;break;case 1028:zs.flags&=-1025,ys(zs.alternate,zs);break;case 4:ys(zs.alternate,zs);break;case 8:bs(s,u=zs);var x=u.alternate;hs(u),null!==x&&hs(x)}zs=zs.nextEffect}}catch(e){if(null===zs)throw Error(o(330));Mu(zs,e),zs=zs.nextEffect}}while(null!==zs);if(S=Rn,_=dn(),y=S.focusedElem,s=S.selectionRange,_!==y&&y&&y.ownerDocument&&function e(t,r){return!(!t||!r)&&(t===r||(!t||3!==t.nodeType)&&(r&&3===r.nodeType?e(t,r.parentNode):"contains"in t?t.contains(r):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(r))))}(y.ownerDocument.documentElement,y)){null!==s&&fn(y)&&(_=s.start,void 0===(S=s.end)&&(S=_),"selectionStart"in y?(y.selectionStart=_,y.selectionEnd=Math.min(S,y.value.length)):(S=(_=y.ownerDocument||document)&&_.defaultView||window).getSelection&&(S=S.getSelection(),u=y.textContent.length,x=Math.min(s.start,u),s=void 0===s.end?x:Math.min(s.end,u),!S.extend&&x>s&&(u=s,s=x,x=u),u=ln(y,x),a=ln(y,s),u&&a&&(1!==S.rangeCount||S.anchorNode!==u.node||S.anchorOffset!==u.offset||S.focusNode!==a.node||S.focusOffset!==a.offset)&&((_=_.createRange()).setStart(u.node,u.offset),S.removeAllRanges(),x>s?(S.addRange(_),S.extend(a.node,a.offset)):(_.setEnd(a.node,a.offset),S.addRange(_))))),_=[];for(S=y;S=S.parentNode;)1===S.nodeType&&_.push({element:S,left:S.scrollLeft,top:S.scrollTop});for("function"==typeof y.focus&&y.focus(),y=0;y<_.length;y++)(S=_[y]).element.scrollLeft=S.left,S.element.scrollTop=S.top}Yt=!!Vn,Rn=Vn=null,e.current=r,zs=n;do{try{for(y=e;null!==zs;){var O=zs.flags;if(36&O&&fs(y,zs.alternate,zs),128&O){_=void 0;var w=zs.ref;if(null!==w){var C=zs.stateNode;switch(zs.tag){case 5:_=C;break;default:_=C}"function"==typeof w?w(_):w.current=_}}zs=zs.nextEffect}}catch(e){if(null===zs)throw Error(o(330));Mu(zs,e),zs=zs.nextEffect}}while(null!==zs);zs=null,Mi(),Cs=i}else e.current=r;if(Ws)Ws=!1,Xs=e,Ys=t;else for(zs=n;null!==zs;)t=zs.nextEffect,zs.nextEffect=null,8&zs.flags&&((O=zs).sibling=null,O.stateNode=null),zs=t;if(0===(n=e.pendingLanes)&&(qs=null),1===n?e===$s?Js++:(Js=0,$s=e):Js=0,r=r.stateNode,yi&&"function"==typeof yi.onCommitFiberRoot)try{yi.onCommitFiberRoot(bi,r,void 0,64==(64&r.current.flags))}catch(e){}if(cu(e,Li()),Hs)throw Hs=!1,e=Gs,Gs=null,e;return 0!=(8&Cs)||Hi(),null}function Pu(){for(;null!==zs;){var e=zs.alternate;iu||null===nu||(0!=(8&zs.flags)?$e(zs,nu)&&(iu=!0):13===zs.tag&&Ss(e,zs)&&$e(zs,nu)&&(iu=!0));var t=zs.flags;0!=(256&t)&&ds(e,zs),0==(512&t)||Ws||(Ws=!0,zi(97,(function(){return Eu(),null}))),zs=zs.nextEffect}}function Eu(){if(90!==Ys){var e=97<Ys?97:Ys;return Ys=90,Ui(e,Tu)}return!1}function Au(e,t){Qs.push(t,e),Ws||(Ws=!0,zi(97,(function(){return Eu(),null})))}function Du(e,t){Ks.push(t,e),Ws||(Ws=!0,zi(97,(function(){return Eu(),null})))}function Tu(){if(null===Xs)return!1;var e=Xs;if(Xs=null,0!=(48&Cs))throw Error(o(331));var t=Cs;Cs|=32;var r=Ks;Ks=[];for(var n=0;n<r.length;n+=2){var i=r[n],a=r[n+1],s=i.destroy;if(i.destroy=void 0,"function"==typeof s)try{s()}catch(e){if(null===a)throw Error(o(330));Mu(a,e)}}for(r=Qs,Qs=[],n=0;n<r.length;n+=2){i=r[n],a=r[n+1];try{var u=i.create;i.destroy=u()}catch(e){if(null===a)throw Error(o(330));Mu(a,e)}}for(u=e.current.firstEffect;null!==u;)e=u.nextEffect,u.nextEffect=null,8&u.flags&&(u.sibling=null,u.stateNode=null),u=e;return Cs=t,Hi(),!0}function Iu(e,t,r){oa(e,t=ss(0,t=is(r,t),1)),t=au(),null!==(e=uu(e,1))&&(zt(e,1,t),cu(e,t))}function Mu(e,t){if(3===e.tag)Iu(e,e,t);else for(var r=e.return;null!==r;){if(3===r.tag){Iu(r,e,t);break}if(1===r.tag){var n=r.stateNode;if("function"==typeof r.type.getDerivedStateFromError||"function"==typeof n.componentDidCatch&&(null===qs||!qs.has(n))){var i=us(r,e=is(t,e),1);if(oa(r,i),i=au(),null!==(r=uu(r,1)))zt(r,1,i),cu(r,i);else if("function"==typeof n.componentDidCatch&&(null===qs||!qs.has(n)))try{n.componentDidCatch(t,e)}catch(e){}break}}r=r.return}}function ku(e,t,r){var n=e.pingCache;null!==n&&n.delete(t),t=au(),e.pingedLanes|=e.suspendedLanes&r,js===e&&(Es&r)===r&&(4===Ts||3===Ts&&(62914560&Es)===Es&&500>Li()-Ls?vu(e,0):Vs|=r),cu(e,t)}function Bu(e,t){var r=e.stateNode;null!==r&&r.delete(t),0===(t=0)&&(0==(2&(t=e.mode))?t=1:0==(4&t)?t=99===Ni()?1:2:(0===tu&&(tu=Ms),0===(t=Ft(62914560&~tu))&&(t=4194304))),r=au(),null!==(e=uu(e,t))&&(zt(e,t,r),cu(e,r))}function Vu(e,t,r,n){this.tag=e,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Ru(e,t,r,n){return new Vu(e,t,r,n)}function Lu(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Nu(e,t){var r=e.alternate;return null===r?((r=Ru(e.tag,t,e.key,e.mode)).elementType=e.elementType,r.type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.type=e.type,r.flags=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.childLanes=e.childLanes,r.lanes=e.lanes,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,t=e.dependencies,r.dependencies=null===t?null:{lanes:t.lanes,firstContext:t.firstContext},r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Fu(e,t,r,n,i,a){var s=2;if(n=e,"function"==typeof e)Lu(e)&&(s=1);else if("string"==typeof e)s=5;else e:switch(e){case w:return Uu(r.children,i,a,t);case V:s=8,i|=16;break;case C:s=8,i|=1;break;case j:return(e=Ru(12,r,t,8|i)).elementType=j,e.type=j,e.lanes=a,e;case D:return(e=Ru(13,r,t,i)).type=D,e.elementType=D,e.lanes=a,e;case T:return(e=Ru(19,r,t,i)).elementType=T,e.lanes=a,e;case R:return zu(r,i,a,t);case L:return(e=Ru(24,r,t,i)).elementType=L,e.lanes=a,e;default:if("object"==typeof e&&null!==e)switch(e.$$typeof){case P:s=10;break e;case E:s=9;break e;case A:s=11;break e;case I:s=14;break e;case M:s=16,n=null;break e;case k:s=22;break e}throw Error(o(130,null==e?e:typeof e,""))}return(t=Ru(s,r,t,i)).elementType=e,t.type=n,t.lanes=a,t}function Uu(e,t,r,n){return(e=Ru(7,e,n,t)).lanes=r,e}function zu(e,t,r,n){return(e=Ru(23,e,n,t)).elementType=R,e.lanes=r,e}function Hu(e,t,r){return(e=Ru(6,e,null,t)).lanes=r,e}function Gu(e,t,r){return(t=Ru(4,null!==e.children?e.children:[],e.key,t)).lanes=r,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function qu(e,t,r){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=r,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=Ut(0),this.expirationTimes=Ut(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ut(0),this.mutableSourceEagerHydrationData=null}function Wu(e,t,r){var n=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:O,key:null==n?null:""+n,children:e,containerInfo:t,implementation:r}}function Xu(e,t,r,n){var i=t.current,a=au(),s=ou(i);e:if(r){t:{if(Qe(r=r._reactInternals)!==r||1!==r.tag)throw Error(o(170));var u=r;do{switch(u.tag){case 3:u=u.stateNode.context;break t;case 1:if(fi(u.type)){u=u.stateNode.__reactInternalMemoizedMergedChildContext;break t}}u=u.return}while(null!==u);throw Error(o(171))}if(1===r.tag){var c=r.type;if(fi(c)){r=hi(r,c,u);break e}}r=u}else r=si;return null===t.context?t.context=r:t.pendingContext=r,(t=aa(a,s)).payload={element:e},null!==(n=void 0===n?null:n)&&(t.callback=n),oa(i,t),su(i,s,a),s}function Yu(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 5:default:return e.child.stateNode}}function Qu(e,t){if(null!==(e=e.memoizedState)&&null!==e.dehydrated){var r=e.retryLane;e.retryLane=0!==r&&r<t?r:t}}function Ku(e,t){Qu(e,t),(e=e.alternate)&&Qu(e,t)}function Zu(e,t,r){var n=null!=r&&null!=r.hydrationOptions&&r.hydrationOptions.mutableSources||null;if(r=new qu(e,t,null!=r&&!0===r.hydrate),t=Ru(3,null,null,2===t?7:1===t?3:0),r.current=t,t.stateNode=r,na(t),e[Qn]=r.current,Pn(8===e.nodeType?e.parentNode:e),n)for(e=0;e<n.length;e++){var i=(t=n[e])._getVersion;i=i(t._source),null==r.mutableSourceEagerHydrationData?r.mutableSourceEagerHydrationData=[t,i]:r.mutableSourceEagerHydrationData.push(t,i)}this._internalRoot=r}function Ju(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function $u(e,t,r,n,i){var a=r._reactRootContainer;if(a){var o=a._internalRoot;if("function"==typeof i){var s=i;i=function(){var e=Yu(o);s.call(e)}}Xu(t,o,e,i)}else{if(a=r._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var r;r=e.lastChild;)e.removeChild(r);return new Zu(e,0,t?{hydrate:!0}:void 0)}(r,n),o=a._internalRoot,"function"==typeof i){var u=i;i=function(){var e=Yu(o);u.call(e)}}mu((function(){Xu(t,o,e,i)}))}return Yu(o)}function ec(e,t){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;if(!Ju(t))throw Error(o(200));return Wu(e,t,null,r)}Us=function(e,t,r){var n=t.lanes;if(null!==e)if(e.memoizedProps!==t.pendingProps||ci.current)Io=!0;else{if(0==(r&n)){switch(Io=!1,t.tag){case 3:zo(t),za();break;case 5:Da(t);break;case 1:fi(t.type)&&gi(t);break;case 4:Ea(t,t.stateNode.containerInfo);break;case 10:n=t.memoizedProps.value;var i=t.type._context;oi(Xi,i._currentValue),i._currentValue=n;break;case 13:if(null!==t.memoizedState)return 0!=(r&t.child.childLanes)?Xo(e,t,r):(oi(Ia,1&Ia.current),null!==(t=es(e,t,r))?t.sibling:null);oi(Ia,1&Ia.current);break;case 19:if(n=0!=(r&t.childLanes),0!=(64&e.flags)){if(n)return $o(e,t,r);t.flags|=64}if(null!==(i=t.memoizedState)&&(i.rendering=null,i.tail=null,i.lastEffect=null),oi(Ia,Ia.current),n)break;return null;case 23:case 24:return t.lanes=0,Ro(e,t,r)}return es(e,t,r)}Io=0!=(16384&e.flags)}else Io=!1;switch(t.lanes=0,t.tag){case 2:if(n=t.type,null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=di(t,ui.current),ea(t,r),i=to(null,t,n,e,i,r),t.flags|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){if(t.tag=1,t.memoizedState=null,t.updateQueue=null,fi(n)){var a=!0;gi(t)}else a=!1;t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,na(t);var s=n.getDerivedStateFromProps;"function"==typeof s&&da(t,n,s,e),i.updater=fa,t.stateNode=i,i._reactInternals=t,ga(t,n,e,r),t=Uo(null,t,n,!0,a,r)}else t.tag=0,Mo(null,t,i,r),t=t.child;return t;case 16:i=t.elementType;e:{switch(null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),e=t.pendingProps,i=(a=i._init)(i._payload),t.type=i,a=t.tag=function(e){if("function"==typeof e)return Lu(e)?1:0;if(null!=e){if((e=e.$$typeof)===A)return 11;if(e===I)return 14}return 2}(i),e=Wi(i,e),a){case 0:t=No(null,t,i,e,r);break e;case 1:t=Fo(null,t,i,e,r);break e;case 11:t=ko(null,t,i,e,r);break e;case 14:t=Bo(null,t,i,Wi(i.type,e),n,r);break e}throw Error(o(306,i,""))}return t;case 0:return n=t.type,i=t.pendingProps,No(e,t,n,i=t.elementType===n?i:Wi(n,i),r);case 1:return n=t.type,i=t.pendingProps,Fo(e,t,n,i=t.elementType===n?i:Wi(n,i),r);case 3:if(zo(t),n=t.updateQueue,null===e||null===n)throw Error(o(282));if(n=t.pendingProps,i=null!==(i=t.memoizedState)?i.element:null,ia(e,t),ua(t,n,null,r),(n=t.memoizedState.element)===i)za(),t=es(e,t,r);else{if((a=(i=t.stateNode).hydrate)&&(Ba=Hn(t.stateNode.containerInfo.firstChild),ka=t,a=Va=!0),a){if(null!=(e=i.mutableSourceEagerHydrationData))for(i=0;i<e.length;i+=2)(a=e[i])._workInProgressVersionPrimary=e[i+1],Ha.push(a);for(r=xa(t,null,n,r),t.child=r;r;)r.flags=-3&r.flags|1024,r=r.sibling}else Mo(e,t,n,r),za();t=t.child}return t;case 5:return Da(t),null===e&&Na(t),n=t.type,i=t.pendingProps,a=null!==e?e.memoizedProps:null,s=i.children,Nn(n,i)?s=null:null!==a&&Nn(n,a)&&(t.flags|=16),Lo(e,t),Mo(e,t,s,r),t.child;case 6:return null===e&&Na(t),null;case 13:return Xo(e,t,r);case 4:return Ea(t,t.stateNode.containerInfo),n=t.pendingProps,null===e?t.child=Sa(t,null,n,r):Mo(e,t,n,r),t.child;case 11:return n=t.type,i=t.pendingProps,ko(e,t,n,i=t.elementType===n?i:Wi(n,i),r);case 7:return Mo(e,t,t.pendingProps,r),t.child;case 8:case 12:return Mo(e,t,t.pendingProps.children,r),t.child;case 10:e:{n=t.type._context,i=t.pendingProps,s=t.memoizedProps,a=i.value;var u=t.type._context;if(oi(Xi,u._currentValue),u._currentValue=a,null!==s)if(u=s.value,0===(a=on(u,a)?0:0|("function"==typeof n._calculateChangedBits?n._calculateChangedBits(u,a):1073741823))){if(s.children===i.children&&!ci.current){t=es(e,t,r);break e}}else for(null!==(u=t.child)&&(u.return=t);null!==u;){var c=u.dependencies;if(null!==c){s=u.child;for(var l=c.firstContext;null!==l;){if(l.context===n&&0!=(l.observedBits&a)){1===u.tag&&((l=aa(-1,r&-r)).tag=2,oa(u,l)),u.lanes|=r,null!==(l=u.alternate)&&(l.lanes|=r),$i(u.return,r),c.lanes|=r;break}l=l.next}}else s=10===u.tag&&u.type===t.type?null:u.child;if(null!==s)s.return=u;else for(s=u;null!==s;){if(s===t){s=null;break}if(null!==(u=s.sibling)){u.return=s.return,s=u;break}s=s.return}u=s}Mo(e,t,i.children,r),t=t.child}return t;case 9:return i=t.type,n=(a=t.pendingProps).children,ea(t,r),n=n(i=ta(i,a.unstable_observedBits)),t.flags|=1,Mo(e,t,n,r),t.child;case 14:return a=Wi(i=t.type,t.pendingProps),Bo(e,t,i,a=Wi(i.type,a),n,r);case 15:return Vo(e,t,t.type,t.pendingProps,n,r);case 17:return n=t.type,i=t.pendingProps,i=t.elementType===n?i:Wi(n,i),null!==e&&(e.alternate=null,t.alternate=null,t.flags|=2),t.tag=1,fi(n)?(e=!0,gi(t)):e=!1,ea(t,r),ma(t,n,i),ga(t,n,i,r),Uo(null,t,n,!0,e,r);case 19:return $o(e,t,r);case 23:case 24:return Ro(e,t,r)}throw Error(o(156,t.tag))},Zu.prototype.render=function(e){Xu(e,this._internalRoot,null,null)},Zu.prototype.unmount=function(){var e=this._internalRoot,t=e.containerInfo;Xu(null,e,null,(function(){t[Qn]=null}))},et=function(e){13===e.tag&&(su(e,4,au()),Ku(e,4))},tt=function(e){13===e.tag&&(su(e,67108864,au()),Ku(e,67108864))},rt=function(e){if(13===e.tag){var t=au(),r=ou(e);su(e,r,t),Ku(e,r)}},nt=function(e,t){return t()},je=function(e,t,r){switch(t){case"input":if(re(e,r),t=r.name,"radio"===r.type&&null!=t){for(r=e;r.parentNode;)r=r.parentNode;for(r=r.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<r.length;t++){var n=r[t];if(n!==e&&n.form===e.form){var i=ei(n);if(!i)throw Error(o(90));Z(n),re(n,i)}}}break;case"textarea":ce(e,r);break;case"select":null!=(t=r.value)&&oe(e,!!r.multiple,t,!1)}},Ie=pu,Me=function(e,t,r,n,i){var a=Cs;Cs|=4;try{return Ui(98,e.bind(null,t,r,n,i))}finally{0===(Cs=a)&&(Fs(),Hi())}},ke=function(){0==(49&Cs)&&(function(){if(null!==Zs){var e=Zs;Zs=null,e.forEach((function(e){e.expiredLanes|=24&e.pendingLanes,cu(e,Li())}))}Hi()}(),Eu())},Be=function(e,t){var r=Cs;Cs|=2;try{return e(t)}finally{0===(Cs=r)&&(Fs(),Hi())}};var tc={Events:[Jn,$n,ei,De,Te,Eu,{current:!1}]},rc={findFiberByHostInstance:Zn,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},nc={bundleType:rc.bundleType,version:rc.version,rendererPackageName:rc.rendererPackageName,rendererConfig:rc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:S.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return null===(e=Je(e))?null:e.stateNode},findFiberByHostInstance:rc.findFiberByHostInstance||function(){return null},findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__){var ic=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ic.isDisabled&&ic.supportsFiber)try{bi=ic.inject(nc),yi=ic}catch(e){}}t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=tc,t.createPortal=ec,t.findDOMNode=function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternals;if(void 0===t){if("function"==typeof e.render)throw Error(o(188));throw Error(o(268,Object.keys(e)))}return e=null===(e=Je(t))?null:e.stateNode},t.flushSync=function(e,t){var r=Cs;if(0!=(48&r))return e(t);Cs|=1;try{if(e)return Ui(99,e.bind(null,t))}finally{Cs=r,Hi()}},t.hydrate=function(e,t,r){if(!Ju(t))throw Error(o(200));return $u(null,e,t,!0,r)},t.render=function(e,t,r){if(!Ju(t))throw Error(o(200));return $u(null,e,t,!1,r)},t.unmountComponentAtNode=function(e){if(!Ju(e))throw Error(o(40));return!!e._reactRootContainer&&(mu((function(){$u(null,null,e,!1,(function(){e._reactRootContainer=null,e[Qn]=null}))})),!0)},t.unstable_batchedUpdates=pu,t.unstable_createPortal=function(e,t){return ec(e,t,2<arguments.length&&void 0!==arguments[2]?arguments[2]:null)},t.unstable_renderSubtreeIntoContainer=function(e,t,r,n){if(!Ju(r))throw Error(o(200));if(null==e||void 0===e._reactInternals)throw Error(o(38));return $u(e,t,r,!1,n)},t.version="17.0.2"},function(e,t,r){"use strict";e.exports=r(424)},function(e,t,r){"use strict";
/** @license React v0.20.2
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var n,i,a,o;if("object"==typeof performance&&"function"==typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var u=Date,c=u.now();t.unstable_now=function(){return u.now()-c}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var l=null,d=null,f=function(){if(null!==l)try{var e=t.unstable_now();l(!0,e),l=null}catch(e){throw setTimeout(f,0),e}};n=function(e){null!==l?setTimeout(n,0,e):(l=e,setTimeout(f,0))},i=function(e,t){d=setTimeout(e,t)},a=function(){clearTimeout(d)},t.unstable_shouldYield=function(){return!1},o=t.unstable_forceFrameRate=function(){}}else{var p=window.setTimeout,m=window.clearTimeout;if("undefined"!=typeof console){var h=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 h&&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,v=null,b=-1,y=5,_=0;t.unstable_shouldYield=function(){return t.unstable_now()>=_},o=function(){},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):y=0<e?Math.floor(1e3/e):5};var S=new MessageChannel,x=S.port2;S.port1.onmessage=function(){if(null!==v){var e=t.unstable_now();_=e+y;try{v(!0,e)?x.postMessage(null):(g=!1,v=null)}catch(e){throw x.postMessage(null),e}}else g=!1},n=function(e){v=e,g||(g=!0,x.postMessage(null))},i=function(e,r){b=p((function(){e(t.unstable_now())}),r)},a=function(){m(b),b=-1}}function O(e,t){var r=e.length;e.push(t);e:for(;;){var n=r-1>>>1,i=e[n];if(!(void 0!==i&&0<j(i,t)))break e;e[n]=t,e[r]=i,r=n}}function w(e){return void 0===(e=e[0])?null:e}function C(e){var t=e[0];if(void 0!==t){var r=e.pop();if(r!==t){e[0]=r;e:for(var n=0,i=e.length;n<i;){var a=2*(n+1)-1,o=e[a],s=a+1,u=e[s];if(void 0!==o&&0>j(o,r))void 0!==u&&0>j(u,o)?(e[n]=u,e[s]=r,n=s):(e[n]=o,e[a]=r,n=a);else{if(!(void 0!==u&&0>j(u,r)))break e;e[n]=u,e[s]=r,n=s}}}return t}return null}function j(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}var P=[],E=[],A=1,D=null,T=3,I=!1,M=!1,k=!1;function B(e){for(var t=w(E);null!==t;){if(null===t.callback)C(E);else{if(!(t.startTime<=e))break;C(E),t.sortIndex=t.expirationTime,O(P,t)}t=w(E)}}function V(e){if(k=!1,B(e),!M)if(null!==w(P))M=!0,n(R);else{var t=w(E);null!==t&&i(V,t.startTime-e)}}function R(e,r){M=!1,k&&(k=!1,a()),I=!0;var n=T;try{for(B(r),D=w(P);null!==D&&(!(D.expirationTime>r)||e&&!t.unstable_shouldYield());){var o=D.callback;if("function"==typeof o){D.callback=null,T=D.priorityLevel;var s=o(D.expirationTime<=r);r=t.unstable_now(),"function"==typeof s?D.callback=s:D===w(P)&&C(P),B(r)}else C(P);D=w(P)}if(null!==D)var u=!0;else{var c=w(E);null!==c&&i(V,c.startTime-r),u=!1}return u}finally{D=null,T=n,I=!1}}var L=o;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){M||I||(M=!0,n(R))},t.unstable_getCurrentPriorityLevel=function(){return T},t.unstable_getFirstCallbackNode=function(){return w(P)},t.unstable_next=function(e){switch(T){case 1:case 2:case 3:var t=3;break;default:t=T}var r=T;T=t;try{return e()}finally{T=r}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=L,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=T;T=e;try{return t()}finally{T=r}},t.unstable_scheduleCallback=function(e,r,o){var s=t.unstable_now();switch("object"==typeof o&&null!==o?o="number"==typeof(o=o.delay)&&0<o?s+o:s:o=s,e){case 1:var u=-1;break;case 2:u=250;break;case 5:u=1073741823;break;case 4:u=1e4;break;default:u=5e3}return e={id:A++,callback:r,priorityLevel:e,startTime:o,expirationTime:u=o+u,sortIndex:-1},o>s?(e.sortIndex=o,O(E,e),null===w(P)&&e===w(E)&&(k?a():k=!0,i(V,o-s))):(e.sortIndex=u,O(P,e),M||I||(M=!0,n(R))),e},t.unstable_wrapCallback=function(e){var t=T;return function(){var r=T;T=t;try{return e.apply(this,arguments)}finally{T=r}}}},function(e,t,r){"use strict";r.r(t),r.d(t,"VolumeStreamingCustomControls",(function(){return S}));var n=r(0),i=r(33),a=r(3),o=r(164),s=r(18),u=r(2),c=r(73),l=r(336),d=r(36),f=r(1),p=r(47),m=r(179),h=r(13),g=r(224),v=r(15),b={color:u.ParamDefinition.Color(p.a.black,{description:"Display color of the volume."}),wireframe:u.ParamDefinition.Boolean(!1,{description:"Control display of the volume as a wireframe."}),opacity:u.ParamDefinition.Numeric(.3,{min:0,max:1,step:.01},{description:"Opacity of the volume."})},y=new Map([["em",[-5,5]],["2fo-fc",[0,3]],["fo-fc(+ve)",[1,5]],["fo-fc(-ve)",[-5,-1]]]),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.ref=h.StateSelection.findTagInSubtree(t.plugin.state.data.tree,t.props.bCell.transform.ref,t.props.name),t.getVisible=function(){var e=t.plugin.state.data,r=t.ref;return!!r&&!e.cells.get(r).state.isHidden},t.toggleVisible=function(){var e=t.plugin.state.data,r=t.ref;r&&Object(g.setSubtreeVisibility)(e,r,!e.cells.get(r).state.isHidden)},t}return Object(n.__extends)(t,e),t.prototype.componentDidUpdate=function(){this.ref=h.StateSelection.findTagInSubtree(this.plugin.state.data.tree,this.props.bCell.transform.ref,this.props.name)},t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.data.events.cell.stateUpdated,(function(t){e.ref===t.ref&&e.forceUpdate()}))},t.prototype.render=function(){var e=this.props,t=e.isRelative,r=e.stats,n=e.channels[e.name],i=r.min,o=r.max,u=r.mean,d=r.sigma,f=Math.round(100*("relative"===n.isoValue.kind?n.isoValue.relativeValue:n.isoValue.absoluteValue))/100,p=(i-u)/d,h=(o-u)/d;if(!this.props.isUnbounded){var g=y.get(this.props.name);"em"===this.props.name?(p=Math.max(g[0],p),h=Math.min(g[1],h)):(p=g[0],h=g[1])}var _=u+d*p,S=u+d*h,x=Object(m.e)(t?Math.round((S-_)/d)/100:d/100,2),O=t?p:_,w=t?h:S;return a.createElement(s.ExpandableControlRow,{label:e.label+(e.isRelative?" σ":""),colorStripe:n.color,pivot:a.createElement("div",{className:"msp-volume-channel-inline-controls"},a.createElement(l.a,{value:f,min:O,max:w,step:x,onChange:function(r){return e.changeIso(e.name,r,t)},disabled:e.params.isDisabled,onEnter:e.params.events.onEnter}),a.createElement(s.IconButton,{svg:this.getVisible()?v.VisibilityOutlinedSvg:v.VisibilityOffOutlinedSvg,onClick:this.toggleVisible,toggleState:!1,disabled:e.params.isDisabled})),controls:a.createElement(c.ParameterControls,{onChange:function(t){var r=t.name,n=t.value;return e.changeParams(e.name,r,n)},params:b,values:n,onEnter:e.params.events.onEnter,isDisabled:e.params.isDisabled})})},t}(i.PluginUIComponent),S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.changeIso=function(e,r,i){var a,o=t.props.params;t.newParams(Object(n.__assign)(Object(n.__assign)({},o),{entry:{name:o.entry.name,params:Object(n.__assign)(Object(n.__assign)({},o.entry.params),{channels:Object(n.__assign)(Object(n.__assign)({},o.entry.params.channels),(a={},a[e]=Object(n.__assign)(Object(n.__assign)({},o.entry.params.channels[e]),{isoValue:i?d.b.IsoValue.relative(r):d.b.IsoValue.absolute(r)}),a))})}}))},t.changeParams=function(e,r,i){var a,o,s=t.props.params;t.newParams(Object(n.__assign)(Object(n.__assign)({},s),{entry:{name:s.entry.name,params:Object(n.__assign)(Object(n.__assign)({},s.entry.params),{channels:Object(n.__assign)(Object(n.__assign)({},s.entry.params.channels),(a={},a[e]=Object(n.__assign)(Object(n.__assign)({},s.entry.params.channels[e]),(o={},o[r]=i,o)),a))})}}))},t.changeOption=function(e){var r=e.name,i=e.value,a=t.props.params;if("entry"===r)t.newParams(Object(n.__assign)(Object(n.__assign)({},a),{entry:{name:i,params:a.entry.params}}));else{var o=t.props.b.data,s="em"===o.info.kind,u=i.params.isRelative,c=o.info.header.sampling[0],l=a.entry.params.channels,d=a.entry.params.view.name===i.name?a.entry.params.view.params:t.props.info.params.entry.map(a.entry.name).params.view.map(i.name).defaultValue,f=Object(n.__assign)({},d);"selection-box"===i.name?f.radius=i.params.radius:"box"===i.name?(f.bottomLeft=i.params.bottomLeft,f.topRight=i.params.topRight):"auto"===i.name&&(f.radius=i.params.radius,f.selectionDetailLevel=i.params.selectionDetailLevel),f.isUnbounded=!!i.params.isUnbounded,t.newParams(Object(n.__assign)(Object(n.__assign)({},a),{entry:{name:a.entry.name,params:Object(n.__assign)(Object(n.__assign)({},a.entry.params),{view:{name:i.name,params:f},detailLevel:i.params.detailLevel,channels:s?{em:t.convert(l.em,c.valuesInfo[0],u)}:{"2fo-fc":t.convert(l["2fo-fc"],c.valuesInfo[0],u),"fo-fc(+ve)":t.convert(l["fo-fc(+ve)"],c.valuesInfo[1],u),"fo-fc(-ve)":t.convert(l["fo-fc(-ve)"],c.valuesInfo[1],u)}})}}))}},t}return Object(n.__extends)(t,e),t.prototype.areInitial=function(e){return u.ParamDefinition.areEqual(this.props.info.params,e,this.props.info.initialValues)},t.prototype.newParams=function(e){this.props.events.onChange(e,this.areInitial(e))},t.prototype.convert=function(e,t,r){return Object(n.__assign)(Object(n.__assign)({},e),{isoValue:r?d.b.IsoValue.toRelative(e.isoValue,t):d.b.IsoValue.toAbsolute(e.isoValue,t)})},t.prototype.render=function(){if(!this.props.b)return null;var e=this.props.b.data,t="em"===e.info.kind,r=t?"em":"2fo-fc",i=this.props.params,s=this.props.info.params.entry.map(i.entry.name).params.detailLevel,l="relative"===i.entry.params.channels[r].isoValue.kind,d=e.info.header.sampling[0],p=u.ParamDefinition.Boolean(l,{description:"Use normalized or absolute isocontour scale.",label:"Normalized"}),m=!!i.entry.params.view.params.isUnbounded,h=u.ParamDefinition.Boolean(m,{description:"Show full/limited range of iso-values for more fine-grained control.",label:"Unbounded"}),g="off"===i.entry.params.view.name,v={entry:u.ParamDefinition.Select(i.entry.name,e.data.entries.map((function(e){return[e.dataId,e.dataId]})),{isHidden:g,description:"Which entry with volume data to display."}),view:u.ParamDefinition.MappedStatic(i.entry.params.view.name,{off:u.ParamDefinition.Group({isRelative:u.ParamDefinition.Boolean(l,{isHidden:!0}),isUnbounded:u.ParamDefinition.Boolean(m,{isHidden:!0})},{description:"Display off."}),box:u.ParamDefinition.Group({bottomLeft:u.ParamDefinition.Vec3(f.Vec3.zero()),topRight:u.ParamDefinition.Vec3(f.Vec3.zero()),detailLevel:s,isRelative:p,isUnbounded:h},{description:"Static box defined by cartesian coords."}),"selection-box":u.ParamDefinition.Group({radius:u.ParamDefinition.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in Å within which the volume is shown."}),detailLevel:s,isRelative:p,isUnbounded:h},{description:"Box around focused element."}),cell:u.ParamDefinition.Group({detailLevel:s,isRelative:p,isUnbounded:h},{description:"Box around the structure's bounding box."}),auto:u.ParamDefinition.Group({radius:u.ParamDefinition.Numeric(5,{min:0,max:50,step:.5},{description:"Radius in Å within which the volume is shown."}),detailLevel:s,selectionDetailLevel:Object(n.__assign)(Object(n.__assign)({},s),{label:"Selection Detail"}),isRelative:p,isUnbounded:h},{description:"Box around focused element."})},{options:o.a.ViewTypeOptions,description:'Controls what of the volume is displayed. "Off" hides the volume alltogether. "Bounded box" shows the volume inside the given box. "Around Focus" shows the volume around the element/atom last interacted with. "Whole Structure" shows the volume for the whole structure.'})},b={entry:i.entry.name,view:{name:i.entry.params.view.name,params:{detailLevel:i.entry.params.detailLevel,radius:i.entry.params.view.params.radius,bottomLeft:i.entry.params.view.params.bottomLeft,topRight:i.entry.params.view.params.topRight,selectionDetailLevel:i.entry.params.view.params.selectionDetailLevel,isRelative:l,isUnbounded:m}}};return g?a.createElement(c.ParameterControls,{onChange:this.changeOption,params:v,values:b,onEnter:this.props.events.onEnter,isDisabled:this.props.isDisabled}):a.createElement(a.Fragment,null,!t&&a.createElement(_,{label:"2Fo-Fc",name:"2fo-fc",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:l,params:this.props,stats:d.valuesInfo[0],isUnbounded:m}),!t&&a.createElement(_,{label:"Fo-Fc(+ve)",name:"fo-fc(+ve)",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:l,params:this.props,stats:d.valuesInfo[1],isUnbounded:m}),!t&&a.createElement(_,{label:"Fo-Fc(-ve)",name:"fo-fc(-ve)",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:l,params:this.props,stats:d.valuesInfo[1],isUnbounded:m}),t&&a.createElement(_,{label:"EM",name:"em",bCell:this.props.bCell,channels:i.entry.params.channels,changeIso:this.changeIso,changeParams:this.changeParams,isRelative:l,params:this.props,stats:d.valuesInfo[0],isUnbounded:m}),a.createElement(c.ParameterControls,{onChange:this.changeOption,params:v,values:b,onEnter:this.props.events.onEnter,isDisabled:this.props.isDisabled}))},t}(i.PluginUIComponent)},function(e,t,r){"use strict";(function(e){
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <http://feross.org>
 * @license  MIT
 */
var n=r(427),i=r(428),a=r(429);function o(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,r){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return d(this,e)}return c(this,e,t,r)}function c(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=f(e,t);return e}(e,t,r,n):"string"==typeof t?function(e,t,r){"string"==typeof r&&""!==r||(r="utf8");if(!u.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|m(t,r),i=(e=s(e,n)).write(t,r);i!==n&&(e=e.slice(0,i));return e}(e,t,r):function(e,t){if(u.isBuffer(t)){var r=0|p(t.length);return 0===(e=s(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(n=t.length)!=n?s(e,0):f(e,t);if("Buffer"===t.type&&a(t.data))return f(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function d(e,t){if(l(t),e=s(e,t<0?0:0|p(t)),!u.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|p(t.length);e=s(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function m(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(n)return F(e).length;t=(""+t).toLowerCase(),n=!0}}function h(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return A(this,t,r);case"utf8":case"utf-8":return j(this,t,r);case"ascii":return P(this,t,r);case"latin1":case"binary":return E(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=u.from(t,n)),u.isBuffer(t))return 0===t.length?-1:b(e,t,r,n,i);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){var a,o=1,s=e.length,u=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,u/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(a=r;a<s;a++)if(c(e,a)===c(t,-1===l?0:a-l)){if(-1===l&&(l=a),a-l+1===u)return l*o}else-1!==l&&(a-=a-l),l=-1}else for(r+u>s&&(r=s-u),a=r;a>=0;a--){for(var d=!0,f=0;f<u;f++)if(c(e,a+f)!==c(t,f)){d=!1;break}if(d)return a}return-1}function y(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=t.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function _(e,t,r,n){return z(F(t,e.length-r),e,r,n)}function S(e,t,r,n){return z(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function x(e,t,r,n){return S(e,t,r,n)}function O(e,t,r,n){return z(U(t),e,r,n)}function w(e,t,r,n){return z(function(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function C(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function j(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var a,o,s,u,c=e[i],l=null,d=c>239?4:c>223?3:c>191?2:1;if(i+d<=r)switch(d){case 1:c<128&&(l=c);break;case 2:128==(192&(a=e[i+1]))&&(u=(31&c)<<6|63&a)>127&&(l=u);break;case 3:a=e[i+1],o=e[i+2],128==(192&a)&&128==(192&o)&&(u=(15&c)<<12|(63&a)<<6|63&o)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:a=e[i+1],o=e[i+2],s=e[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(u=(15&c)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,d=1):l>65535&&(l-=65536,n.push(l>>>10&1023|55296),l=56320|1023&l),n.push(l),i+=d}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,r){return c(null,e,t,r)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,r){return function(e,t,r,n){return l(t),t<=0?s(e,t):void 0!==r?"string"==typeof n?s(e,t).fill(r,n):s(e,t).fill(r):s(e,t)}(null,e,t,r)},u.allocUnsafe=function(e){return d(null,e)},u.allocUnsafeSlow=function(e){return d(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);i<a;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!a(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=u.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var o=e[r];if(!u.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,i),i+=o.length}return n},u.byteLength=m,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?j(this,0,e):h.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,r,n,i){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(a,o),c=this.slice(n,i),l=e.slice(t,r),d=0;d<s;++d)if(c[d]!==l[d]){a=c[d],o=l[d];break}return a<o?-1:o<a?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},u.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return y(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":return S(this,e,t,r);case"latin1":case"binary":return x(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function P(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function E(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function A(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",a=t;a<r;++a)i+=N(e[a]);return i}function D(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function T(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,r,n,i,a){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function M(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);i<a;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function k(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);i<a;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function B(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function V(e,t,r,n,a){return a||B(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,a){return a||B(e,0,r,8),i.write(e,t,r,n,52,8),r+8}u.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=u.prototype;else{var i=t-e;r=new u(i,void 0);for(var a=0;a<i;++a)r[a]=this[a+e]}return r},u.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},u.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},u.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},u.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||T(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},u.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),i.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),i.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),i.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),i.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||I(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},u.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||I(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},u.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):k(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):k(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);I(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)e<0&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},u.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var i=Math.pow(2,8*r-1);I(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},u.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):M(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):M(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):k(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):k(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,r){return V(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return V(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&r<t&&t<n)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(a<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},u.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var a;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(a=t;a<r;++a)this[a]=e;else{var o=u.isBuffer(e)?e:F(new u(e,n).toString()),s=o.length;for(a=0;a<r-t;++a)this[a+t]=o[a%s]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function N(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function U(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function z(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}}).call(this,r(395))},function(e,t,r){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=c(e),o=n[0],s=n[1],u=new a(function(e,t,r){return 3*(t+r)/4-r}(0,o,s)),l=0,d=s>0?o-4:o;for(r=0;r<d;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===s&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===s&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,a=[],o=0,s=r-i;o<s;o+=16383)a.push(l(e,o,o+16383>s?s:o+16383));1===i?(t=e[r-1],a.push(n[t>>2]+n[t<<4&63]+"==")):2===i&&(t=(e[r-2]<<8)+e[r-1],a.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return a.join("")};for(var n=[],i=[],a="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=o.length;s<u;++s)n[s]=o[s],i[o.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function l(e,t,r){for(var i,a,o=[],s=t;s<r;s+=3)i=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(n[(a=i)>>18&63]+n[a>>12&63]+n[a>>6&63]+n[63&a]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
t.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,u=(1<<s)-1,c=u>>1,l=-7,d=r?i-1:0,f=r?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-l)-1,p>>=-l,l+=s;l>0;a=256*a+e[t+d],d+=f,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+d],d+=f,l-=8);if(0===a)a=1-c;else{if(a===u)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=c}return(p?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,s,u,c=8*a-i-1,l=(1<<c)-1,d=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,m=n?1:-1,h=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+d>=1?f/u:f*Math.pow(2,1-d))*u>=2&&(o++,u/=2),o+d>=l?(s=0,o=l):o+d>=1?(s=(t*u-1)*Math.pow(2,i),o+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),o=0));i>=8;e[r+p]=255&s,p+=m,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;e[r+p]=255&o,p+=m,o/=256,c-=8);e[r+p-m]|=128*h}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){(function(e,t){!function(e,r){"use strict";if(!e.setImmediate){var n,i,a,o,s,u=1,c={},l=!1,d=e.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(e);f=f&&f.setTimeout?f:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){m(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?e.MessageChannel?((a=new MessageChannel).port1.onmessage=function(e){m(e.data)},n=function(e){a.port2.postMessage(e)}):d&&"onreadystatechange"in d.createElement("script")?(i=d.documentElement,n=function(e){var t=d.createElement("script");t.onreadystatechange=function(){m(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):n=function(e){setTimeout(m,0,e)}:(o="setImmediate$"+Math.random()+"$",s=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&m(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",s,!1):e.attachEvent("onmessage",s),n=function(t){e.postMessage(o+t,"*")}),f.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var i={callback:e,args:t};return c[u]=i,n(u),u++},f.clearImmediate=p}function p(e){delete c[e]}function m(e){if(l)setTimeout(m,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(void 0,r)}}(t)}finally{p(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,r(395),r(344))},function(e,t){e.exports=XMLHttpRequest},function(e,t){},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDBeLociLabelProvider=void 0;var n=r(177),i=r(4),a=r(77);t.PDBeLociLabelProvider=n.PluginBehavior.create({name:"pdbe-loci-label-provider",category:"interaction",ctor:function(){function e(e){var t=this;this.ctx=e,this.f={label:function(e){var r=t.ctx.customState,n=[];if(!!(!r||!r.initParams.superposition)&&i.StructureElement.Loci.is(e)&&1===e.elements.length){var o=e.elements[0].unit,s=i.StructureElement.Location.create(e.structure,o,o.elements[0]),u=i.StructureProperties.entity.pdbx_description(s).join(", ");n.push(u)}return n.push(a.lociLabel(e)),n.filter((function(e){return!!e})).join("</br>")},group:function(e){return e.toString().replace(/Model [0-9]+/g,"Models")},priority:100}}return e.prototype.register=function(){this.ctx.managers.lociLabels.addProvider(this.f)},e.prototype.unregister=function(){this.ctx.managers.lociLabels.removeProvider(this.f)},e}(),display:{name:"Provide PDBe Loci Label"}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDBeSuperpositionStructureTools=t.PDBeLigandViewStructureTools=t.PDBeStructureTools=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(33),o=r(330),s=r(398),u=r(402),c=r(381),l=r(435),d=r(15),f=r(436),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-section-header"},i.createElement(d.Icon,{svg:d.BuildSvg}),"Structure Tools"),i.createElement(u.StructureSourceControls,null),i.createElement(l.AnnotationsComponentControls,null),i.createElement(o.StructureComponentControls,null),i.createElement(c.VolumeStreamingControls,null),i.createElement(c.VolumeSourceControls,null),i.createElement(s.StructureMeasurementsControls,null))},t}(a.PluginUIComponent);t.PDBeStructureTools=p;var m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-section-header"},i.createElement(d.Icon,{svg:d.BuildSvg}),"Structure Tools"),i.createElement(o.StructureComponentControls,null),i.createElement(c.VolumeStreamingControls,null),i.createElement(s.StructureMeasurementsControls,null))},t}(a.PluginUIComponent);t.PDBeLigandViewStructureTools=m;var h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.render=function(){return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-section-header"},i.createElement(d.Icon,{svg:d.BuildSvg}),"Structure Tools"),i.createElement(f.SuperpositionComponentControls,null),i.createElement(s.StructureMeasurementsControls,null))},t}(a.PluginUIComponent);t.PDBeSuperpositionStructureTools=h},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationsComponentControls=t.TextsmsOutlinedSvg=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(18),o=r(33),s=r(388),u=r(13),c=r(73),l=r(409),d=r(396),f=r(411),p=r(15),m=r(284),h=i.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.createElement("g",null,i.createElement("path",{d:"M20 2H4c-1.1 0-2 .9-2 2v18l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H6l-2 2V4h16v12z"}),i.createElement("path",{d:"M7 9h2v2H7zM11 9h2v2h-2zM15 9h2v2h-2z"})));function g(){return h}t.TextsmsOutlinedSvg=g;var v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isCollapsed:!1,validationApplied:!1,domainAtnApplied:!1,validationOptions:!1,domainAtnOptions:!1},t.getOptionParams=function(){var e=!1,r=!1,n=t.plugin.customState;if(n&&n.initParams&&(n.initParams.validationAnnotation&&(e=!0),n.initParams.domainAnnotation&&(r=!0)),e&&!t.state.validationParams||r&&!t.state.domainAtnParams){var i=u.StateSelection.findTagInSubtree(t.plugin.state.data.tree,u.StateTransform.RootRef,"structure-component-static-polymer");if(i){var a=t.plugin.state.data.select(i)[0].obj;if(a){var o={structure:a.data};if(e&&!t.state.validationParams){var c=s.StructureQualityReportColorThemeProvider.getParams(o);c&&t.setState({validationParams:{params:c,values:{type:c.type.defaultValue}}})}if(r&&!t.state.domainAtnParams){var d=l.DomainAnnotationsColorThemeProvider.getParams(o);d&&t.setState({domainAtnParams:{params:d,values:{type:d.type.defaultValue}}})}}}}},t.toggleCollapsed=function(){t.setState({isCollapsed:!t.state.isCollapsed})},t.toggleOptions=function(e){0===e&&t.setState({validationOptions:!t.state.validationOptions}),1===e&&t.setState({domainAtnOptions:!t.state.domainAtnOptions})},t.applyAnnotation=function(e,r,n){var i,a="polymer-id",o=d.PDBeStructureQualityReport,s=t.state.domainAtnParams?f.PDBeDomainAnnotations:void 0;if(0===e?(r&&(a="pdbe-structure-quality-report"),t.setState({validationApplied:r}),t.setState({domainAtnApplied:!1})):(o=f.PDBeDomainAnnotations,s=t.state.validationParams?d.PDBeStructureQualityReport:void 0,r&&(a="pdbe-domain-annotations"),t.setState({domainAtnApplied:r}),t.setState({validationApplied:!1})),r&&"polymer-id"!==a){var u=t.plugin.state.behaviors.build().to(o.id).update(o,(function(e){e.showTooltip=!0}));if(t.plugin.runTask(t.plugin.state.behaviors.updateTree(u)),s){var c=t.plugin.state.behaviors.build().to(s.id).update(s,(function(e){e.showTooltip=!1}));t.plugin.runTask(t.plugin.state.behaviors.updateTree(c))}}t.plugin.managers.structure.hierarchy.currentComponentGroups.forEach((function(e){"structure-component-static-polymer"===e[0].key&&(i=e)})),i&&t.plugin.managers.structure.component.updateRepresentationsTheme(i,{color:a,colorParams:n||void 0})},t.initApplyAnnotation=function(e){0===e&&t.applyAnnotation(0,!t.state.validationApplied,t.state.validationParams.values),1===e&&t.applyAnnotation(1,!t.state.domainAtnApplied,t.state.domainAtnParams.values)},t.updateValidationParams=function(e){var r=n.__assign({},t.state.validationParams);r.values=e,t.setState({validationParams:r}),t.state.validationApplied&&t.applyAnnotation(0,t.state.validationApplied,e)},t.updateDomainAtnParams=function(e){var r=n.__assign({},t.state.domainAtnParams);r.values=e,t.setState({domainAtnParams:r}),t.state.domainAtnApplied&&t.applyAnnotation(1,t.state.domainAtnApplied,e)},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(){e.getOptionParams(),e.forceUpdate()})),this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(t){return e.setState({description:m.StructureHierarchyManager.getSelectedStructuresDescription(e.plugin)})}))},t.prototype.render=function(){var e=this;if(!this.state.validationParams&&!this.state.domainAtnParams)return i.createElement(i.Fragment,null);var t={accent:"green",svg:g},r=this.state.isCollapsed?"msp-transform-wrapper msp-transform-wrapper-collapsed":"msp-transform-wrapper";return i.createElement("div",{className:r},i.createElement("div",{className:"msp-transform-header"},i.createElement(a.Button,{icon:t?void 0:this.state.isCollapsed?p.ArrowRightSvg:p.ArrowDropDownSvg,noOverflow:!0,onClick:this.toggleCollapsed,className:t?"msp-transform-header-brand msp-transform-header-brand-"+t.accent:void 0,title:"Click to "+(this.state.isCollapsed?"expand":"collapse")},i.createElement(p.Icon,{svg:null==t?void 0:t.svg,inline:!0}),"Annotations",i.createElement("small",{style:{margin:"0 6px"}},this.state.isCollapsed?"":this.state.description))),!this.state.isCollapsed&&this.state.validationParams&&i.createElement("div",{className:"msp-flex-row"},i.createElement(a.Button,{noOverflow:!0,className:"msp-control-button-label",title:"Validation Report Annotations.",style:{textAlign:"left"}},"Validation Report"),i.createElement(a.IconButton,{onClick:function(){return e.initApplyAnnotation(0)},toggleState:!1,svg:this.state.validationApplied?p.VisibilityOutlinedSvg:p.VisibilityOffOutlinedSvg,title:"Click to "+(this.state.validationApplied?"Hide":"Show")+" Validation Report Annotation",small:!0,className:"msp-form-control",flex:!0}),i.createElement(a.IconButton,{onClick:function(){return e.toggleOptions(0)},svg:p.MoreHorizSvg,title:"Actions",toggleState:this.state.validationOptions,className:"msp-form-control",flex:!0})),!this.state.isCollapsed&&this.state.validationParams&&this.state.validationOptions&&i.createElement("div",{style:{marginBottom:"6px"}},i.createElement("div",{className:"msp-accent-offset"},i.createElement("div",{className:"msp-representation-entry"},i.createElement(c.ParameterControls,{params:this.state.validationParams.params,values:this.state.validationParams.values,onChangeValues:this.updateValidationParams})))),!this.state.isCollapsed&&this.state.domainAtnParams&&i.createElement("div",{className:"msp-flex-row"},i.createElement(a.Button,{noOverflow:!0,className:"msp-control-button-label",title:"Domain Annotations.",style:{textAlign:"left"}},"Domains"),i.createElement(a.IconButton,{onClick:function(){return e.initApplyAnnotation(1)},toggleState:!1,svg:this.state.domainAtnApplied?p.VisibilityOutlinedSvg:p.VisibilityOffOutlinedSvg,title:"Click to "+(this.state.domainAtnApplied?"Hide":"Show")+" Domain Annotation",small:!0,className:"msp-form-control",flex:!0}),i.createElement(a.IconButton,{onClick:function(){return e.toggleOptions(1)},svg:p.MoreHorizSvg,title:"Actions",toggleState:this.state.domainAtnOptions,className:"msp-form-control",flex:!0})),!this.state.isCollapsed&&this.state.domainAtnParams&&this.state.domainAtnOptions&&i.createElement("div",{style:{marginBottom:"6px"}},i.createElement("div",{className:"msp-accent-offset"},i.createElement("div",{className:"msp-representation-entry"},i.createElement(c.ParameterControls,{params:this.state.domainAtnParams.params,values:this.state.domainAtnParams.values,onChangeValues:this.updateDomainAtnParams})))))},t}(o.PurePluginUIComponent);t.AnnotationsComponentControls=v},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SuperpositionComponentControls=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(27),o=r(13),s=r(2),u=r(33),c=r(18),l=r(15),d=r(73),f=r(279),p=r(156),m=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.defaultState=function(){return{header:"Components",isCollapsed:!1,isDisabled:!1,brand:{accent:"blue",svg:l.CubeOutlineSvg}}},t.prototype.renderControls=function(){return i.createElement(i.Fragment,null,i.createElement(h,null))},t}(u.CollapsableControls);t.SuperpositionComponentControls=m;var h=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={segmentWatch:!1,ligSearchText:"",carbSearchText:"",componentGroups:{nonLigGroups:[],ligGroups:[],carbGroups:[]},ligGroups:[],isLigCollapsed:!1,carbGroups:[],isCarbCollapsed:!1,isBusy:!1},t.ligInputStream=new p.Subject,t.handleLigInputStream=function(e){t.setState({ligSearchText:e});var r=t.state.componentGroups.ligGroups.filter((function(t){return t[0].key.split(",")[0].split("-")[2].toLowerCase().indexOf(e.toLowerCase())>=0}));t.setState({ligGroups:r})},t.carbInputStream=new p.Subject,t.handleCarbInputStream=function(e){t.setState({carbSearchText:e});var r=t.state.componentGroups.carbGroups.filter((function(t){var r=t[0].key.split(",")[0].split("-");return r.splice(0,2),r.pop(),r.join("-").toLowerCase().indexOf(e.toLowerCase())>=0}));t.setState({carbGroups:r})},t.toggleVisible=function(e,r,i){e.preventDefault(),e.currentTarget.blur();var a=t.plugin.customState;a.events.isBusy.next(!0);var o="ligands"===i?t.state.ligGroups:t.state.carbGroups;setTimeout((function(){return n.__awaiter(t,void 0,void 0,(function(){var e,t,i,s,u,c;return n.__generator(this,(function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),e=n.__asyncValues(o),l.label=1;case 1:return[4,e.next()];case 2:if((t=l.sent()).done)return[3,4];i=t.value,this.plugin.managers.structure.hierarchy.toggleVisibility(i,r),l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return s=l.sent(),u={error:s},[3,11];case 6:return l.trys.push([6,,9,10]),t&&!t.done&&(c=e.return)?[4,c.call(e)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(u)throw u.error;return[7];case 10:return[7];case 11:return a.events.isBusy.next(!1),[2]}}))}))}))},t.showHideAllControls=function(e){return i.createElement(i.Fragment,null,i.createElement(c.Button,{icon:l.CheckSvg,flex:!0,onClick:function(r){return t.toggleVisible(r,"show",e)},style:{flex:"0 0 50px",textAlign:"center",fontSize:"80%",color:"#9cacc3",padding:0},title:"Show all "+e,disabled:!1},"All"),i.createElement(c.Button,{icon:l.CloseSvg,flex:!0,onClick:function(r){return t.toggleVisible(r,"hide",e)},style:{flex:"0 0 50px",textAlign:"center",fontSize:"80%",color:"#9cacc3",padding:0},title:"Hide all "+e,disabled:!1},"None"))},t.clearLigSearch=function(e){e.preventDefault(),t.setState({ligSearchText:""}),t.ligInputStream.next(""),e.currentTarget.blur()},t.clearCarbSearch=function(e){e.preventDefault(),t.setState({carbSearchText:""}),t.carbInputStream.next(""),e.currentTarget.blur()},t.collapseSection=function(e,r){e.preventDefault(),e.currentTarget.blur(),"ligands"===r?t.setState({isLigCollapsed:!t.state.isLigCollapsed}):t.setState({isCarbCollapsed:!t.state.isCarbCollapsed})},t.sectionHeader=function(e){var r="ligands"===e?t.showHideAllControls("ligands"):t.showHideAllControls("carbohydrates"),n="ligands"===e?"Ligand":"Carbohydrates",a="ligands"===e?t.state.ligGroups.length:t.state.carbGroups.length,o="ligands"===e?t.state.componentGroups.ligGroups.length:t.state.componentGroups.carbGroups.length;return i.createElement("div",{className:"msp-flex-row",style:{marginTop:"6px"}},i.createElement("button",{className:"msp-form-control msp-control-button-label msp-transform-header-brand-gray",style:{textAlign:"left"},onClick:function(r){return t.collapseSection(r,e)}},i.createElement("span",null,i.createElement("strong",null,n)),i.createElement("small",{style:{color:"#7d91b0"}}," ( ",a,a<o?" / "+o:""," )")),a>1&&r)},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.managers.structure.hierarchy.behaviors.selection,(function(){e.categoriseGroups(),e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})}))},t.prototype.componentDidUpdate=function(){var e=this,t=this.plugin.customState;t.events&&!this.state.segmentWatch&&(this.setState({segmentWatch:!0}),this.subscribe(t.events.segmentUpdate,(function(){e.categoriseGroups(),e.forceUpdate()}))),this.subscribe(this.ligInputStream.pipe(f.debounceTime(1e3/24)),(function(t){return e.handleLigInputStream(t)})),this.subscribe(this.carbInputStream.pipe(f.debounceTime(1e3/24)),(function(t){return e.handleCarbInputStream(t)}))},t.prototype.categoriseGroups=function(){var e={nonLigGroups:[],ligGroups:[],carbGroups:[]},t=this.plugin.managers.structure.hierarchy.currentComponentGroups,r=this.plugin.customState;t.forEach((function(t){var n=!1;if(r.initParams&&r.initParams.superpositionParams&&r.initParams.superpositionParams.ligandView&&(n=!0),n){var i=(a=t[0].key.split(","))[0].split("-");if(-1===a.indexOf("superposition-focus-surr-sel")){if(i[i.length-1]!==r.superpositionState.activeSegment-1+"")return;a.indexOf("superposition-ligand-sel")>=0?e.ligGroups.push(t):a.indexOf("superposition-carb-sel")>=0?e.carbGroups.push(t):e.nonLigGroups.push(t)}else e.nonLigGroups.push(t)}else{var a;((a=t[0].key.split(",")).indexOf("superposition-focus-surr-sel")>=0||a.indexOf("Chain-"+(r.superpositionState.activeSegment-1))>=0)&&e.nonLigGroups.push(t)}})),this.setState({componentGroups:e,ligGroups:e.ligGroups,carbGroups:e.carbGroups,ligSearchText:"",carbSearchText:""})},t.prototype.render=function(){var e=this,t=i.createElement("div",{className:"msp-mapped-parameter-group",style:{fontSize:"90%"}},i.createElement("div",{className:"msp-control-row msp-transform-header-brand-gray",style:{height:"33px"}},i.createElement("span",{className:"msp-control-row-label"},"Search Ligand"),i.createElement("div",{className:"msp-control-row-ctrl"},i.createElement("input",{type:"text",placeholder:"Enter HET code",disabled:this.state.isBusy,onChange:function(t){return e.ligInputStream.next(t.target.value)},value:this.state.ligSearchText,maxLength:3}))),i.createElement(c.IconButton,{svg:l.CloseSvg,flex:!0,onClick:this.clearLigSearch,style:{flex:"0 0 24px",padding:0},disabled:""===this.state.ligSearchText||this.state.isBusy,toggleState:""!==this.state.ligSearchText,title:"Clear search input"})),r=i.createElement("div",{className:"msp-mapped-parameter-group",style:{fontSize:"90%"}},i.createElement("div",{className:"msp-control-row msp-transform-header-brand-gray",style:{height:"33px"}},i.createElement("span",{className:"msp-control-row-label"},"Search Carbohydrate"),i.createElement("div",{className:"msp-control-row-ctrl"},i.createElement("input",{type:"text",placeholder:"Enter HET code",disabled:this.state.isBusy,onChange:function(t){return e.carbInputStream.next(t.target.value)},value:this.state.carbSearchText,maxLength:3}))),i.createElement(c.IconButton,{svg:l.CloseSvg,flex:!0,onClick:this.clearCarbSearch,style:{flex:"0 0 24px",padding:0},disabled:""===this.state.carbSearchText||this.state.isBusy,toggleState:""!==this.state.carbSearchText,title:"Clear search input"})),n=this.sectionHeader("ligands"),a=this.sectionHeader("carbohydrates");return i.createElement(i.Fragment,null,this.state.componentGroups.nonLigGroups.length>0&&i.createElement("div",null,this.state.componentGroups.nonLigGroups.map((function(e){return i.createElement(g,{key:e[0].cell.transform.ref,group:e,boldHeader:!0})}))),this.state.componentGroups.ligGroups.length>0&&n,!this.state.isLigCollapsed&&this.state.componentGroups.ligGroups.length>5&&t,this.state.componentGroups.ligGroups.length>0&&i.createElement("div",{className:"msp-control-offset",style:{maxHeight:"800px",overflowY:"auto"}},!this.state.isLigCollapsed&&this.state.ligGroups.map((function(e){return i.createElement(g,{key:e[0].cell.transform.ref,group:e,boldHeader:!1})}))),this.state.componentGroups.carbGroups.length>0&&a,!this.state.isCarbCollapsed&&this.state.componentGroups.carbGroups.length>5&&r,this.state.componentGroups.carbGroups.length>0&&i.createElement("div",{className:"msp-control-offset",style:{maxHeight:"800px",overflowY:"auto"}},!this.state.isCarbCollapsed&&this.state.carbGroups.map((function(e){return i.createElement(g,{key:e[0].cell.transform.ref,group:e,boldHeader:!1})}))))},t}(u.PurePluginUIComponent),g=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={action:void 0,isHidden:!1,isBusy:!1},t.checkAllHidden=function(){return n.__awaiter(t,void 0,void 0,(function(){var e,t,r;return n.__generator(this,(function(n){for(e=!0,t=0,r=this.props.group;t<r.length;t++)if(!r[t].cell.state.isHidden){e=!1;break}return e&&this.setState({isHidden:!0}),[2]}))}))},t.toggleVisible=function(e){e.preventDefault(),e.currentTarget.blur(),t.plugin.managers.structure.component.toggleVisibility(t.props.group),t.setState({isHidden:!t.state.isHidden})},t.toggleAction=function(){return t.setState({action:"action"===t.state.action?void 0:"action"})},t.highlight=function(e){e.preventDefault(),t.props.group[0].cell.parent&&a.PluginCommands.Interactivity.Object.Highlight(t.plugin,{state:t.props.group[0].cell.parent,ref:t.props.group.map((function(e){return e.cell.transform.ref}))})},t.clearHighlight=function(e){e.preventDefault(),a.PluginCommands.Interactivity.ClearHighlights(t.plugin)},t.focus=function(){for(var e=!0,r=0,n=t.props.group;r<n.length;r++){if(!n[r].cell.state.isHidden){e=!1;break}}e&&t.plugin.managers.structure.hierarchy.toggleVisibility(t.props.group,"show"),t.plugin.managers.camera.focusSpheres(t.props.group,(function(e){var t;if(!e.cell.state.isHidden)return null===(t=e.cell.obj)||void 0===t?void 0:t.data.boundary.sphere}))},t}return n.__extends(t,e),Object.defineProperty(t.prototype,"pivot",{get:function(){return this.props.group[0]},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.checkAllHidden(),this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){var r,n;(null===(r=e.pivot.cell.obj)||void 0===r?void 0:r.label)===(null===(n=t.cell.obj)||void 0===n?void 0:n.label)&&(t.cell.state.isHidden?e.checkAllHidden():e.setState({isHidden:!1}))})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})})),this.subscribe(this.plugin.customState.events.isBusy,(function(t){e.setState({isBusy:t})}))},t.prototype.render=function(){var e,t=this,r=this.pivot,n=null===(e=r.cell.obj)||void 0===e?void 0:e.label,a=this.props.boldHeader?i.createElement("strong",null,n):n;return i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-flex-row"},i.createElement(c.Button,{noOverflow:!0,className:"msp-control-button-label",title:n+" - Click to focus.",onClick:this.focus,style:{textAlign:"left"},disabled:this.state.isBusy},a),i.createElement(c.IconButton,{disabled:this.state.isBusy,svg:this.state.isHidden?l.VisibilityOffOutlinedSvg:l.VisibilityOutlinedSvg,toggleState:!1,onClick:this.toggleVisible,title:(this.state.isHidden?"Show":"Hide")+" component",small:!0,className:"msp-form-control",flex:!0}),i.createElement(c.IconButton,{disabled:this.state.isBusy,svg:l.MoreHorizSvg,onClick:this.toggleAction,title:"Actions",toggleState:"action"===this.state.action,className:"msp-form-control",flex:!0})),"action"===this.state.action&&i.createElement("div",{className:"msp-accent-offset"},i.createElement("div",{style:{marginBottom:"6px"}},r.representations.map((function(e){return i.createElement(v,{group:t.props.group,key:e.cell.transform.ref,representation:e})})))))},t}(u.PurePluginUIComponent),v=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isBusy:!1,clusterVal:{cluster:"All"}},t.remove=function(){return t.plugin.managers.structure.component.removeRepresentations(t.props.group,t.props.representation)},t.toggleVisible=function(e){e.preventDefault(),e.currentTarget.blur(),t.plugin.managers.structure.component.toggleVisibility(t.props.group,t.props.representation)},t.update=function(e){return t.updateRepresentations(t.props.group,t.props.representation,e)},t.selectCluster=function(e){t.setState({clusterVal:{cluster:e.cluster}})},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){o.State.ObjectEvent.isCell(t,e.props.representation.cell)&&e.forceUpdate()})),this.subscribe(this.plugin.behaviors.state.isBusy,(function(t){e.setState({isBusy:t})})),this.subscribe(this.plugin.customState.events.isBusy,(function(t){e.setState({isBusy:t})}))},t.prototype.updateRepresentations=function(e,t,r){var n,i,a;if(0===e.length)return Promise.resolve();var o=e[0].representations.indexOf(t);if(o<0)return Promise.resolve();var s=this.plugin.customState.superpositionState,u=[];if("All"!==this.state.clusterVal.cluster&&0===(u=s.segmentData[s.activeSegment-1].clusters[parseInt(this.state.clusterVal.cluster)-1].map((function(e){return e.pdb_id+"_"+e.struct_asym_id}))).length)return;for(var c=this.plugin.state.data.build(),l=0,d=e;l<d.length;l++){var f=d[l].representations[o];if(f&&f.cell.transform.transformer===t.cell.transform.transformer){if("All"!==this.state.clusterVal.cluster)if(-1===u.indexOf(s.refMaps[f.cell.transform.parent]))continue;var p={type:r.type?r.type:null===(n=f.cell.params)||void 0===n?void 0:n.values.type,colorTheme:r.colorTheme?r.colorTheme:null===(i=f.cell.params)||void 0===i?void 0:i.values.colorTheme,sizeTheme:r.sizeTheme?r.sizeTheme:null===(a=f.cell.params)||void 0===a?void 0:a.values.sizeTheme};c.to(f.cell).update(p)}}return c.commit({canUndo:"Update Representation"})},t.prototype.render=function(){var e,t,r,n,a,o,u=this.props.representation.cell,c=this.plugin.customState.superpositionState,l=[["All","All"]];c.segmentData[c.activeSegment-1].clusters.forEach((function(e,t){l.push([t+1+"",t+1+""])}));var f={cluster:s.ParamDefinition.Select("All",l,{label:"Select Cluster"})},p=!1;if(u&&u.obj){var m=u.obj;m.tags&&m.tags.indexOf("superposition-focus-surr-repr")>=0&&(p=!0)}return i.createElement("div",{className:"msp-representation-entry"},u.parent&&i.createElement("div",null,l.length>2&&!p&&i.createElement("div",{className:"msp-representation-entry"},i.createElement(d.ParameterControls,{params:f,values:this.state.clusterVal,onChangeValues:this.selectCluster,isDisabled:this.state.isBusy})),i.createElement("div",{className:"msp-representation-entry"},i.createElement(d.ParameterControls,{params:{type:null===(e=u.params)||void 0===e?void 0:e.definition.type},values:{type:null===(t=u.params)||void 0===t?void 0:t.values.type},onChangeValues:this.update,isDisabled:this.state.isBusy})),i.createElement("div",{className:"msp-representation-entry"},i.createElement(d.ParameterControls,{params:{colorTheme:null===(r=u.params)||void 0===r?void 0:r.definition.colorTheme},values:{colorTheme:null===(n=u.params)||void 0===n?void 0:n.values.colorTheme},onChangeValues:this.update,isDisabled:this.state.isBusy})),i.createElement("div",{className:"msp-representation-entry"},i.createElement(d.ParameterControls,{params:{sizeTheme:null===(a=u.params)||void 0===a?void 0:a.definition.sizeTheme},values:{sizeTheme:null===(o=u.params)||void 0===o?void 0:o.values.sizeTheme},onChangeValues:this.update,isDisabled:this.state.isBusy}))))},t}(u.PurePluginUIComponent)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PDBeViewportControls=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(78),o=r(18),s=r(213),u=r(438),c=r(403),l=r(329),d=r(15),f=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.isBlack=function(e){if(e&&e.initParams&&e.initParams.bgColor){var t=e.initParams.bgColor;if(0===t.r&&0===t.g&&0===t.b)return!0}return!1},t.prototype.render=function(){var e=this.plugin.customState,t=!1;e&&e.initParams&&e.initParams.moleculeId&&e.initParams.pdbeLink&&(t=!0),e&&e.initParams&&e.initParams.superposition&&(t=!1);var r={parentStyle:{width:"auto"},containerStyle:{position:"absolute",right:"10px",top:"10px"},style:{display:"inline-block",fontSize:"14px",color:this.isBlack(e)?"#fff":"#555",borderBottom:"none",cursor:"pointer",textDecoration:"none"},pdbeImg:{src:"https://www.ebi.ac.uk/pdbe/entry/static/images/logos/PDBe/logo_T_64.png",alt:"PDBe logo",style:{height:"12px",width:"12px",border:0,position:"absolute",margin:"4px 0 0 -13px"}}};return i.createElement(i.Fragment,null,t&&i.createElement("div",{style:r.containerStyle},i.createElement("a",{className:"msp-pdbe-link",style:r.style,target:"_blank",href:"https://pdbe.org/"+e.initParams.moleculeId},i.createElement("img",{src:r.pdbeImg.src,alt:r.pdbeImg.alt,style:r.pdbeImg.style}),e.initParams.moleculeId)),i.createElement("div",{className:"msp-viewport-controls",onMouseMove:this.onMouseMove,style:t?{marginTop:"22px"}:void 0},i.createElement("div",{className:"msp-viewport-controls-buttons"},i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),this.icon(d.AutorenewSvg,this.resetCamera,"Reset Camera")),i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),this.icon(d.CameraOutlinedSvg,this.toggleScreenshotExpanded,"Screenshot / State Snapshot",this.state.isScreenshotExpanded)),i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),this.icon(d.BuildOutlinedSvg,this.toggleControls,"Toggle Controls Panel",this.plugin.layout.state.showControls),this.plugin.config.get(a.PluginConfig.Viewport.ShowExpand)&&this.icon(d.FullscreenSvg,this.toggleExpanded,"Toggle Expanded Viewport",this.plugin.layout.state.isExpanded),this.icon(d.TuneSvg,this.toggleSettingsExpanded,"Settings / Controls Info",this.state.isSettingsExpanded)),this.plugin.config.get(a.PluginConfig.Viewport.ShowSelectionMode)&&i.createElement("div",null,i.createElement("div",{className:"msp-semi-transparent-background"}),i.createElement(s.ToggleSelectionModeButton,null))),this.state.isScreenshotExpanded&&i.createElement("div",{className:"msp-viewport-controls-panel"},i.createElement(o.ControlGroup,{header:"Screenshot / State",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleScreenshotExpanded,topRightIcon:d.CloseSvg,noTopMargin:!0,childrenClassName:"msp-viewport-controls-panel-controls"},i.createElement(u.DownloadScreenshotControls,{close:this.toggleScreenshotExpanded}))),this.state.isSettingsExpanded&&i.createElement("div",{className:"msp-viewport-controls-panel"},i.createElement(o.ControlGroup,{header:"Settings / Controls Info",title:"Click to close.",initialExpanded:!0,hideExpander:!0,hideOffset:!0,onHeaderClick:this.toggleSettingsExpanded,topRightIcon:d.CloseSvg,noTopMargin:!0,childrenClassName:"msp-viewport-controls-panel-controls"},i.createElement(c.SimpleSettingsControl,null)))))},t}(l.ViewportControls);t.PDBeViewportControls=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DownloadScreenshotControls=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(73),o=r(33),s=r(279),u=r(156),c=r(18),l=r(27),d=r(15),f=function(e){function t(){var t,r,a,o=e.apply(this,arguments)||this;return o.state={showPreview:!0,isDisabled:!1,resolution:null===(t=o.plugin.helpers.viewportScreenshot)||void 0===t?void 0:t.params.resolution,transparent:null===(r=o.plugin.helpers.viewportScreenshot)||void 0===r?void 0:r.params.transparent,axes:null===(a=o.plugin.helpers.viewportScreenshot)||void 0===a?void 0:a.params.axes},o.imgRef=i.createRef(),o.updateQueue=new u.Subject,o.preview=function(){return n.__awaiter(o,void 0,void 0,(function(){var e;return n.__generator(this,(function(t){switch(t.label){case 0:return this.imgRef.current?(e=this.imgRef.current,[4,this.plugin.helpers.viewportScreenshot.getImageDataUri()]):[2];case 1:return e.src=t.sent(),[2]}}))}))},o.download=function(){var e;null===(e=o.plugin.helpers.viewportScreenshot)||void 0===e||e.download(),o.props.close()},o.openTab=function(){for(var e=o.imgRef.current.src,t=atob(e.substr("data:image/png;base64,".length)),r=[],n=Math.min(t.length,1048576),i=0;i<t.length;i+=n){for(var a=new Uint8Array(Math.min(n,t.length-i)),s=0,u=a.length;s<u;s++)a[s]=t.charCodeAt(i+s);r.push(a)}var c=new Blob(r,{type:"image/png"}),l=URL.createObjectURL(c);window.open(l,"_blank"),o.props.close()},o.setProps=function(e){"resolution"===e.name?(o.plugin.helpers.viewportScreenshot.params.resolution=e.value,o.setState({resolution:e.value})):"transparent"===e.name?(o.plugin.helpers.viewportScreenshot.params.transparent=e.value,o.setState({transparent:e.value})):"axes"===e.name&&(o.plugin.helpers.viewportScreenshot.params.axes=e.value,o.setState({axes:e.value}))},o.downloadToFileJson=function(){l.PluginCommands.State.Snapshots.DownloadToFile(o.plugin,{type:"json"})},o.downloadToFileZip=function(){l.PluginCommands.State.Snapshots.DownloadToFile(o.plugin,{type:"zip"})},o.open=function(e){e.target.files&&e.target.files[0]&&l.PluginCommands.State.Snapshots.OpenFile(o.plugin,{file:e.target.files[0]})},o}return n.__extends(t,e),t.prototype.handlePreview=function(){this.state.showPreview&&this.preview()},t.prototype.componentDidUpdate=function(){this.updateQueue.next()},t.prototype.componentDidMount=function(){var e=this;this.plugin.canvas3d&&(this.subscribe(s.debounceTime(250)(this.updateQueue),(function(){return e.handlePreview()})),this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){var t;e.plugin.helpers.viewportScreenshot.imagePass.setProps({multiSample:{mode:"on",sampleLevel:2},postprocessing:null===(t=e.plugin.canvas3d)||void 0===t?void 0:t.props.postprocessing}),e.updateQueue.next()})),this.subscribe(s.debounceTime(250)(this.plugin.canvas3d.didDraw),(function(){e.state.isDisabled||e.updateQueue.next()})),this.subscribe(this.plugin.state.data.behaviors.isUpdating,(function(t){e.setState({isDisabled:t}),t||e.updateQueue.next()})),this.handlePreview())},t.prototype.render=function(){return i.createElement("div",null,i.createElement("div",{className:"msp-image-preview"},i.createElement("img",{ref:this.imgRef}),i.createElement("br",null),i.createElement("span",null,"Right-click the image to Copy.")),i.createElement("div",{className:"msp-flex-row"},i.createElement(c.Button,{icon:d.GetAppSvg,onClick:this.download,disabled:this.state.isDisabled},"Download"),i.createElement(c.Button,{icon:d.LaunchSvg,onClick:this.openTab,disabled:this.state.isDisabled},"Open in new Tab")),i.createElement(a.ParameterControls,{params:this.plugin.helpers.viewportScreenshot.params,values:this.plugin.helpers.viewportScreenshot.values,onChange:this.setProps,isDisabled:this.state.isDisabled}))},t}(o.PluginUIComponent);t.DownloadScreenshotControls=f},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.subscribeToComponentEvents=void 0,t.subscribeToComponentEvents=function(e){document.addEventListener("PDB.interactions.click",(function(t){if(void 0!==t.detail){var r=t.detail.interacting_nodes?{data:t.detail.interacting_nodes}:{data:[t.detail.selected_node]};r.data[0].focus=!0,e.visual.select(r)}})),document.addEventListener("PDB.interactions.mouseover",(function(t){if(void 0!==t.detail){var r=t.detail.interacting_nodes?{data:t.detail.interacting_nodes}:{data:[t.detail.selected_node]};e.visual.highlight(r)}})),document.addEventListener("PDB.interactions.mouseout",(function(t){e.visual.clearHighlight()})),document.addEventListener("PDB.topologyViewer.click",(function(t){if(void 0!==t.eventData){var r={entity_id:t.eventData.entityId,struct_asym_id:t.eventData.structAsymId,start_residue_number:t.eventData.residueNumber,end_residue_number:t.eventData.residueNumber,sideChain:!0,focus:!0};e.visual.select({data:[r]})}})),document.addEventListener("PDB.topologyViewer.mouseover",(function(t){if(void 0!==t.eventData){var r={entity_id:t.eventData.entityId,struct_asym_id:t.eventData.structAsymId,start_residue_number:t.eventData.residueNumber,end_residue_number:t.eventData.residueNumber};e.visual.highlight({data:[r]})}})),document.addEventListener("PDB.topologyViewer.mouseout",(function(t){e.visual.clearHighlight()})),document.addEventListener("protvista-mouseover",(function(t){if(void 0!==t.detail){var r=void 0;t.detail.start&&t.detail.end&&(r={start_residue_number:parseInt(t.detail.start),end_residue_number:parseInt(t.detail.end)}),t.detail.feature&&t.detail.feature.entityId&&(r.entity_id=t.detail.feature.entityId+""),t.detail.feature&&t.detail.feature.bestChainId&&(r.struct_asym_id=t.detail.feature.bestChainId),r&&e.visual.highlight({data:[r]})}})),document.addEventListener("protvista-mouseout",(function(t){e.visual.clearHighlight()})),document.addEventListener("protvista-click",(function(t){if(void 0!==t.detail){var r=!1,n=void 0;if(t.detail.start&&t.detail.end&&(n={start_residue_number:parseInt(t.detail.start),end_residue_number:parseInt(t.detail.end)}),t.detail.feature&&t.detail.feature.entityId&&(n.entity_id=t.detail.feature.entityId+""),t.detail.feature&&t.detail.feature.bestChainId&&(n.struct_asym_id=t.detail.feature.bestChainId),(t.detail.feature&&t.detail.feature.accession&&"Chain"===t.detail.feature.accession.split(" ")[0]||"Ligand binding site"===t.detail.feature.tooltipContent)&&(r=!0),t.detail.start===t.detail.end&&(r=!0),n){if(r)n.sideChain=!0;else{var i=void 0;if(t.detail.trackIndex>-1&&t.detail.feature.locations&&t.detail.feature.locations[0].fragments[t.detail.trackIndex].color&&(i=t.detail.feature.locations[0].fragments[t.detail.trackIndex].color),void 0===i&&t.detail.feature.color&&(i=t.detail.feature.color),void 0===i&&t.detail.color&&(i=t.detail.color),void 0===i)i={r:65,g:96,b:91};else{if(/rgb/g.test(i)){var a=i.substring(4,i.length-1).split(",");i={r:a[0],g:a[1],b:a[2]}}}n.color=i}n.focus=!0,e.visual.select({data:[n]})}}}));var t=["uniprot","pfam","cath","scop","strand","helice"],r=["chain","quality","quality_outlier","binding site","alternate conformer"];document.addEventListener("PDB.seqViewer.click",(function(n){if(void 0!==n.eventData)if(void 0!==n.eventData.elementData&&r.indexOf(n.eventData.elementData.elementType)>-1){var i={entity_id:n.eventData.entityId,struct_asym_id:n.eventData.elementData.pathData.struct_asym_id,start_residue_number:n.eventData.residueNumber,end_residue_number:n.eventData.residueNumber,sideChain:!0,focus:!0};e.visual.select({data:[i]})}else if(void 0!==n.eventData.elementData&&t.indexOf(n.eventData.elementData.elementType)>-1){var a=n.eventData.elementData.color;i={entity_id:n.eventData.entityId,struct_asym_id:n.eventData.elementData.pathData.struct_asym_id,start_residue_number:n.eventData.elementData.pathData.start.residue_number,end_residue_number:n.eventData.elementData.pathData.end.residue_number,color:{r:a[0],g:a[1],b:a[2]},focus:!0};e.visual.select({data:[i]})}})),document.addEventListener("PDB.seqViewer.mouseover",(function(n){if(void 0!==n.eventData)if(void 0!==n.eventData.elementData&&r.indexOf(n.eventData.elementData.elementType)>-1){var i={entity_id:n.eventData.entityId,struct_asym_id:n.eventData.elementData.pathData.struct_asym_id,start_residue_number:n.eventData.residueNumber,end_residue_number:n.eventData.residueNumber,focus:!0};e.visual.select({data:[i]})}else if(void 0!==n.eventData.elementData&&t.indexOf(n.eventData.elementData.elementType)>-1){i={entity_id:n.eventData.entityId,struct_asym_id:n.eventData.elementData.pathData.struct_asym_id,start_residue_number:n.eventData.elementData.pathData.start.residue_number,end_residue_number:n.eventData.elementData.pathData.end.residue_number};e.visual.highlight({data:[i]})}})),document.addEventListener("PDB.seqViewer.mouseout",(function(t){e.visual.clearHighlight()}))}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LeftPanelControls=t.WavesIconSvg=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(146),o=r(27),s=r(13),u=r(33),c=r(18),l=r(73),d=r(399),f=r(292),p=r(386),m=r(195),h=r(441),g=r(15),v=r(195),b=i.createElement("svg",{width:"24px",height:"24px",viewBox:"0 0 24 24"},i.createElement("path",{d:"M17 16.99c-1.35 0-2.2.42-2.95.8-.65.33-1.18.6-2.05.6-.9 0-1.4-.25-2.05-.6-.75-.38-1.57-.8-2.95-.8s-2.2.42-2.95.8c-.65.33-1.17.6-2.05.6v1.95c1.35 0 2.2-.42 2.95-.8.65-.33 1.17-.6 2.05-.6s1.4.25 2.05.6c.75.38 1.57.8 2.95.8s2.2-.42 2.95-.8c.65-.33 1.18-.6 2.05-.6.9 0 1.4.25 2.05.6.75.38 1.58.8 2.95.8v-1.95c-.9 0-1.4-.25-2.05-.6-.75-.38-1.6-.8-2.95-.8zm0-4.45c-1.35 0-2.2.43-2.95.8-.65.32-1.18.6-2.05.6-.9 0-1.4-.25-2.05-.6-.75-.38-1.57-.8-2.95-.8s-2.2.43-2.95.8c-.65.32-1.17.6-2.05.6v1.95c1.35 0 2.2-.43 2.95-.8.65-.35 1.15-.6 2.05-.6s1.4.25 2.05.6c.75.38 1.57.8 2.95.8s2.2-.43 2.95-.8c.65-.35 1.15-.6 2.05-.6s1.4.25 2.05.6c.75.38 1.58.8 2.95.8v-1.95c-.9 0-1.4-.25-2.05-.6-.75-.38-1.6-.8-2.95-.8zm2.95-8.08c-.75-.38-1.58-.8-2.95-.8s-2.2.42-2.95.8c-.65.32-1.18.6-2.05.6-.9 0-1.4-.25-2.05-.6-.75-.37-1.57-.8-2.95-.8s-2.2.42-2.95.8c-.65.33-1.17.6-2.05.6v1.93c1.35 0 2.2-.43 2.95-.8.65-.33 1.17-.6 2.05-.6s1.4.25 2.05.6c.75.38 1.57.8 2.95.8s2.2-.43 2.95-.8c.65-.32 1.18-.6 2.05-.6.9 0 1.4.25 2.05.6.75.38 1.58.8 2.95.8V5.04c-.9 0-1.4-.25-2.05-.58zM17 8.09c-1.35 0-2.2.43-2.95.8-.65.35-1.15.6-2.05.6s-1.4-.25-2.05-.6c-.75-.38-1.57-.8-2.95-.8s-2.2.43-2.95.8c-.65.35-1.15.6-2.05.6v1.95c1.35 0 2.2-.43 2.95-.8.65-.32 1.18-.6 2.05-.6s1.4.25 2.05.6c.75.38 1.57.8 2.95.8s2.2-.43 2.95-.8c.65-.32 1.18-.6 2.05-.6.9 0 1.4.25 2.05.6.75.38 1.58.8 2.95.8V9.49c-.9 0-1.4-.25-2.05-.6-.75-.38-1.6-.8-2.95-.8z"}));function y(){return b}t.WavesIconSvg=y;var _=function(e){function t(){var t,r=e.apply(this,arguments)||this;return r.state={tab:r.plugin.behaviors.layout.leftPanelTabName.value},r.set=function(e){if(r.state.tab===e)return r.setState({tab:"none"},(function(){return r.plugin.behaviors.layout.leftPanelTabName.next("none")})),void o.PluginCommands.Layout.Update(r.plugin,{state:{regionState:n.__assign(n.__assign({},r.plugin.layout.state.regionState),{left:"collapsed"})}});r.setState({tab:e},(function(){return r.plugin.behaviors.layout.leftPanelTabName.next(e)})),"full"!==r.plugin.layout.state.regionState.left&&o.PluginCommands.Layout.Update(r.plugin,{state:{regionState:n.__assign(n.__assign({},r.plugin.layout.state.regionState),{left:"full"})}})},r.tabs={none:i.createElement(i.Fragment,null),root:i.createElement(i.Fragment,null,i.createElement(c.SectionHeader,{icon:g.HomeOutlinedSvg,title:"Home"}),i.createElement(d.StateObjectActions,{state:r.plugin.state.data,nodeRef:s.StateTransform.RootRef,hideHeader:!0,initiallyCollapsed:!0,alwaysExpandFirst:!0}),"none"!==(null===(t=r.plugin.spec.components)||void 0===t?void 0:t.remoteState)&&i.createElement(f.RemoteStateSnapshots,{listOnly:!0})),data:i.createElement(i.Fragment,null,i.createElement(c.SectionHeader,{icon:g.AccountTreeOutlinedSvg,title:i.createElement(i.Fragment,null,i.createElement(x,null)," State Tree")}),i.createElement(p.StateTree,{state:r.plugin.state.data})),segments:i.createElement(i.Fragment,null,i.createElement(h.SegmentTree,null)),states:i.createElement(f.StateSnapshots,null),settings:i.createElement(i.Fragment,null,i.createElement(c.SectionHeader,{icon:g.TuneSvg,title:"Plugin Settings"}),i.createElement(S,null)),help:i.createElement(i.Fragment,null,i.createElement(c.SectionHeader,{icon:g.HelpOutlineSvg,title:"Help"}),i.createElement(m.HelpContent,null),i.createElement(w,null))},r}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.behaviors.layout.leftPanelTabName,(function(t){e.state.tab!==t&&e.setState({tab:t}),"none"===t&&"collapsed"!==e.plugin.layout.state.regionState.left&&o.PluginCommands.Layout.Update(e.plugin,{state:{regionState:n.__assign(n.__assign({},e.plugin.layout.state.regionState),{left:"collapsed"})}})})),this.subscribe(this.plugin.state.data.events.changed,(function(t){var r=t.state;"data"===e.state.tab&&1===r.cells.size&&e.set("root")}))},t.prototype.render=function(){var e=this,t=this.state.tab,r=this.plugin.customState;return i.createElement("div",{className:"msp-left-panel-controls"},i.createElement("div",{className:"msp-left-panel-controls-buttons"},i.createElement(c.IconButton,{svg:g.HelpOutlineSvg,toggleState:"help"===t,transparent:!0,onClick:function(){return e.set("help")},title:"Help"}),r&&r.initParams&&r.initParams.superposition&&i.createElement(c.IconButton,{svg:y,toggleState:"segments"===t,transparent:!0,onClick:function(){return e.set("segments")},title:"Superpose segments"}),i.createElement("div",{className:"msp-left-panel-controls-buttons-bottom"},i.createElement(c.IconButton,{svg:g.TuneSvg,toggleState:"settings"===t,transparent:!0,onClick:function(){return e.set("settings")},title:"Settings"}))),i.createElement("div",{className:"msp-scrollable-container"},this.tabs[t]))},t}(u.PluginUIComponent);t.LeftPanelControls=_;var S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.setSettings=function(e){var r;o.PluginCommands.Canvas3D.SetSettings(t.plugin,{settings:(r={},r[e.name]=e.value,r)})},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.layout.events.updated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.canvas3d.camera.stateChanged,(function(t){void 0===t.radiusMax&&void 0===t.radius||e.forceUpdate()}))},t.prototype.render=function(){return i.createElement(i.Fragment,null,this.plugin.canvas3d&&i.createElement(i.Fragment,null,i.createElement(c.SectionHeader,{title:"Viewport"}),i.createElement(l.ParameterControls,{params:a.Canvas3DParams,values:this.plugin.canvas3d.props,onChange:this.setSettings})))},t}(u.PluginUIComponent),x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.remove=function(e){e.preventDefault(),o.PluginCommands.State.RemoveObject(t.plugin,{state:t.plugin.state.data,ref:s.StateTransform.RootRef})},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.created,(function(t){t.cell.transform.parent===s.StateTransform.RootRef&&e.forceUpdate()})),this.subscribe(this.plugin.state.events.cell.removed,(function(t){t.parent===s.StateTransform.RootRef&&e.forceUpdate()}))},t.prototype.render=function(){return 0===this.plugin.state.data.tree.children.get(s.StateTransform.RootRef).size?null:i.createElement(c.IconButton,{svg:g.DeleteOutlinedSvg,onClick:this.remove,title:"Remove All",style:{display:"inline-block"},small:!0,className:"msp-no-hover-outline",transparent:!0})},t}(u.PluginUIComponent);function O(e){return i.createElement("div",{className:"msp-simple-help-section"},e.header)}var w=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()}))},t.prototype.render=function(){return i.createElement("div",null,i.createElement(O,{header:"Superposition"}),i.createElement(v.HelpGroup,{header:"Segment"},i.createElement(v.HelpText,null,i.createElement("p",null,"Discrete UniProt sequence range mapped to the structure"))),i.createElement(v.HelpGroup,{header:"Cluster"},i.createElement(v.HelpText,null,i.createElement("p",null,"Structural chains that possess significantly close superposition Q-score"))),i.createElement(v.HelpGroup,{header:"Representative chain"},i.createElement(v.HelpText,null,i.createElement("p",null,"The best-ranked chain within a cluster chosen based on the model quality, resolution, observed residues ratio and UniProt sequence coverage"))))},t}(u.PluginUIComponent)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SegmentTree=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(279),o=r(27),s=r(13),u=r(33),c=r(18),l=r(2),d=r(73),f=r(13),p=r(412),m=r(189),h=r(15),g=r(100),v=r(24),b=r(10),y=r(156),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.getSegmentParams=function(){var e=t.customState;if(e.superpositionState&&e.superpositionState.segmentData){var r=e.superpositionState.segmentData.map((function(e,t){var r=t+1+" ( "+e.segment_start+" - "+e.segment_end+" )";return[r,r]})),n={segment:l.ParamDefinition.Select("",r,{label:"Select Segment",description:"Select segment to view its clusters below"})},i=e.superpositionState.activeSegment-1;t.setState({segment:{params:n,value:{segment:r[i][0]}}}),t.setState({isBusy:!1})}},t.updateSegment=function(e){return n.__awaiter(t,void 0,void 0,(function(){var t,r,i=this;return n.__generator(this,(function(a){return this.state.segment?((t=this.customState).events.isBusy.next(!0),this.hideStructures(t.superpositionState.activeSegment-1),(r=n.__assign({},this.state.segment)).value=e,this.setState({segment:r}),setTimeout((function(){return n.__awaiter(i,void 0,void 0,(function(){var r;return n.__generator(this,(function(n){switch(n.label){case 0:return r=parseInt(e.segment.split(" ")[0]),t.superpositionState.activeSegment=r,[4,this.displayStructures(t.superpositionState.activeSegment-1)];case 1:return n.sent(),t.events.isBusy.next(!1),this.plugin.customState.events.segmentUpdate.next(!0),[2]}}))}))}),100),[2,!1]):[2]}))}))},t.hideStructures=function(e){t.plugin.managers.interactivity.lociSelects.deselectAll(),t.plugin.managers.structure.focus.clear();var r=t.plugin.managers.structure.measurement.state,n=void 0;["labels","distances","angles","dihedrals"].forEach((function(e){n||r[e][0]&&(n=t.plugin.state.data.cells.get(r[e][0].transform.parent))})),n&&o.PluginCommands.State.RemoveObject(t.plugin,{state:n.parent,ref:n.transform.parent,removeParentGhosts:!0});var i=t.customState;i.superpositionState.visibleRefs[e]=[];for(var a=0,s=i.superpositionState.loadedStructs[e];a<s.length;a++){var u=s[a],c=t.customState.superpositionState.models[u];if(c){var l=t.plugin.managers.structure.hierarchy.current.refs.get(c);if(l&&l.components)for(var d=0,f=l.components;d<f.length;d++){var p=f[d];p&&p.cell&&!p.cell.state.isHidden&&(i.superpositionState.visibleRefs[e].push(p.cell.transform.ref),o.PluginCommands.State.ToggleVisibility(t.plugin,{state:p.cell.parent,ref:p.cell.transform.ref}))}}}},t.displayStructures=function(e){return n.__awaiter(t,void 0,void 0,(function(){var t,r,i,a,s,u,c=this;return n.__generator(this,(function(n){switch(n.label){case 0:return 0!==(t=this.customState).superpositionState.visibleRefs[e].length?[3,3]:(r=[],t.superpositionState.segmentData[e].clusters.forEach((function(e){var n=[e[0]];t.initParams.superpositionParams&&t.initParams.superpositionParams.superposeAll&&(n=e),n.forEach((function(e){var n=e.pdb_id+"_"+e.struct_asym_id,i=t.superpositionState.models[n];if(i){var a=c.plugin.state.data.cells.get(i);!!a.state.isHidden&&o.PluginCommands.State.ToggleVisibility(c.plugin,{state:a.parent,ref:i})}else r.push(e)}))})),o.PluginCommands.Camera.Reset(this.plugin),r.length>0?[4,p.renderSuperposition(this.plugin,e,r)]:[3,2]);case 1:n.sent(),n.label=2;case 2:return[3,4];case 3:for(i=0,a=t.superpositionState.visibleRefs[e];i<a.length;i++)s=a[i],(u=this.plugin.state.data.cells.get(s))&&u.state.isHidden&&o.PluginCommands.State.ToggleVisibility(this.plugin,{state:u.parent,ref:s});o.PluginCommands.Camera.Reset(this.plugin),n.label=4;case 4:return[2]}}))}))},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.customState.events.superpositionInit,(function(){var t=e.customState;t&&!t.superpositionError&&e.getSegmentParams(),e.forceUpdate()})),this.subscribe(this.plugin.customState.events.isBusy,(function(t){e.setState({isBusy:t}),t?o.PluginCommands.Toast.Show(e.plugin,{title:"Process",message:"Loading / computing large dataset!",key:"is-busy-toast"}):o.PluginCommands.Toast.Hide(e.plugin,{key:"is-busy-toast"})})),this.subscribe(this.plugin.behaviors.layout.leftPanelTabName,(function(t){"segments"===t&&(e.getSegmentParams(),e.forceUpdate())}))},Object.defineProperty(t.prototype,"customState",{get:function(){return this.plugin.customState},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=i.createElement(c.SectionHeader,{title:"Structure clusters"}),t=this.customState;if(t&&t.initParams&&!t.initParams.superposition)return i.createElement(i.Fragment,null,e,i.createElement("div",null,"Functionality unavailable!"));if(t&&t.initParams&&t.initParams.superposition){if(e=i.createElement(c.SectionHeader,{title:"Structure clusters - "+t.initParams.moleculeId}),t.superpositionError)return i.createElement(i.Fragment,null,e,i.createElement("div",{style:{textAlign:"center"}},t.superpositionError));if(!t.superpositionState||!t.superpositionState.segmentData)return i.createElement(i.Fragment,null,e,i.createElement("div",{style:{textAlign:"center"}},"Loading Segment Data!"))}if(this.state){var r=parseInt(this.state.segment.value.segment.split(" ")[0])-1,n=t.superpositionState.segmentData,a="( "+n[0].segment_start+" - "+n[n.length-1].segment_end+" )";return e=i.createElement(c.SectionHeader,{title:"Structure clusters "+t.initParams.moleculeId,desc:a}),i.createElement(i.Fragment,null,e,i.createElement(d.ParameterControls,{params:this.state.segment.params,values:this.state.segment.value,onChangeValues:this.updateSegment,isDisabled:this.state.isBusy}),n[r].clusters.map((function(e,t){return i.createElement(S,{cluster:e,totalClusters:n[r].clusters.length,segmentIndex:r,clusterIndex:t,key:"cluster-"+r+"-"+t})})))}return i.createElement(i.Fragment,null)},t}(u.PurePluginUIComponent);t.SegmentTree=_;var S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={isCollapsed:!1,showAll:!1,showNone:!1,showSearch:!1,isBusy:!1,cluster:t.props.cluster,searchText:""},t.inputStream=new y.Subject,t.handleInputStream=function(e){t.setState({searchText:e});var r=t.props.cluster.filter((function(t){return t.pdb_id.toLowerCase().indexOf(e.toLowerCase())>=0}));t.setState({cluster:r})},t.toggleExpanded=function(e){e.preventDefault(),t.setState({isCollapsed:!t.state.isCollapsed}),e.currentTarget.blur()},t.selectAll=function(e){e.preventDefault(),t.setState({showAll:!t.state.showAll,showNone:!1}),e.currentTarget.blur()},t.selectNone=function(e){e.preventDefault(),t.setState({showAll:!1,showNone:!t.state.showNone}),e.currentTarget.blur()},t.applyAction=function(e){return n.__awaiter(t,void 0,void 0,(function(){var t,r,i=this;return n.__generator(this,(function(a){return e.preventDefault(),e.currentTarget.blur(),(t=this.customState).events.isBusy.next(!0),r=n.__assign({},this.state),this.setState({showAll:!1,showNone:!1}),setTimeout((function(){return n.__awaiter(i,void 0,void 0,(function(){var e,i,a,s,u,c,l,d,f,m,h;return n.__generator(this,(function(g){switch(g.label){case 0:e=[],g.label=1;case 1:g.trys.push([1,9,10,15]),i=n.__asyncValues(this.state.cluster),g.label=2;case 2:return[4,i.next()];case 3:return(a=g.sent()).done?[3,8]:(s=a.value,u=s.pdb_id+"_"+s.struct_asym_id,c=void 0,t&&t.superpositionState&&t.superpositionState.models[u]&&(c=this.customState.superpositionState.models[u]),c?(l=this.plugin.state.data.cells.get(c))&&((d=!!l.state.isHidden)&&r.showAll||!d&&r.showNone)?[4,o.PluginCommands.State.ToggleVisibility(this.plugin,{state:l.parent,ref:c})]:[3,5]:[3,6]);case 4:g.sent(),g.label=5;case 5:return[3,7];case 6:r.showAll&&e.push(s),g.label=7;case 7:return[3,2];case 8:return[3,15];case 9:return f=g.sent(),m={error:f},[3,15];case 10:return g.trys.push([10,,13,14]),a&&!a.done&&(h=i.return)?[4,h.call(i)]:[3,12];case 11:g.sent(),g.label=12;case 12:return[3,14];case 13:if(m)throw m.error;return[7];case 14:return[7];case 15:return o.PluginCommands.Camera.Reset(this.plugin),e.length>0?[4,p.renderSuperposition(this.plugin,this.props.segmentIndex,e)]:[3,17];case 16:g.sent(),g.label=17;case 17:return t.events.isBusy.next(!1),[2]}}))}))})),[2]}))}))},t.cancelAction=function(e){e.preventDefault(),t.setState({showAll:!1,showNone:!1}),e.currentTarget.blur()},t.clearSearch=function(e){e.preventDefault(),t.setState({searchText:""}),t.inputStream.next(""),e.currentTarget.blur()},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.customState.events.isBusy,(function(t){e.setState({isBusy:t,showAll:!1,showNone:!1})})),this.subscribe(this.inputStream.pipe(a.debounceTime(1e3/24)),(function(t){return e.handleInputStream(t)}))},Object.defineProperty(t.prototype,"customState",{get:function(){return this.plugin.customState},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this,t=this.customState;if(!t.superpositionState||!t.superpositionState.segmentData)return i.createElement(i.Fragment,null);var r=i.createElement(c.IconButton,{svg:this.state.isCollapsed?h.ArrowRightSvg:h.ArrowDropDownSvg,flex:"20px",onClick:this.toggleExpanded,transparent:!0,disabled:this.state.isBusy,className:"msp-no-hover-outline"}),n="Segment "+t.superpositionState.activeSegment+" Cluster "+(this.props.clusterIndex+1),a=i.createElement(c.Button,{className:"msp-btn-tree-label",noOverflow:!0,title:n,disabled:this.state.isBusy},i.createElement("span",null,"Cluster ",this.props.clusterIndex+1)," ",i.createElement("small",null,this.state.cluster.length<this.props.cluster.length?this.state.cluster.length+" / ":"",this.props.cluster.length," chain",this.props.cluster.length>1?"s":"")),o=i.createElement(i.Fragment,null,i.createElement(c.Button,{icon:h.CheckSvg,flex:!0,onClick:this.selectAll,style:{flex:"0 0 50px",textAlign:"center",fontSize:"80%",color:"#9cacc3",padding:0},disabled:this.state.isBusy,title:"Show all chains"},"All"),i.createElement(c.Button,{icon:h.CloseSvg,flex:!0,onClick:this.selectNone,style:{flex:"0 0 50px",textAlign:"center",fontSize:"80%",color:"#9cacc3",padding:0},disabled:this.state.isBusy,title:"Hide all chains"},"None")),s=i.createElement("div",{className:"msp-flex-row msp-tree-row",style:{marginTop:"10px"}},r,a,this.props.cluster.length>1&&o),u=i.createElement("div",{className:"msp-mapped-parameter-group",style:{fontSize:"90%"}},i.createElement("div",{className:"msp-control-row msp-transform-header-brand-gray",style:{height:"33px",marginLeft:"30px"}},i.createElement("span",{className:"msp-control-row-label"},"Search PDB ID"),i.createElement("div",{className:"msp-control-row-ctrl"},i.createElement("input",{type:"text",placeholder:"Enter PDB ID..",disabled:this.state.isBusy,onChange:function(t){return e.inputStream.next(t.target.value)},value:this.state.searchText,maxLength:4}))),i.createElement(c.IconButton,{svg:h.CloseSvg,flex:!0,onClick:this.clearSearch,style:{flex:"0 0 24px",padding:0},disabled:this.state.isBusy||""===this.state.searchText,toggleState:""!==this.state.searchText,title:"Clear search input"}));return i.createElement(i.Fragment,null,s,(this.state.showAll||this.state.showNone)&&i.createElement("div",null,i.createElement("div",{className:"msp-control-row msp-transform-header-brand-"+(this.state.showAll?"green":"red"),style:{display:"flex",marginLeft:"20px",height:"35px"}},i.createElement("span",{className:"msp-control-row-label",style:{flex:"1 1 auto",textAlign:"left",fontSize:"85%"}},this.state.showAll?"Display":"Hide"," ",this.state.cluster.length<this.props.cluster.length?this.state.cluster.length+" / ":"all ",this.props.cluster.length," chains"),i.createElement(c.Button,{icon:h.CheckSvg,flex:!0,onClick:this.applyAction,style:{flex:"0 0 60px",textAlign:"center",fontSize:"78%",color:"#9cacc3",padding:0,margin:"0 1px"},title:"Apply action"},"Apply"),i.createElement(c.Button,{icon:h.CloseSvg,flex:!0,onClick:this.cancelAction,style:{flex:"0 0 60px",textAlign:"center",fontSize:"78%",color:"#9cacc3",padding:0,margin:"0 1px"},title:"Cancel action"},"Cancel"))),!this.state.isCollapsed&&this.props.cluster.length>5&&u,!this.state.isCollapsed&&i.createElement("div",{className:"msp-tree-updates-wrapper",style:{maxHeight:this.props.totalClusters>1?"330px":"87%",overflowY:"auto"}},this.state.cluster.map((function(t,r){return i.createElement(x,{segmentIndex:e.props.segmentIndex,structure:t,isRep:0===r,key:"str-"+t.pdb_id+t.struct_asym_id+r})}))))},t}(u.PluginUIComponent),x=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={showControls:!1,isBusy:!1,isProcessing:!1,isHidden:!0},t.toggleVisible=function(e){return n.__awaiter(t,void 0,void 0,(function(){var t,r,i,a;return n.__generator(this,(function(n){switch(n.label){case 0:if(e.preventDefault(),e.currentTarget.blur(),this.setState({isProcessing:!0,showControls:!1}),!this.ref)return[3,1];if((t=this.plugin.managers.structure.hierarchy.current.refs.get(this.ref))&&t.components){for(r=0,i=t.components;r<i.length;r++)a=i[r],!!a.cell.state.isHidden===this.state.isHidden&&o.PluginCommands.State.ToggleVisibility(this.plugin,{state:a.cell.parent,ref:a.cell.transform.ref});this.setState({isHidden:!this.state.isHidden})}return[3,3];case 1:return[4,p.renderSuperposition(this.plugin,this.props.segmentIndex,[this.props.structure])];case 2:n.sent(),n.label=3;case 3:return this.setState({isProcessing:!1}),o.PluginCommands.Camera.Reset(this.plugin),[2]}}))}))},t.selectAction=function(e){e&&(t.setState({showControls:!1}),(null==e?void 0:e.value)())},t.highlight=function(e){if(e.preventDefault(),t.ref){var r=t.plugin.state.data.cells.get(t.ref);o.PluginCommands.Interactivity.Object.Highlight(t.plugin,{state:r.parent,ref:t.ref})}e.currentTarget.blur()},t.clearHighlight=function(e){e.preventDefault(),o.PluginCommands.Interactivity.ClearHighlights(t.plugin),e.currentTarget.blur()},t.toggleControls=function(e){e.preventDefault(),t.setState({showControls:!t.state.showControls}),e.currentTarget.blur()},t}return n.__extends(t,e),Object.defineProperty(t.prototype,"customState",{get:function(){return this.plugin.customState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ref",{get:function(){return this.customState&&this.customState.superpositionState&&this.customState.superpositionState.models[this.props.structure.pdb_id+"_"+this.props.structure.struct_asym_id]?this.customState.superpositionState.models[this.props.structure.pdb_id+"_"+this.props.structure.struct_asym_id]:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"modelCell",{get:function(){return this.ref?this.plugin.state.data.cells.get(this.ref):void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isAllHidden",{get:function(){var e=!0;if(this.ref){var t=this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);if(t&&t.components)for(var r=0,n=t.components;r<n.length;r++){var i=n[r];if(i&&i.cell&&!i.cell.state.isHidden){e=!1;break}}else e=!1}return e},enumerable:!1,configurable:!0}),t.prototype.checkRelation=function(e){var t=!1,r=this.plugin.state.data.cells.get(e);if(r&&r.transform.parent)if(r&&r.transform.parent===this.ref)t=!0;else{var n=this.plugin.state.data.cells.get(r.transform.parent);n&&n.transform.parent===this.ref&&(t=!0)}else{var i=this.plugin.state.data.cells.get(this.ref);i&&i.transform.parent===r.transform.parent&&(t=!0)}return t},t.prototype.is=function(e){if(!this.ref)return!1;var t=!1;return this.ref&&e.ref!==this.ref&&(t=this.checkRelation(e.ref)),!(e.ref!==this.ref&&!t)||!!(this.customState.superpositionState.invalidStruct.indexOf(this.props.structure.pdb_id+"_"+this.props.structure.struct_asym_id)>-1)},t.prototype.componentDidMount=function(){var e=this;this.setState({isHidden:this.isAllHidden}),this.subscribe(this.plugin.customState.events.isBusy,(function(t){e.setState({isBusy:t,showControls:!1})})),this.subscribe(this.plugin.state.events.cell.stateUpdated.pipe(a.filter((function(t){return e.is(t)})),a.debounceTime(33)),(function(t){e.setState({isHidden:e.isAllHidden})}))},t.prototype.getTagRefs=function(e){var t=new Set(e),r=this.plugin.state.data.tree;return f.StateSelection.findUniqueTagsInSubtree(r,this.modelCell.transform.ref,t)},t.prototype.getRandomColor=function(){var e=g.ColorLists,t=this.plugin.customState.superpositionState,r=t.colorState[this.props.segmentIndex].palleteIndex,n=t.colorState[this.props.segmentIndex].colorIndex;e[t.colorPalette[r]].list[n+1]?n+=1:(n=0,r=t.colorPalette[r+1]?r+1:0);var i=t.colorPalette[r];return this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].palleteIndex=r,this.plugin.customState.superpositionState.colorState[this.props.segmentIndex].colorIndex=n,e[i].list[n]},t.prototype.addChainRepr=function(){return n.__awaiter(this,void 0,void 0,(function(){var e,t,r,i;return n.__generator(this,(function(n){switch(n.label){case 0:return e=this.getRandomColor(),t=this.plugin.state.data.select(this.ref)[0],r=b.MolScriptBuilder.struct.generator.atomGroups({"chain-test":b.MolScriptBuilder.core.rel.eq([b.MolScriptBuilder.struct.atomProperty.macromolecular.label_asym_id(),this.props.structure.struct_asym_id])}),[4,this.plugin.builders.structure.tryCreateComponentFromExpression(t,r,"Chain-"+this.props.segmentIndex,{label:"Chain",tags:["superposition-sel"]})];case 1:return(i=n.sent())?[4,this.plugin.builders.structure.representation.addRepresentation(i,{type:"cartoon",color:"uniform",colorParams:{value:e}},{tag:"superposition-visual"})]:[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},t.prototype.updates=function(){var e=this,t=this.plugin.managers.structure.hierarchy.current.refs.get(this.ref);if(t&&t.components){var r=[],n=!0;t.components.forEach((function(e){"Chain"===e.key.split(",")[0].split("-")[2]&&(n=!1),e.representations&&e.representations.forEach((function(e){r.push(e)}))}));var a=this.plugin.customState;if(a.initParams&&a.initParams.superpositionParams&&!a.initParams.superpositionParams.ligandView&&(n=!1),r.length>0)return i.createElement("div",{className:"msp-accent-offset",style:{marginLeft:"40px"}},r.length>0&&r.map((function(e,r){return i.createElement(O,{group:[t],key:e.cell.transform.ref+"-"+r,representation:e})})),n&&i.createElement("div",{className:"msp-control-group-header",style:{marginTop:"1px"}},i.createElement(c.Button,{noOverflow:!0,className:"msp-control-button-label",title:"Click to add chain representaion",onClick:function(){return e.addChainRepr()}},"  Add Chain ",this.props.structure.struct_asym_id," Representation")))}return i.createElement(i.Fragment,null)},t.prototype.getSubtitle=function(){var e,t=this.plugin.customState.superpositionState.hets[this.props.structure.pdb_id+"_"+this.props.structure.struct_asym_id];if(t){var r=this.props.structure.is_representative?1:4,n=t.length,i=t.join(", ");n>r&&(i=t.slice(0,r).join(", "),i+=" + "+(n-r)),e=" ( "+i+" )",this.props.structure.is_representative&&(e=" "+e+" ( Representative )")}else this.props.structure.is_representative&&(e=" ( Representative )");return e},Object.defineProperty(t.prototype,"panelColor",{get:function(){var e="#808080";if(!this.state.isHidden&&this.modelCell){var t=this.getTagRefs(["superposition-visual","superposition-ligand-visual"]),r=t["superposition-ligand-visual"]?t["superposition-ligand-visual"]:t["superposition-visual"]?t["superposition-visual"]:void 0;if(r){var n=this.plugin.state.data.cells.get(r);if(n.params&&n.params.values&&n.params.values.colorTheme){var i=n.params.values.colorTheme;if(i.params&&i.params.value)e=""+v.Color.toStyle(i.params.value);else if(i.params&&i.params.palette){var a=i.params.palette.params.list.colors;e=""+v.Color.toStyle(a[0])}else if(i.params&&i.params.list){var o=i.params.list.colors;e=""+v.Color.toStyle(o[0])}}}}return e},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e=this.customState.initParams.superpositionParams,t=this.props.structure.pdb_id+"_"+this.props.structure.struct_asym_id,r=this.customState.superpositionState.invalidStruct.indexOf(t)>-1,n=this.customState.superpositionState.noMatrixStruct.indexOf(t)>-1,a=r?n?" Matrix not available!":" No Ligand found!":this.getSubtitle(),o=this.props.structure.pdb_id+" chain "+this.props.structure.auth_asym_id;e&&e.ligandView&&(o=this.props.structure.pdb_id+" "+this.props.structure.struct_asym_id);var s=i.createElement(c.Button,{className:"msp-btn-tree-label",style:{borderLeftColor:this.panelColor},noOverflow:!0,title:o,disabled:!!(r||this.state.isBusy||this.state.isProcessing),onMouseEnter:this.highlight,onMouseLeave:this.clearHighlight},i.createElement("span",null,o),a&&i.createElement("small",null,a)),u=i.createElement(c.IconButton,{svg:this.state.showControls?h.ArrowDropDownSvg:h.ArrowRightSvg,flex:"20px",onClick:this.toggleControls,transparent:!0,className:"msp-no-hover-outline",disabled:!!(r||this.state.isBusy||this.state.isProcessing)}),l=i.createElement(c.IconButton,{svg:this.state.isHidden?h.VisibilityOffOutlinedSvg:h.VisibilityOutlinedSvg,toggleState:!1,small:!0,onClick:this.toggleVisible,disabled:!!(r||this.state.isBusy||this.state.isProcessing),title:this.state.isHidden?"Show chain":"Hide chain"}),d=i.createElement("div",{className:"msp-flex-row msp-tree-row",style:{marginLeft:this.state.isHidden?"31px":"10px"}},!this.state.isHidden&&u,s,l);return i.createElement("div",{style:{marginBottom:"1px"}},d,this.state.showControls&&this.updates())},t}(u.PluginUIComponent),O=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.toggleVisible=function(e){e.preventDefault(),e.currentTarget.blur();var r=t.props.representation.cell;o.PluginCommands.State.ToggleVisibility(t.plugin,{state:r.parent,ref:r.transform.parent})},t}return n.__extends(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.stateUpdated,(function(t){s.State.ObjectEvent.isCell(t,e.props.representation.cell)&&e.forceUpdate()}))},t.prototype.render=function(){var e,t,r,n,a,o,s,u=this.props.representation.cell,l=null===(e=u.obj)||void 0===e?void 0:e.label;if((null===(t=u.obj)||void 0===t?void 0:t.data.source)&&(null===(r=u.obj)||void 0===r?void 0:r.data.source.label)){var d=(null===(n=u.obj)||void 0===n?void 0:n.data.source.label.indexOf("[Focus]"))>=0?"[Focus]":null===(a=u.obj)||void 0===a?void 0:a.data.source.label,f=d.length>10;d=""+(f?d.substring(0,28)+"...":d),l=f?d:d+" "+(l&&l.length<21?" - "+l:"")}return(null===(o=u.obj)||void 0===o?void 0:o.data.source)&&"Custom Selection"===(null===(s=u.obj)||void 0===s?void 0:s.data.source.label)&&(l="Custom Selection"),i.createElement("div",{className:"msp-representation-entry"},u.parent&&i.createElement(c.ExpandGroup,{header:""+(l||"Representation"),noOffset:!0,headerStyle:{overflow:"hidden"}},i.createElement(m.UpdateTransformControl,{state:u.parent,transform:u.transform,customHeader:"none",noMargin:!0})),i.createElement(c.IconButton,{svg:this.props.representation.cell.state.isHidden?h.VisibilityOffOutlinedSvg:h.VisibilityOutlinedSvg,toggleState:!1,onClick:this.toggleVisible,title:this.props.representation.cell.state.isHidden?"Show representation":"Hide representation",small:!0,className:"msp-default-bg",style:{position:"absolute",top:0,right:0,lineHeight:"24px",height:"24px",textAlign:"right",width:"32px",paddingRight:"6px",background:"none"}}))},t}(u.PurePluginUIComponent)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CustomEvents=void 0;var n=r(413);!function(e){function t(e,t,r){void 0!==t&&(t.residueNumber=t.seq_id,e.eventData=t,e.eventData.residueNumber=t.seq_id,r.dispatchEvent(e))}e.add=function(e,r){var i=function(e){for(var t={},r=0,n=e.length;r<n;r++){var i=e[r],a=void 0;"function"==typeof MouseEvent?a=new MouseEvent(i,{view:window,bubbles:!0,cancelable:!0}):"function"==typeof document.createEvent&&(a=document.createEvent("MouseEvents")).initEvent(i,!0,!0),t[i]=a}return t}(["PDB.molstar.click","PDB.molstar.mouseover","PDB.molstar.mouseout"]);e.behaviors.interaction.click.subscribe((function(e){if(1===e.button&&e.current&&"empty-loci"!==e.current.loci.kind){var a=n.lociDetails(e.current.loci);a&&t(i["PDB.molstar.click"],a,r)}})),e.behaviors.interaction.hover.subscribe((function(e){if(e.current&&e.current.loci&&"empty-loci"!==e.current.loci.kind){var a=n.lociDetails(e.current.loci);a&&t(i["PDB.molstar.mouseover"],a,r)}e.current&&e.current.loci&&"empty-loci"===e.current.loci.kind&&t(i["PDB.molstar.mouseout"],{},r)}))}}(t.CustomEvents||(t.CustomEvents={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SuperpositionFocusRepresentation=t.SuperpositionFocusRepresentationTags=void 0;var n,i=r(0),a=r(4),o=r(167),s=r(31),u=r(177),c=r(10),l=r(13),d=r(2),f=r(27),p=r(413);!function(e){e.SurrSel="superposition-focus-surr-sel",e.SurrRepr="superposition-focus-surr-repr"}(n=t.SuperpositionFocusRepresentationTags||(t.SuperpositionFocusRepresentationTags={}));var m=new Set([n.SurrSel,n.SurrRepr]),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return i.__extends(t,e),Object.defineProperty(t.prototype,"surrLabel",{get:function(){return"[Focus] Surroundings ("+this.params.expandRadius+" Å)"},enumerable:!1,configurable:!0}),t.prototype.ensureShape=function(e){var t=this.plugin.state.data,r=t.tree,i=t.build(),a=l.StateSelection.findUniqueTagsInSubtree(r,e.transform.ref,m);return a[n.SurrSel]||(a[n.SurrSel]=i.to(e).apply(s.StateTransforms.Model.StructureSelectionFromExpression,{expression:c.MolScriptBuilder.struct.generator.empty(),label:this.surrLabel},{tags:n.SurrSel}).ref),a[n.SurrRepr]||(a[n.SurrRepr]=i.to(a[n.SurrSel]).apply(s.StateTransforms.Representation.StructureRepresentation3D,this.params.surroundingsParams,{tags:n.SurrRepr}).ref),{state:t,builder:i,refs:a}},t.prototype.clear=function(e){var t=this.plugin.state.data,r=t.select(l.StateSelection.Generators.byRef(e).subtree().withTag(n.SurrSel));if(0!==r.length){for(var a=t.build(),o=c.MolScriptBuilder.struct.generator.empty(),u=0,d=r;u<d.length;u++){var p=d[u];a.to(p).update(s.StateTransforms.Model.StructureSelectionFromExpression,(function(e){return i.__assign(i.__assign({},e),{expression:o})}))}return f.PluginCommands.State.Update(this.plugin,{state:t,tree:a,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})}},t.prototype.focus=function(e){return i.__awaiter(this,void 0,void 0,(function(){var t,r,o,u,l,d,m,h,g,v,b=this;return i.__generator(this,(function(y){switch(y.label){case 0:return(t=this.plugin.helpers.substructureParent.get(e.structure))&&t.obj?(r=a.StructureElement.Loci.remap(e,t.obj.data),o=a.StructureElement.Loci.extendToWholeResidues(r),u=a.StructureElement.Bundle.fromLoci(o),l=a.StructureElement.Bundle.toExpression(u),d=c.MolScriptBuilder.struct.modifier.includeSurroundings({0:l,radius:this.params.expandRadius,"as-whole-residues":!0}),p.lociDetails(e)||(d=c.MolScriptBuilder.struct.modifier.exceptBy({0:d,by:l})),m=this.ensureShape(t),h=m.state,g=m.builder,v=m.refs,g.to(v[n.SurrSel]).update(s.StateTransforms.Model.StructureSelectionFromExpression,(function(e){return i.__assign(i.__assign({},e),{expression:d,label:b.surrLabel})})),[4,f.PluginCommands.State.Update(this.plugin,{state:h,tree:g,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})]):[2];case 1:return y.sent(),[2]}}))}))},t.prototype.register=function(e){var t=this;this.subscribeObservable(this.plugin.managers.structure.focus.behaviors.current,(function(e){t.clear(l.StateTransform.RootRef),e&&t.focus(e.loci)}))},t.prototype.update=function(e){return i.__awaiter(this,void 0,void 0,(function(){var t,r,a,o,s,u,c;return i.__generator(this,(function(i){switch(i.label){case 0:for(t=this.params,this.params=e,r=this.plugin.state.data,a=r.build(),o=l.StateSelection.Generators.root.subtree(),s=0,u=r.select(o.withTag(n.SurrRepr));s<u.length;s++)c=u[s],a.to(c).update(this.params.surroundingsParams);return[4,f.PluginCommands.State.Update(this.plugin,{state:r,tree:a,options:{doNotLogTiming:!0,doNotUpdateCurrent:!0}})];case 1:return i.sent(),e.expandRadius===t.expandRadius?[3,3]:[4,this.clear(l.StateTransform.RootRef)];case 2:i.sent(),i.label=3;case 3:return[2,!0]}}))}))},t}(u.PluginBehavior.WithSubscribers);t.SuperpositionFocusRepresentation=u.PluginBehavior.create({name:"create-superposition-focus-representation",display:{name:"Superposition Focus Representation"},category:"interaction",ctor:h,params:function(e,t){return function(e){var t=s.StateTransforms.Representation.StructureRepresentation3D.definition.params(void 0,e);return{expandRadius:d.ParamDefinition.Numeric(5,{min:1,max:10,step:1}),surroundingsParams:d.ParamDefinition.Group(t,{label:"Surroundings",customDefault:o.createStructureRepresentationParams(e,void 0,{type:"ball-and-stick",size:"physical",typeParams:{sizeFactor:.16},sizeParams:{scale:.3}})})}}(t)}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SuperpostionViewport=void 0;var n=r(0),i=n.__importStar(r(3)),a=r(33),o=r(278),s=r(387),u=r(401),c=r(329),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n.__extends(t,e),t.prototype.render=function(){var e,t,r=(null===(t=null===(e=this.plugin.spec.components)||void 0===e?void 0:e.viewport)||void 0===t?void 0:t.controls)||c.ViewportControls;return i.createElement(i.Fragment,null,i.createElement(c.Viewport,null),i.createElement("div",{className:"msp-viewport-top-left-controls"},i.createElement(o.StateSnapshotViewportControls,null)),i.createElement(o.SelectionViewportControls,null),i.createElement(r,null),i.createElement(s.BackgroundTaskProgress,null),i.createElement("div",{className:"msp-highlight-toast-wrapper"},i.createElement(o.LociLabels,null),i.createElement(u.Toasts,null)))},t}(a.PluginUIComponent);t.SuperpostionViewport=l},function(e,t,r){},function(e,t,r){"use strict";r.r(t),r.d(t,"PluginContext",(function(){return Lc}));var n,i,a,o=r(0),s=r(158),u=r(102),c=r(247),l=r(146),d=r(2);i=n||(n={}),a=function(){function e(){this.providers=Object(u.OrderedMap)().asMutable(),this.defaultAutoAttachValues=new Map}return e.prototype.getParams=function(e){var t={},r=[],n=[];if(e)for(var i=this.providers.values();;){var a=i.next();if(a.done)break;var s=a.value;s.isApplicable(e)&&(s.isHidden||(r.push([s.descriptor.name,s.label]),this.defaultAutoAttachValues.get(s.descriptor.name)&&n.push(s.descriptor.name)),t[s.descriptor.name]=d.ParamDefinition.Group(Object(o.__assign)({},s.getParams(e)),{label:s.label,isHidden:s.isHidden}))}return{autoAttach:d.ParamDefinition.MultiSelect(n,r),properties:d.ParamDefinition.Group(t,{isFlat:!0})}},e.prototype.setDefaultAutoAttach=function(e,t){this.defaultAutoAttachValues.set(e,t)},e.prototype.get=function(e){if(!this.providers.get(e))throw new Error("Custom property '"+e+"' is not registered.");return this.providers.get(e)},e.prototype.register=function(e,t){this.providers.set(e.descriptor.name,e),this.defaultAutoAttachValues.set(e.descriptor.name,t)},e.prototype.unregister=function(e){this.providers.delete(e),this.defaultAutoAttachValues.delete(e)},e}(),i.Registry=a;var f=r(296),p=["gz","zip"],m=["bcif","ccp4","dcd"];var h=function(){function e(e){this.plugin=e}return Object.defineProperty(e.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),e.prototype.rawData=function(e,t){return this.dataState.build().toRoot().apply(f.RawData,e,t).commit({revertOnError:!0})},e.prototype.download=function(e,t){return this.dataState.build().toRoot().apply(f.Download,e,t).commit({revertOnError:!0})},e.prototype.downloadBlob=function(e,t){return this.dataState.build().toRoot().apply(f.DownloadBlob,e,t).commit({revertOnError:!0})},e.prototype.readFile=function(e,t){var r;return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,i;return Object(o.__generator)(this,(function(a){switch(a.label){case 0:return[4,this.dataState.build().toRoot().apply(f.ReadFile,e,t).commit({revertOnError:!0})];case 1:return n=a.sent(),i=function(e){var t,r,n="",i=(t=e instanceof File?e.name:e instanceof Blob?"":e).lastIndexOf("?"),a=-1!==i?t.substring(i):"",o=(t=t.substring(0,-1===i?t.length:i)).replace(/^.*[\\/]/,""),s=o.substring(0,o.lastIndexOf(".")),u=o.split("."),c=u.length>1?(u.pop()||"").toLowerCase():"",l=t.match(/^(.+):\/\/(.+)$/);l&&(n=l[1].toLowerCase(),t=l[2]||"");var d=t.substring(0,t.lastIndexOf("/")+1);if(p.includes(c)){r=c;var f=t.length-c.length-1;c=(t.substr(0,f).split(".").pop()||"").toLowerCase();var h=s.length-c.length-1;s=s.substr(0,h)}else r=!1;return{path:t,name:o,ext:c,base:s,dir:d,compressed:r,binary:m.includes(c),protocol:n,query:a,src:e}}((null===(r=e.file)||void 0===r?void 0:r.file)||""),[2,{data:n,fileInfo:i}]}}))}))},e}(),g=r(13),v=r(8),b=r(31),y=r(12),_=r(17),S=r(48),x=r(87),O=r(167),w=r(206),C=r(220),j=r(29),P=r(78),E=function(){function e(e){var t=this;this.plugin=e,this._providers=[],this.providerMap=new Map,this.defaultProvider=C.a.auto,Object(x.c)(C.a,(function(e){return t.registerPreset(e)}))}return Object.defineProperty(e.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),e.prototype.resolveProvider=function(e){var t;return"string"==typeof e?null!==(t=C.a[e])&&void 0!==t?t:Object(y.c)(this._providers,(function(t){return t.id===e})):e},e.prototype.hasPreset=function(e){for(var t=0,r=this._providers;t<r.length;t++){var n=r[t];if(!n.isApplicable||n.isApplicable(e,this.plugin))return!0}return!1},Object.defineProperty(e.prototype,"providers",{get:function(){return this._providers},enumerable:!1,configurable:!0}),e.prototype.getPresets=function(e){if(!e)return this.providers;for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push(i)}return t},e.prototype.getPresetSelect=function(e){for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];e&&i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push([i.id,i.display.name,i.display.group])}return d.ParamDefinition.Select("auto",t)},e.prototype.getPresetsWithOptions=function(e){for(var t=[],r=Object.create(null),n=0,i=this._providers;n<i.length;n++){var a=i[n];a.isApplicable&&!a.isApplicable(e,this.plugin)||(t.push([a.id,a.display.name]),r[a.id]=a.params?d.ParamDefinition.Group(a.params(e,this.plugin)):d.ParamDefinition.EmptyGroup())}return 0===t.length?d.ParamDefinition.MappedStatic("",{"":d.ParamDefinition.EmptyGroup()}):d.ParamDefinition.MappedStatic(t[0][0],r,{options:t})},e.prototype.registerPreset=function(e){if(this.providerMap.has(e.id))throw new Error("Representation provider with id '"+e.id+"' already registered.");this._providers.push(e),this.providerMap.set(e.id,e)},e.prototype.unregisterPreset=function(e){this.providerMap.delete(e.id),Object(j.arrayRemoveInPlace)(this._providers,e)},e.prototype.applyPreset=function(e,t,r){var n,i=this,a=this.resolveProvider(t);if(a){var o=this.plugin.state.data,s=g.StateObjectRef.resolveAndCheck(o,e);if(s){var u=(null===(n=a.params)||void 0===n?void 0:n.call(a,s.obj,this.plugin))||{},c=r||(a.params?d.ParamDefinition.getDefaultValues(u):{}),l=this.plugin.config.get(P.PluginConfig.Structure.DefaultRepresentationPresetParams);c=d.ParamDefinition.merge(u,l,c);var f=_.b.create(""+a.display.name,(function(){return a.apply(s,c,i.plugin)}));return this.plugin.runTask(f)}S.b||console.warn("Applying structure repr. provider to bad cell.")}},e.prototype.addRepresentation=function(e,t,r){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,i;return Object(o.__generator)(this,(function(a){switch(a.label){case 0:return n=this.dataState.build(),(i=this.buildRepresentation(n,e,t,r))?[4,n.commit()]:[2];case 1:return a.sent(),[2,i]}}))}))},e.prototype.buildRepresentation=function(e,t,r,n){var i,a;if(t){var o=null===(a=null===(i=g.StateObjectRef.resolveAndCheck(this.dataState,t))||void 0===i?void 0:i.obj)||void 0===a?void 0:a.data;if(o){var s=Object(O.createStructureRepresentationParams)(this.plugin,o,r);return(null==n?void 0:n.tag)?e.to(t).applyOrUpdateTagged(n.tag,w.StructureRepresentation3D,s,{state:null==n?void 0:n.initialState}).selector:e.to(t).apply(w.StructureRepresentation3D,s,{state:null==n?void 0:n.initialState}).selector}}},e}(),A=r(4),D=r(95),T=r(9),I=r(275),M=r(1),k=r(160),B=r(257);function V(e){return e}(V||(V={})).CommonParams=function(e,t){return{modelProperties:d.ParamDefinition.Optional(d.ParamDefinition.Group(g.StateTransformer.getParamDefinition(b.StateTransforms.Model.CustomModelProperties,void 0,t))),structureProperties:d.ParamDefinition.Optional(d.ParamDefinition.Group(g.StateTransformer.getParamDefinition(b.StateTransforms.Model.CustomStructureProperties,void 0,t))),representationPreset:d.ParamDefinition.Optional(d.ParamDefinition.Text("auto"))}};var R=V.CommonParams,L=V({id:"preset-trajectory-default",display:{name:"Default (Assembly)",group:"Preset",description:"Shows the first assembly or, if that is unavailable, the first model."},isApplicable:function(e){return!0},params:function(e,t){return Object(o.__assign)({model:d.ParamDefinition.Optional(d.ParamDefinition.Group(g.StateTransformer.getParamDefinition(b.StateTransforms.Model.ModelFromTrajectory,e,t))),showUnitcell:d.ParamDefinition.Optional(d.ParamDefinition.Boolean(!1)),structure:d.ParamDefinition.Optional(I.a.getParams(void 0,"assembly").type),representationPresetParams:d.ParamDefinition.Optional(d.ParamDefinition.Group(C.b.CommonParams))},R(e,t))},apply:function(e,t,r){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,i,a,s,u,c,l,d;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return[4,(n=r.builders.structure).createModel(e,t.model)];case 1:return i=o.sent(),[4,n.insertModelProperties(i,t.modelProperties)];case 2:return a=o.sent(),[4,n.createStructure(a||i,t.structure)];case 3:return s=o.sent(),[4,n.insertStructureProperties(s,t.structureProperties)];case 4:return u=o.sent(),void 0===t.showUnitcell||t.showUnitcell?[4,n.tryCreateUnitcell(a,void 0,{isHidden:!0})]:[3,6];case 5:return l=o.sent(),[3,7];case 6:l=void 0,o.label=7;case 7:return c=l,[4,r.builders.structure.representation.applyPreset(u,t.representationPreset||"auto",t.representationPresetParams)];case 8:return d=o.sent(),[2,{model:i,modelProperties:a,unitcell:c,structure:s,structureProperties:u,representation:d}]}}))}))}}),N=V({id:"preset-trajectory-all-models",display:{name:"All Models",group:"Preset",description:"Shows all models; colored by model-index."},isApplicable:function(e){return e.data.frameCount>1},params:function(e,t){return Object(o.__assign)({useDefaultIfSingleModel:d.ParamDefinition.Optional(d.ParamDefinition.Boolean(!1)),representationPresetParams:d.ParamDefinition.Optional(d.ParamDefinition.Group(C.b.CommonParams))},R(e,t))},apply:function(e,t,r){var n,i;return Object(o.__awaiter)(this,void 0,void 0,(function(){var a,s,u,c,l,d,f,p,m,h;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:if(!(a=null===(i=null===(n=g.StateObjectRef.resolveAndCheck(r.state.data,e))||void 0===n?void 0:n.obj)||void 0===i?void 0:i.data))return[2,{}];if(1===a.frameCount&&t.useDefaultIfSingleModel)return[2,L.apply(e,t,r)];s=r.builders.structure,u=[],c=[],l=0,o.label=1;case 1:return l<a.frameCount?[4,s.createModel(e,{modelIndex:l})]:[3,8];case 2:return d=o.sent(),[4,s.insertModelProperties(d,t.modelProperties,{isCollapsed:!0})];case 3:return f=o.sent(),[4,s.createStructure(f||d,{name:"model",params:{}})];case 4:return p=o.sent(),[4,s.insertStructureProperties(p,t.structureProperties)];case 5:return m=o.sent(),u.push(d),c.push(p),h=p.obj?Object(k.c)(p.obj.data,{elementCountFactor:a.frameCount}):"medium",[4,s.representation.applyPreset(m,t.representationPreset||"auto",{theme:{globalName:"model-index"},quality:h})];case 6:o.sent(),o.label=7;case 7:return l++,[3,1];case 8:return[2,{models:u,structures:c}]}}))}))}}),F=function(e,t){return Object(o.__assign)({model:d.ParamDefinition.Optional(d.ParamDefinition.Group(g.StateTransformer.getParamDefinition(b.StateTransforms.Model.ModelFromTrajectory,e,t)))},R(e,t))};function U(e,t,r,n){return Object(o.__awaiter)(this,void 0,void 0,(function(){var i,a,s,u,c,l,d;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return[4,(i=n.builders.structure).createModel(t,r.model)];case 1:return a=o.sent(),[4,i.insertModelProperties(a,r.modelProperties)];case 2:return s=o.sent(),[4,i.createStructure(s||a,{name:"symmetry",params:e})];case 3:return u=o.sent(),[4,i.insertStructureProperties(u,r.structureProperties)];case 4:return c=o.sent(),[4,i.tryCreateUnitcell(s,void 0,{isHidden:!1})];case 5:return l=o.sent(),[4,n.builders.structure.representation.applyPreset(c,r.representationPreset||"auto",{theme:{globalName:e.theme}})];case 6:return d=o.sent(),[2,{model:a,modelProperties:s,unitcell:l,structure:u,structureProperties:c,representation:d}]}}))}))}var z,H,G=V({id:"preset-trajectory-unitcell",display:{name:"Unit Cell",group:"Preset",description:"Shows the fully populated unit cell."},isApplicable:function(e){return A.Model.hasCrystalSymmetry(e.data.representative)},params:F,apply:function(e,t,r){return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(n){switch(n.label){case 0:return[4,U({ijkMin:M.Vec3.create(0,0,0),ijkMax:M.Vec3.create(0,0,0)},e,t,r)];case 1:return[2,n.sent()]}}))}))}}),q=V({id:"preset-trajectory-supercell",display:{name:"Super Cell",group:"Preset",description:"Shows the super cell, i.e. the central unit cell and all adjacent unit cells."},isApplicable:function(e){return A.Model.hasCrystalSymmetry(e.data.representative)},params:F,apply:function(e,t,r){return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(n){switch(n.label){case 0:return[4,U({ijkMin:M.Vec3.create(-1,-1,-1),ijkMax:M.Vec3.create(1,1,1),theme:"operator-hkl"},e,t,r)];case 1:return[2,n.sent()]}}))}))}}),W=V({id:"preset-trajectory-crystal-contacts",display:{name:"Crystal Contacts",group:"Preset",description:"Showsasymetric unit and chains from neighbours within 5 Å, i.e., symmetry mates."},isApplicable:function(e){return A.Model.hasCrystalSymmetry(e.data.representative)},params:function(e,t){return Object(o.__assign)({model:d.ParamDefinition.Optional(d.ParamDefinition.Group(g.StateTransformer.getParamDefinition(b.StateTransforms.Model.ModelFromTrajectory,e,t)))},R(e,t))},apply:function(e,t,r){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,i,a,s,u,c,l;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return[4,(n=r.builders.structure).createModel(e,t.model)];case 1:return i=o.sent(),[4,n.insertModelProperties(i,t.modelProperties)];case 2:return a=o.sent(),[4,n.createStructure(a||i,{name:"symmetry-mates",params:{radius:5}})];case 3:return s=o.sent(),[4,n.insertStructureProperties(s,t.structureProperties)];case 4:return u=o.sent(),[4,n.tryCreateUnitcell(a,void 0,{isHidden:!0})];case 5:return c=o.sent(),[4,r.builders.structure.representation.applyPreset(u,t.representationPreset||"auto",{theme:{globalName:"operator-name",carbonColor:"operator-name",focus:{name:"element-symbol",params:{carbonColor:{name:"operator-name",params:B.c.defaultValues}}}}})];case 6:return l=o.sent(),[2,{model:i,modelProperties:a,unitcell:c,structure:s,structureProperties:u,representation:l}]}}))}))}}),X={default:L,"all-models":N,unitcell:G,supercell:q,crystalContacts:W},Y=function(){function e(e){var t=this;this.plugin=e,this._providers=[],this.providerMap=new Map,this.defaultProvider=X.default,Object(x.c)(X,(function(e){return t.registerPreset(e)}))}return e.prototype.resolveProvider=function(e){var t;return"string"==typeof e?null!==(t=X[e])&&void 0!==t?t:Object(y.c)(this._providers,(function(t){return t.id===e})):e},e.prototype.hasPreset=function(e){for(var t=0,r=this._providers;t<r.length;t++){var n=r[t];if(!n.isApplicable||n.isApplicable(e,this.plugin))return!0}return!1},Object.defineProperty(e.prototype,"providers",{get:function(){return this._providers},enumerable:!1,configurable:!0}),e.prototype.getPresets=function(e){if(!e)return this.providers;for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push(i)}return t},e.prototype.getPresetSelect=function(e){for(var t=[],r=0,n=this._providers;r<n.length;r++){var i=n[r];e&&i.isApplicable&&!i.isApplicable(e,this.plugin)||t.push([i.id,i.display.name])}return d.ParamDefinition.Select("auto",t)},e.prototype.getPresetsWithOptions=function(e){for(var t=[],r=Object.create(null),n=0,i=this._providers;n<i.length;n++){var a=i[n];a.isApplicable&&!a.isApplicable(e,this.plugin)||(t.push([a.id,a.display.name]),r[a.id]=a.params?d.ParamDefinition.Group(a.params(e,this.plugin)):d.ParamDefinition.EmptyGroup())}return 0===t.length?d.ParamDefinition.MappedStatic("",{"":d.ParamDefinition.EmptyGroup()}):d.ParamDefinition.MappedStatic(t[0][0],r,{options:t})},e.prototype.registerPreset=function(e){if(this.providerMap.has(e.id))throw new Error("Hierarchy provider with id '"+e.id+"' already registered.");this._providers.push(e),this.providerMap.set(e.id,e)},e.prototype.unregisterPreset=function(e){this.providerMap.delete(e.id),Object(j.arrayRemoveInPlace)(this._providers,e)},e.prototype.applyPreset=function(e,t,r){var n=this,i=this.resolveProvider(t);if(i){var a=this.plugin.state.data,o=g.StateObjectRef.resolveAndCheck(a,e);if(o){var s=r||(i.params?d.ParamDefinition.getDefaultValues(i.params(o.obj,this.plugin)):{}),u=_.b.create(""+i.display.name,(function(){return i.apply(o,s,n.plugin)}));return this.plugin.runTask(u)}S.b||console.warn("Applying hierarchy preset provider to bad cell.")}},e}(),Q=function(){function e(e){this.plugin=e,this.hierarchy=new Y(this.plugin),this.representation=new E(this.plugin)}return Object.defineProperty(e.prototype,"dataState",{get:function(){return this.plugin.state.data},enumerable:!1,configurable:!0}),e.prototype.parseTrajectoryData=function(e,t){return Object(o.__awaiter)(this,void 0,void 0,(function(){var r;return Object(o.__generator)(this,(function(n){switch(n.label){case 0:if(!(r="string"==typeof t?this.plugin.dataFormats.get(t):t))throw new Error("'"+t+"' is not a supported data format.");return[4,r.parse(this.plugin,e)];case 1:return[2,n.sent().trajectory]}}))}))},e.prototype.parseTrajectoryBlob=function(e,t){return this.dataState.build().to(e).apply(b.StateTransforms.Data.ParseBlob,t,{state:{isGhost:!0}}).apply(b.StateTransforms.Model.TrajectoryFromBlob,void 0).commit({revertOnError:!0})},e.prototype.parseTrajectory=function(e,t){var r=g.StateObjectRef.resolveAndCheck(this.dataState,e);if(!r)throw new Error("Invalid data cell.");return v.a.Data.Blob.is(r.obj)?this.parseTrajectoryBlob(e,t):this.parseTrajectoryData(e,t)},e.prototype.createModel=function(e,t,r){return this.dataState.build().to(e).apply(b.StateTransforms.Model.ModelFromTrajectory,t||{modelIndex:0},{state:r}).commit({revertOnError:!0})},e.prototype.insertModelProperties=function(e,t,r){return this.dataState.build().to(e).apply(b.StateTransforms.Model.CustomModelProperties,t,{state:r}).commit({revertOnError:!0})},e.prototype.tryCreateUnitcell=function(e,t,r){var n,i,a,o=this.dataState,s=null===(i=null===(n=g.StateObjectRef.resolveAndCheck(o,e))||void 0===n?void 0:n.obj)||void 0===i?void 0:i.data;if(s){var u=null===(a=D.a.Provider.get(s))||void 0===a?void 0:a.spacegroup.cell;if(!T.f.isZero(u))return o.build().to(e).apply(b.StateTransforms.Representation.ModelUnitcell3D,t,{state:r}).commit({revertOnError:!0})}},e.prototype.createStructure=function(e,t,r){var n,i=this.dataState;if(!t){var a=g.StateObjectRef.resolveAndCheck(i,e);if(a){var o=D.a.Provider.get(null===(n=a.obj)||void 0===n?void 0:n.data);o&&0!==(null==o?void 0:o.assemblies.length)||(t={name:"model",params:{}})}}return i.build().to(e).apply(b.StateTransforms.Model.StructureFromModel,{type:t||{name:"assembly",params:{}}},{state:r}).commit({revertOnError:!0})},e.prototype.insertStructureProperties=function(e,t){return this.dataState.build().to(e).apply(b.StateTransforms.Model.CustomStructureProperties,t).commit({revertOnError:!0})},e.prototype.isComponentTransform=function(e){return e.transform.transformer===b.StateTransforms.Model.StructureComponent},e.prototype.tryCreateComponent=function(e,t,r,n){var i,a;return Object(o.__awaiter)(this,void 0,void 0,(function(){var s,u,c,l,d;return Object(o.__generator)(this,(function(f){switch(f.label){case 0:return s=this.dataState,u=s.build().to(e),c="structure-component-"+r,[4,(l=u.applyOrUpdateTagged(c,b.StateTransforms.Model.StructureComponent,t,{tags:n?Object(o.__spreadArrays)(n,[c]):[c]})).commit()];case 1:return f.sent(),(d=l.selector).isOk&&0!==(null===(a=null===(i=d.cell)||void 0===i?void 0:i.obj)||void 0===a?void 0:a.data.elementCount)?[3,3]:[4,s.build().delete(d.ref).commit()];case 2:return f.sent(),[2];case 3:return[2,d]}}))}))},e.prototype.tryCreateComponentFromExpression=function(e,t,r,n){return this.tryCreateComponent(e,{type:{name:"expression",params:t},nullIfEmpty:!0,label:((null==n?void 0:n.label)||"").trim()},r,null==n?void 0:n.tags)},e.prototype.tryCreateComponentStatic=function(e,t,r){return this.tryCreateComponent(e,{type:{name:"static",params:t},nullIfEmpty:!0,label:((null==r?void 0:r.label)||"").trim()},"static-"+t,null==r?void 0:r.tags)},e.prototype.tryCreateComponentFromSelection=function(e,t,r,n){var i=this;return this.plugin.runTask(_.b.create("Query Component",(function(a){return Object(o.__awaiter)(i,void 0,void 0,(function(){var i,s,u,c,l,d,f,p,m,h,v,b;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return s=(i=n||{}).label,u=i.tags,s=(s||"").trim(),(c=null===(b=null===(v=g.StateObjectRef.resolveAndCheck(this.dataState,e))||void 0===v?void 0:v.obj)||void 0===b?void 0:b.data)?t.referencesCurrent?(m={},h={name:"bundle"},p=(f=A.StructureElement.Bundle).fromSelection,[4,t.getSelection(this.plugin,a,c)]):[3,2]:[2];case 1:return m.type=(h.params=p.apply(f,[o.sent()]),h),m.nullIfEmpty=!0,m.label=s||t.label,d=m,[3,3];case 2:d={type:{name:"expression",params:t.expression},nullIfEmpty:!0,label:s||t.label},o.label=3;case 3:return l=d,t.ensureCustomProperties?[4,t.ensureCustomProperties({runtime:a,assetManager:this.plugin.managers.asset},c)]:[3,5];case 4:o.sent(),o.label=5;case 5:return[2,this.tryCreateComponent(e,l,r,u)]}}))}))})))},e}(),K=r(377),Z=r(185),J=r(47),$=r(36),ee=r(295);!function(e){e.create=function(e){var t=e.name;return{descriptor:e,get:function(e){return e._propertyData[t]},set:function(r,n){r.customProperties.add(e),r._propertyData[t]=n}}}}(z||(z={})),function(e){e.Descriptor={name:"recommended_iso_value"},e.Provider=z.create(e.Descriptor)}(H||(H={}));var te=r(277),re=r(312);function ne(e,t){return Object(o.__awaiter)(this,void 0,void 0,(function(){var r,n=this;return Object(o.__generator)(this,(function(i){return t&&(r=t.entryId)&&r.toLowerCase().startsWith("emd")?[2,e.runTask(_.b.create("Try Set Recommended IsoValue",(function(i){return Object(o.__awaiter)(n,void 0,void 0,(function(){var n;return Object(o.__generator)(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,Object(te.b)(e,i,r)];case 1:return n=a.sent(),H.Provider.set(t,$.b.IsoValue.absolute(n)),[3,3];case 2:return a.sent(),[3,3];case 3:return[2]}}))}))})))]:[2]}))}))}function ie(e){var t=H.Provider.get(e);if(t){if("relative"===t.kind)return t;var r=e.grid.stats;return re.a.is(e.sourceData)&&(r={min:e.sourceData.data.volume_data_3d_info.min_source.value(0),max:e.sourceData.data.volume_data_3d_info.max_source.value(0),mean:e.sourceData.data.volume_data_3d_info.mean_source.value(0),sigma:e.sourceData.data.volume_data_3d_info.sigma_source.value(0)}),$.b.IsoValue.toRelative(t,r)}}function ae(e,t){return Object(o.__awaiter)(this,void 0,void 0,(function(){var r,n;return Object(o.__generator)(this,(function(i){switch(i.label){case 0:return r={},(n=t.volume.data&&ie(t.volume.data))&&(r.isoValue=n),[4,e.build().to(t.volume).apply(b.StateTransforms.Representation.VolumeRepresentation3D,Object(ee.a)(e,t.volume.data,{type:"isosurface",typeParams:r})).commit()];case 1:return[2,[i.sent()]]}}))}))}var oe=Object(Z.a)({label:"CCP4/MRC/MAP",description:"CCP4/MRC/MAP",category:"Volume",binaryExtensions:["ccp4","mrc","map"],parse:function(e,t,r){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var n,i;return Object(o.__generator)(this,(function(a){switch(a.label){case 0:return n=e.build().to(t).apply(b.StateTransforms.Data.ParseCcp4,{},{state:{isGhost:!0}}),i=n.apply(b.StateTransforms.Volume.VolumeFromCcp4,{entryId:null==r?void 0:r.entryId}),[4,n.commit({revertOnError:!0})];case 1:return a.sent(),[4,ne(e,i.selector.data)];case 2:return a.sent(),[2,{format:n.selector,volume:i.selector}]}}))}))},visuals:ae}),se=Object(Z.a)({label:"DSN6/BRIX",description:"DSN6/BRIX",category:"Volume",binaryExtensions:["dsn6","brix"],parse:function(e,t,r){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var n,i;return Object(o.__generator)(this,(function(a){switch(a.label){case 0:return n=e.build().to(t).apply(b.StateTransforms.Data.ParseDsn6,{},{state:{isGhost:!0}}),i=n.apply(b.StateTransforms.Volume.VolumeFromDsn6,{entryId:null==r?void 0:r.entryId}),[4,n.commit({revertOnError:!0})];case 1:return a.sent(),[4,ne(e,i.selector.data)];case 2:return a.sent(),[2,{format:n.selector,volume:i.selector}]}}))}))},visuals:ae}),ue=Object(Z.a)({label:"DX",description:"DX",category:"Volume",stringExtensions:["dx"],binaryExtensions:["dxbin"],parse:function(e,t,r){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var n,i;return Object(o.__generator)(this,(function(a){switch(a.label){case 0:return n=e.build().to(t).apply(b.StateTransforms.Data.ParseDx,{},{state:{isGhost:!0}}),[4,(i=n.apply(b.StateTransforms.Volume.VolumeFromDx,{entryId:null==r?void 0:r.entryId})).commit({revertOnError:!0})];case 1:return a.sent(),[4,ne(e,i.selector.data)];case 2:return a.sent(),[2,{volume:i.selector}]}}))}))},visuals:ae}),ce=[["ccp4",oe],["dsn6",se],["cube",Object(Z.a)({label:"Cube",description:"Cube",category:"Volume",stringExtensions:["cub","cube"],parse:function(e,t,r){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var n,i,a;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return n=e.build().to(t).apply(b.StateTransforms.Data.ParseCube,{},{state:{isGhost:!0}}),i=n.apply(b.StateTransforms.Volume.VolumeFromCube,{entryId:null==r?void 0:r.entryId}),a=n.apply(b.StateTransforms.Model.TrajectoryFromCube,void 0,{state:{isGhost:!0}}).apply(b.StateTransforms.Model.ModelFromTrajectory).apply(b.StateTransforms.Model.StructureFromModel),[4,n.commit({revertOnError:!0})];case 1:return o.sent(),[4,ne(e,i.selector.data)];case 2:return o.sent(),[2,{format:n.selector,volume:i.selector,structure:a.selector}]}}))}))},visuals:function(e,t){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var r,n,i,a,s,u,c,l,d,f;return Object(o.__generator)(this,(function(p){switch(p.label){case 0:return r=e.build(),n=[],(i=null===(f=null===(d=t.volume.cell)||void 0===d?void 0:d.obj)||void 0===f?void 0:f.data)&&$.b.isOrbitals(i)?(a=r.to(t.volume).apply(b.StateTransforms.Representation.VolumeRepresentation3D,Object(ee.a)(e,i,{type:"isosurface",typeParams:{isoValue:$.b.IsoValue.relative(1),alpha:.4},color:"uniform",colorParams:{value:J.a.blue}})),s=r.to(t.volume).apply(b.StateTransforms.Representation.VolumeRepresentation3D,Object(ee.a)(e,i,{type:"isosurface",typeParams:{isoValue:$.b.IsoValue.relative(-1),alpha:.4},color:"uniform",colorParams:{value:J.a.red}})),n.push(a.selector,s.selector)):(u=r.to(t.volume).apply(b.StateTransforms.Representation.VolumeRepresentation3D,Object(ee.a)(e,i,{type:"isosurface",typeParams:{isoValue:$.b.IsoValue.relative(2),alpha:.4},color:"uniform",colorParams:{value:J.a.grey}})),n.push(u.selector)),[4,e.builders.structure.representation.applyPreset(t.structure,"auto")];case 1:return c=p.sent(),[4,r.commit()];case 2:return p.sent(),l=[],Object(x.c)(null==c?void 0:c.representations,(function(e){e&&l.push(e)})),[2,Object(o.__spreadArrays)(n,l)]}}))}))}})],["dx",ue],["dscif",Object(Z.a)({label:"DensityServer CIF",description:"DensityServer CIF",category:"Volume",stringExtensions:["cif"],binaryExtensions:["bcif"],isApplicable:function(e,t){return"dscif"===Object(Z.b)(e,t)},parse:function(e,t,r){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var n,i,a,s,u,c,l,d,f,p;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return[4,e.build().to(t).apply(b.StateTransforms.Data.ParseCif).commit()];case 1:if(n=o.sent(),i=e.build().to(n),1!==(a=n.obj.data.blocks.slice(1)).length&&2!==a.length)throw new Error("unknown number of blocks");for(s=[],u=0,c=a;u<c.length;u++)l=c[u],s.push(i.apply(b.StateTransforms.Volume.VolumeFromDensityServerCif,{blockHeader:l.header,entryId:null==r?void 0:r.entryId}).selector);return[4,i.commit()];case 2:o.sent(),d=0,f=s,o.label=3;case 3:return d<f.length?(p=f[d],[4,ne(e,p.data)]):[3,6];case 4:o.sent(),o.label=5;case 5:return d++,[3,3];case 6:return[2,{volumes:s}]}}))}))},visuals:function(e,t){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var r,n,i,a,s,u;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return r=t.volumes,n=e.build(),i=[],r.length>0&&(a=r[0].data&&ie(r[0].data)||$.b.IsoValue.relative(1.5),i[0]=n.to(r[0]).apply(b.StateTransforms.Representation.VolumeRepresentation3D,w.VolumeRepresentation3DHelpers.getDefaultParamsStatic(e,"isosurface",{isoValue:a,alpha:1},"uniform",{value:J.a.teal})).selector),r.length>1&&(s=w.VolumeRepresentation3DHelpers.getDefaultParamsStatic(e,"isosurface",{isoValue:$.b.IsoValue.relative(3),alpha:.3},"uniform",{value:J.a.green}),u=w.VolumeRepresentation3DHelpers.getDefaultParamsStatic(e,"isosurface",{isoValue:$.b.IsoValue.relative(-3),alpha:.3},"uniform",{value:J.a.red}),i[i.length]=n.to(r[1]).apply(b.StateTransforms.Representation.VolumeRepresentation3D,s).selector,i[i.length]=n.to(r[1]).apply(b.StateTransforms.Representation.VolumeRepresentation3D,u).selector),[4,n.commit()];case 1:return o.sent(),[2,i]}}))}))}})]],le=[["ply",Object(Z.a)({label:"PLY",description:"PLY",category:"Shape",stringExtensions:["ply"],parse:function(e,t){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var r,n;return Object(o.__generator)(this,(function(i){switch(i.label){case 0:return r=e.state.data.build().to(t).apply(b.StateTransforms.Data.ParsePly,{},{state:{isGhost:!0}}),n=r.apply(b.StateTransforms.Model.ShapeFromPly),[4,r.commit()];case 1:return i.sent(),[2,{format:r.selector,shape:n.selector}]}}))}))},visuals:function(e,t){return e.state.data.build().to(t.shape).apply(b.StateTransforms.Representation.ShapeRepresentation3D).commit()}})]],de=[["psf",Object(Z.a)({label:"PSF",description:"PSF",category:"Structure",stringExtensions:["psf"],parse:function(e,t){return Object(o.__awaiter)(void 0,void 0,void 0,(function(){var r,n;return Object(o.__generator)(this,(function(i){switch(i.label){case 0:return r=e.state.data.build().to(t).apply(b.StateTransforms.Data.ParsePsf,{},{state:{isGhost:!0}}),n=r.apply(b.StateTransforms.Model.TopologyFromPsf),[4,r.commit()];case 1:return i.sent(),[2,{format:r.selector,topology:n.selector}]}}))}))}})],["dcd",Object(Z.a)({label:"DCD",description:"DCD",category:"Structure",binaryExtensions:["dcd"],parse:function(e,t){return e.state.data.build().to(t).apply(b.StateTransforms.Model.CoordinatesFromDcd).commit()}})],["xtc",Object(Z.a)({label:"XTC",description:"XTC",category:"Structure",binaryExtensions:["xtc"],parse:function(e,t){return e.state.data.build().to(t).apply(b.StateTransforms.Model.CoordinatesFromXtc).commit()}})]],fe=function(){function e(){this._list=[],this._map=new Map,this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0;for(var e=0,t=ce;e<t.length;e++){var r=t[e],n=r[0],i=r[1];this.add(n,i)}for(var a=0,o=de;a<o.length;a++){var s=o[a];n=s[0],i=s[1];this.add(n,i)}for(var u=0,c=le;u<c.length;u++){var l=c[u];n=l[0],i=l[1];this.add(n,i)}for(var d=0,f=K.a;d<f.length;d++){var p=f[d];n=p[0],i=p[1];this.add(n,i)}}return Object.defineProperty(e.prototype,"types",{get:function(){return this._list.map((function(e){return[e.name,e.provider.label]}))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"extensions",{get:function(){if(this._extensions)return this._extensions;var e=new Set;return this._list.forEach((function(t){var r,n,i=t.provider;null===(r=i.stringExtensions)||void 0===r||r.forEach((function(t){return e.add(t)})),null===(n=i.binaryExtensions)||void 0===n||n.forEach((function(t){return e.add(t)}))})),this._extensions=e,e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"binaryExtensions",{get:function(){if(this._binaryExtensions)return this._binaryExtensions;var e=new Set;return this._list.forEach((function(t){var r;return null===(r=t.provider.binaryExtensions)||void 0===r?void 0:r.forEach((function(t){return e.add(t)}))})),this._binaryExtensions=e,e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){if(this._options)return this._options;var e=[];return this._list.forEach((function(t){var r=t.name,n=t.provider;return e.push([r,n.label,n.category||""])})),this._options=e,e},enumerable:!1,configurable:!0}),e.prototype._clear=function(){this._extensions=void 0,this._binaryExtensions=void 0,this._options=void 0},e.prototype.add=function(e,t){this._clear(),this._list.push({name:e,provider:t}),this._map.set(e,t)},e.prototype.remove=function(e){this._clear(),this._list.splice(this._list.findIndex((function(t){return t.name===e})),1),this._map.delete(e)},e.prototype.auto=function(e,t){for(var r=0,n=this.list.length;r<n;++r){var i=this._list[r].provider,a=!1;if((i.binaryExtensions&&i.binaryExtensions.indexOf(e.ext)>=0||i.stringExtensions&&i.stringExtensions.indexOf(e.ext)>=0)&&(a=!0),a&&(!i.isApplicable||i.isApplicable(e,t.data)))return i}},e.prototype.get=function(e){if(this._map.has(e))return this._map.get(e);throw new Error("unknown data format name '"+e+"'")},Object.defineProperty(e.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),e}(),pe=r(89),me=r(23),he=r(128),ge={minRadius:5,extraRadius:4,durationMs:250},ve=function(){function e(e){this.plugin=e,this.boundaryHelper=new he.a("98")}return e.prototype.transformedLoci=function(e){var t,r;if(A.StructureElement.Loci.is(e)){var n=null===(r=null===(t=this.plugin.helpers.substructureParent.get(e.structure))||void 0===t?void 0:t.obj)||void 0===r?void 0:r.data;n&&(e=A.StructureElement.Loci.remap(e,n))}return e},e.prototype.focusRenderObjects=function(e,t){if(e){for(var r=[],n=0,i=e;n<i.length;n++){var a=i[n].values.boundingSphere.ref.value;0!==a.radius&&r.push(a)}this.focusSpheres(r,(function(e){return e}),t)}},e.prototype.focusLoci=function(e,t){var r;if(Array.isArray(e)&&e.length>1){for(var n=[],i=0,a=e;i<a.length;i++){var o=a[i];(c=me.Loci.getBoundingSphere(this.transformedLoci(o)))&&n.push(c)}if(0===n.length)return;this.boundaryHelper.reset();for(var s=0,u=n;s<u.length;s++){var c=u[s];this.boundaryHelper.includeSphere(c)}this.boundaryHelper.finishedIncludeStep();for(var l=0,d=n;l<d.length;l++){c=d[l];this.boundaryHelper.radiusSphere(c)}r=this.boundaryHelper.getSphere()}else if(Array.isArray(e)){if(0===e.length)return;r=me.Loci.getBoundingSphere(this.transformedLoci(e[0]))}else r=me.Loci.getBoundingSphere(this.transformedLoci(e));r&&this.focusSphere(r,t)},e.prototype.focusSpheres=function(e,t,r){for(var n=[],i=0,a=e;i<a.length;i++){(u=t(a[i]))&&n.push(u)}if(0!==n.length){if(1===n.length)return this.focusSphere(n[0],r);this.boundaryHelper.reset();for(var o=0,s=n;o<s.length;o++){var u=s[o];this.boundaryHelper.includeSphere(u)}this.boundaryHelper.finishedIncludeStep();for(var c=0,l=n;c<l.length;c++){u=l[c];this.boundaryHelper.radiusSphere(u)}this.focusSphere(this.boundaryHelper.getSphere(),r)}},e.prototype.focusSphere=function(e,t){var r,n,i,a,s=Object(o.__assign)(Object(o.__assign)({},ge),t),u=s.extraRadius,c=s.minRadius,l=s.durationMs,d=Math.max(e.radius+u,c);if(null==t?void 0:t.principalAxes){var f=null==t?void 0:t.principalAxes.boxAxes,p=f.origin,m=f.dirA,h=f.dirC,g=null===(r=this.plugin.canvas3d)||void 0===r?void 0:r.camera.getFocus(p,d,m,h);null===(n=this.plugin.canvas3d)||void 0===n||n.requestCameraReset({durationMs:l,snapshot:g})}else{g=null===(i=this.plugin.canvas3d)||void 0===i?void 0:i.camera.getFocus(e.center,d);null===(a=this.plugin.canvas3d)||void 0===a||a.requestCameraReset({durationMs:l,snapshot:g})}},e.prototype.setSnapshot=function(e,t){var r;null===(r=this.plugin.canvas3d)||void 0===r||r.requestCameraReset({snapshot:e,durationMs:t})},e.prototype.reset=function(e,t){var r;null===(r=this.plugin.canvas3d)||void 0===r||r.requestCameraReset({snapshot:e,durationMs:t})},e}(),be=r(380),ye=r(41),_e=r(51),Se=function(){function e(e){var t=this;this.ctx=e,this.providers=[],this.locis=[],this.isDirty=!1,this.labels=[],this.groupedLabels=new Map,e.managers.interactivity.lociHighlights.addProvider((function(e,r){t.mark(e,r),t.showLabels()}))}return e.prototype.clearProviders=function(){this.providers=[],this.isDirty=!0,this.showLabels()},e.prototype.addProvider=function(e){this.providers.push(e),this.providers.sort((function(e,t){return(t.priority||0)-(e.priority||0)})),this.isDirty=!0,this.showLabels()},e.prototype.removeProvider=function(e){this.providers=this.providers.filter((function(t){return t!==e})),this.isDirty=!0,this.showLabels()},e.prototype.mark=function(e,t){var r=this.locis.findIndex((function(t){return ye.a.Loci.areEqual(e,t)}));-1===r&&t===_e.a.Highlight?(this.locis.push(e),this.isDirty=!0):-1!==r&&t===_e.a.RemoveHighlight&&(Object(j.arrayRemoveAtInPlace)(this.locis,r),this.isDirty=!0)},e.prototype.showLabels=function(){this.ctx.behaviors.labels.highlight.next({labels:this.getLabels()})},e.prototype.getLabels=function(){var e=this;if(this.isDirty){this.groupedLabels.clear(),this.labels.length=0;for(var t=0,r=this.providers;t<r.length;t++)for(var n=r[t],i=0,a=this.locis;i<a.length;i++){var o=a[i];if(!me.Loci.isEmpty(o.loci)){var s=n.label(o.loci,o.repr);if(s){var u=n.group?n.group(s):s.toString(),c=this.groupedLabels.get(u);c?c.push(s):this.groupedLabels.set(u,[s])}}}this.labels.length=0,this.groupedLabels.forEach((function(t,r){var n=t.length,i=n>1&&t[0]!==t[1]?r:t[0];e.labels.push(1===n?i:i+" <small>|| × "+n+"</small>")})),this.isDirty=!1}return this.labels},e}(),xe=r(260),Oe=r(116),we=r(77),Ce=function(e){function t(t){var r=e.call(this,{history:[]})||this;r.plugin=t,r.events={historyUpdated:r.ev()},r.behaviors={current:r.ev.behavior(void 0)},t.state.data.events.object.removed.subscribe((function(e){var t,n,i=e.obj;if(v.a.Molecule.Structure.is(i)){(null===(n=r.current)||void 0===n?void 0:n.loci.structure)===i.data&&r.clear();for(var a=[],o=0,s=r.history;o<s.length;o++){var u=s[o];u.loci.structure===i.data&&a.push(u)}a.length!==r.history.length&&(r.history.length=0,(t=r.history).push.apply(t,a),r.events.historyUpdated.next())}}));var n=Object(T.g)();return t.state.data.events.object.updated.subscribe((function(e){var t,i=e.oldData,a=e.obj,s=e.action;if(v.a.Molecule.Structure.is(a)&&"in-place"===s){var u=r.state.current,c=a.data;if(u&&u.loci.structure===i){var l=A.StructureElement.Loci.remap(u.loci,c);r.state.current=Object(o.__assign)(Object(o.__assign)({},u),{loci:l}),r.behaviors.current.next(r.state.current),me.Loci.getBoundingSphere(l,n);var d=null===(t=r.plugin.canvas3d)||void 0===t?void 0:t.camera,f=d.getTargetDistance(n.radius+4);(M.Vec3.distance(d.target,n.center)>n.radius||f>d.viewport.height/d.zoom)&&r.plugin.managers.camera.focusSphere(n,{durationMs:0})}}})),r}return Object(o.__extends)(t,e),Object.defineProperty(t.prototype,"current",{get:function(){return this.state.current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"history",{get:function(){return this.state.history},enumerable:!1,configurable:!0}),t.prototype.tryAddHistory=function(e){if(!A.StructureElement.Loci.isEmpty(e.loci)){for(var t=0,r=void 0,n=0,i=this.state.history;n<i.length;n++){var a=i[n];if(A.StructureElement.Loci.areEqual(a.loci,e.loci)){r=a;break}t++}if(r)return Object(j.arrayRemoveAtInPlace)(this.state.history,t),this.state.history.unshift(e),void this.events.historyUpdated.next();this.state.history.unshift(e),this.state.history.length>8&&this.state.history.pop(),this.events.historyUpdated.next()}},t.prototype.set=function(e){this.tryAddHistory(e),this.state.current&&A.StructureElement.Loci.areEqual(this.state.current.loci,e.loci)||(this.state.current=e,this.behaviors.current.next(e))},t.prototype.setFromLoci=function(e){var t=me.Loci.normalize(e);A.StructureElement.Loci.is(t)&&!A.StructureElement.Loci.isEmpty(t)?this.set({loci:t,label:Object(we.lociLabel)(t,{reverse:!0,hidePrefix:!0,htmlStyling:!1})}):this.clear()},t.prototype.addFromLoci=function(e){var t=this.state.current&&A.StructureElement.Loci.is(e)&&e.structure===this.state.current.loci.structure?A.StructureElement.Loci.union(e,this.state.current.loci):e;this.setFromLoci(t)},t.prototype.clear=function(){this.state.current&&(this.state.current=void 0,this.behaviors.current.next(void 0))},t.prototype.getSnapshot=function(){if(!this.current)return{};var e=this.plugin.helpers.substructureParent.get(this.current.loci.structure),t=null==e?void 0:e.transform.ref;return t?{current:{label:this.current.label,ref:t,bundle:A.StructureElement.Bundle.fromLoci(this.current.loci),category:this.current.category}}:{}},t.prototype.setSnapshot=function(e){var t,r;if(e.current){var n=e.current,i=n.label,a=n.ref,o=n.bundle,s=n.category,u=null===(r=null===(t=this.plugin.state.data.select(g.StateSelection.Generators.byRef(a))[0])||void 0===t?void 0:t.obj)||void 0===r?void 0:r.data;if(u){var c=A.StructureElement.Bundle.toLoci(o,u);this.set({label:i,loci:c,category:s})}}else this.clear()},t}(Oe.b),je=r(284),Pe=r(379),Ee=r(6),Ae=r(238),De=r(5),Te=new he.a("98"),Ie=function(e){function t(t){var r=e.call(this,{entries:new Map,additionsHistory:[],stats:{structureCount:0,elementCount:0,label:"Nothing Selected"}})||this;return r.plugin=t,r.events={changed:r.ev(),additionsHistoryUpdated:r.ev(),loci:{add:r.ev(),remove:r.ev(),clear:r.ev()}},t.helpers.substructureParent.events.removed.subscribe((function(e){return r.onRemove(e.ref,e.obj)})),t.helpers.substructureParent.events.updated.subscribe((function(e){return r.onUpdate(e.ref,e.oldObj,e.obj)})),r}return Object(o.__extends)(t,e),Object.defineProperty(t.prototype,"entries",{get:function(){return this.state.entries},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"additionsHistory",{get:function(){return this.state.additionsHistory},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"stats",{get:function(){return this.state.stats||(this.state.stats=this.calcStats()),this.state.stats},enumerable:!1,configurable:!0}),t.prototype.getEntry=function(e){var t=this.plugin.helpers.substructureParent.get(e,!0);if(t){var r=t.transform.ref;if(!this.entries.has(r)){var n=new Me(A.StructureElement.Loci(e,[]));return this.entries.set(r,n),n}return this.entries.get(r)}},t.prototype.calcStats=function(){var e=0,t=0,r=A.StructureElement.Stats.create();this.entries.forEach((function(n){var i=n.selection.elements;if(i.length){e+=1;for(var a=0,o=i.length;a<o;++a)t+=Ee.OrderedSet.size(i[a].indices);A.StructureElement.Stats.add(r,r,A.StructureElement.Stats.ofLoci(n.selection))}}));var n=Object(we.structureElementStatsLabel)(r,{countsOnly:!0});return{structureCount:e,elementCount:t,label:n}},t.prototype.add=function(e){if(!A.StructureElement.Loci.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=A.StructureElement.Loci.union(t.selection,e),this.tryAddHistory(e),this.referenceLoci=e,this.events.loci.add.next(e),!A.StructureElement.Loci.areEqual(r,t.selection)},t.prototype.remove=function(e){if(!A.StructureElement.Loci.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=A.StructureElement.Loci.subtract(t.selection,e),this.referenceLoci=e,this.events.loci.remove.next(e),!A.StructureElement.Loci.areEqual(r,t.selection)},t.prototype.intersect=function(e){if(!A.StructureElement.Loci.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=A.StructureElement.Loci.intersect(t.selection,e),this.referenceLoci=e,!A.StructureElement.Loci.areEqual(r,t.selection)},t.prototype.set=function(e){if(!A.StructureElement.Loci.is(e))return!1;var t=this.getEntry(e.structure);if(!t)return!1;var r=t.selection;return t.selection=e,this.tryAddHistory(e),this.referenceLoci=void 0,!A.StructureElement.Loci.areEqual(r,t.selection)},t.prototype.modifyHistory=function(e,t,r,n){void 0===n&&(n=!1);var i=this.additionsHistory,a=i.indexOf(e);if(!(a<0)){var o=void 0;switch(t){case"remove":Object(j.arrayRemoveAtInPlace)(i,a);break;case"up":o=a-1;break;case"down":o=a+1}if(void 0!==o)for(var s=r?Math.min(i.length,r):i.length;;){if((o%=s)<0&&(o+=s),!n||i[a].loci.structure===i[o].loci.structure){var u=i[a];i[a]=i[o],i[o]=u;break}o+="up"===t?-1:1}this.events.additionsHistoryUpdated.next()}},t.prototype.tryAddHistory=function(e){if(!me.Loci.isEmpty(e)){for(var t=0,r=void 0,n=0,i=this.additionsHistory;n<i.length;n++){var a=i[n];if(me.Loci.areEqual(a.loci,e)){r=a;break}t++}if(r)return Object(j.arrayRemoveAtInPlace)(this.additionsHistory,t),this.additionsHistory.unshift(r),void this.events.additionsHistoryUpdated.next();var o=A.StructureElement.Stats.ofLoci(e),s=Object(we.structureElementStatsLabel)(o,{reverse:!0});this.additionsHistory.unshift({id:De.c.create22(),loci:e,label:s}),this.additionsHistory.length>24&&this.additionsHistory.pop(),this.events.additionsHistoryUpdated.next()}},t.prototype.clearHistory=function(){0!==this.state.additionsHistory.length&&(this.state.additionsHistory=[],this.events.additionsHistoryUpdated.next())},t.prototype.clearHistoryForStructure=function(e){for(var t=[],r=0,n=this.state.additionsHistory;r<n.length;r++){(o=n[r]).loci.structure.root===e.root&&t.push(o)}for(var i=0,a=t;i<a.length;i++){var o=a[i];this.modifyHistory(o,"remove")}0!==t.length&&this.events.additionsHistoryUpdated.next()},t.prototype.onRemove=function(e,t){var r;this.entries.has(e)&&(this.entries.delete(e),(null==t?void 0:t.data)&&this.clearHistoryForStructure(t.data),(null===(r=this.referenceLoci)||void 0===r?void 0:r.structure)===(null==t?void 0:t.data)&&(this.referenceLoci=void 0),this.state.stats=void 0,this.events.changed.next())},t.prototype.onUpdate=function(e,t,r){var n,i,a,o;if(t!==r&&(null==t?void 0:t.data)!==r.data){var s=this.plugin.helpers.substructureParent.get(r.data,!0);if(s&&(e=s.transform.ref,this.entries.has(e))){var u=null===(i=null===(n=this.plugin.helpers.substructureParent.get(r.data))||void 0===n?void 0:n.obj)||void 0===i?void 0:i.data;if(u)if(!(null==t?void 0:t.data)||A.Structure.areUnitIdsAndIndicesEqual(t.data,r.data)){this.entries.set(e,function(e,t){return new Me(A.StructureElement.Loci.remap(e.selection,t))}(this.entries.get(e),u)),(null===(a=this.referenceLoci)||void 0===a?void 0:a.structure.root)===u.root&&(this.referenceLoci=A.StructureElement.Loci.remap(this.referenceLoci,u));for(var c=!1,l=0,d=this.state.additionsHistory;l<d.length;l++){var f=d[l];f.loci.structure.root===u.root&&(f.loci=A.StructureElement.Loci.remap(f.loci,u),c=!0)}c&&this.events.additionsHistoryUpdated.next()}else this.entries.set(e,new Me(A.StructureElement.Loci(u,[]))),(null===(o=this.referenceLoci)||void 0===o?void 0:o.structure.root)===u.root&&(this.referenceLoci=void 0),this.clearHistoryForStructure(u),this.state.stats=void 0,this.events.changed.next()}}},t.prototype.clear=function(){for(var e=this.entries.keys(),t=[];;){var r=e.next();if(r.done)break;var n=this.entries.get(r.value);A.StructureElement.Loci.isEmpty(n.selection)||t.push(n.selection),n.selection=A.StructureElement.Loci(n.selection.structure,[])}return this.referenceLoci=void 0,this.state.stats=void 0,this.events.changed.next(),this.events.loci.clear.next(),this.clearHistory(),t},t.prototype.getLoci=function(e){var t=this.getEntry(e);return t?t.selection:me.EmptyLoci},t.prototype.getStructure=function(e){var t=this.getEntry(e);if(t)return t.structure},t.prototype.structureHasSelection=function(e){var t,r,n=null===(r=null===(t=e.cell)||void 0===t?void 0:t.obj)||void 0===r?void 0:r.data;if(!n)return!1;var i=this.getEntry(n);return!!i&&!A.StructureElement.Loci.isEmpty(i.selection)},t.prototype.has=function(e){if(A.StructureElement.Loci.is(e)){var t=this.getEntry(e.structure);if(t)return A.StructureElement.Loci.isSubset(t.selection,e)}return!1},t.prototype.tryGetRange=function(e){if(A.StructureElement.Loci.is(e)&&(1===e.elements.length&&this.getEntry(e.structure))){var t=e.elements[0];if(t){var r=this.referenceLoci;if(r&&A.StructureElement.Loci.is(r)&&r.structure===e.structure){for(var n,i=0,a=r.elements;i<a.length;i++){var o=a[i];if(t.unit===o.unit){n=o;break}}if(n&&t.unit===n.unit)return function(e,t,r){var n=Math.min(Ee.OrderedSet.min(t.indices),Ee.OrderedSet.min(r.indices)),i=Math.max(Ee.OrderedSet.max(t.indices),Ee.OrderedSet.max(r.indices));return A.StructureElement.Loci(e,[{unit:t.unit,indices:Ee.OrderedSet.ofRange(n,i)}])}(e.structure,n,t)}}}},t.prototype.elementCount=function(){var e=0;return this.entries.forEach((function(t){e+=A.StructureElement.Loci.size(t.selection)})),e},t.prototype.getBoundary=function(){var e=M.Vec3.create(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),t=M.Vec3.create(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);Te.reset();var r=[];this.entries.forEach((function(e){var t=e.selection;A.StructureElement.Loci.isEmpty(t)||r.push(A.StructureElement.Loci.getBoundary(t))}));for(var n=0,i=r.length;n<i;++n){var a=r[n],o=a.box,s=a.sphere;M.Vec3.min(e,e,o.min),M.Vec3.max(t,t,o.max),Te.includePositionRadius(s.center,s.radius)}Te.finishedIncludeStep();for(n=0,i=r.length;n<i;++n){s=r[n].sphere;Te.radiusPositionRadius(s.center,s.radius)}return{box:{min:e,max:t},sphere:Te.getSphere()}},t.prototype.getPrincipalAxes=function(){var e=this.elementCount(),t=new Float32Array(3*e),r=0;return this.entries.forEach((function(e){A.StructureElement.Loci.toPositionsArray(e.selection,t,r),r+=3*A.StructureElement.Loci.size(e.selection)})),Ae.a.ofPositions(t)},t.prototype.modify=function(e,t){var r=!1;switch(e){case"add":r=this.add(t);break;case"remove":r=this.remove(t);break;case"intersect":r=this.intersect(t);break;case"set":r=this.set(t)}r&&(this.state.stats=void 0,this.events.changed.next())},Object.defineProperty(t.prototype,"applicableStructures",{get:function(){return this.plugin.managers.structure.hierarchy.selection.structures.filter((function(e){return!!e.cell.obj})).map((function(e){return e.cell.obj.data}))},enumerable:!1,configurable:!0}),t.prototype.triggerInteraction=function(e,t,r){switch(void 0===r&&(r=!0),e){case"add":this.plugin.managers.interactivity.lociSelects.select({loci:t},r);break;case"remove":this.plugin.managers.interactivity.lociSelects.deselect({loci:t},r);break;case"intersect":this.plugin.managers.interactivity.lociSelects.selectJoin({loci:t},r);break;case"set":this.plugin.managers.interactivity.lociSelects.selectOnly({loci:t},r)}},t.prototype.fromLoci=function(e,t,r){void 0===r&&(r=!0),this.triggerInteraction(e,t,r)},t.prototype.fromSelectionQuery=function(e,t,r){var n=this;void 0===r&&(r=!0),this.plugin.runTask(_.b.create("Structure Selection",(function(i){return Object(o.__awaiter)(n,void 0,void 0,(function(){var n,a,s,u;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:n=0,a=this.applicableStructures,o.label=1;case 1:return n<a.length?(s=a[n],[4,t.getSelection(this.plugin,i,s)]):[3,4];case 2:u=o.sent(),this.triggerInteraction(e,A.StructureSelection.toLociWithSourceUnits(u),r),o.label=3;case 3:return n++,[3,1];case 4:return[2]}}))}))})))},t.prototype.fromSelections=function(e){var t,r=g.StateObjectRef.resolveAndCheck(this.plugin.state.data,e);if(r&&r.obj)if(v.a.Molecule.Structure.Selections.is(r.obj)){this.clear();for(var n=0,i=null===(t=r.obj)||void 0===t?void 0:t.data;n<i.length;n++){var a=i[n];this.fromLoci("set",a.loci)}}else console.warn("fromSelections applied to wrong object type.",r.obj)},t}(Oe.b);var Me=function(){function e(e){this._structure=void 0,this._selection=e}return Object.defineProperty(e.prototype,"selection",{get:function(){return this._selection},set:function(e){this._selection=e,this._structure=void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"structure",{get:function(){return this._structure||(me.Loci.isEmpty(this._selection)?this._structure=void 0:this._structure=A.StructureElement.Loci.toStructure(this._selection)),this._structure},enumerable:!1,configurable:!0}),e}();var ke,Be,Ve=r(38),Re=r(112),Le=r(49),Ne=r(22),Fe=r(53),Ue=r(291),ze=r(50),He={includeTypes:d.ParamDefinition.MultiSelect(Object(Ue.a)(Ne.BondType.Names),d.ParamDefinition.objectToOptions(Ne.BondType.Names)),excludeTypes:d.ParamDefinition.MultiSelect([],d.ParamDefinition.objectToOptions(Ne.BondType.Names)),ignoreHydrogens:d.ParamDefinition.Boolean(!1)},Ge=(d.ParamDefinition.getDefaultValues(He),Object(o.__assign)(Object(o.__assign)({},Re.a),He)),qe=(d.ParamDefinition.getDefaultValues(Ge),Object(o.__assign)(Object(o.__assign)({},Re.b),He));d.ParamDefinition.getDefaultValues(qe);function We(e,t,r){return!Ne.BondType.is(e,r)||Ne.BondType.is(t,r)}function Xe(e,t){var r=e.elements,n=e.model.atomicHierarchy.derived.atom.atomicNumber,i=e.bonds,a=i.a,o=i.b,s=i.edgeProps.flags,u=t.ignoreHydrogens,c=t.includeTypes,l=t.excludeTypes,d=Ne.BondType.fromNames(c),f=Ne.BondType.fromNames(l),p=Ne.BondType.isAll(d)&&0===f;return!p&&u?function(e){return Object(ze.n)(n,r[a[e]])||Object(ze.n)(n,r[o[e]])||We(d,f,s[e])}:p?u?function(e){return Object(ze.n)(n,r[a[e]])||Object(ze.n)(n,r[o[e]])}:void 0:function(e){return We(d,f,s[e])}}function Ye(e,t){var r=e.interUnitBonds.edges,n=t.ignoreHydrogens,i=t.includeTypes,a=t.excludeTypes,o=Ne.BondType.fromNames(i),s=Ne.BondType.fromNames(a),u=Ne.BondType.isAll(o)&&0===s,c=function(t){var n=r[t],i=e.unitMap.get(n.unitA),a=e.unitMap.get(n.unitB);return Object(ze.o)(i,i.elements[n.indexA])||Object(ze.o)(a,a.elements[n.indexB])};return!u&&n?function(e){return c(e)||We(o,s,r[e].props.flag)}:u?n?function(e){return c(e)}:void 0:function(e){return We(o,s,r[e].props.flag)}}function Qe(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i];if(A.Unit.isAtomic(s))return A.Bond.Loci(o,[A.Bond.Location(o,s,s.bonds.a[a],o,s,s.bonds.b[a]),A.Bond.Location(o,s,s.bonds.b[a],o,s,s.bonds.a[a])])}return me.EmptyLoci}function Ke(e,t,r,n){var i=!1;if(A.Bond.isLoci(e)){var a=t.structure,o=t.group;if(!A.Structure.areEquivalent(e.structure,a))return!1;var s=o.units[0];if(!A.Unit.isAtomic(s))return!1;for(var u=2*s.bonds.edgeCount,c=0,l=e.bonds;c<l.length;c++){var d=l[c];if(d.aUnit===d.bUnit){var f=o.unitIndexMap.get(d.aUnit.id);if(void 0!==f){var p=s.bonds.getDirectedEdgeIndex(d.aIndex,d.bIndex);-1!==p&&r(Ee.Interval.ofSingleton(f*u+p))&&(i=!0)}}}}else if(A.StructureElement.Loci.is(e)){a=t.structure,o=t.group;if(!A.Structure.areEquivalent(e.structure,a))return!1;s=o.units[0];if(!A.Unit.isAtomic(s))return!1;for(var m=2*s.bonds.edgeCount,h=function(e){var t=o.unitIndexMap.get(e.unit.id);if(void 0!==t){var a=s.bonds,u=a.offset,c=a.b;Ee.OrderedSet.forEach(e.indices,(function(a){for(var o=u[a],s=u[a+1];o<s;o++)n&&!Ee.OrderedSet.has(e.indices,c[o])||r(Ee.Interval.ofSingleton(t*m+o))&&(i=!0)}))}},g=0,v=e.elements;g<v.length;g++){h(v[g])}}return i}function Ze(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.interUnitBonds.edges[i],o=t.unitMap.get(a.unitA),s=t.unitMap.get(a.unitB);return A.Bond.Loci(t,[A.Bond.Location(t,o,a.indexA,t,s,a.indexB),A.Bond.Location(t,s,a.indexB,t,o,a.indexA)])}return me.EmptyLoci}function Je(e,t,r,n){var i=!1;if(A.Bond.isLoci(e)){if(!A.Structure.areEquivalent(e.structure,t))return!1;for(var a=0,o=e.bonds;a<o.length;a++){var s=o[a],u=t.interUnitBonds.getBondIndexFromLocation(s);-1!==u&&r(Ee.Interval.ofSingleton(u))&&(i=!0)}}else if(A.StructureElement.Loci.is(e)){if(!A.Structure.areEquivalent(e.structure,t))return!1;if(n&&1===e.elements.length)return!1;for(var c=new Map,l=0,d=e.elements;l<d.length;l++){var f=d[l];c.set(f.unit.id,f.indices)}for(var p=function(e){var a=e.unit;if(!A.Unit.isAtomic(a))return"continue";t.interUnitBonds.getConnectedUnits(a.id).forEach((function(o){var s=c.get(o.unitB);n&&!s||Ee.OrderedSet.forEach(e.indices,(function(e){o.connectedIndices.includes(e)&&o.getEdges(e).forEach((function(u){if(!n||s&&Ee.OrderedSet.has(s,u.indexB)){var c=t.interUnitBonds.getEdgeIndex(e,a.id,u.indexB,o.unitB);r(Ee.Interval.ofSingleton(c))&&(i=!0)}}))}))}))},m=0,h=e.elements;m<h.length;m++){p(f=h[m])}}return i}(Be=ke||(ke={})).fromGroup=function(e){var t=e.group,r=e.structure,n=t.units[0],i=A.Unit.isAtomic(n)?2*n.bonds.edgeCount:0,a=t.units.length,o=A.Bond.Location();return o.aStructure=r,o.bStructure=r,Object(Fe.a)(i,a,1,(function(e,r){var n=t.units[r];return o.aUnit=n,o.bUnit=n,o.aIndex=n.bonds.a[e],o.bIndex=n.bonds.b[e],o}))},Be.fromStructure=function(e){var t=e.interUnitBonds.edgeCount,r=A.Bond.Location();return r.aStructure=e,r.bStructure=e,Object(Fe.a)(t,1,1,(function(t){var n=e.interUnitBonds.edges[t];return r.aUnit=e.unitMap.get(n.unitA),r.aIndex=n.indexA,r.bUnit=e.unitMap.get(n.unitB),r.bIndex=n.indexB,r}),!0)};var $e=r(145),et=r(166),tt=Ne.BondType.is;function rt(e,t,r,n){var i=A.StructureElement.Location.create(t,e),a=A.Bond.Location(t,e,void 0,t,e,void 0),o=e.elements,s=e.bonds,u=s.edgeCount,c=s.a,l=s.b,d=s.edgeProps,f=s.offset,p=d.order,m=d.flags,h=n.sizeFactor,g=n.sizeAspectRatio,v=Object(M.Vec3)(),b=Object(M.Vec3)(),y=e.conformation.invariantPosition;return{linkCount:2*u,referencePosition:function(e){var t,r,n=c[e],i=l[e];n>i&&(n=(t=[i,n])[0],i=t[1]),f[n+1]-f[n]==1&&(n=(r=[i,n])[0],i=r[1]);for(var a=f[n],s=f[n+1];a<s;++a){var u=l[a];if(u!==i&&u!==n)return y(o[u],v)}for(a=f[i],s=f[i+1];a<s;++a){var d=c[a];if(d!==n&&d!==i)return y(o[d],v)}return null},position:function(e,t,n){var a=function(e){return i.element=o[c[e]],r.size.size(i)*h}(n),s=function(e){return i.element=o[l[e]],r.size.size(i)*h}(n),u=Math.min(a,s)*g,d=Math.sqrt(Math.max(0,a*a-u*u))-.05,f=Math.sqrt(Math.max(0,s*s-u*u))-.05;y(o[c[n]],e),y(o[l[n]],t),d<=.01&&f<=.01||(M.Vec3.normalize(b,M.Vec3.sub(b,t,e)),M.Vec3.scaleAndAdd(e,e,b,d),M.Vec3.scaleAndAdd(t,t,b,-f))},style:function(e){var t=p[e],r=m[e];return tt(r,2)||tt(r,4)?1:2===t?2:3===t?3:0},radius:function(e){return function(e){return a.aIndex=c[e],a.bIndex=l[e],r.size.size(a)*h}(e)*g},ignore:Xe(e,n)}}function nt(e,t,r,n,i,a){if(!A.Unit.isAtomic(t))return et.a.createEmpty(a);if(!t.bonds.edgeCount)return et.a.createEmpty(a);var o=rt(t,r,n,i),s=Object(Re.c)(e,o,i,a),u=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return s.setBoundingSphere(u),s}function it(e,t,r,n,i,a){if(!A.Unit.isAtomic(t))return Ve.a.createEmpty(a);if(!t.bonds.edgeCount)return Ve.a.createEmpty(a);var o=rt(t,r,n,i),s=Object(Re.d)(e,o,i,a),u=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return s.setBoundingSphere(u),s}var at=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.g),Le.a),Ge),{sizeFactor:d.ParamDefinition.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:d.ParamDefinition.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:d.ParamDefinition.Boolean(!0)});function ot(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return Object(Le.b)({defaultProps:d.ParamDefinition.getDefaultValues(at),createGeometry:nt,createLocationIterator:ke.fromGroup,getLoci:Qe,eachLocation:Ke,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.linkCap!==r.linkCap||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||!Object(De.f)(t.includeTypes,r.includeTypes)||!Object(De.f)(t.excludeTypes,r.excludeTypes);var s=a.group.units[0],u=o.group.units[0];A.Unit.isAtomic(s)&&A.Unit.isAtomic(u)&&($e.a.areEqual(s.bonds,u.bonds)||(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0))},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(at),createGeometry:it,createLocationIterator:ke.fromGroup,getLoci:Qe,eachLocation:Ke,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.sizeAspectRatio!==r.sizeAspectRatio||t.radialSegments!==r.radialSegments||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.linkCap!==r.linkCap||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||!Object(De.f)(t.includeTypes,r.includeTypes)||!Object(De.f)(t.excludeTypes,r.excludeTypes);var s=a.group.units[0],u=o.group.units[0];A.Unit.isAtomic(s)&&A.Unit.isAtomic(u)&&($e.a.areEqual(s.bonds,u.bonds)||(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0))},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}var st=r(92),ut=new A.Bond.ElementBondIterator;function ct(e,t,r,n){for(ut.setElement(t,r,n);ut.hasNext;){var i=ut.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}var lt=Object(M.Vec3)();function dt(e,t,r){var n=A.StructureElement.Location.create(e),i=A.Bond.Location(e,void 0,void 0,e,void 0,void 0),a=e.interUnitBonds,o=a.edgeCount,s=a.edges,u=r.sizeFactor,c=r.sizeAspectRatio,l=Object(M.Vec3)();return{linkCount:o,referencePosition:function(t){var r,n,i,a,o=s[t];if(o.unitA<o.unitB)r=e.unitMap.get(o.unitA),n=e.unitMap.get(o.unitB),i=o.indexA,a=o.indexB;else{if(!(o.unitA>o.unitB))throw new Error("same units in createInterUnitBondCylinderMesh");r=e.unitMap.get(o.unitB),n=e.unitMap.get(o.unitA),i=o.indexB,a=o.indexA}return ct(lt,e,r,i)||ct(lt,e,n,a)},position:function(r,i,a){var o=s[a],d=e.unitMap.get(o.unitA),f=e.unitMap.get(o.unitB),p=function(r){var i=s[r];return n.unit=e.unitMap.get(i.unitA),n.element=n.unit.elements[i.indexA],t.size.size(n)*u}(a),m=function(r){var i=s[r];return n.unit=e.unitMap.get(i.unitB),n.element=n.unit.elements[i.indexB],t.size.size(n)*u}(a),h=Math.min(p,m)*c,g=Math.sqrt(Math.max(0,p*p-h*h))-.05,v=Math.sqrt(Math.max(0,m*m-h*h))-.05;d.conformation.position(d.elements[o.indexA],r),f.conformation.position(f.elements[o.indexB],i),g<=.01&&v<=.01||(M.Vec3.normalize(l,M.Vec3.sub(l,i,r)),M.Vec3.scaleAndAdd(r,r,l,g),M.Vec3.scaleAndAdd(i,i,l,-v))},style:function(e){var t=s[e].props.order,r=De.a.create(s[e].props.flag);return Ne.BondType.is(r,2)||Ne.BondType.is(r,4)?1:2===t?2:3===t?3:0},radius:function(r){return function(r){var n=s[r];return i.aUnit=e.unitMap.get(n.unitA),i.aIndex=n.indexA,i.bUnit=e.unitMap.get(n.unitB),i.bIndex=n.indexB,t.size.size(i)*u}(r)*c},ignore:Ye(e,r)}}function ft(e,t,r,n,i){if(!t.interUnitBonds.edgeCount)return et.a.createEmpty(i);var a=dt(t,r,n),o=Object(Re.c)(e,a,n,i),s=T.g.expand(Object(T.g)(),t.boundary.sphere,1*n.sizeFactor);return o.setBoundingSphere(s),o}function pt(e,t,r,n,i){if(!t.interUnitBonds.edgeCount)return Ve.a.createEmpty(i);var a=dt(t,r,n),o=Object(Re.d)(e,a,n,i),s=T.g.expand(Object(T.g)(),t.boundary.sphere,1*n.sizeFactor);return o.setBoundingSphere(s),o}var mt=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},st.g),st.a),Ge),{sizeFactor:d.ParamDefinition.Numeric(.3,{min:0,max:10,step:.01}),sizeAspectRatio:d.ParamDefinition.Numeric(2/3,{min:0,max:3,step:.01}),tryUseImpostor:d.ParamDefinition.Boolean(!0)});function ht(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return Object(st.b)({defaultProps:d.ParamDefinition.getDefaultValues(mt),createGeometry:ft,createLocationIterator:ke.fromStructure,getLoci:Ze,eachLocation:Je,setUpdateState:function(e,t,r){e.createGeometry=t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.linkCap!==r.linkCap||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||!Object(De.f)(t.includeTypes,r.includeTypes)||!Object(De.f)(t.excludeTypes,r.excludeTypes)},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return Object(st.h)({defaultProps:d.ParamDefinition.getDefaultValues(mt),createGeometry:pt,createLocationIterator:ke.fromStructure,getLoci:Ze,eachLocation:Je,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.sizeAspectRatio!==r.sizeAspectRatio||t.radialSegments!==r.radialSegments||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.ignoreHydrogens!==r.ignoreHydrogens||t.linkCap!==r.linkCap||t.dashCount!==r.dashCount||t.dashScale!==r.dashScale||t.dashCap!==r.dashCap||!Object(De.f)(t.includeTypes,r.includeTypes)||!Object(De.f)(t.excludeTypes,r.excludeTypes)},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}var gt,vt,bt,yt=r(272),_t=r(35),St=r(82),xt=r(270),Ot=new Float32Array([-1,1,-1,-1,1,1,1,-1]),wt=new Uint16Array([0,1,2,1,3,2]),Ct=y.a.add3,jt=y.a.add2,Pt=y.a.add;function Et(e,t){var r=t.ignoreHydrogens,n=t.traceOnly,i=e.model.atomicHierarchy.derived.atom.atomicNumber,a=A.Unit.isCoarse(e);return!a&&r&&n?function(e,t){return Object(ze.n)(i,t)&&!Object(ze.p)(e,t)}:!a&&r?function(e,t){return Object(ze.n)(i,t)}:!a&&n?function(e,t){return!Object(ze.p)(e,t)}:void 0}function At(e,t,r,n,i,a){var o=i.detail,s=i.sizeFactor,u=t.elements,c=u.length,l=c*Object(yt.b)(o),d=_t.a.createState(l,l/2,a),f=Object(M.Vec3)(),p=t.conformation.invariantPosition,m=Et(t,i),h=A.StructureElement.Location.create(r);h.unit=t;for(var g=0,v=0;v<c;v++)if(!m||!m(t,u[v])){h.element=u[v],p(u[v],f),d.currentGroup=v;var b=n.size.size(h);b>g&&(g=b),Object(St.a)(d,f,b*s,o)}var y=_t.a.getMesh(d),_=T.g.expand(Object(T.g)(),t.boundary.sphere,g*s+.05);return y.setBoundingSphere(_),y}function Dt(e,t,r,n,i,a){for(var o=t.elements,s=o.length,u=gt.create(s,s/2,a),c=Object(M.Vec3)(),l=t.conformation.invariantPosition,d=Et(t,i),f=A.StructureElement.Location.create(r,t),p=0,m=0;m<s;m++)if(!(null==d?void 0:d(t,o[m]))){l(o[m],c),u.add(c[0],c[1],c[2],m),f.element=o[m];var h=n.size.size(f);h>p&&(p=h)}var g=u.getSpheres();return g.setBoundingSphere(T.g.expand(Object(T.g)(),t.boundary.sphere,p*i.sizeFactor+.05)),g}function Tt(e,t,r){var n=!1;if(!A.StructureElement.Loci.is(e))return!1;var i=t.structure,a=t.group;if(!A.Structure.areEquivalent(e.structure,i))return!1;for(var o=a.elements.length,s=0,u=e.elements;s<u.length;s++){var c=u[s],l=a.unitIndexMap.get(c.unit.id);if(void 0!==l){var d=l*o;if(Ee.Interval.is(c.indices)){var f=d+Ee.Interval.start(c.indices),p=d+Ee.Interval.end(c.indices);r(Ee.Interval.ofBounds(f,p))&&(n=!0)}else for(var m=0,h=c.indices.length;m<h;m++){f=c.indices[m];for(var g=m+1;g<h&&c.indices[g]===f;)g++;m=g-1;p=c.indices[m];n=r(Ee.Interval.ofRange(d+f,d+p))||n}}}return n}function It(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i],u=Ee.OrderedSet.ofSingleton(a);return A.StructureElement.Loci(o,[{unit:s,indices:u}])}return me.EmptyLoci}function Mt(e,t,r){var n=!1;if(!A.StructureElement.Loci.is(e))return!1;if(!A.Structure.areEquivalent(e.structure,t))return!1;for(var i=t.serialMapping.cumulativeUnitElementCount,a=0,o=e.elements;a<o.length;a++){var s=o[a],u=t.unitIndexMap.get(s.unit.id);if(void 0!==u)if(Ee.Interval.is(s.indices)){var c=i[u]+Ee.Interval.start(s.indices),l=i[u]+Ee.Interval.end(s.indices);r(Ee.Interval.ofBounds(c,l))&&(n=!0)}else for(var d=0,f=s.indices.length;d<f;d++){var p=i[u]+s.indices[d];r(Ee.Interval.ofSingleton(p))&&(n=!0)}}return n}function kt(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.serialMapping,o=a.unitIndices,s=a.cumulativeUnitElementCount,u=o[i],c=t.units[u],l=i-s[u],d=Ee.OrderedSet.ofSingleton(l);return A.StructureElement.Loci(t,[{unit:c,indices:d}])}return me.EmptyLoci}(gt||(gt={})).create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024),e*=4,t*=4;var n=y.a.create(Float32Array,3,t,r?r.centerBuffer.ref.value:e),i=y.a.create(Float32Array,2,t,r?r.mappingBuffer.ref.value:e),a=y.a.create(Uint32Array,3,t/2,r?r.indexBuffer.ref.value:e/2),o=y.a.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e);return{add:function(e,t,r,s){for(var u=n.elementCount,c=0;c<4;++c)Ct(n,e,t,r),jt(i,Ot[2*c],Ot[2*c+1]),Pt(o,s);Ct(a,u+wt[0],u+wt[1],u+wt[2]),Ct(a,u+wt[3],u+wt[4],u+wt[5])},getSpheres:function(){var e=y.a.compact(n,!0),t=y.a.compact(i,!0),s=y.a.compact(a,!0),u=y.a.compact(o,!0);return xt.a.create(e,t,s,u,n.elementCount/4,r)}}},(bt=vt||(vt={})).fromGroup=function(e){var t=e.group,r=e.structure,n=t.elements.length,i=t.units.length,a=A.StructureElement.Location.create(r);return Object(Fe.a)(n,i,1,(function(e,r){var n=t.units[r];return a.unit=n,a.element=n.elements[e],a}))},bt.fromStructure=function(e){var t=e.units,r=e.elementCount,n=e.serialMapping,i=n.unitIndices,a=n.elementIndices,o=A.StructureElement.Location.create(e);return Object(Fe.a)(r,1,1,(function(e){return o.unit=t[i[e]],o.element=a[e],o}),!0)};var Bt=r(30),Vt=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.g),Le.k),{sizeFactor:d.ParamDefinition.Numeric(1,{min:0,max:10,step:.1}),detail:d.ParamDefinition.Numeric(0,{min:0,max:3,step:1},Bt.a.CustomQualityParamInfo),ignoreHydrogens:d.ParamDefinition.Boolean(!1),traceOnly:d.ParamDefinition.Boolean(!1),tryUseImpostor:d.ParamDefinition.Boolean(!0)});function Rt(e,t,r,n){return r.tryUseImpostor&&n&&n.extensions.fragDepth?function(e){return Object(Le.l)({defaultProps:d.ParamDefinition.getDefaultValues(Vt),createGeometry:Dt,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){e.createGeometry=t.ignoreHydrogens!==r.ignoreHydrogens||t.traceOnly!==r.traceOnly},mustRecreate:function(e,t,r){return!t.tryUseImpostor||!r}},e)}(e):function(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(Vt),createGeometry:At,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.ignoreHydrogens!==r.ignoreHydrogens||t.traceOnly!==r.traceOnly},mustRecreate:function(e,t,r){return t.tryUseImpostor&&!!r}},e)}(e)}var Lt=r(110),Nt=r(233),Ft=r(55),Ut=r(86),zt={"element-sphere":function(e,t){return Object(Lt.a)("Element sphere",e,t,Rt)},"intra-bond":function(e,t){return Object(Lt.a)("Intra-unit bond cylinder",e,t,ot)},"inter-bond":function(e,t){return Object(Nt.a)("Inter-unit bond cylinder",e,t,ht)}},Ht=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Vt),at),mt),{unitKinds:Object(Ut.j)(["atomic"]),sizeFactor:d.ParamDefinition.Numeric(.15,{min:.01,max:10,step:.01}),sizeAspectRatio:d.ParamDefinition.Numeric(2/3,{min:.01,max:3,step:.01}),visuals:d.ParamDefinition.MultiSelect(["element-sphere","intra-bond","inter-bond"],d.ParamDefinition.objectToOptions(zt))});var Gt=Object(Ft.b)({name:"ball-and-stick",label:"Ball & Stick",description:"Displays atoms as spheres and bonds as cylinders.",factory:function(e,t){return ye.a.createMulti("Ball & Stick",e,t,Ft.c,zt)},getParams:function(e,t){return d.ParamDefinition.clone(Ht)},defaultValues:d.ParamDefinition.getDefaultValues(Ht),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}});function qt(e,t,r,n,i){var a=t.carbohydrates,o=a.links,s=a.elements,u=n.linkSizeFactor,c=A.StructureElement.Location.create(t),l={linkCount:o.length,position:function(e,t,r){var n=o[r];M.Vec3.copy(e,s[n.carbohydrateIndexA].geometry.center),M.Vec3.copy(t,s[n.carbohydrateIndexB].geometry.center)},radius:function(e){var t=o[e],n=s[t.carbohydrateIndexA],i=n.unit.rings.all[n.ringIndex];return c.unit=n.unit,c.element=n.unit.elements[i[0]],r.size.size(c)*u}};return Object(Re.d)(e,l,n,i)}var Wt=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.g),Re.a),{linkSizeFactor:d.ParamDefinition.Numeric(.3,{min:0,max:3,step:.01})});function Xt(e){return Object(st.h)({defaultProps:d.ParamDefinition.getDefaultValues(Wt),createGeometry:qt,createLocationIterator:Yt,getLoci:Qt,eachLocation:Kt,setUpdateState:function(e,t,r){e.createGeometry=t.linkSizeFactor!==r.linkSizeFactor||t.radialSegments!==r.radialSegments||t.linkCap!==r.linkCap}},e)}function Yt(e){var t=e.carbohydrates,r=t.elements,n=t.links,i=n.length,a=A.StructureElement.Location.create(e);return Object(Fe.a)(i,1,1,(function(e){var t=n[e],i=r[t.carbohydrateIndexA],o=i.unit.rings.all[i.ringIndex];return a.unit=i.unit,a.element=i.unit.elements[o[0]],a}),!0)}function Qt(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.carbohydrates,o=a.links,s=a.elements,u=o[i],c=s[u.carbohydrateIndexA],l=s[u.carbohydrateIndexB];return A.StructureElement.Loci.union(Object(ze.f)(t,c.unit,c.residueIndex,c.altId),Object(ze.f)(t,l.unit,l.residueIndex,l.altId))}return me.EmptyLoci}function Kt(e,t,r){var n=!1;if(!A.StructureElement.Loci.is(e))return!1;if(!A.Structure.areEquivalent(e.structure,t))return!1;for(var i=t.carbohydrates.getLinkIndices,a=function(e,t){if(!A.Unit.isAtomic(e))return"continue";Ee.OrderedSet.forEach(t,(function(t){for(var a=i(e,e.elements[t]),o=0,s=a.length;o<s;++o)r(Ee.Interval.ofSingleton(a[o]))&&(n=!0)}))},o=0,s=e.elements;o<s.length;o++){var u=s[o];a(u.unit,u.indices)}return n}var Zt,Jt,$t=r(256),er=r(137),tr=r(153),rr=M.Vec3.create(0,0,-.5),nr=M.Vec3.create(0,0,.5),ir=Object(M.Vec3)(),ar=Object(M.Vec3)(),or=Object(M.Vec3)(),sr=Object(M.Vec3)();function ur(e){for(var t=e.length/3,r=(3===t?1:4===t?2:t)+t,n=4===t?3*t+4:3*r,i=Object(er.a)(r,n),a=0;a<t;++a){var o=(a+1)%t;M.Vec3.set(ir,e[3*a],e[3*a+1],-.5),M.Vec3.set(ar,e[3*o],e[3*o+1],-.5),i.add(ir,ar,nr)}if(3===t)M.Vec3.set(ir,e[0],e[1],-.5),M.Vec3.set(ar,e[3],e[4],-.5),M.Vec3.set(or,e[6],e[7],-.5),i.add(or,ar,ir);else if(4===t)M.Vec3.set(ir,e[0],e[1],-.5),M.Vec3.set(ar,e[3],e[4],-.5),M.Vec3.set(or,e[6],e[7],-.5),M.Vec3.set(sr,e[9],e[10],-.5),i.addQuad(sr,or,ar,ir);else for(a=0;a<t;++a){o=(a+1)%t;M.Vec3.set(ir,e[3*a],e[3*a+1],-.5),M.Vec3.set(ar,e[3*o],e[3*o+1],-.5),i.add(rr,ar,ir)}return i.getPrimitive()}var cr={pointCount:5,outerRadius:1,innerRadius:.5,thickness:.3},lr=M.Vec3.zero(),dr=M.Vec3.zero(),fr=M.Vec3.zero(),pr=M.Vec3.zero(),mr=M.Vec3.zero();var hr,gr,vr=r(190),br=[.5,0,0,-.5,0,0,0,.5,0,0,-.5,0,0,0,.5,0,0,-.5],yr=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2],_r=[0,2,4,0,4,3,1,2,5,1,5,3];Object(vr.b)(br,[0,2,1,3,2,1,3,0,0,4,1,4,2,4,3,4,0,5,1,5,2,5,3,5]);var Sr=r(246),xr=r(184),Or=M.Mat4.identity(),wr=M.Vec3.zero(),Cr=M.Vec3.zero(),jr=Object($t.a)(),Pr=Object($t.c)(),Er=(Zt||(Zt=ur(Object(tr.a)(8,!0))),Zt),Ar=function(){if(!Jt){for(var e=Object(tr.a)(8,!0),t=new Float32Array(30),r=0;r<8;++r)t[3*r]=e[3*r],t[3*r+1]=e[3*r+1],t[3*r+2]=-.5;t[24]=0,t[25]=0,t[26]=-.5,t[27]=0,t[28]=0,t[29]=.5;Jt=Object(er.b)(t,[0,1,8,1,2,8,4,5,8,5,6,8,2,3,9,3,4,9,6,7,9,7,0,9])}return Jt}(),Dr=function(e){for(var t=Object(o.__assign)(Object(o.__assign)({},cr),e),r=t.outerRadius,n=t.innerRadius,i=t.thickness,a=t.pointCount,s=2*a*2,u=Object(er.a)(s),c=new Float32Array(2*a),l=new Float32Array(2*a),d=0;d<a;++d){var f=2*d,p=2*d+1,m=(f+1)/a*Math.PI,h=(p+1)/a*Math.PI;l[f]=Math.cos(m)*r,l[p]=Math.sin(m)*r,c[f]=Math.cos(h)*n,c[p]=Math.sin(h)*n}for(M.Vec3.set(lr,0,0,i/2),M.Vec3.set(dr,0,0,-i/2),d=0;d<a;++d){var g=(d+1)%a;M.Vec3.set(fr,l[2*d],l[2*d+1],0),M.Vec3.set(pr,c[2*d],c[2*d+1],0),M.Vec3.set(mr,l[2*g],l[2*g+1],0),u.add(lr,fr,pr),u.add(pr,fr,dr),u.add(lr,pr,mr),u.add(mr,pr,dr)}return u.getPrimitive()}({outerRadius:1,innerRadius:.5,thickness:.5,pointCount:5}),Tr=(hr||(hr=Object(er.b)(br,yr)),hr),Ir=(gr||(gr=Object(er.b)(br,_r)),gr),Mr=Object(Sr.a)(),kr=Object(Sr.d)(),Br=Object(Sr.c)(),Vr=Object(Sr.g)(),Rr=Object(Sr.b)();function Lr(e,t,r,n,i){for(var a=_t.a.createState(256,128,i),o=n.detail,s=n.sizeFactor,u=t.carbohydrates,c=u.elements.length,l=A.StructureElement.Location.create(t),d=0;d<c;++d){var f=u.elements[d],p=f.unit.rings.all[f.ringIndex],m=Object(xr.f)(f.component.type,p.length);l.unit=f.unit,l.element=f.unit.elements[p[0]];var h=r.size.size(l),g=h*s,v=h*s*1.612,b=f.geometry,y=b.center,_=b.normal,S=b.direction;switch(M.Vec3.add(Cr,y,S),M.Mat4.targetTo(Or,y,Cr,_),M.Mat4.setTranslation(Or,y),a.currentGroup=2*d,m){case 0:Object(St.a)(a,y,g,o);break;case 1:M.Mat4.scaleUniformly(Or,Or,v),_t.a.addPrimitive(a,Or,jr);break;case 2:M.Mat4.scaleUniformly(Or,Or,v),_t.a.addPrimitive(a,Or,Pr),M.Mat4.mul(Or,Or,M.Mat4.rotZ90X180),a.currentGroup+=1,_t.a.addPrimitive(a,Or,Pr);break;case 4:M.Mat4.scaleUniformly(Or,Or,1.2*v),_t.a.addPrimitive(a,Or,Er);break;case 5:M.Mat4.scaleUniformly(Or,Or,1.2*v),_t.a.addPrimitive(a,Or,Ar),M.Mat4.mul(Or,Or,M.Mat4.rotZ90),a.currentGroup+=1,_t.a.addPrimitive(a,Or,Ar);break;case 6:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,v,v,v/2)),_t.a.addPrimitive(a,Or,jr);break;case 7:M.Mat4.scaleUniformly(Or,Or,v),M.Mat4.mul(Or,Or,M.Mat4.rotZY90),_t.a.addPrimitive(a,Or,Dr);break;case 8:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,1.4*v,1.4*v,1.4*v)),_t.a.addPrimitive(a,Or,Tr);break;case 3:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,1.4*v,1.4*v,1.4*v)),_t.a.addPrimitive(a,Or,Ir),M.Mat4.mul(Or,Or,M.Mat4.rotY90),a.currentGroup+=1,_t.a.addPrimitive(a,Or,Ir);break;case 9:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,v,v/2,v/2)),_t.a.addPrimitive(a,Or,Mr);break;case 12:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,v,v,v/2)),_t.a.addPrimitive(a,Or,Mr);break;case 13:case 11:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,v,v,v/2)),_t.a.addPrimitive(a,Or,kr);break;case 14:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,v,v,v/2)),_t.a.addPrimitive(a,Or,Br);break;case 15:M.Mat4.mul(Or,Or,M.Mat4.rotZY90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,v,v,v/2)),_t.a.addPrimitive(a,Or,Rr);break;case 10:default:M.Mat4.mul(Or,Or,M.Mat4.rotZYZ90),M.Mat4.scale(Or,Or,M.Vec3.set(wr,v/1.5,v,v/2)),_t.a.addPrimitive(a,Or,Vr)}}return _t.a.getMesh(a)}var Nr=Object(o.__assign)(Object(o.__assign)({},st.g),{detail:d.ParamDefinition.Numeric(0,{min:0,max:3,step:1},Bt.a.CustomQualityParamInfo),sizeFactor:d.ParamDefinition.Numeric(1.75,{min:0,max:10,step:.01})});function Fr(e){return Object(st.h)({defaultProps:d.ParamDefinition.getDefaultValues(Nr),createGeometry:Lr,createLocationIterator:Ur,getLoci:zr,eachLocation:Hr,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail}},e)}function Ur(e){var t=e.carbohydrates.elements,r=2*t.length,n=A.StructureElement.Location.create(e);return Object(Fe.a)(r,1,1,(function(e,r){var i=t[Math.floor(e/2)],a=i.unit.rings.all[i.ringIndex];return n.unit=i.unit,n.element=i.unit.elements[a[0]],n}),!0,(function(e,t){return e%2==1}))}function zr(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.carbohydrates.elements[Math.floor(i/2)];return Object(ze.f)(t,a.unit,a.residueIndex,a.altId)}return me.EmptyLoci}function Hr(e,t,r){var n=t.carbohydrates.getElementIndices,i=!1;if(!A.StructureElement.Loci.is(e))return!1;if(!A.Structure.areEquivalent(e.structure,t))return!1;for(var a=function(e,t){if(!A.Unit.isAtomic(e))return"continue";Ee.OrderedSet.forEach(t,(function(t){for(var a=n(e,e.elements[t]),o=0,s=a.length;o<s;++o)r(Ee.Interval.ofSingleton(2*a[o]))&&(i=!0)}))},o=0,s=e.elements;o<s.length;o++){var u=s[o];a(u.unit,u.indices)}return i}var Gr=r(113);function qr(e,t,r,n,i){var a=t.carbohydrates,o=a.terminalLinks,s=a.elements,u=n.terminalLinkSizeFactor,c=A.StructureElement.Location.create(t),l={linkCount:o.length,position:function(e,t,r){var n=o[r];n.fromCarbohydrate?(M.Vec3.copy(e,s[n.carbohydrateIndex].geometry.center),n.elementUnit.conformation.position(n.elementUnit.elements[n.elementIndex],t)):(n.elementUnit.conformation.position(n.elementUnit.elements[n.elementIndex],e),M.Vec3.copy(t,s[n.carbohydrateIndex].geometry.center))},radius:function(e){var t=o[e];if(t.fromCarbohydrate){var n=s[t.carbohydrateIndex],i=n.unit.rings.all[n.ringIndex];c.unit=n.unit,c.element=n.unit.elements[i[0]]}else c.unit=t.elementUnit,c.element=t.elementUnit.elements[t.elementIndex];return r.size.size(c)*u},style:function(e){var t=o[e],r=t.elementUnit.elements[t.elementIndex],n=Object(Gr.c)(t.elementUnit.model.atomicHierarchy.atoms.type_symbol.value(r));return Gr.b.has(n)?1:0}};return Object(Re.d)(e,l,n,i)}var Wr=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.g),Re.a),{terminalLinkSizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:3,step:.01})});function Xr(e){return Object(st.h)({defaultProps:d.ParamDefinition.getDefaultValues(Wr),createGeometry:qr,createLocationIterator:Yr,getLoci:Qr,eachLocation:Kr,setUpdateState:function(e,t,r){e.createGeometry=t.terminalLinkSizeFactor!==r.terminalLinkSizeFactor||t.radialSegments!==r.radialSegments||t.linkCap!==r.linkCap}},e)}function Yr(e){var t=e.carbohydrates,r=t.elements,n=t.terminalLinks,i=n.length,a=A.StructureElement.Location.create(e);return Object(Fe.a)(i,1,1,(function(e){var t=n[e];if(t.fromCarbohydrate){var i=r[t.carbohydrateIndex],o=i.unit.rings.all[i.ringIndex];a.unit=i.unit,a.element=i.unit.elements[o[0]]}else a.unit=t.elementUnit,a.element=t.elementUnit.elements[t.elementIndex];return a}),!0)}function Qr(e,t,r){var n=e.objectId,i=e.groupId;if(r===n){var a=t.carbohydrates,o=a.terminalLinks,s=a.elements,u=o[i],c=s[u.carbohydrateIndex];return A.StructureElement.Loci.union(Object(ze.f)(t,c.unit,c.residueIndex,c.altId),Object(ze.e)(t,u.elementUnit,u.elementUnit.elements[u.elementIndex]))}return me.EmptyLoci}function Kr(e,t,r){var n=!1;if(!A.StructureElement.Loci.is(e))return!1;if(!A.Structure.areEquivalent(e.structure,t))return!1;for(var i=t.carbohydrates.getTerminalLinkIndices,a=function(e,t){if(!A.Unit.isAtomic(e))return"continue";Ee.OrderedSet.forEach(t,(function(t){for(var a=i(e,e.elements[t]),o=0,s=a.length;o<s;++o)r(Ee.Interval.ofSingleton(a[o]))&&(n=!0)}))},o=0,s=e.elements;o<s.length;o++){var u=s[o];a(u.unit,u.indices)}return n}var Zr={"carbohydrate-symbol":function(e,t){return Object(Nt.a)("Carbohydrate symbol mesh",e,t,Fr)},"carbohydrate-link":function(e,t){return Object(Nt.a)("Carbohydrate link cylinder",e,t,Xt)},"carbohydrate-terminal-link":function(e,t){return Object(Nt.a)("Carbohydrate terminal link cylinder",e,t,Xr)}},Jr=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Nr),Wt),Wr),{visuals:d.ParamDefinition.MultiSelect(["carbohydrate-symbol","carbohydrate-link","carbohydrate-terminal-link"],d.ParamDefinition.objectToOptions(Zr))});var $r=Object(Ft.b)({name:"carbohydrate",label:"Carbohydrate",description:"Displays carbohydrate symbols (3D SNFG).",factory:function(e,t){return ye.a.createMulti("Carbohydrate",e,t,Ft.c,Zr)},getParams:function(e,t){return d.ParamDefinition.clone(Jr)},defaultValues:d.ParamDefinition.getDefaultValues(Jr),defaultColorTheme:{name:"carbohydrate-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.models.some((function(e){return A.Model.hasCarbohydrate(e)}))}}),en=r(91),tn=r(88);function rn(e,t){return{centerA:A.StructureElement.Location.create(e,t),centerB:A.StructureElement.Location.create(e,t)}}(function(){function e(e,t){this.unit=t,this.state=0,this.hasNext=!1,this.traceElementIndex=t.model.atomicHierarchy.derived.residue.traceElementIndex,this.polymerIt=tn.a.transientSegments(qn(t),t.elements),this.residueIt=Ee.Segmentation.transientSegments(t.model.atomicHierarchy.residueAtomSegments,t.elements),this.value=rn(e,t),this.hasNext=this.residueIt.hasNext&&this.polymerIt.hasNext}e.prototype.move=function(){if(0===this.state)for(;this.polymerIt.hasNext;)if(this.residueIt.setSegment(this.polymerIt.move()),this.residueIt.hasNext){this.residueSegment=this.residueIt.move(),this.value.centerB.element=this.traceElementIndex[this.residueSegment.index],this.state=2;break}if(2===this.state)this.residueSegment=this.residueIt.move(),this.value.centerA.element=this.value.centerB.element,this.value.centerB.element=this.traceElementIndex[this.residueSegment.index],this.residueIt.hasNext||(this.unit.model.atomicRanges.cyclicPolymerMap.has(this.residueSegment.index)?this.state=3:this.state=0);else if(3===this.state){var e=this.unit.model.atomicRanges.cyclicPolymerMap;this.value.centerA.element=this.value.centerB.element,this.value.centerB.element=this.traceElementIndex[e.get(this.residueSegment.index)],this.state=0}return this.hasNext=this.residueIt.hasNext||this.polymerIt.hasNext||3===this.state,this.value}})(),function(){function e(e,t){this.unit=t,this.state=0,this.hasNext=!1,this.polymerIt=tn.a.transientSegments(qn(t),t.elements),this.value=rn(e,t),this.hasNext=this.polymerIt.hasNext}e.prototype.move=function(){return 0===this.state&&this.polymerIt.hasNext&&(this.polymerSegment=this.polymerIt.move(),this.elementIndex=this.polymerSegment.start,this.elementIndex+1<this.polymerSegment.end?(this.value.centerB.element=this.unit.elements[this.elementIndex],this.state=1):this.state=0),1===this.state&&(this.elementIndex+=1,this.value.centerA.element=this.value.centerB.element,this.value.centerB.element=this.unit.elements[this.elementIndex],this.elementIndex+1>=this.polymerSegment.end&&(this.state=0)),this.hasNext=this.elementIndex+1<this.polymerSegment.end||this.polymerIt.hasNext,this.value}}();function nn(e,t){return{centerA:A.StructureElement.Location.create(e,t),centerB:A.StructureElement.Location.create(e,t)}}var an=function(){function e(e,t){this.unit=t,this.hasNext=!1,this.traceElementIndex=t.model.atomicHierarchy.derived.residue.traceElementIndex,this.gapIt=tn.a.transientSegments(Wn(t),t.elements),this.value=nn(e,t),this.hasNext=this.gapIt.hasNext}return e.prototype.move=function(){var e=this.unit,t=e.elements,r=e.residueIndex,n=this.gapIt.move();return this.value.centerA.element=this.traceElementIndex[r[t[n.start]]],this.value.centerB.element=this.traceElementIndex[r[t[n.end-1]]],this.hasNext=this.gapIt.hasNext,this.value},e}(),on=function(){function e(e,t){this.unit=t,this.hasNext=!1,this.gapIt=tn.a.transientSegments(Wn(t),t.elements),this.value=nn(e,t),this.hasNext=this.gapIt.hasNext}return e.prototype.move=function(){var e=this.gapIt.move();return this.value.centerA.element=this.unit.elements[e.start],this.value.centerB.element=this.unit.elements[e.end-1],this.hasNext=this.gapIt.hasNext,this.value},e}(),sn=r(181);function un(e,t,r){switch(void 0===r&&(r=!1),e.kind){case 0:return new mn(e,t,r);case 1:case 2:return new hn(e,t)}}var cn=Ne.SecondaryStructureType.create(536870912);function ln(e,t){return{center:A.StructureElement.Location.create(e,t),centerPrev:A.StructureElement.Location.create(e,t),centerNext:A.StructureElement.Location.create(e,t),first:!1,last:!1,initial:!1,final:!1,secStrucFirst:!1,secStrucLast:!1,secStrucType:cn,moleculeType:0,coarseBackboneFirst:!1,coarseBackboneLast:!1,isCoarseBackbone:!1,p0:Object(M.Vec3)(),p1:Object(M.Vec3)(),p2:Object(M.Vec3)(),p3:Object(M.Vec3)(),p4:Object(M.Vec3)(),d12:Object(M.Vec3)(),d23:Object(M.Vec3)()}}var dn=Object(M.Vec3)(),fn=Object(M.Vec3)(),pn=Object(M.Vec3)(),mn=function(){function e(e,t,r){var n;void 0===r&&(r=!1),this.unit=e,this.state=0,this.p0=Object(M.Vec3)(),this.p1=Object(M.Vec3)(),this.p2=Object(M.Vec3)(),this.p3=Object(M.Vec3)(),this.p4=Object(M.Vec3)(),this.p5=Object(M.Vec3)(),this.p6=Object(M.Vec3)(),this.d01=Object(M.Vec3)(),this.d12=Object(M.Vec3)(),this.d23=Object(M.Vec3)(),this.d34=Object(M.Vec3)(),this.hasNext=!1,this.atomicConformation=e.model.atomicConformation,this.residueAtomSegments=e.model.atomicHierarchy.residueAtomSegments,this.polymerRanges=e.model.atomicRanges.polymerRanges,this.traceElementIndex=e.model.atomicHierarchy.derived.residue.traceElementIndex,this.directionFromElementIndex=e.model.atomicHierarchy.derived.residue.directionFromElementIndex,this.directionToElementIndex=e.model.atomicHierarchy.derived.residue.directionToElementIndex,this.moleculeType=e.model.atomicHierarchy.derived.residue.moleculeType,this.cyclicPolymerMap=e.model.atomicRanges.cyclicPolymerMap,this.polymerIt=tn.a.transientSegments(this.polymerRanges,e.elements),this.residueIt=Ee.Segmentation.transientSegments(this.residueAtomSegments,e.elements),this.value=ln(t,e),this.hasNext=this.residueIt.hasNext&&this.polymerIt.hasNext;var i=!r&&(null===(n=sn.a.get(t).value)||void 0===n?void 0:n.get(e.invariantId));if(i){var a=i.type,o=i.getIndex;this.getSecStruc=function(e){return a[o(e)]}}else this.getSecStruc=function(e){return cn}}return e.prototype.pos=function(e,t){-1!==t&&(e[0]=this.atomicConformation.x[t],e[1]=this.atomicConformation.y[t],e[2]=this.atomicConformation.z[t])},e.prototype.updateResidueSegmentRange=function(e){var t=this.residueAtomSegments.index;this.residueSegmentMin=t[this.polymerRanges[2*e.index]],this.residueSegmentMax=t[this.polymerRanges[2*e.index+1]]},e.prototype.getResidueIndex=function(e){if(e<this.residueSegmentMin)e=void 0!==(t=this.cyclicPolymerMap.get(this.residueSegmentMin))?t-(this.residueSegmentMin-e-1):this.residueSegmentMin;else if(e>this.residueSegmentMax){var t;e=void 0!==(t=this.cyclicPolymerMap.get(this.residueSegmentMax))?t+(e-this.residueSegmentMax-1):this.residueSegmentMax}return e},e.prototype.setControlPoint=function(e,t,r,n,i){var a=this.getSecStruc(i);Ne.SecondaryStructureType.is(a,4)?M.Vec3.scale(e,M.Vec3.add(e,t,M.Vec3.add(e,n,M.Vec3.add(e,r,r))),1/4):M.Vec3.copy(e,r)},e.prototype.setFromToVector=function(e,t){this.value.isCoarseBackbone?M.Vec3.set(e,1,0,0):(this.pos(fn,this.directionFromElementIndex[t]),this.pos(pn,this.directionToElementIndex[t]),M.Vec3.sub(e,pn,fn))},e.prototype.setDirection=function(e,t,r,n){M.Vec3.matchDirection(fn,t,r),M.Vec3.matchDirection(pn,n,r),M.Vec3.scale(e,M.Vec3.add(e,fn,M.Vec3.add(e,pn,M.Vec3.add(e,r,r))),1/4)},e.prototype.move=function(){var e=this.residueIt,t=this.polymerIt,r=this.value;if(0===this.state)for(;t.hasNext;)if(this.polymerSegment=t.move(),e.setSegment(this.polymerSegment),this.updateResidueSegmentRange(this.polymerSegment),e.hasNext){this.state=1;var n=this.residueAtomSegments.index[this.unit.elements[this.polymerSegment.start]],i=this.getResidueIndex(n-1);this.currSecStrucType=n===i?cn:this.getSecStruc(i),this.nextSecStrucType=this.getSecStruc(n),this.currCoarseBackbone=-1===this.directionFromElementIndex[i]||-1===this.directionToElementIndex[i],this.nextCoarseBackbone=-1===this.directionFromElementIndex[n]||-1===this.directionToElementIndex[n];break}if(1===this.state){var a=e.move().index,o=this.getResidueIndex(a-3),s=this.getResidueIndex(a-2),u=this.getResidueIndex(a-1),c=this.getResidueIndex(a+1),l=this.getResidueIndex(a+2),d=this.getResidueIndex(a+3);this.prevSecStrucType=this.currSecStrucType,this.currSecStrucType=this.nextSecStrucType,this.nextSecStrucType=a===c?cn:this.getSecStruc(c),this.prevCoarseBackbone=this.currCoarseBackbone,this.currCoarseBackbone=this.nextCoarseBackbone,this.nextCoarseBackbone=a!==c&&(-1===this.directionFromElementIndex[c]||-1===this.directionToElementIndex[c]),r.secStrucType=this.currSecStrucType,r.secStrucFirst=this.prevSecStrucType!==this.currSecStrucType,r.secStrucLast=this.currSecStrucType!==this.nextSecStrucType,r.isCoarseBackbone=this.currCoarseBackbone,r.coarseBackboneFirst=this.prevCoarseBackbone!==this.currCoarseBackbone,r.coarseBackboneLast=this.currCoarseBackbone!==this.nextCoarseBackbone,r.first=a===this.residueSegmentMin,r.last=a===this.residueSegmentMax,r.moleculeType=this.moleculeType[a],r.isCoarseBackbone=-1===this.directionFromElementIndex[a]||-1===this.directionToElementIndex[a],r.initial=a===u,r.final=a===c,r.centerPrev.element=this.traceElementIndex[u],r.center.element=this.traceElementIndex[a],r.centerNext.element=this.traceElementIndex[c],this.pos(this.p0,this.traceElementIndex[o]),this.pos(this.p1,this.traceElementIndex[s]),this.pos(this.p2,this.traceElementIndex[u]),this.pos(this.p3,this.traceElementIndex[a]),this.pos(this.p4,this.traceElementIndex[c]),this.pos(this.p5,this.traceElementIndex[l]),this.pos(this.p6,this.traceElementIndex[d]),this.setFromToVector(this.d01,u),this.setFromToVector(this.d12,a),this.setFromToVector(this.d23,c),this.setFromToVector(this.d34,l);var f=.5;a===u?(M.Vec3.scale(dn,M.Vec3.sub(dn,this.p3,this.p4),f),M.Vec3.add(this.p2,this.p3,dn),M.Vec3.add(this.p1,this.p2,dn),M.Vec3.add(this.p0,this.p1,dn)):u===s?(M.Vec3.scale(dn,M.Vec3.sub(dn,this.p2,this.p3),f),M.Vec3.add(this.p1,this.p2,dn),M.Vec3.add(this.p0,this.p1,dn)):s===o&&(M.Vec3.scale(dn,M.Vec3.sub(dn,this.p1,this.p2),f),M.Vec3.add(this.p0,this.p1,dn)),a===c?(M.Vec3.scale(dn,M.Vec3.sub(dn,this.p3,this.p2),f),M.Vec3.add(this.p4,this.p3,dn),M.Vec3.add(this.p5,this.p4,dn),M.Vec3.add(this.p6,this.p5,dn)):c===l?(M.Vec3.scale(dn,M.Vec3.sub(dn,this.p4,this.p3),f),M.Vec3.add(this.p5,this.p4,dn),M.Vec3.add(this.p6,this.p5,dn)):l===d&&(M.Vec3.scale(dn,M.Vec3.sub(dn,this.p5,this.p4),f),M.Vec3.add(this.p6,this.p5,dn)),this.setControlPoint(r.p0,this.p0,this.p1,this.p2,s),this.setControlPoint(r.p1,this.p1,this.p2,this.p3,u),this.setControlPoint(r.p2,this.p2,this.p3,this.p4,a),this.setControlPoint(r.p3,this.p3,this.p4,this.p5,c),this.setControlPoint(r.p4,this.p4,this.p5,this.p6,l),this.setDirection(r.d12,this.d01,this.d12,this.d23),this.setDirection(r.d23,this.d12,this.d23,this.d34),e.hasNext||(this.state=0)}return this.hasNext=e.hasNext||t.hasNext,this.value},e}(),hn=function(){function e(e,t){switch(this.unit=e,this.state=0,this.hasNext=!1,this.polymerIt=tn.a.transientSegments(qn(e),e.elements),this.value=ln(t,e),M.Vec3.set(this.value.d12,1,0,0),M.Vec3.set(this.value.d23,1,0,0),e.kind){case 1:this.conformation=e.model.coarseConformation.spheres;break;case 2:this.conformation=e.model.coarseConformation.gaussians}this.hasNext=this.polymerIt.hasNext}return e.prototype.getElementIndex=function(e){return Math.min(Math.max(this.polymerSegment.start,e),this.polymerSegment.end-1)},e.prototype.pos=function(e,t){var r=this.unit.elements[t];e[0]=this.conformation.x[r],e[1]=this.conformation.y[r],e[2]=this.conformation.z[r]},e.prototype.move=function(){if(0===this.state)for(;this.polymerIt.hasNext;)if(this.polymerSegment=this.polymerIt.move(),this.elementIndex=this.polymerSegment.start,this.elementIndex<this.polymerSegment.end){this.state=1;break}if(1===this.state){var e=this.getElementIndex(this.elementIndex-2),t=this.getElementIndex(this.elementIndex-1),r=this.getElementIndex(this.elementIndex+1),n=this.getElementIndex(this.elementIndex+2);this.value.centerPrev.element=this.value.center.unit.elements[t],this.value.center.element=this.value.center.unit.elements[this.elementIndex],this.value.centerNext.element=this.value.center.unit.elements[r],this.pos(this.value.p0,e),this.pos(this.value.p1,t),this.pos(this.value.p2,this.elementIndex),this.pos(this.value.p3,r),this.pos(this.value.p4,n);var i=.5;this.elementIndex===t?(M.Vec3.scale(dn,M.Vec3.sub(dn,this.value.p2,this.value.p3),i),M.Vec3.add(this.value.p1,this.value.p2,dn),M.Vec3.add(this.value.p0,this.value.p1,dn)):t===e&&(M.Vec3.scale(dn,M.Vec3.sub(dn,this.value.p1,this.value.p2),i),M.Vec3.add(this.value.p0,this.value.p1,dn)),this.elementIndex===r?(M.Vec3.scale(dn,M.Vec3.sub(dn,this.value.p2,this.value.p1),i),M.Vec3.add(this.value.p3,this.value.p2,dn),M.Vec3.add(this.value.p4,this.value.p3,dn)):r===n&&(M.Vec3.scale(dn,M.Vec3.sub(dn,this.value.p3,this.value.p2),i),M.Vec3.add(this.value.p4,this.value.p3,dn)),this.value.first=this.elementIndex===this.polymerSegment.start,this.value.last=this.elementIndex===this.polymerSegment.end-1,this.elementIndex+1>=this.polymerSegment.end&&(this.state=0)}return this.hasNext=this.elementIndex+1<this.polymerSegment.end||this.polymerIt.hasNext,this.elementIndex+=1,this.value},e}(),gn=r(70),vn=M.Vec3.fromArray,bn=M.Vec3.toArray,yn=M.Vec3.normalize,_n=M.Vec3.sub,Sn=M.Vec3.spline,xn=M.Vec3.slerp,On=M.Vec3.copy,wn=M.Vec3.cross,Cn=M.Vec3.orthogonalize,jn=M.Vec3.matchDirection;function Pn(e){var t=e+1,r=3*t;return{curvePoints:new Float32Array(r),tangentVectors:new Float32Array(r),normalVectors:new Float32Array(r),binormalVectors:new Float32Array(r),widthValues:new Float32Array(t),heightValues:new Float32Array(t),linearSegments:e}}function En(e,t,r,n){!function(e,t,r,n){for(var i=e.curvePoints,a=e.tangentVectors,o=e.linearSegments,s=t.p0,u=t.p1,c=t.p2,l=t.p3,d=t.p4,f=t.secStrucFirst,p=t.secStrucLast,m=1-n,h=f?.5:r,g=p?.5:r,v=0;v<=o;++v){var b=1*v/o;if(b<m){var y=Object(gn.b)(h,r,b);Sn(Tn,s,u,c,l,b+n,y),Sn(An,s,u,c,l,b+n+.01,h),Sn(Dn,s,u,c,l,b+n-.01,h)}else{y=Object(gn.b)(r,g,b);Sn(Tn,u,c,l,d,b-m,y),Sn(An,u,c,l,d,b-m+.01,y),Sn(Dn,u,c,l,d,b-m-.01,y)}bn(Tn,i,3*v),yn(Mn,_n(Mn,An,Dn)),bn(Mn,a,3*v)}}(e,t,r,n),function(e,t){var r=e.curvePoints,n=e.tangentVectors,i=e.normalVectors,a=e.binormalVectors,o=t.d12,s=t.d23,u=r.length/3;vn(Rn,n,0),vn(Ln,n,3*(u-1)),Cn(Nn,Rn,o),Cn(Fn,Ln,s),jn(Fn,Fn,Nn),On(Vn,Nn);for(var c=0;c<u;++c){var l=0===c?0:1/(u-c);vn(Mn,n,3*c),Cn(kn,Mn,xn(In,Vn,Fn,l)),bn(kn,i,3*c),On(Vn,kn),yn(Bn,wn(Bn,Mn,kn)),bn(Bn,a,3*c)}}(e,t)}var An=Object(M.Vec3)(),Dn=Object(M.Vec3)(),Tn=Object(M.Vec3)();var In=Object(M.Vec3)(),Mn=Object(M.Vec3)(),kn=Object(M.Vec3)(),Bn=Object(M.Vec3)(),Vn=Object(M.Vec3)(),Rn=Object(M.Vec3)(),Ln=Object(M.Vec3)(),Nn=Object(M.Vec3)(),Fn=Object(M.Vec3)();function Un(e,t,r,n,i,a,o,s){for(var u=e.widthValues,c=e.heightValues,l=e.linearSegments,d=1-s,f=0;f<=l;++f){var p=1*f/l;p<d?(u[f]=Object(gn.b)(t,r,p+s),c[f]=Object(gn.b)(i,a,p+s)):(u[f]=Object(gn.b)(r,n,p-d),c[f]=Object(gn.b)(a,o,p-d))}}var zn,Hn,Gn;function qn(e){switch(e.kind){case 0:return e.model.atomicRanges.polymerRanges;case 1:return e.model.coarseHierarchy.spheres.polymerRanges;case 2:return e.model.coarseHierarchy.gaussians.polymerRanges}}function Wn(e){switch(e.kind){case 0:return e.model.atomicRanges.gapRanges;case 1:return e.model.coarseHierarchy.spheres.gapRanges;case 2:return e.model.coarseHierarchy.gaussians.gapRanges}}function Xn(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i];if(A.Unit.isAtomic(s))return Object(ze.g)(o,s,s.polymerElements[a]);var u=s.elements,c=s.polymerElements[a],l=Ee.OrderedSet.indexOf(u,c);if(-1!==l){var d=Ee.OrderedSet.ofSingleton(l);return A.StructureElement.Loci(o,[{unit:s,indices:d}])}}return me.EmptyLoci}function Yn(e,t,r,n,i,a){for(var o=-1,s=-1,u=i;u<=a;u++){if(!((l=r[u])<0)&&(o=Ee.OrderedSet.indexOf(t,l))>=0){s=u;break}}if(o<0)return!1;var c=o;for(u=a;u>s;u--){var l;if(!((l=r[u])<0)){var d=Ee.OrderedSet.indexOf(t,l);if(d>=0){c=d;break}}}return n(Ee.Interval.ofRange(e+o,e+c))}function Qn(e,t,r,n,i){var a=!1,o=i.unit.elements,s=i.unit.model.atomicHierarchy.derived.residue.traceElementIndex,u=i.unit.model.atomicHierarchy.residueAtomSegments.index,c=r(i.unit);if(Ee.Interval.is(i.indices))a=0===Ee.Interval.start(i.indices)&&Ee.Interval.end(i.indices)===i.unit.elements.length?n(Ee.Interval.ofBounds(e,e+t))||a:Yn(e,c,s,n,p=u[o[Ee.Interval.min(i.indices)]],m=u[o[Ee.Interval.max(i.indices)]])||a;else for(var l=i.indices,d=0,f=l.length;d<f;d++){for(var p,m=p=u[o[l[d]]],h=d+1;h<f;){var g=u[o[l[h]]];if(g-m>1)break;m=g,h++}d=h-1,a=Yn(e,c,s,n,p,m)||a}return a}function Kn(e){return e.polymerElements}function Zn(e,t,r){var n=!1;if(!A.StructureElement.Loci.is(e))return!1;var i=t.structure,a=t.group;if(!A.Structure.areEquivalent(e.structure,i))return!1;for(var o=a.units[0].polymerElements.length,s=0,u=e.elements;s<u.length;s++){var c=u[s];if(a.unitIndexMap.has(c.unit.id)){var l=a.unitIndexMap.get(c.unit.id)*o;if(A.Unit.isAtomic(c.unit))n=Qn(l,o,Kn,r,c)||n;else if(Ee.Interval.is(c.indices)){var d=l+Ee.Interval.start(c.indices),f=l+Ee.Interval.end(c.indices);n=r(Ee.Interval.ofBounds(d,f))||n}else for(var p=0,m=c.indices.length;p<m;p++){d=c.indices[p];for(var h=p+1;h<m&&c.indices[h]===d;)h++;p=h-1;f=c.indices[p];n=r(Ee.Interval.ofRange(l+d,l+f))||n}}}return n}function Jn(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i],u=Ee.OrderedSet.indexOf(s.elements,s.gapElements[a]),c=Ee.OrderedSet.indexOf(s.elements,s.gapElements[a%2?a-1:a+1]);if(-1!==u&&-1!==c)return A.Bond.Loci(o,[A.Bond.Location(o,s,u,o,s,c),A.Bond.Location(o,s,c,o,s,u)])}return me.EmptyLoci}function $n(e,t,r){var n=!1;if(A.Bond.isLoci(e)){var i=t.structure,a=t.group;if(!A.Structure.areRootsEquivalent(e.structure,i))return!1;e=A.Bond.remapLoci(e,i);for(var o=a.units[0].gapElements.length,s=0,u=e.bonds;s<u.length;s++){var c=u[s],l=a.unitIndexMap.get(c.aUnit.id);if(void 0!==l){var d=Ee.OrderedSet.indexOf(c.aUnit.gapElements,c.aUnit.elements[c.aIndex]),f=Ee.OrderedSet.indexOf(c.bUnit.gapElements,c.bUnit.elements[c.bIndex]);-1!==d&&-1!==f&&r(Ee.Interval.ofSingleton(l*o+d))&&(n=!0)}}}else if(A.StructureElement.Loci.is(e)){i=t.structure,a=t.group;if(!A.Structure.areRootsEquivalent(e.structure,i))return!1;e=A.StructureElement.Loci.remap(e,i);for(var p=a.units[0].gapElements.length,m=function(e){var t=a.unitIndexMap.get(e.unit.id);void 0!==t&&Ee.OrderedSet.forEach(e.indices,(function(i){var a=Ee.OrderedSet.indexOf(e.unit.gapElements,e.unit.elements[i]);-1!==a&&r(Ee.Interval.ofSingleton(t*p+a))&&(n=!0)}))},h=0,g=e.elements;h<g.length;h++){m(g[h])}}return n}function ei(e,t,r){var n=e.objectId,i=e.instanceId,a=e.groupId;if(r===n){var o=t.structure,s=t.group.units[i];if(A.Unit.isAtomic(s))return Object(ze.g)(o,s,s.nucleotideElements[a])}return me.EmptyLoci}function ti(e){return e.nucleotideElements}function ri(e,t,r){var n=!1;if(!A.StructureElement.Loci.is(e))return!1;var i=t.structure,a=t.group;if(!A.Structure.areEquivalent(e.structure,i))return!1;var o=a.units[0];if(!A.Unit.isAtomic(o))return!1;for(var s=o.nucleotideElements.length,u=0,c=e.elements;u<c.length;u++){var l=c[u];if(A.Unit.isAtomic(l.unit)&&a.unitIndexMap.has(l.unit.id)){var d=a.unitIndexMap.get(l.unit.id)*s;A.Unit.isAtomic(l.unit)&&(n=Qn(d,s,ti,r,l)||n)}}return n}(zn||(zn={})).fromGroup=function(e){var t=e.group,r=e.structure,n=t.units[0].polymerElements,i=n.length,a=t.units.length,o=A.StructureElement.Location.create(r);return Object(Fe.a)(i,a,1,(function(e,r){var i=t.units[r];return o.unit=i,o.element=n[e],o}))},(Hn||(Hn={})).fromGroup=function(e){var t=e.group,r=e.structure,n=t.units[0].gapElements,i=n.length,a=t.units.length,o=A.StructureElement.Location.create(r);return Object(Fe.a)(i,a,1,(function(e,r){var i=t.units[r];return o.unit=i,o.element=n[e],o}))},(Gn||(Gn={})).fromGroup=function(e){var t=e.group,r=e.structure,n=t.units[0],i=A.Unit.isAtomic(n)?n.nucleotideElements:[],a=i.length,o=t.units.length,s=A.StructureElement.Location.create(r);return Object(Fe.a)(a,o,1,(function(e,r){var n=t.units[r];return s.unit=n,s.element=i[e],s}))};var ni=M.Vec3.zero(),ii=M.Vec3.zero(),ai=M.Vec3.zero(),oi=M.Vec3.zero(),si=M.Vec3.zero(),ui=M.Vec3.zero(),ci=M.Vec3.zero(),li=M.Vec3.zero(),di=M.Vec3.zero(),fi=M.Vec3.zero(),pi=M.Mat4.identity(),mi=M.Vec3.zero(),hi=Object($t.a)(),gi={sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01}),radialSegments:d.ParamDefinition.Numeric(16,{min:2,max:56,step:2},Bt.a.CustomQualityParamInfo)};d.ParamDefinition.getDefaultValues(gi);function vi(e,t,r,n,i,a){if(!A.Unit.isAtomic(t))return Ve.a.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return Ve.a.createEmpty(a);for(var s=i.sizeFactor,u=i.radialSegments,c=o*(hi.vertices.length/3+2*u),l=_t.a.createState(c,c/4,a),d=t.elements,f=t.model,p=f.atomicHierarchy,m=p.chainAtomSegments,h=p.residueAtomSegments,g=p.atoms,v=p.index,b=f.atomicHierarchy.derived.residue,y=b.moleculeType,_=b.traceElementIndex,S=g.label_comp_id,x=t.conformation.invariantPosition,O=Ee.Segmentation.transientSegments(m,d),w=Ee.Segmentation.transientSegments(h,d),C={radiusTop:1*s,radiusBottom:1*s,radialSegments:u,bottomCap:!0},j=0;O.hasNext;)for(w.setSegment(O.move());w.hasNext;){var P=w.move().index;if(Object(Ne.isNucleic)(y[P])){var E=S.value(h.offsets[P]),D=-1,I=-1,k=-1,B=-1,V=-1,R=-1,L=4.5,N=2.5*s,F=Object(Ne.isPurineBase)(E),U=Object(Ne.isPyrimidineBase)(E);if(!F&&!U){var z=v.findAtomOnResidue(P,"C4"),H=v.findAtomOnResidue(P,"N9");-1!==z&&-1!==H&&M.Vec3.distance(x(z,ni),x(H,ii))<1.6?F=!0:U=!0}F?(L=4.5,D=v.findAtomOnResidue(P,"N1"),I=v.findAtomOnResidue(P,"C4"),k=v.findAtomOnResidue(P,"C6"),B=v.findAtomOnResidue(P,"C2"),V=v.findAtomOnResidue(P,"N9"),R=_[P]):U&&(L=3,D=v.findAtomOnResidue(P,"N3"),I=v.findAtomOnResidue(P,"C6"),k=v.findAtomOnResidue(P,"C4"),B=v.findAtomOnResidue(P,"C2"),-1===(V=v.findAtomOnResidue(P,"N1"))&&(V=v.findAtomOnResidue(P,"C1")),R=_[P]),-1!==V&&-1!==R&&(x(V,si),x(R,ui),l.currentGroup=j,Object(en.a)(l,si,ui,1,C),-1!==D&&-1!==I&&-1!==k&&-1!==B&&(x(D,ni),x(I,ii),x(k,ai),x(B,oi),M.Vec3.normalize(ci,M.Vec3.sub(ci,ii,ni)),M.Vec3.normalize(li,M.Vec3.sub(li,oi,ai)),M.Vec3.normalize(di,M.Vec3.cross(di,ci,li)),M.Mat4.targetTo(pi,ni,ii,di),M.Vec3.scaleAndAdd(fi,ni,ci,L/2-.2),M.Mat4.scale(pi,pi,M.Vec3.set(mi,4.5,N,L)),M.Mat4.setTranslation(pi,fi),_t.a.addPrimitive(l,pi,hi))),++j}}var G=_t.a.getMesh(l),q=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return G.setBoundingSphere(q),G}var bi=Object(o.__assign)(Object(o.__assign)({},Le.g),gi);function yi(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(bi),createGeometry:vi,createLocationIterator:Gn.fromGroup,getLoci:ei,eachLocation:ri,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments}},e)}var _i=M.Vec3.zero(),Si=M.Vec3.zero(),xi=M.Vec3.zero(),Oi=M.Vec3.zero(),wi=M.Vec3.zero(),Ci=M.Vec3.zero(),ji=M.Vec3.zero(),Pi=M.Vec3.zero(),Ei=M.Vec3.zero(),Ai=M.Vec3.zero(),Di=M.Vec3.zero(),Ti={sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01}),radialSegments:d.ParamDefinition.Numeric(16,{min:2,max:56,step:2},Bt.a.CustomQualityParamInfo),detail:d.ParamDefinition.Numeric(0,{min:0,max:3,step:1},Bt.a.CustomQualityParamInfo)},Ii=(d.ParamDefinition.getDefaultValues(Ti),new Float32Array(54)),Mi=new Uint32Array([0,1,2,3,4,5,6,7,16,17,14,15,12,13,8,9,10,11,0,1]),ki=new Uint32Array([8,12,14,16,6,4,2,0,10]),Bi=new Uint32Array([9,11,1,3,5,7,17,15,13]),Vi=new Float32Array(36),Ri=new Uint32Array([0,1,2,3,4,5,6,7,8,9,10,11,0,1]),Li=new Uint32Array([0,10,8,6,4,2]),Ni=new Uint32Array([1,3,5,7,9,11]),Fi=M.Vec3.zero();function Ui(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];for(var i=0,a=r.length;i<a;++i){var o=r[i];M.Vec3.toArray(M.Vec3.add(Fi,o,t),e,2*i*3),M.Vec3.toArray(M.Vec3.sub(Fi,o,t),e,3*(2*i+1))}}function zi(e,t,r,n,i,a){if(!A.Unit.isAtomic(t))return Ve.a.createEmpty(a);var o=t.nucleotideElements.length;if(!o)return Ve.a.createEmpty(a);for(var s=i.sizeFactor,u=i.radialSegments,c=i.detail,l=o*(26+2*u),d=_t.a.createState(l,l/4,a),f=t.elements,p=t.model,m=p.atomicHierarchy,h=m.chainAtomSegments,g=m.residueAtomSegments,v=m.atoms,b=m.index,y=p.atomicHierarchy.derived.residue,_=y.moleculeType,S=y.traceElementIndex,x=v.label_comp_id,O=t.conformation.invariantPosition,w=Ee.Segmentation.transientSegments(h,f),C=Ee.Segmentation.transientSegments(g,f),j=1*s,P=1.25*s,E={radiusTop:1*s,radiusBottom:1*s,radialSegments:u},D=0;w.hasNext;)for(C.setSegment(w.move());C.hasNext;){var I=C.move().index;if(Object(Ne.isNucleic)(_[I])){var k=x.value(g.offsets[I]),B=-1,V=-1,R=-1,L=-1,N=-1,F=-1,U=-1,z=-1,H=-1,G=-1;d.currentGroup=D;var q=Object(Ne.isPurineBase)(k),W=Object(Ne.isPyrimidineBase)(k);if(!q&&!W){var X=b.findAtomOnResidue(I,"C4"),Y=b.findAtomOnResidue(I,"N9");-1!==X&&-1!==Y&&M.Vec3.distance(O(X,wi),O(Y,Ai))<1.6?q=!0:W=!0}q?(B=S[I],V=b.findAtomOnResidue(I,"N1"),R=b.findAtomOnResidue(I,"C2"),L=b.findAtomOnResidue(I,"N3"),N=b.findAtomOnResidue(I,"C4"),-1===(F=b.findAtomOnResidue(I,"C5"))&&(F=b.findAtomOnResidue(I,"N5")),U=b.findAtomOnResidue(I,"C6"),-1===(z=b.findAtomOnResidue(I,"N7"))&&(z=b.findAtomOnResidue(I,"C7")),H=b.findAtomOnResidue(I,"C8"),-1!==(G=b.findAtomOnResidue(I,"N9"))&&-1!==B&&(O(G,Ai),O(B,_i),d.currentGroup=D,Object(en.a)(d,Ai,_i,1,E),Object(St.a)(d,Ai,j,c)),-1!==V&&-1!==R&&-1!==L&&-1!==N&&-1!==F&&-1!==U&&-1!==z&&-1!==H&&-1!==G&&(O(V,Si),O(R,xi),O(L,Oi),O(N,wi),O(F,Ci),O(U,ji),O(z,Pi),O(H,Ei),M.Vec3.triangleNormal(Di,Si,wi,Ci),M.Vec3.scale(Di,Di,P),Ui(Ii,Di,Si,xi,Oi,wi,Ci,ji,Pi,Ei,Ai),_t.a.addTriangleStrip(d,Ii,Mi),_t.a.addTriangleFan(d,Ii,ki),_t.a.addTriangleFan(d,Ii,Bi))):W&&(B=S[I],-1===(V=b.findAtomOnResidue(I,"N1"))&&(V=b.findAtomOnResidue(I,"C1")),R=b.findAtomOnResidue(I,"C2"),L=b.findAtomOnResidue(I,"N3"),N=b.findAtomOnResidue(I,"C4"),F=b.findAtomOnResidue(I,"C5"),U=b.findAtomOnResidue(I,"C6"),-1!==V&&-1!==B&&(O(V,Si),O(B,_i),d.currentGroup=D,Object(en.a)(d,Si,_i,1,E),Object(St.a)(d,Si,j,c)),-1!==V&&-1!==R&&-1!==L&&-1!==N&&-1!==F&&-1!==U&&(O(R,xi),O(L,Oi),O(N,wi),O(F,Ci),O(U,ji),M.Vec3.triangleNormal(Di,Si,wi,Ci),M.Vec3.scale(Di,Di,P),Ui(Vi,Di,Si,xi,Oi,wi,Ci,ji),_t.a.addTriangleStrip(d,Vi,Ri),_t.a.addTriangleFan(d,Vi,Li),_t.a.addTriangleFan(d,Vi,Ni))),++D}}var Q=_t.a.getMesh(d),K=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return Q.setBoundingSphere(K),Q}var Hi=Object(o.__assign)(Object(o.__assign)({},Le.g),Ti);function Gi(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(Hi),createGeometry:zi,createLocationIterator:Gn.fromGroup,getLoci:ei,eachLocation:ri,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments}},e)}var qi,Wi=M.Vec3.zero(),Xi=M.Vec3.zero(),Yi=M.Vec3.zero(),Qi=M.Vec3.zero(),Ki=Object(tr.a)(3,!1);var Zi=M.Mat4.identity(),Ji=M.Vec3.zero(),$i=M.Vec3.zero(),ea=M.Vec3.zero(),ta=M.Vec3.zero(),ra=(qi||(qi=function(){for(var e=Object(er.a)(8),t=0;t<3;++t){var r=(t+1)%3;M.Vec3.set(Wi,Ki[3*t],Ki[3*t+1],-.5),M.Vec3.set(Xi,Ki[3*r],Ki[3*r+1],-.5),M.Vec3.set(Yi,Ki[3*r],Ki[3*r+1],.5),M.Vec3.set(Qi,Ki[3*t],Ki[3*t+1],.5),e.add(Wi,Xi,Yi),e.add(Yi,Qi,Wi)}return M.Vec3.set(Wi,Ki[0],Ki[1],-.5),M.Vec3.set(Xi,Ki[3],Ki[4],-.5),M.Vec3.set(Yi,Ki[6],Ki[7],-.5),e.add(Yi,Xi,Wi),M.Vec3.set(Wi,Ki[0],Ki[1],.5),M.Vec3.set(Xi,Ki[3],Ki[4],.5),M.Vec3.set(Yi,Ki[6],Ki[7],.5),e.add(Wi,Xi,Yi),e.getPrimitive()}()),qi),na={sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01})};d.ParamDefinition.getDefaultValues(na);function ia(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return Ve.a.createEmpty(a);for(var s=i.sizeFactor,u=24*o,c=_t.a.createState(u,u/10,a),l=Pn(1),d=l.normalVectors,f=l.binormalVectors,p=0,m=un(t,r);m.hasNext;){var h=m.move();c.currentGroup=p;var g=Object(Ne.isNucleic)(h.moleculeType),v=Ne.SecondaryStructureType.is(h.secStrucType,4);if(En(l,h,g||v?.5:.9,g?.3:.5),v&&!h.secStrucLast||!v){var b=n.size.size(h.center)*s,y=4*b,_=4*b,S=6*b,x=g?f:d;M.Vec3.fromArray($i,x,0),M.Vec3.fromArray(ea,x,3),M.Vec3.normalize(ta,M.Vec3.add(ta,$i,ea)),M.Mat4.targetTo(Zi,h.p3,h.p1,ta),M.Mat4.mul(Zi,Zi,M.Mat4.rotY90Z180),M.Mat4.scale(Zi,Zi,M.Vec3.set(Ji,S,_,y)),M.Mat4.setTranslation(Zi,h.p2),_t.a.addPrimitive(c,Zi,ra)}++p}var O=_t.a.getMesh(c),w=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return O.setBoundingSphere(w),O}var aa=Object(o.__assign)(Object(o.__assign)({},Le.g),na);function oa(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(aa),createGeometry:ia,createLocationIterator:zn.fromGroup,getLoci:Xn,eachLocation:Zn,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor}},e)}var sa={sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01}),radialSegments:d.ParamDefinition.Numeric(16,{min:2,max:56,step:2},Bt.a.CustomQualityParamInfo)};d.ParamDefinition.getDefaultValues(sa);function ua(e,t,r,n,i,a){var o=t.gapElements.length;if(!o)return Ve.a.createEmpty(a);for(var s=i.sizeFactor,u=i.radialSegments,c=10*u*2*o*2,l=_t.a.createState(c,c/10,a),d=t.conformation.invariantPosition,f=M.Vec3.zero(),p=M.Vec3.zero(),m={radiusTop:1,radiusBottom:1,topCap:!0,bottomCap:!0,radialSegments:u},h=0,g=function(e,t){switch(t.kind){case 0:return new an(e,t);case 1:case 2:return new on(e,t)}}(r,t);g.hasNext;){var v=g.move(),b=v.centerA,y=v.centerB;b.element===y.element||(d(b.element,f),d(y.element,p),m.radiusTop=m.radiusBottom=n.size.size(b)*s,l.currentGroup=h,Object(en.c)(l,f,p,.5,10,m),m.radiusTop=m.radiusBottom=n.size.size(y)*s,l.currentGroup=h+1,Object(en.c)(l,p,f,.5,10,m)),h+=2}var _=_t.a.getMesh(l),S=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return _.setBoundingSphere(S),_}var ca=Object(o.__assign)(Object(o.__assign)({},Le.g),sa);function la(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(ca),createGeometry:ua,createLocationIterator:Hn.fromGroup,getLoci:Jn,eachLocation:$n,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.radialSegments!==r.radialSegments}},e)}var da=Object(M.Vec3)(),fa=Object(M.Vec3)(),pa=Object(M.Vec3)(),ma=Object(M.Vec3)(),ha=Object(M.Vec3)(),ga=Object(M.Vec3)(),va=Object(M.Vec3)(),ba=Object(M.Vec3)(),ya=Object(M.Vec3)(),_a=Object(M.Vec3)(),Sa=Object(M.Vec3)(),xa=Object(M.Vec3)(),Oa=Object(M.Vec3)(),wa=Object(M.Vec3)(),Ca=Object(M.Vec3)(),ja=M.Vec3.fromArray,Pa=M.Vec3.scale,Ea=M.Vec3.add,Aa=M.Vec3.sub,Da=M.Vec3.magnitude,Ta=M.Vec3.negate,Ia=M.Vec3.copy,Ma=M.Vec3.cross,ka=y.a.add3,Ba=y.a.add;function Va(e,t,r,n,i,a,o,s){var u=t.vertices,c=t.normals,l=t.indices,d=u.elementCount;ja(va,n,e),Pa(va,va,o),ja(ga,n,e),Pa(ga,ga,s),ja(ma,i,e),Pa(ma,ma,a),ja(ya,r,e),Ea(xa,Ea(xa,ya,ma),ga),Aa(Oa,Ea(Oa,ya,ma),va),Aa(wa,Aa(wa,ya,ma),va),Ea(Ca,Aa(Ca,ya,ma),ga),o<s?(ka(u,Ca[0],Ca[1],Ca[2]),ka(u,wa[0],wa[1],wa[2]),ka(u,Oa[0],Oa[1],Oa[2]),ka(u,xa[0],xa[1],xa[2]),Ia(ha,ga)):(ka(u,xa[0],xa[1],xa[2]),ka(u,Oa[0],Oa[1],Oa[2]),ka(u,wa[0],wa[1],wa[2]),ka(u,Ca[0],Ca[1],Ca[2]),Ia(ha,va)),Ma(_a,ma,ha);for(var f=0;f<4;++f)ka(c,_a[0],_a[1],_a[2]);ka(l,d+2,d+1,d),ka(l,d,d+3,d+2)}function Ra(e,t,r,n,i,a,o,s,u,c){var l=e.currentGroup,d=e.vertices,f=e.normals,p=e.indices,m=e.groups,h=d.elementCount,g=0;s>0&&(ja(da,t,0),ja(fa,t,3*i),g=s/Da(Aa(pa,fa,da)));for(var v=0;v<=i;++v){var b=a[v],y=o[v],_=0===s?y:s*(1-v/i),S=3*v;ja(ha,r,S),Pa(ha,ha,_),ja(ma,n,S),Pa(ma,ma,b),s>0&&(ja(da,r,S),ja(fa,n,S),Pa(ba,Ma(ba,da,fa),g)),ja(ya,t,S),ja(_a,r,S),ja(Sa,n,S),Ea(da,Ea(da,ya,ma),ha),Ia(fa,_a),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2]),Ea(da,Aa(da,ya,ma),ha),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2]),Ea(fa,Ta(fa,Sa),ba),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2]),Aa(da,Aa(da,ya,ma),ha),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2]),Ta(fa,_a),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2]),Aa(da,Ea(da,ya,ma),ha),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2]),Ea(fa,Sa,ba),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2]),Ea(da,Ea(da,ya,ma),ha),ka(d,da[0],da[1],da[2]),ka(f,fa[0],fa[1],fa[2])}for(v=0;v<i;++v){for(var x=0;x<2;x++)ka(p,h+8*v+2*x,h+8*(v+1)+2*x+1,h+8*v+2*x+1),ka(p,h+8*v+2*x,h+8*(v+1)+2*x,h+8*(v+1)+2*x+1);for(x=2;x<4;x++)ka(p,h+8*v+2*x,h+8*(v+1)+2*x,h+8*v+2*x+1),ka(p,h+8*(v+1)+2*x,h+8*(v+1)+2*x+1,h+8*v+2*x+1)}if(u){var b=a[0],y=o[0],O=0===s?y:s;Va(0,e,t,r,n,b,O,O)}else if(s>0){Va(0,e,t,r,n,b=a[0],s,-(y=o[0])),Va(0,e,t,r,n,b,-s,y)}c&&0===s&&Va(3*i,e,t,r,n,b=a[i],-(y=o[i]),-y);v=0;for(var w=8*(i+1)+(u?4:s>0?8:0)+(c&&0===s?4:0);v<w;++v)Ba(m,l)}var La=Object(M.Vec3)(),Na=Object(M.Vec3)(),Fa=Object(M.Vec3)(),Ua=Object(M.Vec3)(),za=Object(M.Vec3)();function Ha(e,t,r,n,i,a){e[0]=t[0]*i+r[0]*a+n[0],e[1]=t[1]*i+r[1]*a+n[1],e[2]=t[2]*i+r[2]*a+n[2]}var Ga=M.Vec3.fromArray,qa=M.Vec3.normalize,Wa=M.Vec3.negate,Xa=M.Vec3.copy,Ya=M.Vec3.cross,Qa=y.a.add3,Ka=new Map;function Za(e,t,r,n,i,a,o,s,u,c){for(var l,d,f,p,m,h=e.currentGroup,g=e.vertices,v=e.normals,b=e.indices,_=e.groups,S=g.elementCount,x=function(e){if(!Ka.has(e)){for(var t=[],r=[],n=0;n<e;++n){var i=2*Math.PI*n/e;t[n]=Math.cos(i),r[n]=Math.sin(i)}Ka.set(e,{cos:t,sin:r})}return Ka.get(e)}(a),O=x.cos,w=x.sin,C=0;C<=i;++C){var j=3*C;Ga(Ua,r,j),Ga(za,n,j),Ga(Fa,t,j);for(var P=o[C],E=s[C],A=0;A<a;++A)Ha(Na,Ua,za,Fa,E*O[A],P*w[A]),2===a?(Xa(La,za),qa(La,La),0===A&&C%2!=0||Wa(La,La)):(l=La,d=Ua,f=za,p=P*O[A],m=E*w[A],l[0]=d[0]*p+f[0]*m,l[1]=d[1]*p+f[1]*m,l[2]=d[2]*p+f[2]*m),qa(La,La),Qa(g,Na[0],Na[1],Na[2]),Qa(v,La[0],La[1],La[2])}for(C=0;C<i;++C)for(A=0;A<a;++A)Qa(b,S+C*a+(A+1)%a,S+(C+1)*a+(A+1)%a,S+C*a+A),Qa(b,S+(C+1)*a+(A+1)%a,S+(C+1)*a+A,S+C*a+A);if(u){var D=0,T=g.elementCount;Ga(Ua,r,D),Ga(za,n,D),Ga(Fa,t,D),Ya(La,za,Ua),Qa(g,Fa[0],Fa[1],Fa[2]),Qa(v,La[0],La[1],La[2]);P=o[0],E=s[0];S=g.elementCount;for(C=0;C<a;++C)Ha(Na,Ua,za,Fa,E*O[C],P*w[C]),Qa(g,Na[0],Na[1],Na[2]),Qa(v,La[0],La[1],La[2]),Qa(b,S+(C+1)%a,S+C,T)}if(c){D=3*i,T=g.elementCount;Ga(Ua,r,D),Ga(za,n,D),Ga(Fa,t,D),Ya(La,Ua,za),Qa(g,Fa[0],Fa[1],Fa[2]),Qa(v,La[0],La[1],La[2]);P=o[i],E=s[i];S=g.elementCount;for(C=0;C<a;++C)Ha(Na,Ua,za,Fa,E*O[C],P*w[C]),Qa(g,Na[0],Na[1],Na[2]),Qa(v,La[0],La[1],La[2]),Qa(b,S+C,S+(C+1)%a,T)}var I=(i+1)*a+(u?a+1:0)+(c?a+1:0);y.a.addRepeat(_,I,h)}var Ja=M.Vec3.fromArray,$a=M.Vec3.magnitude,eo=M.Vec3.sub,to=M.Vec3.add,ro=M.Vec3.scale,no=M.Vec3.negate,io=M.Vec3.copy,ao=M.Vec3.cross,oo=y.a.add3,so=y.a.add,uo=Object(M.Vec3)(),co=Object(M.Vec3)(),lo=Object(M.Vec3)(),fo=Object(M.Vec3)(),po=Object(M.Vec3)(),mo=Object(M.Vec3)(),ho=Object(M.Vec3)(),go=Object(M.Vec3)(),vo=Object(M.Vec3)();function bo(e,t,r,n,i,a,o,s){var u=e.currentGroup,c=e.vertices,l=e.normals,d=e.indices,f=e.groups,p=c.elementCount,m=0;s>0&&(Ja(uo,t,0),Ja(co,t,3*i),m=s/$a(eo(lo,co,uo)));for(var h=0;h<=i;++h){var g=a[h],v=o[h],b=0===s?v:s*(1-h/i),y=3*h;Ja(po,r,y),ro(po,po,b),Ja(fo,n,y),ro(fo,fo,g),s>0&&(Ja(uo,r,y),Ja(co,n,y),ro(mo,ao(mo,uo,co),m)),Ja(ho,t,y),Ja(go,r,y),Ja(vo,n,y),to(uo,ho,po),no(co,vo),oo(c,uo[0],uo[1],uo[2]),oo(l,co[0],co[1],co[2]),eo(uo,ho,po),oo(c,uo[0],uo[1],uo[2]),oo(l,co[0],co[1],co[2]),to(uo,ho,po),io(co,vo),oo(c,uo[0],uo[1],uo[2]),oo(l,co[0],co[1],co[2]),eo(uo,ho,po),oo(c,uo[0],uo[1],uo[2]),oo(l,co[0],co[1],co[2])}for(h=0;h<i;++h)oo(d,p+4*h,p+4*(h+1)+1,p+4*h+1),oo(d,p+4*h,p+4*(h+1),p+4*(h+1)+1),oo(d,p+4*h+2+1,p+4*(h+1)+2+1,p+4*h+2),oo(d,p+4*h+2,p+4*(h+1)+2+1,p+4*(h+1)+2);h=0;for(var _=4*(i+1);h<_;++h)so(f,u)}var yo={sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01}),aspectRatio:d.ParamDefinition.Numeric(5,{min:.1,max:10,step:.1}),arrowFactor:d.ParamDefinition.Numeric(1.5,{min:0,max:3,step:.1}),detail:d.ParamDefinition.Numeric(0,{min:0,max:3,step:1},Bt.a.CustomQualityParamInfo),linearSegments:d.ParamDefinition.Numeric(8,{min:1,max:48,step:1},Bt.a.CustomQualityParamInfo),radialSegments:d.ParamDefinition.Numeric(16,{min:2,max:56,step:2},Bt.a.CustomQualityParamInfo)},_o=(d.ParamDefinition.getDefaultValues(yo),Object(M.Vec3)());function So(e,t,r,n,i,a){var o,s,u,c=t.polymerElements.length;if(!c)return Ve.a.createEmpty(a);for(var l=i.sizeFactor,d=i.detail,f=i.linearSegments,p=i.radialSegments,m=i.aspectRatio,h=i.arrowFactor,g=f*p*c+(p+1)*c*2,v=_t.a.createState(g,g/10,a),b=A.Unit.isCoarse(t),y=Pn(f),_=y.curvePoints,S=y.normalVectors,x=y.binormalVectors,O=y.widthValues,w=y.heightValues,C=0,j=un(t,r);j.hasNext;){var P=j.move();v.currentGroup=C;var E=Object(Ne.isNucleic)(P.moleculeType),D=Ne.SecondaryStructureType.is(P.secStrucType,4),I=Ne.SecondaryStructureType.is(P.secStrucType,2),k=E?.3:.5;En(y,P,I?.9:.5,k);var B=n.size.size(P.centerPrev)*l,V=n.size.size(P.center)*l,R=n.size.size(P.centerNext)*l;b&&(B*=m/2,V*=m/2,R*=m/2);var L=P.secStrucFirst||P.coarseBackboneFirst||P.first,N=P.secStrucLast||P.coarseBackboneLast||P.last,F=f;if(P.initial){var U=f-(F=Math.max(Math.round(f*k),1));_.copyWithin(0,3*U),x.copyWithin(0,3*U),S.copyWithin(0,3*U),M.Vec3.fromArray(_o,_,3),M.Vec3.normalize(_o,M.Vec3.sub(_o,P.p2,_o)),M.Vec3.scaleAndAdd(_o,P.p2,_o,2*V),M.Vec3.toArray(_o,_,0)}else P.final&&(F=Math.max(Math.round(f*(1-k)),1),M.Vec3.fromArray(_o,_,3*F-3),M.Vec3.normalize(_o,M.Vec3.sub(_o,P.p2,_o)),M.Vec3.scaleAndAdd(_o,P.p2,_o,2*V),M.Vec3.toArray(_o,_,3*F));if(!0===P.initial&&!0===P.final)Object(St.a)(v,P.p2,2*V,d);else if(D){var z=B*m,H=V*m,G=R*m,q=P.secStrucLast?H*h:0;Un(y,B,V,R,z,H,G,k),2===p?bo(v,_,S,x,F,O,w,q):Ra(v,_,S,x,F,O,w,q,L,N)}else{z=void 0,H=void 0,G=void 0;if(I&&!P.isCoarseBackbone?(z=B*m,H=V*m,G=R*m):E&&!P.isCoarseBackbone?(B=(o=[z=B*m,B])[0],z=o[1],V=(s=[H=V*m,V])[0],H=s[1],R=(u=[G=R*m,R])[0],G=u[1]):(z=B,H=V,G=R),Un(y,B,V,R,z,H,G,k),2===p)if(E&&!P.isCoarseBackbone){for(var W=0,X=x.length;W<X;W++)x[W]*=-1;bo(v,_,x,S,F,w,O,0)}else bo(v,_,S,x,F,O,w,0);else 4===p?Ra(v,_,S,x,F,O,w,0,L,N):Za(v,_,S,x,F,p,O,w,L,N)}++C}var Y=_t.a.getMesh(v),Q=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return Y.setBoundingSphere(Q),Y}var xo=Object(o.__assign)(Object(o.__assign)({},Le.g),yo);function Oo(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(xo),createGeometry:So,createLocationIterator:zn.fromGroup,getLoci:Xn,eachLocation:Zn,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.linearSegments!==r.linearSegments||t.radialSegments!==r.radialSegments||t.aspectRatio!==r.aspectRatio||t.arrowFactor!==r.arrowFactor;var s=sn.a.get(a.structure).version;e.info.secondaryStructureHash!==s&&(e.createGeometry=!0,e.info.secondaryStructureHash=s)}},e)}var wo={"polymer-trace":function(e,t){return Object(Lt.a)("Polymer trace mesh",e,t,Oo)},"polymer-gap":function(e,t){return Object(Lt.a)("Polymer gap cylinder",e,t,la)},"nucleotide-block":function(e,t){return Object(Lt.a)("Nucleotide block mesh",e,t,yi)},"nucleotide-ring":function(e,t){return Object(Lt.a)("Nucleotide ring mesh",e,t,Gi)},"direction-wedge":function(e,t){return Object(Lt.a)("Polymer direction wedge",e,t,oa)}},Co=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},xo),ca),bi),Hi),aa),{sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01}),visuals:d.ParamDefinition.MultiSelect(["polymer-trace","polymer-gap","nucleotide-block"],d.ParamDefinition.objectToOptions(wo))});var jo=Object(Ft.b)({name:"cartoon",label:"Cartoon",description:"Displays ribbons, planks, tubes smoothly following the trace atoms of polymers.",factory:function(e,t){return ye.a.createMulti("Cartoon",e,t,Ft.c,wo)},getParams:function(e,t){var r=d.ParamDefinition.clone(Co),n=!1,i=!1;return t.units.forEach((function(e){!n&&A.Unit.isAtomic(e)&&e.nucleotideElements.length&&(n=!0),!i&&e.gapElements.length&&(i=!0)})),r.visuals.defaultValue=["polymer-trace"],n&&r.visuals.defaultValue.push("nucleotide-block"),i&&r.visuals.defaultValue.push("polymer-gap"),r},defaultValues:d.ParamDefinition.getDefaultValues(Co),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.polymerResidueCount>0},ensureCustomProperties:{attach:function(e,t){return sn.a.attach(e,t,void 0,!0)},detach:function(e){return sn.a.ref(e,!1)}}}),Po=r(317),Eo=r(218),Ao=r(69),Do=Object(o.__assign)(Object(o.__assign)({},Le.g),{sizeFactor:d.ParamDefinition.Numeric(1,{min:0,max:10,step:.1}),detail:d.ParamDefinition.Numeric(0,{min:0,max:3,step:1},Bt.a.CustomQualityParamInfo),ignoreHydrogens:d.ParamDefinition.Boolean(!1)});function To(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(Do),createGeometry:Io,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.ignoreHydrogens!==r.ignoreHydrogens}},e)}function Io(e,t,r,n,i,a){var o=i.detail,s=i.sizeFactor,u=t.elements,c=t.model,l=t.model.atomicHierarchy.derived.atom.atomicNumber,d=u.length,f=d*Object(yt.b)(o),p=_t.a.createState(f,f/2,a),m=Eo.a.Provider.get(c);if(!m)return Ve.a.createEmpty(a);var h=Object(M.Vec3)(),g=Object(M.Mat3)(),v=Object(M.Vec3)(),b=Object(M.Vec3)(),y=Object(M.Vec3)(),_=m.elementToAnsiotrop,S=m.data,x=S.U,O=S._schema.U.space,w=t.conformation.invariantPosition,C=A.StructureElement.Location.create(r);C.unit=t;for(var j=0;j<d;j++){var P=u[j],E=_[P];if(-1!==E&&(!i.ignoreHydrogens||!Object(ze.n)(l,P))){C.element=P,w(P,h),p.currentGroup=j,M.Tensor.toMat3(g,O,x.value(E)),M.Mat3.symmtricFromLower(g,g),M.Mat3.symmetricEigenvalues(v,g),M.Mat3.eigenvector(b,g,v[1]),M.Mat3.eigenvector(y,g,v[2]);for(var D=0;D<3;++D)v[D]=1.5958*s*Math.sqrt(Math.abs(v[D]));Object(Ao.b)(v[0],v[1],M.EPSILON)&&Object(Ao.b)(v[1],v[2],M.EPSILON)?Object(St.a)(p,h,v[0],o):Object(Po.a)(p,h,y,b,v,o)}}var I=_t.a.getMesh(p),k=T.g.expand(Object(T.g)(),t.boundary.sphere,1*s);return I.setBoundingSphere(k),I}var Mo={"ellipsoid-mesh":function(e,t){return Object(Ft.d)("Ellipsoid Mesh",e,t,To)},"intra-bond":function(e,t){return Object(Ft.d)("Intra-unit bond cylinder",e,t,ot)},"inter-bond":function(e,t){return Object(Ft.a)("Inter-unit bond cylinder",e,t,ht)}},ko=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Do),at),mt),{unitKinds:Object(Ut.j)(["atomic"]),sizeFactor:d.ParamDefinition.Numeric(1,{min:.01,max:10,step:.01}),sizeAspectRatio:d.ParamDefinition.Numeric(.1,{min:.01,max:3,step:.01}),linkCap:d.ParamDefinition.Boolean(!0),visuals:d.ParamDefinition.MultiSelect(["ellipsoid-mesh","intra-bond","inter-bond"],d.ParamDefinition.objectToOptions(Mo))});var Bo=Object(Ft.b)({name:"ellipsoid",label:"Ellipsoid",description:"Displays anisotropic displacement ellipsoids of atomic elements plus bonds as cylinders.",factory:function(e,t){return ye.a.createMulti("Ellipsoid",e,t,Ft.c,Mo)},getParams:function(e,t){return d.ParamDefinition.clone(ko)},defaultValues:d.ParamDefinition.getDefaultValues(ko),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0&&e.models.some((function(e){return Eo.a.Provider.isApplicable(e)}))}}),Vo=r(67),Ro=(r(180),r(64)),Lo=r(68),No=r(11),Fo={drawCount:Object(No.k)("number"),instanceCount:Object(No.k)("number"),aRadius:Object(No.a)("float32",1,0),aPosition:Object(No.a)("float32",3,0),aGroup:Object(No.a)("float32",1,0),uCurrentSlice:Object(No.j)("f"),uCurrentX:Object(No.j)("f"),uCurrentY:Object(No.j)("f"),uBboxMin:Object(No.j)("v3",!0),uBboxSize:Object(No.j)("v3",!0),uGridDim:Object(No.j)("v3",!0),uGridTexDim:Object(No.j)("v3",!0),uGridTexScale:Object(No.j)("v2",!0),uAlpha:Object(No.j)("f",!0),uResolution:Object(No.j)("f",!0),uRadiusFactorInv:Object(No.j)("f",!0),tMinDistanceTex:Object(No.i)("texture","rgba","float","nearest"),dGridTexType:Object(No.c)("string",["2d","3d"]),dCalcType:Object(No.c)("string",["density","minDistance","groupId"])},Uo=Object(Ro.g)("gaussian-density","\nprecision highp float;\n\nattribute vec3 aPosition;\nattribute float aRadius;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n\n#if defined(dCalcType_groupId)\n    attribute float aGroup;\n    varying float vGroup;\n#endif\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n    vRadiusSqInv = 1.0 / (aRadius * aRadius);\n    #if defined(dCalcType_groupId)\n        vGroup = aGroup;\n    #endif\n    gl_PointSize = ceil(((aRadius * 3.0) / uResolution) + uResolution);\n    vPosition = (aPosition - uBboxMin) / uResolution;\n    gl_Position = vec4(((aPosition - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n}\n","\nprecision highp float;\n\nvarying vec3 vPosition;\nvarying float vRadiusSqInv;\n#if defined(dCalcType_groupId)\n    #if defined(dGridTexType_2d)\n        precision highp sampler2D;\n        uniform sampler2D tMinDistanceTex;\n        uniform vec3 uGridTexDim;\n    #elif defined(dGridTexType_3d)\n        precision highp sampler3D;\n        uniform sampler3D tMinDistanceTex;\n    #endif\n    varying float vGroup;\n#endif\n\n#include common\n\nuniform vec3 uGridDim;\nuniform vec2 uGridTexScale;\nuniform float uCurrentSlice;\nuniform float uCurrentX;\nuniform float uCurrentY;\nuniform float uAlpha;\nuniform float uResolution;\nuniform float uRadiusFactorInv;\n\nvoid main() {\n    vec2 v = gl_FragCoord.xy - vec2(uCurrentX, uCurrentY) - 0.5;\n    vec3 fragPos = vec3(v.x, v.y, uCurrentSlice);\n    float dist = distance(fragPos, vPosition) * uResolution;\n\n    #if defined(dCalcType_density)\n        float density = exp(-uAlpha * ((dist * dist) * vRadiusSqInv));\n        gl_FragColor.a = density * uRadiusFactorInv;\n    #elif defined(dCalcType_minDistance)\n        gl_FragColor.a = 1.0 - dist * uRadiusFactorInv;\n    #elif defined(dCalcType_groupId)\n        #if defined(dGridTexType_2d)\n            float minDistance = 1.0 - texture2D(tMinDistanceTex, (gl_FragCoord.xy) / (uGridTexDim.xy / uGridTexScale)).a;\n        #elif defined(dGridTexType_3d)\n            float minDistance = 1.0 - texelFetch(tMinDistanceTex, ivec3(gl_FragCoord.xy, uCurrentSlice), 0).a;\n        #endif\n        if (dist * uRadiusFactorInv > minDistance + uResolution * 0.05)\n            discard;\n        gl_FragColor.rgb = encodeFloatRGB(vGroup);\n    #endif\n}\n");function zo(e){return e.namedFramebuffers["gaussian-density"]||(e.namedFramebuffers["gaussian-density"]=e.resources.framebuffer()),e.namedFramebuffers["gaussian-density"]}function Ho(e,t,r,n,i,a){var o="gaussian-density-"+e;return t.namedTextures[o]||(t.namedTextures[o]=t.resources.texture(r,n,i,a)),t.namedTextures[o]}function Go(e,t,r,n,i,a){return e.isWebGL2?function(e,t,r,n,i,a){return Wo(function(e,t,r,n,i,a){var o=e.gl,s=e.resources,u=e.state,c=e.extensions,l=c.colorBufferFloat,d=c.textureFloat,f=c.colorBufferHalfFloat,p=c.textureHalfFloat,m=i.smoothness,h=i.resolution,g=Qo(t,r,n,i),v=g.drawCount,b=g.positions,y=g.radii,_=g.groups,S=g.scale,x=g.expandedBox,O=g.dim,w=g.maxRadius,C=O[0],j=O[1],P=O[2],E=Ho("min-dist-3d",e,"volume-uint8","rgba","ubyte","nearest");E.define(C,j,P);var A=M.Vec2.create(1,1),D=2*w,T=Ko(e,v,b,y,_,E,x,O,O,A,m,h,D),I=T.values.uCurrentSlice,k=zo(e);k.bind(),Zo(e),o.viewport(0,0,C,j),o.scissor(0,0,C,j),a||(a=f&&p?s.texture("volume-float16","rgba","fp16","linear"):l&&d?s.texture("volume-float32","rgba","float","linear"):s.texture("volume-uint8","rgba","ubyte","linear"));function B(e,t){u.currentRenderItemId=-1;for(var r=0;r<P;++r)De.e.update(I,r),e.attachFramebuffer(k,0,r),t&&o.clear(o.COLOR_BUFFER_BIT),T.render();o.flush()}return a.define(C,j,P),$o(e,T),B(a,!0),Jo(e,T),B(E,!0),es(e,T),B(a,!1),{texture:a,scale:S,bbox:x,gridDim:O,gridTexDim:O,gridTexScale:A,radiusFactor:D}}(e,t,r,n,i,a))}(e,t,r,n,i,a):qo(e,t,r,n,!1,i,a)}function qo(e,t,r,n,i,a,o){return Wo(Yo(e,t,r,n,i,a,o))}function Wo(e){var t=e.texture,r=e.scale,n=e.bbox,i=e.gridDim,a=e.gridTexDim,o=e.gridTexScale,s=e.radiusFactor;return{transform:Xo(r,n),texture:t,bbox:n,gridDim:i,gridTexDim:a,gridTexScale:o,radiusFactor:s}}function Xo(e,t){var r=M.Mat4.identity();return M.Mat4.fromScaling(r,e),M.Mat4.setTranslation(r,t.min),r}function Yo(e,t,r,n,i,a,o){var s=e.gl,u=e.resources,c=e.state,l=e.extensions,d=l.colorBufferFloat,f=l.textureFloat,p=l.colorBufferHalfFloat,m=l.textureHalfFloat,h=l.blendMinMax,g=a.smoothness,v=a.resolution,b=Qo(t,r,n,a),y=b.drawCount,_=b.positions,S=b.radii,x=b.groups,O=b.scale,w=b.expandedBox,C=b.dim,j=b.maxRadius,P=C[0],E=C[1],A=C[2],D=function(e){var t=e[0]*e[1]*e[2],r=Math.sqrt(t),n=Math.pow(2,Math.ceil(Math.log(r)/Math.log(2))),i=0,a=e[1],o=1,s=e[2];n<e[0]*e[2]?(s=Math.floor(n/e[0]),o=Math.ceil(e[2]/s),i=s*e[0],a*=o):i=e[0]*e[2];return{texDimX:i,texDimY:a,texRows:o,texCols:s,powerOfTwoSize:a<n?n:2*n}}(C),T=D.texDimX,I=D.texDimY,k=D.texCols,B=D.powerOfTwoSize,V=M.Vec3.create(T,I,0),R=M.Vec2.create(T/B,I/B),L=2*j,N=i?B:T,F=i?B:I,U=Ho("min-dist-2d",e,"image-uint8","rgba","ubyte","nearest");U.define(N,F);var z=Ko(e,y,_,S,x,U,w,C,V,R,g,v,L),H=z.values,G=H.uCurrentSlice,q=H.uCurrentX,W=H.uCurrentY,X=zo(e);function Y(e,t){c.currentRenderItemId=-1,e.attachFramebuffer(X,0),t&&(s.viewport(0,0,N,F),s.scissor(0,0,N,F),s.clear(s.COLOR_BUFFER_BIT)),De.e.update(W,0);for(var r=0,n=0,i=0,a=0;a<A;++a)r>=k&&(r-=k,n+=E,i=0,De.e.update(W,n)),De.e.update(q,i),De.e.update(G,a),s.viewport(i,n,P,E),s.scissor(i,n,P,E),z.render(),++r,i+=P;s.flush()}return X.bind(),Zo(e),o||(o=p&&m?u.texture("image-float16","rgba","fp16","linear"):d&&f?u.texture("image-float32","rgba","float","linear"):u.texture("image-uint8","rgba","ubyte","linear")),o.define(N,F),$o(e,z),Y(o,!0),h&&(Jo(e,z),Y(U,!0),es(e,z),Y(o,!1)),{texture:o,scale:O,bbox:w,gridDim:C,gridTexDim:V,gridTexScale:R,radiusFactor:L}}function Qo(e,t,r,n){for(var i=n.resolution,a=n.radiusOffset,o=1/i,s=e.indices,u=e.x,c=e.y,l=e.z,d=e.id,f=Ee.OrderedSet.size(s),p=new Float32Array(3*f),m=new Float32Array(f),h=new Float32Array(f),g=0,v=0;v<f;++v){var b=Ee.OrderedSet.getAt(s,v);p[3*v]=u[b],p[3*v+1]=c[b],p[3*v+2]=l[b];var y=r(b)+a;g<y&&(g=y),m[v]=y,h[v]=d?d[v]:v}var _=2*g+4*i,S=T.b.expand(Object(T.b)(),t,M.Vec3.create(_,_,_)),x=T.b.scale(Object(T.b)(),S,o),O=T.b.size(Object(M.Vec3)(),x);return M.Vec3.ceil(O,O),{drawCount:f,positions:p,radii:m,groups:h,scale:M.Vec3.create(i,i,i),expandedBox:S,dim:O,maxRadius:g}}function Ko(e,t,r,n,i,a,s,u,c,l,d,f,p){if(e.namedComputeRenderables["gaussian-density"]){var m=M.Vec3.sub(Object(M.Vec3)(),s.max,s.min),h=e.namedComputeRenderables["gaussian-density"].values;De.e.updateIfChanged(h.drawCount,t),De.e.updateIfChanged(h.instanceCount,1),De.e.update(h.aRadius,n),De.e.update(h.aPosition,r),De.e.update(h.aGroup,i),De.e.updateIfChanged(h.uCurrentSlice,0),De.e.updateIfChanged(h.uCurrentX,0),De.e.updateIfChanged(h.uCurrentY,0),De.e.update(h.uBboxMin,s.min),De.e.update(h.uBboxSize,m),De.e.update(h.uGridDim,u),De.e.update(h.uGridTexDim,c),De.e.update(h.uGridTexScale,l),De.e.updateIfChanged(h.uAlpha,d),De.e.updateIfChanged(h.uResolution,f),De.e.updateIfChanged(h.uRadiusFactorInv,1/p),De.e.update(h.tMinDistanceTex,a),De.e.updateIfChanged(h.dGridTexType,a.getDepth()>0?"3d":"2d"),De.e.updateIfChanged(h.dCalcType,"density"),e.namedComputeRenderables["gaussian-density"].update()}else e.namedComputeRenderables["gaussian-density"]=function(e,t,r,n,i,a,s,u,c,l,d,f,p){var m=M.Vec3.sub(Object(M.Vec3)(),s.max,s.min),h={drawCount:De.e.create(t),instanceCount:De.e.create(1),aRadius:De.e.create(n),aPosition:De.e.create(r),aGroup:De.e.create(i),uCurrentSlice:De.e.create(0),uCurrentX:De.e.create(0),uCurrentY:De.e.create(0),uBboxMin:De.e.create(s.min),uBboxSize:De.e.create(m),uGridDim:De.e.create(u),uGridTexDim:De.e.create(c),uGridTexScale:De.e.create(l),uAlpha:De.e.create(d),uResolution:De.e.create(f),uRadiusFactorInv:De.e.create(1/p),tMinDistanceTex:De.e.create(a),dGridTexType:De.e.create(a.getDepth()>0?"3d":"2d"),dCalcType:De.e.create("density")},g=Object(o.__assign)({},Fo),v=Object(Lo.a)(e,"points",Uo,g,h);return Object(Vo.a)(v,h)}(e,t,r,n,i,a,s,u,c,l,d,f,p);return e.namedComputeRenderables["gaussian-density"]}function Zo(e){var t=e.gl,r=e.state;r.disable(t.CULL_FACE),r.enable(t.BLEND),r.disable(t.DEPTH_TEST),r.enable(t.SCISSOR_TEST),r.depthMask(!1),r.clearColor(0,0,0,0)}function Jo(e,t){var r=e.gl,n=e.state;if(De.e.update(t.values.dCalcType,"minDistance"),t.update(),n.colorMask(!1,!1,!1,!0),n.blendFunc(r.ONE,r.ONE),!e.extensions.blendMinMax)throw new Error("GPU gaussian surface calculation requires EXT_blend_minmax");n.blendEquation(e.extensions.blendMinMax.MAX)}function $o(e,t){var r=e.gl,n=e.state;De.e.update(t.values.dCalcType,"density"),t.update(),n.colorMask(!1,!1,!1,!0),n.blendFunc(r.ONE,r.ONE),n.blendEquation(r.FUNC_ADD)}function es(e,t){var r=e.gl,n=e.state;De.e.update(t.values.dCalcType,"groupId"),t.update(),n.colorMask(!0,!0,!0,!1),n.blendFunc(r.ONE,r.ZERO),n.blendEquation(r.FUNC_ADD)}var ts=r(322);function rs(e,t,r,n,i){return Object(o.__awaiter)(this,void 0,void 0,(function(){function a(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var t;return Object(o.__generator)(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<g?(function(e,t){for(var r=e;r<t;++r)for(var n=Ee.OrderedSet.getAt(d,r),i=f[n],a=p[n],o=m[n],s=v[r],u=1/(s*s),c=2*s,g=c*c,b=Math.ceil(c*l),y=Math.floor(l*(i-O[0])),_=Math.floor(l*(a-O[1])),S=Math.floor(l*(o-O[2])),x=Math.max(0,y-b),w=Math.max(0,_-b),C=Math.max(0,S-b),j=Math.min(I,y+b+2),E=Math.min(k,_+b+2),D=Math.min(B,S+b+2),T=x;T<j;++T)for(var M=L[T]-i,H=T*R,G=w;G<E;++G)for(var q=N[G]-a,W=M*M+q*q,X=G*V+H,Y=C;Y<D;++Y){var Q=F[Y]-o,K=W+Q*Q;if(K<=g){var Z=Object(ts.a)(K*u*-z),J=Y+X;P[J]+=Z,Z>U[J]&&(U[J]=Z,A[J]=h?h[r]:r)}}}(t,Math.min(t+H,g)),e.shouldUpdate?[4,e.update({message:"filling density grid",current:t,max:g})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t+=H,[3,1];case 4:return[2]}}))}))}var s,u,c,l,d,f,p,m,h,g,v,b,y,_,S,x,O,w,C,j,P,E,A,D,I,k,B,V,R,L,N,F,U,z,H,G;return Object(o.__generator)(this,(function(e){switch(e.label){case 0:for(s=i.resolution,u=i.radiusOffset,c=i.smoothness,l=1/s,d=t.indices,f=t.x,p=t.y,m=t.z,h=t.id,g=Ee.OrderedSet.size(d),v=new Float32Array(g),b=0,y=0;y<g;++y)_=n(Ee.OrderedSet.getAt(d,y))+u,b<_&&(b=_),v[y]=_;return S=2*b+s,x=T.b.expand(Object(T.b)(),r,M.Vec3.create(S,S,S)),O=x.min,w=T.b.scale(Object(T.b)(),x,l),C=T.b.size(Object(M.Vec3)(),w),M.Vec3.ceil(C,C),j=M.Tensor.Space(C,[0,1,2],Float32Array),P=j.create(),E=M.Tensor.create(j,P),(A=j.create()).fill(-1),D=M.Tensor.create(j,A),I=C[0],k=C[1],B=C[2],R=(V=B)*k,L=Object(T.i)(C[0],O[0],s),N=Object(T.i)(C[1],O[1],s),F=Object(T.i)(C[2],O[2],s),U=j.create(),z=c,H=Math.ceil(1e5/(Math.pow(Math.pow(b,3),3)*l)),[4,a()];case 1:return e.sent(),G=M.Mat4.identity(),M.Mat4.fromScaling(G,M.Vec3.create(s,s,s)),M.Mat4.setTranslation(G,x.min),[2,{field:E,idField:D,transform:G,radiusFactor:1}]}}))}))}var ns=Object(o.__assign)({resolution:d.ParamDefinition.Numeric(1,{min:.1,max:20,step:.1},Object(o.__assign)({description:"Grid resolution/cell spacing."},Bt.a.CustomQualityParamInfo)),radiusOffset:d.ParamDefinition.Numeric(0,{min:0,max:10,step:.1},{description:"Extra/offset radius added to the atoms/coarse elements for gaussian calculation. Useful to create coarse, low resolution surfaces."}),smoothness:d.ParamDefinition.Numeric(1.5,{min:.5,max:2.5,step:.1},{description:"Smoothness of the gausian surface, lower is smoother."})},ze.a);d.ParamDefinition.getDefaultValues(ns);function is(e,t){var r=e.maxTextureSize/3;return r*r/Math.max(1,t?t.units.length/16:1)}function as(e,t,r){var n=this,i=t.lookup3d.boundary.box,a=Object(ze.d)(i,r),s=Object(ze.j)(e,t,a),u=s.position,c=s.radius;return _.b.create("Gaussian Density",(function(e){return Object(o.__awaiter)(n,void 0,void 0,(function(){return Object(o.__generator)(this,(function(t){switch(t.label){case 0:return[4,rs(e,u,i,c,a)];case 1:return[2,t.sent()]}}))}))}))}function os(e,t,r,n,i){var a=this,s=t.lookup3d.boundary.box,u=Object(ze.d)(s,r,is(n,e)),c=Object(ze.j)(e,t,u),l=c.position,d=c.radius;return _.b.create("Gaussian Density",(function(e){return Object(o.__awaiter)(a,void 0,void 0,(function(){return Object(o.__generator)(this,(function(e){return[2,Go(n,l,s,d,u,i)]}))}))}))}function ss(e,t,r,n,i,a){var s=this,u=t.lookup3d.boundary.box,c=Object(ze.d)(u,n,is(i,e)),l=Object(ze.j)(e,t,c),d=l.position,f=l.radius;return _.b.create("Gaussian Density",(function(e){return Object(o.__awaiter)(s,void 0,void 0,(function(){return Object(o.__generator)(this,(function(e){return[2,qo(i,d,u,f,r,c,a)]}))}))}))}function us(e,t){var r=this,n=e.lookup3d.boundary.box,i=Object(ze.d)(n,t),a=Object(ze.h)(e,t.ignoreHydrogens,t.traceOnly),s=a.position,u=a.radius;return _.b.create("Gaussian Density",(function(e){return Object(o.__awaiter)(r,void 0,void 0,(function(){return Object(o.__generator)(this,(function(t){switch(t.label){case 0:return[4,rs(e,s,n,u,i)];case 1:return[2,t.sent()]}}))}))}))}function cs(e,t,r,n){var i=this,a=e.lookup3d.boundary.box,s=Object(ze.d)(a,t,is(r)),u=Object(ze.h)(e,t.ignoreHydrogens,t.traceOnly),c=u.position,l=u.radius;return _.b.create("Gaussian Density",(function(e){return Object(o.__awaiter)(i,void 0,void 0,(function(){return Object(o.__generator)(this,(function(e){return[2,Go(r,c,a,l,s,n)]}))}))}))}function ls(e,t,r,n,i){var a=this,s=e.lookup3d.boundary.box,u=Object(ze.d)(s,r,is(n)),c=Object(ze.h)(e,r.ignoreHydrogens,r.traceOnly),l=c.position,d=c.radius;return _.b.create("Gaussian Density",(function(e){return Object(o.__awaiter)(a,void 0,void 0,(function(){return Object(o.__generator)(this,(function(e){return[2,qo(n,l,s,d,t,u,i)]}))}))}))}var ds=r(217),fs=r(191),ps=r(341),ms=Object(o.__assign)(Object(o.__assign)({},ns),{ignoreHydrogens:d.ParamDefinition.Boolean(!1),tryUseGpu:d.ParamDefinition.Boolean(!0)}),hs=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.g),Le.m),ms),gs=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},st.g),st.k),ms);function vs(e){return e.extensions.colorBufferFloat&&e.extensions.textureFloat&&e.extensions.blendMinMax&&e.extensions.drawBuffers}function bs(e,t,r){if(t.resolution>1)return!1;var n=r.maxTextureSize/3,i=Object(ze.l)(e.boundary.box,t.resolution,n*n);return i.areaCells<i.maxAreaCells}function ys(e,t,r,n){return r.tryUseGpu&&n&&vs(n)&&bs(t,r,n)?function(e){return Object(Le.n)({defaultProps:d.ParamDefinition.getDefaultValues(hs),createGeometry:Os,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)},mustRecreate:function(e,t,r){return!t.tryUseGpu||!r||!bs(e.structure,t,r)},dispose:function(e){e.vertexTexture.ref.value.destroy(),e.groupTexture.ref.value.destroy(),e.normalTexture.ref.value.destroy()}},e)}(e):function(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(hs),createGeometry:Ss,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)},mustRecreate:function(e,t,r){return t.tryUseGpu&&!!r&&bs(e.structure,t,r)}},e)}(e)}function _s(e,t,r,n){return r.tryUseGpu&&n&&vs(n)&&bs(t,r,n)?function(e){return Object(st.l)({defaultProps:d.ParamDefinition.getDefaultValues(gs),createGeometry:ws,createLocationIterator:vt.fromStructure,getLoci:kt,eachLocation:Mt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0)},mustRecreate:function(e,t,r){return!t.tryUseGpu||!r||!bs(e,t,r)},dispose:function(e){e.vertexTexture.ref.value.destroy(),e.groupTexture.ref.value.destroy(),e.normalTexture.ref.value.destroy()}},e)}(e):function(e){return Object(st.h)({defaultProps:d.ParamDefinition.getDefaultValues(gs),createGeometry:xs,createLocationIterator:vt.fromStructure,getLoci:kt,eachLocation:Mt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0)},mustRecreate:function(e,t,r){return t.tryUseGpu&&!!r&&bs(e,t,r)}},e)}(e)}function Ss(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,s,u,c,l,d,f,p,m;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return n=i.smoothness,[4,as(r,t,i).runInContext(e.runtime)];case 1:return s=o.sent(),u=s.transform,c=s.field,l=s.idField,d=s.radiusFactor,f={isoLevel:Math.exp(-n)/d,scalarField:c,idField:l},[4,Object(ds.b)(f,a).runAsChild(e.runtime)];case 2:return p=o.sent(),Ve.a.transform(p,u),e.webgl&&!e.webgl.isWebGL2&&Ve.a.uniformTriangleGroup(p),m=T.g.expand(Object(T.g)(),t.boundary.sphere,i.radiusOffset+Object(ze.k)(t)),p.setBoundingSphere(m),[2,p]}}))}))}function xs(e,t,r,n,i){return Object(o.__awaiter)(this,void 0,void 0,(function(){var r,a,s,u,c,l,d,f,p;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return r=n.smoothness,[4,us(t,n).runInContext(e.runtime)];case 1:return a=o.sent(),s=a.transform,u=a.field,c=a.idField,l=a.radiusFactor,d={isoLevel:Math.exp(-r)/l,scalarField:u,idField:c},[4,Object(ds.b)(d,i).runAsChild(e.runtime)];case 2:return f=o.sent(),Ve.a.transform(f,s),e.webgl&&!e.webgl.isWebGL2&&Ve.a.uniformTriangleGroup(f),p=T.g.expand(Object(T.g)(),t.boundary.sphere,n.radiusOffset+Object(ze.i)(t)),f.setBoundingSphere(p),[2,f]}}))}))}function Os(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,s,u,c,l,d,f,p,m,h,g,v;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:if(!e.webgl)throw new Error("webgl context required to create gaussian surface texture-mesh");return n=e.webgl,s=n.namedTextures,u=n.resources,c=n.extensions,l=c.colorBufferFloat,d=c.textureFloat,f=c.colorBufferHalfFloat,p=c.textureHalfFloat,s["gaussian-surface"]||(s["gaussian-surface"]=f&&p?u.texture("image-float16","rgba","fp16","linear"):l&&d?u.texture("image-float32","rgba","float","linear"):u.texture("image-uint8","rgba","ubyte","linear")),[4,ss(r,t,!0,i,e.webgl,s["gaussian-surface"]).runInContext(e.runtime)];case 1:return m=o.sent(),h=Math.exp(-i.smoothness)/m.radiusFactor,g=Object(ps.a)(e.webgl,m.texture,m.gridDim,m.gridTexDim,m.gridTexScale,m.transform,h,!0,null==a?void 0:a.vertexTexture.ref.value,null==a?void 0:a.groupTexture.ref.value,null==a?void 0:a.normalTexture.ref.value),v=T.g.expand(Object(T.g)(),t.boundary.sphere,i.radiusOffset+Object(ze.i)(r)),[2,fs.a.create(g.vertexCount,1,g.vertexTexture,g.groupTexture,g.normalTexture,v,a)]}}))}))}function ws(e,t,r,n,i){return Object(o.__awaiter)(this,void 0,void 0,(function(){var r,a,s,u,c,l,d,f,p,m,h,g;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:if(!e.webgl)throw new Error("webgl context required to create structure gaussian surface texture-mesh");return r=e.webgl,a=r.namedTextures,s=r.resources,u=r.extensions,c=u.colorBufferFloat,l=u.textureFloat,d=u.colorBufferHalfFloat,f=u.textureHalfFloat,a["gaussian-surface"]||(a["gaussian-surface"]=d&&f?s.texture("image-float16","rgba","fp16","linear"):c&&l?s.texture("image-float32","rgba","float","linear"):s.texture("image-uint8","rgba","ubyte","linear")),[4,ls(t,!0,n,e.webgl,a["gaussian-surface"]).runInContext(e.runtime)];case 1:return p=o.sent(),m=Math.exp(-n.smoothness)/p.radiusFactor,h=Object(ps.a)(e.webgl,p.texture,p.gridDim,p.gridTexDim,p.gridTexScale,p.transform,m,!0,null==i?void 0:i.vertexTexture.ref.value,null==i?void 0:i.groupTexture.ref.value,null==i?void 0:i.normalTexture.ref.value),g=T.g.expand(Object(T.g)(),t.boundary.sphere,n.radiusOffset+Object(ze.i)(t)),[2,fs.a.create(h.vertexCount,1,h.vertexTexture,h.groupTexture,h.normalTexture,g,i)]}}))}))}var Cs=r(80);function js(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,s,u,c,l,d,f,p;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return n=i.smoothness,[4,as(r,t,i).runInContext(e.runtime)];case 1:return s=o.sent(),u=s.transform,c=s.field,l=s.idField,d={isoLevel:Math.exp(-n),scalarField:c,idField:l},[4,Object(ds.a)(d,a).runAsChild(e.runtime)];case 2:return f=o.sent(),Cs.a.transform(f,u),p=T.g.expand(Object(T.g)(),t.boundary.sphere,i.radiusOffset+Object(ze.k)(t)),f.setBoundingSphere(p),[2,f]}}))}))}var Ps=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.e),ns),{sizeFactor:d.ParamDefinition.Numeric(3,{min:0,max:10,step:.1}),lineSizeAttenuation:d.ParamDefinition.Boolean(!1),ignoreHydrogens:d.ParamDefinition.Boolean(!1)});function Es(e){return Object(Le.f)({defaultProps:d.ParamDefinition.getDefaultValues(Ps),createGeometry:js,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)}},e)}var As={"gaussian-surface-mesh":function(e,t){return Object(Lt.a)("Gaussian surface mesh",e,t,ys)},"structure-gaussian-surface-mesh":function(e,t){return Object(Ft.a)("Structure-Gaussian surface mesh",e,t,_s)},"gaussian-surface-wireframe":function(e,t){return Object(Lt.a)("Gaussian surface wireframe",e,t,Es)}},Ds=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},hs),Ps),{visuals:d.ParamDefinition.MultiSelect(["gaussian-surface-mesh"],d.ParamDefinition.objectToOptions(As))});var Ts=Object(Ft.b)({name:"gaussian-surface",label:"Gaussian Surface",description:"Displays a gaussian molecular surface.",factory:function(e,t){return ye.a.createMulti("Gaussian Surface",e,t,Ft.c,As)},getParams:function(e,t){return d.ParamDefinition.clone(Ds)},defaultValues:d.ParamDefinition.getDefaultValues(Ds),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}}),Is=r(216),Ms=r(290),ks=Object(o.__assign)(Object(o.__assign)({},st.i),{background:d.ParamDefinition.Boolean(!0),backgroundMargin:d.ParamDefinition.Numeric(0,{min:0,max:1,step:.01}),backgroundColor:d.ParamDefinition.Color(J.a.black),backgroundOpacity:d.ParamDefinition.Numeric(.5,{min:0,max:1,step:.01}),level:d.ParamDefinition.Select("residue",[["chain","Chain"],["residue","Residue"],["element","Element"]]),chainScale:d.ParamDefinition.Numeric(10,{min:0,max:20,step:.1}),residueScale:d.ParamDefinition.Numeric(1,{min:0,max:20,step:.1}),elementScale:d.ParamDefinition.Numeric(.5,{min:0,max:20,step:.1})});function Bs(e){return Object(st.j)({defaultProps:d.ParamDefinition.getDefaultValues(ks),createGeometry:Vs,createLocationIterator:vt.fromStructure,getLoci:kt,eachLocation:Mt,setUpdateState:function(e,t,r){e.createGeometry=t.level!==r.level||"chain"===t.level&&t.chainScale!==r.chainScale||"residue"===t.level&&t.residueScale!==r.residueScale||"element"===t.level&&t.elementScale!==r.elementScale}},e)}function Vs(e,t,r,n,i){switch(n.level){case"chain":return function(e,t,r,n,i){for(var a=A.StructureElement.Location.create(t),o=t.units,s=t.serialMapping,u=A.StructureProperties.chain,c=u.auth_asym_id,l=u.label_asym_id,d=s.cumulativeUnitElementCount,f=o.length,p=n.chainScale,m=Is.a.create(n,f,f/2,i),h=0,g=o.length;h<g;++h){var v=o[h];a.unit=v,a.element=v.elements[0];var b=v.lookup3d.boundary.sphere,y=b.center,_=b.radius;M.Vec3.transformMat4(Rs,y,v.conformation.operator.matrix);var S=c(a),x=l(a),O=S===x?x:x+" ["+S+"]";m.add(O,Rs[0],Rs[1],Rs[2],_,p,d[h])}return m.getText()}(0,t,0,n,i);case"residue":return function(e,t,r,n,i){for(var a=A.StructureElement.Location.create(t),o=t.units,s=t.serialMapping,u=A.StructureProperties.atom.label_comp_id,c=A.StructureProperties.residue.auth_seq_id,l=s.cumulativeUnitElementCount,d=2*t.polymerResidueCount,f=n.residueScale,p=Is.a.create(n,d,d/2,i),m=0,h=o.length;m<h;++m){var g=o[m],v=g.conformation.position,b=g.elements;a.unit=g,a.element=g.elements[0];for(var y=g.model.atomicHierarchy.residueAtomSegments.index,_=l[m],S=0,x=b.length;S<x;){var O=S,w=y[b[S]];for(S++;S<x&&y[b[S]]===w;)S++;Ls.reset();for(var C=O;C<S;C++)v(b[C],Rs),Ls.includePosition(Rs);Ls.finishedIncludeStep();for(C=O;C<S;C++)v(b[C],Rs),Ls.radiusPosition(Rs);a.element=b[O];var j=Ls.getSphere(),P=j.center,E=j.radius,D=c(a),T=u(a)+" "+D;p.add(T,P[0],P[1],P[2],E,f,_+O)}}return p.getText()}(0,t,0,n,i);case"element":return function(e,t,r,n,i){for(var a=A.StructureElement.Location.create(t),o=t.units,s=t.serialMapping,u=A.StructureProperties.atom,c=u.label_atom_id,l=u.label_alt_id,d=s.cumulativeUnitElementCount,f=Object(Ms.a)({},{scale:1}),p=t.elementCount,m=n.elementScale,h=Is.a.create(n,p,p/2,i),g=0,v=o.length;g<v;++g){var b=o[g],y=b.conformation.position,_=b.elements;a.unit=b;for(var S=d[g],x=0,O=_.length;x<O;x++){a.element=_[x],y(a.element,Rs);var w=c(a),C=l(a),j=C?w+"%"+C:w;h.add(j,Rs[0],Rs[1],Rs[2],f.size(a),m,S+x)}}return h.getText()}(0,t,0,n,i)}}var Rs=Object(M.Vec3)(),Ls=new he.a("98");var Ns={"label-text":function(e,t){return Object(Ft.a)("Label text",e,t,Bs)}},Fs=Object(o.__assign)(Object(o.__assign)({},ks),{visuals:d.ParamDefinition.MultiSelect(["label-text"],d.ParamDefinition.objectToOptions(Ns))});var Us=Object(Ft.b)({name:"label",label:"Label",description:"Displays labels.",factory:function(e,t){var r=ye.a.createMulti("Label",e,t,Ft.c,Ns);return r.setState({pickable:!1,markerActions:_e.a.None}),r},getParams:function(e,t){return d.ParamDefinition.clone(Fs)},defaultValues:d.ParamDefinition.getDefaultValues(Fs),defaultColorTheme:{name:"uniform"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}}),zs=r(25);var Hs={probeRadius:d.ParamDefinition.Numeric(1.4,{min:0,max:10,step:.1},{description:"Radius of the probe tracing the molecular surface."}),resolution:d.ParamDefinition.Numeric(.5,{min:.01,max:20,step:.01},Object(o.__assign)({description:"Grid resolution/cell spacing."},Bt.a.CustomQualityParamInfo)),probePositions:d.ParamDefinition.Numeric(30,{min:12,max:90,step:1},Object(o.__assign)({description:"Number of positions tested for probe target intersection."},Bt.a.CustomQualityParamInfo))};d.ParamDefinition.getDefaultValues(Hs);function Gs(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){function s(e,t,r,n,i){if(-1!==f){if((s=f)!==n&&s!==i&&u(s,e,t,r))return s;f=-1}for(var a=0,o=w.count;a<o;++a){var s;if((s=Ee.OrderedSet.getAt(C,w.indices[a]))!==n&&s!==i&&u(s,e,t,r))return f=s,s}return-1}function u(e,t,r,n){var i=D[e],a=j[e]-t,o=P[e]-r,s=E[e]-n;return a*a+o*o+s*s<i*i}function c(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var t;return Object(o.__generator)(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<I?(function(e,t){for(var r=e;r<t;++r){var n=Ee.OrderedSet.getAt(C,r),i=j[n],a=P[n],o=E[n],u=D[n],c=u*u;O.find(i,a,o,u);for(var l=Math.ceil(u*_),d=Math.floor(_*(i-R)),f=Math.floor(_*(a-L)),p=Math.floor(_*(o-N)),m=Math.max(0,d-l),h=Math.max(0,f-l),g=Math.max(0,p-l),v=Math.min(z,d+l+2),b=Math.min(H,f+l+2),y=Math.min(G,p+l+2),S=m;S<v;++S)for(var x=$[S]-i,w=S*W,T=h;T<b;++T)for(var I=ee[T]-a,M=x*x+I*I,k=T*q+w,B=g;B<y;++B){var V=te[B]-o,F=M+V*V;if(F<c){var U=B+k;Z[U]<0&&(Z[U]*=-1);var X=Math.sqrt(F),Y=u/X;if(-1===s(x*Y+i,I*Y+a,V*Y+o,n,-1)){var Q=u-X;Q<Z[U]&&(Z[U]=Q,J[U]=A[r])}}}}}(t,Math.min(t+re,I)),e.shouldUpdate?[4,e.update({message:"projecting points",current:t,max:I})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t+=re,[3,1];case 4:return[2]}}))}))}function l(e,t){var r,n,i=D[e],a=D[t],o=p[0]=j[t]-j[e],u=p[1]=P[t]-P[e],c=p[2]=E[t]-E[e],l=o*o+u*u+c*c,d=Math.sqrt(l),v=i*((i*i+d*d-a*a)/(2*i*d));M.Vec3.normalize(p,p),n=p,(r=h)[0]=r[1]=r[2]=1,0!==n[0]?r[0]=(n[1]+n[2])/-n[0]:0!==n[1]?r[1]=(n[0]+n[2])/-n[1]:0!==n[2]&&(r[2]=(n[0]+n[1])/-n[2]),M.Vec3.normalize(h,h),M.Vec3.cross(g,p,h),M.Vec3.normalize(g,g);var b=Math.sqrt(i*i-v*v);M.Vec3.scale(h,h,b),M.Vec3.scale(g,g,b),M.Vec3.scale(p,p,v),m[0]=p[0]+j[e],m[1]=p[1]+P[e],m[2]=p[2]+E[e],f=-1;for(var x=0;x<y;++x){var O=Y[x],w=Q[x],T=m[0]+O*h[0]+w*g[0],I=m[1]+O*h[1]+w*g[1],k=m[2]+O*h[2]+w*g[2];if(-1===s(T,I,k,e,t))for(var B=Math.floor(_*(T-R)),V=Math.floor(_*(I-L)),F=Math.floor(_*(k-N)),U=Math.max(0,B-S),X=Math.max(0,V-S),K=Math.max(0,F-S),re=Math.min(z,B+S+2),ne=Math.min(H,V+S+2),ie=Math.min(G,F+S+2),ae=U;ae<re;++ae)for(var oe=T-$[ae],se=ae*W,ue=X;ue<ne;++ue)for(var ce=I-ee[ue],le=oe*oe+ce*ce,de=ue*q+se,fe=K;fe<ie;++fe){var pe=k-te[fe],me=le+pe*pe,he=fe+de,ge=Z[he];if(ge>0&&me<ge*ge){Z[he]=Math.sqrt(me);var ve=oe*p[0]+ce*p[1]+pe*p[2];J[he]=A[Ee.OrderedSet.indexOf(C,ve<0?t:e)]}}}}function d(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var t;return Object(o.__generator)(this,(function(r){switch(r.label){case 0:t=0,r.label=1;case 1:return t<I?(function(e,t){for(var r=e;r<t;++r){var n=Ee.OrderedSet.getAt(C,r);O.find(j[n],P[n],E[n],D[n]);for(var i=0,a=w.count;i<a;++i){var o=Ee.OrderedSet.getAt(C,w.indices[i]);n<o&&l(n,o)}}}(t,Math.min(t+re,I)),e.shouldUpdate?[4,e.update({message:"projecting torii",current:t,max:I})]:[3,3]):[3,4];case 2:r.sent(),r.label=3;case 3:return t+=re,[3,1];case 4:return[2]}}))}))}var f,p,m,h,g,v,b,y,_,S,x,O,w,C,j,P,E,A,D,I,k,B,V,R,L,N,F,U,z,H,G,q,W,X,Y,Q,K,Z,J,$,ee,te,re,ne,ie,ae;return Object(o.__generator)(this,(function(e){switch(e.label){case 0:return f=-1,p=Object(M.Vec3)(),m=Object(M.Vec3)(),h=Object(M.Vec3)(),g=Object(M.Vec3)(),v=a.resolution,b=a.probeRadius,y=a.probePositions,_=1/v,S=Math.max(5,2+Math.floor(b*_)),x=M.Vec3.create(n,n,n),M.Vec3.scale(x,x,2),O=Object(T.c)(t,r,x),w=O.result,null===i&&(i=O.boundary.box),C=t.indices,j=t.x,P=t.y,E=t.z,A=t.id,D=t.radius,I=Ee.OrderedSet.size(C),k=n+v,B=T.b.expand(Object(T.b)(),i,M.Vec3.create(k,k,k)),V=B.min,R=V[0],L=V[1],N=V[2],F=T.b.scale(Object(T.b)(),B,_),U=T.b.size(Object(M.Vec3)(),F),M.Vec3.ceil(U,U),z=U[0],H=U[1],G=U[2],W=(q=G)*H,X=function(e){for(var t=0,r=2*Math.PI/e,n=new Float32Array(e),i=new Float32Array(e),a=0;a<e;a++)n[a]=Math.cos(t),i[a]=Math.sin(t),t+=r;return{cosTable:n,sinTable:i}}(y),Y=X.cosTable,Q=X.sinTable,K=M.Tensor.Space(U,[0,1,2],Float32Array),Z=K.create(),J=K.create(),Z.fill(-1001),J.fill(-1),$=Object(T.i)(z,R,v),ee=Object(T.i)(H,L,v),te=Object(T.i)(G,N,v),re=Math.ceil(1e5/(Math.pow(Math.pow(n,3),3)*_)),[4,c()];case 1:return e.sent(),[4,d()];case 2:return e.sent(),ne=M.Tensor.create(K,Z),ie=M.Tensor.create(K,J),ae=zs.c.identity(),zs.c.fromScaling(ae,M.Vec3.create(v,v,v)),zs.c.setTranslation(ae,B.min),[2,{field:ne,idField:ie,transform:ae}]}}))}))}function qs(e,t,r){var n=this,i=t.lookup3d.boundary.box,a=Object(ze.d)(i,r),s=function(e,t,r){for(var n=r.probeRadius,i=Object(ze.j)(e,t,r),a=i.position,s=i.boundary,u=i.radius,c=a.indices,l=Ee.OrderedSet.size(c),d=new Float32Array(Ee.OrderedSet.end(c)),f=0,p=0;p<l;++p){var m=Ee.OrderedSet.getAt(c,p),h=u(m);f<h&&(f=h),d[m]=h+n}return{position:Object(o.__assign)(Object(o.__assign)({},a),{radius:d}),boundary:s,maxRadius:f}}(e,t,a),u=s.position,c=s.boundary,l=s.maxRadius;return _.b.create("Molecular Surface",(function(e){return Object(o.__awaiter)(n,void 0,void 0,(function(){return Object(o.__generator)(this,(function(t){switch(t.label){case 0:return[4,Ws(e,u,c,l,i,a)];case 1:return[2,t.sent()]}}))}))}))}function Ws(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(o){return[2,Gs(e,t,r,n,i,a)]}))}))}var Xs=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.g),Hs),ze.a);function Ys(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,s,u,c,l,d,f;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return[4,qs(r,t,i).runInContext(e.runtime)];case 1:return n=o.sent(),s=n.transform,u=n.field,c=n.idField,l={isoLevel:i.probeRadius,scalarField:u,idField:c},[4,Object(ds.b)(l,a).runAsChild(e.runtime)];case 2:return d=o.sent(),Ve.a.transform(d,s),e.webgl&&!e.webgl.isWebGL2&&Ve.a.uniformTriangleGroup(d),f=T.g.expand(Object(T.g)(),t.boundary.sphere,i.probeRadius+Object(ze.k)(t)),d.setBoundingSphere(f),[2,d]}}))}))}function Qs(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(Xs),createGeometry:Ys,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.probeRadius!==r.probeRadius&&(e.createGeometry=!0),t.probePositions!==r.probePositions&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)}},e)}var Ks=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.e),Hs),ze.a),{sizeFactor:d.ParamDefinition.Numeric(1.5,{min:0,max:10,step:.1})});function Zs(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,s,u,c,l,d,f;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return[4,qs(r,t,i).runInContext(e.runtime)];case 1:return n=o.sent(),s=n.transform,u=n.field,c=n.idField,l={isoLevel:i.probeRadius,scalarField:u,idField:c},[4,Object(ds.a)(l,a).runAsChild(e.runtime)];case 2:return d=o.sent(),Cs.a.transform(d,s),f=T.g.expand(Object(T.g)(),t.boundary.sphere,i.probeRadius+Object(ze.k)(t)),d.setBoundingSphere(f),[2,d]}}))}))}function Js(e){return Object(Le.f)({defaultProps:d.ParamDefinition.getDefaultValues(Ks),createGeometry:Zs,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.probeRadius!==r.probeRadius&&(e.createGeometry=!0),t.probePositions!==r.probePositions&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)}},e)}var $s={"molecular-surface-mesh":function(e,t){return Object(Lt.a)("Molecular surface mesh",e,t,Qs)},"molecular-surface-wireframe":function(e,t){return Object(Lt.a)("Molecular surface wireframe",e,t,Js)}},eu=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Xs),Ks),{visuals:d.ParamDefinition.MultiSelect(["molecular-surface-mesh"],d.ParamDefinition.objectToOptions($s))});var tu=Object(Ft.b)({name:"molecular-surface",label:"Molecular Surface",description:"Displays a molecular surface.",factory:function(e,t){return ye.a.createMulti("Molecular Surface",e,t,Ft.c,$s)},getParams:function(e,t){return d.ParamDefinition.clone(eu)},defaultValues:d.ParamDefinition.getDefaultValues(eu),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}}),ru=Object(o.__assign)(Object(o.__assign)({},Le.g),{sizeFactor:d.ParamDefinition.Numeric(1,{min:0,max:2,step:.1}),detail:d.ParamDefinition.Numeric(0,{min:0,max:3,step:1},Bt.a.CustomQualityParamInfo)});function nu(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(ru),createGeometry:iu,createLocationIterator:au,getLoci:ou,eachLocation:su,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail}},e)}function iu(e,t,r,n,i,a){if(!function(e){if(A.Unit.Traits.is(e.traits,1))return!1;if(A.Unit.Traits.is(e.traits,2))return!1;if(A.Unit.isCoarse(e))return!0;if(0===e.elements.length)return!1;e.model.atomicHierarchy.derived.residue.moleculeType;var t=e.residueIndex[e.elements[0]],r=e.model.atomicHierarchy.derived.residue.moleculeType[t];return 3!==r&&2!==r}(t))return Ve.a.createEmpty(a);var o=i.detail,s=i.sizeFactor,u=_t.a.createState(256,128,a),c=t.principalAxes.boxAxes,l=c.origin,d=c.dirA,f=c.dirB,p=T.a.size(Object(M.Vec3)(),c);M.Vec3.scale(p,p,s/2);var m=M.Vec3.create(p[2],p[1],p[0]);u.currentGroup=0,Object(Po.a)(u,l,d,f,m,o+1);var h=_t.a.getMesh(u),g=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return h.setBoundingSphere(g),h}function au(e){var t=e.group,r=e.structure,n=t.units.length,i=A.StructureElement.Location.create(r);return Object(Fe.a)(1,n,1,(function(e,r){var n=t.units[r];return i.unit=n,i.element=n.elements[e],i}))}function ou(e,t,r){var n=e.objectId,i=e.instanceId;if(r===n){var a=t.structure,o=t.group.units[i],s=Ee.OrderedSet.ofBounds(0,o.elements.length);return A.StructureElement.Loci(a,[{unit:o,indices:s}])}return me.EmptyLoci}function su(e,t,r){var n=!1;if(!A.StructureElement.Loci.is(e))return!1;var i=t.structure,a=t.group;if(!A.Structure.areEquivalent(e.structure,i))return!1;for(var o=a.elements.length,s=0,u=e.elements;s<u.length;s++){var c=u[s],l=a.unitIndexMap.get(c.unit.id);void 0!==l&&Ee.OrderedSet.size(c.indices)===o&&r(Ee.Interval.ofSingleton(l))&&(n=!0)}return n}var uu={"orientation-ellipsoid-mesh":function(e,t){return Object(Lt.a)("Orientation ellipsoid mesh",e,t,nu)}},cu=Object(o.__assign)(Object(o.__assign)({},ru),{visuals:d.ParamDefinition.MultiSelect(["orientation-ellipsoid-mesh"],d.ParamDefinition.objectToOptions(uu))});var lu,du=Object(Ft.b)({name:"orientation",label:"Orientation",description:"Displays orientation ellipsoids for polymer chains.",factory:function(e,t){return ye.a.createMulti("Orientation",e,t,Ft.c,uu)},getParams:function(e,t){return d.ParamDefinition.clone(cu)},defaultValues:d.ParamDefinition.getDefaultValues(cu),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}}),fu=r(269),pu=y.a.add3,mu=y.a.add;(lu||(lu={})).create=function(e,t,r){void 0===e&&(e=2048),void 0===t&&(t=1024);var n=y.a.create(Float32Array,3,t,r?r.centerBuffer.ref.value:e),i=y.a.create(Float32Array,1,t,r?r.groupBuffer.ref.value:e);return{add:function(e,t,r,a){pu(n,e,t,r),mu(i,a)},getPoints:function(){var e=y.a.compact(n,!0),t=y.a.compact(i,!0);return fu.a.create(e,t,n.elementCount,r)}}};var hu=Object(o.__assign)(Object(o.__assign)({},Le.i),{pointSizeAttenuation:d.ParamDefinition.Boolean(!1),ignoreHydrogens:d.ParamDefinition.Boolean(!1),traceOnly:d.ParamDefinition.Boolean(!1)});function gu(e,t,r,n,i,a){var o=t.elements,s=o.length,u=lu.create(s,s/10,a),c=Object(M.Vec3)(),l=t.conformation.invariantPosition,d=Et(t,i);if(d)for(var f=0;f<s;++f)d(t,o[f])||(l(o[f],c),u.add(c[0],c[1],c[2],f));else for(f=0;f<s;++f)l(o[f],c),u.add(c[0],c[1],c[2],f);var p=u.getPoints(),m=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return p.setBoundingSphere(m),p}function vu(e){return Object(Le.j)({defaultProps:d.ParamDefinition.getDefaultValues(hu),createGeometry:gu,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){e.createGeometry=t.ignoreHydrogens!==r.ignoreHydrogens||t.traceOnly!==r.traceOnly}},e)}var bu={"element-point":function(e,t){return Object(Lt.a)("Points",e,t,vu)}},yu=Object(o.__assign)({},hu);var _u=Object(Ft.b)({name:"point",label:"Point",description:"Displays elements (atoms, coarse spheres) as spheres.",factory:function(e,t){return ye.a.createMulti("Point",e,t,Ft.c,bu)},getParams:function(e,t){return d.ParamDefinition.clone(yu)},defaultValues:d.ParamDefinition.getDefaultValues(yu),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}}),Su={sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01}),detail:d.ParamDefinition.Numeric(0,{min:0,max:3,step:1},Bt.a.CustomQualityParamInfo),linearSegments:d.ParamDefinition.Numeric(8,{min:1,max:48,step:1},Bt.a.CustomQualityParamInfo),radialSegments:d.ParamDefinition.Numeric(16,{min:2,max:56,step:2},Bt.a.CustomQualityParamInfo)},xu=(d.ParamDefinition.getDefaultValues(Su),Object(M.Vec3)());function Ou(e,t,r,n,i,a){var o=t.polymerElements.length;if(!o)return Ve.a.createEmpty(a);for(var s=i.sizeFactor,u=i.detail,c=i.linearSegments,l=i.radialSegments,d=c*l*o+(l+1)*o*2,f=_t.a.createState(d,d/10,a),p=Pn(c),m=p.curvePoints,h=p.normalVectors,g=p.binormalVectors,v=p.widthValues,b=p.heightValues,y=0,_=un(t,r,!0);_.hasNext;){var S=_.move();f.currentGroup=y;var x=Object(Ne.isNucleic)(S.moleculeType)?.3:.5;En(p,S,.5,x);var O=S.coarseBackboneFirst||S.first,w=S.coarseBackboneLast||S.last,C=n.size.size(S.centerPrev)*s,j=n.size.size(S.center)*s,P=n.size.size(S.centerNext)*s;Un(p,C,j,P,C,j,P,x);var E=c;if(S.initial){var A=c-(E=Math.max(Math.round(c*x),1));m.copyWithin(0,3*A),g.copyWithin(0,3*A),h.copyWithin(0,3*A),v.copyWithin(0,3*A),b.copyWithin(0,3*A),M.Vec3.fromArray(xu,m,3),M.Vec3.normalize(xu,M.Vec3.sub(xu,S.p2,xu)),M.Vec3.scaleAndAdd(xu,S.p2,xu,2*j),M.Vec3.toArray(xu,m,0)}else S.final&&(E=Math.max(Math.round(c*(1-x)),1),M.Vec3.fromArray(xu,m,3*E-3),M.Vec3.normalize(xu,M.Vec3.sub(xu,S.p2,xu)),M.Vec3.scaleAndAdd(xu,S.p2,xu,2*j),M.Vec3.toArray(xu,m,3*E));!0===S.initial&&!0===S.final?Object(St.a)(f,S.p2,2*j,u):2===l?bo(f,m,h,g,E,v,b,0):4===l?Ra(f,m,h,g,E,v,b,0,O,w):Za(f,m,h,g,E,l,v,b,O,w),++y}var D=_t.a.getMesh(f),I=T.g.expand(Object(T.g)(),t.boundary.sphere,1*i.sizeFactor);return D.setBoundingSphere(I),D}var wu=Object(o.__assign)(Object(o.__assign)({},Le.g),Su);function Cu(e){return Object(Le.h)({defaultProps:d.ParamDefinition.getDefaultValues(wu),createGeometry:Ou,createLocationIterator:zn.fromGroup,getLoci:Xn,eachLocation:Zn,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.detail!==r.detail||t.linearSegments!==r.linearSegments||t.radialSegments!==r.radialSegments}},e)}var ju={"polymer-tube":function(e,t){return Object(Lt.a)("Polymer tube mesh",e,t,Cu)},"polymer-gap":function(e,t){return Object(Lt.a)("Polymer gap cylinder",e,t,la)}},Pu=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},wu),ca),{sizeFactor:d.ParamDefinition.Numeric(.2,{min:0,max:10,step:.01}),visuals:d.ParamDefinition.MultiSelect(["polymer-tube","polymer-gap"],d.ParamDefinition.objectToOptions(ju))});var Eu=Object(Ft.b)({name:"putty",label:"Putty",description:"Displays a tube smoothly following the trace atoms of polymers.",factory:function(e,t){return ye.a.createMulti("Putty",e,t,Ft.c,ju)},getParams:function(e,t){var r=d.ParamDefinition.clone(Pu),n=!1,i=!1;return t.units.forEach((function(e){!n&&A.Unit.isAtomic(e)&&e.nucleotideElements.length&&(n=!0),!i&&e.gapElements.length&&(i=!0)})),r.visuals.defaultValue=["polymer-tube"],i&&r.visuals.defaultValue.push("polymer-gap"),r},defaultValues:d.ParamDefinition.getDefaultValues(Pu),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uncertainty"},isApplicable:function(e){return e.polymerResidueCount>0}}),Au={"element-sphere":function(e,t){return Object(Lt.a)("Sphere mesh",e,t,Rt)}},Du=Object(o.__assign)({},Vt);var Tu=Object(Ft.b)({name:"spacefill",label:"Spacefill",description:"Displays atomic/coarse elements as spheres.",factory:function(e,t){return ye.a.createMulti("Spacefill",e,t,Ft.c,Au)},getParams:function(e,t){return d.ParamDefinition.clone(Du)},defaultValues:d.ParamDefinition.getDefaultValues(Du),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"physical"},isApplicable:function(e){return e.elementCount>0}}),Iu=Ne.BondType.is;function Mu(e,t,r,n,i,a){if(!A.Unit.isAtomic(t))return Cs.a.createEmpty(a);var o=A.StructureElement.Location.create(r,t),s=t.elements,u=t.bonds,c=u.edgeCount,l=u.a,d=u.b,f=u.edgeProps,p=u.offset,m=f.order,h=f.flags,g=i.sizeFactor;if(!c)return Cs.a.createEmpty(a);var v=Object(M.Vec3)(),b=t.conformation.invariantPosition,y={linkCount:2*c,referencePosition:function(e){var t,r,n=l[e],i=d[e];n>i&&(n=(t=[i,n])[0],i=t[1]),p[n+1]-p[n]==1&&(n=(r=[i,n])[0],i=r[1]);for(var a=p[n],o=p[n+1];a<o;++a){var u=d[a];if(u!==i&&u!==n)return b(s[u],v)}for(a=p[i],o=p[i+1];a<o;++a){var c=l[a];if(c!==n&&c!==i)return b(s[c],v)}return null},position:function(e,t,r){b(s[l[r]],e),b(s[d[r]],t)},style:function(e){var t=m[e],r=h[e];return Iu(r,2)||Iu(r,4)?1:2===t?2:3===t?3:0},radius:function(e){o.element=s[l[e]];var t=n.size.size(o);o.element=s[d[e]];var r=n.size.size(o);return Math.min(t,r)*g},ignore:Xe(t,i)},_=Object(Re.e)(e,y,i,a),S=T.g.expand(Object(T.g)(),t.boundary.sphere,1*g);return _.setBoundingSphere(S),_}var ku=Object(o.__assign)(Object(o.__assign)({},Le.e),qe);function Bu(e){return Object(Le.f)({defaultProps:d.ParamDefinition.getDefaultValues(ku),createGeometry:Mu,createLocationIterator:ke.fromGroup,getLoci:Qe,eachLocation:Ke,setUpdateState:function(e,t,r,n,i,a,o){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.dashCount!==r.dashCount||t.ignoreHydrogens!==r.ignoreHydrogens||!Object(De.f)(t.includeTypes,r.includeTypes)||!Object(De.f)(t.excludeTypes,r.excludeTypes);var s=a.group.units[0],u=o.group.units[0];A.Unit.isAtomic(s)&&A.Unit.isAtomic(u)&&($e.a.areEqual(s.bonds,u.bonds)||(e.createGeometry=!0,e.updateTransform=!0,e.updateColor=!0,e.updateSize=!0))}},e)}var Vu=new A.Bond.ElementBondIterator;function Ru(e,t,r,n){for(Vu.setElement(t,r,n);Vu.hasNext;){var i=Vu.move();return i.otherUnit.conformation.position(i.otherUnit.elements[i.otherIndex],e),e}return null}var Lu=Object(M.Vec3)(),Nu=A.StructureElement.Location.create(void 0);function Fu(e,t,r,n,i){var a=t.interUnitBonds,o=a.edgeCount,s=a.edges,u=n.sizeFactor;if(!o)return Cs.a.createEmpty(i);var c={linkCount:o,referencePosition:function(e){var r,n,i,a,o=s[e];if(o.unitA<o.unitB)r=t.unitMap.get(o.unitA),n=t.unitMap.get(o.unitB),i=o.indexA,a=o.indexB;else{if(!(o.unitA>o.unitB))throw new Error("same units in createInterUnitBondLines");r=t.unitMap.get(o.unitB),n=t.unitMap.get(o.unitA),i=o.indexB,a=o.indexA}return Ru(Lu,t,r,i)||Ru(Lu,t,n,a)},position:function(e,r,n){var i=s[n],a=t.unitMap.get(i.unitA),o=t.unitMap.get(i.unitB);a.conformation.position(a.elements[i.indexA],e),o.conformation.position(o.elements[i.indexB],r)},style:function(e){var t=s[e].props.order,r=De.a.create(s[e].props.flag);return Ne.BondType.is(r,2)||Ne.BondType.is(r,4)?1:2===t?2:3===t?3:0},radius:function(e){var n=s[e];Nu.structure=t,Nu.unit=t.unitMap.get(n.unitA),Nu.element=Nu.unit.elements[n.indexA];var i=r.size.size(Nu);Nu.unit=t.unitMap.get(n.unitB),Nu.element=Nu.unit.elements[n.indexB];var a=r.size.size(Nu);return Math.min(i,a)*u},ignore:Ye(t,n)},l=Object(Re.e)(e,c,n,i),d=T.g.expand(Object(T.g)(),t.boundary.sphere,1*u);return l.setBoundingSphere(d),l}var Uu=Object(o.__assign)(Object(o.__assign)({},st.e),qe);function zu(e){return Object(st.f)({defaultProps:d.ParamDefinition.getDefaultValues(Uu),createGeometry:Fu,createLocationIterator:ke.fromStructure,getLoci:Ze,eachLocation:Je,setUpdateState:function(e,t,r){e.createGeometry=t.sizeFactor!==r.sizeFactor||t.linkScale!==r.linkScale||t.linkSpacing!==r.linkSpacing||t.dashCount!==r.dashCount||t.ignoreHydrogens!==r.ignoreHydrogens||!Object(De.f)(t.includeTypes,r.includeTypes)||!Object(De.f)(t.excludeTypes,r.excludeTypes)}},e)}var Hu={"intra-bond":function(e,t){return Object(Lt.a)("Intra-unit bond line",e,t,Bu)},"inter-bond":function(e,t){return Object(Nt.a)("Inter-unit bond line",e,t,zu)}},Gu=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},ku),Uu),{sizeFactor:d.ParamDefinition.Numeric(1.5,{min:.01,max:10,step:.01}),unitKinds:Object(Ut.j)(["atomic"]),visuals:d.ParamDefinition.MultiSelect(["intra-bond","inter-bond"],d.ParamDefinition.objectToOptions(Hu))});var qu=Object(Ft.b)({name:"line",label:"Line",description:"Displays bonds as lines.",factory:function(e,t){return ye.a.createMulti("Line",e,t,Ft.c,Hu)},getParams:function(e,t){return d.ParamDefinition.clone(Gu)},defaultValues:d.ParamDefinition.getDefaultValues(Gu),defaultColorTheme:{name:"element-symbol"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}}),Wu=r(151);function Xu(e,t,r,n,i){return Object(o.__awaiter)(this,void 0,void 0,(function(){var r,a,s,u,c,l,d,f,p,m,h,g,v;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:if(r=e.runtime,!(a=e.webgl)||!a.extensions.blendMinMax)throw new Error("GaussianDensityVolume requires `webgl` and `blendMinMax` extension");return s=i?i.gridTexture.ref.value:void 0,[4,cs(t,n,a,s).runInContext(r)];case 1:return u=o.sent(),c=u.transform,l=u.texture,d=u.bbox,f=u.gridDim,p={min:0,max:1,mean:.04,sigma:.01},m=M.Mat4.mul(Object(M.Mat4)(),c,M.Mat4.fromScaling(Object(M.Mat4)(),f)),h=M.Mat4.getScaling(Object(M.Vec3)(),c),g=Wu.a.create(d,f,c,m,h,l,p,!0,i),v=T.g.expand(Object(T.g)(),t.boundary.sphere,n.radiusOffset+Object(ze.i)(t)),g.setBoundingSphere(v),[2,g]}}))}))}var Yu=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},st.c),ns),{ignoreHydrogens:d.ParamDefinition.Boolean(!1)});function Qu(e){return Object(st.d)({defaultProps:d.ParamDefinition.getDefaultValues(Yu),createGeometry:Xu,createLocationIterator:vt.fromStructure,getLoci:kt,eachLocation:Mt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)},dispose:function(e){e.gridTexture.ref.value.destroy()}},e)}function Ku(e,t,r,n,i,a){return Object(o.__awaiter)(this,void 0,void 0,(function(){var n,s,u,c,l,d,f,p,m,h,g,v,b;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:if(n=e.runtime,!(s=e.webgl))throw new Error("GaussianDensityVolume requires `webgl`");return u=a?a.gridTexture.ref.value:void 0,[4,os(r,t,i,s,u).runInContext(n)];case 1:return c=o.sent(),l=c.transform,d=c.texture,f=c.bbox,p=c.gridDim,m={min:0,max:1,mean:.04,sigma:.01},h=M.Mat4.mul(Object(M.Mat4)(),l,M.Mat4.fromScaling(Object(M.Mat4)(),p)),g=M.Mat4.getScaling(Object(M.Vec3)(),l),v=Wu.a.create(f,p,l,h,g,d,m,!0,a),b=T.g.expand(Object(T.g)(),t.boundary.sphere,i.radiusOffset+Object(ze.k)(t)),v.setBoundingSphere(b),[2,v]}}))}))}var Zu=Object(o.__assign)(Object(o.__assign)(Object(o.__assign)({},Le.c),ns),{ignoreHydrogens:d.ParamDefinition.Boolean(!1)});function Ju(e){return Object(Le.d)({defaultProps:d.ParamDefinition.getDefaultValues(Zu),createGeometry:Ku,createLocationIterator:vt.fromGroup,getLoci:It,eachLocation:Tt,setUpdateState:function(e,t,r){t.resolution!==r.resolution&&(e.createGeometry=!0),t.radiusOffset!==r.radiusOffset&&(e.createGeometry=!0),t.smoothness!==r.smoothness&&(e.createGeometry=!0),t.ignoreHydrogens!==r.ignoreHydrogens&&(e.createGeometry=!0),t.traceOnly!==r.traceOnly&&(e.createGeometry=!0),t.includeParent!==r.includeParent&&(e.createGeometry=!0)},dispose:function(e){e.gridTexture.ref.value.destroy()}},e)}var $u={"gaussian-volume":function(e,t){return Object(Ft.a)("Gaussian volume",e,t,Qu)},"units-gaussian-volume":function(e,t){return Object(Ft.d)("Units-Gaussian volume",e,t,Ju)}},ec=Object(o.__assign)(Object(o.__assign)({},Yu),{visuals:d.ParamDefinition.MultiSelect(["gaussian-volume"],d.ParamDefinition.objectToOptions($u))});var tc=Object(Ft.b)({name:"gaussian-volume",label:"Gaussian Volume",description:"Displays a gaussian molecular density using direct volume rendering.",factory:function(e,t){return ye.a.createMulti("Gaussian Volume",e,t,Ft.c,$u)},getParams:function(e,t){var r=d.ParamDefinition.clone(ec);return r.renderMode=Wu.a.createRenderModeParam({min:0,max:1,mean:.04,sigma:.01}),r.jumpLength=d.ParamDefinition.Numeric(4,{min:0,max:20,step:.1}),r},defaultValues:d.ParamDefinition.getDefaultValues(ec),defaultColorTheme:{name:"chain-id"},defaultSizeTheme:{name:"uniform"},isApplicable:function(e){return e.elementCount>0}}),rc=function(e){function t(){var r=e.call(this)||this;return Object(x.c)(t.BuiltIn,(function(e,t){if(e.name!==t)throw new Error("Fix BuiltInStructureRepresentations to have matching names. "+e.name+" "+t);r.add(e)})),r}return Object(o.__extends)(t,e),t}(ye.b);(rc||(rc={})).BuiltIn={cartoon:jo,"ball-and-stick":Gt,carbohydrate:$r,ellipsoid:Bo,"gaussian-surface":Ts,"gaussian-volume":tc,label:Us,line:qu,"molecular-surface":tu,orientation:du,point:_u,putty:Eu,spacefill:Tu};var nc=r(390),ic=r(202),ac=r(135),oc=r(24),sc=r(183),uc=r(90),cc=r(249),lc=r(186),dc=r(177),fc=r(79),pc=r(98),mc=r(27),hc=[["full","Full"],["hidden","Hidden"]],gc={isExpanded:d.ParamDefinition.Boolean(!1),showControls:d.ParamDefinition.Boolean(!0),regionState:d.ParamDefinition.Group({left:d.ParamDefinition.Select("full",[["full","Full"],["collapsed","Collapsed"],["hidden","Hidden"]]),top:d.ParamDefinition.Select("full",hc),right:d.ParamDefinition.Select("full",hc),bottom:d.ParamDefinition.Select("full",hc)}),controlsDisplay:d.ParamDefinition.Value("outside",{isHidden:!0})},vc=function(e){function t(t){var r=e.call(this,Object(o.__assign)(Object(o.__assign)({},d.ParamDefinition.getDefaultValues(gc)),t.spec.layout&&t.spec.layout.initial))||this;return r.context=t,r.events={updated:r.ev()},r.rootState=void 0,mc.PluginCommands.Layout.Update.subscribe(t,(function(e){return r.updateProps(e.state)})),"undefined"!=typeof document&&(r.expandedViewport=document.createElement("meta"),r.expandedViewport.name="viewport",r.expandedViewport.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"),r}return Object(o.__extends)(t,e),t.prototype.updateProps=function(e){var t=!!this.state.isExpanded;this.updateState(e),this.root&&"boolean"==typeof e.isExpanded&&e.isExpanded!==t&&this.handleExpand(),this.events.updated.next()},t.prototype.setProps=function(e){this.updateState(e)},t.prototype.setRoot=function(e){this.root=e,this.state.isExpanded&&this.handleExpand()},t.prototype.getScrollElement=function(){return document.scrollingElement?document.scrollingElement:document.documentElement?document.documentElement:document.body},t.prototype.handleExpand=function(){try{var e=document.getElementsByTagName("body")[0],t=document.getElementsByTagName("head")[0];if(!e||!t||!this.root)return;if(this.state.isExpanded){for(var r=t.children,n=[],i=!1,a=0;a<r.length;a++)r[a]===this.expandedViewport?i=!0:"viewport"===(r[a].name||"").toLowerCase()&&n.push(r[a]);for(var o=0,s=n;o<s.length;o++){var u=s[o];t.removeChild(u)}i||t.appendChild(this.expandedViewport);var c=e.style,l=(h=this.getScrollElement()).scrollLeft,d=h.scrollTop;this.rootState={top:c.top,bottom:c.bottom,right:c.right,left:c.left,scrollTop:d,scrollLeft:l,position:c.position,overflow:c.overflow,viewports:n,zIndex:this.root.style.zIndex,width:c.width,height:c.height,maxWidth:c.maxWidth,maxHeight:c.maxHeight,margin:c.margin,marginLeft:c.marginLeft,marginRight:c.marginRight,marginTop:c.marginTop,marginBottom:c.marginBottom},c.overflow="hidden",c.position="fixed",c.top="0",c.bottom="0",c.right="0",c.left="0",c.width="100%",c.height="100%",c.maxWidth="100%",c.maxHeight="100%",c.margin="0",c.marginLeft="0",c.marginRight="0",c.marginTop="0",c.marginBottom="0"}else{for(r=t.children,a=0;a<r.length;a++)if(r[a]===this.expandedViewport){t.removeChild(this.expandedViewport);break}if(this.rootState){for(var f=this.rootState,p=0,m=f.viewports;p<m.length;p++){u=m[p];t.appendChild(u)}var h;(c=e.style).top=f.top,c.bottom=f.bottom,c.left=f.left,c.right=f.right,c.width=f.width,c.height=f.height,c.maxWidth=f.maxWidth,c.maxHeight=f.maxHeight,c.margin=f.margin,c.marginLeft=f.marginLeft,c.marginRight=f.marginRight,c.marginTop=f.marginTop,c.marginBottom=f.marginBottom,c.position=f.position,c.overflow=f.overflow||"",(h=this.getScrollElement()).scrollTop=f.scrollTop,h.scrollLeft=f.scrollLeft,this.rootState=void 0,this.root.style.zIndex=f.zIndex}}}catch(e){var g="Layout change error, you might have to reload the page.";this.context.log.error(g),console.error(g,e)}},t}(Oe.b),bc=r(382),yc=function(){function e(e){var t=this;this.plugin=e,this.ev=lc.RxEventHelper.create(),this.events={updated:this.ev(),removed:this.ev()},this.root=new Map,this.tracked=new Map,e.state.data.events.object.created.subscribe((function(e){t.addMapping(e.state,e.ref,e.obj)})),e.state.data.events.object.removed.subscribe((function(e){t.removeMapping(e.ref)&&t.events.removed.next({ref:e.ref,obj:e.obj})})),e.state.data.events.object.updated.subscribe((function(e){t.updateMapping(e.state,e.ref,e.oldObj,e.obj)&&t.events.updated.next({ref:e.ref,oldObj:e.oldObj,obj:e.obj})}))}return e.prototype.getDecorator=function(e){var t=this.plugin.state.data.tree,r=t.children.get(e);if(1!==r.size)return e;var n=r.first();return t.transforms.get(n).transformer.definition.isDecorator?this.getDecorator(n):e},e.prototype.get=function(e,t){void 0===t&&(t=!1);var r=this.root.get(e);if(r)return t?this.plugin.state.data.cells.get(r.ref):this.plugin.state.data.cells.get(this.getDecorator(r.ref))},e.prototype.addMapping=function(e,t,r){if(!v.a.Molecule.Structure.is(r))return!1;if(this.tracked.set(t,r.data),this.root.has(r.data)){this.root.get(r.data).count++}else{var n=e.select(g.StateSelection.Generators.byRef(t).rootOfType([v.a.Molecule.Structure]))[0];n?this.root.set(r.data,{ref:n.transform.ref,count:1}):this.root.set(r.data,{ref:t,count:1})}return!0},e.prototype.removeMapping=function(e){if(!this.tracked.has(e))return!1;var t=this.tracked.get(e);this.tracked.delete(e);var r=this.root.get(t);return r.count>1?r.count--:this.root.delete(t),!0},e.prototype.updateMapping=function(e,t,r,n){return!!v.a.Molecule.Structure.is(n)&&(this.removeMapping(t),this.addMapping(e,t,n),!0)},e.prototype.dispose=function(){this.ev.dispose()},e}(),_c=r(75),Sc=r(297),xc=function(){function e(){this.ev=lc.RxEventHelper.create(),this.id=0,this.runningTasks=new Set,this.abortRequests=new Map,this.options=new Map,this.currentContext=[],this.events={progress:this.ev(),finished:this.ev()}}return e.prototype.tryGetAbortTaskId=function(e){if(this.abortRequests.has(e.progress.taskId))return e.progress.taskId;for(var t=0,r=e.children;t<r.length;t++){var n=r[t],i=this.tryGetAbortTaskId(n);if(void 0!==i)return i}},e.prototype.track=function(e,t){var r=this;return function(n){var i;if(n.canAbort&&n.requestAbort){var a=r.tryGetAbortTaskId(n.root);void 0!==a&&n.requestAbort(r.abortRequests.get(a))}var o=Object(_c.b)()-n.root.progress.startedTime;r.events.progress.next({id:e,useOverlay:null===(i=r.options.get(t))||void 0===i?void 0:i.useOverlay,level:o<250?"none":"background",progress:n})}},e.prototype.run=function(e,t){return Object(o.__awaiter)(this,void 0,void 0,(function(){var r,n;return Object(o.__generator)(this,(function(i){switch(i.label){case 0:r=this.id++,(null==t?void 0:t.createNewContext)||0===this.currentContext.length?n={ctx:Object(Sc.a)(e,this.track(r,e.id),100),refCount:1}:(n=this.currentContext[this.currentContext.length-1]).refCount++,i.label=1;case 1:return i.trys.push([1,,3,4]),this.options.set(e.id,{useOverlay:!!(null==t?void 0:t.useOverlay)}),this.runningTasks.add(e.id),[4,Object(Sc.b)(n.ctx,e)];case 2:return[2,i.sent()];case 3:return this.options.delete(e.id),this.runningTasks.delete(e.id),this.events.finished.next({id:r}),this.abortRequests.delete(e.id),n.refCount--,0===n.refCount&&Object(j.arrayRemoveInPlace)(this.currentContext,n),[7];case 4:return[2]}}))}))},e.prototype.requestAbortAll=function(e){var t=this;this.runningTasks.forEach((function(r){return t.abortRequests.set(r,e)}))},e.prototype.requestAbort=function(e,t){var r="number"==typeof e?e:e.root.progress.taskId;this.abortRequests.set(r,t)},e.prototype.dispose=function(){this.ev.dispose()},e}();(xc||(xc={})).testTask=function(e){var t=this;return _.b.create("Test",(function(r){return Object(o.__awaiter)(t,void 0,void 0,(function(){var t;return Object(o.__generator)(this,(function(n){switch(n.label){case 0:t=0,n.label=1;case 1:return t<e?[4,(i=100+200*Math.random(),new Promise((function(e){return setTimeout(e,i)})))]:[3,5];case 2:return n.sent(),r.shouldUpdate?[4,r.update({message:"Step "+t,current:t,max:e,isIndeterminate:!1})]:[3,4];case 3:n.sent(),n.label=4;case 4:return t++,[3,1];case 5:return[2]}var i}))}))}))};var Oc=function(e){function t(t){var r=e.call(this,{entries:Object(u.OrderedMap)()})||this;return r.events={changed:r.ev()},r.serialNumber=0,r.serialId=0,mc.PluginCommands.Toast.Show.subscribe(t,(function(e){return r.show(e)})),mc.PluginCommands.Toast.Hide.subscribe(t,(function(e){return r.hide(r.findByKey(e.key))})),r}return Object(o.__extends)(t,e),t.prototype.findByKey=function(e){return this.state.entries.find((function(t){return!!t&&t.key===e}))},t.prototype.show=function(e){var t,r=this,n=this.state.entries,i=void 0,a=++this.serialId;e.key&&(i=this.findByKey(e.key))?(void 0!==i.timeout&&clearTimeout(i.timeout),t=i.serialNumber,n=n.remove(i.id)):t=++this.serialNumber,i={id:a,serialNumber:t,key:e.key,title:e.title,message:e.message,timeout:this.timeout(a,e.timeoutMs),hide:function(){return r.hideId(a)}},this.updateState({entries:n.set(a,i)})&&this.events.changed.next()},t.prototype.timeout=function(e,t){var r=this;if(void 0!==t)return t<0&&(t=500),setTimeout((function(){var t=r.state.entries.get(e);t.timeout=void 0,r.hide(t)}),t)},t.prototype.hideId=function(e){this.hide(this.state.entries.get(e))},t.prototype.hide=function(e){e&&(void 0!==e.timeout&&clearTimeout(e.timeout),e.hide=void 0,this.updateState({entries:this.state.entries.delete(e.id)})&&this.events.changed.next())},t}(Oe.b),wc=r(242);function Cc(e,t,r){void 0===r&&(r=1);var n=window.innerWidth,i=window.innerHeight;t!==document.body&&(n=t.offsetWidth,i=t.offsetHeight),function(e,t,r,n){void 0===n&&(n=1),e.width=Math.round(window.devicePixelRatio*n*t),e.height=Math.round(window.devicePixelRatio*n*r),Object.assign(e.style,{width:t+"px",height:r+"px"})}(e,n,i,r)}function jc(e,t,r){return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(n){return[2,new Promise((function(n,i){var a=function(e){e?n(e):i("no blob returned")};HTMLCanvasElement.prototype.toBlob?e.toBlob(a,t,r):function(e,t,r,n){for(var i=atob(e.toDataURL(r,n).split(",")[1]),a=i.length,o=a>>2,s=new Uint8Array(a),u=new Uint32Array(s.buffer,0,o),c=0,l=0;l<o;++l)u[l]=i.charCodeAt(c++)|i.charCodeAt(c++)<<8|i.charCodeAt(c++)<<16|i.charCodeAt(c++)<<24;for(var d=3&a;d--;)s[c]=i.charCodeAt(c++);t(new Blob([s],{type:r||"image/png"}))}(e,a,t,r)}))]}))}))}var Pc=r(373),Ec=r(96),Ac=function(e){function t(t){var r=e.call(this)||this;return r.plugin=t,r._params=void 0,r.behaviors={values:r.ev.behavior({transparent:r.params.transparent.defaultValue,axes:{name:"off",params:{}},resolution:r.params.resolution.defaultValue}),cropParams:r.ev.behavior({auto:!0,relativePadding:.1}),relativeCrop:r.ev.behavior({x:0,y:0,width:1,height:1})},r.events={previewed:r.ev()},r.canvas=document.createElement("canvas"),r.previewCanvas=document.createElement("canvas"),r.previewData={image:{data:new Uint8ClampedArray(1),width:1,height:0},background:Object(oc.Color)(0),transparent:!1},r}return Object(o.__extends)(t,e),t.prototype.createParams=function(){var e=Math.min(this.plugin.canvas3d?this.plugin.canvas3d.webgl.maxRenderbufferSize:4096,4096);return{resolution:d.ParamDefinition.MappedStatic("viewport",{viewport:d.ParamDefinition.Group({}),hd:d.ParamDefinition.Group({}),"full-hd":d.ParamDefinition.Group({}),"ultra-hd":d.ParamDefinition.Group({}),custom:d.ParamDefinition.Group({width:d.ParamDefinition.Numeric(1920,{min:128,max:e,step:1}),height:d.ParamDefinition.Numeric(1080,{min:128,max:e,step:1})},{isFlat:!0})},{options:[["viewport","Viewport"],["hd","HD (1280 x 720)"],["full-hd","Full HD (1920 x 1080)"],["ultra-hd","Ultra HD (3840 x 2160)"],["custom","Custom"]]}),transparent:d.ParamDefinition.Boolean(!1),axes:wc.b.axes}},Object.defineProperty(t.prototype,"params",{get:function(){return this._params?this._params:this._params=this.createParams()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){return this.behaviors.values.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cropParams",{get:function(){return this.behaviors.cropParams.value},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"relativeCrop",{get:function(){return this.behaviors.relativeCrop.value},enumerable:!1,configurable:!0}),t.prototype.getCanvasSize=function(){var e,t;return{width:(null===(e=this.plugin.canvas3d)||void 0===e?void 0:e.webgl.gl.drawingBufferWidth)||0,height:(null===(t=this.plugin.canvas3d)||void 0===t?void 0:t.webgl.gl.drawingBufferHeight)||0}},t.prototype.getSize=function(){var e=this.values;switch(e.resolution.name){case"viewport":return this.getCanvasSize();case"hd":return{width:1280,height:720};case"full-hd":return{width:1920,height:1080};case"ultra-hd":return{width:3840,height:2160};default:return{width:e.resolution.params.width,height:e.resolution.params.height}}},t.prototype.createPass=function(e){var t=this.plugin.canvas3d,r=t.webgl.extensions,n=r.colorBufferFloat,i=r.textureFloat;return this.plugin.canvas3d.getImagePass({transparentBackground:this.values.transparent,cameraHelper:{axes:this.values.axes},multiSample:{mode:e?"on":"off",sampleLevel:n&&i?4:2},postprocessing:Object(o.__assign)(Object(o.__assign)({},t.props.postprocessing),{antialiasing:{name:"off",params:{}}})})},Object.defineProperty(t.prototype,"previewPass",{get:function(){return this._previewPass||(this._previewPass=this.createPass(!1))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"imagePass",{get:function(){return this._imagePass?(this._imagePass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:Object(o.__assign)(Object(o.__assign)({},this.plugin.canvas3d.props.postprocessing),{antialiasing:{name:"off",params:{}}})}),this._imagePass):this._imagePass=this.createPass(!0)},enumerable:!1,configurable:!0}),t.prototype.getFilename=function(e){void 0===e&&(e=".png");var t=this.plugin.state.data.select(g.StateSelection.Generators.rootsOfType(v.a.Molecule.Model)).map((function(e){return e.obj.data})),r=new Set;return t.forEach((function(e){return r.add(e.entryId.toUpperCase())})),""+(Ec.a.toArray(r).join("-")||"molstar-image")+e},t.prototype.resetCrop=function(){this.behaviors.relativeCrop.next({x:0,y:0,width:1,height:1})},t.prototype.toggleAutocrop=function(){this.cropParams.auto?(this.behaviors.cropParams.next(Object(o.__assign)(Object(o.__assign)({},this.cropParams),{auto:!1})),this.resetCrop()):this.behaviors.cropParams.next(Object(o.__assign)(Object(o.__assign)({},this.cropParams),{auto:!0}))},Object.defineProperty(t.prototype,"isFullFrame",{get:function(){var e=this.relativeCrop;return Object(Ao.b)(e.x,0,1e-5)&&Object(Ao.b)(e.y,0,1e-5)&&Object(Ao.b)(e.width,1,1e-5)&&Object(Ao.b)(e.height,1,1e-5)},enumerable:!1,configurable:!0}),t.prototype.autocrop=function(e){void 0===e&&(e=this.cropParams.relativePadding);for(var t=this.previewData.image,r=t.data,n=t.width,i=t.height,a=this.previewData.transparent,o=a?this.previewData.background:4278190080|this.previewData.background,s=n,u=0,c=i,l=0,d=0;d<i;d++)for(var f=d*n,p=0;p<n;p++){var m=4*(f+p);if(a){if(0===r[m+3])continue}else if((r[m]<<16|r[m+1]<<8|r[m+2]|r[m+3]<<24)===o)continue;p<s&&(s=p),p>u&&(u=p),d<c&&(c=d),d>l&&(l=d)}if(s>u){var h=s;s=u,u=h}if(c>l){h=c;c=l,l=h}var g=u-s+1,v=l-c+1;s-=e*g,u+=e*g,c-=e*v,l+=e*v;var b={x:Math.max(0,s/n),y:Math.max(0,c/i),width:Math.min(1,(u-s+1)/n),height:Math.min(1,(l-c+1)/i)};this.behaviors.relativeCrop.next(b)},t.prototype.getPreview=function(e){void 0===e&&(e=320);var t=this.getSize(),r=t.width,n=t.height;if(!(r<=0||n<=0)){var i=r/n,a=0,o=0;i>1?(a=e,o=Math.round(e/i)):(o=e,a=Math.round(e*i));var s=this.plugin.canvas3d.props;this.previewPass.setProps({cameraHelper:{axes:this.values.axes},transparentBackground:this.values.transparent,postprocessing:s.postprocessing});var u=this.previewPass.getImageData(a,o),c=this.previewCanvas;c.width=u.width,c.height=u.height,this.previewData.image=u,this.previewData.background=s.renderer.backgroundColor,this.previewData.transparent=this.values.transparent;var l=c.getContext("2d");if(!l)throw new Error("Could not create canvas 2d context");return l.putImageData(u,0,0),this.cropParams.auto&&this.autocrop(),this.events.previewed.next(),{canvas:c,width:a,height:o}}},t.prototype.getSizeAndViewport=function(){var e=this.getSize(),t=e.width,r=e.height,n=this.relativeCrop,i={x:Math.floor(n.x*t),y:Math.floor(n.y*r),width:Math.ceil(n.width*t),height:Math.ceil(n.height*r)};return i.width+i.x>t&&(i.width=t-i.x),i.height+i.y>r&&(i.height=r-i.y),{width:t,height:r,viewport:i}},t.prototype.draw=function(e){return Object(o.__awaiter)(this,void 0,void 0,(function(){var t,r,n,i,a,s,u;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:return t=this.getSizeAndViewport(),r=t.width,n=t.height,i=t.viewport,r<=0||n<=0?[2]:[4,e.update("Rendering image...")];case 1:return o.sent(),a=this.imagePass.getImageData(r,n,i),[4,e.update("Encoding image...")];case 2:if(o.sent(),(s=this.canvas).width=a.width,s.height=a.height,!(u=s.getContext("2d")))throw new Error("Could not create canvas 2d context");return u.putImageData(a,0,0),[2]}}))}))},t.prototype.copyToClipboardTask=function(){var e=this,t=navigator.clipboard;if(null==t?void 0:t.write)return _.b.create("Copy Image",(function(r){return Object(o.__awaiter)(e,void 0,void 0,(function(){var e,n;return Object(o.__generator)(this,(function(i){switch(i.label){case 0:return[4,this.draw(r)];case 1:return i.sent(),[4,r.update("Converting image...")];case 2:return i.sent(),[4,jc(this.canvas,"png")];case 3:return e=i.sent(),n=new ClipboardItem({"image/png":e}),t.write([n]),this.plugin.log.message("Image copied to clipboard."),[2]}}))}))}));this.plugin.log.error("clipboard.write not supported!")},t.prototype.getImageDataUri=function(){var e=this;return this.plugin.runTask(_.b.create("Generate Image",(function(t){return Object(o.__awaiter)(e,void 0,void 0,(function(){return Object(o.__generator)(this,(function(e){switch(e.label){case 0:return[4,this.draw(t)];case 1:return e.sent(),[4,t.update("Converting image...")];case 2:return e.sent(),[2,this.canvas.toDataURL("png")]}}))}))})))},t.prototype.copyToClipboard=function(){var e=this.copyToClipboardTask();if(e)return this.plugin.runTask(e)},t.prototype.downloadTask=function(e){var t=this;return _.b.create("Download Image",(function(r){return Object(o.__awaiter)(t,void 0,void 0,(function(){var t;return Object(o.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.draw(r)];case 1:return n.sent(),[4,r.update("Downloading image...")];case 2:return n.sent(),[4,jc(this.canvas,"png")];case 3:return t=n.sent(),Object(Pc.a)(t,null!=e?e:this.getFilename()),[2]}}))}))}))},t.prototype.download=function(e){this.plugin.runTask(this.downloadTask(e))},t}(Oe.a),Dc=r(323),Tc=r(119),Ic=r(372),Mc=function(e){function t(t){var r=e.call(this,{params:{current:""},animationState:"stopped"})||this;return r.context=t,r.map=new Map,r._animations=[],r.currentTime=0,r._params=void 0,r.events={updated:r.ev(),applied:r.ev()},r.isStopped=!0,r.isApplying=!1,r}return Object(o.__extends)(t,e),Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0===this._animations.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"current",{get:function(){return this._current},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"animations",{get:function(){return this._animations},enumerable:!1,configurable:!0}),t.prototype.triggerUpdate=function(){this.events.updated.next()},t.prototype.triggerApply=function(){this.events.applied.next()},t.prototype.getParams=function(){return this._params||(this._params={current:d.ParamDefinition.Select(this._animations[0]&&this._animations[0].name,this._animations.map((function(e){return[e.name,e.display.name]})),{label:"Animation"})}),this._params},t.prototype.updateParams=function(e){if(!this.isEmpty){this.updateState({params:Object(o.__assign)(Object(o.__assign)({},this.state.params),e)});var t=this.map.get(this.state.params.current),r=t.params(this.context);this._current={anim:t,params:r,paramValues:d.ParamDefinition.getDefaultValues(r),state:{},startedTime:-1,lastTime:0},this.triggerUpdate()}},t.prototype.updateCurrentParams=function(e){this.isEmpty||(this._current.paramValues=Object(o.__assign)(Object(o.__assign)({},this._current.paramValues),e),this.triggerUpdate())},t.prototype.register=function(e){this.map.has(e.name)?this.context.log.error("Animation '"+e.name+"' is already registered."):(this._params=void 0,this.map.set(e.name,e),this._animations.push(e),1===this._animations.length?this.updateParams({current:e.name}):this.triggerUpdate())},t.prototype.play=function(e,t){return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(r){switch(r.label){case 0:return[4,this.stop()];case 1:return r.sent(),this.map.has(e.name)||this.register(e),this.updateParams({current:e.name}),this.updateCurrentParams(t),[4,this.start()];case 2:return r.sent(),[2]}}))}))},t.prototype.tick=function(e,t){return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(r){switch(r.label){case 0:return this.currentTime=e,this.isStopped?[2]:t?[4,this.applyFrame()]:[3,2];case 1:return r.sent(),[3,3];case 2:this.applyAsync(),r.label=3;case 3:return[2]}}))}))},t.prototype.start=function(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var e,t,r;return Object(o.__generator)(this,(function(n){switch(n.label){case 0:return this.updateState({animationState:"playing"}),this.context.behaviors.state.isAnimating.value||this.context.behaviors.state.isAnimating.next(!0),this.triggerUpdate(),e=this._current.anim,t=this._current.anim.initialState(this._current.paramValues,this.context),e.setup?[4,e.setup(this._current.paramValues,t,this.context)]:[3,2];case 1:(r=n.sent())&&(t=r),n.label=2;case 2:return this._current.lastTime=0,this._current.startedTime=-1,this._current.state=t,this.isStopped=!1,[2]}}))}))},t.prototype.stop=function(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var e;return Object(o.__generator)(this,(function(t){switch(t.label){case 0:return this.isStopped=!0,"stopped"===this.state.animationState?[3,3]:(e=this._current.anim).teardown?[4,e.teardown(this._current.paramValues,this._current.state,this.context)]:[3,2];case 1:t.sent(),t.label=2;case 2:this.updateState({animationState:"stopped"}),this.triggerUpdate(),t.label=3;case 3:return this.context.behaviors.state.isAnimating.value&&this.context.behaviors.state.isAnimating.next(!1),[2]}}))}))},Object.defineProperty(t.prototype,"isAnimating",{get:function(){return"playing"===this.state.animationState},enumerable:!1,configurable:!0}),t.prototype.applyAsync=function(){return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(e){switch(e.label){case 0:if(this.isApplying)return[2];this.isApplying=!0,e.label=1;case 1:return e.trys.push([1,,3,4]),[4,this.applyFrame()];case 2:return e.sent(),[3,4];case 3:return this.isApplying=!1,[7];case 4:return[2]}}))}))},t.prototype.applyFrame=function(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var e,t;return Object(o.__generator)(this,(function(r){switch(r.label){case 0:return e=this.currentTime,this._current.startedTime<0&&(this._current.startedTime=e),[4,this._current.anim.apply(this._current.state,{lastApplied:this._current.lastTime,current:e-this._current.startedTime},{params:this._current.paramValues,plugin:this.context})];case 1:return"finished"===(t=r.sent()).kind?this.stop():"next"===t.kind&&(this._current.state=t.state,this._current.lastTime=e-this._current.startedTime),this.triggerApply(),[2]}}))}))},t.prototype.getSnapshot=function(){return this.current?{state:this.state,current:{paramValues:this._current.paramValues,state:this._current.anim.stateSerialization?this._current.anim.stateSerialization.toJSON(this._current.state):this._current.state}}:{state:this.state}},t.prototype.setSnapshot=function(e){this.isEmpty||(this.updateState({animationState:e.state.animationState}),this.updateParams(e.state.params),e.current&&(this.current.paramValues=e.current.paramValues,this.current.state=this._current.anim.stateSerialization?this._current.anim.stateSerialization.fromJSON(e.current.state):e.current.state,this.triggerUpdate(),"playing"===this.state.animationState&&this.resume()))},t.prototype.resume=function(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var e;return Object(o.__generator)(this,(function(t){switch(t.label){case 0:return this._current.lastTime=0,this._current.startedTime=-1,e=this._current.anim,this.context.behaviors.state.isAnimating.value||this.context.behaviors.state.isAnimating.next(!0),e.setup?[4,e.setup(this._current.paramValues,this._current.state,this.context)]:[3,2];case 1:t.sent(),t.label=2;case 2:return this.isStopped=!1,[2]}}))}))},t}(Oe.b),kc=r(392),Bc=r(168),Vc=r(301),Rc=function(){function e(e){var t=this;this.plugin=e,this.currentFrame=void 0,this._isAnimating=!1,this.frame=function(){t.tick(Object(_c.b)()),t._isAnimating&&(t.currentFrame=requestAnimationFrame(t.frame))}}return Object.defineProperty(e.prototype,"isAnimating",{get:function(){return this._isAnimating},enumerable:!1,configurable:!0}),e.prototype.tick=function(e,t){var r;return Object(o.__awaiter)(this,void 0,void 0,(function(){return Object(o.__generator)(this,(function(n){switch(n.label){case 0:return[4,this.plugin.managers.animation.tick(e,null==t?void 0:t.isSynchronous)];case 1:return n.sent(),null===(r=this.plugin.canvas3d)||void 0===r||r.tick(e,t),[2]}}))}))},e.prototype.resetTime=function(e){var t;void 0===e&&(e=Object(_c.b)()),null===(t=this.plugin.canvas3d)||void 0===t||t.resetTime(e)},e.prototype.start=function(){this._isAnimating=!0,this.resetTime(),this.currentFrame=requestAnimationFrame(this.frame)},e.prototype.stop=function(){this._isAnimating=!1,void 0!==this.currentFrame&&(cancelAnimationFrame(this.currentFrame),this.currentFrame=void 0)},e}(),Lc=function(){function e(e){var t=this;this.spec=e,this.runTask=function(e,r){return t.managers.task.run(e,r)},this.resolveTask=function(e){if(e)return _.b.is(e)?t.runTask(e):e},this.subs=[],this.disposed=!1,this.ev=lc.RxEventHelper.create(),this.config=new P.PluginConfigManager(this.spec.config),this.state=new bc.a(this),this.commands=new pc.b,this.canvas3dInit=this.ev.behavior(!1),this.behaviors={state:{isAnimating:this.ev.behavior(!1),isUpdating:this.ev.behavior(!1),isBusy:this.ev.behavior(!1)},interaction:{hover:this.ev.behavior({current:ye.a.Loci.Empty,modifiers:uc.b.None,buttons:0,button:0}),click:this.ev.behavior({current:ye.a.Loci.Empty,modifiers:uc.b.None,buttons:0,button:0}),drag:this.ev.behavior({current:ye.a.Loci.Empty,modifiers:uc.b.None,buttons:0,button:0,pageStart:Object(M.Vec2)(),pageEnd:Object(M.Vec2)()}),selectionMode:this.ev.behavior(!1)},labels:{highlight:this.ev.behavior({labels:[]})},layout:{leftPanelTabName:this.ev.behavior("root")},canvas3d:{initialized:this.canvas3dInit.pipe(Object(Bc.a)((function(e){return!!e})),Object(Vc.a)(1))}},this.animationLoop=new Rc(this),this.layout=new vc(this),this.representation={structure:{registry:new rc,themes:{colorThemeRegistry:ic.a.createRegistry(),sizeThemeRegistry:ac.a.createRegistry()}},volume:{registry:new nc.a,themes:{colorThemeRegistry:ic.a.createRegistry(),sizeThemeRegistry:ac.a.createRegistry()}}},this.query={structure:{registry:new pe.d}},this.dataFormats=new fe,this.builders={data:new h(this),structure:void 0},this.helpers={substructureParent:new yc(this),viewportScreenshot:void 0},this.managers={structure:{hierarchy:new je.StructureHierarchyManager(this),component:new xe.StructureComponentManager(this),measurement:new Pe.a(this),selection:new Ie(this),focus:new Ce(this)},volume:{hierarchy:new kc.a(this)},interactivity:void 0,camera:new ve(this),animation:new Mc(this),snapshot:new Ic.a(this),lociLabels:void 0,toast:new Oc(this),asset:new Tc.AssetManager,task:new xc},this.events={log:this.ev(),task:this.managers.task.events,canvas3d:{settingsUpdated:this.ev()}},this.customModelProperties=new n.Registry,this.customStructureProperties=new n.Registry,this.customParamEditors=new Map,this.customStructureControls=new Map,this.genericRepresentationControls=new Map,this.customState=Object.create(null),this.log={entries:Object(u.List)(),entry:function(e){return t.events.log.next(e)},error:function(e){return t.events.log.next(cc.a.error(e))},message:function(e){return t.events.log.next(cc.a.message(e))},info:function(e){return t.events.log.next(cc.a.info(e))},warn:function(e){return t.events.log.next(cc.a.warning(e))}},this.fetch=sc.a,Object(s.c)(!1)}return e.prototype.build=function(){return this.state.data.build()},e.prototype.initViewer=function(e,t){var r,n,i,a,o,u,c,d=this;try{this.layout.setRoot(t),this.spec.layout&&this.spec.layout.initial&&this.layout.setProps(this.spec.layout.initial);var f=!(null!==(r=this.config.get(P.PluginConfig.General.DisableAntialiasing))&&void 0!==r&&r),p=!(null!==(n=this.config.get(P.PluginConfig.General.DisablePreserveDrawingBuffer))&&void 0!==n&&n),m=this.config.get(P.PluginConfig.General.PixelScale)||1,h=this.config.get(P.PluginConfig.General.PickScale)||.25,g=this.config.get(P.PluginConfig.General.EnableWboit)||!1;this.canvas3dContext=l.Canvas3DContext.fromCanvas(e,{antialias:f,preserveDrawingBuffer:p,pixelScale:m,pickScale:h,enableWboit:g}),this.canvas3d=l.Canvas3D.create(this.canvas3dContext),this.canvas3dInit.next(!0);var v=null===(a=null===(i=this.spec.components)||void 0===i?void 0:i.viewport)||void 0===a?void 0:a.canvas3d,b=Object(oc.Color)(16579577);return v?(void 0===(null===(u=v.renderer)||void 0===u?void 0:u.backgroundColor)&&(v=Object(s.a)(v,(function(e){e.renderer?e.renderer.backgroundColor=b:e.renderer={backgroundColor:b}}))),null===(c=this.canvas3d)||void 0===c||c.setProps(v)):null===(o=this.canvas3d)||void 0===o||o.setProps({renderer:{backgroundColor:b}}),this.animationLoop.start(),this.helpers.viewportScreenshot=new Ac(this),this.subs.push(this.canvas3d.interaction.click.subscribe((function(e){return d.behaviors.interaction.click.next(e)}))),this.subs.push(this.canvas3d.interaction.drag.subscribe((function(e){return d.behaviors.interaction.drag.next(e)}))),this.subs.push(this.canvas3d.interaction.hover.subscribe((function(e){return d.behaviors.interaction.hover.next(e)}))),this.subs.push(this.canvas3d.input.resize.subscribe((function(){return d.handleResize()}))),this.subs.push(this.layout.events.updated.subscribe((function(){return requestAnimationFrame((function(){return d.handleResize()}))}))),this.handleResize(),!0}catch(e){return this.log.error(""+e),console.error(e),!1}},e.prototype.handleResize=function(){var e,t,r=null===(e=this.canvas3dContext)||void 0===e?void 0:e.canvas,n=this.layout.root;n&&r&&(Cc(r,n,this.config.get(P.PluginConfig.General.PixelScale)||1),null===(t=this.canvas3d)||void 0===t||t.requestResize())},Object.defineProperty(e.prototype,"isBusy",{get:function(){return this.behaviors.state.isAnimating.value||this.behaviors.state.isUpdating.value},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"selectionMode",{get:function(){return this.behaviors.interaction.selectionMode.value},set:function(e){this.behaviors.interaction.selectionMode.next(e)},enumerable:!1,configurable:!0}),e.prototype.dataTransaction=function(e,t){return this.runTask(this.state.data.transaction(e,t))},e.prototype.clear=function(e){var t;return void 0===e&&(e=!1),e&&(null===(t=this.canvas3d)||void 0===t||t.setProps(l.DefaultCanvas3DParams)),mc.PluginCommands.State.RemoveObject(this,{state:this.state.data,ref:g.StateTransform.RootRef})},e.prototype.dispose=function(e){var t,r;if(!this.disposed){for(var n=0,i=this.subs;n<i.length;n++){i[n].unsubscribe()}this.subs=[],this.commands.dispose(),null===(t=this.canvas3d)||void 0===t||t.dispose(),null===(r=this.canvas3dContext)||void 0===r||r.dispose(e),this.ev.dispose(),this.state.dispose(),this.managers.task.dispose(),this.layout.dispose(),this.helpers.substructureParent.dispose(),Object(x.c)(this.managers,(function(e){var t,r;return null===(r=null===(t=e)||void 0===t?void 0:t.dispose)||void 0===r?void 0:r.call(t)})),Object(x.c)(this.managers.structure,(function(e){var t,r;return null===(r=null===(t=e)||void 0===t?void 0:t.dispose)||void 0===r?void 0:r.call(t)})),this.disposed=!0}},e.prototype.initBehaviorEvents=function(){var e=this;this.subs.push(Object(c.a)(this.state.data.behaviors.isUpdating,this.state.behaviors.behaviors.isUpdating).subscribe((function(t){e.behaviors.state.isUpdating.value!==t&&e.behaviors.state.isUpdating.next(t)})));var t=this.config.get(P.PluginConfig.General.IsBusyTimeoutMs)||750,r=this.behaviors.state.isBusy,n=void 0,i=function(){r.value||r.next(!0)},a=function(){void 0!==n&&clearTimeout(n),n=void 0};this.subs.push(Object(c.a)(this.behaviors.state.isUpdating,this.behaviors.state.isAnimating).subscribe((function(o){var s=e.behaviors.state.isUpdating.value,u=e.behaviors.state.isAnimating.value;s||u?r.value||(a(),n=setTimeout(i,t)):(a(),r.next(!1))}))),this.subs.push(this.behaviors.interaction.selectionMode.subscribe((function(t){var r;t||null===(r=e.managers.interactivity)||void 0===r||r.lociSelects.deselectAll()})))},e.prototype.initBuiltInBehavior=function(){var e=this;dc.BuiltInPluginBehaviors.State.registerDefault(this),dc.BuiltInPluginBehaviors.Representation.registerDefault(this),dc.BuiltInPluginBehaviors.Camera.registerDefault(this),dc.BuiltInPluginBehaviors.Misc.registerDefault(this),this.subs.push(Object(c.a)(this.state.data.events.log,this.state.behaviors.events.log).subscribe((function(t){return e.events.log.next(t)})))},e.prototype.initBehaviors=function(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var e,t,r,n,i,a,s,u,c;return Object(o.__generator)(this,(function(o){switch(o.label){case 0:for(e=this.state.behaviors.build(),t=0,r=Object.keys(fc.a.Categories);t<r.length;t++)c=r[t],e.toRoot().apply(fc.a.CreateCategory,{label:fc.a.Categories[c]},{ref:c,state:{isLocked:!0}});for(n=0,i=this.spec.behaviors;n<i.length;n++)u=i[n],"custom-props"===(c=fc.a.getCategoryId(u.transformer))&&e.to(fc.a.getCategoryId(u.transformer)).apply(u.transformer,u.defaultParams,{ref:u.transformer.id});return[4,this.runTask(this.state.behaviors.updateTree(e,{doNotUpdateCurrent:!0,doNotLogTiming:!0}))];case 1:for(o.sent(),e=this.state.behaviors.build(),a=0,s=this.spec.behaviors;a<s.length;a++)u=s[a],"custom-props"!==(c=fc.a.getCategoryId(u.transformer))&&e.to(fc.a.getCategoryId(u.transformer)).apply(u.transformer,u.defaultParams,{ref:u.transformer.id});return[4,this.runTask(this.state.behaviors.updateTree(e,{doNotUpdateCurrent:!0,doNotLogTiming:!0}))];case 2:return o.sent(),[2]}}))}))},e.prototype.initCustomFormats=function(){if(this.spec.customFormats)for(var e=0,t=this.spec.customFormats;e<t.length;e++){var r=t[e];this.dataFormats.add(r[0],r[1])}},e.prototype.initDataActions=function(){for(var e=0,t=this.spec.actions;e<t.length;e++){var r=t[e];this.state.data.actions.add(r.action)}},e.prototype.initAnimations=function(){if(this.spec.animations)for(var e=0,t=this.spec.animations;e<t.length;e++){var r=t[e];this.managers.animation.register(r)}},e.prototype.initCustomParamEditors=function(){if(this.spec.customParamEditors)for(var e=0,t=this.spec.customParamEditors;e<t.length;e++){var r=t[e],n=r[0],i=r[1];this.customParamEditors.set(n.id,i)}},e.prototype.init=function(){return Object(o.__awaiter)(this,void 0,void 0,(function(){var e=this;return Object(o.__generator)(this,(function(t){switch(t.label){case 0:return this.subs.push(this.events.log.subscribe((function(t){return e.log.entries=e.log.entries.push(t)}))),this.initCustomFormats(),this.initBehaviorEvents(),this.initBuiltInBehavior(),this.managers.interactivity=new be.a(this),this.managers.lociLabels=new Se(this),this.builders.structure=new Q(this),this.initDataActions(),this.initAnimations(),this.initCustomParamEditors(),[4,this.initBehaviors()];case 1:return t.sent(),this.log.message("Mol* Plugin "+Dc.a+" ["+Dc.b.toLocaleString()+"]"),S.b||this.log.message("Development mode enabled"),S.a&&this.log.message("Debug mode enabled"),[2]}}))}))},e}()},function(e,t,r){"use strict";r.r(t),r.d(t,"Plugin",(function(){return re})),r.d(t,"PluginContextContainer",(function(){return ne})),r.d(t,"ControlsWrapper",(function(){return ae})),r.d(t,"DefaultViewport",(function(){return oe})),r.d(t,"Log",(function(){return se}));var n=r(0),i=r(3),a=r(5),o=r(33),s=r(278),u=r(146),c=r(27),l=r(13),d=r(18),f=r(73),p=r(399),m=r(292),h=r(386),g=r(195),v=r(15),b=function(e){function t(){var t,r=e.apply(this,arguments)||this;return r.state={tab:r.plugin.behaviors.layout.leftPanelTabName.value},r.set=function(e){if(r.state.tab===e)return r.setState({tab:"none"},(function(){return r.plugin.behaviors.layout.leftPanelTabName.next("none")})),void c.PluginCommands.Layout.Update(r.plugin,{state:{regionState:Object(n.__assign)(Object(n.__assign)({},r.plugin.layout.state.regionState),{left:"collapsed"})}});r.setState({tab:e},(function(){return r.plugin.behaviors.layout.leftPanelTabName.next(e)})),"full"!==r.plugin.layout.state.regionState.left&&c.PluginCommands.Layout.Update(r.plugin,{state:{regionState:Object(n.__assign)(Object(n.__assign)({},r.plugin.layout.state.regionState),{left:"full"})}})},r.tabs={none:i.createElement(i.Fragment,null),root:i.createElement(i.Fragment,null,i.createElement(d.SectionHeader,{icon:v.HomeOutlinedSvg,title:"Home"}),i.createElement(p.StateObjectActions,{state:r.plugin.state.data,nodeRef:l.StateTransform.RootRef,hideHeader:!0,initiallyCollapsed:!0,alwaysExpandFirst:!0}),"none"!==(null===(t=r.plugin.spec.components)||void 0===t?void 0:t.remoteState)&&i.createElement(m.RemoteStateSnapshots,{listOnly:!0})),data:i.createElement(i.Fragment,null,i.createElement(d.SectionHeader,{icon:v.AccountTreeOutlinedSvg,title:i.createElement(i.Fragment,null,i.createElement(S,null)," State Tree")}),i.createElement(h.StateTree,{state:r.plugin.state.data})),states:i.createElement(m.StateSnapshots,null),settings:i.createElement(i.Fragment,null,i.createElement(d.SectionHeader,{icon:v.TuneSvg,title:"Plugin Settings"}),i.createElement(_,null)),help:i.createElement(i.Fragment,null,i.createElement(d.SectionHeader,{icon:v.HelpOutlineSvg,title:"Help"}),i.createElement(g.HelpContent,null))},r}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.behaviors.layout.leftPanelTabName,(function(t){e.state.tab!==t&&e.setState({tab:t}),"none"===t&&"collapsed"!==e.plugin.layout.state.regionState.left&&c.PluginCommands.Layout.Update(e.plugin,{state:{regionState:Object(n.__assign)(Object(n.__assign)({},e.plugin.layout.state.regionState),{left:"collapsed"})}})})),this.subscribe(this.plugin.state.data.events.changed,(function(t){var r=t.state;"data"===e.state.tab&&1===r.cells.size&&e.set("root")}))},t.prototype.render=function(){var e=this,t=this.state.tab;return i.createElement("div",{className:"msp-left-panel-controls"},i.createElement("div",{className:"msp-left-panel-controls-buttons"},i.createElement(d.IconButton,{svg:v.HomeOutlinedSvg,toggleState:"root"===t,transparent:!0,onClick:function(){return e.set("root")},title:"Home"}),i.createElement(y,{set:this.set}),i.createElement(d.IconButton,{svg:v.SaveOutlinedSvg,toggleState:"states"===t,transparent:!0,onClick:function(){return e.set("states")},title:"Plugin State"}),i.createElement(d.IconButton,{svg:v.HelpOutlineSvg,toggleState:"help"===t,transparent:!0,onClick:function(){return e.set("help")},title:"Help"}),i.createElement("div",{className:"msp-left-panel-controls-buttons-bottom"},i.createElement(d.IconButton,{svg:v.TuneSvg,toggleState:"settings"===t,transparent:!0,onClick:function(){return e.set("settings")},title:"Settings"}))),i.createElement("div",{className:"msp-scrollable-container"},this.tabs[t]))},t}(o.PluginUIComponent),y=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={changed:!1},t}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"tab",{get:function(){return this.plugin.behaviors.layout.leftPanelTabName.value},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.behaviors.layout.leftPanelTabName,(function(t){"data"===e.tab?e.setState({changed:!1}):e.forceUpdate()})),this.subscribe(this.plugin.state.data.events.changed,(function(t){"data"!==e.tab&&e.setState({changed:!0})}))},t.prototype.render=function(){var e=this;return i.createElement(d.IconButton,{svg:v.AccountTreeOutlinedSvg,toggleState:"data"===this.tab,transparent:!0,onClick:function(){return e.props.set("data")},title:"State Tree",style:{position:"relative"},extraContent:this.state.changed?i.createElement("div",{className:"msp-left-panel-controls-button-data-dirty"}):void 0})},t}(o.PluginUIComponent),_=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.setSettings=function(e){var r;c.PluginCommands.Canvas3D.SetSettings(t.plugin,{settings:(r={},r[e.name]=e.value,r)})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.canvas3d.settingsUpdated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.layout.events.updated,(function(){return e.forceUpdate()})),this.subscribe(this.plugin.canvas3d.camera.stateChanged,(function(t){void 0===t.radiusMax&&void 0===t.radius||e.forceUpdate()}))},t.prototype.render=function(){return i.createElement(i.Fragment,null,this.plugin.canvas3d&&i.createElement(i.Fragment,null,i.createElement(d.SectionHeader,{title:"Viewport"}),i.createElement(f.ParameterControls,{params:u.Canvas3DParams,values:this.plugin.canvas3d.props,onChange:this.setSettings})),i.createElement(d.SectionHeader,{title:"Behavior"}),i.createElement(h.StateTree,{state:this.plugin.state.behaviors}))},t}(o.PluginUIComponent),S=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.remove=function(e){e.preventDefault(),c.PluginCommands.State.RemoveObject(t.plugin,{state:t.plugin.state.data,ref:l.StateTransform.RootRef})},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.state.events.cell.created,(function(t){t.cell.transform.parent===l.StateTransform.RootRef&&e.forceUpdate()})),this.subscribe(this.plugin.state.events.cell.removed,(function(t){t.parent===l.StateTransform.RootRef&&e.forceUpdate()}))},t.prototype.render=function(){return 0===this.plugin.state.data.tree.children.get(l.StateTransform.RootRef).size?null:i.createElement(d.IconButton,{svg:v.DeleteOutlinedSvg,onClick:this.remove,title:"Remove All",style:{display:"inline-block"},small:!0,className:"msp-no-hover-outline",transparent:!0})},t}(o.PluginUIComponent),x=r(8),O=r(90),w=r(4),C=r(62),j=r(400),P=r(6),E=r(41),A=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.parentDiv=i.createRef(),t.lastMouseOverSeqIdx=-1,t.highlightQueue=new C.a,t.lociHighlightProvider=function(e,r){t.props.sequenceWrapper.markResidue(e.loci,r)&&t.updateMarker()},t.lociSelectionProvider=function(e,r){t.props.sequenceWrapper.markResidue(e.loci,r)&&t.updateMarker()},t.contextMenu=function(e){e.preventDefault()},t.mouseDownLoci=void 0,t.mouseDown=function(e){e.stopPropagation();var r=t.getSeqIdx(e),n=t.getLoci(r),i=Object(O.e)(e.nativeEvent),a=Object(O.d)(e.nativeEvent),o=Object(O.f)(e.nativeEvent);t.click(n,i,a,o),t.mouseDownLoci=n},t.mouseUp=function(e){if(e.stopPropagation(),void 0!==t.mouseDownLoci){var r=t.getSeqIdx(e),n=t.getLoci(r);if(n&&!w.StructureElement.Loci.areEqual(t.mouseDownLoci,n)){var i=Object(O.e)(e.nativeEvent),a=Object(O.d)(e.nativeEvent),o=Object(O.f)(e.nativeEvent),s=t.mouseDownLoci.elements[0],u=n.elements[0],c=Math.min(P.OrderedSet.min(s.indices),P.OrderedSet.min(u.indices)),l=Math.max(P.OrderedSet.max(s.indices),P.OrderedSet.max(u.indices)),d=w.StructureElement.Loci(n.structure,[{unit:s.unit,indices:P.OrderedSet.ofRange(c,l)}]);t.click(w.StructureElement.Loci.subtract(d,t.mouseDownLoci),i,a,o)}t.mouseDownLoci=void 0}},t.location=w.StructureElement.Location.create(void 0),t.mouseMove=function(e){e.stopPropagation();var r=Object(O.e)(e.nativeEvent),i=Object(O.d)(e.nativeEvent),a=Object(O.f)(e.nativeEvent),o=e.target;if(!o||!o.getAttribute){if(-1===t.lastMouseOverSeqIdx)return;return t.lastMouseOverSeqIdx=-1,void t.highlightQueue.next({seqIdx:-1,buttons:r,button:i,modifiers:a})}var s=o.hasAttribute("data-seqid")?+o.getAttribute("data-seqid"):-1;if(t.lastMouseOverSeqIdx!==s)if(t.lastMouseOverSeqIdx=s,void 0!==t.mouseDownLoci){var u=t.getLoci(s);t.hover(u,0,0,Object(n.__assign)(Object(n.__assign)({},a),{shift:!0}))}else t.highlightQueue.next({seqIdx:s,buttons:r,button:i,modifiers:a})},t.mouseLeave=function(e){if(e.stopPropagation(),t.mouseDownLoci=void 0,-1!==t.lastMouseOverSeqIdx){t.lastMouseOverSeqIdx=-1;var r=Object(O.e)(e.nativeEvent),n=Object(O.d)(e.nativeEvent),i=Object(O.f)(e.nativeEvent);t.highlightQueue.next({seqIdx:-1,buttons:r,button:n,modifiers:i})}},t}return Object(n.__extends)(t,e),Object.defineProperty(t.prototype,"sequenceNumberPeriod",{get:function(){return void 0!==this.props.sequenceNumberPeriod?this.props.sequenceNumberPeriod:this.props.sequenceWrapper.length>10?10:this.getSequenceNumber(this.props.sequenceWrapper.length-1).length>1?5:1},enumerable:!1,configurable:!0}),t.prototype.componentDidMount=function(){var e=this;this.plugin.managers.interactivity.lociHighlights.addProvider(this.lociHighlightProvider),this.plugin.managers.interactivity.lociSelects.addProvider(this.lociSelectionProvider),this.subscribe(Object(j.a)(15)(this.highlightQueue),(function(t){var r=e.getLoci(t.seqIdx<0?void 0:t.seqIdx);e.hover(r,t.buttons,t.button,t.modifiers)}))},t.prototype.componentWillUnmount=function(){e.prototype.componentWillUnmount.call(this),this.plugin.managers.interactivity.lociHighlights.removeProvider(this.lociHighlightProvider),this.plugin.managers.interactivity.lociSelects.removeProvider(this.lociSelectionProvider)},t.prototype.getLoci=function(e){if(void 0!==e){var t=this.props.sequenceWrapper.getLoci(e);if(!w.StructureElement.Loci.isEmpty(t))return t}},t.prototype.getSeqIdx=function(e){var t=void 0,r=e.target;return r&&r.getAttribute&&(t=r.hasAttribute("data-seqid")?+r.getAttribute("data-seqid"):void 0),t},t.prototype.hover=function(e,t,r,n){var i={current:E.a.Loci.Empty,buttons:t,button:r,modifiers:n};void 0===e||w.StructureElement.Loci.isEmpty(e)||(i.current={loci:e}),this.plugin.behaviors.interaction.hover.next(i)},t.prototype.click=function(e,t,r,n){var i={current:E.a.Loci.Empty,buttons:t,button:r,modifiers:n};void 0===e||w.StructureElement.Loci.isEmpty(e)||(i.current={loci:e}),this.plugin.behaviors.interaction.click.next(i)},t.prototype.getBackgroundColor=function(e){return void 0===e&&console.error("unexpected marker value"),0===e?"":e%2==0?"rgb(51, 255, 25)":"rgb(255, 102, 153)"},t.prototype.getResidueClass=function(e,t){return t.length>1?this.props.sequenceWrapper.residueClass(e)+(0===e?" msp-sequence-residue-long-begin":" msp-sequence-residue-long"):this.props.sequenceWrapper.residueClass(e)},t.prototype.residue=function(e,t,r){return i.createElement("span",{key:e,"data-seqid":e,style:{backgroundColor:this.getBackgroundColor(r)},className:this.getResidueClass(e,t)},"​"+t+"​")},t.prototype.getSequenceNumberClass=function(e,t,r){var n=["msp-sequence-number"];return t.startsWith("-")?r.length>1&&e>0?n.push("msp-sequence-number-long-negative"):n.push("msp-sequence-number-negative"):r.length>1&&e>0&&n.push("msp-sequence-number-long"),n.join(" ")},t.prototype.getSequenceNumber=function(e){var t="",r=this.props.sequenceWrapper.getLoci(e),n=w.StructureElement.Loci.getFirstLocation(r,this.location);if(n)if(w.Unit.isAtomic(n.unit)){var i=w.StructureProperties.residue.auth_seq_id(n),a=w.StructureProperties.residue.pdbx_PDB_ins_code(n);t=""+i+(a||"")}else w.Unit.isCoarse(n.unit)&&(t=""+(e+1));return t},t.prototype.padSeqNum=function(e){return e.length<5?e+new Array(5-e.length+1).join(" "):e},t.prototype.getSequenceNumberSpan=function(e,t){var r=this.getSequenceNumber(e);return i.createElement("span",{key:"marker-"+e,className:this.getSequenceNumberClass(e,r,t)},this.padSeqNum(r))},t.prototype.updateMarker=function(){if(this.parentDiv.current)for(var e=this.parentDiv.current.children,t=this.props.sequenceWrapper.markerArray,r=!this.props.hideSequenceNumbers,n=this.sequenceNumberPeriod,i=0,a=0,o=t.length;a<o;a++){r&&a%n==0&&a<o&&i++;var s=e[i];if(!s)return;i++;var u=this.getBackgroundColor(t[a]);s.style.backgroundColor!==u&&(s.style.backgroundColor=u)}},t.prototype.render=function(){for(var e=this.props.sequenceWrapper,t=[],r=!this.props.hideSequenceNumbers,n=this.sequenceNumberPeriod,a=0,o=e.length;a<o;++a){var s=e.residueLabel(a);r&&a%n==0&&a<o&&(t[t.length]=this.getSequenceNumberSpan(a,s)),t[t.length]=this.residue(a,s,e.markerArray[a])}return this.updateMarker(),i.createElement("div",{className:"msp-sequence-wrapper",onContextMenu:this.contextMenu,onMouseDown:this.mouseDown,onMouseUp:this.mouseUp,onMouseMove:this.mouseMove,onMouseLeave:this.mouseLeave,ref:this.parentDiv},t)},t}(o.PluginUIComponent),D=r(23),T=r(51),I=function(){function e(e,t,r){this.data=e,this.markerArray=t,this.length=r}return e.prototype.markResidue=function(e,t){return Object(D.isEveryLoci)(e)?Object(T.c)(this.markerArray,P.Interval.ofLength(this.length),t):this.mark(e,t)},e}(),M=r(47),k=function(e){function t(t){var r=this,n=w.StructureElement.Location.create(t.structure,t.units[0],t.units[0].elements[0]),i=t.units[0].model.sequence.byEntityKey[w.StructureProperties.entity.key(n)],a=i.sequence.length,o=new Uint8Array(a);(r=e.call(this,t,o,a)||this).unitMap=new Map;for(var s=0,u=t.units;s<u.length;s++){var c=u[s];r.unitMap.set(c.id,c)}r.sequence=i.sequence,r.missing=t.units[0].model.properties.missingResidues,r.modelNum=t.units[0].model.modelNum,r.asymId=w.Unit.isAtomic(t.units[0])?w.StructureProperties.chain.label_asym_id(n):w.StructureProperties.coarse.asym_id(n);for(var l=[],d=0;d<a;++d)r.missing.has(r.modelNum,r.asymId,r.seqId(d))&&l.push(d);return r.observed=P.OrderedSet.subtract(P.Interval.ofBounds(0,a),P.SortedArray.ofSortedArray(l)),r}return Object(n.__extends)(t,e),t.prototype.seqId=function(e){return this.sequence.seqId.value(e)},t.prototype.residueLabel=function(e){return this.sequence.label.value(e)||this.sequence.code.value(e)},t.prototype.residueColor=function(e){return this.missing.has(this.modelNum,this.asymId,this.seqId(e))?M.a.grey:M.a.black},t.prototype.residueClass=function(e){return this.missing.has(this.modelNum,this.asymId,this.seqId(e))?"msp-sequence-missing":"msp-sequence-present"},t.prototype.mark=function(e,t){var r=this,n=!1,i=this.data.structure,a=function(e){return r.sequence.index(e)};if(w.StructureElement.Loci.is(e)){if(!w.Structure.areRootsEquivalent(e.structure,i))return!1;for(var o=0,s=(e=w.StructureElement.Loci.remap(e,i)).elements;o<s.length;o++){var u=s[o];this.unitMap.has(u.unit.id)&&(n=w.Unit.isAtomic(u.unit)?B(u,t,this.markerArray,a)||n:V(u,t,this.markerArray,a)||n)}}else if(w.Structure.isLoci(e)){if(!w.Structure.areRootsEquivalent(e.structure,i))return!1;Object(T.c)(this.markerArray,this.observed,t)&&(n=!0)}return n},t.prototype.getLoci=function(e){var t,r,n,i=(t=this.data.units[0].chainGroupId,r=this.data.units[0].conformation.operator.name,n=this.seqId(e),w.Queries.generators.atoms({unitTest:function(e){return w.StructureProperties.unit.chainGroupId(e.element)===t&&w.StructureProperties.unit.operator_name(e.element)===r},residueTest:function(e){return 0===e.element.unit.kind?w.StructureProperties.residue.label_seq_id(e.element)===n:w.StructureProperties.coarse.seq_id_begin(e.element)<=n&&w.StructureProperties.coarse.seq_id_end(e.element)>=n}}));return w.StructureSelection.toLociWithSourceUnits(w.StructureQuery.run(i,this.data.structure))},t}(I);function B(e,t,r,n){var i=e.unit,a=i.model,o=i.elements,s=a.atomicHierarchy.residueAtomSegments.index,u=a.atomicHierarchy.residues.label_seq_id,c=!1;return P.OrderedSet.forEachSegment(e.indices,(function(e){return s[o[e]]}),(function(e){var i=u.value(e);c=Object(T.d)(r,n(i),t)||c})),c}function V(e,t,r,n){var i=e.unit,a=i.model,o=i.elements,s=w.Unit.isSpheres(e.unit)?a.coarseHierarchy.spheres.seq_id_begin:a.coarseHierarchy.gaussians.seq_id_begin,u=w.Unit.isSpheres(e.unit)?a.coarseHierarchy.spheres.seq_id_end:a.coarseHierarchy.gaussians.seq_id_end,c=!1;return P.OrderedSet.forEach(e.indices,(function(e){for(var i=o[e],a=n(s.value(i)),l=n(u.value(i));a<=l;a++)c=Object(T.d)(r,a,t)||c})),c}var R=r(2),L=function(e){function t(t){for(var r=this,n=[],i=new Map,a=new Map,o=new Map,s=0,u=t.units.length;s<u;++s)for(var c=(b=t.units[s]).model.atomicHierarchy,l=c.residueAtomSegments,d=c.atoms,f=P.Segmentation.transientSegments(l,b.elements);f.hasNext;){var p=f.move().index;i.set(p,n.length),a.set(n.length,p),o.set(n.length,b),n.push(d.label_comp_id.value(l.offsets[p]))}var m=n.length,h=new Uint8Array(m);(r=e.call(this,t,h,m)||this).unitMap=new Map;for(var g=0,v=t.units;g<v.length;g++){var b=v[g];r.unitMap.set(b.id,b)}return r.sequence=n,r.sequenceIndices=i,r.residueIndices=a,r.seqToUnit=o,r}return Object(n.__extends)(t,e),t.prototype.residueLabel=function(e){return this.sequence[e]},t.prototype.residueColor=function(e){return M.a.black},t.prototype.residueClass=function(e){return"msp-sequence-present"},t.prototype.mark=function(e,t){var r=this,n=!1,i=this.data.structure;if(w.StructureElement.Loci.is(e)){if(!w.Structure.areRootsEquivalent(e.structure,i))return!1;e=w.StructureElement.Loci.remap(e,i);for(var a=function(e){var i=o.unitMap.get(e.unit.id);if(i){var a=e.unit.model.atomicHierarchy.residueAtomSegments.index;P.OrderedSet.forEach(e.indices,(function(e){var o=r.sequenceIndices.get(a[i.elements[e]]);void 0!==o&&Object(T.c)(r.markerArray,P.Interval.ofSingleton(o),t)&&(n=!0)}))}},o=this,s=0,u=e.elements;s<u.length;s++){a(u[s])}}else if(w.Structure.isLoci(e)){if(!w.Structure.areRootsEquivalent(e.structure,i))return!1;Object(T.c)(this.markerArray,P.Interval.ofBounds(0,this.length),t)&&(n=!0)}return n},t.prototype.getLoci=function(e){var t=[],r=this.residueIndices.get(e);if(void 0!==r){var n=this.seqToUnit.get(e),i=n.model.atomicHierarchy.residueAtomSegments.offsets,a=P.SortedArray.findPredecessorIndex(n.elements,i[r]),o=P.SortedArray.findPredecessorIndex(n.elements,i[r+1]);t.push({unit:n,indices:P.Interval.ofBounds(a,o)})}return w.StructureElement.Loci(this.data.structure,t)},t}(I),N=function(e){function t(t){for(var r=this,n=0,i=0,a=[],o=w.StructureElement.Location.create(t.structure),s=new Map,u=[],c=0,l=t.units.length;c<l;++c){var d=t.units[c];w.StructureElement.Location.set(o,t.structure,d,d.elements[0]);var f=d.model.sequence.byEntityKey[w.StructureProperties.entity.key(o)];f&&(n+=f.sequence.length),i+=d.elements.length;var p=P.Interval.ofBounds(0,d.elements.length);s.set(d.id,p),u.push({unit:d,indices:p})}n>0&&a.push(n+" residues"),a.push(i+" elements");var m=new Uint8Array(1);return(r=e.call(this,t,m,1)||this).label="Whole Chain ("+a.join(", ")+")",r.unitIndices=s,r.loci=w.StructureElement.Loci(r.data.structure,u),r}return Object(n.__extends)(t,e),t.prototype.residueLabel=function(e){return this.label},t.prototype.residueColor=function(e){return M.a.black},t.prototype.residueClass=function(e){return"msp-sequence-present"},t.prototype.mark=function(e,t){var r=!1,n=this.data.structure;if(w.StructureElement.Loci.is(e)){if(!w.Structure.areRootsEquivalent(e.structure,n))return!1;for(var i=0,a=(e=w.StructureElement.Loci.remap(e,n)).elements;i<a.length;i++){var o=a[i],s=this.unitIndices.get(o.unit.id);s&&P.OrderedSet.isSubset(s,o.indices)&&Object(T.c)(this.markerArray,P.Interval.ofSingleton(0),t)&&(r=!0)}}else if(w.Structure.isLoci(e)){if(!w.Structure.areRootsEquivalent(e.structure,n))return!1;Object(T.c)(this.markerArray,P.Interval.ofSingleton(0),t)&&(r=!0)}return r},t.prototype.getLoci=function(e){return this.loci},t}(I),F=function(e){function t(t){for(var r=this,n=0,i=new Map,a=[],o=0,s=t.units.length;o<s;++o){var u=t.units[o];n+=u.elements.length;var c=P.Interval.ofBounds(0,u.elements.length);i.set(u.id,c),a.push({unit:u,indices:c})}var l=new Uint8Array(n);return(r=e.call(this,t,l,n)||this).unitIndices=i,r}return Object(n.__extends)(t,e),t.prototype.residueLabel=function(e){return"X"},t.prototype.residueColor=function(e){return M.a.black},t.prototype.residueClass=function(e){return"msp-sequence-present"},t.prototype.mark=function(e,t){var r=!1,n=this.data,i=n.structure,a=n.units;if(w.StructureElement.Loci.is(e)){if(!w.Structure.areRootsEquivalent(e.structure,i))return!1;for(var o=0,s=(e=w.StructureElement.Loci.remap(e,i)).elements;o<s.length;o++){var u=s[o];(d=this.unitIndices.get(u.unit.id))&&P.OrderedSet.isSubset(d,u.indices)&&Object(T.c)(this.markerArray,u.indices,t)&&(r=!0)}}else if(w.Structure.isLoci(e)){if(!w.Structure.areRootsEquivalent(e.structure,i))return!1;for(var c=0,l=a.length;c<l;++c){var d=this.unitIndices.get(a[c].id);Object(T.c)(this.markerArray,d,t)&&(r=!0)}}return r},t.prototype.getLoci=function(e){for(var t=this.data.units,r=[],n=0,i=0,a=t.length;i<a;++i){var o=t[i];if(e<n+o.elements.length){r.push({unit:o,indices:P.Interval.ofSingleton(e-n)});break}n+=o.elements.length}return w.StructureElement.Loci(this.data.structure,r)},t}(I),U=r(77),z=r(29);function H(e){var t=w.StructureProperties.unit.pdbx_struct_oper_list_ids(e),r=w.StructureProperties.unit.struct_ncs_oper_id(e),n=w.StructureProperties.unit.hkl(e),i=w.StructureProperties.unit.spgrOp(e);return t.sort().join(",")+"|"+r+"|"+n+"|"+i}function G(e){var t=e.split("|"),r=t[0],n=t[1];return[parseInt(r),n]}function q(e,t){for(var r=e.structure,n=e.modelEntityId,i=e.chainGroupId,a=e.operatorKey,o=w.StructureElement.Location.create(r),s=G(n),u=s[0],c=s[1],l=[],d=0,f=r.units;d<f.length;d++){var p=f[d];w.StructureElement.Location.set(o,r,p,p.elements[0]),r.getModelIndex(p.model)===u&&(w.StructureProperties.entity.id(o)===c&&p.chainGroupId===i&&H(o)===a&&l.push(p))}if(l.length>0){var m={structure:r,units:l},h=void 0;if((p=l[0]).polymerElements.length){var g=w.StructureElement.Location.create(r,p,p.elements[0]),v=p.model.sequence.byEntityKey[w.StructureProperties.entity.key(g)];if(v&&v.sequence.length<=5e3)h=new k(m);else{var b=l.reduce((function(e,t){return e+t.polymerElements.length}),0);h=w.Unit.isAtomic(p)||b>5e3?new N(m):new F(m)}}else if(w.Unit.isAtomic(p)){h=l.reduce((function(e,t){return e+t.residueCount}),0)>5e3?new N(m):new L(m)}else console.warn("should not happen, expecting coarse units to be polymeric"),h=new N(m);return h.markResidue(t.getLoci(r),T.a.Select),h}return"No sequence available"}function W(e,t){void 0===t&&(t=!1);for(var r=[],n=w.StructureElement.Location.create(e),i=new Set,a=0,o=e.units;a<o.length;a++){var s=o[a];w.StructureElement.Location.set(n,e,s,s.elements[0]);var u=w.StructureProperties.entity.id(n),c=e.getModelIndex(s.model),l=c+"|"+u;if(!i.has(l)&&(!t||"polymer"===w.StructureProperties.entity.type(n))){var d=w.StructureProperties.entity.pdbx_description(n).join(", ");e.models.length&&(e.representativeModel?d+=" (Model "+e.models[c].modelNum+")":d.startsWith("Polymer ")&&(d+=" ("+e.models[c].entry+")"));var f=u+": "+d;r.push([l,f]),i.add(l)}}return 0===r.length&&r.push(["","No entities"]),r}function X(e,t){for(var r=[],n=w.StructureElement.Location.create(e),i=new Set,a=G(t),o=a[0],s=a[1],u=0,c=e.units;u<c.length;u++){var l=c[u];if(w.StructureElement.Location.set(n,e,l,l.elements[0]),e.getModelIndex(l.model)===o&&w.StructureProperties.entity.id(n)===s){var d=l.chainGroupId;if(!i.has(d)){var f=Object(U.elementLabel)(n,{granularity:"chain",hidePrefix:!0,htmlStyling:!1});r.push([d,f]),i.add(d)}}}return 0===r.length&&r.push([-1,"No units"]),r}function Y(e,t,r){for(var n=[],i=w.StructureElement.Location.create(e),a=new Set,o=G(t),s=o[0],u=o[1],c=0,l=e.units;c<l.length;c++){var d=l[c];if(w.StructureElement.Location.set(i,e,d,d.elements[0]),e.getModelIndex(d.model)===s&&w.StructureProperties.entity.id(i)===u&&d.chainGroupId===r){var f=H(i);if(!a.has(f)){var p=d.conformation.operator.name;n.push([f,p]),a.add(f)}}}return 0===n.length&&n.push(["","No operators"]),n}function Q(e){for(var t,r=[],n=[],i=0,a=e.select(l.StateSelection.Generators.rootsOfType(x.a.Molecule.Structure));i<a.length;i++){var o=a[i];(null===(t=o.obj)||void 0===t?void 0:t.data)&&(n.push(o.obj.data),r.push([o.transform.ref,o.obj.data.label]))}return 0===r.length&&r.push(["","No structure"]),{options:r,all:n}}var K=R.ParamDefinition.Select("single",[["single","Chain"],["polymers","Polymers"],["all","Everything"]]),Z=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={structureOptions:{options:[],all:[]},structure:w.Structure.Empty,structureRef:"",modelEntityId:"",chainGroupId:-1,operatorKey:"",mode:"single"},t.setParamProps=function(e){var r=Object(n.__assign)({},t.state);switch(e.name){case"mode":if(r.mode=e.value,t.state.mode===r.mode)return;if("all"===r.mode||"polymers"===r.mode)break;case"structure":"structure"===e.name&&(r.structureRef=e.value),r.structure=t.getStructure(r.structureRef),r.modelEntityId=W(r.structure)[0][0],r.chainGroupId=X(r.structure,r.modelEntityId)[0][0],r.operatorKey=Y(r.structure,r.modelEntityId,r.chainGroupId)[0][0];break;case"entity":r.modelEntityId=e.value,r.chainGroupId=X(r.structure,r.modelEntityId)[0][0],r.operatorKey=Y(r.structure,r.modelEntityId,r.chainGroupId)[0][0];break;case"chain":r.chainGroupId=e.value,r.operatorKey=Y(r.structure,r.modelEntityId,r.chainGroupId)[0][0];break;case"operator":r.operatorKey=e.value}t.setState(r)},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.plugin.state.data.select(l.StateSelection.Generators.rootsOfType(x.a.Molecule.Structure)).length>0&&this.setState(this.getInitialState()),this.subscribe(this.plugin.state.events.object.updated,(function(t){var r=t.ref,n=t.obj;r===e.state.structureRef&&n&&n.type===x.a.Molecule.Structure.type&&n.data!==e.state.structure&&e.sync()})),this.subscribe(this.plugin.state.events.object.created,(function(t){var r=t.obj;r&&r.type===x.a.Molecule.Structure.type&&e.sync()})),this.subscribe(this.plugin.state.events.object.removed,(function(t){var r=t.obj;r&&r.type===x.a.Molecule.Structure.type&&r.data===e.state.structure&&e.sync()}))},t.prototype.sync=function(){var e=Q(this.plugin.state.data);Object(z.arrayEqual)(e.all,this.state.structureOptions.all)||this.setState(this.getInitialState())},t.prototype.getStructure=function(e){var t=this.plugin.state.data.select(e)[0];return e&&t&&t.obj?t.obj.data:w.Structure.Empty},t.prototype.getSequenceWrapper=function(e){return{wrapper:q(this.state,this.plugin.managers.structure.selection),label:R.ParamDefinition.optionLabel(e.chain,this.state.chainGroupId)+" | "+R.ParamDefinition.optionLabel(e.entity,this.state.modelEntityId)}},t.prototype.getSequenceWrappers=function(e){if("single"===this.state.mode)return[this.getSequenceWrapper(e)];for(var t=this.getStructure(this.state.structureRef),r=[],n=0,i=W(t,"polymers"===this.state.mode);n<i.length;n++)for(var a=i[n],o=a[0],s=a[1],u=0,c=X(t,o);u<c.length;u++)for(var l=c[u],d=l[0],f=l[1],p=0,m=Y(t,o,d);p<m.length;p++){var h=m[p][0];r.push({wrapper:q({structure:t,modelEntityId:o,chainGroupId:d,operatorKey:h},this.plugin.managers.structure.selection),label:f+" | "+s})}return r},t.prototype.getInitialState=function(){var e,t=Q(this.plugin.state.data),r=t.options[0][0],n=this.getStructure(r),i=W(n)[0][0],a=X(n,i)[0][0],o=Y(n,i,a)[0][0];return this.state.structure&&this.state.structure===n&&(i=this.state.modelEntityId,a=this.state.chainGroupId,o=this.state.operatorKey),{structureOptions:t,structure:n,structureRef:r,modelEntityId:i,chainGroupId:a,operatorKey:o,mode:null!==(e=this.props.defaultMode)&&void 0!==e?e:"single"}},Object.defineProperty(t.prototype,"params",{get:function(){var e=this.state,t=e.structureOptions,r=e.structure,n=e.modelEntityId,i=e.chainGroupId,a=W(r),o=X(r,n),s=Y(r,n,i);return{structure:R.ParamDefinition.Select(t.options[0][0],t.options,{shortLabel:!0}),entity:R.ParamDefinition.Select(a[0][0],a,{shortLabel:!0}),chain:R.ParamDefinition.Select(o[0][0],o,{shortLabel:!0,twoColumns:!0,label:"Chain"}),operator:R.ParamDefinition.Select(s[0][0],s,{shortLabel:!0,twoColumns:!0}),mode:K}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){return{structure:this.state.structureRef,entity:this.state.modelEntityId,chain:this.state.chainGroupId,operator:this.state.operatorKey,mode:this.state.mode}},enumerable:!1,configurable:!0}),t.prototype.render=function(){if(this.getStructure(this.state.structureRef)===w.Structure.Empty)return i.createElement("div",{className:"msp-sequence"},i.createElement("div",{className:"msp-sequence-select"},i.createElement(v.Icon,{svg:v.HelpOutlineSvg,style:{cursor:"help",position:"absolute",right:0,top:0},title:"Shows a sequence of one or more chains. Use the controls to alter selection."}),i.createElement("span",null,"Sequence"),i.createElement("span",{style:{fontWeight:"normal"}},"No structure available")));var e=this.params,t=this.values,r=this.getSequenceWrappers(e);return i.createElement("div",{className:"msp-sequence"},i.createElement("div",{className:"msp-sequence-select"},i.createElement(v.Icon,{svg:v.HelpOutlineSvg,style:{cursor:"help",position:"absolute",right:0,top:0},title:"This shows a single sequence. Use the controls to show a different sequence."}),i.createElement("span",null,"Sequence of"),i.createElement(f.PureSelectControl,{title:"[Structure] "+R.ParamDefinition.optionLabel(e.structure,t.structure),param:e.structure,name:"structure",value:t.structure,onChange:this.setParamProps}),i.createElement(f.PureSelectControl,{title:"[Mode]",param:K,name:"mode",value:t.mode,onChange:this.setParamProps}),"single"===t.mode&&i.createElement(f.PureSelectControl,{title:"[Entity] "+R.ParamDefinition.optionLabel(e.entity,t.entity),param:e.entity,name:"entity",value:t.entity,onChange:this.setParamProps}),"single"===t.mode&&i.createElement(f.PureSelectControl,{title:"[Chain] "+R.ParamDefinition.optionLabel(e.chain,t.chain),param:e.chain,name:"chain",value:t.chain,onChange:this.setParamProps}),e.operator.options.length>1&&i.createElement(i.Fragment,null,i.createElement(f.PureSelectControl,{title:"[Instance] "+R.ParamDefinition.optionLabel(e.operator,t.operator),param:e.operator,name:"operator",value:t.operator,onChange:this.setParamProps}))),i.createElement(J,null,r.map((function(e,r){var n="string"==typeof e.wrapper?i.createElement("div",{key:r,className:"msp-sequence-wrapper"},e.wrapper):i.createElement(A,{key:r,sequenceWrapper:e.wrapper});return"single"===t.mode?n:i.createElement(i.Fragment,null,i.createElement("div",{className:"msp-sequence-chain-label"},e.label),n)}))))},t}(o.PluginUIComponent);function J(e){var t=e.children;return i.createElement("div",{className:"msp-sequence-wrapper-non-empty"},t)}var $=r(387),ee=r(401),te=r(329),re=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.region=function(e,t){return i.createElement("div",{className:"msp-layout-region msp-layout-"+e},i.createElement("div",{className:"msp-layout-static"},t))},t.prototype.render=function(){return i.createElement(o.PluginReactContext.Provider,{value:this.props.plugin},i.createElement(ie,null))},t}(i.Component),ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){return i.createElement(o.PluginReactContext.Provider,{value:this.props.plugin},i.createElement("div",{className:"msp-plugin"},this.props.children))},t}(i.Component),ie=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onDrop=function(e){var r;if(e.preventDefault(),e.dataTransfer.items){for(var n=0;n<e.dataTransfer.items.length;n++)if("file"===e.dataTransfer.items[n].kind){r=e.dataTransfer.items[n].getAsFile();break}}else r=e.dataTransfer.files[0];if(r){var i=(null==r?void 0:r.name.toLowerCase())||"";(i.endsWith("molx")||i.endsWith("molj"))&&c.PluginCommands.State.Snapshots.OpenFile(t.plugin,{file:r})}},t.onDragOver=function(e){e.preventDefault()},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.layout.events.updated,(function(){return e.forceUpdate()}))},t.prototype.region=function(e,t){return i.createElement("div",{className:"msp-layout-region msp-layout-"+e},i.createElement("div",{className:"msp-layout-static"},t?i.createElement(t,null):null))},Object.defineProperty(t.prototype,"layoutVisibilityClassName",{get:function(){var e=this.plugin.layout.state,t=this.plugin.spec.layout&&this.plugin.spec.layout.controls||{},r=[];return"none"!==t.top&&e.showControls&&"hidden"!==e.regionState.top||r.push("msp-layout-hide-top"),"none"!==t.left&&e.showControls&&"hidden"!==e.regionState.left?"collapsed"===e.regionState.left&&r.push("msp-layout-collapse-left"):r.push("msp-layout-hide-left"),"none"!==t.right&&e.showControls&&"hidden"!==e.regionState.right||r.push("msp-layout-hide-right"),"none"!==t.bottom&&e.showControls&&"hidden"!==e.regionState.bottom||r.push("msp-layout-hide-bottom"),r.join(" ")},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layoutClassName",{get:function(){var e=this.plugin.layout.state,t=["msp-plugin-content"];return e.isExpanded?t.push("msp-layout-expanded"):t.push("msp-layout-standard","msp-layout-standard-"+e.controlsDisplay),t.join(" ")},enumerable:!1,configurable:!0}),t.prototype.render=function(){var e,t,r,n,a=this.plugin.layout.state,o=(null===(e=this.plugin.spec.layout)||void 0===e?void 0:e.controls)||{},s=(null===(r=null===(t=this.plugin.spec.components)||void 0===t?void 0:t.viewport)||void 0===r?void 0:r.view)||oe;return i.createElement("div",{className:"msp-plugin",onDrop:this.onDrop,onDragOver:this.onDragOver},i.createElement("div",{className:this.layoutClassName},i.createElement("div",{className:this.layoutVisibilityClassName},this.region("main",s),a.showControls&&"none"!==o.top&&this.region("top",o.top||Z),a.showControls&&"none"!==o.left&&this.region("left",o.left||b),a.showControls&&"none"!==o.right&&this.region("right",o.right||ae),a.showControls&&"none"!==o.bottom&&this.region("bottom",o.bottom||se)),!(null===(n=this.plugin.spec.components)||void 0===n?void 0:n.hideTaskOverlay)&&i.createElement($.OverlayTaskProgress,null)))},t}(o.PluginUIComponent),ae=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){var e,t=(null===(e=this.plugin.spec.components)||void 0===e?void 0:e.structureTools)||s.DefaultStructureTools;return i.createElement("div",{className:"msp-scrollable-container"},i.createElement(t,null))},t}(o.PluginUIComponent),oe=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Object(n.__extends)(t,e),t.prototype.render=function(){var e,t,r=(null===(t=null===(e=this.plugin.spec.components)||void 0===e?void 0:e.viewport)||void 0===t?void 0:t.controls)||te.ViewportControls;return i.createElement(i.Fragment,null,i.createElement(te.Viewport,null),i.createElement("div",{className:"msp-viewport-top-left-controls"},i.createElement(s.AnimationViewportControls,null),i.createElement(s.TrajectoryViewportControls,null),i.createElement(s.StateSnapshotViewportControls,null)),i.createElement(s.SelectionViewportControls,null),i.createElement(r,null),i.createElement($.BackgroundTaskProgress,null),i.createElement("div",{className:"msp-highlight-toast-wrapper"},i.createElement(s.LociLabels,null),i.createElement(ee.Toasts,null)))},t}(o.PluginUIComponent),se=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.wrapper=i.createRef(),t.state={entries:t.plugin.log.entries},t}return Object(n.__extends)(t,e),t.prototype.componentDidMount=function(){var e=this;this.subscribe(this.plugin.events.log,(function(){return e.setState({entries:e.plugin.log.entries})}))},t.prototype.componentDidUpdate=function(){this.scrollToBottom()},t.prototype.scrollToBottom=function(){var e=this.wrapper.current;e&&(e.scrollTop=e.scrollHeight-e.clientHeight-1)},t.prototype.render=function(){for(var e=this.state.entries,t=e.size,r=[],n=Math.max(0,t-10),o=0;n<t;n++){var s=e.get(n);r.push(i.createElement("li",{key:o++},i.createElement("div",{className:"msp-log-entry-badge msp-log-entry-"+s.type}),i.createElement("div",{className:"msp-log-timestamp"},Object(a.i)(s.timestamp)),i.createElement("div",{className:"msp-log-entry"},s.message)))}return i.createElement("div",{ref:this.wrapper,className:"msp-log",style:{position:"absolute",top:"0",right:"0",bottom:"0",left:"0",overflowY:"auto"}},i.createElement("ul",{className:"msp-list-unstyled"},r))},t}(o.PluginUIComponent)},function(e,t,r){"use strict";r.r(t),r.d(t,"PDBeStructureQualityReport",(function(){return i.PDBeStructureQualityReport})),r.d(t,"PDBePreferredAssembly",(function(){return n})),r.d(t,"PDBeStructRefDomain",(function(){return f}));var n,i=r(396),a=r(0),o=r(7),s=r(152),u=r(63),c=r(95),l=r(74),d=r(66);!function(e){function t(e){var t=c.a.Provider.get(e);return(null==t?void 0:t.assemblies.length)?t.assemblies[0].id:""}function r(e){return e._staticPropertyData.__PDBePreferredAssebly__||t(e)}e.getFirstFromModel=t,e.get=r,e.Schema={pdbe_preferred_assembly:{assembly_id:o.a.Schema.str}},e.Descriptor=Object(d.CustomPropertyDescriptor)({name:"pdbe_preferred_assembly",cifExport:{prefix:"pdbe",context:function(e){return r(e.firstModel)},categories:[{name:"pdbe_preferred_assembly",instance:function(t){return u.a.Category.ofTable(o.d.ofArrays(e.Schema.pdbe_preferred_assembly,{assembly_id:[t]}))}}]}}),e.attachFromCifOrApi=function(r,i){return Object(a.__awaiter)(this,void 0,void 0,(function(){var o,u;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return r.customProperties.has(e.Descriptor)?[2,!0]:void 0===(o=function(r){if(l.a.is(r.sourceData)){var n=r.sourceData.data.frame.categories.pdbe_preferred_assembly;if(n)return Object(s.c)(e.Schema.pdbe_preferred_assembly,n).assembly_id.value(0)||t(r)}}(r))&&i.PDBe_apiSourceJson?[4,i.PDBe_apiSourceJson(r)]:[3,2];case 1:return(u=a.sent())?(o=function(e,t){var r=t[0]&&t[0].assemblies;if(!r||!r.length)return n.getFirstFromModel(e);for(var i=0,a=r;i<a.length;i++){var o=a[i];if(o.preferred)return o.assembly_id}return r[0].assembly_id}(r,u),[3,3]):[2,!1];case 2:return[2,!1];case 3:return o?(r.customProperties.add(e.Descriptor),function(e,t){e._staticPropertyData.__PDBePreferredAssebly__=t}(r,o),[2,!0]):[2,!1]}}))}))}}(n||(n={}));var f,p=r(248);!function(e){function t(e){return e._staticPropertyData.__PDBeStructRefSeq__}e.get=t,e.Schema={pdbe_struct_ref_domain:{id:o.a.Schema.int,db_name:o.a.Schema.str,db_code:o.a.Schema.str,identifier:o.a.Schema.str,name:o.a.Schema.str,label_entity_id:o.a.Schema.str,label_asym_id:o.a.Schema.str,beg_label_seq_id:o.a.Schema.int,beg_pdbx_PDB_ins_code:o.a.Schema.str,end_label_seq_id:o.a.Schema.int,end_pdbx_PDB_ins_code:o.a.Schema.str}},e.Descriptor=Object(d.CustomPropertyDescriptor)({name:"pdbe_struct_ref_domain",cifExport:{prefix:"pdbe",context:function(e){return t(e.firstModel)},categories:[p.PropertyWrapper.defaultInfoCategory("pdbe_struct_ref_domain_info",(function(e){return e.info})),{name:"pdbe_struct_ref_domain",instance:function(e){return e&&e.data?u.a.Category.ofTable(e.data):u.a.Category.Empty}}]}}),e.attachFromCifOrApi=function(t,r){return Object(a.__awaiter)(this,void 0,void 0,(function(){var n,i,u;return Object(a.__generator)(this,(function(a){switch(a.label){case 0:return t.customProperties.has(e.Descriptor)?[2,!0]:(i=p.PropertyWrapper.tryGetInfoFromCif("pdbe_struct_ref_domain_info",t))?(n=function(t){if(l.a.is(t.sourceData)){var r=t.sourceData.data.frame.categories.pdbe_struct_ref_domain;if(r)return Object(s.c)(e.Schema.pdbe_struct_ref_domain,r)}}(t),[3,4]):[3,1];case 1:return r.PDBe_apiSourceJson?[4,r.PDBe_apiSourceJson(t)]:[3,3];case 2:return(u=a.sent())?(i=p.PropertyWrapper.createInfo(),n=function(e,t){for(var r=[],n=1,i=0,a=Object.keys(t);i<a.length;i++)for(var s=a[i],u=t[s],c=0,l=Object.keys(u);c<l.length;c++)for(var d=l[c],p=u[d],m=0,h=p.mappings;m<h.length;m++){var g=h[m];r.push({id:n++,db_name:s,db_code:d,identifier:p.identifier,name:p.name,label_entity_id:""+g.entity_id,label_asym_id:g.struct_asym_id,beg_label_seq_id:g.start.residue_number,beg_pdbx_PDB_ins_code:g.start.author_insertion_code,end_label_seq_id:g.end.residue_number,end_pdbx_PDB_ins_code:g.end.author_insertion_code})}return o.d.ofRows(f.Schema.pdbe_struct_ref_domain,r)}(0,u),[3,4]):[2,!1];case 3:return[2,!1];case 4:return t.customProperties.add(e.Descriptor),function(e,t){e._staticPropertyData.__PDBeStructRefSeq__=t}(t,{info:i,data:n}),[2,!0]}}))}))}}(f||(f={}))},function(e,t,r){"use strict";r.r(t),r.d(t,"AnimateModelIndex",(function(){return l})),r.d(t,"AnimateAssemblyUnwind",(function(){return d})),r.d(t,"AnimateUnitsExplode",(function(){return f})),r.d(t,"AnimateStateInterpolation",(function(){return p}));var n,i=r(0);!function(e){e.create=function(e){return e},e.getDuration=function(e,t){var r,n;if(t.customDurationMs)return t.customDurationMs;var i=null===(n=(r=t.definition).getDuration)||void 0===n?void 0:n.call(r,t.params,e);return"fixed"===(null==i?void 0:i.kind)?i.durationMs:void 0}}(n||(n={}));var a=r(8),o=r(31),s=r(13),u=r(27),c=r(2),l=n.create({name:"built-in.animate-model-index",display:{name:"Animate Trajectory"},params:function(){return{mode:c.ParamDefinition.MappedStatic("palindrome",{palindrome:c.ParamDefinition.Group({}),loop:c.ParamDefinition.Group({}),once:c.ParamDefinition.Group({direction:c.ParamDefinition.Select("forward",[["forward","Forward"],["backward","Backward"]])},{isFlat:!0})},{options:[["palindrome","Palindrome"],["loop","Loop"],["once","Once"]]}),maxFPS:c.ParamDefinition.Numeric(15,{min:1,max:60,step:1})}},canApply:function(e){for(var t=e.state.data,r=0,n=t.select(s.StateSelection.Generators.ofTransformer(o.StateTransforms.Model.ModelFromTrajectory));r<n.length;r++){var i=n[r],u=s.StateSelection.findAncestorOfType(t.tree,t.cells,i.transform.ref,[a.a.Molecule.Trajectory]);if(u&&u.obj&&u.obj.data.frameCount>1)return{canApply:!0}}return{canApply:!1,reason:"No trajectory to animate"}},initialState:function(){return{}},apply:function(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var n,c,l,d,f,p,m,h,g,v,b;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if(t.current>0&&t.current-t.lastApplied<1e3/r.params.maxFPS)return[2,{kind:"skip"}];if(n=r.plugin.state.data,0===(c=n.select(s.StateSelection.Generators.ofTransformer(o.StateTransforms.Model.ModelFromTrajectory))).length)return[2,{kind:"finished"}];for(l=n.build(),d=r.params,f=e.palindromeDirections||{},p=!1,m=!0,h=function(e){var t=s.StateSelection.findAncestorOfType(n.tree,n.cells,e.transform.ref,[a.a.Molecule.Trajectory]);if(!t||!t.obj)return"continue";var r=t.obj;if(r.data.frameCount<=1)return"continue";l.to(e).update((function(t){var n=r.data.frameCount;if(1===n)return t;m=!1;var i=1;if("once"===d.mode.name){if(-1===(i="backward"===d.mode.params.direction?-1:1)&&0===t.modelIndex||1===i&&t.modelIndex===n-1)return p=!0,t}else"palindrome"===d.mode.name&&(i=0===t.modelIndex?1:t.modelIndex===n-1?-1:f[e.transform.ref]||1);f[e.transform.ref]=i;var a=(t.modelIndex+i)%n;return a<0&&(a+=n),p=p||-1===i&&0===a||1===i&&a===n-1,{modelIndex:a}}))},g=0,v=c;g<v.length;g++)b=v[g],h(b);return m?[3,2]:[4,u.PluginCommands.State.Update(r.plugin,{state:n,tree:l,options:{doNotLogTiming:!0}})];case 1:i.sent(),i.label=2;case 2:return m||"once"===d.mode.name&&p?[2,{kind:"finished"}]:"palindrome"===d.mode.name?[2,{kind:"next",state:{palindromeDirections:f}}]:[2,{kind:"next",state:{}}]}}))}))}}),d=n.create({name:"built-in.animate-assembly-unwind",display:{name:"Unwind Assembly"},params:function(e){for(var t=[["all","All"]],r=0,n=e.state.data.select(s.StateSelection.Generators.rootsOfType(a.a.Molecule.Structure));r<n.length;r++){var i=n[r];t.push([i.transform.ref,i.obj.data.models[0].label])}return{durationInMs:c.ParamDefinition.Numeric(3e3,{min:100,max:1e4,step:100}),playOnce:c.ParamDefinition.Boolean(!1),target:c.ParamDefinition.Select(t[0][0],t)}},canApply:function(e){var t=e.state.data,r=s.StateTransform.RootRef;return{canApply:t.select(s.StateSelection.Generators.ofType(a.a.Molecule.Structure.Representation3D,r)).length>0}},initialState:function(){return{t:0}},setup:function(e,t){for(var r=t.state.data,n=e.target&&"all"!==e.target?e.target:s.StateTransform.RootRef,i=r.select(s.StateSelection.Generators.ofType(a.a.Molecule.Structure.Representation3D,n)),u=r.build(),c=!1,l=0,d=i;l<d.length;l++){var f=d[l];r.select(s.StateSelection.Generators.ofTransformer(o.StateTransforms.Representation.UnwindStructureAssemblyRepresentation3D,f.transform.ref)).length>0||(c=!0,u.to(f).apply(o.StateTransforms.Representation.UnwindStructureAssemblyRepresentation3D,{t:0},{tags:"animate-assembly-unwind"}))}if(c)return u.commit({doNotUpdateCurrent:!0})},teardown:function(e,t){var r=t.state.data,n=r.select(s.StateSelection.Generators.ofType(a.a.Molecule.Structure.Representation3DState).withTag("animate-assembly-unwind"));if(0!==n.length){for(var i=r.build(),o=0,u=n;o<u.length;o++){var c=u[o];i.delete(c.transform.ref)}return i.commit()}},apply:function(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var n,a,c,l,d,f,p,m,h,g;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if(n=r.plugin.state.data,a=r.params.target&&"all"!==r.params.target?r.params.target:s.StateTransform.RootRef,0===(c=n.select(s.StateSelection.Generators.ofTransformer(o.StateTransforms.Representation.UnwindStructureAssemblyRepresentation3D,a))).length)return[2,{kind:"finished"}];for(l=n.build(),d=(t.current-t.lastApplied)/r.params.durationInMs,f=e.t+d,p=!1,r.params.playOnce&&f>=1?(p=!0,f=1):f%=1,m=0,h=c;m<h.length;m++)g=h[m],l.to(g).update({t:f});return[4,u.PluginCommands.State.Update(r.plugin,{state:n,tree:l,options:{doNotLogTiming:!0}})];case 1:return i.sent(),p?[2,{kind:"finished"}]:[2,{kind:"next",state:{t:f}}]}}))}))}}),f=n.create({name:"built-in.animate-units-explode",display:{name:"Explode Units"},params:function(){return{durationInMs:c.ParamDefinition.Numeric(3e3,{min:100,max:1e4,step:100})}},initialState:function(){return{t:0}},setup:function(e,t){return Object(i.__awaiter)(this,void 0,void 0,(function(){var e,r,n,u,c,l,d;return Object(i.__generator)(this,(function(i){for(e=t.state.data,r=e.select(s.StateSelection.Generators.ofType(a.a.Molecule.Structure.Representation3D)),n=e.build(),u=!1,c=0,l=r;c<l.length;c++)d=l[c],e.select(s.StateSelection.Generators.ofTransformer(o.StateTransforms.Representation.ExplodeStructureRepresentation3D,d.transform.ref)).length>0||(u=!0,n.to(d.transform.ref).apply(o.StateTransforms.Representation.ExplodeStructureRepresentation3D,{t:0},{tags:"animate-units-explode"}));return u?[2,n.commit({doNotUpdateCurrent:!0})]:[2]}))}))},teardown:function(e,t){var r=t.state.data,n=r.select(s.StateSelection.Generators.ofType(a.a.Molecule.Structure.Representation3DState).withTag("animate-units-explode"));if(0!==n.length){for(var i=r.build(),o=0,u=n;o<u.length;o++){var c=u[o];i.delete(c.transform.ref)}return i.commit()}},apply:function(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var n,a,c,l,d,f,p,m;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if(n=r.plugin.state.data,0===(a=n.select(s.StateSelection.Generators.ofTransformer(o.StateTransforms.Representation.ExplodeStructureRepresentation3D))).length)return[2,{kind:"finished"}];for(c=n.build(),l=(t.current-t.lastApplied)/r.params.durationInMs,d=(e.t+l)%1,f=0,p=a;f<p.length;f++)m=p[f],c.to(m).update({t:d});return[4,u.PluginCommands.State.Update(r.plugin,{state:n,tree:c,options:{doNotLogTiming:!0}})];case 1:return i.sent(),[2,{kind:"next",state:{t:d}}]}}))}))}}),p=n.create({name:"built-in.animate-state-interpolation",display:{name:"Animate State Interpolation"},params:function(){return{transtionDurationInMs:c.ParamDefinition.Numeric(2e3,{min:100,max:3e4,step:10})}},canApply:function(e){return{canApply:e.managers.snapshot.state.entries.size>1}},initialState:function(){return{}},apply:function(e,t,r){return Object(i.__awaiter)(this,void 0,void 0,(function(){var e,n,a,o,c,l,d,f,p,m,h,g,v,b,y,_,S,x;return Object(i.__generator)(this,(function(i){switch(i.label){case 0:if((e=r.plugin.managers.snapshot.state.entries).size<2)return[2,{kind:"finished"}];if(n=t.current%r.params.transtionDurationInMs/r.params.transtionDurationInMs,a=Math.floor(t.current/r.params.transtionDurationInMs)%e.size,(o=Math.ceil(t.current/r.params.transtionDurationInMs))===a&&o++,o%=e.size,c=e.get(a).snapshot,l=e.get(o).snapshot,!c.data||!l.data)return[2,{kind:"skip"}];for(d=c.data.tree.transforms,f=l.data.tree.transforms,p=r.plugin.state.data,m=p.build(),h=0,g=d;h<g.length;h++)for(v=g[h],b=0,y=f;b<y.length;b++)(_=y[b]).ref===v.ref&&_.version!==v.version&&(S=s.StateTransform.fromJSON(v),x=s.StateTransform.fromJSON(_),S.transformer.definition.interpolate?m.to(v.ref).update(S.transformer.definition.interpolate(S.params,x.params,n,r.plugin)):m.to(v.ref).update(n<=.5?S.params:x.params));return[4,u.PluginCommands.State.Update(r.plugin,{state:p,tree:m,options:{doNotLogTiming:!0}})];case 1:return i.sent(),[2,{kind:"next",state:{}}]}}))}))}})}]);
!function(t){var e={};function i(s){if(e[s])return e[s].exports;var r=e[s]={i:s,l:!1,exports:{}};return t[s].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(s,r,function(e){return t[e]}.bind(null,r));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";i.r(e);
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
const s="undefined"!=typeof window&&null!=window.customElements&&void 0!==window.customElements.polyfillWrapFlushCallback,r=(t,e,i=null)=>{for(;e!==i;){const i=e.nextSibling;t.removeChild(e),e=i}},n=`{{lit-${String(Math.random()).slice(2)}}}`,o=`\x3c!--${n}--\x3e`,a=new RegExp(`${n}|${o}`);class l{constructor(t,e){this.parts=[],this.element=e;const i=[],s=[],r=document.createTreeWalker(e.content,133,null,!1);let o=0,l=-1,d=0;const{strings:p,values:{length:m}}=t;for(;d<m;){const t=r.nextNode();if(null!==t){if(l++,1===t.nodeType){if(t.hasAttributes()){const e=t.attributes,{length:i}=e;let s=0;for(let t=0;t<i;t++)h(e[t].name,"$lit$")&&s++;for(;s-- >0;){const e=p[d],i=u.exec(e)[2],s=i.toLowerCase()+"$lit$",r=t.getAttribute(s);t.removeAttribute(s);const n=r.split(a);this.parts.push({type:"attribute",index:l,name:i,strings:n}),d+=n.length-1}}"TEMPLATE"===t.tagName&&(s.push(t),r.currentNode=t.content)}else if(3===t.nodeType){const e=t.data;if(e.indexOf(n)>=0){const s=t.parentNode,r=e.split(a),n=r.length-1;for(let e=0;e<n;e++){let i,n=r[e];if(""===n)i=c();else{const t=u.exec(n);null!==t&&h(t[2],"$lit$")&&(n=n.slice(0,t.index)+t[1]+t[2].slice(0,-"$lit$".length)+t[3]),i=document.createTextNode(n)}s.insertBefore(i,t),this.parts.push({type:"node",index:++l})}""===r[n]?(s.insertBefore(c(),t),i.push(t)):t.data=r[n],d+=n}}else if(8===t.nodeType)if(t.data===n){const e=t.parentNode;null!==t.previousSibling&&l!==o||(l++,e.insertBefore(c(),t)),o=l,this.parts.push({type:"node",index:l}),null===t.nextSibling?t.data="":(i.push(t),l--),d++}else{let e=-1;for(;-1!==(e=t.data.indexOf(n,e+1));)this.parts.push({type:"node",index:-1}),d++}}else r.currentNode=s.pop()}for(const t of i)t.parentNode.removeChild(t)}}const h=(t,e)=>{const i=t.length-e.length;return i>=0&&t.slice(i)===e},d=t=>-1!==t.index,c=()=>document.createComment(""),u=/([ \x09\x0a\x0c\x0d])([^\0-\x1F\x7F-\x9F "'>=/]+)([ \x09\x0a\x0c\x0d]*=[ \x09\x0a\x0c\x0d]*(?:[^ \x09\x0a\x0c\x0d"'`<>=]*|"[^"]*|'[^']*))$/;function p(t,e){const{element:{content:i},parts:s}=t,r=document.createTreeWalker(i,133,null,!1);let n=g(s),o=s[n],a=-1,l=0;const h=[];let d=null;for(;r.nextNode();){a++;const t=r.currentNode;for(t.previousSibling===d&&(d=null),e.has(t)&&(h.push(t),null===d&&(d=t)),null!==d&&l++;void 0!==o&&o.index===a;)o.index=null!==d?-1:o.index-l,n=g(s,n),o=s[n]}h.forEach(t=>t.parentNode.removeChild(t))}const m=t=>{let e=11===t.nodeType?0:1;const i=document.createTreeWalker(t,133,null,!1);for(;i.nextNode();)e++;return e},g=(t,e=-1)=>{for(let i=e+1;i<t.length;i++){const e=t[i];if(d(e))return i}return-1};
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
const y=new WeakMap,f=t=>"function"==typeof t&&y.has(t),_={},b={};
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
class S{constructor(t,e,i){this.__parts=[],this.template=t,this.processor=e,this.options=i}update(t){let e=0;for(const i of this.__parts)void 0!==i&&i.setValue(t[e]),e++;for(const t of this.__parts)void 0!==t&&t.commit()}_clone(){const t=s?this.template.element.content.cloneNode(!0):document.importNode(this.template.element.content,!0),e=[],i=this.template.parts,r=document.createTreeWalker(t,133,null,!1);let n,o=0,a=0,l=r.nextNode();for(;o<i.length;)if(n=i[o],d(n)){for(;a<n.index;)a++,"TEMPLATE"===l.nodeName&&(e.push(l),r.currentNode=l.content),null===(l=r.nextNode())&&(r.currentNode=e.pop(),l=r.nextNode());if("node"===n.type){const t=this.processor.handleTextExpression(this.options);t.insertAfterNode(l.previousSibling),this.__parts.push(t)}else this.__parts.push(...this.processor.handleAttributeExpressions(l,n.name,n.strings,this.options));o++}else this.__parts.push(void 0),o++;return s&&(document.adoptNode(t),customElements.upgrade(t)),t}}
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */const v=window.trustedTypes&&trustedTypes.createPolicy("lit-html",{createHTML:t=>t}),w=` ${n} `;class C{constructor(t,e,i,s){this.strings=t,this.values=e,this.type=i,this.processor=s}getHTML(){const t=this.strings.length-1;let e="",i=!1;for(let s=0;s<t;s++){const t=this.strings[s],r=t.lastIndexOf("\x3c!--");i=(r>-1||i)&&-1===t.indexOf("--\x3e",r+1);const a=u.exec(t);e+=null===a?t+(i?w:o):t.substr(0,a.index)+a[1]+a[2]+"$lit$"+a[3]+n}return e+=this.strings[t],e}getTemplateElement(){const t=document.createElement("template");let e=this.getHTML();return void 0!==v&&(e=v.createHTML(e)),t.innerHTML=e,t}}
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
const P=t=>null===t||!("object"==typeof t||"function"==typeof t),x=t=>Array.isArray(t)||!(!t||!t[Symbol.iterator]);class N{constructor(t,e,i){this.dirty=!0,this.element=t,this.name=e,this.strings=i,this.parts=[];for(let t=0;t<i.length-1;t++)this.parts[t]=this._createPart()}_createPart(){return new A(this)}_getValue(){const t=this.strings,e=t.length-1,i=this.parts;if(1===e&&""===t[0]&&""===t[1]){const t=i[0].value;if("symbol"==typeof t)return String(t);if("string"==typeof t||!x(t))return t}let s="";for(let r=0;r<e;r++){s+=t[r];const e=i[r];if(void 0!==e){const t=e.value;if(P(t)||!x(t))s+="string"==typeof t?t:String(t);else for(const e of t)s+="string"==typeof e?e:String(e)}}return s+=t[e],s}commit(){this.dirty&&(this.dirty=!1,this.element.setAttribute(this.name,this._getValue()))}}class A{constructor(t){this.value=void 0,this.committer=t}setValue(t){t===_||P(t)&&t===this.value||(this.value=t,f(t)||(this.committer.dirty=!0))}commit(){for(;f(this.value);){const t=this.value;this.value=_,t(this)}this.value!==_&&this.committer.commit()}}class T{constructor(t){this.value=void 0,this.__pendingValue=void 0,this.options=t}appendInto(t){this.startNode=t.appendChild(c()),this.endNode=t.appendChild(c())}insertAfterNode(t){this.startNode=t,this.endNode=t.nextSibling}appendIntoPart(t){t.__insert(this.startNode=c()),t.__insert(this.endNode=c())}insertAfterPart(t){t.__insert(this.startNode=c()),this.endNode=t.endNode,t.endNode=this.startNode}setValue(t){this.__pendingValue=t}commit(){if(null===this.startNode.parentNode)return;for(;f(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=_,t(this)}const t=this.__pendingValue;t!==_&&(P(t)?t!==this.value&&this.__commitText(t):t instanceof C?this.__commitTemplateResult(t):t instanceof Node?this.__commitNode(t):x(t)?this.__commitIterable(t):t===b?(this.value=b,this.clear()):this.__commitText(t))}__insert(t){this.endNode.parentNode.insertBefore(t,this.endNode)}__commitNode(t){this.value!==t&&(this.clear(),this.__insert(t),this.value=t)}__commitText(t){const e=this.startNode.nextSibling,i="string"==typeof(t=null==t?"":t)?t:String(t);e===this.endNode.previousSibling&&3===e.nodeType?e.data=i:this.__commitNode(document.createTextNode(i)),this.value=t}__commitTemplateResult(t){const e=this.options.templateFactory(t);if(this.value instanceof S&&this.value.template===e)this.value.update(t.values);else{const i=new S(e,t.processor,this.options),s=i._clone();i.update(t.values),this.__commitNode(s),this.value=i}}__commitIterable(t){Array.isArray(this.value)||(this.value=[],this.clear());const e=this.value;let i,s=0;for(const r of t)i=e[s],void 0===i&&(i=new T(this.options),e.push(i),0===s?i.appendIntoPart(this):i.insertAfterPart(e[s-1])),i.setValue(r),i.commit(),s++;s<e.length&&(e.length=s,this.clear(i&&i.endNode))}clear(t=this.startNode){r(this.startNode.parentNode,t.nextSibling,this.endNode)}}class E{constructor(t,e,i){if(this.value=void 0,this.__pendingValue=void 0,2!==i.length||""!==i[0]||""!==i[1])throw new Error("Boolean attributes can only contain a single expression");this.element=t,this.name=e,this.strings=i}setValue(t){this.__pendingValue=t}commit(){for(;f(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=_,t(this)}if(this.__pendingValue===_)return;const t=!!this.__pendingValue;this.value!==t&&(t?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name),this.value=t),this.__pendingValue=_}}class O extends N{constructor(t,e,i){super(t,e,i),this.single=2===i.length&&""===i[0]&&""===i[1]}_createPart(){return new B(this)}_getValue(){return this.single?this.parts[0].value:super._getValue()}commit(){this.dirty&&(this.dirty=!1,this.element[this.name]=this._getValue())}}class B extends A{}let R=!1;(()=>{try{const t={get capture(){return R=!0,!1}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){}})();class V{constructor(t,e,i){this.value=void 0,this.__pendingValue=void 0,this.element=t,this.eventName=e,this.eventContext=i,this.__boundHandleEvent=t=>this.handleEvent(t)}setValue(t){this.__pendingValue=t}commit(){for(;f(this.__pendingValue);){const t=this.__pendingValue;this.__pendingValue=_,t(this)}if(this.__pendingValue===_)return;const t=this.__pendingValue,e=this.value,i=null==t||null!=e&&(t.capture!==e.capture||t.once!==e.once||t.passive!==e.passive),s=null!=t&&(null==e||i);i&&this.element.removeEventListener(this.eventName,this.__boundHandleEvent,this.__options),s&&(this.__options=U(t),this.element.addEventListener(this.eventName,this.__boundHandleEvent,this.__options)),this.value=t,this.__pendingValue=_}handleEvent(t){"function"==typeof this.value?this.value.call(this.eventContext||this.element,t):this.value.handleEvent(t)}}const U=t=>t&&(R?{capture:t.capture,passive:t.passive,once:t.once}:t.capture)
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */;function I(t){let e=M.get(t.type);void 0===e&&(e={stringsArray:new WeakMap,keyString:new Map},M.set(t.type,e));let i=e.stringsArray.get(t.strings);if(void 0!==i)return i;const s=t.strings.join(n);return i=e.keyString.get(s),void 0===i&&(i=new l(t,t.getTemplateElement()),e.keyString.set(s,i)),e.stringsArray.set(t.strings,i),i}const M=new Map,k=new WeakMap;
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */new
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
class{handleAttributeExpressions(t,e,i,s){const r=e[0];if("."===r){return new O(t,e.slice(1),i).parts}if("@"===r)return[new V(t,e.slice(1),s.eventContext)];if("?"===r)return[new E(t,e.slice(1),i)];return new N(t,e,i).parts}handleTextExpression(t){return new T(t)}};
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */"undefined"!=typeof window&&(window.litHtmlVersions||(window.litHtmlVersions=[])).push("1.4.1");const j=(t,e)=>`${t}--${e}`;let q=!0;void 0===window.ShadyCSS?q=!1:void 0===window.ShadyCSS.prepareTemplateDom&&(console.warn("Incompatible ShadyCSS version detected. Please update to at least @webcomponents/webcomponentsjs@2.0.2 and @webcomponents/shadycss@1.3.1."),q=!1);const D=t=>e=>{const i=j(e.type,t);let s=M.get(i);void 0===s&&(s={stringsArray:new WeakMap,keyString:new Map},M.set(i,s));let r=s.stringsArray.get(e.strings);if(void 0!==r)return r;const o=e.strings.join(n);if(r=s.keyString.get(o),void 0===r){const i=e.getTemplateElement();q&&window.ShadyCSS.prepareTemplateDom(i,t),r=new l(e,i),s.keyString.set(o,r)}return s.stringsArray.set(e.strings,r),r},H=["html","svg"],F=new Set,L=(t,e,i)=>{F.add(t);const s=i?i.element:document.createElement("template"),r=e.querySelectorAll("style"),{length:n}=r;if(0===n)return void window.ShadyCSS.prepareTemplateStyles(s,t);const o=document.createElement("style");for(let t=0;t<n;t++){const e=r[t];e.parentNode.removeChild(e),o.textContent+=e.textContent}(t=>{H.forEach(e=>{const i=M.get(j(e,t));void 0!==i&&i.keyString.forEach(t=>{const{element:{content:e}}=t,i=new Set;Array.from(e.querySelectorAll("style")).forEach(t=>{i.add(t)}),p(t,i)})})})(t);const a=s.content;i?function(t,e,i=null){const{element:{content:s},parts:r}=t;if(null==i)return void s.appendChild(e);const n=document.createTreeWalker(s,133,null,!1);let o=g(r),a=0,l=-1;for(;n.nextNode();){l++;for(n.currentNode===i&&(a=m(e),i.parentNode.insertBefore(e,i));-1!==o&&r[o].index===l;){if(a>0){for(;-1!==o;)r[o].index+=a,o=g(r,o);return}o=g(r,o)}}}(i,o,a.firstChild):a.insertBefore(o,a.firstChild),window.ShadyCSS.prepareTemplateStyles(s,t);const l=a.querySelector("style");if(window.ShadyCSS.nativeShadow&&null!==l)e.insertBefore(l.cloneNode(!0),e.firstChild);else if(i){a.insertBefore(o,a.firstChild);const t=new Set;t.add(o),p(i,t)}};window.JSCompiler_renameProperty=(t,e)=>t;const $={toAttribute(t,e){switch(e){case Boolean:return t?"":null;case Object:case Array:return null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){switch(e){case Boolean:return null!==t;case Number:return null===t?null:Number(t);case Object:case Array:return JSON.parse(t)}return t}},G=(t,e)=>e!==t&&(e==e||t==t),W={attribute:!0,type:String,converter:$,reflect:!1,hasChanged:G};class z extends HTMLElement{constructor(){super(),this.initialize()}static get observedAttributes(){this.finalize();const t=[];return this._classProperties.forEach((e,i)=>{const s=this._attributeNameForProperty(i,e);void 0!==s&&(this._attributeToPropertyMap.set(s,i),t.push(s))}),t}static _ensureClassProperties(){if(!this.hasOwnProperty(JSCompiler_renameProperty("_classProperties",this))){this._classProperties=new Map;const t=Object.getPrototypeOf(this)._classProperties;void 0!==t&&t.forEach((t,e)=>this._classProperties.set(e,t))}}static createProperty(t,e=W){if(this._ensureClassProperties(),this._classProperties.set(t,e),e.noAccessor||this.prototype.hasOwnProperty(t))return;const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const r=this[t];this[e]=s,this.requestUpdateInternal(t,r,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this._classProperties&&this._classProperties.get(t)||W}static finalize(){const t=Object.getPrototypeOf(this);if(t.hasOwnProperty("finalized")||t.finalize(),this.finalized=!0,this._ensureClassProperties(),this._attributeToPropertyMap=new Map,this.hasOwnProperty(JSCompiler_renameProperty("properties",this))){const t=this.properties,e=[...Object.getOwnPropertyNames(t),..."function"==typeof Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t):[]];for(const i of e)this.createProperty(i,t[i])}}static _attributeNameForProperty(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}static _valueHasChanged(t,e,i=G){return i(t,e)}static _propertyValueFromAttribute(t,e){const i=e.type,s=e.converter||$,r="function"==typeof s?s:s.fromAttribute;return r?r(t,i):t}static _propertyValueToAttribute(t,e){if(void 0===e.reflect)return;const i=e.type,s=e.converter;return(s&&s.toAttribute||$.toAttribute)(t,i)}initialize(){this._updateState=0,this._updatePromise=new Promise(t=>this._enableUpdatingResolver=t),this._changedProperties=new Map,this._saveInstanceProperties(),this.requestUpdateInternal()}_saveInstanceProperties(){this.constructor._classProperties.forEach((t,e)=>{if(this.hasOwnProperty(e)){const t=this[e];delete this[e],this._instanceProperties||(this._instanceProperties=new Map),this._instanceProperties.set(e,t)}})}_applyInstanceProperties(){this._instanceProperties.forEach((t,e)=>this[e]=t),this._instanceProperties=void 0}connectedCallback(){this.enableUpdating()}enableUpdating(){void 0!==this._enableUpdatingResolver&&(this._enableUpdatingResolver(),this._enableUpdatingResolver=void 0)}disconnectedCallback(){}attributeChangedCallback(t,e,i){e!==i&&this._attributeToProperty(t,i)}_propertyToAttribute(t,e,i=W){const s=this.constructor,r=s._attributeNameForProperty(t,i);if(void 0!==r){const t=s._propertyValueToAttribute(e,i);if(void 0===t)return;this._updateState=8|this._updateState,null==t?this.removeAttribute(r):this.setAttribute(r,t),this._updateState=-9&this._updateState}}_attributeToProperty(t,e){if(8&this._updateState)return;const i=this.constructor,s=i._attributeToPropertyMap.get(t);if(void 0!==s){const t=i.getPropertyOptions(s);this._updateState=16|this._updateState,this[s]=i._propertyValueFromAttribute(e,t),this._updateState=-17&this._updateState}}requestUpdateInternal(t,e,i){let s=!0;if(void 0!==t){const r=this.constructor;i=i||r.getPropertyOptions(t),r._valueHasChanged(this[t],e,i.hasChanged)?(this._changedProperties.has(t)||this._changedProperties.set(t,e),!0!==i.reflect||16&this._updateState||(void 0===this._reflectingProperties&&(this._reflectingProperties=new Map),this._reflectingProperties.set(t,i))):s=!1}!this._hasRequestedUpdate&&s&&(this._updatePromise=this._enqueueUpdate())}requestUpdate(t,e){return this.requestUpdateInternal(t,e),this.updateComplete}async _enqueueUpdate(){this._updateState=4|this._updateState;try{await this._updatePromise}catch(t){}const t=this.performUpdate();return null!=t&&await t,!this._hasRequestedUpdate}get _hasRequestedUpdate(){return 4&this._updateState}get hasUpdated(){return 1&this._updateState}performUpdate(){if(!this._hasRequestedUpdate)return;this._instanceProperties&&this._applyInstanceProperties();let t=!1;const e=this._changedProperties;try{t=this.shouldUpdate(e),t?this.update(e):this._markUpdated()}catch(e){throw t=!1,this._markUpdated(),e}t&&(1&this._updateState||(this._updateState=1|this._updateState,this.firstUpdated(e)),this.updated(e))}_markUpdated(){this._changedProperties=new Map,this._updateState=-5&this._updateState}get updateComplete(){return this._getUpdateComplete()}_getUpdateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._updatePromise}shouldUpdate(t){return!0}update(t){void 0!==this._reflectingProperties&&this._reflectingProperties.size>0&&(this._reflectingProperties.forEach((t,e)=>this._propertyToAttribute(e,this[e],t)),this._reflectingProperties=void 0),this._markUpdated()}updated(t){}firstUpdated(t){}}z.finalized=!0;const J=Element.prototype;J.msMatchesSelector||J.webkitMatchesSelector;
/**
@license
Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
part of the polymer project is also subject to an additional IP rights grant
found at http://polymer.github.io/PATENTS.txt
*/
const K=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Q=Symbol();class X{constructor(t,e){if(e!==Q)throw new Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){return void 0===this._styleSheet&&(K?(this._styleSheet=new CSSStyleSheet,this._styleSheet.replaceSync(this.cssText)):this._styleSheet=null),this._styleSheet}toString(){return this.cssText}}
/**
 * @license
 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at
 * http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at
 * http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at
 * http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at
 * http://polymer.github.io/PATENTS.txt
 */
(window.litElementVersions||(window.litElementVersions=[])).push("2.5.1");const Y={};class Z extends z{static getStyles(){return this.styles}static _getUniqueStyles(){if(this.hasOwnProperty(JSCompiler_renameProperty("_styles",this)))return;const t=this.getStyles();if(Array.isArray(t)){const e=(t,i)=>t.reduceRight((t,i)=>Array.isArray(i)?e(i,t):(t.add(i),t),i),i=e(t,new Set),s=[];i.forEach(t=>s.unshift(t)),this._styles=s}else this._styles=void 0===t?[]:[t];this._styles=this._styles.map(t=>{if(t instanceof CSSStyleSheet&&!K){const e=Array.prototype.slice.call(t.cssRules).reduce((t,e)=>t+e.cssText,"");return new X(String(e),Q)}return t})}initialize(){super.initialize(),this.constructor._getUniqueStyles(),this.renderRoot=this.createRenderRoot(),window.ShadowRoot&&this.renderRoot instanceof window.ShadowRoot&&this.adoptStyles()}createRenderRoot(){return this.attachShadow(this.constructor.shadowRootOptions)}adoptStyles(){const t=this.constructor._styles;0!==t.length&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow?K?this.renderRoot.adoptedStyleSheets=t.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):this._needsShimAdoptedStyleSheets=!0:window.ShadyCSS.ScopingShim.prepareAdoptedCssText(t.map(t=>t.cssText),this.localName))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&void 0!==window.ShadyCSS&&window.ShadyCSS.styleElement(this)}update(t){const e=this.render();super.update(t),e!==Y&&this.constructor.render(e,this.renderRoot,{scopeName:this.localName,eventContext:this}),this._needsShimAdoptedStyleSheets&&(this._needsShimAdoptedStyleSheets=!1,this.constructor._styles.forEach(t=>{const e=document.createElement("style");e.textContent=t.cssText,this.renderRoot.appendChild(e)}))}render(){return Y}}Z.finalized=!0,Z.render=(t,e,i)=>{if(!i||"object"!=typeof i||!i.scopeName)throw new Error("The `scopeName` option is required.");const s=i.scopeName,n=k.has(e),o=q&&11===e.nodeType&&!!e.host,a=o&&!F.has(s),l=a?document.createDocumentFragment():e;if(((t,e,i)=>{let s=k.get(e);void 0===s&&(r(e,e.firstChild),k.set(e,s=new T(Object.assign({templateFactory:I},i))),s.appendInto(e)),s.setValue(t),s.commit()})(t,l,Object.assign({templateFactory:D(s)},i)),a){const t=k.get(l);k.delete(l);const i=t.value instanceof S?t.value.template:void 0;L(s,l,i),r(e,e.firstChild),e.appendChild(l),k.set(e,t)}!n&&o&&window.ShadyCSS.styleElement(e.host)},Z.shadowRootOptions={mode:"open"};class tt extends Z{static get properties(){return{moleculeId:{type:String,attribute:"molecule-id"},assemblyId:{type:String,attribute:"assembly-id"},customDataUrl:{type:String,attribute:"custom-data-url"},customDataFormat:{type:String,attribute:"custom-data-format"},customDataBinary:{type:Boolean,attribute:"custom-data-binary"},ligandLabelCompId:{type:String,attribute:"ligand-label-comp-id"},ligandAuthAsymId:{type:String,attribute:"ligand-auth-asym-Id"},ligandAuthSeqId:{type:String,attribute:"ligand-auth-seq-id"},ligandHydrogens:{type:Boolean,attribute:"ligand-hydrogens"},pdbeUrl:{type:String,attribute:"pdbe-url"},bgColorR:{type:Number,attribute:"bg-color-r"},bgColorG:{type:Number,attribute:"bg-color-g"},bgColorB:{type:Number,attribute:"bg-color-b"},loadMaps:{type:Boolean,attribute:"load-maps"},validationAnnotation:{type:Boolean,attribute:"validation-annotation"},domainAnnotation:{type:Boolean,attribute:"domain-annotation"},lowPrecisionCoords:{type:Boolean,attribute:"low-precision"},expanded:{type:Boolean,attribute:"expanded"},hideControls:{type:Boolean,attribute:"hide-controls"},subscribeEvents:{type:Boolean,attribute:"subscribe-events"},pdbeLink:{type:Boolean,attribute:"pdbe-link"},loadCartoonsOnly:{type:Boolean,attribute:"load-cartoons-only"},selectInteraction:{type:Boolean,attribute:"select-interaction"},landscape:{type:Boolean,attribute:"landscape"},highlightColorR:{type:Number,attribute:"highlight-color-r"},highlightColorG:{type:Number,attribute:"highlight-color-g"},highlightColorB:{type:Number,attribute:"highlight-color-b"},selectColorR:{type:Number,attribute:"select-color-r"},selectColorG:{type:Number,attribute:"select-color-g"},selectColorB:{type:Number,attribute:"select-color-b"},hidePolymer:{type:Boolean,attribute:"hide-polymer"},hideWater:{type:Boolean,attribute:"hide-water"},hideHet:{type:Boolean,attribute:"hide-het"},hideCarbs:{type:Boolean,attribute:"hide-carbs"},hideNonStandard:{type:Boolean,attribute:"hide-non-standard"},hideCoarse:{type:Boolean,attribute:"hide-coarse"},visualStyle:{type:String,attribute:"visual-style"},hideExpandIcon:{type:Boolean,attribute:"hide-expand-icon"},hideSelectionIcon:{type:Boolean,attribute:"hide-selection-icon"},hideAnimationIcon:{type:Boolean,attribute:"hide-animation-icon"}}}validateParams(){return!(!this.moleculeId&&!this.customDataUrl)&&!(this.customDataUrl&&!this.customDataFormat)}formatParam(t){const e={ligandLabelCompId:"label_comp_id",ligandAuthAsymId:"auth_asym_id",ligandAuthSeqId:"auth_seq_id",ligandHydrogens:"hydrogens"},i=Object.keys(e),s={hidePolymer:"polymer",hideWater:"water",hideHet:"het",hideCarbs:"carbs",hideNonStandard:"nonStandard",hideCoarse:"coarse"},r=Object.keys(s),n={hideExpandIcon:"expand",hideSelectionIcon:"selection",hideAnimationIcon:"animation"},o=Object.keys(n);if("customDataUrl"==t||"customDataFormat"==t){if(this.initParams.customData)return;this.initParams.customData={url:this.customDataUrl,format:this.customDataFormat}}else if(i.indexOf(t)>-1){if(this.initParams.ligandView)return;this.initParams.ligandView=Object.assign({},{}),i.forEach(t=>{this[t]&&(this.initParams.ligandView[e[t]]=this[t])})}else if(["highlightColorR","highlightColorG","highlightColorB"].indexOf(t)>-1&&this.highlightColorR&&this.highlightColorG&&this.highlightColorB)this.initParams.highlightColor={r:this.highlightColorR,g:this.highlightColorG,b:this.highlightColorB};else if(["selectColorR","selectColorG","selectColorB"].indexOf(t)>-1&&this.selectColorR&&this.selectColorG&&this.selectColorB)this.initParams.selectColor={r:this.selectColorR,g:this.selectColorG,b:this.selectColorB};else if(["bgColorR","bgColorG","bgColorB"].indexOf(t)>-1&&this.bgColorR&&this.bgColorG&&this.bgColorB)this.initParams.bgColor={r:this.bgColorR,g:this.bgColorG,b:this.bgColorB};else if(r.indexOf(t)>-1){if(this.initParams.hideStructure)return;this.initParams.hideStructure=[],r.forEach(t=>{this[t]&&this.initParams.hideStructure.push(s[t])})}else if(o.indexOf(t)>-1){if(this.initParams.hideCanvasControls)return;this.initParams.hideCanvasControls=[],o.forEach(t=>{this[t]&&this.initParams.hideCanvasControls.push(n[t])})}}createParamModel(){const t=["customDataUrl","customDataFormat","ligandLabelCompId","bgColorR","bgColorG","bgColorB","ligandAuthAsymId","ligandAuthSeqId","ligandHydrogens","highlightColorR","highlightColorG","highlightColorB","selectColorR","selectColorG","selectColorB","hidePolymer","hideWater","hideHet","hideCarbs","hideNonStandard","hideCoarse","hideExpandIcon","hideSelectionIcon","hideAnimationIcon"],e=this.constructor.properties;if(e)for(let i in e)this[i]&&(this.initParams||(this.initParams=Object.assign({},{})),-1==t.indexOf(i)?this.initParams[i]=this[i]:this.formatParam(i))}connectedCallback(){super.connectedCallback(),this.createParamModel(),this.viewerInstance=new PDBeMolstarPlugin,this.validateParams()&&this.initParams&&this.viewerInstance.render(this,this.initParams)}createRenderRoot(){return this}}e.default=tt;customElements.define("pdbe-molstar",tt)}]);
//# sourceMappingURL=pdbe-molstar-component-build-1.1.1.js.map