/*

 Copyright 2016 Google Inc.
 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.

 Copyright 2017 Google Inc.
 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.
 JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(n,f,c){n!=Array.prototype&&n!=Object.prototype&&(n[f]=c.value)};$jscomp.getGlobal=function(n){return"undefined"!=typeof window&&window===n?n:"undefined"!=typeof global&&null!=global?global:n};$jscomp.global=$jscomp.getGlobal(this);$jscomp.SYMBOL_PREFIX="jscomp_symbol_";
$jscomp.initSymbol=function(){$jscomp.initSymbol=function(){};$jscomp.global.Symbol||($jscomp.global.Symbol=$jscomp.Symbol)};$jscomp.symbolCounter_=0;$jscomp.Symbol=function(n){return $jscomp.SYMBOL_PREFIX+(n||"")+$jscomp.symbolCounter_++};
$jscomp.initSymbolIterator=function(){$jscomp.initSymbol();var n=$jscomp.global.Symbol.iterator;n||(n=$jscomp.global.Symbol.iterator=$jscomp.global.Symbol("iterator"));"function"!=typeof Array.prototype[n]&&$jscomp.defineProperty(Array.prototype,n,{configurable:!0,writable:!0,value:function(){return $jscomp.arrayIterator(this)}});$jscomp.initSymbolIterator=function(){}};$jscomp.arrayIterator=function(n){var f=0;return $jscomp.iteratorPrototype(function(){return f<n.length?{done:!1,value:n[f++]}:{done:!0}})};
$jscomp.iteratorPrototype=function(n){$jscomp.initSymbolIterator();n={next:n};n[$jscomp.global.Symbol.iterator]=function(){return this};return n};$jscomp.makeIterator=function(n){$jscomp.initSymbolIterator();$jscomp.initSymbol();$jscomp.initSymbolIterator();var f=n[Symbol.iterator];return f?f.call(n):$jscomp.arrayIterator(n)};$jscomp.arrayFromIterator=function(n){for(var f,c=[];!(f=n.next()).done;)c.push(f.value);return c};$jscomp.arrayFromIterable=function(n){return n instanceof Array?n:$jscomp.arrayFromIterator($jscomp.makeIterator(n))};
$jscomp.polyfill=function(n,f,c,p){if(f){c=$jscomp.global;n=n.split(".");for(p=0;p<n.length-1;p++){var k=n[p];k in c||(c[k]={});c=c[k]}n=n[n.length-1];p=c[n];f=f(p);f!=p&&null!=f&&$jscomp.defineProperty(c,n,{configurable:!0,writable:!0,value:f})}};$jscomp.polyfill("Number.isNaN",function(n){return n?n:function(f){return"number"===typeof f&&isNaN(f)}},"es6","es3");
$jscomp.polyfill("Number.isFinite",function(n){return n?n:function(f){return"number"!==typeof f?!1:!isNaN(f)&&Infinity!==f&&-Infinity!==f}},"es6","es3");$jscomp.iteratorFromArray=function(n,f){$jscomp.initSymbolIterator();n instanceof String&&(n+="");var c=0,p={next:function(){if(c<n.length){var k=c++;return{value:f(k,n[k]),done:!1}}p.next=function(){return{done:!0,value:void 0}};return p.next()}};p[Symbol.iterator]=function(){return p};return p};
$jscomp.polyfill("Array.prototype.keys",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(f){return f})}},"es6","es3");$jscomp.polyfill("Number.isInteger",function(n){return n?n:function(f){return Number.isFinite(f)?f===Math.floor(f):!1}},"es6","es3");
$jscomp.polyfill("Array.from",function(n){return n?n:function(f,c,p){$jscomp.initSymbolIterator();c=null!=c?c:function(a){return a};var k=[],q=f[Symbol.iterator];if("function"==typeof q)for(f=q.call(f);!(q=f.next()).done;)k.push(c.call(p,q.value));else{q=f.length;for(var a=0;a<q;a++)k.push(c.call(p,f[a]))}return k}},"es6","es3");$jscomp.owns=function(n,f){return Object.prototype.hasOwnProperty.call(n,f)};
$jscomp.polyfill("WeakMap",function(n){function f(a){$jscomp.owns(a,p)||$jscomp.defineProperty(a,p,{value:{}})}function c(a){var b=Object[a];b&&(Object[a]=function(a){f(a);return b(a)})}if(function(){if(!n||!Object.seal)return!1;try{var a=Object.seal({}),b=Object.seal({}),c=new n([[a,2],[b,3]]);if(2!=c.get(a)||3!=c.get(b))return!1;c.delete(a);c.set(b,4);return!c.has(a)&&4==c.get(b)}catch(u){return!1}}())return n;var p="$jscomp_hidden_"+Math.random().toString().substring(2);c("freeze");c("preventExtensions");
c("seal");var k=0,q=function(a){this.id_=(k+=Math.random()+1).toString();if(a){$jscomp.initSymbol();$jscomp.initSymbolIterator();a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};q.prototype.set=function(a,b){f(a);if(!$jscomp.owns(a,p))throw Error("WeakMap key fail: "+a);a[p][this.id_]=b;return this};q.prototype.get=function(a){return $jscomp.owns(a,p)?a[p][this.id_]:void 0};q.prototype.has=function(a){return $jscomp.owns(a,p)&&$jscomp.owns(a[p],this.id_)};q.prototype.delete=
function(a){return $jscomp.owns(a,p)&&$jscomp.owns(a[p],this.id_)?delete a[p][this.id_]:!1};return q},"es6","es3");$jscomp.MapEntry=function(){};
$jscomp.polyfill("Map",function(n){if(!$jscomp.ASSUME_NO_NATIVE_MAP&&function(){if(!n||!n.prototype.entries||"function"!=typeof Object.seal)return!1;try{var a=Object.seal({x:4}),c=new n($jscomp.makeIterator([[a,"s"]]));if("s"!=c.get(a)||1!=c.size||c.get({x:4})||c.set({x:4},"t")!=c||2!=c.size)return!1;var u=c.entries(),v=u.next();if(v.done||v.value[0]!=a||"s"!=v.value[1])return!1;v=u.next();return v.done||4!=v.value[0].x||"t"!=v.value[1]||!u.next().done?!1:!0}catch(t){return!1}}())return n;$jscomp.initSymbol();
$jscomp.initSymbolIterator();var f=new WeakMap,c=function(a){this.data_={};this.head_=q();this.size=0;if(a){a=$jscomp.makeIterator(a);for(var b;!(b=a.next()).done;)b=b.value,this.set(b[0],b[1])}};c.prototype.set=function(a,c){var b=p(this,a);b.list||(b.list=this.data_[b.id]=[]);b.entry?b.entry.value=c:(b.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:c},b.list.push(b.entry),this.head_.previous.next=b.entry,this.head_.previous=b.entry,this.size++);return this};c.prototype.delete=
function(a){a=p(this,a);return a.entry&&a.list?(a.list.splice(a.index,1),a.list.length||delete this.data_[a.id],a.entry.previous.next=a.entry.next,a.entry.next.previous=a.entry.previous,a.entry.head=null,this.size--,!0):!1};c.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=q();this.size=0};c.prototype.has=function(a){return!!p(this,a).entry};c.prototype.get=function(a){return(a=p(this,a).entry)&&a.value};c.prototype.entries=function(){return k(this,function(a){return[a.key,
a.value]})};c.prototype.keys=function(){return k(this,function(a){return a.key})};c.prototype.values=function(){return k(this,function(a){return a.value})};c.prototype.forEach=function(a,c){for(var b=this.entries(),m;!(m=b.next()).done;)m=m.value,a.call(c,m[1],m[0],this)};c.prototype[Symbol.iterator]=c.prototype.entries;var p=function(b,c){var m=c&&typeof c;"object"==m||"function"==m?f.has(c)?m=f.get(c):(m=""+ ++a,f.set(c,m)):m="p_"+c;var v=b.data_[m];if(v&&$jscomp.owns(b.data_,m))for(b=0;b<v.length;b++){var t=
v[b];if(c!==c&&t.key!==t.key||c===t.key)return{id:m,list:v,index:b,entry:t}}return{id:m,list:v,index:-1,entry:void 0}},k=function(a,c){var b=a.head_;return $jscomp.iteratorPrototype(function(){if(b){for(;b.head!=a.head_;)b=b.previous;for(;b.next!=b.head;)return b=b.next,{done:!1,value:c(b)};b=null}return{done:!0,value:void 0}})},q=function(){var a={};return a.previous=a.next=a.head=a},a=0;return c},"es6","es3");
$jscomp.checkStringArgs=function(n,f,c){if(null==n)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(f instanceof RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return n+""};
$jscomp.polyfill("String.prototype.startsWith",function(n){return n?n:function(f,c){var p=$jscomp.checkStringArgs(this,f,"startsWith");f+="";var k=p.length,q=f.length;c=Math.max(0,Math.min(c|0,p.length));for(var a=0;a<q&&c<k;)if(p[c++]!=f[a++])return!1;return a>=q}},"es6","es3");
$jscomp.polyfill("Set",function(n){if(!$jscomp.ASSUME_NO_NATIVE_SET&&function(){if(!n||!n.prototype.entries||"function"!=typeof Object.seal)return!1;try{var c=Object.seal({x:4}),f=new n($jscomp.makeIterator([c]));if(!f.has(c)||1!=f.size||f.add(c)!=f||1!=f.size||f.add({x:4})!=f||2!=f.size)return!1;var k=f.entries(),q=k.next();if(q.done||q.value[0]!=c||q.value[1]!=c)return!1;q=k.next();return q.done||q.value[0]==c||4!=q.value[0].x||q.value[1]!=q.value[0]?!1:k.next().done}catch(a){return!1}}())return n;
$jscomp.initSymbol();$jscomp.initSymbolIterator();var f=function(c){this.map_=new Map;if(c){c=$jscomp.makeIterator(c);for(var f;!(f=c.next()).done;)this.add(f.value)}this.size=this.map_.size};f.prototype.add=function(c){this.map_.set(c,c);this.size=this.map_.size;return this};f.prototype.delete=function(c){c=this.map_.delete(c);this.size=this.map_.size;return c};f.prototype.clear=function(){this.map_.clear();this.size=0};f.prototype.has=function(c){return this.map_.has(c)};f.prototype.entries=function(){return this.map_.entries()};
f.prototype.values=function(){return this.map_.values()};f.prototype.keys=f.prototype.values;f.prototype[Symbol.iterator]=f.prototype.values;f.prototype.forEach=function(c,f){var k=this;this.map_.forEach(function(q){return c.call(f,q,q,k)})};return f},"es6","es3");$jscomp.polyfill("Object.assign",function(n){return n?n:function(f,c){for(var p=1;p<arguments.length;p++){var k=arguments[p];if(k)for(var q in k)$jscomp.owns(k,q)&&(f[q]=k[q])}return f}},"es6","es3");$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(n){function f(){this.batch_=null}function c(a){return a instanceof k?a:new k(function(b,c){b(a)})}if(n&&!$jscomp.FORCE_POLYFILL_PROMISE)return n;f.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};f.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var p=$jscomp.global.setTimeout;f.prototype.asyncExecuteFunction=function(a){p(a,
0)};f.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var c=a[b];delete a[b];try{c()}catch(u){this.asyncThrow_(u)}}}this.batch_=null};f.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var k=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(m){b.reject(m)}};k.prototype.createResolveAndReject_=
function(){function a(a){return function(m){c||(c=!0,a.call(b,m))}}var b=this,c=!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};k.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof k)this.settleSameAsPromise_(a);else{a:switch(typeof a){case "object":var b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};k.prototype.resolveToNonPromiseObj_=function(a){var b=
void 0;try{b=a.then}catch(m){this.reject_(m);return}"function"==typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};k.prototype.reject_=function(a){this.settle_(2,a)};k.prototype.fulfill_=function(a){this.settle_(1,a)};k.prototype.settle_=function(a,b){if(0!=this.state_)throw Error("Cannot settle("+a+", "+b|"): Promise already settled in state"+this.state_);this.state_=a;this.result_=b;this.executeOnSettledCallbacks_()};k.prototype.executeOnSettledCallbacks_=function(){if(null!=this.onSettledCallbacks_){for(var a=
this.onSettledCallbacks_,b=0;b<a.length;++b)a[b].call(),a[b]=null;this.onSettledCallbacks_=null}};var q=new f;k.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};k.prototype.settleSameAsThenable_=function(a,b){var c=this.createResolveAndReject_();try{a.call(b,c.resolve,c.reject)}catch(u){c.reject(u)}};k.prototype.then=function(a,b){function c(a,b){return"function"==typeof a?function(e){try{u(a(e))}catch(d){v(d)}}:b}var u,v,t=new k(function(a,
b){u=a;v=b});this.callWhenSettled_(c(a,u),c(b,v));return t};k.prototype.catch=function(a){return this.then(void 0,a)};k.prototype.callWhenSettled_=function(a,b){function c(){switch(u.state_){case 1:a(u.result_);break;case 2:b(u.result_);break;default:throw Error("Unexpected state: "+u.state_);}}var u=this;null==this.onSettledCallbacks_?q.asyncExecute(c):this.onSettledCallbacks_.push(function(){q.asyncExecute(c)})};k.resolve=c;k.reject=function(a){return new k(function(b,c){c(a)})};k.race=function(a){return new k(function(b,
m){for(var u=$jscomp.makeIterator(a),v=u.next();!v.done;v=u.next())c(v.value).callWhenSettled_(b,m)})};k.all=function(a){var b=$jscomp.makeIterator(a),m=b.next();return m.done?c([]):new k(function(a,v){function t(e){return function(d){l[e]=d;g--;0==g&&a(l)}}var l=[],g=0;do l.push(void 0),g++,c(m.value).callWhenSettled_(t(l.length-1),v),m=b.next();while(!m.done)})};return k},"es6","es3");$jscomp.polyfill("Math.log2",function(n){return n?n:function(f){return Math.log(f)/Math.LN2}},"es6","es3");
$jscomp.polyfill("String.prototype.repeat",function(n){return n?n:function(f){var c=$jscomp.checkStringArgs(this,null,"repeat");if(0>f||1342177279<f)throw new RangeError("Invalid count value");f|=0;for(var p="";f;)if(f&1&&(p+=c),f>>>=1)c+=c;return p}},"es6","es3");
$jscomp.polyfill("WeakSet",function(n){if(function(){if(!n||!Object.seal)return!1;try{var c=Object.seal({}),f=Object.seal({}),k=new n([c]);if(!k.has(c)||k.has(f))return!1;k.delete(c);k.add(f);return!k.has(c)&&k.has(f)}catch(q){return!1}}())return n;var f=function(c){this.map_=new WeakMap;if(c){$jscomp.initSymbol();$jscomp.initSymbolIterator();c=$jscomp.makeIterator(c);for(var f;!(f=c.next()).done;)this.add(f.value)}};f.prototype.add=function(c){this.map_.set(c,!0);return this};f.prototype.has=function(c){return this.map_.has(c)};
f.prototype.delete=function(c){return this.map_.delete(c)};return f},"es6","es3");$jscomp.findInternal=function(n,f,c){n instanceof String&&(n=String(n));for(var p=n.length,k=0;k<p;k++){var q=n[k];if(f.call(c,q,k,n))return{i:k,v:q}}return{i:-1,v:void 0}};$jscomp.polyfill("Array.prototype.find",function(n){return n?n:function(f,c){return $jscomp.findInternal(this,f,c).v}},"es6","es3");
$jscomp.polyfill("Array.prototype.values",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(f,c){return c})}},"es6","es3");$jscomp.polyfill("Math.sign",function(n){return n?n:function(f){f=Number(f);return 0===f||isNaN(f)?f:0<f?1:-1}},"es6","es3");$jscomp.polyfill("Array.prototype.entries",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(f,c){return[f,c]})}},"es6","es3");
$jscomp.polyfill("Array.prototype.fill",function(n){return n?n:function(f,c,p){var k=this.length||0;0>c&&(c=Math.max(0,k+c));if(null==p||p>k)p=k;p=Number(p);0>p&&(p=Math.max(0,k+p));for(c=Number(c||0);c<p;c++)this[c]=f;return this}},"es6","es3");
$jscomp.polyfill("Array.prototype.copyWithin",function(n){return n?n:function(f,c,p){var k=this.length;f=Number(f);c=Number(c);p=Number(null!=p?p:k);if(f<c)for(p=Math.min(p,k);c<p;)c in this?this[f++]=this[c++]:(delete this[f++],c++);else for(p=Math.min(p,k+c-f),f+=p-c;p>c;)--p in this?this[--f]=this[p]:delete this[f];return this}},"es6","es3");
(function(n){function f(p){if(c[p])return c[p].exports;var k=c[p]={i:p,l:!1,exports:{}};n[p].call(k.exports,k,k.exports,f);k.l=!0;return k.exports}var c={};f.m=n;f.c=c;f.d=function(c,k,q){f.o(c,k)||Object.defineProperty(c,k,{configurable:!1,enumerable:!0,get:q})};f.n=function(c){var k=c&&c.__esModule?function(){return c["default"]}:function(){return c};f.d(k,"a",k);return k};f.o=function(c,f){return Object.prototype.hasOwnProperty.call(c,f)};f.p="";return f(f.s=145)})([function(n,f,c){function p(a,
b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function q(a,b,c,l){a.addEventListener(b,c,l);return function(){return a.removeEventListener(b,c,l)}}c.d(f,
"c",function(){return q});c.d(f,"a",function(){return b});c.d(f,"b",function(){return m});var a=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,l){c&&a(b.prototype,c);l&&a(b,l);return b}}(),b=function(){function b(){k(this,b);this.refCount=1}a(b,[{key:"addRef",value:function(){++this.refCount;return this}},{key:"dispose",value:function(){0===--this.refCount&&
this.refCountReachedZero()}},{key:"refCountReachedZero",value:function(){this.disposed();var a=this.disposers;if(null!=a){for(var b=a.length;0<b;--b){var c=a[b-1];"object"===typeof c?c.dispose():c.call(this)}this.disposers=void 0}this.wasDisposed=!0}},{key:"disposed",value:function(){}},{key:"registerDisposer",value:function(a){var b=this.disposers;null==b?this.disposers=[a]:b.push(a);return a}},{key:"unregisterDisposer",value:function(a){var b=this.disposers;if(null!=b){var c=b.indexOf(a);-1!==c&&
b.splice(c,1)}return a}},{key:"registerEventListener",value:function(a,b,c,g){this.registerDisposer(q(a,b,c,g))}},{key:"registerCancellable",value:function(a){this.registerDisposer(function(){a.cancel()});return a}}]);return b}(),m=function(a){function b(a){k(this,b);var c=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.value=a;return c}p(b,a);
return b}(b)},function(n,f,c){function p(a,b){var c=Math.abs(a[b]),f=Math.abs(a[b+1]),v=Math.abs(a[b+2]),t=Math.max(c,f,v);1E-4>c/t&&(a[b]=0);1E-4>f/t&&(a[b+1]=0);1E-4>v/t&&(a[b+2]=0)}c.d(f,"b",function(){return q});f.k=function(a){return a[0]*a[1]*a[2]};f.q=function(a){return a[0]+","+a[1]+","+a[2]};f.m=function(a){p(a,0);p(a,4);p(a,8)};f.n=function(a,b,c){var m=b[0],f=b[1];b=b[2];a[0]=c[0]*m+c[4]*f+c[8]*b;a[1]=c[1]*m+c[5]*f+c[9]*b;a[2]=c[2]*m+c[6]*f+c[10]*b;return a};f.c=function(a,b){var c=b[0],
f=b[1],v=b[2],t=b[4],l=b[5],g=b[6],e=b[8],d=b[9];b=b[10];a[0]=Math.sqrt(c*c+f*f+v*v);a[1]=Math.sqrt(t*t+l*l+g*g);a[2]=Math.sqrt(e*e+d*d+b*b);return a};f.o=function(a,b,c,f,v){a[0]=f[0];a[1]=f[1];a[2]=f[2]*v;return k.b.fromRotationTranslationScale(a,c,b,a)};var k=c(89);n=c(19);c.d(f,"i",function(){return k.a});c.d(f,"j",function(){return k.b});c.d(f,"l",function(){return k.c});c.d(f,"p",function(){return k.d});c.d(f,"r",function(){return k.e});c=k.b.create();f.d=c;f.a=["x","y","z"];var q=function b(c,
f){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.lower=c;this.upper=f};c=[k.d.fromValues(1,0,0),k.d.fromValues(0,1,0),k.d.fromValues(0,0,1)];f.e=c;c=k.d.fromValues(0,0,0);f.h=c;c=k.d.fromValues(1,1,1);f.g=c;c=k.d.fromValues(Infinity,Infinity,Infinity);f.f=c;k.c.create();new n.a(1227133513,306783378);new n.a(3272356035,818089008);new n.a(251719695,4027515120);new n.a(4278190335,16711680);new n.a(65535,16711680);new n.a(2097151,0)},function(n,f,c){function p(a){var d=
typeof a;if("number"===d||"string"===d)if(d=parseFloat(""+a),!Number.isNaN(d))return d;throw Error("Expected floating-point number, but received: "+JSON.stringify(a)+".");}function k(a){a=p(a);if(Number.isFinite(a))return a;throw Error("Expected finite floating-point number, but received: "+a+".");}function q(a){a=k(a);if(0<a)return a;throw Error("Expected positive finite floating-point number, but received: "+a+".");}function a(d){if("object"===typeof d){if(null===d)return"null";if(Array.isArray(d)){var e=
"[",h=d.length,b=0;if(b<h)for(e+=a(d[b]);++b<h;)e+=",",e+=a(d[b]);return e+"]"}e="{";h=Object.keys(d).sort();b=0;var c=h.length;if(b<c){var g=h[b];e+=JSON.stringify(g);for(e=e+":"+a(d[g]);++b<c;)e+=",",g=h[b],e+=JSON.stringify(g),e+=":",e+=a(d[g])}return e+"}"}return JSON.stringify(d)}function b(a){return a.replace(/['"]/g,function(a){return'"'===a?"'":'"'})}function m(a){if("object"===typeof a){if(null===a)return"null";var d=a.toJSON;if("function"===typeof d)return m(d.call(a));if(Array.isArray(a)){d=
"[";var e=a.length,h=0;if(h<e)for(d+=m(a[h]);++h<e;)d+="_",d+=m(a[h]);return d+"]"}d="{";h=Object.keys(a);e=!0;h=$jscomp.makeIterator(h);for(var c=h.next();!c.done;c=h.next()){c=c.value;var g=a[c];void 0!==g&&(g=m(g))&&(e?e=!1:d+="_",d+=b(JSON.stringify(b(c))),d+=":",d+=g)}return d+"}"}return"string"===typeof a?b(JSON.stringify(b(a))):JSON.stringify(a)}function u(a,d,e){var h=/[&_,]/g;if('"'===e){var b="'";var c=C;var g=r}else b='"',c=D,g=B;for(var l="";0<a.length;){var t=a.match(g);if(null===t){var m=
a;t=a=""}else{m=a.substr(0,t.index);a=a.substr(t.index+t[0].length);var f=t[1];if(void 0!==f){var u=f,v=b;t=e;f=c;if(2<=u.length&&u.charAt(0)===v&&u.charAt(u.length-1)===v){u=u.substr(1,u.length-2);for(v=t;0<u.length;){var y=u.match(f);if(null===y){v+=u;break}v+=y[1];v+="\\";v+=t;u=u.substr(y.index+y[0].length)}t=v+t}else t=u}else t=t[2]}l+=m.replace(h,d);l+=t}return l}function v(a){return JSON.parse(u(a,",",'"'))}function t(a,d,e){var h=a.length;if(!Array.isArray(d)||d.length!==h)throw Error("Expected length "+
h+" array, but received: "+JSON.stringify(d)+".");for(var b=0;b<h;++b)a[b]=e(d[b],b);return a}function l(a){if("object"!==typeof a||null==a||Array.isArray(a))throw Error("Expected JSON object, but received: "+JSON.stringify(a)+".");return a}function g(a){var d=parseInt(a,10);if(!Number.isInteger(d))throw Error("Expected integer, but received: "+JSON.stringify(a)+".");return d}function e(a){a=g(a);if(0>=a)throw Error("Expected positive integer, but received: "+a+".");return a}function d(a){if("string"!==
typeof a)throw Error("Expected string, but received: "+JSON.stringify(a)+".");return a}f.q=p;f.o=k;f.p=q;f.f=function(a,d,e){e=void 0===e?p:e;l(d);var h=Object.keys(d);h.sort();if(3!==h.length||"x"!==h[0]||"y"!==h[1]||"z"!==h[2])throw Error("Expected object to have keys ['x', 'y', 'z'], but received: "+JSON.stringify(d)+".");a[0]=e(d.x);a[1]=e(d.y);a[2]=e(d.z);return a};f.b=function(a,d){var e=a.length;if(!Array.isArray(d)||d.length!==e)throw Error("Incompatible sizes");for(var h=0;h<e;++h)if(!Number.isFinite(parseFloat(d[h])))throw Error("Non-finite value.");
for(h=0;h<e;++h)a[h]=parseFloat(d[h]);return a};f.d=function(a,d){var e=a.length;if(!Array.isArray(d)||d.length!==e)throw Error("Incompatible sizes.");for(var h=0;h<e;++h){var b=parseInt(d[h],void 0);if(!Number.isInteger(b))throw Error("Non-integer value.");}for(h=0;h<e;++h)a[h]=parseInt(d[h],void 0);return a};f.g=a;f.i=m;f.h=v;f.a=function(a,d){if(!Array.isArray(a))throw Error("Expected array, but received: "+JSON.stringify(a)+".");return a.map(d)};f.c=t;f.u=l;f.s=g;f.A=e;f.t=function(a,d){var e=
d.get(a);if(void 0===e)throw Error("Expected one of "+JSON.stringify(Array.from(d.keys()))+", "+("but received: "+JSON.stringify(a)+"."));return e};f.B=d;f.z=function(a){if(void 0!==a)return d(a)};f.y=function(a){if(void 0!==a)return g(a)};f.x=function(a){if(void 0!==a){if("boolean"===typeof a)return a;if("true"===a)return!0;if("false"===a)return!1;throw Error("Expected string or boolean but received: "+JSON.stringify(a));}};f.w=function(a,d,e){a=a.hasOwnProperty(d)?a[d]:void 0;try{return e(a)}catch(A){throw Error("Error parsing "+
JSON.stringify(d)+" property: "+A.message);}};f.v=function(a,d){l(a);for(var e=new Map,h=$jscomp.makeIterator(Object.keys(a)),b=h.next();!b.done;b=h.next()){b=b.value;try{e.set(b,d(a[b]))}catch(H){throw Error("Error parsing value associated with key "+JSON.stringify(b)+": "+H.message);}}return e};f.r=function(a){if("number"!==typeof a||!Number.isFinite(a)||0>a||1<a)throw Error("Expected floating point number in [0,1], but received: "+JSON.stringify(a)+".");return a};f.e=function(a){if(""===a)return{};
if(a.startsWith("{"))return v(a);var d={};a=a.split(/[&;]/);a=$jscomp.makeIterator(a);for(var e=a.next();!e.done;e=a.next()){e=e.value;var h=e.match(/^([^=&;]+)=([^&;]*)$/);if(null===h)throw Error("Invalid query string part: "+JSON.stringify(e)+".");d[h[1]]=decodeURIComponent(h[2])}return d};f.n=function(a,d){if("string"===typeof a&&null!==a.match(/^[a-zA-Z]/)&&(a=a.toUpperCase(),d.hasOwnProperty(a)))return d[a];throw Error("Invalid enum value: "+JSON.stringify(a)+".");};f.l=function(a){return t(h.p.create(),
a,k)};f.k=function(a){return t(h.p.create(),a,q)};f.j=function(a){return t(h.p.create(),a,e)};f.C=function(a){if(!Array.isArray(a))throw Error("Expected array, received: "+JSON.stringify(a)+".");for(var d=$jscomp.makeIterator(a),e=d.next();!e.done;e=d.next())if(e=e.value,"string"!==typeof e)throw Error("Expected string, received: "+JSON.stringify(e)+".");return a};f.m=function(a){if("boolean"!==typeof a)throw Error("Expected boolean, received: "+JSON.stringify(a));return a};var h=c(1);n=/('(?:[^'\\]|(?:\\.))*')/;
f=/("(?:[^'\\]|(?:\\.))*")/;var r=new RegExp(n.source+"|"+f.source),B=new RegExp(f.source+"|"+n.source),C=/^((?:[^"'\\]|(?:\\.))*)"/,D=/^((?:[^"'\\]|(?:\\.))*)'/},function(n,f){n.exports="function"===typeof Object.create?function(c,f){c.super_=f;c.prototype=Object.create(f.prototype,{constructor:{value:c,enumerable:!1,writable:!0,configurable:!0}})}:function(c,f){c.super_=f;var k=function(){};k.prototype=f.prototype;c.prototype=new k;c.prototype.constructor=c}},function(n,f,c){function p(a,b){if("function"!==
typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"b",function(){return a});c.d(f,"a",function(){return b});var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var l=
b[c];l.enumerable=l.enumerable||!1;l.configurable=!0;"value"in l&&(l.writable=!0);Object.defineProperty(a,l.key,l)}}return function(b,c,t){c&&a(b.prototype,c);t&&a(b,t);return b}}(),a=function(){function a(){k(this,a);this.handlers=new Set;this.count=0;var b=this;this.dispatch=function(){var a=this,c=arguments;++b.count;b.handlers.forEach(function(b){b.apply(a,c)})}}q(a,[{key:"add",value:function(a){var b=this;this.handlers.add(a);return function(){return b.remove(a)}}},{key:"remove",value:function(a){return this.handlers.delete(a)}},
{key:"dispose",value:function(){this.handlers=void 0}}]);return a}(),b=function(a){function b(){k(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);return b}(a)},function(n,f){f=function(){return this}();try{f=f||Function("return this")()||(0,eval)("this")}catch(c){"object"===typeof window&&(f=window)}n.exports=
f},function(n,f){function c(){throw Error("setTimeout has not been defined");}function p(){throw Error("clearTimeout has not been defined");}function k(a){if(v===setTimeout)return setTimeout(a,0);if((v===c||!v)&&setTimeout)return v=setTimeout,setTimeout(a,0);try{return v(a,0)}catch(r){try{return v.call(null,a,0)}catch(B){return v.call(this,a,0)}}}function q(a){if(t===clearTimeout)return clearTimeout(a);if((t===p||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(a);try{return t(a)}catch(r){try{return t.call(null,
a)}catch(B){return t.call(this,a)}}}function a(){g&&e&&(g=!1,e.length?l=e.concat(l):d=-1,l.length&&b())}function b(){if(!g){var h=k(a);g=!0;for(var b=l.length;b;){e=l;for(l=[];++d<b;)e&&e[d].run();d=-1;b=l.length}e=null;g=!1;q(h)}}function m(a,d){this.fun=a;this.array=d}function u(){}n=n.exports={};try{var v="function"===typeof setTimeout?setTimeout:c}catch(h){v=c}try{var t="function"===typeof clearTimeout?clearTimeout:p}catch(h){t=p}var l=[],g=!1,e,d=-1;n.nextTick=function(a){var d=Array(arguments.length-
1);if(1<arguments.length)for(var e=1;e<arguments.length;e++)d[e-1]=arguments[e];l.push(new m(a,d));1!==l.length||g||k(b)};m.prototype.run=function(){this.fun.apply(null,this.array)};n.title="browser";n.browser=!0;n.env={};n.argv=[];n.version="";n.versions={};n.on=u;n.addListener=u;n.once=u;n.off=u;n.removeListener=u;n.removeAllListeners=u;n.emit=u;n.prependListener=u;n.prependOnceListener=u;n.listeners=function(a){return[]};n.binding=function(a){throw Error("process.binding is not supported");};n.cwd=
function(){return"/"};n.chdir=function(a){throw Error("process.chdir is not supported");};n.umask=function(){return 0}},function(n,f,c){(function(p){function k(){try{var a=f.storage.debug}catch(m){}!a&&"undefined"!==typeof p&&"env"in p&&(a=p.env.DEBUG);return a}f=n.exports=c(240);f.log=function(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)};f.formatArgs=function(a){var b=this.useColors;a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+
(b?"%c ":" ")+"+"+f.humanize(this.diff);if(b){b="color: "+this.color;a.splice(1,0,b,"color: inherit");var c=0,v=0;a[0].replace(/%[a-zA-Z%]/g,function(a){"%%"!==a&&(c++,"%c"===a&&(v=c))});a.splice(v,0,b)}};f.save=function(a){try{null==a?f.storage.removeItem("debug"):f.storage.debug=a}catch(m){}};f.load=k;f.useColors=function(){return"undefined"!==typeof window&&window.process&&"renderer"===window.process.type?!0:"undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&
document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)};var q=f;if("undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage)var a=
chrome.storage.local;else a:{try{a=window.localStorage;break a}catch(b){}a=void 0}q.storage=a;f.colors="lightseagreen forestgreen goldenrod dodgerblue darkorchid crimson".split(" ");f.formatters.j=function(a){try{return JSON.stringify(a)}catch(m){return"[UnexpectedJSONParseError]: "+m.message}};f.enable(k())}).call(f,c(6))},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"b",function(){return b});c.d(f,"a",function(){return m});var q=c(4),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,
c,l){c&&a(b.prototype,c);l&&a(b,l);return b}}(),b=function(){function b(a){k(this,b);this.value_=a;this.changed=new q.a}a(b,[{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return b}(),m=function(b){function c(a,b,g){g=void 0===g?a:g;k(this,c);a=(c.__proto__||Object.getPrototypeOf(c)).call(this,a);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==
typeof a?this:a;a.validator=b;a.defaultValue=g;return a}p(c,b);a(c,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",value:function(a){if(void 0!==a){var b=this.validator;try{this.value=b(a);return}catch(g){}}this.value=this.defaultValue}}]);return c}(b)},function(n,f,c){var p=c(63),k=c(157),q=c(159),a=Math.max,b=Math.min;n.exports=function(c,f,v){function t(a){var d=h,e=r;h=r=void 0;
z=a;return m=c.apply(e,d)}function l(a){var d=a-D;a-=z;return void 0===D||d>=f||0>d||E&&a>=G}function g(){var a=k();if(l(a))return e(a);var d=setTimeout;var h=a-z;a=f-(a-D);h=E?b(a,G-h):a;u=d(g,h)}function e(a){u=void 0;if(A&&h)return t(a);h=r=void 0;return m}function d(){var a=k(),d=l(a);h=arguments;r=this;D=a;if(d){if(void 0===u)return z=a=D,u=setTimeout(g,f),y?t(a):m;if(E)return u=setTimeout(g,f),t(D)}void 0===u&&(u=setTimeout(g,f));return m}var h,r,m,u,D,z=0,y=!1,E=!1,A=!0;if("function"!=typeof c)throw new TypeError("Expected a function");
f=q(f)||0;if(p(v)){y=!!v.leading;var G=(E="maxWait"in v)?a(q(v.maxWait)||0,f):G;A="trailing"in v?!!v.trailing:A}d.cancel=function(){void 0!==u&&clearTimeout(u);z=0;h=D=r=u=void 0};d.flush=function(){return void 0===u?m:e(k())};return d}},function(n,f,c){function p(){k.call(this)}f=c(3);var k=c(124);f(p,k);p.prototype.removeAllListeners=function(c){c?delete this._listeners[c]:this._listeners={}};p.prototype.once=function(c,a){function b(){m.removeListener(c,b);f||(f=!0,a.apply(this,arguments))}var m=
this,f=!1;this.on(c,b)};p.prototype.emit=function(){var c=this._listeners[arguments[0]];if(c){for(var a=arguments.length,b=Array(a-1),m=1;m<a;m++)b[m-1]=arguments[m];for(a=0;a<c.length;a++)c[a].apply(this,b)}};p.prototype.on=p.prototype.addListener=k.prototype.addEventListener;p.prototype.removeListener=k.prototype.removeEventListener;n.exports.EventEmitter=p},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"d",function(){return m});c.d(f,"c",function(){return u});var k=c(47),q=c(37),a=c(1);c.d(f,"a",function(){return q.b});var b=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,
c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}(),m;(function(a){a[a.UNKNOWN=0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(m||(m={}));var u=function(c){function t(b){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function");var c=(t.__proto__||Object.getPrototypeOf(t)).call(this,b);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;var e=c.dataType=b.dataType,
d=c.numChannels=b.numChannels;c.chunkBytes=Object(a.k)(b.chunkDataSize)*q.a[e]*d;c.compressedSegmentationBlockSize=b.compressedSegmentationBlockSize;return c}p(t,c);b(t,[{key:"toObject",value:function(){return{transform:this.chunkLayout.transform,numChannels:this.numChannels,chunkDataSize:this.chunkDataSize,voxelSize:this.voxelSize,dataType:this.dataType,lowerVoxelBound:this.lowerVoxelBound,upperVoxelBound:this.upperVoxelBound,lowerClipBound:this.lowerClipBound,upperClipBound:this.upperClipBound,
baseVoxelOffset:this.baseVoxelOffset,compressedSegmentationBlockSize:this.compressedSegmentationBlockSize}}}],[{key:"make",value:function(a){return new t(Object.assign({},a,{transform:Object(k.g)(a.transform,a.volumeSourceOptions)}))}},{key:"fromObject",value:function(a){return new t(a)}},{key:"withDefaultCompression",value:function(a){var b=a.compressedSegmentationBlockSize,e=a.dataType,d=a.voxelSize,h=a.transform,c=a.lowerVoxelBound,l=a.upperVoxelBound;h=Object(k.g)(h,a.volumeSourceOptions);void 0!==
b||a.volumeType!==m.SEGMENTATION||e!==q.b.UINT32&&e!==q.b.UINT64||(b=Object(k.h)({voxelSize:d,transform:h,lowerVoxelBound:c,upperVoxelBound:l,maxVoxelsPerChunkLog2:9}));return new t(Object.assign({},a,{compressedSegmentationBlockSize:b,transform:h}))}},{key:"getDefaults",value:function(a){var b=Object.assign({},a,{transform:Object(k.g)(a.transform,a.volumeSourceOptions)});return(void 0===a.chunkDataSizes?Object(k.f)(b):a.chunkDataSizes).map(function(e){return t.withDefaultCompression(Object.assign({},
a,{chunkDataSize:e}))})}}]);return t}(k.e);f.b="volume/RenderLayer"},function(n,f,c){f.a=function(c){for(;;){var f=c.firstElementChild;if(!f)break;c.removeChild(f)}};f.b=function(c){var f=c.parentElement;return f?(f.removeChild(c),!0):!1}},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==
typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function a(a,d){t.set(a,d)}f.e=a;f.d=function(d,e){a(d,function(a){var d=this,h=a.id,c=new b.b;a=e.call(this,a,c);this.set(h,{promise:a,cancellationToken:c});a.then(function(a){var e=
a.value;a=a.transfers;d.delete(h);d.invoke("rpc.promise.response",{id:h,value:e},a)},function(a){d.delete(h);d.invoke("rpc.promise.response",{id:h,error:a.message,errorName:a.name})})})};c.d(f,"a",function(){return e});c.d(f,"b",function(){return d});c.d(f,"c",function(){return h});f.g=function(a){return function(d){d.prototype.RPC_TYPE_ID=a}};f.f=function(a){return function(d){if(void 0!==a)d.prototype.RPC_TYPE_ID=a;else if(a=d.prototype.RPC_TYPE_ID,void 0===a)throw Error("RPC_TYPE_ID should have already been defined");
r.set(a,d)}};var b=c(27);n=c(0);var m=function C(a,d,e){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,d);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return C(a,d,e)}else{if("value"in b)return b.value;d=b.get;return void 0===d?void 0:d.call(e)}},u=function(){function a(a,d){for(var e=0;e<d.length;e++){var b=d[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(d,e,b){e&&a(d.prototype,
e);b&&a(d,b);return d}}(),v=!("undefined"!==typeof Window&&self instanceof Window),t=new Map,l=function(a){function d(a,e){p(this,d);var b=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,e));b.name=a;b.message=e;return b}q(d,a);return d}(Error);a("rpc.promise.cancel",function(a){this.get(a.id).cancellationToken.cancel()});a("rpc.promise.response",function(a){var d=a.id,e=this.get(d),h=e.resolve;e=e.reject;this.delete(d);a.hasOwnProperty("value")?h(a.value):a.errorName===b.a.name?e(b.a):e(new l(a.errorName,
a.error))});var g=v?-1:0,e=function(){function a(d){var e=this;p(this,a);this.target=d;this.objects=new Map;this.nextId=g;d.onmessage=function(a){a=a.data;t.get(a.functionName).call(e,a)}}u(a,[{key:"set",value:function(a,d){this.objects.set(a,d)}},{key:"delete",value:function(a){this.objects.delete(a)}},{key:"get",value:function(a){return this.objects.get(a)}},{key:"getRef",value:function(a){var d=this.get(a.id);d.referencedGeneration=a.gen;d.addRef();return d}},{key:"invoke",value:function(a,d,e){d.functionName=
a;this.target.postMessage(d,e)}},{key:"promiseInvoke",value:function(a,d,e,h){var c=this;e=void 0===e?b.e:e;return Object(b.d)(e,function(e,b,g){var r=d.id=c.newId();c.set(r,{resolve:e,reject:b});c.invoke(a,d,h);g.add(function(){c.invoke("rpc.promise.cancel",{id:r})})})}},{key:"newId",value:function(){return v?this.nextId--:this.nextId++}},{key:"numObjects",get:function(){return this.objects.size}}]);return a}(),d=function(a){function d(){p(this,d);var a=k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,
arguments));a.rpc=null;a.rpcId=null;return a}q(d,a);u(d,[{key:"initializeSharedObject",value:function(a,d){d=void 0===d?a.newId():d;this.rpc=a;this.rpcId=d;this.isOwner=!1;a.set(d,this)}},{key:"initializeCounterpart",value:function(a,d){d=void 0===d?{}:d;this.initializeSharedObject(a);this.referencedGeneration=this.unreferencedGeneration=0;this.isOwner=!0;d.id=this.rpcId;d.type=this.RPC_TYPE_ID;a.invoke("SharedObject.new",d)}},{key:"dispose",value:function(){m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"dispose",this).call(this)}},{key:"addCounterpartRef",value:function(){return{id:this.rpcId,gen:++this.referencedGeneration}}},{key:"refCountReachedZero",value:function(){!0===this.isOwner?this.referencedGeneration===this.unreferencedGeneration&&this.ownerDispose():!1===this.isOwner?this.rpc.invoke("SharedObject.refCountReachedZero",{id:this.rpcId,gen:this.referencedGeneration}):m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"refCountReachedZero",this).call(this)}},{key:"ownerDispose",
value:function(){var a=this.rpc,e=this.rpcId;m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"refCountReachedZero",this).call(this);a.delete(e);a.invoke("SharedObject.dispose",{id:e})}},{key:"counterpartRefCountReachedZero",value:function(a){this.unreferencedGeneration=a;0===this.refCount&&a===this.referencedGeneration&&this.ownerDispose()}}]);return d}(n.a),h=function(a){function d(a,e){e=void 0===e?{}:e;p(this,d);var b=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e=void 0===
e?{}:e;null!=a&&b.initializeSharedObject(a,e.id);return b}q(d,a);return d}(d);a("SharedObject.dispose",function(a){a=this.get(a.id);if(0!==a.refCount)throw Error("Attempted to dispose object with non-zero reference count.");a.disposed();this.delete(a.rpcId);a.rpcId=null;a.rpc=null});a("SharedObject.refCountReachedZero",function(a){this.get(a.id).counterpartRefCountReachedZero(a.gen)});var r=new Map;a("SharedObject.new",function(a){--(new (r.get(a.type))(this,a)).refCount})},function(n,f,c){c.d(f,
"i",function(){return q});f.q=function(a){return(a[3]+1/256*a[2]+1/65536*a[1]+1/16777216*a[0])/256};c.d(f,"g",function(){return a});c.d(f,"f",function(){return u});c.d(f,"h",function(){return v});c.d(f,"d",function(){return t});f.p=function(a,b){for(var e=0;4>e;++e)a[e]=(b>>8*e&255)/255;return a};f.a=function(a,b){b=void 0===b?1:b;switch(a){case p.b.FLOAT32:if(1===b)return"float";if(1<b&&4>b)return"vec"+b;break;case p.b.UINT8:if(1===b)return"uint8_t";if(1<b&&4>b)return"uint8x"+b+"_t";break;case p.b.UINT16:if(1===
b)return"uint16_t";if(2===b)return"uint16x2_t";break;case p.b.UINT32:if(1===b)return"uint32_t";break;case p.b.UINT64:if(1===b)return"uint64_t"}throw Error("No shader type for "+p.b[a]+"["+b+"].");};var p=c(37),k=c(167),q="\nvec4 packFloat01ToFixedPoint(const float value) {\n  const vec4 shift = vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0);\n  const vec4 mask = vec4(0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);\n  vec4 result = fract(value * shift);\n  result -= result.xxyz * mask;\n  return result * 256.0 / 255.0;\n}\n",
a="\nvec3 hueToRgb(float hue) {\n  float hue6 = hue * 6.0;\n  float r = abs(hue6 - 3.0) - 1.0;\n  float g = 2.0 - abs(hue6 - 2.0);\n  float b = 2.0 - abs(hue6 - 4.0);\n  return clamp(vec3(r, g, b), 0.0, 1.0);\n}\nvec3 hsvToRgb(vec3 c) {\n  vec3 hueRgb = hueToRgb(c.x);\n  return c.z * ((hueRgb - 1.0) * c.y + 1.0);\n}\n";n=["float","vec2","vec3","vec4"].map(function(a){return"\n"+a+" unnormalizeUint8("+a+" value) {\n  return floor(value * 255.0 + 0.5);\n}\n"}).join("");f.o=n;var b=[n,"\nfloat uintleToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintleToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0;\n}\nfloat uintleToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.x + v.y * 256.0 + v.z * 256.0 * 256.0;\n}\n"];
f.n=b;var m=[n,"\nfloat uintbeToFloat(float v) {\n  return unnormalizeUint8(v);\n}\nfloat uintbeToFloat(vec2 v) {\n  v = unnormalizeUint8(v);\n  return v.y + v.x * 256.0;\n}\nfloat uintbeToFloat(vec3 v) {\n  v = unnormalizeUint8(v);\n  return v.z + v.y * 256.0 + v.x * 256.0 * 256.0;\n}\n"];(function(){var a=k.a===k.b.BIG?"be":"le";return[k.a===k.b.BIG?m:b,"\nfloat uintToFloat(float v) {\n  return uint"+a+"ToFloat(v);\n}\nfloat uintToFloat(vec2 v) {\n  return uint"+a+"ToFloat(v);\n}\nfloat uintToFloat(vec3 v) {\n  return uint"+
a+"ToFloat(v);\n}\n"]})();f.l="\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n";f.m=[n,"\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint8_t {\n  float value;\n};\nstruct uint8x2_t {\n  vec2 value;\n};\nstruct uint8x3_t {\n  vec3 value;\n};\nstruct uint8x4_t {\n  vec4 value;\n};\nfloat toRaw(uint8_t x) { return unnormalizeUint8(x.value); }\nfloat toNormalized(uint8_t x) { return x.value; }\nvec2 toRaw(uint8x2_t x) { return unnormalizeUint8(x.value); }\nvec2 toNormalized(uint8x2_t x) { return x.value; }\nvec3 toRaw(uint8x3_t x) { return unnormalizeUint8(x.value); }\nvec3 toNormalized(uint8x3_t x) { return x.value; }\nvec4 toRaw(uint8x4_t x) { return unnormalizeUint8(x.value); }\nvec4 toNormalized(uint8x4_t x) { return x.value; }\nuint64_t toUint64(uint8_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
f.e="\nfloat toRaw(float x) { return x; }\nfloat toNormalized(float x) { return x; }\nvec2 toRaw(vec2 x) { return x; }\nvec2 toNormalized(vec2 x) { return x; }\nvec3 toRaw(vec3 x) { return x; }\nvec3 toNormalized(vec3 x) { return x; }\nvec4 toRaw(vec4 x) { return x; }\nvec4 toNormalized(vec4 x) { return x; }\n";f.j=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n",b,"\nstruct uint16_t {\n  vec2 value;\n};\nstruct uint16x2_t {\n  vec4 value;\n};\nfloat toRaw(uint16_t x) { return uintleToFloat(x.value); }\nfloat toNormalized(uint16_t x) { return toRaw(x) / 65535.0; }\nvec2 toRaw(uint16x2_t x) { return vec2(uintleToFloat(x.value.xy), uintleToFloat(x.value.zw)); }\nvec2 toNormalized(uint16x2_t x) { return toRaw(x) / 65535.0; }\nuint64_t toUint64(uint16_t x) {\n  uint64_t result;\n  result.low = vec4(x.value, 0.0, 0.0);\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];
n=["\nstruct uint64_t {\n  vec4 low, high;\n};\nuint64_t toUint64(uint64_t x) { return x; }\n","\nstruct uint32_t {\n  vec4 value;\n};\nuint64_t toUint64(uint32_t x) {\n  uint64_t result;\n  result.low = x.value;\n  result.high = vec4(0.0, 0.0, 0.0, 0.0);\n  return result;\n}\n"];f.k=n;var u=["\nvec3 getSubscriptsFromNormalized(vec3 normalizedPosition, vec3 size) {\n  return floor(min(normalizedPosition * size, size - 1.0));\n}\n","\nfloat getFortranOrderIndex(vec3 subscripts, vec3 size) {\n  return subscripts.x + size.x * (subscripts.y + size.y * subscripts.z);\n}\n",
"\nfloat getFortranOrderIndexFromNormalized(vec3 normalizedPosition, vec3 size) {\n  return getFortranOrderIndex(getSubscriptsFromNormalized(normalizedPosition, size), size);\n}\n"],v="\nfloat imod(float x, float y) {\n  return x - y * floor(x / y);\n}\n",t="\nfloat exactDot(vec4 a, vec4 b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];\n}\nfloat exactDot(vec3 a, vec3 b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n";f.b=[n,"\nuint32_t add(uint32_t a, uint32_t b) {\n  uint32_t result;\n  float partial = 0.0;\n\n  partial += a.value.x * 255.0 + b.value.x * 255.0;\n  {\n    float byte0 = mod(partial, 256.0);\n    result.value.x = byte0 / 255.0;\n    partial = (partial - byte0) / 256.0;\n  }\n\n  partial += a.value.y * 255.0 + b.value.y * 255.0;\n  {\n    float byte1 = mod(partial, 256.0);\n    result.value.y = byte1 / 255.0;\n    partial = (partial - byte1) / 256.0;\n  }\n\n  partial += a.value.z * 255.0 + b.value.z * 255.0;\n  {\n    float byte2 = mod(partial, 256.0);\n    result.value.z = byte2 / 255.0;\n    partial = (partial - byte2) / 256.0;\n  }\n\n  partial += a.value.w * 255.0 + b.value.w * 255.0;\n  {\n    float byte3 = mod(partial, 256.0);\n    result.value.w = byte3 / 255.0;\n    partial = (partial - byte3) / 256.0;\n  }\n  return result;\n}\n"];
f.c=[n,"\nfloat divmod(uint32_t dividend, float divisor, out uint32_t quotient) {\n\n  float partial = dividend.value.w * 255.0;\n  float remainder;\n\n  remainder = mod(partial, divisor);\n  quotient.value.w = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.z * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.z = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.y * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.y = (partial - remainder) / divisor / 255.0;\n  partial = remainder * 256.0 + dividend.value.x * 255.0;\n\n  remainder = mod(partial, divisor);\n  quotient.value.x = (partial - remainder) / divisor / 255.0;\n\n  return remainder;\n}\n"]},
function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function a(a,d,e,b){b=void 0===b?{}:b;return u.a.forPromise(new Promise(function(h){h(a.getVolume(d,e,b))}),{initialMessage:"Retrieving metadata for volume "+e+".",delay:!0,errorPrefix:"Error retrieving metadata for volume "+e+": "})}f.d=a;c.d(f,"b",function(){return g});c.d(f,"c",function(){return e});c.d(f,"a",function(){return d});f.e=function(a,d){h.set(a,d)};f.f=function(a,d){r.set(a,d)};var b=c(20),m=c(11),
u=c(31);n=c(0);var v=c(2),t=c(4),l=function(){function a(a,d){for(var e=0;e<d.length;e++){var b=d[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(d,e,b){e&&a(d.prototype,e);b&&a(d,b);return d}}(),g=function(a){function d(a,e,b){p(this,d);a=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a));a.initialSpecification=e;a.manager=b;return a}q(d,a);l(d,[{key:"toJSON",value:function(){var a=this.layer;if(!a)return this.initialSpecification;
a=a.toJSON();this.visible||(a.visible=!1);return a}}]);return d}(b.c),e=function(d){function e(a,d,b,h,c){p(this,e);var g=k(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));g.dataSourceProvider=a;g.layerManager=d;g.chunkManager=b;g.layerSelectedValues=h;g.voxelSize=c;g.changed=new t.a;g.voxelCoordinatesSet=new t.b;g.registerDisposer(d.layersChanged.add(g.changed.dispatch));g.registerDisposer(d.specificationChanged.add(g.changed.dispatch));return g}q(e,d);l(e,[{key:"reset",value:function(){this.layerManager.clear()}},
{key:"restoreState",value:function(a){Object(v.u)(a);this.layerManager.clear();for(var d=$jscomp.makeIterator(Object.keys(a)),e=d.next();!e.done;e=d.next())e=e.value,this.layerManager.addManagedLayer(this.getLayer(e,a[e]))}},{key:"initializeLayerFromSpec",value:function(d,e){var b=this;d.initialSpecification=e;"string"===typeof e&&(e={source:e});Object(v.u)(e);var c=Object(v.w)(e,"type",v.z);d.visible=Object(v.w)(e,"visible",function(a){if(void 0===a||!0===a)return!0;if(!1===a)return!1;throw Error("Expected boolean, but received: "+
JSON.stringify(a)+".");});var g=d.sourceUrl=Object(v.w)(e,"source",v.z);if(void 0===c){if(void 0===g)throw Error("Either layer 'type' or 'source' URL must be specified.");a(this.dataSourceProvider,this.chunkManager,g).then(function(a){if(-1!==b.layerManager.managedLayers.indexOf(d)){var h=r.get(a.volumeType);if(void 0!==h)d.layer=new h(b,e);else throw Error("Unsupported volume type: "+m.d[a.volumeType]+".");}})}else if(g=h.get(c),void 0!==g)d.layer=new g(this,e);else throw Error("Unsupported layer type: "+
JSON.stringify(c)+".");}},{key:"getLayer",value:function(a,d){a=new g(a,d,this);this.initializeLayerFromSpec(a,d);return a}},{key:"add",value:function(a,d){this.layerManager.addManagedLayer(a,d)}},{key:"toJSON",value:function(){for(var a={},d=0,e=$jscomp.makeIterator(this.layerManager.managedLayers),b=e.next();!b.done;b=e.next()){b=b.value;var h=b.toJSON();null!=h&&(a[b.name]=h,++d)}if(0!==d)return a}},{key:"setVoxelCoordinates",value:function(a){this.voxelCoordinatesSet.dispatch(a)}},{key:"worker",
get:function(){return this.chunkManager.rpc}},{key:"rpc",get:function(){return this.chunkManager.rpc}},{key:"rootLayers",get:function(){return this.layerManager}}]);return e}(n.a),d=function(a){function d(a){p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.master=a;e.changed=new t.a;e.layerManager=new b.a;e.registerDisposer(a);a=e.layerManager;e.registerDisposer(a.layersChanged.add(e.changed.dispatch));e.registerDisposer(a.specificationChanged.add(e.changed.dispatch));
return e}q(d,a);l(d,[{key:"reset",value:function(){this.layerManager.clear()}},{key:"restoreState",value:function(a){var d=this.master.layerManager,e=[];a=$jscomp.makeIterator(new Set(Object(v.a)(a,v.B)));for(var b=a.next();!b.done;b=a.next()){b=b.value;var h=d.getLayerByName(b);if(void 0===h)throw Error("Undefined layer referenced in subset specification: "+JSON.stringify(b));e.push(h)}this.layerManager.clear();d=$jscomp.makeIterator(e);for(e=d.next();!e.done;e=d.next())this.layerManager.addManagedLayer(e.value.addRef())}},
{key:"toJSON",value:function(){return this.layerManager.managedLayers.map(function(a){return a.name})}},{key:"initializeLayerFromSpec",value:function(a,d){this.master.initializeLayerFromSpec(a,d)}},{key:"getLayer",value:function(a,d){return this.master.getLayer(a,d)}},{key:"add",value:function(a,d){-1===this.master.layerManager.managedLayers.indexOf(a)&&(a.name=this.master.layerManager.getUniqueLayerName(a.name),this.master.layerManager.addManagedLayer(a.addRef()));this.layerManager.addManagedLayer(a,
d)}},{key:"setVoxelCoordinates",value:function(a){this.master.setVoxelCoordinates(a)}},{key:"voxelCoordinatesSet",get:function(){return this.master.voxelCoordinatesSet}},{key:"worker",get:function(){return this.master.rpc}},{key:"rpc",get:function(){return this.master.rpc}},{key:"dataSourceProvider",get:function(){return this.master.dataSourceProvider}},{key:"chunkManager",get:function(){return this.master.chunkManager}},{key:"voxelSize",get:function(){return this.master.voxelSize}},{key:"layerSelectedValues",
get:function(){return this.master.layerSelectedValues}},{key:"rootLayers",get:function(){return this.master.rootLayers}}]);return d}(n.a),h=new Map,r=new Map},function(n,f,c){function p(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function k(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&
d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function q(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function a(a){if("number"!==typeof a||0>a)throw Error("Expected non-negative number as limit, but received: "+JSON.stringify(a));return a}c.d(f,"b",function(){return B});c.d(f,"a",function(){return C});c.d(f,"d",function(){return D});c.d(f,"c",function(){return z});
c.d(f,"e",function(){return y});f.f=function(a,b){a=function(a){function e(a){for(var d=[],b=0;b<arguments.length;++b)d[b-0]=arguments[b];q(this,e);var h;b=p(this,(h=e.__proto__||Object.getPrototypeOf(e)).call.apply(h,[].concat([this],$jscomp.arrayFromIterable(d))));b.parameters=d[1].parameters;return b}k(e,a);h(e,[{key:"initializeCounterpart",value:function(a,b){b.parameters=this.parameters;d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"initializeCounterpart",this).call(this,a,b)}}],
[{key:"encodeOptions",value:function(a){var b=d(e.__proto__||Object.getPrototypeOf(e),"encodeOptions",this).call(this,a);b.parameters=a.parameters;return b}}]);return e}(a);return a=r([Object(e.g)(b.RPC_ID)],a)};var b=c(34),m=c(62),u=c(8),v=c(2),t=c(52),l=c(23),g=c(4),e=c(13),d=function A(a,d,e){null===a&&(a=Function.prototype);var b=Object.getOwnPropertyDescriptor(a,d);if(void 0===b){if(a=Object.getPrototypeOf(a),null!==a)return A(a,d,e)}else{if("value"in b)return b.value;d=b.get;return void 0===
d?void 0:d.call(e)}},h=function(){function a(a,d){for(var e=0;e<d.length;e++){var b=d[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(d,e,b){e&&a(d.prototype,e);b&&a(d,b);return d}}(),r=this&&this.__decorate||function(a,d,e,b){var h=arguments.length,c=3>h?d:null===b?b=Object.getOwnPropertyDescriptor(d,e):b,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)c=Reflect.decorate(a,d,e,b);else for(var r=
a.length-1;0<=r;r--)if(g=a[r])c=(3>h?g(c):3<h?g(d,e,c):g(d,e))||c;return 3<h&&c&&Object.defineProperty(d,e,c),c},B=function(){function a(d){q(this,a);this.source=d;this.state=b.d.SYSTEM_MEMORY}h(a,[{key:"copyToGPU",value:function(a){this.state=b.d.GPU_MEMORY}},{key:"freeGPUMemory",value:function(a){this.state=b.d.SYSTEM_MEMORY}},{key:"gl",get:function(){return this.source.gl}}]);return a}(),C=function G(d){var e=void 0===d?{}:d;d=void 0===e.defaultItemLimit?Number.POSITIVE_INFINITY:e.defaultItemLimit;
e=void 0===e.defaultSizeLimit?Number.POSITIVE_INFINITY:e.defaultSizeLimit;q(this,G);this.sizeLimit=new u.a(e,a);this.itemLimit=new u.a(d,a)},D=function(a){function d(a,e,b){q(this,d);var h=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));h.gl=e;h.capacities=b;h.visibleChunksChanged=new g.a;h.pendingChunkUpdates=null;h.pendingChunkUpdatesTail=null;h.chunkUpdateDeadline=null;h.chunkUpdateDelay=30;e=function(d){return{itemLimit:h.registerDisposer(m.a.makeFromExisting(a,d.itemLimit)).rpcId,
sizeLimit:h.registerDisposer(m.a.makeFromExisting(a,d.sizeLimit)).rpcId}};h.initializeCounterpart(a,{gpuMemoryCapacity:e(b.gpuMemory),systemMemoryCapacity:e(b.systemMemory),downloadCapacity:e(b.download)});return h}k(d,a);h(d,[{key:"scheduleChunkUpdate",value:function(){var a=this.chunkUpdateDeadline;a=null===a||Date.now()<a?0:this.chunkUpdateDelay;setTimeout(this.processPendingChunkUpdates.bind(this),a)}},{key:"processPendingChunkUpdates",value:function(){var a=this.chunkUpdateDeadline;null===a&&
(a=Date.now()+30);for(var d=!1;;){if(Date.now()>a){setTimeout(this.processPendingChunkUpdates.bind(this),this.chunkUpdateDelay);break}var e=this.pendingChunkUpdates,h=this.rpc.get(e.source);if(void 0===e.id){d=$jscomp.makeIterator(h.chunks.keys());for(var c=d.next();!c.done;c=d.next())h.deleteChunk(c.value);d=!0}else if(c=e.state,c===b.d.EXPIRED)h.deleteChunk(e.id);else{var g=e.id;if(e["new"]){var r=h.getChunk(e);h.addChunk(g,r)}else r=h.chunks.get(g);if(c!==r.state)switch(c){case b.d.GPU_MEMORY:r.copyToGPU(this.gl);
d=!0;break;case b.d.SYSTEM_MEMORY:r.freeGPUMemory(this.gl);break;default:throw Error("INTERNAL ERROR: Invalid chunk state: "+b.d[c]);}}e=this.pendingChunkUpdates=e.nextUpdate;--window.numPendingChunkUpdates;if(null==e){this.pendingChunkUpdatesTail=null;break}}d&&this.visibleChunksChanged.dispatch()}}]);return d}(e.b);D=r([Object(e.g)(b.b)],D);window.numPendingChunkUpdates=0;Object(e.e)("Chunk.update",function(a){var d=this.get(a.source).chunkManager.chunkQueueManager,e=d.pendingChunkUpdatesTail;++window.numPendingChunkUpdates;
null==e?(d.pendingChunkUpdates=a,d.pendingChunkUpdatesTail=a,d.scheduleChunkUpdate()):(e.nextUpdate=a,d.pendingChunkUpdatesTail=a)});var z=function(a){function d(a){q(this,d);var e=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.chunkQueueManager=a;e.memoize=new t.b;e.registerDisposer(a.addRef());e.initializeCounterpart(a.rpc,{chunkQueueManager:a.rpcId});return e}k(d,a);h(d,[{key:"getChunkSource",value:function(a,d){var e=this,b=a.encodeOptions(d);b.constructorId=Object(l.a)(a);b=Object(v.g)(b);
return this.memoize.get(b,function(){var b=new a(e,d);b.initializeCounterpart(e.rpc,{});return b})}},{key:"gl",get:function(){return this.chunkQueueManager.gl}}]);return d}(e.b);z=r([Object(e.g)(b.a)],z);var y=function(a){function e(a,d){q(this,e);d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.chunkManager=a;d.chunks=new Map;return d}k(e,a);h(e,[{key:"initializeCounterpart",value:function(a,b){b.chunkManager=this.chunkManager.rpcId;d(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),
"initializeCounterpart",this).call(this,a,b)}},{key:"deleteChunk",value:function(a){var d=this.chunks.get(a);d.state===b.d.GPU_MEMORY&&d.freeGPUMemory(this.gl);this.chunks.delete(a)}},{key:"addChunk",value:function(a,d){this.chunks.set(a,d)}},{key:"getChunk",value:function(a){throw Error("Not implemented.");}},{key:"invalidateCache",value:function(){this.rpc.invoke(b.c,{id:this.rpcId})}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}],[{key:"encodeOptions",value:function(a){return{}}}]);
return e}(e.b)},function(n,f,c){function p(a,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});e&&(Object.setPrototypeOf?Object.setPrototypeOf(a,e):a.__proto__=e)}function k(a,e){var d="";e&1&&(d+="control+");e&2&&(d+="alt+");e&4&&(d+="meta+");e&8&&(d+="shift+");return d+a}function q(a){return"string"===typeof a?{action:a}:
a}function a(a){function e(e,h){for(;;)switch(d){case 0:g=a.indexOf(":");a:{e=void 0;var r=a.substring(g+1).split("+"),l=0;r=$jscomp.makeIterator(r);for(var t=r.next();!t.done;t=r.next())switch(t=t.value,t){case "control":l|=1;break;case "alt":l|=2;break;case "meta":l|=4;break;case "shift":l|=8;break;default:if(void 0===e)e=t;else{c=void 0;break a}}c=void 0===e?void 0:k(e,l)}if(void 0!==c){d=1;break}d=-1;throw Error("Invalid event identifier: "+JSON.stringify(a));case 1:if(-1===g){d=2;break}b=a.substring(0,
g);if("at"===b||"bubble"===b){d=4;break}d=-1;throw Error("Invalid event phase: "+JSON.stringify(b));case 4:return d=5,{value:b+":"+c,done:!1};case 5:if(void 0===h){d=6;break}d=-1;throw h;case 6:d=3;break;case 2:return d=7,{value:"at:"+c,done:!1};case 7:if(void 0===h){d=8;break}d=-1;throw h;case 8:return d=9,{value:"bubble:"+c,done:!1};case 9:if(void 0===h){d=10;break}d=-1;throw h;case 10:case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,b,c,g,l={next:function(a){return e(a,void 0)},throw:function(a){return e(void 0,
a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l}c.d(f,"a",function(){return t});f.b=function(a,e,d){a=l[e.eventPhase]+":"+k(a,(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.metaKey?4:0)|(e.shiftKey?8:0));d=d.get(a);void 0!==d&&(!1!==d.stopPropagation&&e.stopPropagation(),a=new CustomEvent("action:"+d.action,{bubbles:!0,detail:e,cancelable:!0}),a=!e.target.dispatchEvent(a),(!1!==d.preventDefault||a)&&e.preventDefault())};
f.c=function(a,e,d,h){return Object(b.c)(a,"action:"+e,d,h)};var b=c(0);n=c(171);var m=function(){function a(a,d){for(var e=0;e<d.length;e++){var b=d[e];b.enumerable=b.enumerable||!1;b.configurable=!0;"value"in b&&(b.writable=!0);Object.defineProperty(a,b.key,b)}}return function(e,d,b){d&&a(e.prototype,d);b&&a(e,b);return e}}(),u=function e(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return e(a,b,c)}else{if("value"in
d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},v;(function(a){a[a.CONTROL=1]="CONTROL";a[a.ALT=2]="ALT";a[a.META=4]="META";a[a.SHIFT=8]="SHIFT"})(v||(v={}));var t=function(e){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var a=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:
a}p(d,e);m(d,[{key:"setFromObject",value:function(a){for(var d=$jscomp.makeIterator(Object.keys(a)),e=d.next();!e.done;e=d.next())e=e.value,this.set(e,q(a[e]))}},{key:"set",value:function(e,b){b=q(b);e=$jscomp.makeIterator(a(e));for(var h=e.next();!h.done;h=e.next())h=h.value,u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"set",this).call(this,h,b)}},{key:"delete",value:function(e){e=$jscomp.makeIterator(a(e));for(var b=e.next();!b.done;b=e.next())b=b.value,u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"delete",this).call(this,b)}}],[{key:"fromObject",value:function(a,e){e=void 0===e?{}:e;var b=new d;b.label=e.label;if(void 0!==e.parents){e=$jscomp.makeIterator(e.parents);for(var h=e.next();!h.done;h=e.next()){var c=$jscomp.makeIterator(h.value);h=c.next().value;c=c.next().value;b.addParent(h,c)}}e=$jscomp.makeIterator(Object.keys(a));for(h=e.next();!h.done;h=e.next())h=h.value,b.set(h,q(a[h]));return b}}]);return d}(n.a),l=[];l[Event.AT_TARGET]="at";l[Event.CAPTURING_PHASE]="capture";l[Event.BUBBLING_PHASE]=
"bubble"},function(n,f,c){(function(f){var k=c(123),q=function(){};"production"!==f.env.NODE_ENV&&(q=c(7)("sockjs-client:utils:url"));n.exports={getOrigin:function(a){if(!a)return null;a=new k(a);if("file:"===a.protocol)return null;var b=a.port;b||(b="https:"===a.protocol?"443":"80");return a.protocol+"//"+a.hostname+":"+b},isOriginEqual:function(a,b){var c=this.getOrigin(a)===this.getOrigin(b);q("same",a,b,c);return c},isSchemeEqual:function(a,b){return a.split(":")[0]===b.split(":")[0]},addPath:function(a,
b){a=a.split("?");return a[0]+b+(a[1]?"?"+a[1]:"")},addQuery:function(a,b){return a+(-1===a.indexOf("?")?"?"+b:"&"+b)}}}).call(f,c(6))},function(n,f,c){c.d(f,"a",function(){return u});var p=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}(),k=new Uint32Array(2),q=[];for(n=2;36>=n;++n){f=Math.floor(32/Math.log2(n));
c=Math.pow(n,f);var a=Math.floor(f/2),b=Math.pow(n,a);a=Math.pow(n,f-a);var m="^[0-"+String.fromCharCode(48+Math.min(9,n-1));10<n&&(m+="a-"+String.fromCharCode(97+n-11),m+="A-"+String.fromCharCode(65+n-11));m+="]{1,"+Math.ceil(64/Math.log2(n))+"}$";q[n]={lowDigits:f,lowBase:c,lowBase1:b,lowBase2:a,pattern:new RegExp(m)}}var u=function(){function a(b,c){b=void 0===b?0:b;c=void 0===c?0:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.low=b;this.high=c}p(a,[{key:"clone",
value:function(){return new a(this.low,this.high)}},{key:"assign",value:function(a){this.low=a.low;this.high=a.high}},{key:"toString",value:function(a){a=void 0===a?10:a;var b=this.low,c=this.high;if(0===c)return b.toString(a);c*=4294967296;var e=q[a],d=e.lowBase;e=e.lowDigits;var h=c%d;c=Math.floor(c/d);b+=h;c+=Math.floor(b/d);b=(b%d).toString(a);return c.toString(a)+"0".repeat(e-b.length)+b}},{key:"tryParseString",value:function(a,b){b=void 0===b?10:b;var c=q[b],e=c.lowDigits,d=c.lowBase,h=c.lowBase1,
r=c.lowBase2;if(!c.pattern.test(a))return!1;if(a.length<=e)return this.low=parseInt(a,b),this.high=0,!0;e=a.length-e;c=parseInt(a.substr(e),b);a=parseInt(a.substr(0,e),b);d=Math.floor(a*d/4294967296);h=c+a%4294967296*h%4294967296*r%4294967296;4294967296<h&&(++d,h-=4294967296);if(h>>>0!==h||d>>>0!==d)return!1;this.low=h;this.high=d;return!0}},{key:"parseString",value:function(a,b){if(!this.tryParseString(a,void 0===b?10:b))throw Error("Failed to parse string as uint64 value: "+JSON.stringify(a)+".");
return this}},{key:"valid",value:function(){var a=this.low,b=this.high;return a>>>0===a&&b>>>0===b}},{key:"toJSON",value:function(){return this.toString()}},{key:"lshift",value:function(b){b&=63;if(0==b)return this.clone();var c=this.low,g=this.high;return 32>b?new a(c<<b,g<<b|c>>>32-b):new a(0,c<<b-32)}},{key:"rshift",value:function(b){b&=63;if(0==b)return this.clone();var c=this.low,g=this.high;return 32>b?new a(c>>>b|g<<32-b,g>>b):new a(g>>b-32,0<=g?0:-1)}},{key:"or",value:function(b){return new a(this.low|
b.low,this.high|b.high)}},{key:"xor",value:function(b){return new a(this.low^b.low,this.high^b.high)}},{key:"and",value:function(b){return new a(this.low&b.low,this.high&b.high)}}],[{key:"less",value:function(a,b){return a.high<b.high||a.high===b.high&&a.low<b.low}},{key:"compare",value:function(a,b){return a.high-b.high||a.low-b.low}},{key:"equal",value:function(a,b){return a.low===b.low&&a.high===b.high}},{key:"min",value:function(b,c){return a.less(b,c)?b:c}},{key:"random",value:function(){crypto.getRandomValues(k);
return new a(k[0],k[1])}},{key:"parseString",value:function(b,c){c=void 0===c?10:c;return(new a).parseString(b,c)}}]);return a}();u.ZERO=new u(0,0)},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+
typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}c.d(f,"e",function(){return d});c.d(f,"h",function(){return h});c.d(f,"g",function(){return r});c.d(f,"f",function(){return B});c.d(f,"c",function(){return C});c.d(f,"a",function(){return D});c.d(f,"d",function(){return z});c.d(f,"b",function(){return y});f.i=function(a,d,b){return b.registerDisposer(new E(a,d,function(a){var d=
a.redrawNeeded.add(function(){return b.scheduleRedraw()});b.scheduleRedraw();return function(){d();b.scheduleRedraw()}},b.visibility))};n=c(9);var a=c.n(n);n=c(96);var b=c.n(n);n=c(0);var m=c(1),u=c(4),v=c(165),t=c(19),l=c(44),g=function G(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return G(a,d,b)}else{if("value"in e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}},e=function(){function a(a,d){for(var b=
0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),d=function(a){function d(){p(this,d);var a=k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.ready=!1;a.layerChanged=new u.a;a.redrawNeeded=new u.a;a.readyStateChanged=new u.a;a.voxelSize=null;a.boundingBox=null;return a}q(d,a);e(d,[{key:"setReady",value:function(a){this.ready=
a;this.readyStateChanged.dispatch();this.layerChanged.dispatch()}},{key:"handleAction",value:function(a){}},{key:"getValueAt",value:function(a){}},{key:"transformPickedValue",value:function(a,d){return a}},{key:"updateMouseState",value:function(a,d,b){}}]);return d}(n.a),h=function(a){function d(){p(this,d);var a=k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.visibility=new l.a;return a}q(d,a);return d}(d),r=function(a){function d(){p(this,d);return k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,
arguments))}q(d,a);e(d,[{key:"onShow",value:function(){}},{key:"onHide",value:function(){}}]);return d}(n.a),B=function(a){function d(a){a=void 0===a?[]:a;p(this,d);var b=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.layersChanged=new u.a;b.readyStateChanged=new u.a;b.specificationChanged=new u.a;b.renderLayers=[];a.forEach(b.addRenderLayer.bind(b));return b}q(d,a);e(d,[{key:"addRenderLayer",value:function(a){this.renderLayers.push(a);var d=this.layersChanged,b=this.readyStateChanged;
this.registerDisposer(a);this.registerDisposer(a.layerChanged.add(d.dispatch));this.registerDisposer(a.readyStateChanged.add(b.dispatch));b.dispatch();d.dispatch()}},{key:"getValueAt",value:function(a,d){var b=this.renderLayers,e=d.pickedRenderLayer;if(null!==e&&-1!==b.indexOf(e)){var h=e.transformPickedValue(d.pickedValue,d.pickedOffset);return this.transformPickedValue(h)}d=$jscomp.makeIterator(b);for(b=d.next();!b.done&&(b=b.value,!b.ready||(h=b.getValueAt(a),void 0===h));b=d.next());return this.transformPickedValue(h)}},
{key:"transformPickedValue",value:function(a){return a}},{key:"toJSON",value:function(){return null}},{key:"makeDropdown",value:function(a){}},{key:"handleAction",value:function(a){}}]);return d}(n.a),C=function(a){function d(a,b,e){b=void 0===b?null:b;e=void 0===e?!0:e;p(this,d);var h=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));h.name=a;h.visible=e;h.readyStateChanged=new u.a;h.layerChanged=new u.a;h.specificationChanged=new u.a;h.wasDisposed=!1;h.layer_=null;h.layer=b;return h}q(d,
a);e(d,[{key:"handleLayerChanged",value:function(){this.visible&&this.layerChanged.dispatch()}},{key:"setVisible",value:function(a){a!==this.visible&&(this.visible=a,this.layerChanged.dispatch())}},{key:"disposed",value:function(){this.wasDisposed=!0;this.layer=null;g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"layer",get:function(){return this.layer_},set:function(a){var d=this,b=this.layer_;null!=b&&(this.unregisterUserLayer(),b.dispose());this.layer_=
a;if(null!=a){var e=[a.layersChanged.add(function(){return d.handleLayerChanged()}),a.readyStateChanged.add(this.readyStateChanged.dispatch),a.specificationChanged.add(this.specificationChanged.dispatch)];this.unregisterUserLayer=function(){e.forEach(function(a){return a()})};this.readyStateChanged.dispatch();this.handleLayerChanged()}}}]);return d}(n.a),D=function(d){function b(){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.managedLayers=[];d.layersChanged=new u.a;
d.readyStateChanged=new u.a;d.specificationChanged=new u.a;d.boundPositions=new WeakSet;d.numDirectUsers=0;d.scheduleRemoveLayersWithSingleRef=d.registerCancellable(a()(function(){return d.removeLayersWithSingleRef()},0));d.layersChanged.add(d.scheduleRemoveLayersWithSingleRef);return d}q(b,d);e(b,[{key:"filter",value:function(a){var d=this,b=!1;this.managedLayers=this.managedLayers.filter(function(e){return a(e)?!0:(d.unbindManagedLayer(e),b=!0,!1)});b&&this.layersChanged.dispatch()}},{key:"removeLayersWithSingleRef",
value:function(){0<this.numDirectUsers||this.filter(function(a){return 1!==a.refCount})}},{key:"updateSignalBindings",value:function(a,d){d(a.layerChanged,this.layersChanged.dispatch);d(a.readyStateChanged,this.readyStateChanged.dispatch);d(a.specificationChanged,this.specificationChanged.dispatch)}},{key:"useDirectly",value:function(){var a=this;1===++this.numDirectUsers&&this.layersChanged.remove(this.scheduleRemoveLayersWithSingleRef);return function(){0===--a.numDirectUsers&&(a.layersChanged.add(a.scheduleRemoveLayersWithSingleRef),
a.scheduleRemoveLayersWithSingleRef())}}},{key:"addManagedLayer",value:function(a,d){this.updateSignalBindings(a,v.a);void 0===d&&(d=this.managedLayers.length);this.managedLayers.splice(d,0,a);this.layersChanged.dispatch();this.readyStateChanged.dispatch();return a}},{key:"addUserLayer",value:function(a,d,b){a=new C(a,d,b);return this.addManagedLayer(a)}},{key:"readyRenderLayers",value:function(){function a(a,m){for(;;)switch(d){case 0:r=$jscomp.makeIterator(l.managedLayers),g=r.next();case 1:if(g.done){d=
3;break}c=g.value;if(c.visible&&c.layer){d=4;break}d=2;break;case 4:h=$jscomp.makeIterator(c.layer.renderLayers),e=h.next();case 5:if(e.done){d=7;break}b=e.value;if(b.ready){d=8;break}d=6;break;case 8:return d=9,{value:b,done:!1};case 9:if(void 0===m){d=10;break}d=-1;throw m;case 10:case 6:e=h.next();d=5;break;case 7:case 2:g=r.next();d=1;break;case 3:d=-1;default:return{value:void 0,done:!0}}}var d=0,b,e,h,c,g,r,l=this,m={next:function(d){return a(d,void 0)},throw:function(d){return a(void 0,d)},
return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();m[Symbol.iterator]=function(){return this};return m}},{key:"unbindManagedLayer",value:function(a){this.updateSignalBindings(a,v.b);a.dispose()}},{key:"clear",value:function(){for(var a=$jscomp.makeIterator(this.managedLayers),d=a.next();!d.done;d=a.next())this.unbindManagedLayer(d.value);this.managedLayers.length=0;this.layersChanged.dispatch()}},{key:"remove",value:function(a){this.unbindManagedLayer(this.managedLayers[a]);
this.managedLayers.splice(a,1);this.layersChanged.dispatch()}},{key:"removeManagedLayer",value:function(a){a=this.managedLayers.indexOf(a);if(-1===a)throw Error("Internal error: invalid managed layer.");this.remove(a)}},{key:"reorderManagedLayer",value:function(a,d){var b=this.managedLayers.length;a===d||0>a||a>=b||0>d||d>=b||(a=$jscomp.makeIterator(this.managedLayers.splice(a,1)).next().value,this.managedLayers.splice(d,0,a),this.layersChanged.dispatch())}},{key:"disposed",value:function(){this.clear();
g(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"getLayerByName",value:function(a){return this.managedLayers.find(function(d){return d.name===a})}},{key:"getUniqueLayerName",value:function(a){for(var d=a,b=0;void 0!==this.getLayerByName(d);)d=a+ ++b;return d}},{key:"has",value:function(a){return-1!==this.managedLayers.indexOf(a)}},{key:"initializePosition",value:function(d){var b=this,e=this.boundPositions;e.has(d)||(e.add(d),e=a()(function(){b.updatePositionFromLayers(d)}),
this.readyStateChanged.add(e),d.changed.add(e),this.updatePositionFromLayers(d))}},{key:"updatePositionFromLayers",value:function(a){if(!a.valid)for(var d=$jscomp.makeIterator(this.managedLayers),b=d.next();!b.done;b=d.next())if(b=b.value.layer,null!=b){b=$jscomp.makeIterator(b.renderLayers);for(var e=b.next();!e.done;e=b.next())if(e=e.value,e.ready&&(a.voxelSize.valid||null==e.voxelSize||(m.p.copy(a.voxelSize.size,e.voxelSize),a.voxelSize.setValid()),!a.spatialCoordinatesValid&&!a.voxelCoordinatesValid&&
null!=e.boundingBox)){e=e.boundingBox;var h=a.spatialCoordinates;m.p.add(h,e.lower,e.upper);m.p.scale(h,h,.5);a.spatialCoordinatesValid=!0;a.changed.dispatch()}}}},{key:"invokeAction",value:function(a){for(var d=$jscomp.makeIterator(this.managedLayers),b=d.next();!b.done;b=d.next())if(b=b.value,null!==b.layer&&b.visible){b=b.layer;b.handleAction(a);b=$jscomp.makeIterator(b.renderLayers);for(var e=b.next();!e.done;e=b.next())e=e.value,e.ready&&e.handleAction(a)}}},{key:"renderLayers",get:function(){var a=
this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var d={};return d[Symbol.iterator]=function(){function d(d,m){for(;;)switch(b){case 0:l=$jscomp.makeIterator(a.managedLayers),r=l.next();case 1:if(r.done){b=3;break}g=r.value;if(null!==g.layer){b=4;break}b=2;break;case 4:c=$jscomp.makeIterator(g.layer.renderLayers),h=c.next();case 5:if(h.done){b=7;break}e=h.value;b=8;return{value:e,done:!1};case 8:if(void 0===m){b=9;break}b=-1;throw m;case 9:case 6:h=c.next();b=5;break;case 7:case 2:r=l.next();
b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,e,h,c,g,r,l,m={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();m[Symbol.iterator]=function(){return this};return m},d}},{key:"visibleRenderLayers",get:function(){var a=this;$jscomp.initSymbol();$jscomp.initSymbolIterator();var d={};return d[Symbol.iterator]=function(){function d(d,m){for(;;)switch(b){case 0:l=$jscomp.makeIterator(a.managedLayers),
r=l.next();case 1:if(r.done){b=3;break}g=r.value;if(null!==g.layer&&g.visible){b=4;break}b=2;break;case 4:c=$jscomp.makeIterator(g.layer.renderLayers),h=c.next();case 5:if(h.done){b=7;break}e=h.value;b=8;return{value:e,done:!1};case 8:if(void 0===m){b=9;break}b=-1;throw m;case 9:case 6:h=c.next();b=5;break;case 7:case 2:r=l.next();b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,e,h,c,g,r,l,m={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();m[Symbol.iterator]=function(){return this};return m},d}}]);return b}(n.a),z=function(){function a(){var d=this;p(this,a);this.changed=new u.a;this.position=m.p.create();this.active=!1;this.pickedRenderLayer=null;this.pickedValue=new t.a(0,0);this.pickedOffset=0;this.updater=void 0;this.stale=!1;this.triggerUpdate=b()(function(){d.update()},50,{leading:!0,trailing:!0})}e(a,[{key:"updateUnconditionally",value:function(){this.triggerUpdate.cancel();this.update();return this.active}},
{key:"updateIfStale",value:function(){this.stale&&this.update()}},{key:"update",value:function(){var a=this.updater;this.stale=!1;a?this.setActive(a(this)):this.setActive(!1)}},{key:"setActive",value:function(a){this.stale=!1;if(this.active!==a||!0===a)this.active=a,this.changed.dispatch()}}]);return a}(),y=function(a){function d(a,b){p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.layerManager=a;e.mouseState=b;e.values=new Map;e.changed=new u.a;e.needsUpdate=!0;e.registerDisposer(b.changed.add(function(){e.handleChange()}));
e.registerDisposer(a.layersChanged.add(function(){e.handleLayerChange()}));return e}q(d,a);e(d,[{key:"handleLayerChange",value:function(){this.mouseState.active&&this.handleChange()}},{key:"handleChange",value:function(){this.needsUpdate=!0;this.changed.dispatch()}},{key:"update",value:function(){if(this.needsUpdate){this.needsUpdate=!1;var a=this.values,d=this.mouseState;a.clear();if(d.active)for(var b=d.position,e=$jscomp.makeIterator(this.layerManager.managedLayers),h=e.next();!h.done;h=e.next()){h=
h.value;var c=h.layer;h.visible&&c&&a.set(c,c.getValueAt(b,d))}}}},{key:"get",value:function(a){this.update();return this.values.get(a)}},{key:"toJSON",value:function(){this.update();for(var a={},d=this.values,b=$jscomp.makeIterator(this.layerManager.managedLayers),e=b.next();!e.done;e=b.next()){e=e.value;var h=e.layer;h&&(h=d.get(h),void 0!==h&&(h instanceof t.a&&(h={t:"u64",v:h}),a[e.name]=h))}return a}}]);return d}(n.a),E=function(a){function d(a,e,h,c){p(this,d);var g=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
g.layerManager=a;g.renderLayerType=e;g.layerAdded=h;g.visibility=c;g.visibleLayers=new Map;g.newVisibleLayers=new Set;g.throttledUpdateVisibleLayers=b()(function(){g.updateVisibleLayers()},0);g.registerDisposer(a.layersChanged.add(function(){g.handleLayersChanged()}));g.updateVisibleLayers();return g}q(d,a);e(d,[{key:"handleLayersChanged",value:function(){this.throttledUpdateVisibleLayers()}},{key:"disposed",value:function(){this.throttledUpdateVisibleLayers.cancel();this.visibleLayers.forEach(function(a){return a()});
this.visibleLayers.clear();g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"updateVisibleLayers",value:function(){for(var a=this.visibleLayers,d=this.newVisibleLayers,b=this.renderLayerType,e=this.layerAdded,h={},c=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),g=c.next();!g.done;h={disposer:h.disposer,visibilityDisposer:h.visibilityDisposer,typedLayer:h.typedLayer},g=c.next())g=g.value,g instanceof b&&(h.typedLayer=g,d.add(h.typedLayer),
a.has(h.typedLayer)||(h.visibilityDisposer=h.typedLayer.visibility.add(this.visibility),h.disposer=e(h.typedLayer),a.set(h.typedLayer.addRef(),function(a){return function(){a.disposer();a.visibilityDisposer();a.typedLayer.dispose()}}(h))));b=$jscomp.makeIterator(a);for(e=b.next();!e.done;e=b.next())h=$jscomp.makeIterator(e.value),e=h.next().value,h=h.next().value,d.has(e)||(a.delete(e),h());d.clear()}},{key:"getVisibleLayers",value:function(){this.throttledUpdateVisibleLayers.flush();return[].concat($jscomp.arrayFromIterable(this.visibleLayers.keys()))}}]);
return d}(n.a)},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function a(a,d){for(var b=$jscomp.makeIterator(t),e=b.next();!e.done;e=b.next())if(e=e.value,e=e(a,d),null!=e)return e;throw Error("No chunk format handler found.");}f.c=function(a){t.push(a)};c.d(f,"b",function(){return l});c.d(f,"a",function(){return g});n=c(46);var b=c(1),m=function(){function a(a,b){for(var d=0;d<b.length;d++){var e=b[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&
(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),u=b.p.create(),v=b.p.create(),t=[],l=function(e){function d(b,e){p(this,d);e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,e));e.chunkFormatHandler=e.registerDisposer(a(b.chunkQueueManager.gl,e.spec));return e}q(d,e);m(d,[{key:"getValueAt",value:function(a){var d=this.spec,e=d.chunkLayout,h=e.size;e.globalToLocalSpatial(v,a);for(a=0;3>a;++a)u[a]=Math.floor(v[a]/h[a]);a=
Object(b.q)(u);a=this.chunks.get(a);if(!a)return null;e=d.voxelSize;for(var c=0;3>c;++c)u[c]=Math.floor((v[c]-u[c]*h[c])/e[c]);h=a.chunkDataSize;for(e=0;3>e;++e)if(u[e]>=h[e])return;d=d.numChannels;if(1===d)return a.getChannelValueAt(u,0);h=Array(d);for(e=0;e<d;++e)h[e]=a.getChannelValueAt(u,e);return h}},{key:"getChunk",value:function(a){return this.chunkFormatHandler.getChunk(this,a)}},{key:"chunkFormat",get:function(){return this.chunkFormatHandler.chunkFormat}}]);return d}(n.c),g=function(a){function d(a,
b){p(this,d);return k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b))}q(d,a);m(d,[{key:"chunkFormat",get:function(){return this.source.chunkFormat}}]);return d}(n.b)},function(n,f,c){c.d(f,"a",function(){return p});f.b=1E-6;var p="undefined"!==typeof Float32Array?Float32Array:Array;f.c=Math.random},function(n,f,c){f.a=function(c){if(c instanceof Object){var a=c[p];void 0===a&&(a=c[p]=k++);return"o"+a}return""+JSON.stringify(c)};$jscomp.initSymbol();var p=Symbol("objectId"),k=0},function(n,
f,c){c.d(f,"a",function(){return q});var p=c(29),k=function(){function a(a,c){for(var b=0;b<c.length;b++){var m=c[b];m.enumerable=m.enumerable||!1;m.configurable=!0;"value"in m&&(m.writable=!0);Object.defineProperty(a,m.key,m)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),q=function(){function a(b,c){c=void 0===c?p.a:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.gl=b;this.bufferType=c;this.gl=b;this.buffer=b.createBuffer()}k(a,[{key:"bind",
value:function(){this.gl.bindBuffer(this.bufferType,this.buffer)}},{key:"bindToVertexAttrib",value:function(a,c,f,v,t,l){f=void 0===f?p.c:f;v=void 0===v?!1:v;t=void 0===t?0:t;l=void 0===l?0:l;this.bind();this.gl.enableVertexAttribArray(a);this.gl.vertexAttribPointer(a,c,f,v,t,l)}},{key:"setData",value:function(a,c){c=void 0===c?p.k:c;var b=this.gl;this.bind();b.bufferData(this.bufferType,a,c)}},{key:"dispose",value:function(){this.gl.deleteBuffer(this.buffer);this.gl=this.buffer=void 0}}],[{key:"fromData",
value:function(b,c,f,v){b=new a(b,f);b.setData(c,v);return b}}]);return a}()},function(n,f,c){f.b=function(c,a){k.set(c,a)};f.a=function(c){for(var a=new p.b,b=$jscomp.makeIterator(k),m=b.next();!m.done;m=b.next()){var f=$jscomp.makeIterator(m.value);m=f.next().value;f=f.next().value;a.register(m,f(c))}return a};var p=c(28),k=new Map},function(n,f,c){(function(p,k){var q;(function(){function a(d,b){function e(a){var d;if(e[a]!==q)return e[a];if("bug-string-char-index"==a)var g=!1;else if("json"==
a)g=e("json-stringify")&&e("json-parse");else{var l;if("json-stringify"==a){g=b.stringify;var m="function"==typeof g&&p;if(m){(l=function(){return 1}).toJSON=l;try{m="0"===g(0)&&"0"===g(new h)&&'""'==g(new c)&&g(u)===q&&g(q)===q&&g()===q&&"1"===g(l)&&"[1]"==g([l])&&"[null]"==g([q])&&"null"==g(null)&&"[null,null,null]"==g([q,u,null])&&'{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'==g({a:[l,!0,!1,null,"\x00\b\n\f\r\t"]})&&"1"===g(null,l)&&"[\n 1,\n 2\n]"==g([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==
g(new r(-864E13))&&'"+275760-09-13T00:00:00.000Z"'==g(new r(864E13))&&'"-000001-01-01T00:00:00.000Z"'==g(new r(-621987552E5))&&'"1969-12-31T23:59:59.999Z"'==g(new r(-1))}catch(ab){m=!1}}g=m}if("json-parse"==a){g=b.parse;if("function"==typeof g)try{if(0===g("0")&&!g(!1)&&(l=g('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'),d=5==l.a.length&&1===l.a[0])){try{d=!g('"\t"')}catch(ab){}if(d)try{d=1!==g("01")}catch(ab){}if(d)try{d=1!==g("1.")}catch(ab){}}}catch(ab){d=!1}g=d}}return e[a]=!!g}d||(d=v.Object());
b||(b=v.Object());var h=d.Number||v.Number,c=d.String||v.String,g=d.Object||v.Object,r=d.Date||v.Date,l=d.SyntaxError||v.SyntaxError,f=d.TypeError||v.TypeError,t=d.Math||v.Math;d=d.JSON||v.JSON;"object"==typeof d&&d&&(b.stringify=d.stringify,b.parse=d.parse);g=g.prototype;var u=g.toString,k,q,p=new r(-0xc782b5b800cec);try{p=-109252==p.getUTCFullYear()&&0===p.getUTCMonth()&&1===p.getUTCDate()&&10==p.getUTCHours()&&37==p.getUTCMinutes()&&6==p.getUTCSeconds()&&708==p.getUTCMilliseconds()}catch(Ib){}if(!e("json")){var n=
e("bug-string-char-index");if(!p){var N=t.floor;var V=[0,31,59,90,120,151,181,212,243,273,304,334];var T=function(a,d){return V[d]+365*(a-1970)+N((a-1969+(d=+(1<d)))/4)-N((a-1901+d)/100)+N((a-1601+d)/400)}}(k=g.hasOwnProperty)||(k=function(a){var d={};if((d.__proto__=null,d.__proto__={toString:1},d).toString!=u)k=function(a){var d=this.__proto__;a=a in(this.__proto__=null,this);this.__proto__=d;return a};else{var b=d.constructor;k=function(a){var d=(this.constructor||b).prototype;return a in this&&
!(a in d&&this[a]===d[a])}}d=null;return k.call(this,a)});var L=function(a,d){var b=0,e,h;(e=function(){this.valueOf=0}).prototype.valueOf=0;var c=new e;for(h in c)k.call(c,h)&&b++;e=c=null;b?L=2==b?function(a,d){var b={},e="[object Function]"==u.call(a),h;for(h in a)e&&"prototype"==h||k.call(b,h)||!(b[h]=1)||!k.call(a,h)||d(h)}:function(a,d){var b="[object Function]"==u.call(a),e,h;for(e in a)b&&"prototype"==e||!k.call(a,e)||(h="constructor"===e)||d(e);(h||k.call(a,e="constructor"))&&d(e)}:(c="valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor".split(" "),
L=function(a,d){var b="[object Function]"==u.call(a),e,h=!b&&"function"!=typeof a.constructor&&m[typeof a.hasOwnProperty]&&a.hasOwnProperty||k;for(e in a)b&&"prototype"==e||!h.call(a,e)||d(e);for(b=c.length;e=c[--b];h.call(a,e)&&d(e));});return L(a,d)};if(!e("json-stringify")){var S={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},Y=function(a,d){return("000000"+(d||0)).slice(-a)},ha=function(a){for(var d='"',b=0,e=a.length,h=!n||10<e,c=h&&(n?a.split(""):a);b<e;b++){var g=a.charCodeAt(b);
switch(g){case 8:case 9:case 10:case 12:case 13:case 34:case 92:d+=S[g];break;default:d=32>g?d+("\\u00"+Y(2,g.toString(16))):d+(h?c[b]:a.charAt(b))}}return d+'"'},I=function(a,d,b,e,h,c,g){var r;try{var l=d[a]}catch(Zd){}if("object"==typeof l&&l){var m=u.call(l);if("[object Date]"!=m||k.call(l,"toJSON"))"function"==typeof l.toJSON&&("[object Number]"!=m&&"[object String]"!=m&&"[object Array]"!=m||k.call(l,"toJSON"))&&(l=l.toJSON(a));else if(l>-1/0&&l<1/0){if(T){var t=N(l/864E5);for(m=N(t/365.2425)+
1970-1;T(m+1,0)<=t;m++);for(r=N((t-T(m,0))/30.42);T(m,r+1)<=t;r++);t=1+t-T(m,r);var A=(l%864E5+864E5)%864E5;var G=N(A/36E5)%24;var v=N(A/6E4)%60;var B=N(A/1E3)%60;A%=1E3}else m=l.getUTCFullYear(),r=l.getUTCMonth(),t=l.getUTCDate(),G=l.getUTCHours(),v=l.getUTCMinutes(),B=l.getUTCSeconds(),A=l.getUTCMilliseconds();l=(0>=m||1E4<=m?(0>m?"-":"+")+Y(6,0>m?-m:m):Y(4,m))+"-"+Y(2,r+1)+"-"+Y(2,t)+"T"+Y(2,G)+":"+Y(2,v)+":"+Y(2,B)+"."+Y(3,A)+"Z"}else l=null}b&&(l=b.call(d,a,l));if(null===l)return"null";m=u.call(l);
if("[object Boolean]"==m)return""+l;if("[object Number]"==m)return l>-1/0&&l<1/0?""+l:"null";if("[object String]"==m)return ha(""+l);if("object"==typeof l){for(a=g.length;a--;)if(g[a]===l)throw f();g.push(l);var H=[];d=c;c+=h;if("[object Array]"==m){r=0;for(a=l.length;r<a;r++)m=I(r,l,b,e,h,c,g),H.push(m===q?"null":m);a=H.length?h?"[\n"+c+H.join(",\n"+c)+"\n"+d+"]":"["+H.join(",")+"]":"[]"}else L(e||l,function(a){var d=I(a,l,b,e,h,c,g);d!==q&&H.push(ha(a)+":"+(h?" ":"")+d)}),a=H.length?h?"{\n"+c+H.join(",\n"+
c)+"\n"+d+"}":"{"+H.join(",")+"}":"{}";g.pop();return a}};b.stringify=function(a,d,b){var e;if(m[typeof d]&&d)if("[object Function]"==(e=u.call(d)))var h=d;else if("[object Array]"==e){var c={};for(var g=0,r=d.length,l;g<r;l=d[g++],(e=u.call(l),"[object String]"==e||"[object Number]"==e)&&(c[l]=1));}if(b)if("[object Number]"==(e=u.call(b))){if(0<(b-=b%1)){var f="";for(10<b&&(b=10);f.length<b;f+=" ");}}else"[object String]"==e&&(f=10>=b.length?b:b.slice(0,10));return I("",(l={},l[""]=a,l),h,c,f,"",
[])}}if(!e("json-parse")){var P=c.fromCharCode,Na={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},M,Oa,da=function(){M=Oa=null;throw l();},O=function(){for(var a=Oa,d=a.length,b,e,h,c,g;M<d;)switch(g=a.charCodeAt(M),g){case 9:case 10:case 13:case 32:M++;break;case 123:case 125:case 91:case 93:case 58:case 44:return b=n?a.charAt(M):a[M],M++,b;case 34:b="@";for(M++;M<d;)if(g=a.charCodeAt(M),32>g)da();else if(92==g)switch(g=a.charCodeAt(++M),g){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:b+=
Na[g];M++;break;case 117:e=++M;for(h=M+4;M<h;M++)g=a.charCodeAt(M),48<=g&&57>=g||97<=g&&102>=g||65<=g&&70>=g||da();b+=P("0x"+a.slice(e,M));break;default:da()}else{if(34==g)break;g=a.charCodeAt(M);for(e=M;32<=g&&92!=g&&34!=g;)g=a.charCodeAt(++M);b+=a.slice(e,M)}if(34==a.charCodeAt(M))return M++,b;da();default:e=M;45==g&&(c=!0,g=a.charCodeAt(++M));if(48<=g&&57>=g){for(48==g&&(g=a.charCodeAt(M+1),48<=g&&57>=g)&&da();M<d&&(g=a.charCodeAt(M),48<=g&&57>=g);M++);if(46==a.charCodeAt(M)){for(h=++M;h<d&&(g=
a.charCodeAt(h),48<=g&&57>=g);h++);h==M&&da();M=h}g=a.charCodeAt(M);if(101==g||69==g){g=a.charCodeAt(++M);43!=g&&45!=g||M++;for(h=M;h<d&&(g=a.charCodeAt(h),48<=g&&57>=g);h++);h==M&&da();M=h}return+a.slice(e,M)}c&&da();if("true"==a.slice(M,M+4))return M+=4,!0;if("false"==a.slice(M,M+5))return M+=5,!1;if("null"==a.slice(M,M+4))return M+=4,null;da()}return"$"},Sa=function(a){var d,b;"$"==a&&da();if("string"==typeof a){if("@"==(n?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(d=[];;b||(b=!0)){a=O();
if("]"==a)break;b&&(","==a?(a=O(),"]"==a&&da()):da());","==a&&da();d.push(Sa(a))}return d}if("{"==a){for(d={};;b||(b=!0)){a=O();if("}"==a)break;b&&(","==a?(a=O(),"}"==a&&da()):da());","!=a&&"string"==typeof a&&"@"==(n?a.charAt(0):a[0])&&":"==O()||da();d[a.slice(1)]=Sa(O())}return d}da()}return a},Ta=function(a,d,b){b=za(a,d,b);b===q?delete a[d]:a[d]=b},za=function(a,d,b){var e=a[d],h;if("object"==typeof e&&e)if("[object Array]"==u.call(e))for(h=e.length;h--;)Ta(e,h,b);else L(e,function(a){Ta(e,a,
b)});return b.call(a,d,e)};b.parse=function(a,d){var b;M=0;Oa=""+a;a=Sa(O());"$"!=O()&&da();M=Oa=null;return d&&"[object Function]"==u.call(d)?za((b={},b[""]=a,b),"",d):a}}}b.runInContext=a;return b}var b=c(248),m={"function":!0,object:!0},u=m[typeof f]&&f&&!f.nodeType&&f,v=m[typeof window]&&window||this,t=u&&m[typeof p]&&p&&!p.nodeType&&"object"==typeof k&&k;!t||t.global!==t&&t.window!==t&&t.self!==t||(v=t);if(u&&!b)a(v,u);else{var l=v.JSON,g=v.JSON3,e=!1;var d=a(v,v.JSON3={noConflict:function(){e||
(e=!0,v.JSON=l,v.JSON3=g,l=g=null);return d}});v.JSON={parse:d.parse,stringify:d.stringify}}b&&!(q=d,void 0!==q&&(p.exports=q))}).call(this)}).call(f,c(247)(n),c(5))},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"b",function(){return m});c.d(f,"c",function(){return u});f.d=function(a,c){return new Promise(function(l,g){if(a===b)c(l,g,b);else{var e=new m,d=a.add(function(){e.cancel()});c(function(a){d();l(a)},function(a){d();g(a)},e)}})};var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,
c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}();n=new (function(){function a(){k(this,a);this.name="CancellationError";this.message="CANCELED"}q(a,[{key:"toString",value:function(){return"CANCELED"}}]);return a}());f.a=n;var a=function(){},b={isCanceled:!1,add:function(){return a},remove:a};f.e=b;var m=function(){function b(){k(this,b)}q(b,[{key:"cancel",value:function(){var a=this.handlers;if(null!==a&&(this.handlers=null,void 0!==a)){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())b=
b.value,b()}}},{key:"add",value:function(b){var c=this,g=this.handlers;if(null===g)return b(),a;void 0===g&&(g=this.handlers=new Set);g.add(b);return function(){c.remove(b)}}},{key:"remove",value:function(a){var b=this.handlers;null!=b&&b.delete(a)}},{key:"isCanceled",get:function(){return null===this.handlers}}]);return b}(),u=function(a){function c(){k(this,c);var a=(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.consumers=new Set;return a}p(c,a);q(c,[{key:"addConsumer",value:function(a){var c=this;a=void 0===a?b:a;var e=this.consumers;e.has(a)||a.isCanceled||(e.add(a),a.add(function(){e.delete(a);0===e.size&&c.cancel()}))}}]);return c}(m)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){void 0===b&&(b=-1===a.indexOf("/")?":":"/");a=a.lastIndexOf(b);return-1===a?0:a+1}c.d(f,"a",function(){return v});
c.d(f,"b",function(){return l});var b=c(27),m=c(42);n=c(0);var u=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,d,h){d&&a(b.prototype,d);h&&a(b,h);return b}}(),v=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(n.a),t=/^(?:([a-zA-Z-+_]+):\/\/)?(.*)$/,l=function(c){function e(){p(this,
e);var a=k(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments));a.dataSources=new Map;return a}q(e,c);u(e,[{key:"register",value:function(a,b){this.dataSources.set(a,this.registerDisposer(b))}},{key:"getDataSource",value:function(a){a=a.match(t);if(null===a||void 0===a[1])throw Error('Data source URL must have the form "<protocol>://<path>".');var d=a[1],b=this.dataSources.get(d);if(void 0===b)throw Error("Unsupported data source: "+JSON.stringify(d)+".");return[b,a[2],d]}},{key:"getVolume",
value:function(a,e,c,g){c=void 0===c?{}:c;g=void 0===g?b.e:g;e=$jscomp.makeIterator(this.getDataSource(e));var d=e.next().value,h=e.next().value;return new Promise(function(b){b(d.getVolume(a,h,c,g))})}},{key:"getVectorGraphicsSource",value:function(a,e,c,g){c=void 0===c?{}:c;g=void 0===g?b.e:g;e=$jscomp.makeIterator(this.getDataSource(e));var d=e.next().value,h=e.next().value;return new Promise(function(b){b(d.getVectorGraphicsSource(a,h,c,g))})}},{key:"getMeshSource",value:function(a,e,c){c=void 0===
c?b.e:c;e=$jscomp.makeIterator(this.getDataSource(e));var d=e.next().value,h=e.next().value;return new Promise(function(b){b(d.getMeshSource(a,h,c))})}},{key:"getSkeletonSource",value:function(a,e,c){c=void 0===c?b.e:c;e=$jscomp.makeIterator(this.getDataSource(e));var d=e.next().value,h=e.next().value;return new Promise(function(b){b(d.getSkeletonSource(a,h,c))})}},{key:"volumeCompleter",value:function(a,e,c){c=void 0===c?b.e:c;var d=a.match(t),h=d[1];if(void 0===h){e=[];c=$jscomp.makeIterator(this.dataSources);
for(d=c.next();!d.done;d=c.next()){var g=$jscomp.makeIterator(d.value);d=g.next().value;g=g.next().value;d+="://";d.startsWith(a)&&e.push({value:d,description:g.description})}return Promise.resolve({offset:0,completions:e})}a=this.dataSources.get(h);return void 0!==a&&void 0!==a.volumeCompleter?a.volumeCompleter(d[2],e,c).then(function(a){return Object(m.a)(h.length+3,a)}):Promise.reject(null)}},{key:"suggestLayerName",value:function(d){d=$jscomp.makeIterator(this.getDataSource(d));var b=d.next().value;
d=d.next().value;b=b.suggestLayerName;if(void 0!==b)return b(d);b=a(d,void 0);return d.substring(b)}},{key:"findSourceGroup",value:function(d){var b=$jscomp.makeIterator(this.getDataSource(d));d=b.next().value;var e=b.next().value;b=b.next().value;return(d.findSourceGroup||a)(e)+b.length+3}}]);return e}(n.a)},function(n,f,c){f.a=34962;f.k=35044;f.r=3317;f.t=5121;f.c=5126;f.i=6407;f.j=6408;f.f=6409;f.g=6410;f.d=35632;f.u=35633;f.h=9728;f.e=9729;f.n=10240;f.o=10241;f.p=10242;f.q=10243;f.m=3553;f.l=
33984;f.b=33071;f.s=37440},function(n,f){},function(n,f,c){c.d(f,"a",function(){return q});var p=function(){function a(a,c){for(var b=0;b<c.length;b++){var m=c[b];m.enumerable=m.enumerable||!1;m.configurable=!0;"value"in m&&(m.writable=!0);Object.defineProperty(a,m.key,m)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}();c(176);var k=null,q=function(){function a(b){b=void 0===b?!1:b;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");null===k&&(k=document.createElement("ul"),
k.id="statusContainer",document.body.appendChild(k));var c=document.createElement("li");this.element=c;!0===b&&(b=200);!1!==b?(this.setVisible(!1),this.timer=setTimeout(this.setVisible.bind(this,!0),b)):this.timer=null;k.appendChild(c)}p(a,[{key:"dispose",value:function(){k.removeChild(this.element);this.element=void 0;null!==this.timer&&clearTimeout(this.timer)}},{key:"setText",value:function(a,c){this.element.textContent=a;c&&this.setVisible(!0)}},{key:"setHTML",value:function(a,c){this.element.innerHTML=
a;c&&this.setVisible(!0)}},{key:"setVisible",value:function(a){null!==this.timer&&(clearTimeout(this.timer),this.timer=null);this.element.style.display=a?"block":"none"}}],[{key:"forPromise",value:function(b,c){var m=new a(c.delay);m.setText(c.initialMessage);var f=m.dispose.bind(m);b.then(f,function(a){m.element.textContent=(void 0===c.errorPrefix?"":c.errorPrefix)+(a instanceof Error?a.message:""+a)+"  ";a=document.createElement("button");a.textContent="Dismiss";a.addEventListener("click",function(){m.dispose()});
m.element.appendChild(a);m.setVisible(!0)});return b}},{key:"showMessage",value:function(b){var c=new a;c.element.textContent=b;c.setVisible(!0);return c}},{key:"showTemporaryMessage",value:function(a,c){c=void 0===c?2E3:c;var b=this.showMessage(a);setTimeout(function(){return b.dispose()},c);return b}}]);return a}()},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function q(a){var b=l.get(a),d=a.changed.count;if(void 0!==b&&b.generation===d)return b;if(a instanceof v){var c=a.baseJSON();for(var g=$jscomp.makeIterator(a.children),m=g.next();!m.done;m=g.next()){var f=$jscomp.makeIterator(m.value);m=f.next().value;f=f.next().value;
c[m]=q(f).value}}else c=a.toJSON();void 0===b?(b={generation:d,value:c},l.set(a,b)):(b.generation=d,b.value=c);return b}c.d(f,"a",function(){return v});c.d(f,"b",function(){return t});f.c=q;var a=c(2),b=c(4),m=function e(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return e(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},u=function(){function a(a,b){for(var d=0;d<b.length;d++){var e=
b[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),v=function(){function e(){k(this,e);this.children=new Map;this.changed=new b.a}u(e,[{key:"add",value:function(a,b){var d=this;if(this.children.has(a))throw Error("Key "+JSON.stringify(a)+" already registered.");this.children.set(a,b);b.changed.add(this.changed.dispatch);this.changed.dispatch();return function(){d.remove(a)}}},
{key:"remove",value:function(a){var d=this.children;if(d.has(a))throw Error("Key "+JSON.stringify(a)+" not registered.");d=d.get(a);this.children.delete(a);d.changed.remove(this.changed.dispatch);this.changed.dispatch()}},{key:"dispose",value:function(){for(var a=this.changed,b=$jscomp.makeIterator(this.children.values()),e=b.next();!e.done;e=b.next())e.value.changed.remove(a.dispatch);this.children=void 0}},{key:"toJSON",value:function(){for(var a=this.baseJSON(),b=$jscomp.makeIterator(this.children),
e=b.next();!e.done;e=b.next()){var c=$jscomp.makeIterator(e.value);e=c.next().value;c=c.next().value;a[e]=c.toJSON()}return a}},{key:"baseJSON",value:function(){return{}}},{key:"reset",value:function(){for(var a=$jscomp.makeIterator(this.children.values()),b=a.next();!b.done;b=a.next())b.value.reset()}},{key:"restoreState",value:function(d){Object(a.u)(d);for(var b=$jscomp.makeIterator(this.children),e=b.next();!e.done;e=b.next()){var c=$jscomp.makeIterator(e.value);e=c.next().value;c=c.next().value;
try{d.hasOwnProperty(e)&&c.restoreState(d[e])}catch(C){throw Error("Error restoring property "+JSON.stringify(e)+": "+C.message);}}}}]);return e}(),t=function(b){function d(){k(this,d);var a=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.lastState={};return a}p(d,b);u(d,[{key:"restoreState",value:function(b){Object(a.u)(b);this.lastState=
b;m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"restoreState",this).call(this,b)}},{key:"reset",value:function(){this.lastState={};m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"reset",this).call(this)}},{key:"baseJSON",value:function(){for(var a=Object.assign(m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"baseJSON",this).call(this),this.lastState),b=$jscomp.makeIterator(this.children.keys()),e=b.next();!e.done;e=b.next())delete a[e.value];return a}},{key:"toJSON",
value:function(){var a=m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"toJSON",this).call(this);return this.lastState=a}},{key:"add",value:function(a,b){var e=m(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"add",this).call(this,a,b);a=this.lastState[a];void 0!==a&&(b.reset(),b.restoreState(a));return e}}]);return d}(v),l=new WeakMap},function(n,f,c){(function(f){var k=c(40),q={},a=!1,b=f.chrome&&f.chrome.app&&f.chrome.app.runtime;n.exports={attachEvent:function(a,b){"undefined"!==
typeof f.addEventListener?f.addEventListener(a,b,!1):f.document&&f.attachEvent&&(f.document.attachEvent("on"+a,b),f.attachEvent("on"+a,b))},detachEvent:function(a,b){"undefined"!==typeof f.addEventListener?f.removeEventListener(a,b,!1):f.document&&f.detachEvent&&(f.document.detachEvent("on"+a,b),f.detachEvent("on"+a,b))},unloadAdd:function(c){if(b)return null;var m=k.string(8);q[m]=c;a&&setTimeout(this.triggerUnloadCallbacks,0);return m},unloadDel:function(a){a in q&&delete q[a]},triggerUnloadCallbacks:function(){for(var a in q)q[a](),
delete q[a]}};b||n.exports.attachEvent("unload",function(){a||(a=!0,n.exports.triggerUnloadCallbacks())})}).call(f,c(5))},function(n,f,c){c.d(f,"d",function(){return p});var p;(function(c){c[c.GPU_MEMORY=0]="GPU_MEMORY";c[c.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";c[c.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";c[c.DOWNLOADING=3]="DOWNLOADING";c[c.QUEUED=4]="QUEUED";c[c.NEW=5]="NEW";c[c.FAILED=6]="FAILED";c[c.EXPIRED=7]="EXPIRED"})(p||(p={}));var k;(function(c){c[c.FIRST_TIER=0]="FIRST_TIER";c[c.FIRST_ORDERED_TIER=
0]="FIRST_ORDERED_TIER";c[c.VISIBLE=0]="VISIBLE";c[c.PREFETCH=1]="PREFETCH";c[c.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";c[c.RECENT=2]="RECENT";c[c.LAST_TIER=2]="LAST_TIER"})(k||(k={}));f.b="ChunkQueueManager";f.a="ChunkManager";f.c="ChunkSource.invalidate"},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&
"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b,e){var d=a.createShader(e);a.shaderSource(d,b);a.compileShader(d);if(!a.getShaderParameter(d,a.COMPILE_STATUS)){a=a.getShaderInfoLog(d)||"";var c=
a.replace("\x00","");d=[];c=$jscomp.makeIterator(c.split("\n"));for(var h=c.next();!h.done;h=c.next()){h=h.value;var g=h.match(/^ERROR:\s*(\d+):(\d+)\s*(.+)$/);null!==g?d.push({message:g[3].trim(),file:parseInt(g[1],10),line:parseInt(g[2],10)}):(g=h.match(/^ERROR:\s*(.+)$/),null!==g?d.push({message:g[1]}):(h=h.trim())&&d.push({message:h}))}throw new v(e,b,a,d);}return d}c.d(f,"a",function(){return e});n=c(0);var b=c(29),m=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=
e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),u;(function(a){a[a.VERTEX=b.u]="VERTEX";a[a.FRAGMENT=b.d]="FRAGMENT"})(u||(u={}));var v=function(a){function d(a,b,e,c){p(this,d);var h="Error compiling "+u[a].toLowerCase()+" shader: "+e,g=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,h));g.name="ShaderCompilationError";g.log=e;g.message=h;g.shaderType=a;g.source=b;g.errorMessages=
c;return g}q(d,a);return d}(Error),t=function(a){function d(a,b,e){p(this,d);var c="Error linking shader: "+e,h=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,c));h.name="ShaderLinkError";h.log=e;h.message=c;h.vertexSource=a;h.fragmentSource=b;return h}q(d,a);return d}(Error),l=function(d){function b(d,e,c,h,g){p(this,b);var l=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));l.gl=d;l.vertexSource=e;l.fragmentSource=c;l.attributes=new Map;l.uniforms=new Map;var r=l.vertexShader=
a(d,e,d.VERTEX_SHADER),m=l.fragmentShader=a(d,c,d.FRAGMENT_SHADER),f=d.createProgram();d.attachShader(f,r);d.attachShader(f,m);d.linkProgram(f);if(!d.getProgramParameter(f,d.LINK_STATUS))throw d=d.getProgramInfoLog(f)||"",new t(e,c,d);l.program=f;c=l.uniforms;e=l.attributes;if(h)for(h=$jscomp.makeIterator(h),r=h.next();!r.done;r=h.next())r=r.value,c.set(r,d.getUniformLocation(f,r));if(g)for(g=$jscomp.makeIterator(g),r=g.next();!r.done;r=g.next())h=r.value,e.set(h,d.getAttribLocation(f,h));return l}
q(b,d);m(b,[{key:"uniform",value:function(a){return this.uniforms.get(a)}},{key:"attribute",value:function(a){return this.attributes.get(a)}},{key:"textureUnit",value:function(a){return this.textureUnits.get(a)}},{key:"bind",value:function(){this.gl.useProgram(this.program)}},{key:"disposed",value:function(){var a=this.gl;a.deleteShader(this.vertexShader);this.vertexShader=void 0;a.deleteShader(this.fragmentShader);this.fragmentShader=void 0;a.deleteProgram(this.program);this.uniforms=this.attributes=
this.gl=this.program=void 0}}]);return b}(n.a),g=function(){function a(){p(this,a);this.code="";this.parts=new Set}m(a,[{key:"add",value:function(a){if(!this.parts.has(a))switch(this.parts.add(a),typeof a){case "string":this.code+=a;break;case "function":this.add(a());break;default:if(Array.isArray(a)){a=$jscomp.makeIterator(a);for(var d=a.next();!d.done;d=a.next())this.add(d.value)}else throw Error("Invalid code type");}}},{key:"toString",value:function(){return this.code}}]);return a}(),e=function(){function a(d){p(this,
a);this.gl=d;this.nextTextureUnit=this.nextSymbolID=0;this.varyingsCode=this.attributesCode=this.uniformsCode="";this.fragmentExtensionsSet=new Set;this.fragmentExtensions="";this.vertexCode=new g;this.vertexMain="";this.fragmentCode=new g;this.fragmentMain="";this.required=new Set;this.uniforms=[];this.attributes=[];this.initializers=[];this.textureUnits=new Map}m(a,[{key:"allocateTextureUnit",value:function(a,d){d=void 0===d?1:d;if(this.textureUnits.has(a))throw Error("Duplicate texture unit symbol: "+
a);var b=this.nextTextureUnit;this.nextTextureUnit+=d;this.textureUnits.set(a,b);return b}},{key:"addTextureSampler2D",value:function(a,d,b){var e=this.allocateTextureUnit(d,b);this.addUniform("highp sampler2D",a,b);this.addInitializer(function(d){if(b){for(var c=new Int32Array(b),h=0;h<b;++h)c[h]=h+e;d.gl.uniform1iv(d.uniform(a),c)}else d.gl.uniform1i(d.uniform(a),e)});return e}},{key:"symbol",value:function(a){return a+this.nextSymbolID++}},{key:"addAttribute",value:function(a,d){this.attributes.push(d);
this.attributesCode+="attribute "+a+" "+d+";\n";return d}},{key:"addVarying",value:function(a,d){this.varyingsCode+="varying "+a+" "+d+";\n"}},{key:"addUniform",value:function(a,d,b){this.uniforms.push(d);this.uniformsCode=null!=b?this.uniformsCode+("uniform "+a+" "+d+"["+b+"];\n"):this.uniformsCode+("uniform "+a+" "+d+";\n");return d}},{key:"addFragmentExtension",value:function(a){this.fragmentExtensionsSet.has(a)||(this.fragmentExtensionsSet.add(a),this.fragmentExtensions+="#extension "+a+" : require\n")}},
{key:"addVertexCode",value:function(a){this.vertexCode.add(a)}},{key:"addFragmentCode",value:function(a){this.fragmentCode.add(a)}},{key:"setVertexMain",value:function(a){this.vertexMain=a}},{key:"addVertexMain",value:function(a){this.vertexMain=(this.vertexMain||"")+a}},{key:"setFragmentMain",value:function(a){this.fragmentMain="void main() {\n"+a+"\n}\n"}},{key:"setFragmentMainFunction",value:function(a){this.fragmentMain=a}},{key:"addInitializer",value:function(a){this.initializers.push(a)}},{key:"require",
value:function(a){this.required.has(a)||(this.required.add(a),a(this))}},{key:"build",value:function(){var a=new l(this.gl,"\nprecision highp float;\n"+this.uniformsCode+"\n"+this.attributesCode+"\n"+this.varyingsCode+"\n"+this.vertexCode+"\nvoid main() {\n"+this.vertexMain+"\n}\n","\n"+this.fragmentExtensions+"\nprecision highp float;\n"+this.uniformsCode+"\n"+this.varyingsCode+"\n"+this.fragmentCode+"\n"+this.fragmentMain+"\n",this.uniforms,this.attributes);a.textureUnits=this.textureUnits;var d=
this.initializers;if(0<d.length){a.bind();d=$jscomp.makeIterator(d);for(var b=d.next();!b.done;b=d.next())b=b.value,b(a)}return a}}]);return a}()},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return u});
f.b=function(a,c){c=void 0===c?"GET":c;var l=new XMLHttpRequest;l[m]=c;l[b]=a;l.open(c,a);return l};f.c=function(a,c,l){l=void 0===l?"GET":l;var g=new XMLHttpRequest;if(Array.isArray(a)){var e=a.length;e=1===e?0:Math.abs(Object(q.a)(c))%e;a=a[e]+c}else a+=c;g[m]=l;g[b]=a;g.open(l,a);return g};f.e=function(a,b,c){c=void 0===c?k.e:c;a.responseType=b;return new Promise(function(b,e){var d=function(){a.abort()};c.add(d);a.onloadend=function(){var h=this.status;c.remove(d);200<=h&&300>h?b(this.response):
e(u.fromXhr(a))};a.send()})};f.d=function(a){var b=a.match(/^([^:\/]+):\/\/([^\/]+)(\/.*)?$/);if(null===b)throw Error("Invalid URL: "+JSON.stringify(a));return"gs"===b[1]?[["https://storage.googleapis.com/"+b[2]],b[3]]:[[a],""]};var k=c(27),q=c(154),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}();$jscomp.initSymbol();
var b=Symbol("url");$jscomp.initSymbol();var m=Symbol("method"),u=function(c){function f(a,b,e,d){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=a+" "+JSON.stringify(b)+" resulted in HTTP error "+e;d&&(c+=": "+d);c+=".";var g=(f.__proto__||Object.getPrototypeOf(f)).call(this,c);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");g=!g||"object"!==typeof g&&"function"!==typeof g?this:g;g.name="HttpError";g.message=c;
g.method=a;g.url=b;g.code=e;g.statusMessage=d;return g}p(f,c);a(f,null,[{key:"fromXhr",value:function(a){return new f(a[m],a[b],a.status,a.statusText)}}]);return f}(Error)},function(n,f,c){c.d(f,"b",function(){return p});var p;(function(c){c[c.UINT8=0]="UINT8";c[c.UINT16=1]="UINT16";c[c.UINT32=2]="UINT32";c[c.UINT64=3]="UINT64";c[c.FLOAT32=4]="FLOAT32"})(p||(p={}));n=[];f.a=n;n[p.UINT8]=1;n[p.UINT16]=2;n[p.UINT32]=4;n[p.UINT64]=8;n[p.FLOAT32]=4},function(n,f,c){f.b=function(){return new p.b(void 0)};
f.a=function(c){return new p.a(c,k.B)};var p=c(8),k=c(2)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"b",function(){return u});c.d(f,"a",function(){return t});var q=c(55);n=c(0);var a=c(45),b=function(){function a(a,b){for(var d=0;d<b.length;d++){var e=b[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,e,d){e&&a(b.prototype,e);d&&a(b,d);return b}}(),m=function g(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),
null!==a)return g(a,d,b)}else{if("value"in e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}};c(192);var u=0,v=a.a.fromObject({escape:{action:"close"}}),t=function(c){function e(){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var d=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));d.keyMap=new a.a;d.keyMap.addParent(v,Number.NEGATIVE_INFINITY);++u;var b=d.container=document.createElement("div");b.className="overlay";var c=d.content=document.createElement("div");
d.registerDisposer(new q.a(c));c.className="overlay-content";b.appendChild(c);document.body.appendChild(b);d.registerDisposer(new a.b(d.container,d.keyMap));d.registerEventListener(b,"action:close",function(){d.dispose()});c.focus();return d}k(e,c);b(e,[{key:"disposed",value:function(){--u;document.body.removeChild(this.container);m(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(n.a)},function(n,f,c){var p=c(237);n.exports={string:function(c){for(var f=
p.randomBytes(c),a=[],b=0;b<c;b++)a.push("abcdefghijklmnopqrstuvwxyz012345".substr(f[b]%32,1));return a.join("")},number:function(c){return Math.floor(Math.random()*c)},numberString:function(c){var f=(""+(c-1)).length;return(Array(f+1).join("0")+this.number(c)).slice(-f)}}},function(n,f,c){(function(f){function k(a){return function(c,l,g){u("create ajax sender",c,l);var e={};"string"===typeof l&&(e.headers={"Content-type":"text/plain"});c=b.addPath(c,"/xhr_send");var d=new a("POST",c,l,e);d.once("finish",
function(a){u("finish",a);d=null;if(200!==a&&204!==a)return g(Error("http status "+a));g()});return function(){u("abort");d.close();d=null;var a=Error("Aborted");a.code=1E3;g(a)}}}function q(a,b,c,g){m.call(this,a,b,k(g),c,g)}var a=c(3),b=c(18),m=c(125),u=function(){};"production"!==f.env.NODE_ENV&&(u=c(7)("sockjs-client:ajax-based"));a(q,m);n.exports=q}).call(f,c(6))},function(n,f,c){f.a=function(c,f){f.offset+=c;return f};f.b=function(c,f){var k=[];f=$jscomp.makeIterator(f);for(var a=f.next();!a.done;a=
f.next())a=a.value,a.startsWith(c)&&k.push({value:a});return k};f.c=function(c,f,q,a){var b=[];f=$jscomp.makeIterator(f);for(var m=f.next();!m.done;m=f.next()){m=m.value;var u=q(m);u.startsWith(c)&&b.push({value:u,description:a(m)})}return b}},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return q});n=c(20);var k=function(){function a(a,c){for(var b=0;b<c.length;b++){var f=c[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),q=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);k(b,[{key:"draw",value:function(a){}},{key:"isTransparent",get:function(){return!1}}]);return b}(n.h)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||
"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"b",function(){return u});c.d(f,"a",function(){return v});f.c=function(c){return function(c){function g(){p(this,g);var a=k(this,(g.__proto__||
Object.getPrototypeOf(g)).apply(this,arguments));a.visibility=new v;return a}q(g,c);m(g,[{key:"initializeCounterpart",value:function(e,d){d=void 0===d?{}:d;d.visibility=this.registerDisposer(a.a.makeFromExisting(e,this.visibility)).rpcId;b(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"initializeCounterpart",this).call(this,e,d)}}]);return g}(c)};var a=c(62);n=c(8);var b=function l(a,b,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),
null!==a)return l(a,b,d)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(d)}},m=function(){function a(a,b){for(var d=0;d<b.length;d++){var e=b[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,e,d){e&&a(b.prototype,e);d&&a(b,d);return b}}(),u=function(a){function b(a){a=void 0===a?Number.NEGATIVE_INFINITY:a;p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a))}q(b,a);
m(b,[{key:"visible",get:function(){return this.value===Number.POSITIVE_INFINITY}},{key:"ignored",get:function(){return this.value===Number.NEGATIVE_INFINITY}}]);return b}(n.b);u.VISIBLE=Number.POSITIVE_INFINITY;u.IGNORED=Number.NEGATIVE_INFINITY;var v=function(a){function b(){p(this,b);var a=k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.contributors=new Map;return a}q(b,a);m(b,[{key:"add",value:function(a){var d=this,b=this.contributors,e=a.changed.add(function(){d.update()}),
c=function(){b.delete(c);e();d.update()};b.set(c,a);this.update();return c}},{key:"update",value:function(){for(var a=Number.NEGATIVE_INFINITY,d=$jscomp.makeIterator(this.contributors.values()),b=d.next();!b.done;b=d.next())a=Math.max(a,b.value.value);this.value=a}}]);return b}(u)},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,
enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"b",function(){return m});n=c(0);var k=c(17);c.d(f,"a",function(){return k.a});c.d(f,"c",function(){return k.c});var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,l){c&&a(b.prototype,c);l&&a(b,l);return b}}(),a=new Set("f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 escape pause".split(" ")),
b=new Set("color date datetime datetime-local email month number password search tel text time url week".split(" ")),m=function(c){function f(a,b){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=(f.__proto__||Object.getPrototypeOf(f)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.target=a;c.eventMap=b;c.modifierShortcutsAreGlobal=!0;c.allShortcutsAreGlobal=
!1;c.allowSpaceKeyOnButtons=!1;c.registerEventListener(a,"keydown",c.handleKeyDown.bind(c),!1);return c}p(f,c);q(f,[{key:"shouldIgnoreEvent",value:function(c,f){var g=f.target,e=g.tagName;if(g===this.target)return!1;var d="TEXTAREA"===e||"INPUT"===e||"BUTTON"===e||"SELECT"===e,h=!d&&(g.isContentEditable||g.ownerDocument&&"on"===g.ownerDocument.designMode);return!d&&!h||this.allShortcutsAreGlobal||a.has(c)?!1:h||this.modifierShortcutsAreGlobal&&(f.altKey||f.ctrlKey||f.metaKey)?!0:"INPUT"===e&&b.has(g.type)?
"enter"!==c:"INPUT"===e||"BUTTON"===e?this.allowSpaceKeyOnButtons?!1:"space"===c:!0}},{key:"handleKeyDown",value:function(a){var b=a.code.toLowerCase();this.shouldIgnoreEvent(b,a)||Object(k.b)(b,a,this.eventMap)}}]);return f}(n.a)},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?
a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}c.d(f,"a",function(){return z});c.d(f,"c",function(){return y});c.d(f,"b",function(){return E});c.d(f,"d",function(){return A});n=c(9);var a=c.n(n),b=c(34);n=c(16);f=c(47);var m=c(66),
u=c(0),v=c(1),t=c(23),l=c(4),g=c(44),e=c(67),d=c(35),h=c(68);c=c(13);var r=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),B=function H(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return H(a,d,b)}else{if("value"in
e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}},C=this&&this.__decorate||function(a,d,b,e){var c=arguments.length,h=3>c?d:null===e?e=Object.getOwnPropertyDescriptor(d,b):e,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,d,b,e);else for(var f=a.length-1;0<=f;f--)if(g=a[f])h=(3>c?g(h):3<c?g(d,b,h):g(d,b))||h;return 3<c&&h&&Object.defineProperty(d,b,h),h},D=v.j.create(),z=function(d){function b(d,c,h){p(this,b);var g=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
g.chunkManager=d;g.layerManager=c;g.navigationState=h;g.gl=g.chunkManager.gl;g.dataToViewport=v.j.create();g.viewportToDevice=v.j.create();g.dataToDevice=v.j.create();g.visibleChunks=new Map;g.viewChanged=new l.a;g.renderingStale=!0;g.visibleChunksStale=!0;g.visibleLayerList=[];g.newVisibleLayers=new Set;g.offscreenFramebuffer=g.registerDisposer(new e.b(g.gl,{colorBuffers:Object(e.e)(g.gl,1),depthBuffer:new e.d(g.gl)}));g.updateVisibleLayers=g.registerCancellable(a()(function(){g.updateVisibleLayersNow()},
0));v.j.identity(g.dataToViewport);g.initializeCounterpart(g.chunkManager.rpc,{chunkManager:d.rpcId});g.registerDisposer(h.changed.add(function(){g.updateViewportFromNavigationState()}));g.updateViewportFromNavigationState();g.registerDisposer(c.layersChanged.add(function(){g.hasValidViewport&&g.updateVisibleLayers()}));g.viewChanged.add(function(){g.renderingStale=!0});g.registerDisposer(d.chunkQueueManager.visibleChunksChanged.add(g.viewChanged.dispatch));g.updateViewportFromNavigationState();g.updateVisibleLayers();
return g}q(b,d);r(b,[{key:"updateViewportFromNavigationState",value:function(){var a=this.navigationState;a.valid&&(a.toMat4(D),this.setViewportToDataMatrix(D))}},{key:"updateVisibleLayersNow",value:function(){if(this.wasDisposed||!this.hasValidViewport)return!1;var a=this.visibleLayers,d=this.rpc,b={id:this.rpcId},e=this.newVisibleLayers,c=!1,h=this.visibleLayerList;h.length=0;for(var g=$jscomp.makeIterator(this.layerManager.readyRenderLayers()),f=g.next();!f.done;f=g.next())f=f.value,f instanceof
m.a&&(e.add(f),h.push(f),a.has(f)||(a.set(f.addRef(),[]),f.redrawNeeded.add(this.viewChanged.dispatch),b.layerId=f.rpcId,d.invoke("SliceView.addVisibleLayer",b),c=!0));h=$jscomp.makeIterator(a.keys());for(f=h.next();!f.done;f=h.next())g=f.value,e.has(g)||(a.delete(g),g.redrawNeeded.remove(this.viewChanged.dispatch),b.layerId=g.rpcId,d.invoke("SliceView.removeVisibleLayer",b),g.dispose(),c=!0);e.clear();c&&(this.visibleSourcesStale=!0);this.viewChanged.dispatch();return c}},{key:"onViewportChanged",
value:function(){var a=this.width,d=this.height,b=this.viewportToDevice,e=this.dataToViewport,c=this.dataToDevice;v.j.ortho(b,-a/2,a/2,d/2,-d/2,-10,10);v.j.multiply(c,b,e);this.visibleChunksStale=!0;this.viewChanged.dispatch()}},{key:"setViewportSize",value:function(a,d){return B(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"setViewportSize",this).call(this,a,d)?(this.rpc.invoke("SliceView.updateView",{id:this.rpcId,width:a,height:d}),!0):!1}},{key:"onViewportToDataMatrixChanged",value:function(){var a=
this.viewportToData,d=this.dataToViewport;v.j.invert(d,a);Object(v.m)(d);this.rpc.invoke("SliceView.updateView",{id:this.rpcId,viewportToData:a})}},{key:"onHasValidViewport",value:function(){this.updateVisibleLayers()}},{key:"updateRendering",value:function(){if(this.renderingStale&&this.hasValidViewport&&0!==this.width&&0!==this.height){this.renderingStale=!1;this.maybeUpdateVisibleChunks();var a=this.gl,d=this.offscreenFramebuffer;d.bind(this.width,this.height);a.disable(a.SCISSOR_TEST);a.clearStencil(0);
a.clearColor(0,0,0,0);a.colorMask(!0,!0,!0,!0);a.clear(a.COLOR_BUFFER_BIT);a.enable(a.STENCIL_TEST);a.disable(a.DEPTH_TEST);a.stencilOpSeparate(a.FRONT_AND_BACK,a.KEEP,a.KEEP,a.REPLACE);for(var b=0,e=$jscomp.makeIterator(this.visibleLayerList),c=e.next();!c.done;c=e.next())c=c.value,a.clear(a.STENCIL_BUFFER_BIT),a.stencilFuncSeparate(a.FRONT_AND_BACK,a.GREATER,1,1),1===b&&(a.enable(a.BLEND),a.blendFunc(a.SRC_ALPHA,a.ONE_MINUS_SRC_ALPHA)),c.draw(this),++b;a.disable(a.BLEND);a.disable(a.STENCIL_TEST);
d.unbind()}}},{key:"maybeUpdateVisibleChunks",value:function(){this.updateVisibleLayers.flush();if(!this.visibleChunksStale&&!this.visibleSourcesStale)return!1;this.visibleChunksStale=!1;this.updateVisibleChunks();return!0}},{key:"updateVisibleChunks",value:function(){var a=this.visibleChunks;this.computeVisibleChunks(function(d){var b=a.get(d);void 0===b?(b=[],a.set(d,b)):b.length=0;return b},function(a,d,b){a=Object(v.q)(b);d[d.length]=a})}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),
d=a.next();!d.done;d=a.next())d.value.dispose();this.visibleLayers.clear();this.visibleLayerList.length=0}}]);return b}(Object(g.c)(f.d));z=C([Object(c.g)(f.c)],z);var y=function(a){function d(a,b){p(this,d);a=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));a.spec=b.spec;return a}q(d,a);r(d,[{key:"initializeCounterpart",value:function(a,b){b.spec=this.spec.toObject();B(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,a,b)}}],[{key:"encodeOptions",
value:function(a){var b=B(d.__proto__||Object.getPrototypeOf(d),"encodeOptions",this).call(this,a);b.spec=a.spec.toObject();return b}}]);return d}(n.e),E=function(a){function d(a,e){p(this,d);var c=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a));c.chunkGridPosition=e.chunkGridPosition;c.chunkDataSize=e.chunkDataSize||a.spec.chunkDataSize;c.state=b.d.SYSTEM_MEMORY;return c}q(d,a);return d}(n.b),A=function(a){function b(a,e){p(this,b);var c=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
c.gl=a;c.copyVertexPositionsBuffer=Object(h.a)(c.gl);c.textureCoordinateAdjustment=new Float32Array(4);var g=new d.a(a);g.addVarying("vec2","vTexCoord");g.addUniform("sampler2D","uSampler");g.addInitializer(function(d){a.uniform1i(d.uniform("uSampler"),0)});g.addUniform("vec4","uColorFactor");g.addUniform("vec4","uBackgroundColor");g.addUniform("mat4","uProjectionMatrix");g.addUniform("vec4","uTextureCoordinateAdjustment");g.require(e);g.setFragmentMain("\nvec4 sampledColor = texture2D(uSampler, vTexCoord);\nif (sampledColor.a == 0.0) {\n  sampledColor = uBackgroundColor;\n}\nemit(sampledColor * uColorFactor, vec4(0,0,0,0));\n");
g.addAttribute("vec4","aVertexPosition");g.setVertexMain("\nvTexCoord = uTextureCoordinateAdjustment.xy + 0.5 * (aVertexPosition.xy + 1.0) * uTextureCoordinateAdjustment.zw;\ngl_Position = uProjectionMatrix * aVertexPosition;\n");c.shader=c.registerDisposer(g.build());return c}q(b,a);r(b,[{key:"draw",value:function(a,d,b,e,c,h,g,f){var r=this.gl,l=this.shader,m=this.textureCoordinateAdjustment;m[0]=c;m[1]=h;m[2]=g-c;m[3]=f-h;l.bind();r.activeTexture(r.TEXTURE0);r.bindTexture(r.TEXTURE_2D,a);r.uniformMatrix4fv(l.uniform("uProjectionMatrix"),
!1,d);r.uniform4fv(l.uniform("uColorFactor"),b);r.uniform4fv(l.uniform("uBackgroundColor"),e);r.uniform4fv(l.uniform("uTextureCoordinateAdjustment"),m);a=l.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(a,2);r.drawArrays(r.TRIANGLE_FAN,0,4);r.disableVertexAttribArray(a);r.bindTexture(r.TEXTURE_2D,null)}}],[{key:"get",value:function(a,d){return a.memoize.get("sliceview/SliceViewRenderHelper:"+Object(t.a)(d),function(){return new b(a,d)})}}]);return b}(u.a)},function(n,
f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function q(a,d,b){for(var e=0;3>e;++e)a[e]=Number.POSITIVE_INFINITY,d[e]=Number.NEGATIVE_INFINITY;
b=$jscomp.makeIterator(b);for(e=b.next();!e.done;e=b.next()){var c=e.value.spec;e=c.lowerChunkBound;c=c.upperChunkBound;for(var h=0;3>h;++h)a[h]=Math.min(a[h],e[h]),d[h]=Math.max(d[h],c[h])}}function a(a,d,b,e){for(var c=r.FULLY_INSIDE,h=0;3>h;++h){var g=a[h];var f=d[h],l=b[h],m=e[h];g=g>=m||f<=l?r.FULLY_OUTSIDE:g>=l&&f<=m?r.FULLY_INSIDE:r.PARTIALLY_INSIDE;switch(g){case r.FULLY_OUTSIDE:return g;case r.PARTIALLY_INSIDE:c=g}}return c}function b(a,d){var b=d.length,e=0;if(1<b)for(var c=0,g=0;g<b;++g){var f=
d[g].spec.chunkLayout;var r=f.size;f=f.globalToLocalSpatialVector(h,a);for(var l=0,m=0,t=1,u=0;3>u;++u){var v=r[u];t*=v;v*=f[u];l=Math.min(l,v);m=Math.max(m,v)}r=t/(m-l);r>c&&(c=r,e=g)}return d[e]}function m(a){var d=a.voxelSize,b=void 0===a.lowerVoxelBound?e.h:a.lowerVoxelBound,c=a.upperVoxelBound,h=void 0===a.maxVoxelsPerChunkLog2?18:a.maxVoxelsPerChunkLog2;a=void 0===a.transform?e.d:a.transform;a=Object(e.c)(e.p.create(),a);d=e.p.multiply(a,a,d);a=e.p.fromValues(1,1,1);if(void 0===c)var g=e.f;
else{g=e.p.create();for(var f=0;3>f;++f)g[f]=Math.pow(2,Math.floor(Math.log2(c[f]-b[f])))}for(b=0;b<h;++b){c=Infinity;f=-1;for(var r=0;3>r;++r)if(!(a[r]>=g[r])){var l=a[r]*d[r];l<c&&(c=l,f=r)}c=f;if(-1===c)break;a[c]*=2}return a}function u(a){var d=a.flatDimension,b=a.voxelSize,c=a.maxVoxelsPerChunkLog2,g=a.transform;e.p.subtract(h,void 0===a.upperVoxelBound?e.f:a.upperVoxelBound,void 0===a.lowerVoxelBound?e.h:a.lowerVoxelBound);h[d]=1;return m({voxelSize:b,upperVoxelBound:h,maxVoxelsPerChunkLog2:c,
transform:g})}c.d(f,"d",function(){return C});f.h=m;f.i=u;f.g=function(a,d){d=d.transform;return void 0===d?void 0===a?e.d:a:void 0===a?d:e.j.multiply(e.j.create(),d,a)};f.f=function(a){if(void 0!==a.chunkDataSizes)return a.chunkDataSizes;var d=void 0===a.chunkLayoutPreference?D.ISOTROPIC:a.chunkLayoutPreference;switch(d){case D.ISOTROPIC:return[m(a)];case D.FLAT:d=[];for(var b=0;3>b;++b)d[b]=u({flatDimension:b,voxelSize:a.voxelSize,lowerVoxelBound:a.lowerVoxelBound,upperVoxelBound:a.upperVoxelBound,
maxVoxelsPerChunkLog2:a.maxVoxelsPerChunkLog2,transform:a.transform});d.push(m(a));return d}throw Error("Invalid chunk layout preference: "+d+".");};c.d(f,"e",function(){return z});var v=c(174),t=c(103),l=c(175),g=c(37),e=c(1);n=c(13);c.d(f,"b",function(){return g.b});var d=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,
e);return d}}(),h=e.p.create(),r;(function(a){a[a.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";a[a.FULLY_INSIDE=1]="FULLY_INSIDE";a[a.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(r||(r={}));var B=[e.p.create(),e.p.create(),e.p.create(),e.p.create()],C=function(c){function g(){p(this,g);var a=(g.__proto__||Object.getPrototypeOf(g)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.width=-1;a.height=-1;
a.hasViewportToData=!1;a.hasValidViewport=!1;a.viewportToData=e.j.create();a.viewportAxes=[e.p.create(),e.p.create(),e.p.create()];a.previousViewportAxes=[e.p.create(),e.p.create()];a.centerDataPosition=e.p.create();a.viewportPlaneDistanceToOrigin=0;a.visibleChunkLayouts=new Map;a.visibleLayers=new Map;a.visibleSourcesStale=!0;a.pixelSize=0;e.j.identity(a.viewportToData);return a}k(g,c);d(g,[{key:"onViewportChanged",value:function(){}},{key:"maybeSetHasValidViewport",value:function(){!this.hasValidViewport&&
-1!==this.width&&-1!==this.height&&this.hasViewportToData&&(this.hasValidViewport=!0,this.onHasValidViewport());if(this.hasValidViewport)this.onViewportChanged()}},{key:"onHasValidViewport",value:function(){}},{key:"setViewportSize",value:function(a,d){return a!==this.width||d!==this.height?(this.width=a,this.height=d,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(a){if(this.hasViewportToData&&e.j.equals(this.viewportToData,a))return!1;this.hasViewportToData=
!0;var d=this.viewportToData;e.j.copy(d,a);Object(e.m)(d);e.p.transformMat4(this.centerDataPosition,e.h,a);a=0;for(var b=this.viewportAxes,c=this.previousViewportAxes,h=0;3>h;++h){var g=b[h];Object(e.n)(g,e.e[h],d);0===h&&(a=e.p.length(g));e.p.normalize(g,g)}this.viewportAxes=b;this.previousViewportAxes=c;if(!Object(l.a)(a,this.pixelSize)||.95>e.p.dot(b[0],c[0])||.95>e.p.dot(b[1],c[1]))e.p.copy(c[0],b[0]),e.p.copy(c[1],b[1]),this.visibleSourcesStale=!0,this.pixelSize=a;this.viewportPlaneDistanceToOrigin=
e.p.dot(this.centerDataPosition,this.viewportAxes[2]);this.onViewportToDataMatrixChanged();this.maybeSetHasValidViewport();return!0}},{key:"onViewportToDataMatrixChanged",value:function(){}},{key:"updateVisibleSources",value:function(){if(this.visibleSourcesStale){this.visibleSourcesStale=!1;var a=1.1*this.pixelSize,d=this.visibleChunkLayouts,e=this.viewportAxes[2],c=this.visibleLayers;d.clear();var h={};c=$jscomp.makeIterator(c);for(var g=c.next();!g.done;h={smallestVoxelSize:h.smallestVoxelSize,
visibleSources:h.visibleSources},g=c.next()){g=$jscomp.makeIterator(g.value);var f=g.next().value;h.visibleSources=g.next().value;h.visibleSources.length=0;g=f.sources;var r=g.length;f=void 0;h.smallestVoxelSize=g[0][0].spec.voxelSize;var l=function(d){return function(b){for(var e=0;3>e;++e){var c=b[e];if(c>a&&c>d.smallestVoxelSize[e])return!0}return!1}}(h),m=function(a){return function(b,e){a.visibleSources[a.visibleSources.length++]=b;var c=b.spec.chunkLayout,h=d.get(c);void 0===h&&(h=new Map,d.set(c,
h));h.set(b,e)}}(h);for(f=r-1;;){r=b(e,g[f]);m(r,f);if(0===f||!l(r.spec.voxelSize))break;--f}h.visibleSources.reverse()}}}},{key:"computeVisibleChunks",value:function(d,b){var c=this;this.updateVisibleSources();for(var g=this.width,f=this.height,l=this.viewportToData,m=0;3>m;++m)B[0][m]=-e.e[0][m]*g/2-e.e[1][m]*f/2,B[1][m]=-e.e[0][m]*g/2+e.e[1][m]*f/2,B[2][m]=e.e[0][m]*g/2-e.e[1][m]*f/2,B[3][m]=e.e[0][m]*g/2+e.e[1][m]*f/2;for(g=0;4>g;++g)e.p.transformMat4(B[g],B[g],l);var A=e.p.create(),u=e.p.create(),
G=e.p.create(),v=e.p.create(),k=e.p.create(),E=e.p.create(),y=[],p=[];this.visibleChunkLayouts.forEach(function(g,f){function l(){for(var a=0,d=0,b=0;3>b;++b){var e=E[b],c=A[b],h=u[b]-c,g=k[b]*h;a+=e*(c+g);d+=e*(c+h-g)}return a<J?!1:d<=J}function m(d){function e(){z=Object(t.b)(y,0,B,function(d){var b=d.spec;switch(a(A,u,b.lowerChunkBound,b.upperChunkBound)){case r.PARTIALLY_INSIDE:return!0;case r.FULLY_INSIDE:p.push(d);default:return!1}})}if(0!==p.length||0!==z){for(var c=1,h=0;3>h;++h)c*=Math.max(0,
u[h]-A[h]);if(0!==c&&l())if(1===c)b(f,H,A,p);else{for(var g;;)if(c=A[d],h=u[d],g=h-c,1===g)d=(d+1)%3;else break;g=c+Math.floor(.5*g);var G=(d+1)%3,v=p.length;u[d]=g;var B=z;e();m(G);p.length=v;z=B;u[d]=h;A[d]=g;e();m(G);A[d]=c;p.length=v;z=B}}}var H=d(f);q(G,v,g.keys());e.p.set(A,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);e.p.set(u,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);f.globalToLocalSpatialVector(E,c.viewportAxes[2]);for(var C=
0;3>C;++C)k[C]=0<E[C]?1:0;var J=e.p.dot(f.globalToLocalGrid(h,c.centerDataPosition),E);for(C=0;4>C;++C)for(var n=f.globalToLocalGrid(h,B[C]),D=0;3>D;++D)A[D]=Math.min(A[D],Math.floor(n[D])),u[D]=Math.max(u[D],Math.floor(n[D])+1);e.p.max(A,A,G);e.p.min(u,u,v);p.length=0;y.length=0;g=$jscomp.makeIterator(g.keys());for(C=g.next();!C.done;C=g.next())switch(C=C.value,n=C.spec,a(A,u,n.lowerChunkBound,n.upperChunkBound)){case r.FULLY_INSIDE:p.push(C);break;case r.PARTIALLY_INSIDE:y.push(C)}var z=y.length;
m(0)})}}]);return g}(n.b);f.a=18;var D;(function(a){a[a.ISOTROPIC=0]="ISOTROPIC";a[a.FLAT=1]="FLAT"})(D||(D={}));var z=function E(a){p(this,E);var d=void 0===a.lowerVoxelBound?e.h:a.lowerVoxelBound,b=a.upperVoxelBound,c=a.chunkDataSize,h=a.voxelSize,g=a.transform,f=void 0===a.baseVoxelOffset?e.h:a.baseVoxelOffset,r=void 0===a.lowerClipBound?e.p.multiply(e.p.create(),h,d):a.lowerClipBound,l=void 0===a.upperClipBound?e.p.multiply(e.p.create(),h,b):a.upperClipBound;this.voxelSize=h;this.chunkDataSize=
c;this.chunkLayout=v.a.get(e.p.multiply(e.p.create(),a.chunkDataSize,h),g);this.lowerClipBound=r;this.upperClipBound=l;this.lowerVoxelBound=d;this.upperVoxelBound=b;this.baseVoxelOffset=f;a=this.lowerChunkBound=e.p.create();h=this.upperChunkBound=e.p.create();for(g=0;3>g;++g)a[g]=Math.floor(d[g]/c[g]),h[g]=Math.floor((b[g]-1)/c[g]+1)};f.c="SliceView"},function(n,f,c){f.a=function(c){return new p.a(void 0===c?.5:c,k.r)};var p=c(8),k=c(2)},function(n,f,c){function p(c,a,b){k.call(this,c,a,b,{noCredentials:!0})}
f=c(3);var k=c(126);f(p,k);p.enabled=k.enabled;n.exports=p},function(n,f,c){(function(c){n.exports={isOpera:function(){return c.navigator&&/opera/i.test(c.navigator.userAgent)},isKonqueror:function(){return c.navigator&&/konqueror/i.test(c.navigator.userAgent)},hasDomain:function(){if(!c.document)return!0;try{return!!c.document.domain}catch(k){return!1}}}}).call(f,c(5))},function(n,f,c){(function(f,k){var q=c(33),a=c(26),b=c(50),m=function(){};"production"!==f.env.NODE_ENV&&(m=c(7)("sockjs-client:utils:iframe"));
n.exports={WPrefix:"_jp",currentWindowId:null,polluteGlobalNamespace:function(){n.exports.WPrefix in k||(k[n.exports.WPrefix]={})},postMessage:function(b,c){k.parent!==k?k.parent.postMessage(a.stringify({windowId:n.exports.currentWindowId,type:b,data:c||""}),"*"):m("Cannot postMessage, no parent window.",b,c)},createIframe:function(a,b){var c=k.document.createElement("iframe"),f=function(){m("unattach");clearTimeout(d);try{c.onload=null}catch(r){}c.onerror=null},g=function(){m("cleanup");c&&(f(),
setTimeout(function(){c&&c.parentNode.removeChild(c);c=null},0),q.unloadDel(h))},e=function(a){m("onerror",a);c&&(g(),b(a))};c.src=a;c.style.display="none";c.style.position="absolute";c.onerror=function(){e("onerror")};c.onload=function(){m("onload");clearTimeout(d);d=setTimeout(function(){e("onload timeout")},2E3)};k.document.body.appendChild(c);var d=setTimeout(function(){e("timeout")},15E3);var h=q.unloadAdd(g);return{post:function(a,d){m("post",a,d);try{setTimeout(function(){c&&c.contentWindow&&
c.contentWindow.postMessage(a,d)},0)}catch(C){}},cleanup:g,loaded:f}},createHtmlfile:function(a,b){var c=["Active"].concat("Object").join("X"),f=new k[c]("htmlfile"),g=function(){clearTimeout(r);h.onerror=null},e=function(){f&&(g(),q.unloadDel(u),h.parentNode.removeChild(h),h=f=null,CollectGarbage())},d=function(a){m("onerror",a);f&&(e(),b(a))};f.open();f.write('<html><script>document.domain="'+k.document.domain+'";\x3c/script></html>');f.close();f.parentWindow[n.exports.WPrefix]=k[n.exports.WPrefix];
c=f.createElement("div");f.body.appendChild(c);var h=f.createElement("iframe");c.appendChild(h);h.src=a;h.onerror=function(){d("onerror")};var r=setTimeout(function(){d("timeout")},15E3);var u=q.unloadAdd(e);return{post:function(a,d){try{setTimeout(function(){h&&h.contentWindow&&h.contentWindow.postMessage(a,d)},0)}catch(z){}},cleanup:e,loaded:g}}};n.exports.iframeEnabled=!1;k.document&&(n.exports.iframeEnabled=("function"===typeof k.postMessage||"object"===typeof k.postMessage)&&!b.isKonqueror())}).call(f,
c(6),c(5))},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"a",function(){return u});c.d(f,"b",function(){return v});
var q=c(0),a=c(2),b=function l(a,b,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,d)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(d)}},m=function(){function a(a,b){for(var d=0;d<b.length;d++){var e=b[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,e,d){e&&a(b.prototype,e);d&&a(b,d);return b}}(),
u=function(){function a(){k(this,a);this.map=new Map}m(a,[{key:"get",value:function(a,b){var d=this.map,e=d.get(a);void 0===e?(e=b(),e.registerDisposer(function(){d.delete(a)}),d.set(a,e)):e.addRef();return e}}]);return a}(),v=function(c){function g(){k(this,g);var a=(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(g,c);m(g,[{key:"get",
value:function(e,d){"string"!==typeof e&&(e=Object(a.g)(e));return b(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"get",this).call(this,e,d)}},{key:"getUncounted",value:function(a,d){return this.get(a,function(){return new q.b(d())}).value}}]);return g}(u)},function(n,f,c){function p(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function k(a,d){if("function"!==typeof d&&null!==
d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function q(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}c.d(f,"a",function(){return B});c.d(f,"b",function(){return D});var a=c(34);n=c(16);var b=c(156);f=c(43);var m=c(54),u=c(1),v=c(23),t=c(24),
l=c(35),g=c(14);c=c(13);var e=function E(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return E(a,d,b)}else{if("value"in e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}},d=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,
e);return d}}(),h=this&&this.__decorate||function(a,d,b,e){var c=arguments.length,h=3>c?d:null===e?e=Object.getOwnPropertyDescriptor(d,b):e,g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)h=Reflect.decorate(a,d,b,e);else for(var f=a.length-1;0<=f;f--)if(g=a[f])h=(3>c?g(h):3<c?g(d,b,h):g(d,b))||h;return 3<c&&h&&Object.defineProperty(d,b,h),h},r=function(){function a(){q(this,a);this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4)}d(a,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3",
"aVertexPosition");a.addAttribute("highp vec3","aVertexNormal");a.addVarying("highp vec4","vColor");a.addUniform("highp vec4","uLightDirection");a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uModelMatrix");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.setVertexMain("\ngl_Position = uProjection * (uModelMatrix * vec4(aVertexPosition, 1.0));\nvec3 normal = (uModelMatrix * vec4(aVertexNormal, 0.0)).xyz;\nfloat lightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\nvColor = vec4(lightingFactor * uColor.rgb, uColor.a);\n");
a.setFragmentMain("emit(vColor, uPickID);")}},{key:"beginLayer",value:function(a,d,b){var e=b.dataToDevice,c=b.lightDirection,h=b.ambientLighting;b=b.directionalLighting;a.uniformMatrix4fv(d.uniform("uProjection"),!1,e);e=this.tempLightVec;u.p.scale(e,c,b);e[3]=h;a.uniform4fv(d.uniform("uLightDirection"),e)}},{key:"setColor",value:function(a,d,b){a.uniform4fv(d.uniform("uColor"),b)}},{key:"setPickID",value:function(a,d,b){a.uniform4fv(d.uniform("uPickID"),Object(g.p)(this.tempPickID,b))}},{key:"beginObject",
value:function(a,d,b){a.uniformMatrix4fv(d.uniform("uModelMatrix"),!1,b)}},{key:"getShader",value:function(a,d){var b=this;return a.memoize.get("mesh/MeshShaderManager:"+Object(v.a)(d),function(){var e=new l.a(a);e.require(d);b.defineShader(e);return e.build()})}},{key:"drawFragment",value:function(a,d,b){b.vertexBuffer.bindToVertexAttrib(d.attribute("aVertexPosition"),3);b.normalBuffer.bindToVertexAttrib(d.attribute("aVertexNormal"),3);b.indexBuffer.bind();a.drawElements(a.TRIANGLES,b.numIndices,
a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,d){a.disableVertexAttribArray(d.attribute("aVertexPosition"));a.disableVertexAttribArray(d.attribute("aVertexNormal"))}}]);return a}(),B=function(e){function c(a,d,e){q(this,c);var h=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));h.chunkManager=a;h.source=d;h.displayState=e;h.meshShaderManager=new r;h.shaders=new Map;Object(m.f)(e,h);a=h.sharedObject=h.registerDisposer(new m.b(a,e));a.RPC_TYPE_ID=b.b;a.initializeCounterpartWithChunkManager({source:d.addCounterpartRef()});
h.setReady(!0);a.visibility.add(h.visibility);return h}k(c,e);d(c,[{key:"getShader",value:function(a){var d=this.shaders,b=d.get(a);void 0===b&&(b=this.registerDisposer(this.meshShaderManager.getShader(this.gl,a)),d.set(a,b));return b}},{key:"draw",value:function(d){var b=this;if(d.emitColor||!d.alreadyEmittedPickID){var e=this.gl,c=this.displayState,h=this.meshShaderManager,g=Math.min(1,c.objectAlpha.value);if(!(0>=g)){var f=this.getShader(d.emitter);f.bind();h.beginLayer(e,f,d);var r=d.pickIDs,
l=this.displayState.objectToDataTransform.transform;Object(m.d)(c,this.source.fragmentSource.objectChunks,function(t,u,A){d.emitColor&&h.setColor(e,f,Object(m.e)(c,t,g));d.emitPickID&&h.setPickID(e,f,r.registerUint64(b,u));h.beginObject(e,f,l);t=$jscomp.makeIterator(A);for(u=t.next();!u.done;u=t.next())u=u.value,u.state===a.d.GPU_MEMORY&&h.drawFragment(e,f,u)});h.endLayer(e,f)}}}},{key:"isTransparent",get:function(){return 1>this.displayState.objectAlpha.value}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);
return c}(f.a),C=function(a){function b(a,d){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.objectKey=d.objectKey;a.vertexPositions=d.vertexPositions;var e=a.indices=d.indices;a.numIndices=e.length;a.vertexNormals=d.vertexNormals;return a}k(b,a);d(b,[{key:"copyToGPU",value:function(a){e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=t.a.fromData(a,this.vertexPositions,a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=
t.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,a.STATIC_DRAW);this.normalBuffer=t.a.fromData(a,this.vertexNormals,a.ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose();this.normalBuffer.dispose()}}]);return b}(n.b),D=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.fragmentSource=
a.registerDisposer(new z(a.chunkManager,a));return a}k(b,a);d(b,[{key:"initializeCounterpart",value:function(a,d){this.fragmentSource.initializeCounterpart(this.chunkManager.rpc,{});d.fragmentSource=this.fragmentSource.addCounterpartRef();e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"initializeCounterpart",this).call(this,a,d)}}]);return b}(n.e),z=function(a){function b(a,d){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));a.meshSource=d;a.objectChunks=new Map;
return a}k(b,a);d(b,[{key:"addChunk",value:function(a,d){e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"addChunk",this).call(this,a,d);a=this.objectChunks;var c=d.objectKey,h=a.get(c);void 0===h&&(h=new Set,a.set(c,h));h.add(d)}},{key:"deleteChunk",value:function(a){var d=this.chunks.get(a);e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"deleteChunk",this).call(this,a);a=this.objectChunks;var c=d.objectKey,h=a.get(c);h.delete(d);0===h.size&&a.delete(c)}},{key:"getChunk",
value:function(a){return new C(this,a)}}]);return b}(n.e);z=h([Object(c.g)(b.a)],z)},function(n,f,c){function p(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function k(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function q(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function a(a,d){var b=d.redrawNeeded.dispatch;d.registerDisposer(a.segmentColorHash.changed.add(b));d.registerDisposer(a.visibleSegments.changed.add(b));d.registerDisposer(a.segmentEquivalences.changed.add(b));d.registerDisposer(a.segmentSelectionState.changed.add(b))}c.d(f,"c",function(){return g});c.d(f,"a",function(){return e});f.g=a;
f.f=function(d,b){a(d,b);b.registerDisposer(d.objectAlpha.changed.add(b.redrawNeeded.dispatch));b.registerDisposer(d.objectToDataTransform.changed.add(b.redrawNeeded.dispatch))};f.e=function(a,b,e){e=void 0===e?1:e;var c=d;c[3]=e;a.segmentColorHash.compute(c,b);if(a.segmentSelectionState.isSelected(b))for(a=0;3>a;++a)c[a]=.5*c[a]+.5;c[0]*=e;c[1]*=e;c[2]*=e;return c};f.d=function(a,d,e){Object(b.a)(a,function(c,h){var g=Object(b.b)(c,a.clipBounds.value);g=d.get(g);void 0!==g&&e(h,c,g)})};c.d(f,"b",
function(){return h});var b=c(166);n=c(0);f=c(1);var m=c(4),u=c(19),v=c(44);c=c(13);var t=function B(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return B(a,d,b)}else{if("value"in e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}},l=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,
e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),g=function(){function a(d,b){q(this,a);this.key=d;this.value=b}l(a,[{key:"toString",value:function(){return this.key+"\u2192"+this.value}}]);return a}(),e=function(a){function d(){q(this,d);var a=p(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.selectedSegment=new u.a;a.hasSelectedSegment=!1;a.changed=new m.a;return a}k(d,a);l(d,[{key:"set",value:function(a){if(null==a)this.hasSelectedSegment&&(this.hasSelectedSegment=
!1,this.changed.dispatch());else{var d=this.selectedSegment;this.hasSelectedSegment&&a.low===d.low&&a.high===d.high||(d.low=a.low,d.high=a.high,this.hasSelectedSegment=!0,this.changed.dispatch())}}},{key:"isSelected",value:function(a){return this.hasSelectedSegment&&u.a.equal(a,this.selectedSegment)}},{key:"bindTo",value:function(a,d){var b=this,e=new u.a;this.registerDisposer(a.changed.add(function(){var c=a.get(d);"number"===typeof c?(e.low=c,e.high=0,c=e):c instanceof g&&(c=c.value);b.set(c)}))}}]);
return d}(n.a),d=f.r.create(),h=function(a){function d(a,b){q(this,d);var e=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.chunkManager=a;e.displayState=b;e.registerDisposer(b.clipBounds.changed.add(function(){return a.chunkQueueManager.scheduleChunkUpdate()}));return e}k(d,a);l(d,[{key:"initializeCounterpartWithChunkManager",value:function(a){var b=this.displayState;a.chunkManager=this.chunkManager.rpcId;a.visibleSegments=b.visibleSegments.rpcId;a.segmentEquivalences=b.segmentEquivalences.rpcId;
a.clipBounds=b.clipBounds.rpcId;t(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initializeCounterpart",this).call(this,this.chunkManager.rpc,a)}}]);return d}(Object(v.c)(c.b))},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"a",function(){return l});n=c(9);var a=c.n(n);n=c(0);var b=c(170),m=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,
e.key,e)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),u=function e(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return e(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},v=new function d(){q(this,d);b.a.initializeHead(this)},t=a()(function(){var a=document.activeElement;if(null===a||a===document.body)a=b.a.front(v),null!==a&&a.element.focus()});window.addEventListener("focus",
function(){t()},!0);window.addEventListener("blur",function(){t()},!0);var l=function(d){function c(d){q(this,c);var h=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));h.element=d;h.prev0=null;h.next0=null;h.lastFocusedElement=null;h.scheduleUpdateFocus=h.registerCancellable(a()(function(){var a=document.activeElement,d=h.element;d.contains(a)||((a===h.lastFocusedElement||a.contains(d))&&h.element.focus(),h.lastFocusedElement=null)},0));d.tabIndex=-1;h.registerEventListener(d,"mouseenter",
function(){h.lastFocusedElement=document.activeElement;h.scheduleUpdateFocus()});h.registerEventListener(d,"mouseleave",function(){h.scheduleUpdateFocus.cancel()});b.a.insertBefore(v,h);h.registerEventListener(d,"focus",function(){b.a.pop(h);b.a.insertAfter(v,h)});t();return h}k(c,d);m(c,[{key:"disposed",value:function(){b.a.pop(this);u(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a)},function(n,f,c){function p(c){c.texParameteri(k.m,k.o,k.h);
c.texParameteri(k.m,k.n,k.h);c.texParameteri(k.m,k.p,k.b);c.texParameteri(k.m,k.q,k.b)}f.b=p;f.a=function(c,a,b,f,u,v){u=void 0===u?k.j:u;v=void 0===v?k.t:v;c.activeTexture(k.l+c.tempTextureUnit);c.bindTexture(k.m,a);p(c);c.texImage2D(k.m,0,u,b,f,0,u,v,null);c.bindTexture(k.m,null)};f.c=function(c,a,b){c.activeTexture(k.l+c.tempTextureUnit);c.bindTexture(k.m,a);c.texParameteri(k.m,k.o,k.e);c.texParameteri(k.m,k.n,k.e);c.texParameteri(k.m,k.p,k.b);c.texParameteri(k.m,k.q,k.b);c.pixelStorei(k.s,!0);
c.pixelStorei(k.r,4);c.texImage2D(k.m,0,k.j,k.j,k.t,b);c.pixelStorei(k.s,!1);c.bindTexture(k.m,null)};var k=c(29)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"a",function(){return u});c.d(f,"b",function(){return v});n=c(0);var a=c(4),b=function l(a,b,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,d)}else{if("value"in e)return e.value;b=e.get;return void 0===
b?void 0:b.call(d)}},m=function(){function a(a,b){for(var d=0;d<b.length;d++){var e=b[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,e,d){e&&a(b.prototype,e);d&&a(b,d);return b}}(),u=function(){function b(c,e){q(this,b);this.value_=c;this.defaultValue=e;this.changed=new a.a}m(b,[{key:"toggle",value:function(){this.value=!this.value}},{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_}},
{key:"restoreState",value:function(a){this.value=!0===a||!1===a?a:this.defaultValue}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return b}(),v=function(a){function c(a){q(this,c);var d=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.model=a;d.element=document.createElement("input");var b=d.element;b.type="checkbox";d.registerDisposer(a.changed.add(function(){d.updateCheckbox()}));
d.updateCheckbox();d.registerEventListener(b,"change",function(d){a.value=this.checked});b.addEventListener("mousedown",function(a){a.preventDefault()});return d}k(c,a);m(c,[{key:"updateCheckbox",value:function(){this.element.checked=this.model.value}},{key:"disposed",value:function(){var a=this.element,d=a.parentElement;d&&d.removeChild(a);b(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a);(function(a){function b(a,d){q(this,b);var e=p(this,
(b.__proto__||Object.getPrototypeOf(b)).call(this));e.model=a;e.element=d;e.updateVisibility();e.registerDisposer(a.changed.add(function(){e.updateVisibility()}));return e}k(b,a);m(b,[{key:"updateVisibility",value:function(){this.element.style.display=this.model.value?"":"none"}}]);return b})(n.a)},function(n,f,c){(function(f){function k(c,f){b(c);a.call(this);var m=this;this.bufferPosition=0;this.xo=new f("POST",c,null);this.xo.on("chunk",this._chunkHandler.bind(this));this.xo.once("finish",function(a,
c){b("finish",a,c);m._chunkHandler(a,c);m.xo=null;a=200===a?"network":"permanent";b("close",a);m.emit("close",null,a);m._cleanup()})}var q=c(3),a=c(10).EventEmitter,b=function(){};"production"!==f.env.NODE_ENV&&(b=c(7)("sockjs-client:receiver:xhr"));q(k,a);k.prototype._chunkHandler=function(a,c){b("_chunkHandler",a);if(200===a&&c)for(;;this.bufferPosition+=a+1){var f=c.slice(this.bufferPosition);a=f.indexOf("\n");if(-1===a)break;if(f=f.slice(0,a))b("message",f),this.emit("message",f)}};k.prototype._cleanup=
function(){b("_cleanup");this.removeAllListeners()};k.prototype.abort=function(){b("abort");this.xo&&(this.xo.close(),b("close"),this.emit("close",null,"user"),this.xo=null);this._cleanup()};n.exports=k}).call(f,c(6))},function(n,f,c){function p(c,a,b,f){k.call(this,c,a,b,f)}f=c(3);var k=c(126);f(p,k);p.enabled=k.enabled&&k.supportsCORS;n.exports=p},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function a(a,d,b,e){var c=!1,h;a.registerDisposer(d);var g=t.UNLINKED,f=function(){var c=b.value;if(c!==g)switch(c){case t.UNLINKED:h=
void 0;break;case t.LINKED:h=void 0;e.assign(a,d);break;case t.RELATIVE:h=e.difference(a,d)}g=c;a.changed.dispatch()};a.registerDisposer(a.changed.add(function(){if(!c)switch(b.value){case t.LINKED:e.assign(d,a);break;case t.RELATIVE:e.subtract(d,a,h)}}));a.registerDisposer(d.changed.add(function(){c=!0;switch(b.value){case t.UNLINKED:if(e.isValid(a))break;case t.LINKED:e.assign(a,d);break;case t.RELATIVE:e.add(a,d,h)}c=!1}));a.registerDisposer(b.changed.add(f));f();return a}c.d(f,"d",function(){return t});
c.d(f,"b",function(){return r});c.d(f,"f",function(){return B});c.d(f,"a",function(){return C});c.d(f,"g",function(){return D});c.d(f,"c",function(){return y});c.d(f,"e",function(){return E});n=c(0);var b=c(1),m=c(2),u=c(4);c=c(278);var v=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),t;(function(a){a[a.LINKED=
0]="LINKED";a[a.RELATIVE=1]="RELATIVE";a[a.UNLINKED=2]="UNLINKED"})(t||(t={}));var l=function(a){function d(a){a=void 0===a?t.LINKED:a;p(this,d);return k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,t,a))}q(d,a);return d}(c.a),g=function(a){function d(a){p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.changed=new u.a;var c=!0;null==a&&(a=b.p.create(),c=!1);e.size=a;e.valid=c;return e}q(d,a);v(d,[{key:"reset",value:function(){this.valid=!1;this.changed.dispatch()}},
{key:"setValid",value:function(){this.valid||(this.valid=!0,this.changed.dispatch())}},{key:"toJSON",value:function(){if(this.valid)return Array.prototype.slice.call(this.size)}},{key:"restoreState",value:function(a){try{Object(m.b)(this.size,a),this.valid=!0,this.changed.dispatch()}catch(J){this.valid=!1,this.changed.dispatch()}}},{key:"toString",value:function(){return this.valid?this.size.toString():null}},{key:"voxelFromSpatial",value:function(a,d){return b.p.divide(a,d,this.size)}},{key:"spatialFromVoxel",
value:function(a,d){return b.p.multiply(a,d,this.size)}}]);return d}(n.a),e=b.p.create(),d=b.l.create(),h=function(a){function d(a,e){p(this,d);var c=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.voxelCoordinates=null;c.changed=new u.a;null==a&&(a=new g);c.voxelSize=a;var h=!0;null==e&&(e=b.p.create(),h=!1);c.spatialCoordinates=e;c.spatialCoordinatesValid=h;c.registerDisposer(a);c.registerDisposer(a.changed.add(function(){c.handleVoxelSizeChanged()}));return c}q(d,a);v(d,[{key:"reset",
value:function(){this.spatialCoordinatesValid=!1;this.voxelCoordinates=null;this.voxelSize.reset();this.changed.dispatch()}},{key:"getVoxelCoordinates",value:function(a){var d=this.voxelCoordinates;if(d)b.p.copy(a,d);else if(this.valid)this.voxelSize.voxelFromSpatial(a,this.spatialCoordinates);else return!1;return!0}},{key:"setVoxelCoordinates",value:function(a){var d=this.voxelSize;d.valid?(d.spatialFromVoxel(this.spatialCoordinates,a),this.markSpatialCoordinatesChanged()):(d=this.voxelCoordinates)?
b.p.copy(d,a):this.voxelCoordinates=b.p.clone(a);this.changed.dispatch()}},{key:"markSpatialCoordinatesChanged",value:function(){this.spatialCoordinatesValid=!0;this.voxelCoordinates=null;this.changed.dispatch()}},{key:"handleVoxelSizeChanged",value:function(){null==this.voxelCoordinates||this.spatialCoordinatesValid||(this.voxelSize.spatialFromVoxel(this.spatialCoordinates,this.voxelCoordinates),this.spatialCoordinatesValid=!0);this.voxelCoordinates=null;this.changed.dispatch()}},{key:"toJSON",value:function(){var a=
!0,d=this.voxelSize.toJSON(),b={};void 0!==d&&(a=!1,b.voxelSize=d);this.voxelCoordinatesValid?(this.getVoxelCoordinates(e),b.voxelCoordinates=Array.prototype.slice.call(e),a=!1):this.spatialCoordinatesValid&&(b.spatialCoordinates=Array.prototype.slice.call(this.spatialCoordinates),a=!1);if(!a)return b}},{key:"restoreState",value:function(a){var d=this;Object(m.u)(a);Object(m.w)(a,"voxelSize",function(a){void 0!==a&&d.voxelSize.restoreState(a)});this.spatialCoordinatesValid=!1;Object(m.w)(a,"voxelCoordinates",
function(a){void 0!==a&&d.setVoxelCoordinates(Object(m.b)(b.p.create(),a))});Object(m.w)(a,"spatialCoordinates",function(a){void 0!==a&&(Object(m.b)(d.spatialCoordinates,a),d.markSpatialCoordinatesChanged())})}},{key:"snapToVoxel",value:function(){if(this.valid){for(var a=this.spatialCoordinates,d=this.voxelSize.size,b=0;3>b;++b){var e=d[b];a[b]=Math.round(a[b]/e)*e}this.changed.dispatch()}else if(a=this.voxelCoordinates,null!=a){for(d=0;3>d;++d)a[d]=Math.round(a[d]);this.changed.dispatch()}}},{key:"assign",
value:function(a){this.spatialCoordinatesValid=a.spatialCoordinatesValid;b.p.copy(this.spatialCoordinates,a.spatialCoordinates);this.voxelCoordinates=(a=a.voxelCoordinates)&&b.p.clone(a);this.changed.dispatch()}},{key:"valid",get:function(){return this.spatialCoordinatesValid&&this.voxelSize.valid}},{key:"voxelCoordinatesValid",get:function(){return this.valid||null!=this.voxelCoordinates}}],[{key:"getOffset",value:function(a,d){if(a.spatialCoordinatesValid&&d.spatialCoordinatesValid)return{spatialOffset:b.p.subtract(b.p.create(),
a.spatialCoordinates,d.spatialCoordinates)};if(a.voxelCoordinates&&d.voxelCoordinates){if(a.voxelSize!==d.voxelSize)throw Error("Voxel offsets are only meaningful with identical voxelSize.");return{voxelOffset:b.p.subtract(b.p.create(),a.voxelCoordinates,d.voxelCoordinates)}}return{}}},{key:"addOffset",value:function(a,d,c,h){h=void 0===h?1:h;var g=c.spatialOffset;c=c.voxelOffset;void 0!==g&&d.spatialCoordinatesValid?(b.p.scaleAndAdd(a.spatialCoordinates,d.spatialCoordinates,g,h),a.markSpatialCoordinatesChanged()):
void 0!==c&&d.getVoxelCoordinates(e)&&a.setVoxelCoordinates(b.p.scaleAndAdd(e,e,c,h))}}]);return d}(n.a);c=function(){function a(d,b){b=void 0===b?new l:b;p(this,a);this.peer=d;this.link=b}v(a,[{key:"toJSON",value:function(){var a=this.link;if(a.value!==t.LINKED)return{link:a.toJSON(),value:this.getValueJson()}}},{key:"getValueJson",value:function(){return this.value.toJSON()}},{key:"reset",value:function(){this.link.value=t.LINKED}},{key:"restoreState",value:function(a){var d=this;void 0===a?this.link.value=
t.LINKED:(Object(m.u)(a),this.link.value=t.UNLINKED,Object(m.w)(a,"value",function(a){void 0!==a&&d.value.restoreState(a)}),Object(m.w)(a,"link",function(a){return d.link.restoreState(a)}))}},{key:"copyToPeer",value:function(){this.link.value!==t.LINKED&&(this.link.value=t.UNLINKED,this.peer.assign(this.value),this.link.value=t.LINKED)}},{key:"changed",get:function(){return this.value.changed}}]);return a}();var r=function(d){function b(){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments));d.value=a(new h(d.peer.voxelSize.addRef()),d.peer,d.link,{assign:function(a,d){return a.assign(d)},isValid:function(a){return a.spatialCoordinatesValid||a.voxelCoordinatesValid},difference:h.getOffset,add:h.addOffset,subtract:function(a,d,b){h.addOffset(a,d,b,-1)}});return d}q(b,d);v(b,[{key:"getValueJson",value:function(){var a=this.value.toJSON()||{};delete a.voxelSize;return a}}]);return b}(c),B=function(a){function d(a){p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
e.changed=new u.a;null==a&&(a=b.l.create());e.orientation=a;return e}q(d,a);v(d,[{key:"toJSON",value:function(){var a=this.orientation;if(0!==a[0]||0!==a[1]||0!==a[2]||1!==a[3])return Array.prototype.slice.call(this.orientation)}},{key:"restoreState",value:function(a){try{Object(m.b)(this.orientation,a),b.l.normalize(this.orientation,this.orientation)}catch(J){b.l.identity(this.orientation)}this.changed.dispatch()}},{key:"reset",value:function(){b.l.identity(this.orientation);this.changed.dispatch()}},
{key:"snap",value:function(){var a=b.i.create();b.i.fromQuat(a,this.orientation);for(var d=[!1,!1,!1],e=0;3>e;++e){for(var c=0,h=0,g=0;3>g;++g){var f=a[3*e+g];a[3*e+g]=0;!d[g]&&Math.abs(f)>Math.abs(c)&&(c=f,h=g)}a[3*e+h]=Math.sign(c);d[h]=!0}b.l.fromMat3(this.orientation,a);this.changed.dispatch()}},{key:"assign",value:function(a){b.l.copy(this.orientation,a.orientation);this.changed.dispatch()}}],[{key:"makeRelative",value:function(a,e){var c=new d(b.l.multiply(b.l.create(),a.orientation,e)),h=!1;
c.registerDisposer(a.changed.add(function(){h||(g=!0,b.l.multiply(c.orientation,a.orientation,e),c.changed.dispatch(),g=!1)}));var g=!1,f=b.l.invert(b.l.create(),e);c.registerDisposer(c.changed.add(function(){g||(h=!0,b.l.multiply(a.orientation,c.orientation,f),a.changed.dispatch(),h=!1)}));return c}}]);return d}(n.a),C=function(e){function c(){p(this,c);var e=k(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments));e.value=a(new B,e.peer,e.link,{assign:function(a,d){return a.assign(d)},
isValid:function(){return!0},difference:function(a,d){var e=b.l.create();return b.l.multiply(e,b.l.invert(e,d.orientation),a.orientation)},add:function(a,d,e){b.l.multiply(a.orientation,d.orientation,e);a.changed.dispatch()},subtract:function(a,e,c){b.l.multiply(a.orientation,e.orientation,b.l.invert(d,c));a.changed.dispatch()}});return e}q(c,e);return c}(c),D=function(a){function c(a,d){p(this,c);var b=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.changed=new u.a;null==a&&(a=new h);
b.position=a;null==d&&(d=new B);b.orientation=d;b.registerDisposer(b.position);b.registerDisposer(b.orientation);b.registerDisposer(b.position.changed.add(b.changed.dispatch));b.registerDisposer(b.orientation.changed.add(b.changed.dispatch));return b}q(c,a);v(c,[{key:"reset",value:function(){this.position.reset();this.orientation.reset()}},{key:"toMat4",value:function(a){b.j.fromRotationTranslation(a,this.orientation.orientation,this.position.spatialCoordinates)}},{key:"toJSON",value:function(){var a=
this.position.toJSON(),d=this.orientation.toJSON();if(void 0!==a||void 0!==d)return{position:a,orientation:d}}},{key:"restoreState",value:function(a){var d=this;Object(m.u)(a);Object(m.w)(a,"position",function(a){void 0!==a&&d.position.restoreState(a)});Object(m.w)(a,"orientation",function(a){void 0!==a&&d.orientation.restoreState(a)})}},{key:"snap",value:function(){this.orientation.snap();this.position.snapToVoxel();this.changed.dispatch()}},{key:"translateAbsolute",value:function(a){b.p.add(this.position.spatialCoordinates,
this.position.spatialCoordinates,a);this.position.changed.dispatch()}},{key:"translateRelative",value:function(a){this.valid&&(b.p.transformQuat(e,a,this.orientation.orientation),b.p.add(this.position.spatialCoordinates,this.position.spatialCoordinates,e),this.position.changed.dispatch())}},{key:"translateVoxelsRelative",value:function(a){if(this.valid){var d=b.p.create();b.p.transformQuat(d,a,this.orientation.orientation);b.p.multiply(d,d,this.position.voxelSize.size);b.p.add(this.position.spatialCoordinates,
this.position.spatialCoordinates,d);this.position.changed.dispatch()}}},{key:"rotateRelative",value:function(a,d){var e=b.l.create();b.l.setAxisAngle(e,a,d);a=this.orientation.orientation;b.l.multiply(a,a,e);this.orientation.changed.dispatch()}},{key:"rotateAbsolute",value:function(a,c,h){var g=b.l.create();b.l.setAxisAngle(g,a,c);a=this.orientation.orientation;if(void 0!==h){c=this.position.spatialCoordinates;var f=b.p.subtract(e,h,c),r=b.l.invert(d,a);b.p.transformQuat(f,f,r);b.l.multiply(a,g,a);
b.p.transformQuat(c,f,a);b.p.subtract(c,h,c);this.position.changed.dispatch()}else b.l.multiply(a,g,a);this.orientation.changed.dispatch()}},{key:"valid",get:function(){return this.position.valid}}]);return c}(n.a),z=function(a){function d(a,b){a=void 0===a?Number.NaN:a;b=void 0===b?a:b;p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.value_=a;e.defaultValue=b;e.changed=new u.a;return e}q(d,a);v(d,[{key:"toJSON",value:function(){var a=this.value_,d=this.defaultValue;if(!(Number.isNaN(a)&&
Number.isNaN(d)||a===d))return a}},{key:"restoreState",value:function(a){"number"===typeof a&&Number.isFinite(a)&&0<a?this.value=a:this.value=this.defaultValue}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"zoomBy",value:function(a){var d=this.value_;Number.isNaN(d)||(this.value=d*a)}},{key:"assign",value:function(a){this.value=a.value}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}},{key:"valid",get:function(){return!Number.isNaN(this.value)}}]);
return d}(n.a),y=function(d){function b(){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));d.value=function(){var b=new z;return a(b,d.peer,d.link,{assign:function(a,d){return a.assign(d)},isValid:function(a){return a.valid},difference:function(a,d){return a.value/d.value},add:function(a,d,b){a.value=d.value*b},subtract:function(a,d,b){a.value=d.value/b}})}();return d}q(b,d);return b}(c),E=function(a){function d(a,b){a=void 0===a?new D:a;b=void 0===b?Number.NaN:
b;p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));e.pose=a;e.changed=new u.a;e.zoomFactor="number"===typeof b?new z(b):b;e.registerDisposer(e.zoomFactor);e.registerDisposer(a);e.registerDisposer(e.pose.changed.add(function(){e.changed.dispatch()}));e.registerDisposer(e.zoomFactor.changed.add(function(){e.changed.dispatch()}));e.registerDisposer(e.voxelSize.changed.add(function(){e.handleVoxelSizeChanged()}));e.handleVoxelSizeChanged();return e}q(d,a);v(d,[{key:"reset",value:function(){this.pose.reset();
this.zoomFactor.reset()}},{key:"setZoomFactorFromVoxelSize",value:function(){this.voxelSize.valid&&(this.zoomFactor.value=Math.min.apply(null,this.voxelSize.size))}},{key:"handleVoxelSizeChanged",value:function(){this.zoomFactor.valid||this.setZoomFactorFromVoxelSize()}},{key:"toMat4",value:function(a){this.pose.toMat4(a);var d=this.zoomFactor.value;b.j.scale(a,a,b.p.fromValues(d,d,d))}},{key:"toJSON",value:function(){var a=this.pose.toJSON(),d=this.zoomFactor.toJSON();if(void 0!==a||void 0!==d)return{pose:a,
zoomFactor:d}}},{key:"restoreState",value:function(a){var d=this;try{Object(m.u)(a),Object(m.w)(a,"pose",function(a){void 0!==a&&d.pose.restoreState(a)}),Object(m.w)(a,"zoomFactor",function(a){void 0!==a&&d.zoomFactor.restoreState(a)}),this.handleVoxelSizeChanged(),this.changed.dispatch()}catch(F){this.reset()}}},{key:"zoomBy",value:function(a){this.zoomFactor.zoomBy(a)}},{key:"voxelSize",get:function(){return this.pose.position.voxelSize}},{key:"position",get:function(){return this.pose.position}},
{key:"valid",get:function(){return this.pose.valid}}]);return d}(n.a)},function(n,f){},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return b});var k=c(8);n=c(13);var q=function(){function a(a,b){for(var c=
0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),a=function v(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};f=this&&this.__decorate||function(a,b,c,g){var e=
arguments.length,d=3>e?b:null===g?g=Object.getOwnPropertyDescriptor(b,c):g,h;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)d=Reflect.decorate(a,b,c,g);else for(var f=a.length-1;0<=f;f--)if(h=a[f])d=(3>e?h(d):3<e?h(b,c,d):h(b,c))||d;return 3<e&&d&&Object.defineProperty(b,c,d),d};var b=m=function(b){function c(a,b){b=void 0===b?{}:b;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var e=(c.__proto__||Object.getPrototypeOf(c)).call(this,a,b);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
e=!e||"object"!==typeof e&&"function"!==typeof e?this:e;e.updatingValue_=!1;void 0!==a&&(e.base=new k.b(b.value),e.setupChangedHandler());return e}p(c,b);q(c,[{key:"initializeCounterpart",value:function(b,g){g=void 0===g?{}:g;g.value=this.value;a(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"initializeCounterpart",this).call(this,b,g)}},{key:"setupChangedHandler",value:function(){var a=this;this.registerDisposer(this.base.changed.add(function(){if(a.updatingValue_)a.updatingValue_=!1;
else{var b=a.rpc;null!==b&&b.invoke("SharedWatchableValue.changed",{id:a.rpcId,value:a.value})}}))}},{key:"value",get:function(){return this.base.value},set:function(a){this.base.value=a}},{key:"changed",get:function(){return this.base.changed}}],[{key:"makeFromExisting",value:function(a,b){var e=new m;e.base=b;e.setupChangedHandler();e.initializeCounterpart(a);return e}},{key:"make",value:function(a,b){return m.makeFromExisting(a,new k.b(b))}}]);return c}(n.c);b=m=f([Object(n.f)("SharedWatchableValue")],
b);Object(n.e)("SharedWatchableValue.changed",function(a){var b=this.get(a.id);b.updatingValue_=!0;b.base.value=a.value;b.updatingValue_=!1});var m},function(n,f){n.exports=function(c){var f=typeof c;return null!=c&&("object"==f||"function"==f)}},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==
typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function a(a){switch(a){case g.b.FLOAT32:return D.c;default:throw Error("Data type not supported by WebGL: ${DataType[dataType]}");}}f.f=function(a){return new l.a(void 0===
a?"void main() {\n  emitDefault();\n}\n":a,h.B)};c.d(f,"c",function(){return R});c.d(f,"b",function(){return K});c.d(f,"e",function(){return N});c.d(f,"d",function(){return S});var b=c(34);n=c(16);var m=c(43),u=c(54),v=c(168),t=c(65),l=c(8),g=c(37),e=c(0),d=c(1),h=c(2),r=c(23),B=c(4),C=c(24),D=c(29),z=c(35),y=c(14),E=function ha(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return ha(a,d,b)}else{if("value"in
e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}},A=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),G=c(69),H=d.j.create(),J=new Float32Array(4);f.a="//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START";var F=function(a){function b(a){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
d.vertexAttributes=a;d.shaders=new Map;d.shaderGeneration=-1;d.vertexAttributesKey=Object(h.g)(d.vertexAttributes);return d}q(b,a);A(b,[{key:"defineShader",value:function(a,d){a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");var b="\ngl_Position = uProjection * vec4(aVertex0, 1.0);\n";a.addFragmentCode("\nvec4 segmentColor() {\n  return uColor;\n}\nvoid emitRGB(vec3 color) {\n  emit(vec4(color * uColor.a, uColor.a), uPickID);\n}\nvoid emitDefault() {\n  emit(uColor, uPickID);\n}\n");
a.addFragmentCode(G);this.vertexAttributes.forEach(function(d,e){a.addAttribute("highp "+d.glslDataType,"aVertex"+e);0!==e&&(a.addVarying("highp "+d.glslDataType,"vVertex"+e),b+="vVertex"+e+" = aVertex"+e+";\n",a.addFragmentCode("#define "+d.name+" vVertex"+e+"\n"))});a.setVertexMain(b);a.setFragmentMainFunction("//NEUROGLANCER_SKELETON_LAYER_FRAGMENT_MAIN_START\n"+d)}},{key:"beginLayer",value:function(a,b,e,c){e=d.j.multiply(H,e.dataToDevice,c);a.uniformMatrix4fv(b.uniform("uProjection"),!1,e)}},
{key:"getShader",value:function(a,d,b){var e=this;return this.registerDisposer(a.memoize.get("skeleton/SkeletonShaderManager:"+Object(r.a)(d)+":"+this.vertexAttributesKey+":"+b,function(){var c=new z.a(a);c.require(d);e.defineShader(c,b);return c.build()}))}},{key:"setColor",value:function(a,d,b){a.uniform4fv(d.uniform("uColor"),b)}},{key:"setPickID",value:function(a,d,b){a.uniform4fv(d.uniform("uPickID"),Object(y.p)(J,b))}},{key:"drawSkeleton",value:function(a,d,b){for(var e=this.vertexAttributes,
c=e.length,h=b.vertexAttributeOffsets,g=0;g<c;++g){var f=e[g];b.vertexBuffer.bindToVertexAttrib(d.attribute("aVertex"+g),f.numComponents,f.webglDataType,!1,0,h[g])}b.indexBuffer.bind();a.drawElements(a.LINES,b.numIndices,a.UNSIGNED_INT,0)}},{key:"endLayer",value:function(a,d){for(var b=this.vertexAttributes.length,e=0;e<b;++e)a.disableVertexAttribArray(d.attribute("aVertex"+e))}}]);return b}(e.a),R=function(e){function c(b,e,h,g){p(this,c);var f=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));
f.chunkManager=b;f.source=e;f.voxelSizeObject=h;f.displayState=g;f.tempMat=d.j.create();f.redrawNeeded=new B.a;f.fallbackFragmentMain="void main() {\n  emitDefault();\n}\n";Object(u.f)(g,f);f.displayState.shaderError.value=void 0;f.registerDisposer(g.fragmentMain.changed.add(function(){f.displayState.shaderError.value=void 0;f.redrawNeeded.dispatch()}));b=f.sharedObject=f.registerDisposer(new u.b(b,g));b.RPC_TYPE_ID=v.a;b.initializeCounterpartWithChunkManager({source:e.addCounterpartRef()});b=f.vertexAttributes=
[V];e=$jscomp.makeIterator(e.vertexAttributes);for(h=e.next();!h.done;h=e.next())g=$jscomp.makeIterator(h.value),h=g.next().value,g=g.next().value,b.push({name:h,dataType:g.dataType,numComponents:g.numComponents,webglDataType:a(g.dataType),glslDataType:1<g.numComponents?"vec"+g.numComponents:"float"});return f}q(c,e);A(c,[{key:"getShader",value:function(a,d,b){var e=this.displayState.fragmentMain,c=e.changed.count,h=d.shaders;d.shaderGeneration!==c&&(h.clear(),d.shaderGeneration=c);c=h.get(b);if(void 0===
c){c=null;try{c=d.getShader(a,b,e.value),this.fallbackFragmentMain=e.value,this.displayState.shaderError.value=null}catch(Sa){this.displayState.shaderError.value=Sa;try{c=d.getShader(a,b,this.fallbackFragmentMain)}catch(Ta){}}h.set(b,c)}return c}},{key:"draw",value:function(a,e,c,h){void 0===h&&(h=a.emitColor?1:5);var g=this.gl,f=this.source,m=this.displayState,r=Math.min(1,m.objectAlpha.value);if(!(0>=r)){var l=this.getShader(g,c,a.emitter);if(null!==l){l.bind();var t=this.tempMat;d.j.identity(t);
f.skeletonVertexCoordinatesInVoxels&&d.j.scale(t,t,this.voxelSizeObject.size);d.j.multiply(t,this.displayState.objectToDataTransform.transform,t);c.beginLayer(g,l,a,t);f=f.chunks;var v=a.pickIDs;g.lineWidth(h);Object(u.d)(m,f,function(d,h,f){f.state===b.d.GPU_MEMORY&&(a.emitColor&&c.setColor(g,l,Object(u.e)(m,d,r)),a.emitPickID&&c.setPickID(g,l,v.registerUint64(e,h)),c.drawSkeleton(g,l,f))});c.endLayer(g,l)}}}},{key:"visibility",get:function(){return this.sharedObject.visibility}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);
return c}(e.a),K=function(a){function d(a){p(this,d);var b=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new F(b.base.vertexAttributes));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);b.registerDisposer(a.visibility.add(b.visibility));return b}q(d,a);A(d,[{key:"draw",value:function(a){this.base.draw(a,this,this.renderHelper)}},{key:"gl",get:function(){return this.base.gl}},{key:"isTransparent",
get:function(){return 1>this.base.displayState.objectAlpha.value}}]);return d}(m.a),N=function(a){function d(a){p(this,d);var b=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.base=a;b.renderHelper=b.registerDisposer(new F(b.base.vertexAttributes));b.registerDisposer(a);b.registerDisposer(a.redrawNeeded.add(function(){b.redrawNeeded.dispatch()}));b.setReady(!0);b.registerDisposer(a.visibility.add(b.visibility));return b}q(d,a);A(d,[{key:"draw",value:function(a){this.base.draw(a,this,
this.renderHelper,10)}},{key:"gl",get:function(){return this.base.gl}}]);return d}(t.b),V={dataType:g.b.FLOAT32,numComponents:3,name:"",webglDataType:D.c,glslDataType:"vec3"},T=function(a){function d(a,b){p(this,d);a=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a));a.vertexAttributes=b.vertexAttributes;var e=a.indices=b.indices;a.vertexAttributeOffsets=b.vertexAttributeOffsets;a.numIndices=e.length;return a}q(d,a);A(d,[{key:"copyToGPU",value:function(a){E(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"copyToGPU",this).call(this,a);this.vertexBuffer=C.a.fromData(a,this.vertexAttributes,a.ARRAY_BUFFER,a.STATIC_DRAW);this.indexBuffer=C.a.fromData(a,this.indices,a.ELEMENT_ARRAY_BUFFER,a.STATIC_DRAW)}},{key:"freeGPUMemory",value:function(a){E(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose();this.indexBuffer.dispose()}}]);return d}(n.b),L=new Map,S=function(a){function d(){p(this,d);return k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,
arguments))}q(d,a);A(d,[{key:"getChunk",value:function(a){return new T(this,a)}},{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!0}},{key:"vertexAttributes",get:function(){return L}}]);return d}(n.e)},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function q(a,
d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function a(a){a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = color;\n}\n")}function b(a){a.addFragmentCode("\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragColor = pickId;\n}\n")}
c.d(f,"b",function(){return C});c.d(f,"a",function(){return D});var m=c(97),u=c(20),v=c(99);n=c(100);var t=c(46),l=c(17),g=c(1),e=c(104),d=c(67),h=c(105),r=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),B;(function(a){a[a.COLOR=0]="COLOR";a[a.PICK=1]="PICK";a[a.NUM_TEXTURES=2]="NUM_TEXTURES"})(B||(B={}));
var C=function(a){function d(){p(this,d);return k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}q(d,a);r(d,[{key:"draw",value:function(a){}}]);return d}(u.h),D=function(c){function f(b,c,r,q){p(this,f);var A=k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,b,c,q));A.sliceView=r;A.axesLineHelper=A.registerDisposer(m.a.get(A.gl));A.sliceViewRenderHelper=A.registerDisposer(t.d.get(A.gl,a));A.colorFactor=g.r.fromValues(1,1,1,1);A.backgroundColor=g.r.fromValues(.5,.5,.5,1);
A.pickIDs=new v.a;A.visibleLayerTracker=Object(u.i)(A.viewer.layerManager,C,A);A.offscreenFramebuffer=A.registerDisposer(new d.b(A.gl,{colorBuffers:Object(d.e)(A.gl,B.NUM_TEXTURES)}));A.offscreenCopyHelper=A.registerDisposer(d.c.get(A.gl));A.scaleBarCopyHelper=A.registerDisposer(d.c.get(A.gl));A.scaleBarTexture=A.registerDisposer(new h.a(A.gl));Object(l.c)(c,"translate-via-mouse-drag",function(a){A.viewer.mouseState.updateUnconditionally()&&Object(e.a)(a.detail,function(a,d,b){a=A.viewer.navigationState.position;
var e=a.spatialCoordinates;g.p.set(e,d,b,0);g.p.transformMat4(e,e,A.sliceView.viewportToData);a.changed.dispatch()})});Object(l.c)(c,"rotate-via-mouse-drag",function(a){var d=A.viewer.mouseState;if(d.updateUnconditionally()){var b=g.p.clone(d.position);Object(e.a)(a.detail,function(a,d,e){a=A.sliceView.viewportAxes;A.viewer.navigationState.pose.rotateAbsolute(a[1],d/4*Math.PI/180,b);A.viewer.navigationState.pose.rotateAbsolute(a[0],e/4*Math.PI/180,b)})}});A.registerDisposer(r);A.registerDisposer(r.visibility.add(A.visibility));
A.registerDisposer(r.viewChanged.add(function(){A.visible&&b.scheduleRedraw()}));A.registerDisposer(q.showAxisLines.changed.add(function(){A.visible&&A.scheduleRedraw()}));A.registerDisposer(q.showScaleBar.changed.add(function(){A.visible&&A.context.scheduleRedraw()}));return A}q(f,c);r(f,[{key:"draw",value:function(){var d=this.sliceView;if(d.hasValidViewport){this.onResize();d.updateRendering();var e=this.gl,c=d.width,h=d.height,f=d.dataToDevice;this.offscreenFramebuffer.bind(c,h);e.disable(e.SCISSOR_TEST);
this.gl.clearColor(0,0,0,0);e.clear(e.COLOR_BUFFER_BIT);var r=g.j.create();this.sliceViewRenderHelper.draw(d.offscreenFramebuffer.colorBuffers[0].texture,g.d,this.colorFactor,this.backgroundColor,0,0,1,1);var m=this.visibleLayerTracker.getVisibleLayers(),l=this.pickIDs;l.clear();this.offscreenFramebuffer.bindSingle(B.COLOR);l={dataToDevice:d.dataToDevice,pickIDs:l,emitter:a,emitColor:!0,emitPickID:!1,viewportWidth:c,viewportHeight:h};e.enable(e.BLEND);e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);
for(var u=$jscomp.makeIterator(m),t=u.next();!t.done;t=u.next())t.value.draw(l);e.disable(e.BLEND);this.offscreenFramebuffer.bindSingle(B.PICK);l.emitColor=!1;l.emitPickID=!0;l.emitter=b;m=$jscomp.makeIterator(m);for(t=m.next();!t.done;t=m.next())t.value.draw(l);if(this.viewer.showAxisLines.value||this.viewer.showScaleBar.value){if(this.viewer.showAxisLines.value){g.j.copy(r,f);for(f=0;3>f;++f)r[12+f]=0;for(f=0;4>f;++f)r[2+4*f]=0;h=Math.min(c,h)/4*1.5;f=d.pixelSize;for(m=0;12>m;++m)r[m]=r[m]*h*f}this.offscreenFramebuffer.bindSingle(B.COLOR);
this.viewer.showAxisLines.value&&this.axesLineHelper.draw(r);this.viewer.showScaleBar.value&&(e.enable(e.BLEND),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA),r=this.scaleBarTexture,h=r.dimensions,h.targetLengthInPixels=Math.min(c/4,100),h.nanometersPerPixel=d.pixelSize,r.update(),e.viewport(10,10,r.width,r.height),this.scaleBarCopyHelper.draw(r.texture),e.disable(e.BLEND))}this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[B.COLOR].texture)}}},
{key:"onResize",value:function(){this.sliceView.setViewportSize(this.element.clientWidth,this.element.clientHeight)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=null;var d=this.sliceView;if(!d.hasValidViewport)return!1;var b=d.width,e=d.height,c=this.offscreenFramebuffer;if(!c.hasSize(b,e))return!1;var h=a.position,f=this.mouseX,r=this.mouseY;g.p.set(h,f-b/2,r-e/2,0);g.p.transformMat4(h,h,d.viewportToData);this.pickIDs.setMouseState(a,c.readPixelAsUint32(B.PICK,f,e-r));return!0}},
{key:"zoomByMouse",value:function(a){var d=this.navigationState;if(d.valid){var b=this.sliceView,e=b.height,c=this.mouseX,h=this.mouseY;c-=b.width/2;h-=e/2;e=this.navigationState.zoomFactor.value;d.zoomBy(a);a=d.zoomFactor.value;var f=d.position.spatialCoordinates;g.p.scaleAndAdd(f,f,b.viewportAxes[0],c*(e-a));g.p.scaleAndAdd(f,f,b.viewportAxes[1],h*(e-a));d.position.changed.dispatch()}}},{key:"navigationState",get:function(){return this.sliceView.navigationState}}]);return f}(n.a)},function(n,f,
c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});n=c(20);var k=c(1),q=c(38),a=c(35),b=function(){function a(a,b){for(var e=0;e<b.length;e++){var d=b[e];d.enumerable=d.enumerable||!1;d.configurable=!0;
"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),m=function l(a,b,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,d)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(d)}},u=k.p.create(),v=function(c){function g(a,d,b){b=void 0===b?{}:b;var e=void 0===b.shaderError?Object(q.b)():b.shaderError;if(!(this instanceof
g))throw new TypeError("Cannot call a class as a function");b=(g.__proto__||Object.getPrototypeOf(g)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.sources=null;b.sourceIds=[];b.shader=void 0;b.shaderUpdated=!0;b.rpcId=null;b.shaderError=e;e.value=void 0;b.chunkManager=a;b.sources=d;a=$jscomp.makeIterator(d);for(d=a.next();!d.done;d=a.next()){e=d.value;d=[];b.sourceIds.push(d);e=$jscomp.makeIterator(e);
for(var c=e.next();!c.done;c=e.next())d.push(c.value.rpcId)}a=b.sources[0][0].spec;d=a.chunkLayout;e=b.voxelSize=d.localSpatialVectorToGlobal(k.p.create(),a.voxelSize);for(c=0;3>c;++c)e[c]=Math.abs(e[c]);e=b.boundingBox=new k.b(k.p.fromValues(Infinity,Infinity,Infinity),k.p.fromValues(-Infinity,-Infinity,-Infinity));c=k.p.create();for(var h=0;8>h;++h){for(var f=0;3>f;++f)u[f]=h&1<<f?a.upperClipBound[f]:a.lowerClipBound[f];d.localSpatialToGlobal(c,u);k.p.min(e.lower,e.lower,c);k.p.max(e.upper,e.upper,
c)}b.setReady(!0);return b}p(g,c);b(g,[{key:"initializeShader",value:function(){if(this.shaderUpdated){this.shaderUpdated=!1;try{var a=this.getShader();this.disposeShader();this.shader=a;this.shaderError.value=null}catch(d){this.shaderError.value=d}}}},{key:"disposeShader",value:function(){this.shader&&(this.shader.dispose(),this.shader=void 0)}},{key:"disposed",value:function(){m(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this);this.disposeShader()}},{key:"getShaderKey",
value:function(){return""}},{key:"getShader",value:function(){var a=this,d=this.getShaderKey();return this.gl.memoize.get(d,function(){return a.buildShader()})}},{key:"buildShader",value:function(){var b=new a.a(this.gl);this.defineShader(b);return b.build()}},{key:"gl",get:function(){return this.chunkManager.chunkQueueManager.gl}}]);return g}(n.e)},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}c.d(f,"a",function(){return g});f.e=function(a,d,b,e){b=void 0===b?a.RGBA:b;e=void 0===e?a.UNSIGNED_BYTE:e;for(var c=[],g=0;g<d;++g)c[g]=
new h(a,b,e);return c};c.d(f,"b",function(){return B});c.d(f,"c",function(){return C});n=c(0);var a=c(1),b=c(23),m=c(68),u=c(56),v=c(98),t=function z(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return z(a,d,b)}else{if("value"in e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}},l=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in
e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}();c=function(a){function d(){p(this,d);var a=k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.width=Number.NaN;a.height=Number.NaN;return a}q(d,a);l(d,[{key:"hasSize",value:function(a,d){return this.width===a&&this.height===d}},{key:"resize",value:function(a,d){this.hasSize(a,d)||(this.width=a,this.height=d,this.performResize())}}]);return d}(n.a);var g=function(a){function d(a,
b){b=void 0===b?!1:b;p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b?a.DEPTH_STENCIL:a.DEPTH_COMPONENT16));e.gl=a;e.includeStencilBuffer=b;return e}q(d,a);l(d,[{key:"attachToFramebuffer",value:function(){var a=this.gl;t(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"attachToFramebuffer",this).call(this,this.includeStencilBuffer?a.DEPTH_STENCIL_ATTACHMENT:a.DEPTH_ATTACHMENT)}}]);return d}(function(a){function d(a,b){p(this,d);var e=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
e.gl=a;e.internalformat=b;e.renderbuffer=null;e.renderbuffer=a.createRenderbuffer();return e}q(d,a);l(d,[{key:"performResize",value:function(){var a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,this.renderbuffer);a.renderbufferStorage(a.RENDERBUFFER,this.internalformat,this.width,this.height);a.bindRenderbuffer(a.RENDERBUFFER,null)}},{key:"disposed",value:function(){this.gl.deleteRenderbuffer(this.renderbuffer)}},{key:"attachToFramebuffer",value:function(a){var d=this.gl;d.framebufferRenderbuffer(d.FRAMEBUFFER,
a,d.RENDERBUFFER,this.renderbuffer)}}]);return d}(c)),e=function(a){function d(a){p(this,d);return k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,!0))}q(d,a);return d}(g);f.d=e;var d=function(a){function d(a){p(this,d);var b=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));b.gl=a;b.framebuffer=b.gl.createFramebuffer();return b}q(d,a);l(d,[{key:"disposed",value:function(){this.gl.deleteFramebuffer(this.framebuffer)}},{key:"bind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,
this.framebuffer)}},{key:"unbind",value:function(){var a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,null)}}]);return d}(n.a),h=function(a){function d(a,b,e){p(this,d);var c=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.gl=a;c.format=b;c.dataType=e;c.texture=a.createTexture();return c}q(d,a);l(d,[{key:"performResize",value:function(){Object(u.a)(this.gl,this.texture,this.width,this.height,this.format,this.dataType)}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture)}},
{key:"attachToFramebuffer",value:function(a){var d=this.gl;d.framebufferTexture2D(d.FRAMEBUFFER,a,d.TEXTURE_2D,this.texture,0)}}]);return d}(c),r=new Uint8Array(4),B=function(a){function b(a,e){p(this,b);var c=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.gl=a;c.width=Number.NaN;c.height=Number.NaN;c.fullAttachmentList=[];c.attachmentVerified=!1;c.singleAttachmentList=[c.gl.COLOR_ATTACHMENT0];var h=void 0===e.framebuffer?new d(a):e.framebuffer,g=e.colorBuffers;e=e.depthBuffer;c.framebuffer=
c.registerDisposer(h);c.colorBuffers=g;c.depthBuffer=e;void 0!==e&&c.registerDisposer(e);var f=c.fullAttachmentList;g.forEach(function(d,b){c.registerDisposer(d);f[b]=a.COLOR_ATTACHMENT0+b});return c}q(b,a);l(b,[{key:"hasSize",value:function(a,d){return this.width===a&&this.height===d}},{key:"bind",value:function(a,d){this.width=a;this.height=d;this.framebuffer.bind();var b=this.gl,e=this.depthBuffer;void 0!==e&&(e.resize(a,d),e.attachToFramebuffer());this.colorBuffers.forEach(function(e,c){e.resize(a,
d);e.attachToFramebuffer(b.COLOR_ATTACHMENT0+c)});b.WEBGL_draw_buffers.drawBuffersWEBGL(this.fullAttachmentList);this.verifyAttachment();b.viewport(0,0,a,d)}},{key:"bindSingle",value:function(a){var d=this.gl;this.framebuffer.bind();0!==a&&d.framebufferTexture2D(d.FRAMEBUFFER,d.COLOR_ATTACHMENT0+a,d.TEXTURE_2D,null,0);d.bindTexture(d.TEXTURE_2D,null);this.colorBuffers[a].attachToFramebuffer(d.COLOR_ATTACHMENT0);d.WEBGL_draw_buffers.drawBuffersWEBGL(this.singleAttachmentList)}},{key:"unbind",value:function(){this.framebuffer.unbind()}},
{key:"readPixel",value:function(a,d,b){var e=this.gl;try{this.bindSingle(a),e.readPixels(d,b,1,1,e.RGBA,e.UNSIGNED_BYTE,r)}finally{this.framebuffer.unbind()}return r}},{key:"readPixelAsUint32",value:function(a,d,b){a=this.readPixel(a,d,b);return a[0]+(a[1]<<8)+(a[2]<<16)+(a[3]<<24)}},{key:"verifyAttachment",value:function(){if(!this.attachmentVerified){var a=this.gl;if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw Error("Framebuffer configuration not supported");this.attachmentVerified=
!0}}}]);return b}(n.a),C=function(d){function e(a,d){p(this,e);var b=k(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));b.gl=a;b.shader=d;b.copyVertexPositionsBuffer=Object(m.a)(b.gl);b.copyTexCoordsBuffer=Object(m.a)(b.gl,0,0,1,1);b.registerDisposer(d);return b}q(e,d);l(e,[{key:"draw",value:function(d){for(var b=[],e=0;e<arguments.length;++e)b[e-0]=arguments[e];e=this.gl;var c=this.shader;c.bind();for(var h=b.length,g=0;g<h;++g)e.activeTexture(e.TEXTURE0+g),e.bindTexture(e.TEXTURE_2D,b[g]);
e.uniformMatrix4fv(c.uniform("uProjectionMatrix"),!1,a.d);b=c.attribute("aVertexPosition");this.copyVertexPositionsBuffer.bindToVertexAttrib(b,2);c=c.attribute("aTexCoord");this.copyTexCoordsBuffer.bindToVertexAttrib(c,2);e.drawArrays(e.TRIANGLE_FAN,0,4);e.disableVertexAttribArray(b);e.disableVertexAttribArray(c);for(b=0;b<h;++b)e.activeTexture(e.TEXTURE0+b),e.bindTexture(e.TEXTURE_2D,null)}}],[{key:"get",value:function(a,d,c){d=void 0===d?v.a:d;c=void 0===c?1:c;return a.memoize.get("OffscreenCopyHelper:"+
c+":"+Object(b.a)(d),function(){return new e(a,Object(v.b)(a,d,c))})}}]);return e}(n.a)},function(n,f,c){f.a=function(a,b,c,f,v){b=void 0===b?-1:b;c=void 0===c?-1:c;f=void 0===f?1:f;v=void 0===v?1:v;return a.memoize.get("SquareCornersBuffer:"+b+","+c+","+f+","+v,function(){return new p.b(k.a.fromData(a,new Float32Array([b,c,b,v,f,v,f,c]),q.a,q.k))}).value};var p=c(0),k=c(24),q=c(29)},function(n,f){n.exports="\n\nvec3 colormapJet(float x) {\n  vec3 result;\n  result.r = x < 0.89 ? ((x - 0.35) / 0.31) : (1.0 - (x - 0.89) / 0.11 * 0.5);\n  result.g = x < 0.64 ? ((x - 0.125) * 4.0) : (1.0 - (x - 0.64) / 0.27);\n  result.b = x < 0.34 ? (0.5 + x * 0.5 / 0.11) : (1.0 - (x - 0.34) / 0.31);\n  return clamp(result, 0.0, 1.0);\n}\n"},
function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}function k(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&"function"!==typeof d?a:d}function q(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,
configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function a(a){Object(y.u)(a);var d=Object(y.w)(a,"neariso_voxelres",function(a){return Object(y.v)(a,y.k)}),b=Object(y.w)(a,"neariso_imagesize",function(a){return Object(y.v)(a,y.j)}),e=Object(y.w)(a,"neariso_offset",function(a){return Object(y.v)(a,y.l)});return Object(y.w)(a,"resolutions",function(a){return Object(y.a)(a,y.s)}).map(function(a){var c=""+a,h=d.get(c),g=b.get(c),f=e.get(c);if(void 0===h||void 0===
g||void 0===f)throw Error("Missing neariso_voxelres/neariso_imagesize/neariso_offset for resolution "+(a+"."));return{key:c,voxelSize:h,imageSize:g,voxelOffset:f}})}function b(a){a=A.get(a);void 0===a&&(a=r.d.UNKNOWN);return a}function m(a){Object(y.u)(a);var d=Object(y.w)(a,"channel_type",y.B);return{channelType:d,description:Object(y.w)(a,"description",y.B),volumeType:b(d),dataType:Object(y.w)(a,"datatype",function(a){return Object(y.n)(a,r.a)})}}function u(d){Object(y.u)(d);return{channels:Object(y.w)(d,
"channels",function(a){return Object(y.v)(a,m)}),scales:Object(y.w)(d,"dataset",a)}}function v(a,d,b,e){return a.memoize.getUncounted({type:"ndstore:getTokenInfo",hostnames:d,token:b},function(){return Object(z.e)(Object(z.c)(d,e+"/"+b+"/info/"),"json").then(u)})}function t(a,d,b,e){var c=b.match(F);if(null===c)throw Error("Invalid volume path "+JSON.stringify(b));var h=c[1],g=c[2],f=Object(y.e)(c[3]||"");return a.memoize.getUncounted({type:"ndstore:MultiscaleVolumeChunkSource",hostnames:d,path:b},
function(){return v(a,d,h,e).then(function(b){return new J(a,d,h,b,g,e,f)})})}function l(a,d){var b=d.match(R);if(null===b)throw Error("Invalid ndstore volume path: "+JSON.stringify(d));return t(a,[b[1]],b[2],h.b)}function g(a,d,b){return a.memoize.getUncounted({type:"dvid:getPublicTokens",hostnames:d},function(){return Object(z.e)(Object(z.c)(d,b+"/public_tokens/"),"json").then(function(a){return Object(y.a)(a,y.B)})})}function e(a,d,b,e){var c=b.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===
c)return Promise.reject(null);if(void 0===c[2]){var h=c[1]||"";return g(a,d,e).then(function(a){return{offset:0,completions:Object(C.c)(h,a,function(a){return a+"/"},function(){})}})}return v(a,d,c[1],e).then(function(a){a=Object(C.c)(c[2],a.channels,function(a){return a[0]},function(a){return a[1].channelType+" ("+r.a[a[1].dataType]+")"});return{offset:c[1].length+1,completions:a}})}function d(a,d){var b=a.match(R);return null===b?Promise.reject(null):e(d,[b[1]],b[2],h.b).then(function(a){return Object(C.a)(b[1].length+
1,a)})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"getVolume",function(){return l});c.d(f,"volumeCompleter",function(){return d});c.d(f,"MultiscaleVolumeChunkSource",function(){return J});f.getTokenInfo=v;f.getShardedVolume=t;f.getPublicTokens=g;f.tokenAndChannelCompleter=e;c.d(f,"NDStoreDataSource",function(){return K});c.d(f,"SingleServerDataSource",function(){return N});n=c(16);f=c(28);var h=c(106),r=c(11),B=c(21),C=c(42),D=c(1),z=c(36),y=c(2),E=function(){function a(a,d){for(var b=
0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),A=new Map;A.set("image",r.d.IMAGE);A.set("annotation",r.d.SEGMENTATION);var G=new Set(["npz","raw","jpeg"]),H=function(a){function d(){p(this,d);return k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}q(d,a);return d}(Object(n.f)(B.b,h.c)),J=function(){function a(d,b,e,c,g,
f,m){p(this,a);this.chunkManager=d;this.baseUrls=b;this.key=e;this.tokenInfo=c;this.parameters=m;this.urlPrefix=h.b;this.neariso=!0;if(void 0===g){g=Array.from(c.channels.keys());if(1!==g.length)throw Error("Dataset contains multiple channels: "+JSON.stringify(g));g=g[0]}d=c.channels.get(g);if(void 0===d)throw Error("Specified channel "+JSON.stringify(g)+" is not one of the supported "+("channels "+JSON.stringify(Array.from(c.channels.keys()))));this.channel=g;this.channelInfo=d;this.scales=c.scales;
void 0!==f&&(this.urlPrefix=f);"false"===Object(y.z)(m.neariso)&&(this.neariso=!1);c=Object(y.z)(m.encoding);if(void 0===c)c=this.volumeType===r.d.IMAGE?"jpeg":"npz";else if(!G.has(c))throw Error("Invalid encoding: "+JSON.stringify(c)+".");this.encoding=c}E(a,[{key:"getSources",value:function(a){var d=this;return this.scales.map(function(b){for(var e=b.voxelOffset,c=b.voxelSize,h=D.p.create(),g=0;3>g;++g)h[g]=Math.ceil(e[g]);return r.c.getDefaults({numChannels:d.numChannels,volumeType:d.volumeType,
dataType:d.dataType,voxelSize:c,transform:D.j.fromTranslation(D.j.create(),D.p.multiply(D.p.create(),e,c)),baseVoxelOffset:h,upperVoxelBound:b.imageSize,volumeSourceOptions:a}).map(function(a){return d.chunkManager.getChunkSource(H,{spec:a,parameters:{baseUrls:d.baseUrls,urlPrefix:d.urlPrefix,key:d.key,channel:d.channel,resolution:b.key,encoding:d.encoding,neariso:d.neariso}})})})}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return this.channelInfo.dataType}},
{key:"numChannels",get:function(){return 1}},{key:"volumeType",get:function(){return this.channelInfo.volumeType}}]);return a}(),F=/^([^\/?]+)(?:\/([^\/?]+))?(?:\?(.*))?$/,R=/^((?:http|https):\/\/[^\/?]+)\/(.*)$/,K=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);E(b,[{key:"volumeCompleter",value:function(a,b){return d(a,b)}},{key:"getVolume",value:function(a,d){return l(a,d)}},{key:"description",get:function(){return"NDstore"}}]);
return b}(f.a),N=function(a){function d(a,b,e){e=void 0===e?h.b:e;p(this,d);var c=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.description=a;c.hostnames=b;c.urlprefix=e;return c}q(d,a);E(d,[{key:"getVolume",value:function(a,d){return t(a,this.hostnames,d,this.urlprefix)}},{key:"volumeCompleter",value:function(a,d){return e(d,this.hostnames,a,this.urlprefix)}}]);return d}(f.a)},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"c",function(){return b});c.d(f,"b",function(){return m});var k=c(47),q=c(1),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);
return b}}(),b;(function(a){a[a.LINE=0]="LINE";a[a.POINT=1]="POINT"})(b||(b={}));var m=function(b){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");a=(c.__proto__||Object.getPrototypeOf(c)).call(this,a);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(c,b);a(c,[{key:"toObject",value:function(){return{transform:this.chunkLayout.transform,chunkDataSize:this.chunkDataSize,
voxelSize:this.voxelSize,lowerVoxelBound:this.lowerVoxelBound,upperVoxelBound:this.upperVoxelBound,lowerClipBound:this.lowerClipBound,upperClipBound:this.upperClipBound,baseVoxelOffset:this.baseVoxelOffset}}}],[{key:"make",value:function(a){return new c(Object.assign({},a,{transform:Object(k.g)(a.transform,a.vectorGraphicsSourceOptions)}))}},{key:"fromObject",value:function(a){return new c(a)}},{key:"withDefaults",value:function(a){var b=a.transform,g=a.lowerVoxelBound,e=a.upperVoxelBound,d=a.chunkDataSize;
b=Object(k.g)(b,a.vectorGraphicsSourceOptions);if(void 0===d&&(d=q.p.clone(e),void 0!==g))for(e=0;3>e;e++)d[e]+=Math.abs(g[e]);console.log(d);console.log(a);return new c(Object.assign({},a,{transform:b,chunkDataSize:d}))}}]);return c}(k.e);f.a="vectorgraphics/RenderLayer"},function(n,f,c){c.d(f,"a",function(){return b});var p=c(1),k=c(2),q=c(4),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,
f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function(){function b(a){a=void 0===a?p.j.create():a;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.transform=a;this.changed=new q.a}a(b,[{key:"reset",value:function(){p.j.copy(this.transform,p.d);this.changed.dispatch()}},{key:"toJSON",value:function(){if(!p.j.equals(p.d,this.transform)){var a=this.transform;return[[a[0],a[4],a[8],a[12]],[a[1],a[5],a[9],a[13]],[a[2],a[6],a[10],a[14]],
[a[3],a[7],a[11],a[15]]]}}},{key:"restoreState",value:function(a){if(null==a)this.reset();else if(Array.isArray(a))if(4===a.length)try{for(var b=0;4>b;++b)Object(k.b)(this.transform.subarray(4*b,4*(b+1)),a[b]);p.j.transpose(this.transform,this.transform)}catch(g){this.reset()}else if(16===a.length)try{Object(k.b)(this.transform,a),p.j.transpose(this.transform,this.transform)}catch(g){this.reset()}else this.reset();else if("object"===typeof a){b=p.l.create();var c=p.p.create(),f=p.p.fromValues(1,1,
1);try{Object(k.b)(b,a.rotation),p.l.normalize(b,b)}catch(g){p.l.identity(b)}try{Object(k.b)(c,a.translation)}catch(g){p.p.copy(c,p.h)}try{Object(k.b)(f,a.scale)}catch(g){p.p.copy(f,p.g)}p.j.fromRotationTranslationScale(this.transform,b,c,f);this.changed.dispatch()}else this.reset()}},{key:"clone",value:function(){return new b(p.j.clone(this.transform))}}]);return b}()},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||
"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return m});n=c(0);var q=c(12),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var g=b[c];g.enumerable=g.enumerable||
!1;g.configurable=!0;"value"in g&&(g.writable=!0);Object.defineProperty(a,g.key,g)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function v(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};c(194);var m=function(c){function f(a,b){var e=void 0===b?{}:b;b=void 0===e.min?0:e.min;var d=void 0===e.max?
1:e.max;e=void 0===e.step?.01:e.step;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));c.value=a;c.element=document.createElement("label");c.promptElement=document.createElement("span");c.inputElement=document.createElement("input");var g=c.element,m=c.promptElement,l=c.inputElement;g.className="range-slider";m.className="range-prompt";l.type="range";l.min=""+b;l.max=""+d;l.step=""+e;l.valueAsNumber=c.value.value;
g.appendChild(m);g.appendChild(l);var t=function(){c.value.value=c.inputElement.valueAsNumber};c.registerEventListener(l,"change",t);c.registerEventListener(l,"input",t);c.registerEventListener(l,"wheel",function(a){a=a.deltaY;0<a?(c.inputElement.stepUp(),t()):0>a&&(c.inputElement.stepDown(),t())});a.changed.add(function(){c.inputElement.valueAsNumber=c.value.value});return c}k(f,c);a(f,[{key:"disposed",value:function(){Object(q.b)(this.element);b(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),
"disposed",this).call(this)}}]);return f}(n.a)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});n=c(195);c.n(n);n=c(115);var q=c.n(n);n=c(9);var a=c.n(n);n=c(0);var b=c(12),m=function(){function a(a,b){for(var e=0;e<b.length;e++){var d=b[e];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),u=function l(a,b,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===
e){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,d)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(d)}};c(196);c(197);c(198);c(199)(q.a);var v=function(c){function g(b){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var d=p(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));d.state=b;d.changingValue=!1;d.debouncedValueUpdater=a()(function(){d.changingValue=!0;try{d.state.fragmentMain.value=d.textEditor.getValue()}finally{d.changingValue=
!1}},500);d.textEditor=q()(function(a){},{value:d.state.fragmentMain.value,mode:"glsl",gutters:["CodeMirror-lint-markers"]});d.textEditor.on("change",function(){d.setValidState(void 0);d.debouncedValueUpdater()});d.registerDisposer(d.state.fragmentMain.changed.add(function(){d.changingValue||d.textEditor.setValue(d.state.fragmentMain.value)}));d.element.classList.add("neuroglancer-shader-code-widget");d.registerDisposer(d.state.shaderError.changed.add(function(){d.updateErrorState()}));d.updateErrorState();
return d}k(g,c);m(g,[{key:"updateErrorState",value:function(){var a=this,d=this.state.shaderError.value;void 0===d?this.setValidState(void 0):null!==d?(this.textEditor.setOption("lint",{getAnnotations:function(){if("ShaderCompilationError"===d.name){var b=d.source.split("\n").indexOf(a.state.fragmentMainStartLine)+2;return d.errorMessages.map(function(a){return{message:a.message,severity:"error",from:q.a.Pos(void 0===a.line?0:a.line-b)}})}return"ShaderLinkError"===d.name?[{message:d.log,severity:"error",
from:q.a.Pos(0)}]:[{message:d.message,severity:"error",from:q.a.Pos(0)}]}}),this.setValidState(!1)):(this.textEditor.setOption("lint",void 0),this.setValidState(!0))}},{key:"setValidState",value:function(a){var d=this.element;d.classList.remove("invalid-input");d.classList.remove("valid-input");!0===a?d.classList.add("valid-input"):!1===a&&d.classList.add("invalid-input")}},{key:"disposed",value:function(){this.debouncedValueUpdater.flush();this.debouncedValueUpdater=void 0;Object(b.b)(this.element);
this.textEditor=void 0;u(g.prototype.__proto__||Object.getPrototypeOf(g.prototype),"disposed",this).call(this)}},{key:"element",get:function(){return this.textEditor.getWrapperElement()}}]);return g}(n.a)},function(n,f){},function(n,f,c){c.d(f,"a",function(){return k});var p=function(){function c(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,b,f){b&&c(a.prototype,b);f&&c(a,
f);return a}}();f.b=4093;var k=function(){function c(a,b,f,u){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.a0=a;this.a1=b;this.b=f;this.c=u}p(c,[{key:"computeDotProduct",value:function(a,b){var c=this.a0,f=this.a1;return c[0]*(a&255)+c[1]*(a>>8&255)+c[2]*(a>>16&255)+c[3]*(a>>24&255)+(f[0]*(b&255)+f[1]*(b>>8&255)+f[2]*(b>>16&255)+f[3]*(b>>24&255))}},{key:"compute",value:function(a,b){var c=this.b,f=this.c;a=this.computeDotProduct(a,b);return(a+a*a%4093*f+c)%
4093}},{key:"toString",value:function(){return"new HashFunction(Float32Array.of("+this.a0+"), "+("Float32Array.of("+this.a1+"), "+this.b+", "+this.c+")")}}],[{key:"generate",value:function(){function a(){return Math.floor(4093*Math.random())}return new c(Float32Array.of(a(),a(),a(),a()),Float32Array.of(a(),a(),a(),a()),a(),a())}}]);return c}()},function(n,f,c){function p(a,d){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!d||"object"!==typeof d&&
"function"!==typeof d?a:d}function k(a,d){if("function"!==typeof d&&null!==d)throw new TypeError("Super expression must either be null or a function, not "+typeof d);a.prototype=Object.create(d&&d.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});d&&(Object.setPrototypeOf?Object.setPrototypeOf(a,d):a.__proto__=d)}function q(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}c.d(f,"b",function(){return e});c.d(f,"a",function(){return C});
var a=c(76),b=c(19),m=function z(a,d,b){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,d);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return z(a,d,b)}else{if("value"in e)return e.value;d=e.get;return void 0===d?void 0:d.call(b)}},u=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}();
f.c=3;var v=0,t=0,l=0,g=0;n=function(){function d(a){a=void 0===a?d.generateHashFunctions(3):a;q(this,d);this.loadFactor=.9;this.size=0;this.growFactor=1.2;this.maxHeight=8192;this.emptyHigh=this.emptyLow=4294967295;this.maxAttempts=this.maxRehashAttempts=5;this.maxWidth=4096/this.entryStride;this.generation=0;this.mungedEmptyKey=-1;this.hashFunctions=a;this.allocate(4,1)}u(d,[{key:"updateHashFunctions",value:function(a){this.hashFunctions=d.generateHashFunctions(a);this.mungedEmptyKey=-1}},{key:"tableWithMungedEmptyKey",
value:function(a){for(var d=this.hashFunctions.length,b=Array(d),e=0;e<d;++e)b[e]=this.getHash(e,this.emptyLow,this.emptyHigh);e=this.mungedEmptyKey;if(-1===e)a:for(;;){e=16777216*Math.random()>>>0;for(var c=0;c<d;++c)for(var h=this.getHash(c,e,e),g=0;g<d;++g)if(b[g]===h)continue a;this.mungedEmptyKey=e;break}c=this.table;h=this.emptyLow;g=this.emptyHigh;for(var f=0;f<d;++f){var r=b[f];c[r]===h&&c[r+1]===g&&(c[r]=e,c[r+1]=e)}try{a(c)}finally{for(a=0;a<d;++a)f=b[a],c[f]===e&&c[f+1]===e&&(c[f]=h,c[f+
1]=g)}}},{key:"getHash",value:function(a,d,b){a=this.hashFunctions[a];var e=this.width,c=this.height;e=a[0].compute(d,b)%e;d=a[1].compute(d,b)%c;return this.entryStride*(d*this.width+e)}},{key:"keys",value:function(a){function d(d,B){for(;;)switch(e){case 0:a=void 0===a?new b.a:a,k=v,t=k.emptyLow,u=k.emptyHigh,l=k.entryStride,m=v,r=m.table,f=0,g=r.length;case 1:if(!(f<g)){e=3;break}h=r[f];c=r[f+1];if(h===t&&c===u){e=4;break}a.low=h;a.high=c;e=5;return{value:a,done:!1};case 5:if(void 0===B){e=6;break}e=
-1;throw B;case 6:case 4:case 2:f+=l;e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,c,h,g,f,r,m,l,u,t,k,v=this,B={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();B[Symbol.iterator]=function(){return this};return B}},{key:"indexOfPair",value:function(a,d){var b=this.table,e=this.emptyHigh;if(a===this.emptyLow&&d===e)return-1;e=0;for(var c=this.hashFunctions.length;e<
c;++e){var h=this.getHash(e,a,d);if(b[h]===a&&b[h+1]===d)return h}return-1}},{key:"indexOf",value:function(a){return this.indexOfPair(a.low,a.high)}},{key:"chooseAnotherEmptyKey",value:function(){for(var a=this.emptyLow,d=this.emptyHigh,b=this.table,e=this.entryStride,c,h;c=4294967296*Math.random()>>>0,h=4294967296*Math.random()>>>0,c===a&&h===d||this.hasPair(c,h););this.emptyLow=c;this.emptyHigh=h;for(var g=0,f=b.length;g<f;g+=e)b[g]===a&&b[g+1]===d&&(b[g]=c,b[g+1]=h)}},{key:"has",value:function(a){return-1!==
this.indexOf(a)}},{key:"hasPair",value:function(a,d){return-1!==this.indexOfPair(a,d)}},{key:"delete",value:function(a){a=this.indexOf(a);if(-1!==a){var d=this.table;d[a]=this.emptyLow;d[a+1]=this.emptyHigh;++this.generation;this.size--;return!0}return!1}},{key:"clearTable",value:function(){for(var a=this.table,d=this.entryStride,b=this.emptyLow,e=this.emptyHigh,c=a.length,h=0;h<c;h+=d)a[h]=b,a[h+1]=e}},{key:"clear",value:function(){if(0===this.size)return!1;this.size=0;++this.generation;this.clearTable();
return!0}},{key:"swapPending",value:function(a,d){var b=v,e=t;this.storePending(a,d);a[d]=b;a[d+1]=e}},{key:"storePending",value:function(a,d){v=a[d];t=a[d+1]}},{key:"backupPending",value:function(){l=v;g=t}},{key:"restorePending",value:function(){v=l;t=g}},{key:"tryToInsert",value:function(){for(var a=0,d=this.emptyLow,b=this.emptyHigh,e=this.maxAttempts,c=this.table,h=this.hashFunctions.length,g=Math.floor(Math.random()*h);;){var f=this.getHash(g,v,t);this.swapPending(c,f);if(v===d&&t===b)return!0;
if(++a===e)break;g=(g+Math.floor(Math.random()*(h-1))+1)%h}return!1}},{key:"allocate",value:function(a,d){var b=a*d;this.width=a;this.height=d;this.table=new Uint32Array(b*this.entryStride);this.maxAttempts=b;this.clearTable();this.capacity=b*this.loadFactor;this.mungedEmptyKey=-1}},{key:"rehash",value:function(a,d,b){this.allocate(d,b);this.updateHashFunctions(this.hashFunctions.length);d=this.emptyLow;b=this.emptyHigh;for(var e=this.entryStride,c=0,h=a.length;c<h;c+=e){var g=a[c+1];if(a[c]!==d||
g!==b)if(this.storePending(a,c),!this.tryToInsert())return!1}return!0}},{key:"grow",value:function(a){for(var d=this.table,b=this.width,e=this.height,c=this.maxWidth,h=this.maxHeight;;){var g=b*e;b=Math.min(c,Math.ceil(a/this.height));b*e<a&&(e=Math.min(h,Math.ceil(a/b)));var f=b*e;if(f<a&&f===g)throw Error("Maximum table size exceeded");for(g=0;g<this.maxRehashAttempts;++g)if(this.rehash(d,b,e))return;a=Math.ceil(this.growFactor*a)}}},{key:"insertInternal",value:function(){++this.generation;v===
this.emptyLow&&t===this.emptyHigh&&this.chooseAnotherEmptyKey();++this.size>this.capacity&&(this.backupPending(),this.grow(Math.ceil(this.growFactor*this.width*this.height)),this.restorePending());for(;!this.tryToInsert();)this.backupPending(),this.grow(this.width*this.height),this.restorePending()}}],[{key:"generateHashFunctions",value:function(d){d=void 0===d?3:d;for(var b=[],e=0;e<d;++e){var c=[a.a.generate(),a.a.generate()];b.push(c)}return b}}]);return d}();var e=function(a){function d(){q(this,
d);return p(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}k(d,a);$jscomp.initSymbol();$jscomp.initSymbolIterator();u(d,[{key:"add",value:function(a){var d=a.low;a=a.high;if(this.hasPair(d,a))return!1;v=d;t=a;this.insertInternal();return!0}},{key:Symbol.iterator,value:function(){return this.keys()}}]);return d}(n);e.prototype.entryStride=2;var d=0,h=0,r=0,B=0,C=function(a){function e(){q(this,e);return p(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}k(e,
a);$jscomp.initSymbol();$jscomp.initSymbolIterator();u(e,[{key:"set",value:function(a,b){var e=a.low;a=a.high;if(this.hasPair(e,a))return!1;v=e;t=a;d=b.low;h=b.high;this.insertInternal();return!0}},{key:"get",value:function(a,d){a=this.indexOf(a);if(-1===a)return!1;var b=this.table;d.low=b[a+2];d.high=b[a+3];return!0}},{key:"swapPending",value:function(a,b){var c=d,g=h;m(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"swapPending",this).call(this,a,b);a[b+2]=c;a[b+3]=g}},{key:"storePending",
value:function(a,b){m(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"storePending",this).call(this,a,b);d=a[b+2];h=a[b+3]}},{key:"backupPending",value:function(){m(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"backupPending",this).call(this);r=d;B=h}},{key:"restorePending",value:function(){m(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"restorePending",this).call(this);d=r;h=B}},{key:Symbol.iterator,value:function(){return this.entries()}},{key:"entries",value:function(a){function d(d,
A){for(;;)switch(e){case 0:a=void 0===a?[new b.a,new b.a]:a,q=p,B=q.emptyLow,v=q.emptyHigh,k=q.entryStride,t=p,u=t.table,l=$jscomp.makeIterator(a),m=l.next().value,r=l.next().value,f=0,g=u.length;case 1:if(!(f<g)){e=3;break}h=u[f];c=u[f+1];if(h===B&&c===v){e=4;break}m.low=h;m.high=c;r.low=u[f+2];r.high=u[f+3];e=5;return{value:a,done:!1};case 5:if(void 0===A){e=6;break}e=-1;throw A;case 6:case 4:case 2:f+=k;e=1;break;case 3:e=-1;default:return{value:void 0,done:!0}}}var e=0,c,h,g,f,r,m,l,u,t,k,v,B,
q,p=this,n={next:function(a){return d(a,void 0)},throw:function(a){return d(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();n[Symbol.iterator]=function(){return this};return n}}]);return e}(n);C.prototype.entryStride=4},function(n,f,c){function p(a,d){if(!(a instanceof d))throw new TypeError("Cannot call a class as a function");}c.d(f,"b",function(){return v});f.c=function(b,d,c){c=void 0===c?1:c;switch(d){case q.b.UINT8:if(1>c||4<c)break;b.texelsPerElement=
1;b.textureFormat=t[c];b.texelType=a.t;b.arrayElementsPerTexel=c;b.arrayConstructor=Uint8Array;return b;case q.b.UINT16:if(1>c||2<c)break;b.texelsPerElement=1;b.textureFormat=t[2*c];b.texelType=a.t;b.arrayElementsPerTexel=2*c;b.arrayConstructor=Uint8Array;return b;case q.b.UINT64:if(1!==c)break;b.texelsPerElement=2;b.textureFormat=a.j;b.texelType=a.t;b.arrayElementsPerTexel=4;b.arrayConstructor=Uint8Array;return b;case q.b.UINT32:if(1!==c)break;b.texelsPerElement=1;b.textureFormat=a.j;b.texelType=
a.t;b.arrayElementsPerTexel=4;b.arrayConstructor=Uint8Array;return b;case q.b.FLOAT32:if(!(1>c||4<c))return b.texelsPerElement=1,b.textureFormat=t[c],b.texelType=a.c,b.arrayElementsPerTexel=c,b.arrayConstructor=Float32Array,b}throw Error("No supported texture format for "+q.b[d]+"["+c+"].");};f.e=function(a,d,b,c,g,f){d=d.maxTextureSize;var e=c*g*f;if(!(b*c<=d&&g*f<=d))if(b*c*g<=d&&f<=d)c*=g;else if(c=Math.ceil(e/d),c*b>d)throw Error("Chunk data size exceeds maximum texture size: "+b+" * "+e);b=Math.ceil(e/
c);a.dataWidth=c;a.textureHeight=b;a.textureAccessCoefficients=Float32Array.of(1/c,1/(c*b))};f.d=function(a,d,b,c){var e=d.maxTextureSize;d=Math.ceil(c/e);if(d*b>e)throw Error("Number of elements exceeds maximum texture size: "+b+" * "+c);b=Math.ceil(c/d);a.dataWidth=d;a.textureHeight=b;a.textureAccessCoefficients=Float32Array.of(1/d,1/(d*b))};f.f=function(b,d,c,g){var e=c.arrayConstructor,h=c.textureFormat,f=c.texelsPerElement,r=d.dataWidth;d=d.textureHeight;var l=r*d*c.arrayElementsPerTexel*f;g.constructor!==
e&&(g=new e(g.buffer,g.byteOffset,g.byteLength/e.BYTES_PER_ELEMENT));g=Object(k.a)(g,l);b.pixelStorei(a.r,1);Object(m.b)(b);b.texImage2D(b.TEXTURE_2D,0,h,r*f,d,0,h,c.texelType,g)};c.d(f,"a",function(){return g});var k=c(103),q=c(37),a=c(29),b=c(14),m=c(56),u=function(){function a(a,b){for(var d=0;d<b.length;d++){var e=b[d];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(d,b,e){b&&a(d.prototype,b);e&&a(d,e);return d}}(),
v=function d(){p(this,d)},t=[-1,a.f,a.g,a.i,a.j],l=["","r","ra","rgb","rgba"],g=function(){function a(d){p(this,a);this.key=d;this.uniformName="uTextureAccessCoefficients_"+this.key;this.readTextureValue="readTextureValue_"+this.key}u(a,[{key:"defineShader",value:function(a){a.addUniform("highp vec2",this.uniformName)}},{key:"getReadTextureValueCode",value:function(a){for(var d=this.uniformName,b="\nvoid "+this.readTextureValue+"(highp sampler2D sampler, float index",c=0;c<a;++c)b+=", out vec4 output"+
c;b+=") {\n  index += "+.5/a+";\n  vec2 texCoords = vec2(fract(index * "+d+".x),\n                        index * "+d+".y);\n";for(c=0;c<a;++c)b+="\n  output"+c+" = texture2D(sampler,\n                        vec2(texCoords.x +\n                             "+d+".x * "+(c/a).toFixed(8)+",\n                             texCoords.y));\n";return b+"\n}\n"}},{key:"getAccessor",value:function(a,d,c,g){g=void 0===g?1:g;var h=Object(b.a)(c,g),f=[];f.push(this.getReadTextureValueCode(c===q.b.UINT64?2:1));
a="\n"+h+" "+a+"(float index) {\n";switch(c){case q.b.UINT8:f.push(b.m);a+="\n  "+h+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+d+", index, temp);\n  result.value = temp."+l[g]+";\n  return result;\n";break;case q.b.UINT16:f.push(b.j);a+="\n  "+h+" result;\n  vec4 temp;\n  "+this.readTextureValue+"("+d+", index, temp);\n  result.value = temp."+l[2*g]+";\n  return result;\n";break;case q.b.UINT32:f.push(b.k);a+="\n  "+h+" result;\n  "+this.readTextureValue+"("+d+", index, result.value);\n  return result;\n";
break;case q.b.UINT64:f.push(b.l);a+="\n  "+h+" result;\n  "+this.readTextureValue+"("+d+", index, result.low, result.high);\n  return result;\n";break;case q.b.FLOAT32:f.push(b.e),a+="\n  vec4 temp;\n  "+this.readTextureValue+"("+d+", index, temp);\n  return temp."+l[g]+";\n"}f.push(a+"\n}\n");return f}},{key:"setupTextureLayout",value:function(a,d,b){a.uniform2fv(d.uniform(this.uniformName),b.textureAccessCoefficients)}}]);return a}()},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"c",function(){return u});
f.d=function(b){var e,d,c;return function(h,g){if(void 0!==d&&(void 0===e||void 0===h||e.generation!==h.generation))return void 0===e&&c.addConsumer(g),d;e=void 0;c=new a.c;return d=b(h,c).then(function(a){e=a;c=void 0;return a},function(a){c.isCanceled&&(d=c=void 0);throw a;})}};c.d(f,"a",function(){return t});c.d(f,"b",function(){return l});var a=c(27);n=c(0);var b=c(52),m=function(){function a(a,d){for(var b=0;b<d.length;b++){var e=d[b];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in
e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),u=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(n.a),v=function(){function a(){p(this,a);this.providers=new Map}m(a,[{key:"register",value:function(a,d){this.providers.set(a,d)}},{key:"getCredentialsProvider",value:function(a,d){var b=this.providers.get(a);if(void 0===b)throw Error("No registered credentials provider: "+
JSON.stringify(a));return b(d)}}]);return a}(),t=function(a){function c(a){p(this,c);var d=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.base=a;d.memoize=new b.b;return d}q(c,a);m(c,[{key:"getCredentialsProvider",value:function(a,b){var d=this;return this.memoize.get({key:a,parameters:b},function(){return d.registerDisposer(d.base.getCredentialsProvider(a,b).addRef())})}}]);return c}(n.a),l=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
new v))}q(b,a);m(b,[{key:"register",value:function(a,b){this.base.register(a,b)}}]);return b}(t)},function(n,f,c){(function(f,k){function q(b,c,e){t(b,c);var d=this;a.call(this);setTimeout(function(){d._start(b,c,e)},0)}var a=c(10).EventEmitter,b=c(3),m=c(33),u=c(50),v=c(18),t=function(){};"production"!==f.env.NODE_ENV&&(t=c(7)("sockjs-client:sender:xdr"));b(q,a);q.prototype._start=function(a,b,c){t("_start");var d=this,e=new k.XDomainRequest;b=v.addQuery(b,"t="+ +new Date);e.onerror=function(){t("onerror");
d._error()};e.ontimeout=function(){t("ontimeout");d._error()};e.onprogress=function(){t("progress",e.responseText);d.emit("chunk",200,e.responseText)};e.onload=function(){t("load");d.emit("finish",200,e.responseText);d._cleanup(!1)};this.xdr=e;this.unloadRef=m.unloadAdd(function(){d._cleanup(!0)});try{this.xdr.open(a,b),this.timeout&&(this.xdr.timeout=this.timeout),this.xdr.send(c)}catch(r){this._error()}};q.prototype._error=function(){this.emit("finish",0,"");this._cleanup(!1)};q.prototype._cleanup=
function(a){t("cleanup",a);if(this.xdr){this.removeAllListeners();m.unloadDel(this.unloadRef);this.xdr.ontimeout=this.xdr.onerror=this.xdr.onprogress=this.xdr.onload=null;if(a)try{this.xdr.abort()}catch(g){}this.unloadRef=this.xdr=null}};q.prototype.close=function(){t("close");this._cleanup(!0)};q.enabled=!(!k.XDomainRequest||!u.hasDomain());n.exports=q}).call(f,c(6),c(5))},function(n,f,c){(function(f){var k=c(3),q=c(130),a=c(82);n.exports=function(b){function c(a,c){q.call(this,b.transportName,a,
c)}k(c,q);c.enabled=function(c,m){if(!f.document)return!1;c=a.extend({},m);c.sameOrigin=!0;return b.enabled(c)&&q.enabled()};c.transportName="iframe-"+b.transportName;c.needBody=!0;c.roundTrips=q.roundTrips+b.roundTrips-1;c.facadeTransport=b;return c}}).call(f,c(5))},function(n,f,c){n.exports={isObject:function(c){var f=typeof c;return"function"===f||"object"===f&&!!c},extend:function(c){if(!this.isObject(c))return c;for(var f,q,a=1,b=arguments.length;a<b;a++)for(q in f=arguments[a],f)Object.prototype.hasOwnProperty.call(f,
q)&&(c[q]=f[q]);return c}}},function(n,f,c){function p(c){this.type=c}p.prototype.initEvent=function(c,f,a){this.type=c;this.bubbles=f;this.cancelable=a;this.timeStamp=+new Date;return this};p.prototype.stopPropagation=function(){};p.prototype.preventDefault=function(){};p.CAPTURING_PHASE=1;p.AT_TARGET=2;p.BUBBLING_PHASE=3;n.exports=p},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){var c=document.documentElement.scrollTop+Math.min(document.documentElement.clientHeight-a.offsetHeight,b.clientY);a.style.left=document.documentElement.scrollLeft+Math.min(document.documentElement.clientWidth-a.offsetWidth,b.clientX)+"px";a.style.top=c+"px";a.style.visibility=null}c.d(f,"a",function(){return u});var q=c(0),
a=c(12),b=c(4),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}();c(293);var u=function(c){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=(f.__proto__||Object.getPrototypeOf(f)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.element=document.createElement("div");c.parentDisposers=new Map;c.disabledValue=!1;c.opened=new b.a;c.closed=new b.a;var e=c.element;e.className="neuroglancer-context-menu";e.style.visibility="hidden";e.tabIndex=-1;document.body.appendChild(e);void 0!==a&&c.registerParent(a);return c}p(f,c);m(f,[{key:"registerParent",value:function(a){var b=this,c=this.parentDisposers;c.has(a)||c.set(a,Object(q.c)(a,"contextmenu",function(a){b.show(a);a.stopPropagation();
a.preventDefault()}))}},{key:"show",value:function(a){var b=this;if(!this.disabledValue){this.hide();var c=this.element,d=Object(q.c)(document,"mousedown",function(a){a.target instanceof Node&&!c.contains(a.target)&&b.hide()},!0),h=Object(q.c)(document,"keydown",function(a){"Escape"===a.code&&b.hide()},!0);c.style.display=null;c.style.visibility="hidden";this.opened.dispatch();k(c,a);this.menuDisposer=function(){h();d();c.style.display="none"}}}},{key:"unregisterParent",value:function(a){var b=this.parentDisposers,
c=b.get(a);void 0!==c&&(c(),b.delete(a))}},{key:"disposed",value:function(){for(var b=this.parentDisposers,c=$jscomp.makeIterator(b.values()),e=c.next();!e.done;e=c.next())e=e.value,e();b.clear();Object(a.b)(this.element)}},{key:"hide",value:function(){void 0!==this.menuDisposer&&(this.menuDisposer(),this.menuDisposer=void 0,this.closed.dispatch())}},{key:"disabled",get:function(){return this.disabledValue},set:function(a){this.disabledValue!==a&&(this.disabledValue=a)&&this.hide()}},{key:"open",
get:function(){return void 0!==this.menuDisposer}}]);return f}(q.a)},function(n,f,c){function p(a){return Object(b.a)(a.dataTransfer.types,"neuroglancer-layer\x00")}function k(a){if(void 0!==v&&v.manager.rootLayers===a.rootLayers)return v}function q(a,b,c){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=void 0===c?!1:c;a=void 0===a?!1:a;c=k(b);b=void 0===c?"copy":a||c.manager!==b?"link":"move";return b}f.e=function(a,c){a.dataTransfer.setData(Object(b.b)("neuroglancer-layer\x00",c.layers.map(function(a){return{name:a.name,
visible:a.visible}})),JSON.stringify(c.layers.map(function(a){return a.toJSON()})));void 0!==v&&v.disposer();var e,d=function(){c.manager.unregisterDisposer(d);for(var a=$jscomp.makeIterator(c.layers),b=a.next();!b.done;b=a.next())b.value.dispose();c.manager.dispose();v===e&&(v=void 0)};v=e={manager:c.manager.addRef(),layers:c.layers.map(function(a){return a.addRef()}),disposer:d}};f.a=function(a){if(void 0!==v){if(a&&"move"===a.dataTransfer.dropEffect){var b=new Set(v.layers);v.manager.layerManager.filter(function(a){return!b.has(a)})}v.disposer()}};
f.c=p;f.d=q;f.f=function(a,c,e){return Object(b.e)(a,q(a,c,void 0===e?!1:e))};f.b=function(b,c,e,d,h){var g=k(c),f=!h&&void 0!==g&&g.manager===c;if(!e&&void 0!==g){var l=new t;l.manager=c;l.numSourceLayers=g.layers.length;l.sourceManager=g.manager;l.moveSupported=f;l.layers=new Map;if(!h&&g.manager===c)if(d)g.layers.forEach(function(a,b){l.layers.set(a,b)});else return;g.layers.forEach(function(a,b){!h&&c.layerManager.has(a)||l.layers.set(a.addRef(),b)});return l}b=p(b);if(void 0!==b)try{var u=Object(m.a)(b.parameters,
function(b,d){var e=Object(m.w)(b,"name",m.B);b=Object(m.w)(b,"visible",m.m);e=new a.b(e,null,c);e.visible=b;return[e,d]}),v=new t;v.numSourceLayers=u.length;v.moveSupported=f;v.manager=c;v.dragType=b.dragType;v.layers=new Map(u);return v}catch(y){}};var a=c(15),b=c(86),m=c(2),u=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,d){c&&a(b.prototype,c);d&&
a(b,d);return b}}(),v,t=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}u(a,[{key:"finalize",value:function(a){var b=this.dragType;if(void 0!==b)try{var d=JSON.parse(a.dataTransfer.getData(b));if(!Array.isArray(d)||this.numSourceLayers!==d.length)throw Error("Invalid layer drop data");for(var c=$jscomp.makeIterator(this.layers),g=c.next();!g.done;g=c.next()){var f=$jscomp.makeIterator(g.value),m=f.next().value,l=f.next().value;this.manager.initializeLayerFromSpec(m,
d[l])}}catch(z){return!1}return!0}},{key:"compatibleWithMethod",value:function(a){return this.method===a||!this.moveSupported&&"move"===a?!0:!1}},{key:"method",get:function(){return void 0!==this.sourceManager?this.manager===this.sourceManager?"move":"link":"copy"}}]);return a}()},function(n,f,c){f.b=function(a,b){b=JSON.stringify(b);b=Object(p.b)((new TextEncoder).encode(b));return a+b};f.a=function(a,b){a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;a:{var f=b;if(c.startsWith(f))try{var k=
c.substring(f.length);var t=(new TextDecoder).decode(Object(p.a)(k));var l=JSON.parse(t);break a}catch(g){l=void 0;break a}l=void 0}f=l;if(void 0!==f)return{parameters:f,dragType:c}}};f.e=function(a,b){return q=a.dataTransfer.dropEffect=b};f.c=function(){return q};f.d=function(a){a.draggable=!0;return Object(k.c)(a,"dragstart",function(a){a.stopPropagation();a.preventDefault()})};var p=c(294),k=c(0),q},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"b",function(){return B});
c.d(f,"c",function(){return C});c.d(f,"a",function(){return D});var a=c(31),b=c(143),m=c(137);n=c(0);var u=c(12),v=c(17),t=c(1),l=c(45),g=c(102),e=c(105),d=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),h=function y(a,b,d){null===a&&(a=Function.prototype);var c=Object.getOwnPropertyDescriptor(a,b);if(void 0===
c){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};c(295);c(61);f.d="neuroglancer-position";var r=v.a.fromObject({tab:{action:"tab-forward",preventDefault:!1},arrowup:{action:"adjust-up"},arrowdown:{action:"adjust-down"},wheel:{action:"adjust-via-wheel"},"shift+tab":{action:"tab-backward",preventDefault:!1},backspace:{action:"delete-backward",preventDefault:!1},escape:{action:"cancel"},mouseup0:{action:"select-all-if-was-not-focused",
preventDefault:!1}}),B=function(c){function e(d,c){c=void 0===c?6:c;p(this,e);var h=k(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));h.position=d;h.maxNumberWidth=c;h.element=document.createElement("div");h.inputContainer=document.createElement("div");h.inputElement=document.createElement("input");h.hintElement=document.createElement("input");h.tempPosition=t.p.create();h.updateHintScrollPosition=h.registerCancellable(Object(b.a)(function(){h.hintElement.scrollLeft=h.inputElement.scrollLeft}));
var f=h.element,u=h.inputElement,q=h.hintElement,B=h.inputContainer;B.className="neuroglancer-position-widget-input-container";u.className="neuroglancer-position-widget-input";q.className="neuroglancer-position-widget-hint";h.inputFieldWidth=3*c+11;c=$jscomp.makeIterator([u,q]);for(var A=c.next();!A.done;A=c.next())A=A.value,A.spellcheck=!1,A.autocomplete="off",A.type="text",A.style.width=h.inputFieldWidth+"ch";q.disabled=!0;c=document.createElement("div");c.textContent="\u29c9";c.className="neuroglancer-copy-button neuroglancer-button";
c.title="Copy position to clipboard";c.addEventListener("click",function(){var b=Object(m.b)(h.getPositionText());a.a.showTemporaryMessage(b?"Position copied to clipboard":"Failed to copy position to clipboard")});c.addEventListener("dragstart",function(a){a.dataTransfer.setData("neuroglancer-position",JSON.stringify(d.toJSON()));a.dataTransfer.setData("text",h.getPositionText());a.stopPropagation()});c.draggable=!0;f.appendChild(c);f.appendChild(B);B.appendChild(u);B.appendChild(q);f.className="neuroglancer-position-widget";
h.registerDisposer(d.changed.add(h.registerCancellable(Object(b.a)(function(){return h.updateView()}))));h.registerDisposer(new l.b(u,r)).allShortcutsAreGlobal=!0;h.registerDisposer(new g.a(u,r));h.registerEventListener(u,"change",function(){return h.updatePosition()});h.registerEventListener(u,"blur",function(){return h.updatePosition()});h.registerEventListener(u,"input",function(){return h.cleanInput()});h.registerEventListener(u,"keydown",h.updateHintScrollPosition);h.registerEventListener(u,
"copy",function(a){var b=u.value.substring(u.selectionStart,u.selectionEnd);b=b.trim().replace(/\s+/g," ");a.clipboardData.setData("text/plain",b);a.stopPropagation();a.preventDefault()});var n=!1;h.registerEventListener(u,"mousedown",function(){n=document.activeElement===u});h.registerDisposer(Object(v.c)(u,"select-all-if-was-not-focused",function(a){n||(u.selectionStart=0,u.selectionEnd=u.value.length,u.selectionDirection="forward",a.preventDefault())}));h.registerDisposer(Object(v.c)(u,"tab-forward",
function(a){var b=Math.min(u.selectionStart,u.selectionEnd),d=u.value.substring(b).match(/^([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)/);null!==d&&void 0!==d[2]&&(u.selectionStart=b+d[1].length+d[2].length,u.selectionEnd=u.selectionStart+d[3].length,u.selectionDirection="forward",a.preventDefault())}));h.registerDisposer(Object(v.c)(u,"tab-backward",function(a){var b=u.value.substring(0,Math.max(u.selectionStart,u.selectionEnd)).match(/([^,\s]*)((?:\s+)|(?:\s*,\s*))?([^,\s]*)$/);null!==b&&void 0!==b[2]&&
(u.selectionStart=b.index,u.selectionEnd=u.selectionStart+b[1].length,u.selectionDirection="forward",a.preventDefault())}));h.registerDisposer(Object(v.c)(u,"delete-backward",function(a){if(u.selectionStart===u.selectionEnd&&u.selectionStart===u.value.length){var b=u.value.match(/^(.*)(?![\s])(?:(?:\s+)|(?:\s*,\s*))$/);null!==b&&(u.value=b[1],h.cleanInput(),a.preventDefault())}}));h.registerDisposer(Object(v.c)(u,"cancel",function(){h.updateView();h.inputElement.blur()}));h.registerDisposer(Object(v.c)(u,
"adjust-via-wheel",function(a){a=a.detail;var b=a.deltaY;0!==b&&h.adjustFromCursor(Math.ceil((u.scrollLeft+a.offsetX-u.clientLeft)/(u.scrollWidth/h.inputFieldWidth)),-Math.sign(b))}));h.registerDisposer(Object(v.c)(u,"adjust-up",function(){h.adjustFromCursor(void 0,1)}));h.registerDisposer(Object(v.c)(u,"adjust-down",function(){h.adjustFromCursor(void 0,-1)}));h.updateView();return h}q(e,c);d(e,[{key:"adjustFromCursor",value:function(a,b){var d=this.inputElement;void 0===a&&(a="forward"===d.selectionDirection?
d.selectionEnd:d.selectionStart);void 0!==this.cleanInput()&&(a=d.value.substring(0,a).split(",").length-1,this.updatePosition(),d=this.tempPosition,this.position.getVoxelCoordinates(d)&&(d[a]+=b,this.position.setVoxelCoordinates(d),this.updateView()))}},{key:"cleanInput",value:function(){var a=this.inputElement.selectionStart,b=/(-?\d+(?:\.(?:\d+)?)?)/.source,d=/((?:\s+(?![\s,]))|(?:\s*,\s*))/.source,c=/([\[\]{}()\s]*)/.source;b=this.inputElement.value.match(new RegExp("^"+c+"(?![\\s])"+b+"?"+("(?:"+
d+b+"?(?:"+d+b+"?)?)?")+(c+"$")));if(null!==b){var e="  ",h="x ",g=2,f=b[1].length;d=function(b,d,c){if(void 0!==b){var m=f+b.length;void 0===d&&(d=b,c=" ".repeat(d.length));a>=f&&(g=a===m?e.length+d.length:e.length+Math.min(d.length,a-f));e+=d;h+=c;f=m}};d(b[2]);d(b[3],",   ","  y ");d(b[4]);d(b[5],",   ","  z ");d(b[6]);this.hintElement.value=h;this.inputElement.value!==e&&(this.inputElement.value=e,this.inputElement.selectionEnd=g,this.inputElement.selectionStart=g);this.updateHintScrollPosition();
return void 0!==b[2]&&void 0!==b[4]&&void 0!==b[6]?{position:t.p.set(this.tempPosition,parseFloat(b[2]),parseFloat(b[4]),parseFloat(b[6]))}:{}}this.hintElement.value=""}},{key:"updatePosition",value:function(){var a=this.cleanInput();void 0!==a&&void 0!==a.position&&this.position.setVoxelCoordinates(a.position)}},{key:"getPositionText",value:function(){var a=this.tempPosition;return this.position.getVoxelCoordinates(a)?Math.floor(a[0])+", "+Math.floor(a[1])+", "+Math.floor(a[2]):"<unspecified position>"}},
{key:"updateView",value:function(){var a=this.tempPosition;if(this.position.getVoxelCoordinates(a)){var b=this.inputElement;a="  "+Math.floor(a[0])+",   "+Math.floor(a[1])+",   "+Math.floor(a[2]);var d=a.indexOf(","),c=a.indexOf(",",d+1)-d-4;d="x "+" ".repeat(d-2)+"  y "+" ".repeat(c)+"  z";c=b.selectionStart;var e=b.selectionEnd,h=b.selectionDirection;b.value=a;b.setSelectionRange(c,e,h);this.hintElement.value=d+" ".repeat(a.length-d.length);this.updateHintScrollPosition()}else this.inputElement.value=
"",this.hintElement.value=""}},{key:"disposed",value:function(){Object(u.b)(this.element);h(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(n.a),C=function(a){function c(a,d){p(this,c);var e=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.element=a;e.voxelSize=d;e.dimensionsContainer=document.createElement("span");e.unitsElement=document.createElement("span");var h=e.dimensionsContainer,g=e.unitsElement;a.className="neuroglancer-voxel-size-widget";
a.title="Voxel size";h.className="neuroglancer-voxel-size-dimensions-container";a.appendChild(h);a.appendChild(g);g.className="neuroglancer-voxel-size-units";e.registerDisposer(d.changed.add(e.registerCancellable(Object(b.a)(function(){return e.updateView()}))));e.updateView();return e}q(c,a);d(c,[{key:"updateView",value:function(){var a=this.dimensionsContainer,b=this.unitsElement;Object(u.a)(a);this.element.style.display=this.voxelSize.valid?null:"none";var d=this.voxelSize.size,c=Object(e.b)(Math.min(d[0],
d[1],d[2]));b.textContent=c.unit;for(b=0;3>b;++b){for(var h=d[b]/c.lengthInNanometers,g="",f=0;2>=f&&(g=h.toFixed(f),parseFloat(g)!==h);++f);h=document.createElement("span");h.className="neuroglancer-voxel-size-dimension";h.textContent=g;a.appendChild(h)}}},{key:"disposed",value:function(){Object(u.b)(this.element);h(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),D=function(a){function c(a,d,e){p(this,c);var h=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));
h.element=a;h.mouseState=d;h.voxelSize=e;h.tempPosition=t.p.create();a.className="neuroglancer-mouse-position-widget";a=h.registerCancellable(Object(b.a)(function(){return h.updateView()}));h.registerDisposer(d.changed.add(a));h.registerDisposer(e.changed.add(a));return h}q(c,a);d(c,[{key:"updateView",value:function(){var a="",b=this.mouseState,d=this.voxelSize;b.active&&d.valid&&(a=this.tempPosition,d.voxelFromSpatial(a,b.position),a="x "+Math.floor(a[0])+",  y "+Math.floor(a[1])+",  z "+Math.floor(a[2]));
this.element.textContent=a}},{key:"disposed",value:function(){Object(u.b)(this.element);h(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==
typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){var b=a.match(/^([^:?]+:[^:?]+:[^:?]+)(?::([^:?]+))?(?:\?(.*))?$/);if(null===b)throw Error("Invalid Brain Maps volume key: "+JSON.stringify(a)+".");var d;void 0!==b[2]&&(d={changeStackId:b[2]});a=Object(z.e)(b[3]||
"");return{volumeId:b[1],changeSpec:d,parameters:a}}function b(a){try{return Object(z.u)(a),{id:Object(z.w)(a,"id",z.B),label:Object(z.w)(a,"label",z.B),description:Object(z.w)(a,"description",z.z)}}catch(L){throw Error("Failed to parse project: "+L.message);}}function m(a){try{return Object(z.u)(a),Object(z.w)(a,"project",function(a){return void 0===a?[]:Object(z.a)(a,b)})}catch(L){throw Error("Error parsing project list: "+L.message);}}function u(a){return Object(z.w)(a,"changeStackId",function(a){return void 0===
a?void 0:Object(z.a)(a,z.B)})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"BrainmapsSkeletonSource",function(){return G});c.d(f,"VolumeInfo",function(){return J});c.d(f,"MeshInfo",function(){return F});c.d(f,"MultiscaleVolumeChunkSource",function(){return R});f.parseVolumeKey=a;c.d(f,"VolumeList",function(){return N});f.parseChangeStackList=u;c.d(f,"BrainmapsDataSource",function(){return V});n=c(16);var v=c(151),t=c(28),l=c(93),g=c(155),e=c(53),d=c(64),h=c(11),r=c(21),B=c(31),C=c(42),D=
c(1),z=c(2),y=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),E=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(n.f)(Object(v.a)()(r.b),g.d)),A=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments))}q(b,a);return b}(Object(n.f)(Object(v.a)()(e.b),g.a)),G=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);y(b,[{key:"skeletonVertexCoordinatesInVoxels",get:function(){return!1}}]);return b}(Object(n.f)(Object(v.a)()(d.d),g.b)),H=new Map;H.set("UINT8",h.a.UINT8);H.set("FLOAT",h.a.FLOAT32);H.set("UINT64",h.a.UINT64);var J=function L(a){p(this,L);try{Object(z.u)(a),this.numChannels=Object(z.A)(a.channelCount),this.dataType=
Object(z.t)(a.channelType,H),this.voxelSize=Object(z.f)(D.p.create(),a.pixelSize,z.p),this.upperVoxelBound=Object(z.f)(D.p.create(),a.volumeSize,z.A)}catch(Y){throw Error("Failed to parse BrainMaps volume geometry: "+Y.message);}},F=function S(a){p(this,S);Object(z.u)(a);this.name=Object(z.w)(a,"name",z.B);this.type=Object(z.w)(a,"type",z.B)},R=function(){function a(b,d,c,e,g,f,m,r){p(this,a);this.chunkManager=b;this.instance=d;this.credentialsProvider=c;this.volumeId=e;this.changeSpec=g;this.encoding=
r.encoding;try{Object(z.u)(f);var l=this.scales=Object(z.w)(f,"geometry",function(a){return Object(z.a)(a,function(a){return new J(a)})});if(0===l.length)throw Error("Expected at least one scale.");var u=l[0],t=this.numChannels=u.numChannels,k=this.dataType=u.dataType;b=1;for(var v=l.length;b<v;++b){var q=l[b];if(q.dataType!==k)throw Error("Scale "+b+" has data type "+h.a[q.dataType]+" "+("but scale 0 has data type "+h.a[k]+"."));if(q.numChannels!==t)throw Error("Scale "+b+" has "+q.numChannels+" channel(s) "+
("but scale 0 has "+t+" channels."));}if(1===t)switch(k){case h.a.UINT64:var B=h.d.SEGMENTATION}void 0===B&&(B=void 0!==r.volumeType?r.volumeType:h.d.IMAGE);this.volumeType=B}catch(rb){throw Error("Failed to parse BrainMaps multiscale volume specification: "+rb.message);}try{Object(z.u)(m),this.meshes=Object(z.w)(m,"meshes",function(a){return void 0===a?[]:Object(z.a)(a,function(a){return new F(a)})})}catch(rb){throw Error("Failed to parse BrainMaps meshes specification: "+rb.message);}}y(a,[{key:"getSources",
value:function(a){var b=this,d=g.c.RAW;this.dataType===h.a.UINT64?d=g.c.COMPRESSED_SEGMENTATION:this.volumeType===h.d.IMAGE&&this.dataType===h.a.UINT8&&1===this.numChannels&&this.encoding!==g.c.RAW&&(d=g.c.JPEG);return this.scales.map(function(c,e){return h.c.getDefaults({voxelSize:c.voxelSize,dataType:c.dataType,numChannels:c.numChannels,upperVoxelBound:c.upperVoxelBound,volumeType:b.volumeType,volumeSourceOptions:a}).map(function(a){return b.chunkManager.getChunkSource(E,{credentialsProvider:b.credentialsProvider,
spec:a,parameters:{instance:b.instance,volumeId:b.volumeId,changeSpec:b.changeSpec,scaleIndex:e,encoding:d}})})})}},{key:"getMeshSource",value:function(){var a=this.meshes.find(function(a){return"TRIANGLES"===a.type});return void 0===a?null:this.chunkManager.getChunkSource(A,{credentialsProvider:this.credentialsProvider,parameters:{instance:this.instance,volumeId:this.volumeId,meshName:a.name,changeSpec:this.changeSpec}})}}]);return a}(),K=/^([^\/]+)\/(.*)$/,N=function Y(a,b){p(this,Y);this.projects=
new Map;this.hierarchicalVolumeIds=new Map;var d=this.projects;a=$jscomp.makeIterator(m(a));for(var c=a.next();!c.done;c=a.next())c=c.value,d.set(c.id,c);try{Object(z.u)(b);var e=this.volumeIds=Object(z.w)(b,"volumeId",function(a){return void 0===a?[]:Object(z.a)(a,z.B)});e.sort();for(var h=new Map,g=$jscomp.makeIterator(e),f=g.next();!f.done;f=g.next()){var r=f.value;for(b=0;;){var l=r.indexOf(":",b);-1===l?l=void 0:++l;var u=r.substring(0,b),t=h.get(u);void 0===t&&(t=new Set,h.set(u,t));t.add(r.substring(b,
l));if(void 0===l)break;b=l}}for(var k=this.hierarchicalVolumeIds,v=$jscomp.makeIterator(h),q=v.next();!q.done;q=v.next()){var B=$jscomp.makeIterator(q.value),n=B.next().value,A=B.next().value;k.set(n,Array.from(A))}}catch(vc){throw Error("Failed to parse Brain Maps volume list reply: "+vc.message);}},V=function(b){function d(a,b){p(this,d);var c=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.instance=a;c.credentialsProvider=b;return c}q(d,b);y(d,[{key:"getMeshSource",value:function(a,
b){return a.getChunkSource(A,{credentialsProvider:this.credentialsProvider,parameters:this.getMeshSourceParameters(b)})}},{key:"getMeshSourceParameters",value:function(b){var d=b.match(K);if(null===d)throw Error("Invalid Brainmaps mesh URL: "+b);b=a(d[1]);return{instance:this.instance,volumeId:b.volumeId,changeSpec:b.changeSpec,meshName:d[2]}}},{key:"getSkeletonSource",value:function(a,b){return a.getChunkSource(G,{credentialsProvider:this.credentialsProvider,parameters:this.getMeshSourceParameters(b)})}},
{key:"getVolume",value:function(b,d,c){var e=this;d=a(d);var h=d.volumeId,f=d.changeSpec,m=d.parameters;Object(z.u)(m);d=Object(z.w)(m,"encoding",function(a){return void 0===a?void 0:Object(z.n)(m.encoding,g.c)});var r=Object.assign({},c,{encoding:d});return b.memoize.getUncounted({type:"brainmaps:getVolume",instance:this.instance,volumeId:h,changeSpec:f,brainmapsOptions:r},function(){return Promise.all([Object(l.b)(e.instance,e.credentialsProvider,{method:"GET",path:"/v1beta2/volumes/"+h,responseType:"json"}),
Object(l.b)(e.instance,e.credentialsProvider,{method:"GET",path:"/v1beta2/objects/"+h+"/meshes",responseType:"json"})]).then(function(a){var d=$jscomp.makeIterator(a);a=d.next().value;d=d.next().value;return new R(b,e.instance,e.credentialsProvider,h,f,a,d,r)})})}},{key:"getVolumeList",value:function(a){var b=this;return a.memoize.getUncounted({instance:this.instance,type:"brainmaps:getVolumeList"},function(){var a=Promise.all([Object(l.b)(b.instance,b.credentialsProvider,{method:"GET",path:"/v1beta2/projects",
responseType:"json"}),Object(l.b)(b.instance,b.credentialsProvider,{method:"GET",path:"/v1beta2/volumes",responseType:"json"})]).then(function(a){var b=$jscomp.makeIterator(a);a=b.next().value;b=b.next().value;return new N(a,b)}),d=b.instance.description+" volume list";B.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+d+".",errorPrefix:"Error retrieving "+d+": "});return a})}},{key:"getChangeStackList",value:function(a,b){var d=this;return a.memoize.getUncounted({instance:this.instance,type:"brainmaps:getChangeStackList",
volumeId:b},function(){var a=Object(l.b)(d.instance,d.credentialsProvider,{method:"GET",path:"/v1beta2/changes/"+b+"/change_stacks",responseType:"json"}).then(function(a){return u(a)}),c="change stacks for "+b;B.a.forPromise(a,{delay:!0,initialMessage:"Retrieving "+c+".",errorPrefix:"Error retrieving "+c+": "});return a})}},{key:"volumeCompleter",value:function(a,b){var d=this;return this.getVolumeList(b).then(function(c){var e=a.match(/^([^:]+:[^:]+:[^:]+):(.*)$/);if(null!==e){var h=e[1],g=e[2];
return d.getChangeStackList(b,h).then(function(a){if(void 0===a)throw null;return{offset:h.length+1,completions:Object(C.b)(g,a)}})}var f=a.lastIndexOf(":")+1;e=a.substring(0,f);f=a.substring(f);var m=c.hierarchicalVolumeIds.get(e);if(void 0===m)throw null;return e?{offset:e.length,completions:Object(C.b)(f,m)}:{offset:0,completions:Object(C.c)(f,m,function(a){return a},function(a){return(a=c.projects.get(a.substring(0,a.length-1)))&&a.label})}})}},{key:"description",get:function(){return this.instance.description}}]);
return d}(t.a);f.productionInstance={description:"Google Brain Maps",serverUrls:["https://brainmaps.googleapis.com"]}},function(n,f,c){c(22);c(146);c(147);var p=c(90),k=c(148),q=c(149);c(150);var a=c(91),b=c(92);c.d(f,"a",function(){return p});c.d(f,"b",function(){return k});c.d(f,"c",function(){return q});c.d(f,"d",function(){return a});c.d(f,"e",function(){return b})},function(n,f,c){function p(a,b,c){var f=b[0],m=b[1],t=b[2],l=b[3],g=b[4],e=b[5],d=b[6],h=b[7];b=b[8];var r=c[0],k=c[1],q=c[2],p=
c[3],n=c[4],y=c[5],E=c[6],A=c[7];c=c[8];a[0]=r*f+k*l+q*d;a[1]=r*m+k*g+q*h;a[2]=r*t+k*e+q*b;a[3]=p*f+n*l+y*d;a[4]=p*m+n*g+y*h;a[5]=p*t+n*e+y*b;a[6]=E*f+A*l+c*d;a[7]=E*m+A*g+c*h;a[8]=E*t+A*e+c*b;return a}function k(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=function(){var a=new q.a(9);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=
0;a[8]=1;return a};f.fromMat4=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[4];a[4]=b[5];a[5]=b[6];a[6]=b[8];a[7]=b[9];a[8]=b[10];return a};f.clone=function(a){var b=new q.a(9);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b};f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};f.fromValues=function(a,b,c,f,k,t,l,g,e){var d=new q.a(9);d[0]=a;d[1]=b;d[2]=c;d[3]=f;d[4]=k;d[5]=
t;d[6]=l;d[7]=g;d[8]=e;return d};f.set=function(a,b,c,f,k,t,l,g,e,d){a[0]=b;a[1]=c;a[2]=f;a[3]=k;a[4]=t;a[5]=l;a[6]=g;a[7]=e;a[8]=d;return a};f.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.transpose=function(a,b){if(a===b){var c=b[1],f=b[2],k=b[5];a[1]=b[3];a[2]=b[6];a[3]=c;a[5]=b[7];a[6]=f;a[7]=k}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a};f.invert=function(a,b){var c=b[0],f=b[1],k=b[2],
t=b[3],l=b[4],g=b[5],e=b[6],d=b[7];b=b[8];var h=b*l-g*d,r=-b*t+g*e,q=d*t-l*e,p=c*h+f*r+k*q;if(!p)return null;p=1/p;a[0]=h*p;a[1]=(-b*f+k*d)*p;a[2]=(g*f-k*l)*p;a[3]=r*p;a[4]=(b*c-k*e)*p;a[5]=(-g*c+k*t)*p;a[6]=q*p;a[7]=(-d*c+f*e)*p;a[8]=(l*c-f*t)*p;return a};f.adjoint=function(a,b){var c=b[0],f=b[1],k=b[2],t=b[3],l=b[4],g=b[5],e=b[6],d=b[7];b=b[8];a[0]=l*b-g*d;a[1]=k*d-f*b;a[2]=f*g-k*l;a[3]=g*e-t*b;a[4]=c*b-k*e;a[5]=k*t-c*g;a[6]=t*d-l*e;a[7]=f*e-c*d;a[8]=c*l-f*t;return a};f.determinant=function(a){var b=
a[3],c=a[4],f=a[5],k=a[6],t=a[7],l=a[8];return a[0]*(l*c-f*t)+a[1]*(-l*b+f*k)+a[2]*(t*b-c*k)};f.multiply=p;f.translate=function(a,b,c){var f=b[0],m=b[1],t=b[2],l=b[3],g=b[4],e=b[5],d=b[6],h=b[7];b=b[8];var r=c[0];c=c[1];a[0]=f;a[1]=m;a[2]=t;a[3]=l;a[4]=g;a[5]=e;a[6]=r*f+c*l+d;a[7]=r*m+c*g+h;a[8]=r*t+c*e+b;return a};f.rotate=function(a,b,c){var f=b[0],m=b[1],t=b[2],l=b[3],g=b[4],e=b[5],d=b[6],h=b[7];b=b[8];var r=Math.sin(c);c=Math.cos(c);a[0]=c*f+r*l;a[1]=c*m+r*g;a[2]=c*t+r*e;a[3]=c*l-r*f;a[4]=c*g-
r*m;a[5]=c*e-r*t;a[6]=d;a[7]=h;a[8]=b;return a};f.scale=function(a,b,c){var f=c[0];c=c[1];a[0]=f*b[0];a[1]=f*b[1];a[2]=f*b[2];a[3]=c*b[3];a[4]=c*b[4];a[5]=c*b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];return a};f.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=b[0];a[7]=b[1];a[8]=1;return a};f.fromRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=-c;a[4]=b;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=
0;a[4]=b[1];a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};f.fromMat2d=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=0;a[3]=b[2];a[4]=b[3];a[5]=0;a[6]=b[4];a[7]=b[5];a[8]=1;return a};f.fromQuat=function(a,b){var c=b[0],f=b[1],k=b[2];b=b[3];var t=c+c,l=f+f,g=k+k;c*=t;var e=f*t;f*=l;var d=k*t,h=k*l;k*=g;t*=b;l*=b;b*=g;a[0]=1-f-k;a[3]=e-b;a[6]=d+l;a[1]=e+b;a[4]=1-c-k;a[7]=h-t;a[2]=d-l;a[5]=h+t;a[8]=1-c-f;return a};f.normalFromMat4=function(a,b){var c=b[0],f=b[1],k=b[2],t=b[3],l=b[4],g=b[5],e=b[6],d=b[7],h=b[8],r=b[9],
q=b[10],p=b[11],n=b[12],z=b[13],y=b[14];b=b[15];var E=c*g-f*l,A=c*e-k*l,G=c*d-t*l,H=f*e-k*g,J=f*d-t*g,F=k*d-t*e,R=h*z-r*n,K=h*y-q*n;h=h*b-p*n;var N=r*y-q*z;r=r*b-p*z;q=q*b-p*y;p=E*q-A*r+G*N+H*h-J*K+F*R;if(!p)return null;p=1/p;a[0]=(g*q-e*r+d*N)*p;a[1]=(e*h-l*q-d*K)*p;a[2]=(l*r-g*h+d*R)*p;a[3]=(k*r-f*q-t*N)*p;a[4]=(c*q-k*h+t*K)*p;a[5]=(f*h-c*r-t*R)*p;a[6]=(z*F-y*J+b*H)*p;a[7]=(y*G-n*F-b*A)*p;a[8]=(n*J-z*G+b*E)*p;return a};f.projection=function(a,b,c){a[0]=2/b;a[1]=0;a[2]=0;a[3]=0;a[4]=-2/c;a[5]=0;
a[6]=-1;a[7]=1;a[8]=1;return a};f.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"};f.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];
return a};f.subtract=k;f.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;return a};f.multiplyScalarAndAdd=function(a,b,c,f){a[0]=b[0]+c[0]*f;a[1]=b[1]+c[1]*f;a[2]=b[2]+c[2]*f;a[3]=b[3]+c[3]*f;a[4]=b[4]+c[4]*f;a[5]=b[5]+c[5]*f;a[6]=b[6]+c[6]*f;a[7]=b[7]+c[7]*f;a[8]=b[8]+c[8]*f;return a};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&
a[7]===b[7]&&a[8]===b[8]};f.equals=function(a,b){var c=a[0],f=a[1],k=a[2],t=a[3],l=a[4],g=a[5],e=a[6],d=a[7];a=a[8];var h=b[0],r=b[1],p=b[2],n=b[3],D=b[4],z=b[5],y=b[6],E=b[7];b=b[8];return Math.abs(c-h)<=q.b*Math.max(1,Math.abs(c),Math.abs(h))&&Math.abs(f-r)<=q.b*Math.max(1,Math.abs(f),Math.abs(r))&&Math.abs(k-p)<=q.b*Math.max(1,Math.abs(k),Math.abs(p))&&Math.abs(t-n)<=q.b*Math.max(1,Math.abs(t),Math.abs(n))&&Math.abs(l-D)<=q.b*Math.max(1,Math.abs(l),Math.abs(D))&&Math.abs(g-z)<=q.b*Math.max(1,Math.abs(g),
Math.abs(z))&&Math.abs(e-y)<=q.b*Math.max(1,Math.abs(e),Math.abs(y))&&Math.abs(d-E)<=q.b*Math.max(1,Math.abs(d),Math.abs(E))&&Math.abs(a-b)<=q.b*Math.max(1,Math.abs(a),Math.abs(b))};var q=c(22);f.mul=p;f.sub=k},function(n,f,c){function p(){var a=new e.a(3);a[0]=0;a[1]=0;a[2]=0;return a}function k(a){var b=a[0],d=a[1];a=a[2];return Math.sqrt(b*b+d*d+a*a)}function q(a,b,c){var d=new e.a(3);d[0]=a;d[1]=b;d[2]=c;return d}function a(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];return a}function b(a,
b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];return a}function m(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];return a}function u(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return Math.sqrt(d*d+c*c+a*a)}function v(a,b){var d=b[0]-a[0],c=b[1]-a[1];a=b[2]-a[2];return d*d+c*c+a*a}function t(a){var b=a[0],d=a[1];a=a[2];return b*b+d*d+a*a}function l(a,b){var d=b[0],c=b[1],e=b[2];d=d*d+c*c+e*e;0<d&&(d=1/Math.sqrt(d),a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d);return a}function g(a,b){return a[0]*
b[0]+a[1]*b[1]+a[2]*b[2]}Object.defineProperty(f,"__esModule",{value:!0});f.create=p;f.clone=function(a){var b=new e.a(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};f.length=k;f.fromValues=q;f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a};f.set=function(a,b,c,e){a[0]=b;a[1]=c;a[2]=e;return a};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];return a};f.subtract=a;f.multiply=b;f.divide=m;f.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);
return a};f.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);return a};f.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);return a};f.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);return a};f.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);return a};f.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;return a};f.scaleAndAdd=
function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;a[2]=b[2]+c[2]*e;return a};f.distance=u;f.squaredDistance=v;f.squaredLength=t;f.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};f.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a};f.normalize=l;f.dot=g;f.cross=function(a,b,c){var d=b[0],e=b[1];b=b[2];var h=c[0],f=c[1];c=c[2];a[0]=e*c-b*f;a[1]=b*h-d*c;a[2]=d*f-e*h;return a};f.lerp=function(a,b,c,e){var d=b[0],h=b[1];b=b[2];a[0]=d+e*(c[0]-d);a[1]=h+e*(c[1]-h);a[2]=
b+e*(c[2]-b);return a};f.hermite=function(a,b,c,e,f,g){var d=g*g,h=d*(2*g-3)+1,m=d*(g-2)+g,r=d*(g-1);g=d*(3-2*g);a[0]=b[0]*h+c[0]*m+e[0]*r+f[0]*g;a[1]=b[1]*h+c[1]*m+e[1]*r+f[1]*g;a[2]=b[2]*h+c[2]*m+e[2]*r+f[2]*g;return a};f.bezier=function(a,b,c,e,g,f){var d=1-f,h=d*d,m=f*f,r=h*d;h*=3*f;d*=3*m;f*=m;a[0]=b[0]*r+c[0]*h+e[0]*d+g[0]*f;a[1]=b[1]*r+c[1]*h+e[1]*d+g[1]*f;a[2]=b[2]*r+c[2]*h+e[2]*d+g[2]*f;return a};f.random=function(a,b){b=b||1;var d=2*e.c()*Math.PI,c=2*e.c()-1,h=Math.sqrt(1-c*c)*b;a[0]=Math.cos(d)*
h;a[1]=Math.sin(d)*h;a[2]=c*b;return a};f.transformMat4=function(a,b,c){var d=b[0],e=b[1];b=b[2];var h=c[3]*d+c[7]*e+c[11]*b+c[15];h=h||1;a[0]=(c[0]*d+c[4]*e+c[8]*b+c[12])/h;a[1]=(c[1]*d+c[5]*e+c[9]*b+c[13])/h;a[2]=(c[2]*d+c[6]*e+c[10]*b+c[14])/h;return a};f.transformMat3=function(a,b,c){var d=b[0],e=b[1];b=b[2];a[0]=d*c[0]+e*c[3]+b*c[6];a[1]=d*c[1]+e*c[4]+b*c[7];a[2]=d*c[2]+e*c[5]+b*c[8];return a};f.transformQuat=function(a,b,c){var d=b[0],e=b[1],h=b[2];b=c[0];var f=c[1],g=c[2];c=c[3];var m=c*d+
f*h-g*e,l=c*e+g*d-b*h,r=c*h+b*e-f*d;d=-b*d-f*e-g*h;a[0]=m*c+d*-b+l*-g-r*-f;a[1]=l*c+d*-f+r*-b-m*-g;a[2]=r*c+d*-g+m*-f-l*-b;return a};f.rotateX=function(a,b,c,e){var d=[],h=[];d[0]=b[0]-c[0];d[1]=b[1]-c[1];d[2]=b[2]-c[2];h[0]=d[0];h[1]=d[1]*Math.cos(e)-d[2]*Math.sin(e);h[2]=d[1]*Math.sin(e)+d[2]*Math.cos(e);a[0]=h[0]+c[0];a[1]=h[1]+c[1];a[2]=h[2]+c[2];return a};f.rotateY=function(a,b,c,e){var d=[],h=[];d[0]=b[0]-c[0];d[1]=b[1]-c[1];d[2]=b[2]-c[2];h[0]=d[2]*Math.sin(e)+d[0]*Math.cos(e);h[1]=d[1];h[2]=
d[2]*Math.cos(e)-d[0]*Math.sin(e);a[0]=h[0]+c[0];a[1]=h[1]+c[1];a[2]=h[2]+c[2];return a};f.rotateZ=function(a,b,c,e){var d=[],h=[];d[0]=b[0]-c[0];d[1]=b[1]-c[1];d[2]=b[2]-c[2];h[0]=d[0]*Math.cos(e)-d[1]*Math.sin(e);h[1]=d[0]*Math.sin(e)+d[1]*Math.cos(e);h[2]=d[2];a[0]=h[0]+c[0];a[1]=h[1]+c[1];a[2]=h[2]+c[2];return a};f.angle=function(a,b){a=q(a[0],a[1],a[2]);b=q(b[0],b[1],b[2]);l(a,a);l(b,b);b=g(a,b);return 1<b?0:-1>b?Math.PI:Math.acos(b)};f.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+
")"};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};f.equals=function(a,b){var d=a[0],c=a[1];a=a[2];var h=b[0],f=b[1];b=b[2];return Math.abs(d-h)<=e.b*Math.max(1,Math.abs(d),Math.abs(h))&&Math.abs(c-f)<=e.b*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(a-b)<=e.b*Math.max(1,Math.abs(a),Math.abs(b))};var e=c(22);f.sub=a;f.mul=b;f.div=m;f.dist=u;f.sqrDist=v;f.len=k;f.sqrLen=t;n=function(){var a=p();return function(b,d,c,e,f,g){d||(d=3);c||(c=0);for(e=e?Math.min(e*d+c,b.length):
b.length;c<e;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],f(a,a,g),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();f.forEach=n},function(n,f,c){function p(){var a=new g.a(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a}function k(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];return a}function q(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];a[2]=b[2]*c[2];a[3]=b[3]*c[3];return a}function a(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];a[2]=b[2]/c[2];a[3]=b[3]/c[3];return a}function b(a,b,c){a[0]=b[0]*c;a[1]=b[1]*
c;a[2]=b[2]*c;a[3]=b[3]*c;return a}function m(a,b){var d=b[0]-a[0],c=b[1]-a[1],e=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(d*d+c*c+e*e+a*a)}function u(a,b){var d=b[0]-a[0],c=b[1]-a[1],e=b[2]-a[2];a=b[3]-a[3];return d*d+c*c+e*e+a*a}function v(a){var b=a[0],c=a[1],e=a[2];a=a[3];return Math.sqrt(b*b+c*c+e*e+a*a)}function t(a){var b=a[0],c=a[1],e=a[2];a=a[3];return b*b+c*c+e*e+a*a}function l(a,b){var d=b[0],c=b[1],e=b[2];b=b[3];var f=d*d+c*c+e*e+b*b;0<f&&(f=1/Math.sqrt(f),a[0]=d*f,a[1]=c*f,a[2]=e*f,a[3]=
b*f);return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=p;f.clone=function(a){var b=new g.a(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b};f.fromValues=function(a,b,c,f){var d=new g.a(4);d[0]=a;d[1]=b;d[2]=c;d[3]=f;return d};f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];return a};f.set=function(a,b,c,f,g){a[0]=b;a[1]=c;a[2]=f;a[3]=g;return a};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];return a};f.subtract=k;f.multiply=q;f.divide=
a;f.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);a[3]=Math.ceil(b[3]);return a};f.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);a[3]=Math.floor(b[3]);return a};f.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);a[2]=Math.min(b[2],c[2]);a[3]=Math.min(b[3],c[3]);return a};f.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);a[2]=Math.max(b[2],c[2]);a[3]=Math.max(b[3],c[3]);return a};
f.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);a[3]=Math.round(b[3]);return a};f.scale=b;f.scaleAndAdd=function(a,b,c,f){a[0]=b[0]+c[0]*f;a[1]=b[1]+c[1]*f;a[2]=b[2]+c[2]*f;a[3]=b[3]+c[3]*f;return a};f.distance=m;f.squaredDistance=u;f.length=v;f.squaredLength=t;f.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a};f.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];a[3]=1/b[3];return a};f.normalize=l;f.dot=function(a,b){return a[0]*
b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};f.lerp=function(a,b,c,f){var d=b[0],e=b[1],g=b[2];b=b[3];a[0]=d+f*(c[0]-d);a[1]=e+f*(c[1]-e);a[2]=g+f*(c[2]-g);a[3]=b+f*(c[3]-b);return a};f.random=function(a,d){d=d||1;a[0]=g.c();a[1]=g.c();a[2]=g.c();a[3]=g.c();l(a,a);b(a,a,d);return a};f.transformMat4=function(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];a[0]=c[0]*d+c[4]*e+c[8]*f+c[12]*b;a[1]=c[1]*d+c[5]*e+c[9]*f+c[13]*b;a[2]=c[2]*d+c[6]*e+c[10]*f+c[14]*b;a[3]=c[3]*d+c[7]*e+c[11]*f+c[15]*b;return a};f.transformQuat=
function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],m=c[2];c=c[3];var l=c*d+h*f-m*e,u=c*e+m*d-g*f,t=c*f+g*e-h*d;d=-g*d-h*e-m*f;a[0]=l*c+d*-g+u*-m-t*-h;a[1]=u*c+d*-h+t*-g-l*-m;a[2]=t*c+d*-m+l*-h-u*-g;a[3]=b[3];return a};f.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};f.equals=function(a,b){var d=a[0],c=a[1],e=a[2];a=a[3];var f=b[0],m=b[1],l=b[2];b=b[3];return Math.abs(d-f)<=g.b*Math.max(1,
Math.abs(d),Math.abs(f))&&Math.abs(c-m)<=g.b*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(e-l)<=g.b*Math.max(1,Math.abs(e),Math.abs(l))&&Math.abs(a-b)<=g.b*Math.max(1,Math.abs(a),Math.abs(b))};var g=c(22);f.sub=k;f.mul=q;f.div=a;f.dist=m;f.sqrDist=u;f.len=v;f.sqrLen=t;n=function(){var a=p();return function(b,c,e,f,g,m){c||(c=4);e||(e=0);for(f=f?Math.min(f*c+e,b.length):b.length;e<f;e+=c)a[0]=b[e],a[1]=b[e+1],a[2]=b[e+2],a[3]=b[e+3],g(a,a,m),b[e]=a[0],b[e+1]=a[1],b[e+2]=a[2],b[e+3]=a[3];return b}}();
f.forEach=n},function(n,f,c){f.b=function(c,a,b,f){f=void 0===f?p.e:f;var m=void 0;return new Promise(function(u,t){function l(e){null!==m&&(m=Object(k.c)(c.serverUrls,b.path,b.method),m.responseType=b.responseType,m.setRequestHeader("Authorization",e.credentials.tokenType+" "+e.credentials.accessToken),m.onloadend=function(){if(null!==m){var b=this.status;200<=b&&300>b?(f.remove(g),u(this.response)):401===b?a.get(e,f).then(l):504===b||503===b?a.get(void 0,f).then(l):(f.remove(g),t(k.a.fromXhr(this)))}},
m.send(b.payload))}var g=function(){var a=m;m=null;null!=a&&a.abort();t(p.a)};f.add(g);a.get(void 0,f).then(l)})};var p=c(27),k=c(36);f.a="google-brainmaps"},function(n,f,c){f=c(158);c="object"==typeof self&&self&&self.Object===Object&&self;f=f||c||Function("return this")();n.exports=f},function(n,f,c){f=c(94).Symbol;n.exports=f},function(n,f,c){var p=c(9),k=c(63);n.exports=function(c,a,b){var f=!0,u=!0;if("function"!=typeof c)throw new TypeError("Expected a function");k(b)&&(f="leading"in b?!!b.leading:
f,u="trailing"in b?!!b.trailing:u);return p(c,a,{leading:f,maxWait:a,trailing:u})}},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return b});n=c(0);var k=c(24),q=c(98),a=function(){function a(a,
b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function(b){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var b=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&
"function"!==typeof b?this:b;b.gl=a;b.vertexBuffer=b.registerDisposer(k.a.fromData(a,new Float32Array([0,0,0,1,1,0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,0,1,1]),a.ARRAY_BUFFER,a.STATIC_DRAW));b.colorBuffer=b.registerDisposer(k.a.fromData(a,new Float32Array([1,0,0,.5,1,0,0,.5,0,1,0,.5,0,1,0,.5,0,0,1,.5,0,0,1,.5]),a.ARRAY_BUFFER,a.STATIC_DRAW));b.trivialColorShader=b.registerDisposer(Object(q.c)(a));return b}p(c,b);a(c,[{key:"draw",value:function(a,b){b=void 0===b?!0:b;var c=this.trivialColorShader,f=this.gl;
c.bind();f.uniformMatrix4fv(c.uniform("uProjectionMatrix"),!1,a);a=c.attribute("aVertexPosition");this.vertexBuffer.bindToVertexAttrib(a,4);c=c.attribute("aColor");this.colorBuffer.bindToVertexAttrib(c,4);b&&(f.colorMask(!1,!1,!1,!0),f.clearColor(0,0,0,0),f.clear(f.COLOR_BUFFER_BIT),f.colorMask(!0,!0,!0,!0),f.enable(f.BLEND),f.blendFunc(f.ONE_MINUS_DST_ALPHA,f.DST_ALPHA));f.lineWidth(1);f.drawArrays(f.LINES,0,6);b&&f.disable(f.BLEND);f.disableVertexAttribArray(a);f.disableVertexAttribArray(c)}}],
[{key:"get",value:function(a){return a.memoize.get("SliceViewPanel:AxesLineHelper",function(){return new c(a)})}}]);return c}(n.a)},function(n,f,c){function p(a){a.setFragmentMain("gl_FragColor = getValue0();")}f.a=p;f.b=function(a,b,c){b=void 0===b?p:b;c=void 0===c?1:c;return a.memoize.get("elementWiseTextureShader:"+c+":"+Object(k.a)(b),function(){var f=new q.a(a);f.addVarying("vec2","vTexCoord");f.addUniform("sampler2D","uSampler",c);f.addInitializer(function(b){for(var f=[],g=0;g<c;++g)f[g]=g;
a.uniform1iv(b.uniform("uSampler"),f)});for(var m=0;m<c;++m)f.addFragmentCode("\nvec4 getValue"+m+"() {\n  return texture2D(uSampler["+m+"], vTexCoord);\n}\n");f.addUniform("mat4","uProjectionMatrix");f.require(b);f.addAttribute("vec4","aVertexPosition");f.addAttribute("vec2","aTexCoord");f.setVertexMain("vTexCoord = aTexCoord; gl_Position = uProjectionMatrix * aVertexPosition;");return f.build()})};f.c=function(a){return a.memoize.get("trivialColorShader",function(){var b=new q.a(a);b.addVarying("vec4",
"vColor");b.setFragmentMain("gl_FragColor = vColor;");b.addAttribute("vec4","aVertexPosition");b.addAttribute("vec4","aColor");b.addUniform("mat4","uProjectionMatrix");b.setVertexMain("vColor = aColor; gl_Position = uProjectionMatrix * aVertexPosition;");return b.build()})};var k=c(23),q=c(35)},function(n,f,c){c.d(f,"a",function(){return k});var p=function(){function c(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,
f.key,f)}}return function(a,b,f){b&&c(a.prototype,b);f&&c(a,f);return a}}(),k=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.renderLayers=[null];this.values=[0,0,0];this.nextPickID=1}p(c,[{key:"clear",value:function(){this.renderLayers.length=1;this.values.length=3;this.nextPickID=1}},{key:"registerUint64",value:function(a,b,c){return this.register(a,void 0===c?1:c,b.low,b.high)}},{key:"register",value:function(a,b,c,f){var m=this.renderLayers,
k=this.values,l=this.nextPickID;this.nextPickID+=void 0===b?1:b;b=m.length;m[b]=a;a=3*b;k[a]=l;k[a+1]=void 0===c?0:c;k[a+2]=void 0===f?0:f;return l}},{key:"setMouseState",value:function(a,b){for(var c=this.renderLayers,f=this.values,k=0,t=c.length-1;k<t;){var l=Math.ceil(k+(t-k)/2);f[3*l]>b?t=l-1:k=l}c=a.pickedRenderLayer=c[k];k*=3;b=a.pickedOffset=b-f[k];t=a.pickedValue;t.low=f[k+1];t.high=f[k+2];null!==c&&c.updateMouseState(a,t,b)}}]);return c}()},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return e});n=c(101);var q=c(55),a=c(17),b=c(1),m=c(45),u=c(102),v=c(172),t=function(){function a(a,b){for(var d=
0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),l=function h(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return h(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};c(173);c(30);var g=b.p.create(),e=function(c){function e(c,
f,h){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var l=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,c,f,h.visibility));l.viewer=h;l.mouseX=0;l.mouseY=0;l.mouseStateUpdater=l.updateMouseState.bind(l);l.inputEventMap=h.inputEventMap;f.classList.add("neuroglancer-rendered-data-panel");f.classList.add("neuroglancer-panel");f.classList.add("neuroglancer-noselect");l.registerDisposer(new q.a(f));l.registerDisposer(new m.b(f,l.inputEventMap));l.registerDisposer(new u.a(f,
l.inputEventMap));l.registerEventListener(f,"mousemove",l.onMousemove.bind(l));l.registerEventListener(f,"mouseleave",l.onMouseout.bind(l));Object(a.c)(f,"snap",function(){l.navigationState.pose.snap()});Object(a.c)(f,"zoom-in",function(){l.navigationState.zoomBy(.5)});Object(a.c)(f,"zoom-out",function(){l.navigationState.zoomBy(2)});for(c={axis:0};3>c.axis;c={axis:c.axis},++c.axis){h=b.a[c.axis];for(var r={},k=$jscomp.makeIterator([-1,1]),t=k.next();!t.done;r={sign:r.sign,tempOffset:r.tempOffset},
t=k.next())r.sign=t.value,t=0>r.sign?"-":"+",Object(a.c)(f,"rotate-relative-"+h+t,function(a,c){return function(){l.navigationState.pose.rotateRelative(b.e[a.axis],.1*c.sign)}}(c,r)),r.tempOffset=b.p.create(),Object(a.c)(f,""+h+t,function(a,b){return function(){var c=l.navigationState,e=a.tempOffset;e[0]=0;e[1]=0;e[2]=0;e[b.axis]=a.sign;c.pose.translateVoxelsRelative(e)}}(r,c))}Object(a.c)(f,"zoom-via-wheel",function(a){a=a.detail;l.onMousemove(a);l.zoomByMouse(Object(v.a)(a))});c={};h=$jscomp.makeIterator([1,
10]);for(r=h.next();!r.done;c={amount:c.amount},r=h.next())c.amount=r.value,Object(a.c)(f,"z+"+c.amount+"-via-wheel",function(a){return function(b){var c=b.detail;b=l.navigationState;c=0!==c.deltaY?c.deltaY:c.deltaX;g[0]=0;g[1]=0;g[2]=(0<c?-1:1)*a.amount;b.pose.translateVoxelsRelative(g)}}(c));Object(a.c)(f,"move-to-mouse-position",function(){var a=l.viewer.mouseState;if(a.updateUnconditionally()){var c=l.navigationState.pose.position;b.p.copy(c.spatialCoordinates,a.position);c.changed.dispatch()}});
Object(a.c)(f,"snap",function(){return l.navigationState.pose.snap()});return l}k(e,c);t(e,[{key:"onMouseout",value:function(a){a=this.viewer.mouseState;a.updater=void 0;a.setActive(!1)}},{key:"onMousemove",value:function(a){var b=this.element;a.target===b&&(this.mouseX=a.offsetX-b.clientLeft,this.mouseY=a.offsetY-b.clientTop,a=this.viewer.mouseState,a.updater=this.mouseStateUpdater,a.triggerUpdate())}},{key:"disposed",value:function(){var a=this.viewer.mouseState;a.updater===this.mouseStateUpdater&&
(a.updater=void 0,a.setActive(!1));l(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}}]);return e}(n.b)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"b",function(){return v});c.d(f,"a",function(){return t});n=c(0);var a=c(4),b=c(169),m=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,d){c&&a(b.prototype,c);d&&
a(b,d);return b}}(),u=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},v=function(a){function b(a,c,e){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.context=a;d.element=c;d.visibility=e;d.gl=a.gl;a.addPanel(d);return d}q(b,a);m(b,[{key:"scheduleRedraw",value:function(){this.context.scheduleRedraw()}},
{key:"setGLViewport",value:function(){var a=this.element,b=a.getBoundingClientRect(),c=this.context.canvasRect,e=a.clientLeft+b.left-c.left,f=a.clientWidth,g=a.clientHeight;b=b.top-c.top+a.clientTop+g;a=this.gl;a.enable(a.SCISSOR_TEST);b=this.context.canvas.height-b;a.viewport(e,b,f,g);a.scissor(e,b,f,g)}},{key:"disposed",value:function(){this.context.removePanel(this);u(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visibility.visible}}]);
return b}(n.a),t=function(c){function e(d){p(this,e);var c=k(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.container=d;c.canvas=document.createElement("canvas");c.updateStarted=new a.a;c.updateFinished=new a.a;c.panels=new Set;c.updatePending=null;c.needsRedraw=!1;var f=c.canvas;d.style.position="relative";f.style.position="absolute";f.style.top="0px";f.style.left="0px";f.style.width="100%";f.style.height="100%";f.style.zIndex="0";d.appendChild(f);c.gl=Object(b.a)(f);c.registerEventListener(window,
"resize",c.onResize.bind(c));return c}q(e,c);m(e,[{key:"makeCanvasOverlayElement",value:function(){var a=document.createElement("div");a.style.position="absolute";a.style.top="0px";a.style.left="0px";a.style.width="100%";a.style.height="100%";a.style.zIndex="2";this.container.appendChild(a);return a}},{key:"disposed",value:function(){null!=this.updatePending&&(cancelAnimationFrame(this.updatePending),this.updatePending=null)}},{key:"addPanel",value:function(a){this.panels.add(a)}},{key:"removePanel",
value:function(a){this.panels.delete(a);a.dispose()}},{key:"onResize",value:function(){this.scheduleRedraw();for(var a=$jscomp.makeIterator(this.panels),b=a.next();!b.done;b=a.next())b.value.onResize()}},{key:"scheduleUpdate",value:function(){null===this.updatePending&&(this.updatePending=requestAnimationFrame(this.update.bind(this)))}},{key:"scheduleRedraw",value:function(){this.needsRedraw||(this.needsRedraw=!0,this.scheduleUpdate())}},{key:"update",value:function(){this.updatePending=null;this.updateStarted.dispatch();
if(this.needsRedraw){this.needsRedraw=!1;var a=this.gl,b=this.canvas;b.width=b.offsetWidth;b.height=b.offsetHeight;this.canvasRect=b.getBoundingClientRect();this.gl.clearColor(0,0,0,0);a.clear(a.COLOR_BUFFER_BIT|a.DEPTH_BUFFER_BIT);b=$jscomp.makeIterator(this.panels);for(var c=b.next();!c.done;c=b.next()){c=c.value;var e=c.element;c.visible&&0!==e.clientWidth&&0!==e.clientHeight&&0!==e.offsetWidth&&0!==e.offsetHeight&&(c.setGLViewport(),c.draw())}a.disable(a.SCISSOR_TEST);this.gl.clearColor(1,1,1,
1);this.gl.colorMask(!1,!1,!1,!0);a.clear(a.COLOR_BUFFER_BIT);this.gl.colorMask(!0,!0,!0,!0)}this.updateFinished.dispatch()}}]);return e}(n.a)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return b});n=c(0);var q=c(17),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function(b){function c(a,b){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");
var f=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.target=a;f.eventMap=b;f.registerEventListener(a,"wheel",function(a){f.dispatch("wheel",a)});f.registerEventListener(a,"click",function(a){f.dispatch("click"+a.button,a)});f.registerEventListener(a,"dblclick",function(a){f.dispatch("dblclick"+a.button,a)});f.registerEventListener(a,"mousedown",function(a){f.dispatch("mousedown"+a.button,a)});f.registerEventListener(a,"mouseup",function(a){f.dispatch("mouseup"+a.button,a)});return f}
k(c,b);a(c,[{key:"dispatch",value:function(a,b){Object(q.b)(a,b,this.eventMap)}}]);return c}(n.a)},function(n,f,c){f.b=function(c,f,q,a){for(;f<q;){var b=c[f];a(b)?++f:(--q,c[f]=c[q],c[q]=b)}return q};f.a=function(c,f){if(c.length===f)return c;f=new c.constructor(f);f.set(c);return f}},function(n,f,c){f.a=function(c,f){var k=c.view.document,a=c.screenX,b=c.screenY,m=function(c){var m=a-c.screenX,g=b-c.screenY;a=c.screenX;b=c.screenY;f(c,m,g)},u=c.button,p=function(a){a.button===u&&(k.removeEventListener("mousemove",
m,!0),k.removeEventListener("mouseup",p,!1))};k.addEventListener("mousemove",m,!0);k.addEventListener("mouseup",p,!1)}},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function q(a){for(var b=v.length,d=v[b-1],c=0;c<b;++c){var f=v[c];if(a>=f.lengthInNanometers){d=f;break}}return d}f.b=q;c.d(f,"a",function(){return l});n=c(0);var a=c(56),b=function e(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return e(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},m=function(){function a(a,b){for(var d=0;d<b.length;d++){var c=b[d];c.enumerable=c.enumerable||
!1;c.configurable=!0;"value"in c&&(c.writable=!0);Object.defineProperty(a,c.key,c)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),u=[1.5,2,3,5,7.5,10],v=[{unit:"km",lengthInNanometers:1E12},{unit:"m",lengthInNanometers:1E9},{unit:"mm",lengthInNanometers:1E6},{unit:"\u00b5m",lengthInNanometers:1E3},{unit:"nm",lengthInNanometers:1},{unit:"pm",lengthInNanometers:.001}],t=function(){function a(){k(this,a);this.allowedSignificands=u;this.prevTargetLengthInPixels=this.prevNanometersPerPixel=
this.nanometersPerPixel=this.targetLengthInPixels=0}m(a,[{key:"update",value:function(){var a=this.nanometersPerPixel,b=this.targetLengthInPixels;if(this.prevNanometersPerPixel===a&&this.prevTargetLengthInPixels===b)return!1;this.prevNanometersPerPixel=a;this.prevTargetLengthInPixels=b;var c=b*a;b=Math.pow(10,Math.floor(Math.log(c)/Math.LN10));c/=b;for(var e=1,f=$jscomp.makeIterator(this.allowedSignificands),m=f.next();!m.done;m=f.next())if(m=m.value,Math.abs(m-c)<Math.abs(e-c))e=m;else break;b*=
e;c=q(b);this.lengthInPixels=Math.round(b/a);this.physicalUnit=c.unit;this.physicalLength=b/c.lengthInNanometers;return!0}}]);return a}(),l=function(c){function d(a,b){b=void 0===b?new t:b;k(this,d);var c=(d.__proto__||Object.getPrototypeOf(d)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");c=!c||"object"!==typeof c&&"function"!==typeof c?this:c;c.gl=a;c.dimensions=b;c.texture=null;c.width=0;c.height=0;return c}p(d,c);m(d,[{key:"update",value:function(){var b=
this.dimensions,c=this.texture;if(b.update()||null===c){null===c&&(c=this.texture=this.gl.createTexture());var d=this.gl,e=document.createElement("canvas"),f=e.getContext("2d");f.font="bold 15px sans-serif";f.fillStyle="white";var m=b.physicalLength+" "+b.physicalUnit,l=f.measureText(m);l=Math.max(b.lengthInPixels,l.width)+4;e.width=l;e.height=32;f.font="bold 15px sans-serif";f.textAlign="center";f.fillStyle="rgba(0, 0, 0, 0.3)";f.fillRect(0,0,l,32);f.fillStyle="white";f.fillText(m,l/2,17);f.fillRect(2,
22,b.lengthInPixels,8);Object(a.c)(d,c,e);this.width=l;this.height=32}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;b(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}}]);return d}(n.a)},function(n,f,c){c.d(f,"c",function(){return p});f.a="/ocp/ca";f.b="/nd/sd";var p=function q(){if(!(this instanceof q))throw new TypeError("Cannot call a class as a function");};p.RPC_ID="ndstore/VolumeChunkSource"},function(n,f,c){function p(a,
b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof
b))throw new TypeError("Cannot call a class as a function");}function a(a,b,c){Object(y.u)(a);var e=Object(y.w)(a,"Base",function(a){return new G(a)});switch(e.typeName){case "uint8blk":case "grayscale8":return new F(a,b,e,d.c.JPEG,c);case "imagetile":return new V(a,b,e);case "labels64":case "labelblk":return new F(a,b,e,d.c.COMPRESSED_SEGMENTATION,c);default:throw Error("DVID data type "+JSON.stringify(e.typeName)+" is not supported.");}}function b(a){try{for(var b=Object(y.v)(a,function(a){return new T(a)}),
c=new Map,d=$jscomp.makeIterator(b),e=d.next();!e.done;e=d.next()){var f=$jscomp.makeIterator(e.value),g=f.next().value,h=f.next().value;c.set(g,h);for(var m=$jscomp.makeIterator(h.vnodes),l=m.next();!l.done;l=m.next()){var r=l.value;if(r!==g){var k=new T(h);c.set(r,k)}}}for(var t=$jscomp.makeIterator(c),u=t.next();!u.done;u=t.next()){var q=$jscomp.makeIterator(u.value),p=q.next().value;q.next().value.uuid=p}return c}catch(Ma){throw Error("Failed to parse DVID repositories info: "+Ma.message);}}function m(a,
b){return a.memoize.getUncounted({type:"dvid:getServerInfo",baseUrls:b},function(){var a=Object(z.e)(Object(z.c)(b,"/api/repos/info","GET"),"json").then(function(a){return new L(a)}),c="repository info for DVID server "+b[0];B.a.forPromise(a,{initialMessage:"Retrieving "+c+".",delay:!0,errorPrefix:"Error retrieving "+c+": "});return a})}function u(a,b,c,d){return a.memoize.getUncounted({type:"dvid:getInstanceDetails",baseUrls:b,nodeKey:c,name:d.name},function(){var a=Object(z.e)(Object(z.c)(b,"/api/node/"+
c+"/"+d.name+"/info","GET"),"json"),e="datainstance info for node "+c+" and instance "+d.name+" "+("on DVID server "+b[0]);B.a.forPromise(a,{initialMessage:"Retrieving "+e+".",delay:!0,errorPrefix:"Error retrieving "+e+": "});return a.then(function(a){a=Object(y.w)(a,"Extended",y.u);d.lowerVoxelBound=Object(y.w)(a,"MinPoint",function(a){return Object(y.d)(D.p.create(),a)});d.upperVoxelBound=Object(y.w)(a,"MaxPoint",function(a){return Object(y.d)(D.p.create(),a)});return d})})}function v(a,b,c,d){return m(a,
b).then(function(e){e=e.getNode(c);if(void 0===e)throw Error("Invalid node: "+JSON.stringify(c)+".");e=e.dataInstances.get(d);if(!(e instanceof F||e instanceof V))throw Error("Invalid data instance "+d+".");return u(a,b,c,e)}).then(function(e){return a.memoize.getUncounted({type:"dvid:MultiscaleVolumeChunkSource",baseUrls:b,nodeKey:c,dataInstanceKey:d},function(){return new S(a,b,c,d,e)})})}function t(a,b){var c=b.match(Y);if(null===c)throw Error("Invalid DVID URL: "+JSON.stringify(b)+".");return v(a,
[c[1]],c[2],c[3])}function l(a,b){return{offset:0,completions:Object(C.c)(b,a.dataInstances.values(),function(a){return a.name},function(a){return""+a.base.typeName})}}function g(a,b){var c=b.match(/^(?:([^\/]+)(?:\/([^\/]*))?)?$/);if(null===c)throw Error("Invalid DVID URL syntax.");if(void 0===c[2])return{offset:0,completions:Object(C.c)(b,a.repositories.values(),function(a){return a.uuid+"/"},function(a){return a.alias+": "+a.description})};b=c[1];a=a.getNode(b);return Object(C.a)(b.length+1,l(a,
c[2]))}function e(a,b){a=a.match(/^((?:http|https):\/\/[^\/]+)\/(.*)$/);if(null===a)return Promise.reject(null);var c=a[1],d=a[2];return m(b,[c]).then(function(a){return Object(C.a)(c.length+1,g(a,d))})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"getVolume",function(){return t});c.d(f,"volumeCompleter",function(){return e});c.d(f,"DataInstanceBaseInfo",function(){return G});c.d(f,"DataInstanceInfo",function(){return H});c.d(f,"VolumeDataInstanceInfo",function(){return F});c.d(f,"TileLevelInfo",
function(){return R});c.d(f,"TileDataInstanceInfo",function(){return V});f.parseDataInstance=a;c.d(f,"RepositoryInfo",function(){return T});f.parseRepositoriesInfo=b;c.d(f,"ServerInfo",function(){return L});f.getServerInfo=m;f.getDataInstanceDetails=u;c.d(f,"MultiscaleVolumeChunkSource",function(){return S});f.getShardedVolume=v;f.completeInstanceName=l;f.completeNodeAndInstance=g;c.d(f,"DVIDDataSource",function(){return ha});n=c(16);f=c(28);var d=c(179),h=c(11),r=c(21),B=c(31),C=c(42),D=c(1),z=c(36),
y=c(2),E=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),A=new Map;A.set("uint8",h.a.UINT8);A.set("uint32",h.a.UINT32);A.set("uint64",h.a.UINT64);var G=function(){function a(b){q(this,a);this.obj=b;Object(y.u)(b);Object(y.w)(b,"TypeName",y.B)}E(a,[{key:"typeName",get:function(){return this.obj.TypeName}}]);
return a}(),H=function P(a,b,c){q(this,P);this.obj=a;this.name=b;this.base=c},J=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(Object(n.f)(r.b,d.d)),F=function(a){function b(a,c,d,e,f){q(this,b);d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c,d));d.encoding=e;a=Object(y.w)(a,"Extended",y.u);e=Object(y.w)(a,"Values",function(a){return Object(y.a)(a,y.u)});if(1>e.length)throw Error("Expected Extended.Values property to have length >= 1, but received: ${JSON.stringify(extendedValues)}.");
d.numLevels=1;for(f=new Set(f);f.has(c+"_"+d.numLevels.toString());)d.numLevels+=1;d.dataType=Object(y.w)(e[0],"DataType",function(a){return Object(y.t)(a,A)});d.voxelSize=Object(y.w)(a,"VoxelSize",function(a){return Object(y.c)(D.p.create(),a,y.p)});d.numChannels=1;return d}k(b,a);E(b,[{key:"getSources",value:function(a,b,c){for(var e=this.encoding,f=[],g={},m=0;m<this.numLevels;g={volParameters:g.volParameters},++m){for(var l=D.p.scale(D.p.create(),this.voxelSize,Math.pow(2,m)),r=D.p.create(),k=
D.p.create(),t=0;3>t;++t)r[t]=Math.floor(this.voxelSize[t]/l[t]*this.lowerVoxelBound[t]),k[t]=Math.ceil(this.voxelSize[t]/l[t]*this.upperVoxelBound[t]);t=b.dataInstanceKey;0<m&&(t+="_"+m.toString());g.volParameters={baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:t,encoding:e};l=h.c.getDefaults({voxelSize:l,dataType:this.dataType,numChannels:this.numChannels,transform:D.j.fromTranslation(D.j.create(),D.p.multiply(D.p.create(),r,l)),baseVoxelOffset:r,upperVoxelBound:D.p.subtract(D.p.create(),
k,r),volumeType:this.volumeType,volumeSourceOptions:c,compressedSegmentationBlockSize:e===d.c.COMPRESSED_SEGMENTATION?D.p.fromValues(8,8,8):void 0}).map(function(b){return function(c){return a.getChunkSource(J,{spec:c,parameters:b.volParameters})}}(g));f.push(l)}return f}},{key:"volumeType",get:function(){return this.encoding===d.c.COMPRESSED_SEGMENTATION?h.d.SEGMENTATION:h.d.IMAGE}}]);return b}(H),R=function Na(a){q(this,Na);Object(y.u)(a);this.resolution=Object(y.w)(a,"Resolution",function(a){return Object(y.c)(D.p.create(),
a,y.p)});this.tileSize=Object(y.w)(a,"TileSize",function(a){return Object(y.c)(D.p.create(),a,y.A)})},K=[[0,1],[0,2],[1,2]],N=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(Object(n.f)(r.b,d.a)),V=function(a){function b(a,c,e){q(this,b);c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a,c,e));a=Object(y.w)(a,"Extended",y.u);c.levels=Object(y.w)(a,"Levels",function(a){return Object(y.v)(a,function(a){return new R(a)})});
e=c.levels.get("0");if(void 0===e)throw Error("Level 0 is not defined.");c.voxelSize=e.resolution;var f=Object(y.w)(a,"MinTileCoord",function(a){return Object(y.c)(D.p.create(),a,y.s)}),g=Object(y.w)(a,"MaxTileCoord",function(a){return Object(y.c)(D.p.create(),a,y.s)});c.lowerVoxelBound=D.p.multiply(D.p.create(),e.tileSize,f);c.upperVoxelBound=D.p.multiply(D.p.create(),e.tileSize,g);a=Object(y.w)(a,"Encoding",function(a){return a});switch(a){case 2:c.encoding=d.b.JPEG;break;default:throw Error("Unsupported tile encoding: "+
JSON.stringify(a)+".");}return c}k(b,a);E(b,[{key:"dataType",get:function(){return h.a.UINT8}},{key:"volumeType",get:function(){return h.d.IMAGE}},{key:"numChannels",get:function(){return 1}}]);E(b,[{key:"getSources",value:function(a,b,c){for(var d=this,e=[],f=this.numChannels,g=this.dataType,m=this.encoding,l={},r=$jscomp.makeIterator(this.levels),k=r.next();!k.done;l={levelInfo:l.levelInfo,level:l.level},k=r.next())k=$jscomp.makeIterator(k.value),l.level=k.next().value,l.levelInfo=k.next().value,
k=K.map(function(e){return function(l){for(var r=D.p.clone(d.voxelSize),k=D.p.fromValues(1,1,1),t=0;2>t;++t)r[l[t]]=e.levelInfo.resolution[l[t]],k[l[t]]=e.levelInfo.tileSize[l[t]];t=D.p.create();for(var u=D.p.create(),q=0;3>q;++q)t[q]=Math.floor(d.voxelSize[q]/r[q]*d.lowerVoxelBound[q]),u[q]=Math.ceil(d.voxelSize[q]/r[q]*d.upperVoxelBound[q]);r=h.c.make({voxelSize:r,chunkDataSize:k,numChannels:f,dataType:g,lowerVoxelBound:t,upperVoxelBound:u,volumeSourceOptions:c});return a.getChunkSource(N,{spec:r,
parameters:{baseUrls:b.baseUrls,nodeKey:b.nodeKey,dataInstanceKey:b.dataInstanceKey,encoding:m,level:e.level,dims:l[0]+"_"+l[1]}})}}(l)),e.push(k);return e}}]);return b}(H),T=function M(b){q(this,M);this.errors=[];this.dataInstances=new Map;this.vnodes=new Set;if(b instanceof M)this.alias=b.alias,this.description=b.description,this.errors=b.errors,this.dataInstances=b.dataInstances;else{Object(y.u)(b);this.alias=Object(y.w)(b,"Alias",y.B);this.description=Object(y.w)(b,"Description",y.B);for(var c=
Object(y.w)(b,"DataInstances",y.u),d=Object.keys(c),e=$jscomp.makeIterator(d),f=e.next();!f.done;f=e.next()){f=f.value;try{this.dataInstances.set(f,a(c[f],f,d))}catch(za){f="Failed to parse data instance "+JSON.stringify(f)+": "+za.message,console.log(f),this.errors.push(f)}}b=Object(y.w)(b,"DAG",y.u);b=Object(y.w)(b,"Nodes",y.u);b=$jscomp.makeIterator(Object.keys(b));for(f=b.next();!f.done;f=b.next())this.vnodes.add(f.value)}},L=function(){function a(c){q(this,a);this.repositories=b(c)}E(a,[{key:"getNode",
value:function(a){for(var b=[],c=$jscomp.makeIterator(this.repositories.keys()),d=c.next();!d.done;d=c.next())d=d.value,d.startsWith(a)&&b.push(d);if(1!==b.length)throw Error("Node key "+JSON.stringify(a)+" matches "+JSON.stringify(b)+" nodes.");return this.repositories.get(b[0])}}]);return a}(),S=function(){function a(b,c,d,e,f){q(this,a);this.chunkManager=b;this.baseUrls=c;this.nodeKey=d;this.dataInstanceKey=e;this.info=f}E(a,[{key:"getSources",value:function(a){return this.info.getSources(this.chunkManager,
{baseUrls:this.baseUrls,nodeKey:this.nodeKey,dataInstanceKey:this.dataInstanceKey},a)}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return this.info.dataType}},{key:"numChannels",get:function(){return this.info.numChannels}},{key:"volumeType",get:function(){return this.info.volumeType}}]);return a}(),Y=/^((?:http|https):\/\/[^\/]+)\/([^\/]+)\/([^\/]+)$/,ha=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
k(b,a);E(b,[{key:"getVolume",value:function(a,b){return t(a,b)}},{key:"volumeCompleter",value:function(a,b){return e(a,b)}},{key:"description",get:function(){return"DVID"}}]);return b}(f.a)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&
null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){var c=Object(F.a)(a,F.u);if(1>c.length)throw Error("No stacks found for owner object.");a=new Map;var d=Object(F.w)(c[0],"stackId",m);c=$jscomp.makeIterator(c);for(var e=c.next();!e.done;e=c.next()){var f=e.value;
e=Object(F.w)(f,"stackId",b);Object(F.u)(f);var g=Object(F.w)(f,"state",F.B);if(T.has(g)){g=Object(F.w)(f,"stats",F.u);var h=g;Object(F.u)(h);h=Object(F.w)(h,"stackBounds",F.u);var l=H.p.create();l[0]=Object(F.w)(h,"minX",F.q);l[1]=Object(F.w)(h,"minY",F.q);l[2]=Object(F.w)(h,"minZ",F.q);h=l;l=g;Object(F.u)(l);l=Object(F.w)(l,"stackBounds",F.u);var r=H.p.create();r[0]=Object(F.w)(l,"maxX",F.q);r[1]=Object(F.w)(l,"maxY",F.q);r[2]=Object(F.w)(l,"maxZ",F.q);l=r;r=[];g.hasOwnProperty("channelNames")&&
(r=u(g));g=Object(F.w)(f,"currentVersion",v);f=Object(F.w)(f,"stackId",t);f={lowerVoxelBound:h,upperVoxelBound:l,voxelResolution:g,project:f,channels:r}}else f=void 0;void 0!==f&&(g=f.project,h=a.get(g),void 0===h&&(h=new Map,a.set(g,{stacks:h}),h=a.get(g)),h.stacks.set(e,f))}return{owner:d,projects:a}}function b(a){Object(F.u)(a);return Object(F.w)(a,"stack",F.B)}function m(a){Object(F.u)(a);return Object(F.w)(a,"owner",F.B)}function u(a){Object(F.u)(a);return Object(F.w)(a,"channelNames",function(a){return Object(F.a)(a,
F.B)})}function v(a){Object(F.u)(a);var b=H.p.create();try{b[0]=Object(F.w)(a,"stackResolutionX",F.q),b[1]=Object(F.w)(a,"stackResolutionY",F.q),b[2]=Object(F.w)(a,"stackResolutionZ",F.q)}catch(M){b[0]=1,b[1]=1,b[2]=1}return b}function t(a){Object(F.u)(a);return Object(F.w)(a,"project",F.B)}function l(a,b){for(var c=0,d=0;2>d;d++)c<a.upperVoxelBound[d]&&(c=a.upperVoxelBound[d]);for(a=0;c>b;)c/=2,a++;return a}function g(b,c,d){return b.memoize.getUncounted({type:"render:getOwnerInfo",hostnames:c,owner:d},
function(){return Object(J.e)(Object(J.c)(c,"/render-ws/v1/owner/"+d+"/stacks"),"json").then(a)})}function e(a,b,c){var d=c.match(S);if(null===d)throw Error("Invalid volume path "+JSON.stringify(c));var e=d[1],f=d[2],h=d[3],m=d[4],l=Object(F.e)(d[5]||"");return a.memoize.getUncounted({type:"render:MultiscaleVolumeChunkSource",hostnames:b,path:c},function(){return g(a,b,e).then(function(c){return new L(a,b,c,h,f,m,l)})})}function d(a,b){var c=b.match(Y);if(null===c)throw Error("Invalid render volume path: "+
JSON.stringify(b));b=c[1].split(",");return e(a,b,c[2])}function h(a,b,c){var d=c.match(/^(?:([^\/]+)(?:\/([^\/]*))?(?:\/([^\/]*))?(\/.*?)?)?$/);if(null===d||void 0===d[2])return Promise.reject(null);if(void 0===d[3]){var e=d[2]||"";return g(a,b,d[1]).then(function(a){a=Object(G.c)(e,a.projects,function(a){return a[0]+"/"},function(){});return{offset:d[1].length+1,completions:a}})}if(void 0===d[4]){var f=d[3]||"";return g(a,b,d[1]).then(function(a){a=a.projects.get(d[2]);if(void 0===a)return Promise.reject(null);
a=Object(G.c)(f,a.stacks,function(a){return a[0]+"/"},function(a){return"("+a[1].project+")"});return{offset:d[1].length+d[2].length+2,completions:a}})}var h=d[4].substr(1)||"";return g(a,b,d[1]).then(function(a){a=a.projects.get(d[2]);if(void 0===a)return Promise.reject(null);a=a.stacks.get(d[3]);if(void 0===a)return Promise.reject(null);a=a.channels;if(0===a.length)return Promise.reject(null);a=Object(G.c)(h,a,function(a){return a},function(){});return{offset:d[1].length+d[2].length+d[3].length+
3,completions:a}})}function r(a,b){var c=a.match(Y);if(null===c)return Promise.reject(null);a=c[1].split(",");return h(b,a,c[2]).then(function(a){return Object(G.a)(c[1].length+1,a)})}function B(a,b){var c=b.match(Y);if(null===c)throw Error("Invalid render point path: "+JSON.stringify(b));return C(a,[c[1]],c[2])}function C(a,b,c){var d=c.match(S);if(null===d)throw Error("Invalid point path "+JSON.stringify(c));var e=d[1],f=d[2],h=d[3],m=Object(F.e)(d[4]||"");return a.memoize.getUncounted({type:"render:MultiscaleVectorGraphicsChunkSource",
hostnames:b,path:c},function(){return g(a,b,e).then(function(c){return new ha(a,b,c,h,f,m)})})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"getVolume",function(){return d});c.d(f,"volumeCompleter",function(){return r});c.d(f,"MultiscaleVolumeChunkSource",function(){return L});f.computeStackHierarchy=l;f.getOwnerInfo=g;f.getShardedVolume=e;f.stackAndProjectCompleter=h;c.d(f,"MultiscaleVectorGraphicsChunkSource",function(){return ha});f.getPointMatches=B;f.getShardedPointMatches=C;c.d(f,
"RenderDataSource",function(){return I});n=c(16);f=c(28);var D=c(181),z=c(71),y=c(109),E=c(11),A=c(21),G=c(42),H=c(1),J=c(36),F=c(2),R=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),K=new Set(["jpg"]),N=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
q(b,a);return b}(Object(n.f)(A.b,D.b)),V=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(n.f)(y.b,D.a)),T=new Set(["COMPLETE"]),L=function(){function a(b,c,d,e,f,g,h){p(this,a);this.chunkManager=b;this.baseUrls=c;this.ownerInfo=d;this.project=f;this.parameters=h;b=d.projects.get(f);if(void 0===b)throw Error("Specified project "+JSON.stringify(f)+" does not exist for "+("specified owner "+JSON.stringify(d.owner)));
if(void 0===e){e=Array.from(b.stacks.keys());if(1!==e.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(e));e=e[0]}d=b.stacks.get(e);if(void 0===d)throw Error("Specified stack "+JSON.stringify(e)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));this.stack=e;this.stackInfo=d;void 0!==g&&0<g.length&&(this.channel=g);this.minIntensity=Object(F.y)(h.minIntensity);this.maxIntensity=Object(F.y)(h.maxIntensity);this.maxTileSpecsToRender=Object(F.y)(h.maxTileSpecsToRender);
this.filter=Object(F.x)(h.filter);g=Object(F.z)(h.encoding);if(void 0===g)g="jpg";else if(!K.has(g))throw Error("Invalid encoding: "+JSON.stringify(g)+".");this.encoding=g;this.numLevels=Object(F.y)(h.numlevels);this.dims=H.p.create();h=Object(F.y)(h.tilesize);void 0===h&&(h=1024);this.dims[0]=h;this.dims[1]=h;this.dims[2]=1}R(a,[{key:"getSources",value:function(a){var b=[],c=this.numLevels;void 0===c&&(c=l(this.stackInfo,this.dims[0]));for(var d=H.p.create(),e=H.p.create(),f=0;3>f;f++)d[f]=this.stackInfo.lowerVoxelBound[f]*
this.stackInfo.voxelResolution[f],e[f]=this.stackInfo.upperVoxelBound[f]*this.stackInfo.voxelResolution[f];for(f=0;f<c;f++){for(var g=H.p.clone(this.stackInfo.voxelResolution),h=H.p.fromValues(1,1,1),m=0;2>m;++m)g[m]*=Math.pow(2,f),h[m]=this.dims[m];m=H.p.create();for(var r=H.p.create(),k=0;3>k;k++)m[k]=Math.floor(this.stackInfo.voxelResolution[k]/g[k]*this.stackInfo.lowerVoxelBound[k]),r[k]=Math.ceil(this.stackInfo.voxelResolution[k]/g[k]*this.stackInfo.upperVoxelBound[k]);g=E.c.make({voxelSize:g,
chunkDataSize:h,numChannels:this.numChannels,dataType:this.dataType,lowerClipBound:d,upperClipBound:e,lowerVoxelBound:m,upperVoxelBound:r,volumeSourceOptions:a});g=this.chunkManager.getChunkSource(N,{spec:g,parameters:{baseUrls:this.baseUrls,owner:this.ownerInfo.owner,project:this.stackInfo.project,stack:this.stack,channel:this.channel,minIntensity:this.minIntensity,maxIntensity:this.maxIntensity,maxTileSpecsToRender:this.maxTileSpecsToRender,filter:this.filter,dims:this.dims[0]+"_"+this.dims[1],
level:f,encoding:this.encoding}});b.push([g])}return b}},{key:"getMeshSource",value:function(){return null}},{key:"dataType",get:function(){return E.a.UINT8}},{key:"numChannels",get:function(){return 3}},{key:"volumeType",get:function(){return E.d.IMAGE}}]);return a}(),S=/^([^\/?]+)(?:\/([^\/?]+))?(?:\/([^\/?]+))(?:\/([^\/?]*))?(?:\?(.*))?$/,Y=/^((?:(?:(?:http|https):\/\/[^,\/]+)[^\/?])+)\/(.*)$/,ha=function(){function a(b,c,d,e,f,g){p(this,a);this.chunkManager=b;this.baseUrls=c;this.ownerInfo=d;
this.project=f;this.parameters=g;b=d.projects.get(f);if(void 0===b)throw Error("Specified project "+JSON.stringify(f)+" does not exist for "+("specified owner "+JSON.stringify(d.owner)));if(void 0===e){e=Array.from(b.stacks.keys());if(1!==e.length)throw Error("Dataset contains multiple stacks: "+JSON.stringify(e));e=e[0]}d=b.stacks.get(e);if(void 0===d)throw Error("Specified stack "+JSON.stringify(e)+" is not one of the supported stacks: "+JSON.stringify(Array.from(b.stacks.keys())));this.stack=e;
this.stackInfo=d;d=Object(F.z)(g.matchCollection);void 0===d&&(d=e);this.matchCollection=d;e=Object(F.y)(g.zoffset);void 0===e&&(e=1);this.zoffset=e;this.dims=H.p.create();g=Object(F.y)(g.tilesize);void 0===g&&(g=1024);this.dims[0]=g;this.dims[1]=g;this.dims[2]=1}R(a,[{key:"getSources",value:function(a){for(var b=H.p.clone(this.stackInfo.voxelResolution),c=H.p.create(),d=H.p.create(),e=0;3>e;e++)c[e]=Math.floor(this.stackInfo.voxelResolution[e]/b[e]*this.stackInfo.lowerVoxelBound[e]),d[e]=Math.ceil(this.stackInfo.voxelResolution[e]/
b[e]*this.stackInfo.upperVoxelBound[e]);e=H.p.clone(d);e[0]+=Math.abs(c[0]);e[1]+=Math.abs(c[1]);e[2]=1;a=z.b.make({voxelSize:b,lowerVoxelBound:c,upperVoxelBound:d,chunkDataSize:e,vectorGraphicsSourceOptions:a});return[[this.chunkManager.getChunkSource(V,{spec:a,parameters:{baseUrls:this.baseUrls,owner:this.ownerInfo.owner,project:this.stackInfo.project,stack:this.stack,encoding:"points",matchCollection:this.matchCollection,zoffset:this.zoffset}})]]}}]);return a}(),I=function(a){function b(){p(this,
b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);R(b,[{key:"getVolume",value:function(a,b){return d(a,b)}},{key:"volumeCompleter",value:function(a,b){return r(a,b)}},{key:"getVectorGraphicsSource",value:function(a,b){return B(a,b)}},{key:"description",get:function(){return"Render"}}]);return b}(f.a)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return t});c.d(f,"b",function(){return g});n=c(46);f=c(66);var a=c(71),b=c(24),m=c(13),u=function d(a,b,c){null===
a&&(a=Function.prototype);var f=Object.getOwnPropertyDescriptor(a,b);if(void 0===f){if(a=Object.getPrototypeOf(a),null!==a)return d(a,b,c)}else{if("value"in f)return f.value;b=f.get;return void 0===b?void 0:b.call(c)}},v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(b){function c(b,d){d=void 0===
d?{}:d;d=void 0===d.sourceOptions?{}:d.sourceOptions;p(this,c);b=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,b.chunkManager,b.getSources(d)));b.shader=void 0;b.shaderUpdated=!0;b.rpcId=null;d=b.registerDisposer(new m.b);d.RPC_TYPE_ID=a.a;d.initializeCounterpart(b.chunkManager.rpc,{sources:b.sourceIds});b.rpcId=d.rpcId;return b}q(c,b);v(c,[{key:"defineShader",value:function(a){a.addFragmentCode("\nvoid emit(vec4 color) {\n  gl_FragColor = color;\n}\nvoid emitRGBA(vec4 rgba) {\n  emit(vec4(rgba.rgb, rgba.a * uOpacity));\n}\nvoid emitRGB(vec3 rgb) {\n  emit(vec4(rgb, uOpacity));\n}\nvoid emitGrayscale(float value) {\n  emit(vec4(value, value, value, uOpacity));\n}\nvoid emitTransparent() {\n  emit(vec4(0.0, 0.0, 0.0, 0.0));\n}\n")}},
{key:"beginSlice",value:function(a){a=this.shader;a.bind();return a}}]);return c}(f.a),l=function(a){function c(a,b){p(this,c);a=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a,b));a.vertexPositions=b.vertexPositions;a.numPoints=Math.floor(a.vertexPositions.length/3);return a}q(c,a);v(c,[{key:"copyToGPU",value:function(a){u(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"copyToGPU",this).call(this,a);this.vertexBuffer=b.a.fromData(a,this.vertexPositions,a.ARRAY_BUFFER,a.STATIC_DRAW)}},
{key:"freeGPUMemory",value:function(a){u(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"freeGPUMemory",this).call(this,a);this.vertexBuffer.dispose()}}]);return c}(n.b),g=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);v(b,[{key:"getChunk",value:function(a){return new l(this,a)}},{key:"vectorGraphicsCoordinatesInVoxels",get:function(){return!0}}]);return b}(n.c)},function(n,f,c){function p(a,c){if("function"!==typeof c&&
null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"OpenConnectomeDataSource",function(){return a});var k=c(106),q=["http://openconnecto.me","http://www.openconnecto.me"],a=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
var a=(b.__proto__||Object.getPrototypeOf(b)).call(this,"NDstore server hosted at openconnecto.me",q,k.a);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);return b}(c(70).SingleServerDataSource)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){return a.getChunkSource(C,{parameters:b})}function b(a,b,c){return a.memoize.getUncounted({type:"precomputed:MultiscaleVolumeChunkSource",
baseUrls:b,path:c},function(){return Object(d.e)(Object(d.c)(b,c+"/info"),"json").then(function(d){return new z(a,b,c,d)})})}function m(b,c){var e=$jscomp.makeIterator(Object(d.d)(c));c=e.next().value;e=e.next().value;return a(b,{baseUrls:c,path:e,lod:0})}function u(a,c){var e=$jscomp.makeIterator(Object(d.d)(c));c=e.next().value;e=e.next().value;return b(a,c,e)}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"getMeshSource",function(){return m});c.d(f,"getVolume",function(){return u});c.d(f,
"MultiscaleVolumeChunkSource",function(){return z});f.getShardedMeshSource=a;f.getShardedVolume=b;c.d(f,"PrecomputedDataSource",function(){return y});n=c(16);f=c(28);var v=c(184),t=c(53),l=c(11),g=c(21),e=c(1),d=c(36),h=c(2),r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),B=function(a){function b(){p(this,
b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(n.f)(g.b,v.c)),C=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(Object(n.f)(t.b,v.a)),D=function A(a){p(this,A);Object(h.u)(a);this.resolution=Object(h.w)(a,"resolution",function(a){return Object(h.c)(e.p.create(),a,h.p)});this.voxelOffset=Object(h.w)(a,"voxel_offset",function(a){return Object(h.d)(e.p.create(),a)});
this.size=Object(h.w)(a,"size",function(a){return Object(h.c)(e.p.create(),a,h.A)});this.chunkSizes=Object(h.w)(a,"chunk_sizes",function(a){return Object(h.a)(a,function(a){return Object(h.c)(e.p.create(),a,h.A)})});if(0===this.chunkSizes.length)throw Error("No chunk sizes specified.");(this.encoding=Object(h.w)(a,"encoding",function(a){return Object(h.n)(a,v.b)}))===v.b.COMPRESSED_SEGMENTATION&&(this.compressedSegmentationBlockSize=Object(h.w)(a,"compressed_segmentation_block_size",function(a){return Object(h.c)(e.p.create(),
a,h.A)}));this.key=Object(h.w)(a,"key",h.B)},z=function(){function b(a,c,d,e){p(this,b);this.chunkManager=a;this.baseUrls=c;this.path=d;Object(h.u)(e);this.dataType=Object(h.w)(e,"data_type",function(a){return Object(h.n)(a,l.a)});this.numChannels=Object(h.w)(e,"num_channels",h.A);this.volumeType=Object(h.w)(e,"type",function(a){return Object(h.n)(a,l.d)});this.mesh=Object(h.w)(e,"mesh",h.z);this.scales=Object(h.w)(e,"scales",function(a){return Object(h.a)(a,function(a){return new D(a)})})}r(b,[{key:"getMeshSource",
value:function(){var b=this.mesh;return void 0===b?null:a(this.chunkManager,{baseUrls:this.baseUrls,path:this.path+"/"+b,lod:0})}},{key:"getSources",value:function(a){var b=this;return this.scales.map(function(c){return l.c.getDefaults({voxelSize:c.resolution,dataType:b.dataType,numChannels:b.numChannels,transform:e.j.fromTranslation(e.j.create(),e.p.multiply(e.p.create(),c.resolution,c.voxelOffset)),upperVoxelBound:c.size,volumeType:b.volumeType,chunkDataSizes:c.chunkSizes,baseVoxelOffset:c.voxelOffset,
compressedSegmentationBlockSize:c.compressedSegmentationBlockSize,volumeSourceOptions:a}).map(function(a){return b.chunkManager.getChunkSource(B,{spec:a,parameters:{baseUrls:b.baseUrls,path:b.path+"/"+c.key,encoding:c.encoding}})})})}}]);return b}(),y=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);r(b,[{key:"getVolume",value:function(a,b){return u(a,b)}},{key:"getMeshSource",value:function(a,b){return m(a,b)}},{key:"description",
get:function(){return"Precomputed file-backed data source"}}]);return b}(f.a)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b,c){return a.rpc.promiseInvoke(m.a,{chunkManager:a.addCounterpartRef(),url:b},c)}function b(b,c){return b.memoize.getUncounted({type:"nifti/getVolume",url:c},function(){return a(b,c,t.e).then(function(a){return new d(b,c,a)})})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"getVolume",function(){return b});c.d(f,
"MultiscaleVolumeChunkSource",function(){return d});c.d(f,"NiftiDataSource",function(){return h});n=c(16);f=c(28);var m=c(186),u=c(11),v=c(21),t=c(27),l=c(1),g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,
arguments))}q(b,a);return b}(Object(n.f)(v.b,m.b)),d=function(){function a(b,c,d){p(this,a);this.chunkManager=b;this.url=c;this.info=d}g(a,[{key:"getSources",value:function(a){var b=this.info;a=u.c.withDefaultCompression({volumeType:b.volumeType,chunkDataSize:b.volumeSize,dataType:b.dataType,voxelSize:b.voxelSize,numChannels:b.numChannels,upperVoxelBound:b.volumeSize,transform:Object(l.o)(l.j.create(),b.qoffset,b.quatern,l.g,b.qfac),volumeSourceOptions:a});return[[this.chunkManager.getChunkSource(e,
{spec:a,parameters:{url:this.url}})]]}},{key:"getMeshSource",value:function(){return null}},{key:"numChannels",get:function(){return this.info.numChannels}},{key:"dataType",get:function(){return this.info.dataType}},{key:"volumeType",get:function(){return this.info.volumeType}}]);return a}(),h=function(a){function c(){p(this,c);return k(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}q(c,a);g(c,[{key:"getVolume",value:function(a,c){return b(a,c)}},{key:"description",get:function(){return"Single NIfTI file"}}]);
return c}(f.a)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){return function(a){function b(a){for(var c=[],d=0;d<arguments.length;++d)c[d-0]=arguments[d];p(this,b);var e;d=k(this,(e=b.__proto__||Object.getPrototypeOf(b)).call.apply(e,[].concat([this],$jscomp.arrayFromIterable(c))));c=c[1];e=d.dataSource=d.registerDisposer(c.dataSource.addRef());d.generation=c.generation;e.registerSource(c.parameters.key,d);return d}q(b,a);C(b,null,[{key:"encodeOptions",
value:function(a){var c=D(b.__proto__||Object.getPrototypeOf(b),"encodeOptions",this).call(this,a);c.dataSource=Object(B.a)(a.dataSource);return c}}]);return b}(a)}function b(a){Object(r.u)(a);return{key:Object(r.w)(a,"key",r.B),offset:Object(r.w)(a,"offset",r.l),sizeInVoxels:Object(r.w)(a,"sizeInVoxels",r.j),voxelSize:Object(r.w)(a,"voxelSize",r.k),chunkDataSize:Object(r.w)(a,"chunkDataSize",function(a){return void 0===a?void 0:Object(r.j)(a)})}}function m(a){Object(r.u)(a);return{dataType:Object(r.w)(a,
"dataType",function(a){return Object(r.n)(a,l.b)}),numComponents:Object(r.w)(a,"numComponents",r.A)}}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"MultiscaleVolumeChunkSource",function(){return E});c.d(f,"PythonSkeletonSource",function(){return A});c.d(f,"PythonDataSource",function(){return G});n=c(16);f=c(28);var u=c(190),v=c(53),t=c(64),l=c(47),g=c(11),e=c(21),d=c(1),h=c(36),r=c(2),B=c(23),C=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;
d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),D=function J(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return J(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},z=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
q(b,a);return b}(a(Object(n.f)(e.b,u.d))),y=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);return b}(a(Object(n.f)(v.b,u.a))),E=function(){function a(c,e,f,h){p(this,a);this.dataSource=c;this.chunkManager=e;this.key=f;this.response=h;Object(r.u)(h);this.dataType=Object(r.w)(h,"dataType",function(a){return Object(r.n)(a,l.b)});this.volumeType=Object(r.w)(h,"volumeType",function(a){return Object(r.n)(a,g.d)});this.numChannels=Object(r.w)(h,
"numChannels",r.A);this.encoding=Object(r.w)(h,"encoding",function(a){return Object(r.n)(a,u.c)});this.generation=Object(r.w)(h,"generation",function(a){return a});var m=Object(r.w)(h,"maxVoxelsPerChunkLog2",function(a){return void 0===a?l.a:Object(r.A)(a)});c=Object(r.w)(h,"threeDimensionalScales",function(a){return void 0===a?void 0:Object(r.a)(a,b)});h=Object(r.w)(h,"twoDimensionalScales",function(a){return void 0===a?void 0:Object(r.a)(a,function(a){return Object(r.c)(Array(3),a,b)})});if(void 0===
h===(void 0===c))throw Error('Exactly one of "threeDimensionalScales" and "twoDimensionalScales" must be specified.');if(void 0!==h){if(0===h.length)throw Error("At least one scale must be specified.");this.scales=h.map(function(a){return a.map(function(a,b){var c=a.voxelSize,d=a.sizeInVoxels;b=void 0===a.chunkDataSize?Object(l.i)({voxelSize:c,upperVoxelBound:d,flatDimension:2-b,maxVoxelsPerChunkLog2:m}):a.chunkDataSize;return{key:a.key,offset:a.offset,sizeInVoxels:d,voxelSize:c,chunkDataSize:b}})});
if(!d.p.equals(this.scales[0][0].voxelSize,this.scales[0][1].voxelSize)||!d.p.equals(this.scales[0][0].voxelSize,this.scales[0][2].voxelSize))throw Error("Lowest scale must have uniform voxel size.");}if(void 0!==c){if(0===c.length)throw Error("At least one scale must be specified.");this.scales=c.map(function(a){var b=a.voxelSize,c=a.sizeInVoxels,d=void 0===a.chunkDataSize?Object(l.h)({voxelSize:b,upperVoxelBound:c,maxVoxelsPerChunkLog2:m}):a.chunkDataSize;return[{key:a.key,offset:a.offset,sizeInVoxels:c,
voxelSize:b,chunkDataSize:d}]})}}C(a,[{key:"getSources",value:function(a){var b=this,c=this.numChannels,e=this.dataType,f=this.volumeType,h=this.encoding,m=this.scales[0][0],l=d.p.multiply(d.p.create(),m.voxelSize,m.sizeInVoxels);return this.scales.map(function(m){return m.map(function(m){var k=g.c.withDefaultCompression({voxelSize:m.voxelSize,dataType:e,volumeType:f,numChannels:c,transform:d.j.fromTranslation(d.j.create(),m.offset),upperVoxelBound:m.sizeInVoxels,upperClipBound:l,chunkDataSize:m.chunkDataSize,
volumeSourceOptions:a});return b.chunkManager.getChunkSource(z,{spec:k,dataSource:b.dataSource,generation:b.generation,parameters:{key:b.key,scaleKey:m.key,encoding:h}})})})}},{key:"getMeshSource",value:function(){return this.chunkManager.getChunkSource(y,{dataSource:this.dataSource,generation:this.generation,parameters:{key:this.key}})}}]);return a}(),A=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);C(b,[{key:"skeletonVertexCoordinatesInVoxels",
get:function(){return!1}},{key:"vertexAttributes",get:function(){return this.parameters.vertexAttributes}}]);return b}(a(Object(n.f)(t.d,u.b))),G=function(a){function b(){p(this,b);var a=k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.sources=new Map;a.sourceGenerations=new Map;return a}q(b,a);C(b,[{key:"registerSource",value:function(a,b){var c=this,d=this.sources.get(a);void 0===d&&(d=new Set,this.sources.set(a,d));var e=this.sourceGenerations.get(a);void 0!==e&&(b.generation=
e);d.add(b);b.registerDisposer(function(){d.delete(b);0===d.size&&c.sources.delete(a)})}},{key:"setSourceGeneration",value:function(a,b){var c=this.sourceGenerations;if(c.get(a)!==b&&(c.set(a,b),a=this.sources.get(a),void 0!==a))for(a=$jscomp.makeIterator(a),c=a.next();!c.done;c=a.next())c=c.value,c.generation!==b&&(c.generation=b,c.invalidateCache())}},{key:"deleteSourceGeneration",value:function(a){this.sourceGenerations.delete(a)}},{key:"getVolume",value:function(a,b){var c=this;return a.memoize.getUncounted({type:"python:MultiscaleVolumeChunkSource",
key:b},function(){return Object(h.e)(Object(h.b)("/neuroglancer/info/"+b),"json").then(function(d){return new E(c,a,b,d)})})}},{key:"getSkeletonSource",value:function(a,b){var c=b.match(/^([^\/?]+)\?(.*)$/);if(null===c)throw Error("Invalid python volume path: "+JSON.stringify(b));return a.getChunkSource(A,{dataSource:this,generation:-1,parameters:{key:c[1],vertexAttributes:Object(r.v)(JSON.parse(c[2]),m)}})}},{key:"description",get:function(){return"Python-served volume"}}]);return b}(f.a)},function(n,
f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){for(var b=0,c=0;3>c;++c)0>a[c]&&(b+=1<<c);return b}c.d(f,"a",function(){return D});var b=c(34);n=c(66);var m=c(11);f=c(0);var u=c(1),v=c(24),t=c(38),l=c(14),g=c(13),e=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),d=u.p.create(),
h=u.p.create(),r=u.j.create(),B=function(a){function b(a){p(this,b);var c=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.outputVertexIndices=c.registerDisposer(v.a.fromData(a,new Float32Array([0,1,2,3,4,5]),a.ARRAY_BUFFER,a.STATIC_DRAW));c.vertexBasePositions=[0,0,0,1,0,0,0,1,0,1,1,0,0,0,1,1,0,1,0,1,1,1,1,1];a=[0,1,2,4,5,3,6,7];for(var d=[0,1,2,5,3,4,6,7],e=[0,1,1,4,4,7,4,7,1,5,0,1,1,4,4,7,0,2,2,5,5,7,5,7,2,6,0,2,2,5,5,7,0,3,3,6,6,7,6,7,3,4,0,3,3,6,6,7],f=[0,1,2,3,4,5,6,7,1,4,5,0,3,
7,2,6,2,6,0,5,7,3,1,4,3,0,6,4,1,2,7,5,4,3,7,1,0,6,5,2,5,2,1,7,6,0,4,3,6,7,3,2,5,4,0,1,7,5,4,6,2,1,3,0],g=[],h=0;8>h;++h)for(var m=0;m<e.length;++m)g.push(a[f[8*d[h]+e[m]]]);c.vertexIndices=new Int32Array(g);return c}q(b,a);e(b,null,[{key:"get",value:function(a){return a.memoize.get("SliceViewShaderBuffers",function(){return new b(a)})}}]);return b}(f.a),C=function(b){function c(a){p(this,c);var b=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.data=b.registerDisposer(B.get(a));return b}
q(c,b);e(c,null,[{key:"get",value:function(a){return a.memoize.get("volume.VolumeSliceVertexComputationManager",function(){return new c(a)})}}]);e(c,[{key:"defineShader",value:function(a){var b=this.data;a.addAttribute("highp float","aVertexIndexFloat");a.addUniform("highp vec3","uTranslation");a.addUniform("highp mat4","uProjectionMatrix");a.addUniform("highp vec3","uPlaneNormal");a.addUniform("highp float","uPlaneDistance");a.addUniform("highp ivec2","uVertexIndex",24);a.addUniform("highp vec3",
"uVertexBasePosition",8);a.addInitializer(function(a){a.gl.uniform3fv(a.uniform("uVertexBasePosition"),new Float32Array(b.vertexBasePositions))});a.addUniform("highp vec3","uChunkDataSize");a.addUniform("highp vec3","uVoxelSize");a.addUniform("highp vec3","uLowerClipBound");a.addUniform("highp vec3","uUpperClipBound");a.addVarying("highp vec3","vChunkPosition");a.setVertexMain("\nvec3 chunkSize = uChunkDataSize * uVoxelSize;\nint vertexIndex = int(aVertexIndexFloat);\nfor (int e = 0; e < 4; ++e) {\n  highp ivec2 vidx = uVertexIndex[vertexIndex*4 + e];\n  highp vec3 v1 = max(uLowerClipBound, min(uUpperClipBound, chunkSize * uVertexBasePosition[vidx.x] + uTranslation));\n  highp vec3 v2 = max(uLowerClipBound, min(uUpperClipBound, chunkSize * uVertexBasePosition[vidx.y] + uTranslation));\n  highp vec3 vDir = v2 - v1;\n  highp float denom = dot(vDir, uPlaneNormal);\n  if (abs(denom) > 0.001) {\n    highp float lambda = (uPlaneDistance - dot(v1, uPlaneNormal)) / denom;\n    if ((lambda >= -0.001) && (lambda <= (1.0 + 0.001))) {\n      lambda = clamp(lambda, 0.0, 1.0);\n      highp vec3 position = v1 + lambda * vDir;\n      gl_Position = uProjectionMatrix * vec4(position, 1.0);\n      vChunkPosition = (position - uTranslation) / uVoxelSize + 0.001 * abs(uPlaneNormal);\n      break;\n    }\n  }\n}\n");
a.addFragmentCode("\nvec3 getPositionWithinChunk () {\n  return floor(min(vChunkPosition, uChunkDataSize - 1.0));\n}\n")}},{key:"computeVerticesDebug",value:function(b,c,d,e,f,g,h,m){b=u.p.multiply(u.p.create(),b,c);var l=a(g);l=this.data.vertexIndices.subarray(48*l,48*(l+1));for(var k=[0,0],r=[u.p.create(),u.p.create()],t=u.p.create(),q=u.p.create(),p=u.p.create(),v=u.p.create(),n=u.p.fromValues(Math.abs(g[0]),Math.abs(g[1]),Math.abs(g[2])),A=new Float32Array(this.data.vertexBasePositions),B=function(a){return A.subarray(3*
a,3*a+3)},G=0;6>G;++G)for(var E=0;4>E;++E){for(var y=0;2>y;++y)k[y]=l[2*(4*G+E)+y],u.p.multiply(r[y],b,B(k[y])),u.p.add(r[y],r[y],h),u.p.min(r[y],r[y],e),u.p.max(r[y],r[y],d);u.p.subtract(t,r[1],r[0]);y=u.p.dot(t,g);if(.001<Math.abs(y)){var C=(f-u.p.dot(r[0],g))/y;if(-.001<=C&&1.001>=C){C=Math.max(0,Math.min(1,C));u.p.scaleAndAdd(q,r[0],t,C);u.p.transformMat4(p,q,m);u.p.sub(v,q,h);u.p.divide(v,v,c);u.p.scaleAndAdd(v,v,n,.001);console.log("vertex "+G+", e = "+E+", at "+p+", "+("vChunkPosition = "+
v+", edge dir = "+t+", denom = "+y));break}else console.log("vertex "+G+", e = "+E+", skipped, deom = "+y+", "+("vDir = "+Object(u.q)(t)+", ")+("uPlaneNormal = "+Object(u.q)(g)+", ")+("lambda="+C))}else console.log("vertex "+G+", e = "+E+", skipped, deom = "+y+", "+("vDir = "+Object(u.q)(t)+", uPlaneNormal = "+Object(u.q)(g)))}}},{key:"beginSlice",value:function(a,b){a=b.attribute("aVertexIndexFloat");this.data.outputVertexIndices.bindToVertexAttrib(a,1)}},{key:"endSlice",value:function(a,b){b=b.attribute("aVertexIndexFloat");
a.disableVertexAttribArray(b)}},{key:"beginSource",value:function(b,c,e,f,g){var m=g.chunkLayout,l=m.globalToLocalSpatialVector(d,e.viewportAxes[2]);e=u.p.dot(m.globalToLocalSpatial(h,e.centerDataPosition),l);b.uniform3fv(c.uniform("uPlaneNormal"),l);b.uniform1f(c.uniform("uPlaneDistance"),e);l=a(l);b.uniform2iv(c.uniform("uVertexIndex"),this.data.vertexIndices.subarray(48*l,48*(l+1)));b.uniformMatrix4fv(c.uniform("uProjectionMatrix"),!1,u.j.multiply(r,f,m.transform));b.uniform3fv(c.uniform("uVoxelSize"),
g.voxelSize);b.uniform3fv(c.uniform("uLowerClipBound"),g.lowerClipBound);b.uniform3fv(c.uniform("uUpperClipBound"),g.upperClipBound)}},{key:"setupChunkDataSize",value:function(a,b,c){a.uniform3fv(b.uniform("uChunkDataSize"),c)}},{key:"drawChunk",value:function(a,b,c){a.uniform3fv(b.uniform("uTranslation"),c);a.drawArrays(a.TRIANGLE_FAN,0,6)}}]);return c}(f.a),D=function(a){function c(a,b){var d=void 0===b?{}:b;b=void 0===d.shaderError?Object(t.b)():d.shaderError;d=void 0===d.sourceOptions?{}:d.sourceOptions;
p(this,c);a=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a.chunkManager,a.getSources(d),{shaderError:b}));a.vertexComputationManager=C.get(a.gl);b=a.registerDisposer(new g.b);b.RPC_TYPE_ID=m.b;b.initializeCounterpart(a.chunkManager.rpc,{sources:a.sourceIds});a.rpcId=b.rpcId;return a}q(c,a);e(c,[{key:"getValueAt",value:function(a){for(var b=$jscomp.makeIterator(this.sources),c=b.next();!c.done;c=b.next()){c=$jscomp.makeIterator(c.value);for(var d=c.next();!d.done;d=c.next())if(d=d.value.getValueAt(a),
null!=d)return d}return null}},{key:"getShader",value:function(){var a=this,b=this.getShaderKey()+"/"+this.chunkFormat.shaderKey;return this.gl.memoize.get(b,function(){return a.buildShader()})}},{key:"defineShader",value:function(a){this.vertexComputationManager.defineShader(a);a.addFragmentCode("\nvoid emit(vec4 color) {\n  gl_FragData[0] = color;\n}\n");this.chunkFormat.defineShader(a);a.addFragmentCode("\n"+Object(l.a)(this.dataType)+" getDataValue() { return getDataValue(0); }\n")}},{key:"beginSlice",
value:function(a){a=this.gl;var b=this.shader;b.bind();this.vertexComputationManager.beginSlice(a,b);return b}},{key:"endSlice",value:function(a){this.vertexComputationManager.endSlice(this.gl,a)}},{key:"draw",value:function(a){var c=a.visibleLayers.get(this);if(0!==c.length&&(this.initializeShader(),void 0!==this.shader)){var d=this.gl,e=u.p.create(),f=this.beginSlice(a),g=this.vertexComputationManager,h=this.chunkFormat;h.beginDrawing(d,f);var m={};c=$jscomp.makeIterator(c);for(var l=c.next();!l.done;m=
{chunkDataSize:m.chunkDataSize},l=c.next()){var k=l.value,r=k.spec.chunkLayout;l=k.chunks;var t=r.size;m.chunkDataSize=void 0;var q=a.visibleChunks.get(r);if(q){g.beginSource(d,f,a,a.dataToDevice,k.spec);k=k.chunkFormat;k.beginSource(d,f);r=function(a){return function(b){a.chunkDataSize=b;g.setupChunkDataSize(d,f,a.chunkDataSize)}}(m);q=$jscomp.makeIterator(q);for(var p=q.next();!p.done;p=q.next())if((p=l.get(p.value))&&p.state===b.d.GPU_MEMORY){var v=p.chunkDataSize;v!==m.chunkDataSize&&r(v);u.p.multiply(e,
t,p.chunkGridPosition);k.bindChunk(d,f,p);g.drawChunk(d,f,e)}}}h.endDrawing(d,f);this.endSlice(f)}}},{key:"dataType",get:function(){return this.sources[0][0].spec.dataType}},{key:"chunkFormat",get:function(){return this.sources[0][0].chunkFormat}}]);return c}(n.a)},function(n,f,c){(function(c,f){n.exports=f()})(this,function(){function c(a){return new RegExp("(^|\\s)"+a+"(?:$|\\s)\\s*")}function f(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild);return a}function q(a,b){return f(a).appendChild(b)}
function a(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function b(b,c,d,e){b=a(b,c,d,e);b.setAttribute("role","presentation");return b}function m(a,b){3==b.nodeType&&(b=b.parentNode);if(a.contains)return a.contains(b);do if(11==b.nodeType&&(b=b.host),b==a)return!0;while(b=b.parentNode)}function u(){try{var a=document.activeElement}catch(x){a=
document.body||null}for(;a&&a.shadowRoot&&a.shadowRoot.activeElement;)a=a.shadowRoot.activeElement;return a}function v(a,b){var d=a.className;c(b).test(d)||(a.className+=(d?" ":"")+b)}function t(a,b){a=a.split(" ");for(var d=0;d<a.length;d++)a[d]&&!c(a[d]).test(b)&&(b+=" "+a[d]);return b}function l(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function g(a,b,c){b||(b={});for(var d in a)!a.hasOwnProperty(d)||!1===c&&b.hasOwnProperty(d)||(b[d]=a[d]);return b}
function e(a,b,c,d,e){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));d=d||0;for(e=e||0;;){var w=a.indexOf("\t",d);if(0>w||w>=b)return e+(b-d);e+=w-d;e+=c-e%c;d=w+1}}function d(a,b){for(var c=0;c<a.length;++c)if(a[c]==b)return c;return-1}function h(a,b,c){for(var d=0,e=0;;){var w=a.indexOf("\t",d);-1==w&&(w=a.length);var f=w-d;if(w==a.length||e+f>=b)return d+Math.min(f,b-e);e+=w-d;e+=c-e%c;d=w+1;if(e>=b)return d}}function r(a){for(;xc.length<=a;)xc.push(n(xc)+" ");return xc[a]}function n(a){return a[a.length-
1]}function C(a,b){for(var c=[],d=0;d<a.length;d++)c[d]=b(a[d],d);return c}function D(a,b,c){for(var d=0,e=c(b);d<a.length&&c(a[d])<=e;)d++;a.splice(d,0,b)}function z(){}function y(a,b){Object.create?a=Object.create(a):(z.prototype=a,a=new z);b&&g(b,a);return a}function E(a){return/\w/.test(a)||"\u0080"<a&&(a.toUpperCase()!=a.toLowerCase()||bg.test(a))}function A(a,b){return b?-1<b.source.indexOf("\\w")&&E(a)?!0:b.test(a):E(a)}function G(a){for(var b in a)if(a.hasOwnProperty(b)&&a[b])return!1;return!0}
function H(a){return 768<=a.charCodeAt(0)&&cg.test(a)}function J(a,b,c){for(;(0>c?0<b:b<a.length)&&H(a.charAt(b));)b+=c;return b}function F(a,b,c){for(var d=b>c?-1:1;;){if(b==c)return b;var e=(b+c)/2;e=0>d?Math.ceil(e):Math.floor(e);if(e==b)return a(e)?b:c;a(e)?c=e:b=e+d}}function R(c,d,e){this.input=e;this.scrollbarFiller=a("div",null,"CodeMirror-scrollbar-filler");this.scrollbarFiller.setAttribute("cm-not-content","true");this.gutterFiller=a("div",null,"CodeMirror-gutter-filler");this.gutterFiller.setAttribute("cm-not-content",
"true");this.lineDiv=b("div",null,"CodeMirror-code");this.selectionDiv=a("div",null,null,"position: relative; z-index: 1");this.cursorDiv=a("div",null,"CodeMirror-cursors");this.measure=a("div",null,"CodeMirror-measure");this.lineMeasure=a("div",null,"CodeMirror-measure");this.lineSpace=b("div",[this.measure,this.lineMeasure,this.selectionDiv,this.cursorDiv,this.lineDiv],null,"position: relative; outline: none");var w=b("div",[this.lineSpace],"CodeMirror-lines");this.mover=a("div",[w],null,"position: relative");
this.sizer=a("div",[this.mover],"CodeMirror-sizer");this.sizerWidth=null;this.heightForcer=a("div",null,null,"position: absolute; height: 30px; width: 1px;");this.gutters=a("div",null,"CodeMirror-gutters");this.lineGutter=null;this.scroller=a("div",[this.sizer,this.heightForcer,this.gutters],"CodeMirror-scroll");this.scroller.setAttribute("tabIndex","-1");this.wrapper=a("div",[this.scrollbarFiller,this.gutterFiller,this.scroller],"CodeMirror");X&&8>ba&&(this.gutters.style.zIndex=-1,this.scroller.style.paddingRight=
0);oa||Ua&&Kb||(this.scroller.draggable=!0);c&&(c.appendChild?c.appendChild(this.wrapper):c(this.wrapper));this.reportedViewFrom=this.reportedViewTo=this.viewFrom=this.viewTo=d.first;this.view=[];this.externalMeasured=this.renderedView=null;this.lastWrapHeight=this.lastWrapWidth=this.viewOffset=0;this.updateLineNumbers=null;this.nativeBarWidth=this.barHeight=this.barWidth=0;this.scrollbarsClipped=!1;this.lineNumWidth=this.lineNumInnerWidth=this.lineNumChars=null;this.alignWidgets=!1;this.maxLine=
this.cachedCharWidth=this.cachedTextHeight=this.cachedPaddingH=null;this.maxLineLength=0;this.maxLineChanged=!1;this.wheelDX=this.wheelDY=this.wheelStartX=this.wheelStartY=null;this.shift=!1;this.activeTouch=this.selForContextMenu=null;e.init(this)}function K(a,b){b-=a.first;if(0>b||b>=a.size)throw Error("There is no line "+(b+a.first)+" in the document.");for(;!a.lines;)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function N(a,b,c){var d=[],e=b.line;
a.iter(b.line,c.line+1,function(a){a=a.text;e==c.line&&(a=a.slice(0,c.ch));e==b.line&&(a=a.slice(b.ch));d.push(a);++e});return d}function V(a,b,c){var d=[];a.iter(b,c,function(a){d.push(a.text)});return d}function T(a,b){if(b-=a.height)for(;a;a=a.parent)a.height+=b}function L(a){if(null==a.parent)return null;var b=a.parent;a=d(b.lines,a);for(var c=b.parent;c;b=c,c=c.parent)for(var e=0;c.children[e]!=b;++e)a+=c.children[e].chunkSize();return a+b.first}function S(a,b){var c=a.first;a:do{for(var d=0;d<
a.children.length;++d){var e=a.children[d],w=e.height;if(b<w){a=e;continue a}b-=w;c+=e.chunkSize()}return c}while(!a.lines);for(d=0;d<a.lines.length;++d){e=a.lines[d].height;if(b<e)break;b-=e}return c+d}function Y(a,b){return b>=a.first&&b<a.first+a.size}function ha(a,b){return String(a.lineNumberFormatter(b+a.firstLineNumber))}function I(a,b,c){void 0===c&&(c=null);if(!(this instanceof I))return new I(a,b,c);this.line=a;this.ch=b;this.sticky=c}function P(a,b){return a.line-b.line||a.ch-b.ch}function Na(a,
b){return a.sticky==b.sticky&&0==P(a,b)}function M(a){return I(a.line,a.ch)}function Oa(a,b){return 0>P(a,b)?b:a}function da(a,b){return 0>P(a,b)?a:b}function O(a,b){if(b.line<a.first)return I(a.first,0);var c=a.first+a.size-1;if(b.line>c)return I(c,K(a,c).text.length);a=K(a,b.line).text.length;c=b.ch;b=null==c||c>a?I(b.line,a):0>c?I(b.line,0):b;return b}function Sa(a,b){for(var c=[],d=0;d<b.length;d++)c[d]=O(a,b[d]);return c}function Ta(a,b,c){this.marker=a;this.from=b;this.to=c}function za(a,b){if(a)for(var c=
0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function Ib(a,b){if(b.full)return null;var c=Y(a,b.from.line)&&K(a,b.from.line).markedSpans,d=Y(a,b.to.line)&&K(a,b.to.line).markedSpans;if(!c&&!d)return null;a=b.from.ch;var e=b.to.ch,w=0==P(b.from,b.to),f;if(c)for(var x=0;x<c.length;++x){var g=c[x],h=g.marker;if(null==g.from||(h.inclusiveLeft?g.from<=a:g.from<a)||!(g.from!=a||"bookmark"!=h.type||w&&g.marker.insertLeft)){var m=null==g.to||(h.inclusiveRight?g.to>=a:g.to>a);(f||(f=[])).push(new Ta(h,
g.from,m?null:g.to))}}c=f;var l;if(d)for(f=0;f<d.length;++f)if(x=d[f],g=x.marker,null==x.to||(g.inclusiveRight?x.to>=e:x.to>e)||x.from==e&&"bookmark"==g.type&&(!w||x.marker.insertLeft))h=null==x.from||(g.inclusiveLeft?x.from<=e:x.from<e),(l||(l=[])).push(new Ta(g,h?null:x.from-e,null==x.to?null:x.to-e));d=1==b.text.length;e=n(b.text).length+(d?a:0);if(c)for(w=0;w<c.length;++w)if(f=c[w],null==f.to)(x=za(l,f.marker),x)?d&&(f.to=null==x.to?null:x.to+e):f.to=a;if(l)for(a=0;a<l.length;++a)w=l[a],null!=
w.to&&(w.to+=e),null==w.from?za(c,w.marker)||(w.from=e,d&&(c||(c=[])).push(w)):(w.from+=e,d&&(c||(c=[])).push(w));c&&(c=Wd(c));l&&l!=c&&(l=Wd(l));a=[c];if(!d){b=b.text.length-2;var k;if(0<b&&c)for(d=0;d<c.length;++d)null==c[d].to&&(k||(k=[])).push(new Ta(c[d].marker,null,null));for(c=0;c<b;++c)a.push(k);a.push(l)}return a}function Wd(a){for(var b=0;b<a.length;++b){var c=a[b];null!=c.from&&c.from==c.to&&!1!==c.marker.clearWhenEmpty&&a.splice(b--,1)}return a.length?a:null}function ag(a,b,c){var e=null;
a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;!c.readOnly||e&&-1!=d(e,c)||(e||(e=[])).push(c)}});if(!e)return null;a=[{from:b,to:c}];for(b=0;b<e.length;++b){c=e[b];for(var w=c.find(0),f=0;f<a.length;++f){var x=a[f];if(!(0>P(x.to,w.from)||0<P(x.from,w.to))){var g=[f,1],h=P(x.from,w.from),l=P(x.to,w.to);(0>h||!c.inclusiveLeft&&!h)&&g.push({from:x.from,to:w.from});(0<l||!c.inclusiveRight&&!l)&&g.push({from:w.to,to:x.to});a.splice.apply(a,
g);f+=g.length-3}}}return a}function rb(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c)b[c].marker.detachLine(a);a.markedSpans=null}}function Xd(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.attachLine(a);a.markedSpans=b}}function ab(a,b){var c=a.lines.length-b.lines.length;if(0!=c)return c;c=a.find();var d=b.find(),e=P(c.from,d.from)||(a.inclusiveLeft?-1:0)-(b.inclusiveLeft?-1:0);return e?-e:(c=P(c.to,d.to)||(a.inclusiveRight?1:0)-(b.inclusiveRight?1:0))?c:b.id-a.id}function Ma(a,b){a=
Va&&a.markedSpans;if(a)for(var c,d=0;d<a.length;++d)if(c=a[d],c.marker.collapsed&&null==(b?c.from:c.to)&&(!e||0>ab(e,c.marker)))var e=c.marker;return e}function vc(a,b,c,d,e){a=K(a,b);if(a=Va&&a.markedSpans)for(b=0;b<a.length;++b){var w=a[b];if(w.marker.collapsed){var f=w.marker.find(0),x=P(f.from,c)||(w.marker.inclusiveLeft?-1:0)-(e.inclusiveLeft?-1:0),g=P(f.to,d)||(w.marker.inclusiveRight?1:0)-(e.inclusiveRight?1:0);if(!(0<=x&&0>=g||0>=x&&0<=g)&&(0>=x&&(w.marker.inclusiveRight&&e.inclusiveLeft?
0<=P(f.to,c):0<P(f.to,c))||0<=x&&(w.marker.inclusiveRight&&e.inclusiveLeft?0>=P(f.from,d):0>P(f.from,d))))return!0}}}function Ha(a){for(var b;b=Ma(a,!0);)a=b.find(-1,!0).line;return a}function Yc(a,b){a=K(a,b);var c=Ha(a);return a==c?b:L(c)}function Yd(a,b){if(b>a.lastLine())return b;var c=K(a,b);if(!bb(a,c))return b;for(;a=Ma(c,!1);)c=a.find(1,!0).line;return L(c)+1}function bb(a,b){var c=Va&&b.markedSpans;if(c)for(var d,e=0;e<c.length;++e)if(d=c[e],d.marker.collapsed&&(null==d.from||!d.marker.widgetNode&&
0==d.from&&d.marker.inclusiveLeft&&Zc(a,b,d)))return!0}function Zc(a,b,c){if(null==c.to)return b=c.marker.find(1,!0),Zc(a,b.line,za(b.line.markedSpans,c.marker));if(c.marker.inclusiveRight&&c.to==b.text.length)return!0;for(var d,e=0;e<b.markedSpans.length;++e)if(d=b.markedSpans[e],d.marker.collapsed&&!d.marker.widgetNode&&d.from==c.to&&(null==d.to||d.to!=c.from)&&(d.marker.inclusiveLeft||c.marker.inclusiveRight)&&Zc(a,b,d))return!0}function Ia(a){a=Ha(a);for(var b=0,c=a.parent,d=0;d<c.lines.length;++d){var e=
c.lines[d];if(e==a)break;else b+=e.height}for(a=c.parent;a;c=a,a=c.parent)for(d=0;d<a.children.length&&(e=a.children[d],e!=c);++d)b+=e.height;return b}function wc(a){if(0==a.height)return 0;for(var b=a.text.length,c,d=a;c=Ma(d,!0);)c=c.find(0,!0),d=c.from.line,b+=c.from.ch-c.to.ch;for(d=a;c=Ma(d,!1);)a=c.find(0,!0),b-=d.text.length-a.from.ch,d=a.to.line,b+=d.text.length-a.to.ch;return b}function $c(a){var b=a.display;a=a.doc;b.maxLine=K(a,a.first);b.maxLineLength=wc(b.maxLine);b.maxLineChanged=!0;
a.iter(function(a){var c=wc(a);c>b.maxLineLength&&(b.maxLineLength=c,b.maxLine=a)})}function Zd(a,b,c,d){if(!a)return d(b,c,"ltr",0);for(var e=!1,w=0;w<a.length;++w){var f=a[w];if(f.from<c&&f.to>b||b==c&&f.to==b)d(Math.max(f.from,b),Math.min(f.to,c),1==f.level?"rtl":"ltr",w),e=!0}e||d(b,c,"ltr")}function Jb(a,b,c){var d;Lb=null;for(var e=0;e<a.length;++e){var w=a[e];if(w.from<b&&w.to>b)return e;w.to==b&&(w.from!=w.to&&"before"==c?d=e:Lb=e);w.from==b&&(w.from!=w.to&&"before"!=c?d=e:Lb=e)}return null!=
d?d:Lb}function Pa(a,b){var c=a.order;null==c&&(c=a.order=dg(a.text,b));return c}function wa(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else{var e=(a=a._handlers)&&a[b];e&&(c=d(e,c),-1<c&&(a[b]=e.slice(0,c).concat(e.slice(c+1))))}}function ea(a,b){var c=a._handlers&&a._handlers[b]||yc;if(c.length)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function ja(a,b,c){"string"==typeof b&&(b={type:b,
preventDefault:function(){this.defaultPrevented=!0}});ea(a,c||b.type,a,b);return ad(b)||b.codemirrorIgnore}function ae(a){var b=a._handlers&&a._handlers.cursorActivity;if(b){a=a.curOp.cursorActivityHandlers||(a.curOp.cursorActivityHandlers=[]);for(var c=0;c<b.length;++c)-1==d(a,b[c])&&a.push(b[c])}}function Ba(a,b){return 0<(a._handlers&&a._handlers[b]||yc).length}function sb(a){a.prototype.on=function(a,b){Q(this,a,b)};a.prototype.off=function(a,b){wa(this,a,b)}}function pa(a){a.preventDefault?a.preventDefault():
a.returnValue=!1}function be(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function ad(a){return null!=a.defaultPrevented?a.defaultPrevented:0==a.returnValue}function Mb(a){pa(a);be(a)}function ce(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));Ca&&a.ctrlKey&&1==b&&(b=3);return b}function eg(b){if(null==bd){var c=a("span","\u200b");q(b,a("span",[c,document.createTextNode("x")]));0!=b.firstChild.offsetHeight&&(bd=1>=c.offsetWidth&&2<c.offsetHeight&&!(X&&8>ba))}b=
bd?a("span","\u200b"):a("span","\u00a0",null,"display: inline-block; width: 1px; margin-right: -1px");b.setAttribute("cm-text","");return b}function fg(a,b){2<arguments.length&&(b.dependencies=Array.prototype.slice.call(arguments,2));cd[a]=b}function zc(a){if("string"==typeof a&&tb.hasOwnProperty(a))a=tb[a];else if(a&&"string"==typeof a.name&&tb.hasOwnProperty(a.name)){var b=tb[a.name];"string"==typeof b&&(b={name:b});a=y(b,a);a.name=b.name}else{if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return zc("application/xml");
if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+json$/.test(a))return zc("application/json")}return"string"==typeof a?{name:a}:a||{name:"null"}}function dd(a,b){b=zc(b);var c=cd[b.name];if(!c)return dd(a,"text/plain");a=c(a,b);if(ub.hasOwnProperty(b.name)){c=ub[b.name];for(var d in c)c.hasOwnProperty(d)&&(a.hasOwnProperty(d)&&(a["_"+d]=a[d]),a[d]=c[d])}a.name=b.name;b.helperType&&(a.helperType=b.helperType);if(b.modeProps)for(var e in b.modeProps)a[e]=b.modeProps[e];return a}function gg(a,b){a=ub.hasOwnProperty(a)?
ub[a]:ub[a]={};g(b,a)}function cb(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);a={};for(var c in b){var d=b[c];d instanceof Array&&(d=d.concat([]));a[c]=d}return a}function ed(a,b){for(var c;a.innerMode;){c=a.innerMode(b);if(!c||c.mode==a)break;b=c.state;a=c.mode}return c||{mode:a,state:b}}function de(a,b,c){return a.startState?a.startState(b,c):!0}function ee(a,b,c,d){var e=[a.state.modeGen],w={};fe(a,b.text,a.doc.mode,c,function(a,b){return e.push(a,b)},w,d);var f=c.state;d=function(d){c.baseTokens=
e;var g=a.state.overlays[d],x=1,h=0;c.state=!0;fe(a,b.text,g.mode,c,function(a,b){for(var c=x;h<a;){var d=e[x];d>a&&e.splice(x,1,a,e[x+1],d);x+=2;h=Math.min(a,d)}if(b)if(g.opaque)e.splice(c,x-c,a,"overlay "+b),x=c+2;else for(;c<x;c+=2)a=e[c+1],e[c+1]=(a?a+" ":"")+"overlay "+b},w);c.state=f;c.baseTokens=null;c.baseTokenPos=1};for(var g=0;g<a.state.overlays.length;++g)d(g);return{styles:e,classes:w.bgClass||w.textClass?w:null}}function ge(a,b,c){if(!b.styles||b.styles[0]!=a.state.modeGen){var d=Nb(a,
L(b)),e=b.text.length>a.options.maxHighlightLength&&cb(a.doc.mode,d.state),w=ee(a,b,d);e&&(d.state=e);b.stateAfter=d.save(!e);b.styles=w.styles;w.classes?b.styleClasses=w.classes:b.styleClasses&&(b.styleClasses=null);c===a.doc.highlightFrontier&&(a.doc.modeFrontier=Math.max(a.doc.modeFrontier,++a.doc.highlightFrontier))}return b.styles}function Nb(a,b,c){var d=a.doc,e=a.display;if(!d.mode.startState)return new Ja(d,!0,b);var w=hg(a,b,c),f=w>d.first&&K(d,w-1).stateAfter,g=f?Ja.fromSaved(d,f,w):new Ja(d,
de(d.mode),w);d.iter(w,b,function(c){fd(a,c.text,g);var d=g.line;c.stateAfter=d==b-1||0==d%5||d>=e.viewFrom&&d<e.viewTo?g.save():null;g.nextLine()});c&&(d.modeFrontier=g.line);return g}function fd(a,b,c,d){var e=a.doc.mode;a=new fa(b,a.options.tabSize,c);a.start=a.pos=d||0;for(""==b&&he(e,c.state);!a.eol();)gd(e,a,c.state),a.start=a.pos}function he(a,b){if(a.blankLine)return a.blankLine(b);if(a.innerMode&&(a=ed(a,b),a.mode.blankLine))return a.mode.blankLine(a.state)}function gd(a,b,c,d){for(var e=
0;10>e;e++){d&&(d[0]=ed(a,c).mode);var w=a.token(b,c);if(b.pos>b.start)return w}throw Error("Mode "+a.name+" failed to advance stream.");}function ie(a,b,c,d){var e=a.doc,w=e.mode;b=O(e,b);var f=K(e,b.line);c=Nb(a,b.line,c);a=new fa(f.text,a.options.tabSize,c);var g;for(d&&(g=[]);(d||a.pos<b.ch)&&!a.eol();){a.start=a.pos;var x=gd(w,a,c.state);d&&g.push(new je(a,x,cb(e.mode,c.state)))}return d?g:new je(a,x,c.state)}function ke(a,b){if(a)for(;;){var c=a.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!c)break;
a=a.slice(0,c.index)+a.slice(c.index+c[0].length);var d=c[1]?"bgClass":"textClass";null==b[d]?b[d]=c[2]:(new RegExp("(?:^|s)"+c[2]+"(?:$|s)")).test(b[d])||(b[d]+=" "+c[2])}return a}function fe(a,b,c,d,e,f,g){var w=c.flattenSpans;null==w&&(w=a.options.flattenSpans);var x=0,h=null,l=new fa(b,a.options.tabSize,d),m=a.options.addModeClass&&[null];for(""==b&&ke(he(c,d.state),f);!l.eol();){if(l.pos>a.options.maxHighlightLength){w=!1;g&&fd(a,b,d,l.pos);l.pos=b.length;var U=null}else U=ke(gd(c,l,d.state,
m),f);if(m){var W=m[0].name;W&&(U="m-"+(U?W+" "+U:W))}if(!w||h!=U){for(;x<l.start;)x=Math.min(l.start,x+5E3),e(x,h);h=U}l.start=l.pos}for(;x<l.pos;)a=Math.min(l.pos,x+5E3),e(a,h),x=a}function hg(a,b,c){for(var d,w,f=a.doc,g=c?-1:b-(a.doc.mode.innerMode?1E3:100);b>g;--b){if(b<=f.first)return f.first;var x=K(f,b-1),h=x.stateAfter;if(h&&(!c||b+(h instanceof Ac?h.lookAhead:0)<=f.modeFrontier))return b;x=e(x.text,null,a.options.tabSize);if(null==w||d>x)w=b-1,d=x}return w}function ig(a,b){a.modeFrontier=
Math.min(a.modeFrontier,b);if(!(a.highlightFrontier<b-10)){for(var c=a.first,d=b-1;d>c;d--){var e=K(a,d).stateAfter;if(e&&(!(e instanceof Ac)||d+e.lookAhead<b)){c=d+1;break}}a.highlightFrontier=Math.min(a.highlightFrontier,c)}}function le(a,b){if(!a||/^\s*$/.test(a))return null;b=b.addModeClass?jg:kg;return b[a]||(b[a]=a.replace(/\S+/g,"cm-$&"))}function me(a,c){var d=b("span",null,null,oa?"padding-right: .1px":null);d={pre:b("pre",[d],"CodeMirror-line"),content:d,col:0,pos:0,cm:a,trailingSpace:!1,
splitSpaces:(X||oa)&&a.getOption("lineWrapping")};c.measure={};for(var e=0;e<=(c.rest?c.rest.length:0);e++){var w=e?c.rest[e-1]:c.line,g=void 0;d.pos=0;d.addToken=lg;var x=a.display.measure;if(null!=hd)x=hd;else{var h=q(x,document.createTextNode("A\u062eA")),l=Ob(h,0,1).getBoundingClientRect();h=Ob(h,1,2).getBoundingClientRect();f(x);x=l&&l.left!=l.right?hd=3>h.right-l.right:!1}x&&(g=Pa(w,a.doc.direction))&&(d.addToken=mg(d.addToken,g));d.map=[];var m=c!=a.display.externalMeasured&&L(w);a:{var k=
h=l=x=void 0,r=void 0,u=void 0,p=void 0;g=d;m=ge(a,w,m);var v=w.markedSpans,n=w.text,A=0;if(v)for(var y=n.length,B=0,G=1,C="",E=0;;){if(E==B){r=k=h=l=u="";x=null;E=Infinity;for(var D=[],z=void 0,H=0;H<v.length;++H){var J=v[H],F=J.marker;"bookmark"==F.type&&J.from==B&&F.widgetNode?D.push(F):J.from<=B&&(null==J.to||J.to>B||F.collapsed&&J.to==B&&J.from==B)?(null!=J.to&&J.to!=B&&E>J.to&&(E=J.to,k=""),F.className&&(r+=" "+F.className),F.css&&(u=(u?u+";":"")+F.css),F.startStyle&&J.from==B&&(h+=" "+F.startStyle),
F.endStyle&&J.to==E&&(z||(z=[])).push(F.endStyle,J.to),F.title&&!l&&(l=F.title),F.collapsed&&(!x||0>ab(x.marker,F))&&(x=J)):J.from>B&&E>J.from&&(E=J.from)}if(z)for(H=0;H<z.length;H+=2)z[H+1]==E&&(k+=" "+z[H]);if(!x||x.from==B)for(z=0;z<D.length;++z)ne(g,0,D[z]);if(x&&(x.from||0)==B){ne(g,(null==x.to?y+1:x.to)-B,x.marker,null==x.from);if(null==x.to)break a;x.to==B&&(x=!1)}}if(B>=y)break;for(D=Math.min(y,E);;){if(C){z=B+C.length;x||(H=z>D?C.slice(0,D-B):C,g.addToken(g,H,p?p+r:r,h,B+H.length==E?k:"",
l,u));if(z>=D){C=C.slice(D-B);B=D;break}B=z;h=""}C=n.slice(A,A=m[G++]);p=le(m[G++],g.cm.options)}}else for(x=1;x<m.length;x+=2)g.addToken(g,n.slice(A,A=m[x]),le(m[x+1],g.cm.options))}w.styleClasses&&(w.styleClasses.bgClass&&(d.bgClass=t(w.styleClasses.bgClass,d.bgClass||"")),w.styleClasses.textClass&&(d.textClass=t(w.styleClasses.textClass,d.textClass||"")));0==d.map.length&&d.map.push(0,0,d.content.appendChild(eg(a.display.measure)));0==e?(c.measure.map=d.map,c.measure.cache={}):((c.measure.maps||
(c.measure.maps=[])).push(d.map),(c.measure.caches||(c.measure.caches=[])).push({}))}oa&&(e=d.content.lastChild,/\bcm-tab\b/.test(e.className)||e.querySelector&&e.querySelector(".cm-tab"))&&(d.content.className="cm-tab-wrap-hack");ea(a,"renderLine",a,c.line,d.pre);d.pre.className&&(d.textClass=t(d.pre.className,d.textClass||""));return d}function ng(b){var c=a("span","\u2022","cm-invalidchar");c.title="\\u"+b.charCodeAt(0).toString(16);c.setAttribute("aria-label",c.title);return c}function lg(b,c,
d,e,f,g,h){if(c){if(b.splitSpaces){var w=b.trailingSpace;if(1<c.length&&!/  /.test(c))w=c;else{for(var x="",l=0;l<c.length;l++){var m=c.charAt(l);" "!=m||!w||l!=c.length-1&&32!=c.charCodeAt(l+1)||(m="\u00a0");x+=m;w=" "==m}w=x}}else w=c;x=w;l=b.cm.state.specialChars;m=!1;if(l.test(c)){w=document.createDocumentFragment();for(var U=0;;){l.lastIndex=U;var W=l.exec(c),k=W?W.index-U:c.length-U;if(k){var Aa=document.createTextNode(x.slice(U,U+k));X&&9>ba?w.appendChild(a("span",[Aa])):w.appendChild(Aa);
b.map.push(b.pos,b.pos+k,Aa);b.col+=k;b.pos+=k}if(!W)break;U+=k+1;"\t"==W[0]?(W=b.cm.options.tabSize,W-=b.col%W,k=w.appendChild(a("span",r(W),"cm-tab")),k.setAttribute("role","presentation"),k.setAttribute("cm-text","\t"),b.col+=W):("\r"==W[0]||"\n"==W[0]?(k=w.appendChild(a("span","\r"==W[0]?"\u240d":"\u2424","cm-invalidchar")),k.setAttribute("cm-text",W[0])):(k=b.cm.options.specialCharPlaceholder(W[0]),k.setAttribute("cm-text",W[0]),X&&9>ba?w.appendChild(a("span",[k])):w.appendChild(k)),b.col+=1);
b.map.push(b.pos,b.pos+1,k);b.pos++}}else b.col+=c.length,w=document.createTextNode(x),b.map.push(b.pos,b.pos+c.length,w),X&&9>ba&&(m=!0),b.pos+=c.length;b.trailingSpace=32==x.charCodeAt(c.length-1);if(d||e||f||m||h)return c=d||"",e&&(c+=e),f&&(c+=f),e=a("span",[w],c,h),g&&(e.title=g),b.content.appendChild(e);b.content.appendChild(w)}}function mg(a,b){return function(c,d,e,w,f,g,x){e=e?e+" cm-force-border":"cm-force-border";for(var h=c.pos,l=h+d.length;;){for(var m=void 0,U=0;U<b.length&&!(m=b[U],
m.to>h&&m.from<=h);U++);if(m.to>=l)return a(c,d,e,w,f,g,x);a(c,d.slice(0,m.to-h),e,w,null,g,x);w=null;d=d.slice(m.to-h);h=m.to}}}function ne(a,b,c,d){var e=!d&&c.widgetNode;e&&a.map.push(a.pos,a.pos+b,e);!d&&a.cm.display.input.needsContentAttribute&&(e||(e=a.content.appendChild(document.createElement("span"))),e.setAttribute("cm-marker",c.id));e&&(a.cm.display.input.setUneditable(e),a.content.appendChild(e));a.pos+=b;a.trailingSpace=!1}function oe(a,b,c){for(var d=this.line=b,e;d=Ma(d,!1);)d=d.find(1,
!0).line,(e||(e=[])).push(d);this.size=(this.rest=e)?L(n(this.rest))-c+1:1;this.node=this.text=null;this.hidden=bb(a,b)}function Bc(a,b,c){var d=[],e;for(e=b;e<c;)b=new oe(a.doc,K(a.doc,e),e),e+=b.size,d.push(b);return d}function og(a,b){if(a=a.ownsGroup)try{var c=a.delayedCallbacks,d=0;do{for(;d<c.length;d++)c[d].call(null);for(var e=0;e<a.ops.length;e++){var w=a.ops[e];if(w.cursorActivityHandlers)for(;w.cursorActivityCalled<w.cursorActivityHandlers.length;)w.cursorActivityHandlers[w.cursorActivityCalled++].call(null,
w.cm)}}while(d<c.length)}finally{vb=null,b(a)}}function ma(a,b){var c=a._handlers&&a._handlers[b]||yc;if(c.length){var d=Array.prototype.slice.call(arguments,2);if(vb)var e=vb.delayedCallbacks;else Pb?e=Pb:(e=Pb=[],setTimeout(pg,0));for(var w=function(a){e.push(function(){return c[a].apply(null,d)})},f=0;f<c.length;++f)w(f)}}function pg(){var a=Pb;Pb=null;for(var b=0;b<a.length;++b)a[b]()}function pe(a,b,c,d){for(var e=0;e<b.changes.length;e++){var w=b.changes[e];if("text"==w){w=a;var f=b,g=f.text.className,
x=qe(w,f);f.text==f.node&&(f.node=x.pre);f.text.parentNode.replaceChild(x.pre,f.text);f.text=x.pre;x.bgClass!=f.bgClass||x.textClass!=f.textClass?(f.bgClass=x.bgClass,f.textClass=x.textClass,id(w,f)):g&&(f.text.className=g)}else if("gutter"==w)re(a,b,c,d);else if("class"==w)id(a,b);else if("widget"==w){w=a;f=b;g=d;f.alignable&&(f.alignable=null);x=f.node.firstChild;for(var h;x;x=h)h=x.nextSibling,"CodeMirror-linewidget"==x.className&&f.node.removeChild(x);se(w,f,g)}}b.changes=null}function Qb(b){b.node==
b.text&&(b.node=a("div",null,null,"position: relative"),b.text.parentNode&&b.text.parentNode.replaceChild(b.node,b.text),b.node.appendChild(b.text),X&&8>ba&&(b.node.style.zIndex=2));return b.node}function qe(a,b){var c=a.display.externalMeasured;return c&&c.line==b.line?(a.display.externalMeasured=null,b.measure=c.measure,c.built):me(a,b)}function id(b,c){var d=c.bgClass?c.bgClass+" "+(c.line.bgClass||""):c.line.bgClass;d&&(d+=" CodeMirror-linebackground");if(c.background)d?c.background.className=
d:(c.background.parentNode.removeChild(c.background),c.background=null);else if(d){var e=Qb(c);c.background=e.insertBefore(a("div",null,d),e.firstChild);b.display.input.setUneditable(c.background)}c.line.wrapClass?Qb(c).className=c.line.wrapClass:c.node!=c.text&&(c.node.className="");c.text.className=(c.textClass?c.textClass+" "+(c.line.textClass||""):c.line.textClass)||""}function re(b,c,d,e){c.gutter&&(c.node.removeChild(c.gutter),c.gutter=null);c.gutterBackground&&(c.node.removeChild(c.gutterBackground),
c.gutterBackground=null);if(c.line.gutterClass){var w=Qb(c);c.gutterBackground=a("div",null,"CodeMirror-gutter-background "+c.line.gutterClass,"left: "+(b.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+"px; width: "+e.gutterTotalWidth+"px");b.display.input.setUneditable(c.gutterBackground);w.insertBefore(c.gutterBackground,c.text)}w=c.line.gutterMarkers;if(b.options.lineNumbers||w){var f=Qb(c),g=c.gutter=a("div",null,"CodeMirror-gutter-wrapper","left: "+(b.options.fixedGutter?e.fixedPos:-e.gutterTotalWidth)+
"px");b.display.input.setUneditable(g);f.insertBefore(g,c.text);c.line.gutterClass&&(g.className+=" "+c.line.gutterClass);!b.options.lineNumbers||w&&w["CodeMirror-linenumbers"]||(c.lineNumber=g.appendChild(a("div",ha(b.options,d),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+e.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+b.display.lineNumInnerWidth+"px")));if(w)for(c=0;c<b.options.gutters.length;++c)d=b.options.gutters[c],(f=w.hasOwnProperty(d)&&w[d])&&g.appendChild(a("div",[f],"CodeMirror-gutter-elt",
"left: "+e.gutterLeft[d]+"px; width: "+e.gutterWidth[d]+"px"))}}function qg(a,b,c,d){var e=qe(a,b);b.text=b.node=e.pre;e.bgClass&&(b.bgClass=e.bgClass);e.textClass&&(b.textClass=e.textClass);id(a,b);re(a,b,c,d);se(a,b,d);return b.node}function se(a,b,c){te(a,b.line,b,c,!0);if(b.rest)for(var d=0;d<b.rest.length;d++)te(a,b.rest[d],b,c,!1)}function te(b,c,d,e,f){if(c.widgets){var w=Qb(d),g=0;for(c=c.widgets;g<c.length;++g){var h=c[g],x=a("div",[h.node],"CodeMirror-linewidget");h.handleMouseEvents||x.setAttribute("cm-ignore-events",
"true");var l=h,m=x,U=e;if(l.noHScroll){(d.alignable||(d.alignable=[])).push(m);var k=U.wrapperWidth;m.style.left=U.fixedPos+"px";l.coverGutter||(k-=U.gutterTotalWidth,m.style.paddingLeft=U.gutterTotalWidth+"px");m.style.width=k+"px"}l.coverGutter&&(m.style.zIndex=5,m.style.position="relative",l.noHScroll||(m.style.marginLeft=-U.gutterTotalWidth+"px"));b.display.input.setUneditable(x);f&&h.above?w.insertBefore(x,d.gutter||d.text):w.appendChild(x);ma(h,"redraw")}}}function Rb(b){if(null!=b.height)return b.height;
var c=b.doc.cm;if(!c)return 0;if(!m(document.body,b.node)){var d="position: relative;";b.coverGutter&&(d+="margin-left: -"+c.display.gutters.offsetWidth+"px;");b.noHScroll&&(d+="width: "+c.display.wrapper.clientWidth+"px;");q(c.display.measure,a("div",[b.node],null,d))}return b.height=b.node.parentNode.offsetHeight}function Qa(a,b){for(b=b.target||b.srcElement;b!=a.wrapper;b=b.parentNode)if(!b||1==b.nodeType&&"true"==b.getAttribute("cm-ignore-events")||b.parentNode==a.sizer&&b!=a.mover)return!0}function jd(a){return a.mover.offsetHeight-
a.lineSpace.offsetHeight}function ue(b){if(b.cachedPaddingH)return b.cachedPaddingH;var c=q(b.measure,a("pre","x"));c=window.getComputedStyle?window.getComputedStyle(c):c.currentStyle;c={left:parseInt(c.paddingLeft),right:parseInt(c.paddingRight)};isNaN(c.left)||isNaN(c.right)||(b.cachedPaddingH=c);return c}function Ka(a){return 30-a.display.nativeBarWidth}function db(a){return a.display.scroller.clientWidth-Ka(a)-a.display.barWidth}function kd(a){return a.display.scroller.clientHeight-Ka(a)-a.display.barHeight}
function ve(a,b,c){if(a.line==b)return{map:a.measure.map,cache:a.measure.cache};for(var d=0;d<a.rest.length;d++)if(a.rest[d]==b)return{map:a.measure.maps[d],cache:a.measure.caches[d]};for(b=0;b<a.rest.length;b++)if(L(a.rest[b])>c)return{map:a.measure.maps[b],cache:a.measure.caches[b],before:!0}}function ld(a,b){if(b>=a.display.viewFrom&&b<a.display.viewTo)return a.display.view[eb(a,b)];if((a=a.display.externalMeasured)&&b>=a.lineN&&b<a.lineN+a.size)return a}function fb(a,b){var c=L(b),d=ld(a,c);d&&
!d.text?d=null:d&&d.changes&&(pe(a,d,c,md(a)),a.curOp.forceUpdate=!0);if(!d){var e=Ha(b);d=L(e);e=a.display.externalMeasured=new oe(a.doc,e,d);e.lineN=d;d=e.built=me(a,e);e.text=d.pre;q(a.display.lineMeasure,d.pre);d=e}a=ve(d,b,c);return{line:b,view:d,rect:null,map:a.map,cache:a.cache,before:a.before,hasHeights:!1}}function Da(b,c,d,e,f){c.before&&(d=-1);var w=d+(e||"");if(c.cache.hasOwnProperty(w))b=c.cache[w];else{c.rect||(c.rect=c.view.text.getBoundingClientRect());if(!c.hasHeights){var g=c.view,
h=c.rect,x=b.options.lineWrapping,l=x&&db(b);if(!g.measure.heights||x&&g.measure.width!=l){var m=g.measure.heights=[];if(x)for(g.measure.width=l,g=g.text.firstChild.getClientRects(),x=0;x<g.length-1;x++){l=g[x];var U=g[x+1];2<Math.abs(l.bottom-U.bottom)&&m.push((l.bottom+U.top)/2-h.top)}m.push(h.bottom-h.top)}c.hasHeights=!0}m=e;g=we(c.map,d,m);e=g.node;h=g.start;x=g.end;d=g.collapse;if(3==e.nodeType){for(var k=0;4>k;k++){for(;h&&H(c.line.text.charAt(g.coverStart+h));)--h;for(;g.coverStart+x<g.coverEnd&&
H(c.line.text.charAt(g.coverStart+x));)++x;if(X&&9>ba&&0==h&&x==g.coverEnd-g.coverStart)var r=e.parentNode.getBoundingClientRect();else{r=Ob(e,h,x).getClientRects();x=xe;if("left"==m)for(l=0;l<r.length&&(x=r[l]).left==x.right;l++);else for(l=r.length-1;0<=l&&(x=r[l]).left==x.right;l--);r=x}if(r.left||r.right||0==h)break;x=h;--h;d="right"}X&&11>ba&&((k=!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI)||(null!=nd?k=nd:(m=q(b.display.measure,a("span","x")),k=m.getBoundingClientRect(),
m=Ob(m,0,1).getBoundingClientRect(),k=nd=1<Math.abs(k.left-m.left)),k=!k),k||(k=screen.logicalXDPI/screen.deviceXDPI,m=screen.logicalYDPI/screen.deviceYDPI,r={left:r.left*k,right:r.right*k,top:r.top*m,bottom:r.bottom*m}))}else 0<h&&(d=m="right"),r=b.options.lineWrapping&&1<(k=e.getClientRects()).length?k["right"==m?k.length-1:0]:e.getBoundingClientRect();!(X&&9>ba)||h||r&&(r.left||r.right)||(r=(r=e.parentNode.getClientRects()[0])?{left:r.left,right:r.left+Sb(b.display),top:r.top,bottom:r.bottom}:
xe);e=r.top-c.rect.top;h=r.bottom-c.rect.top;k=(e+h)/2;m=c.view.measure.heights;for(g=0;g<m.length-1&&!(k<m[g]);g++);d={left:("right"==d?r.right:r.left)-c.rect.left,right:("left"==d?r.left:r.right)-c.rect.left,top:g?m[g-1]:0,bottom:m[g]};r.left||r.right||(d.bogus=!0);b.options.singleCursorHeightPerLine||(d.rtop=e,d.rbottom=h);b=d;b.bogus||(c.cache[w]=b)}return{left:b.left,right:b.right,top:f?b.rtop:b.top,bottom:f?b.rbottom:b.bottom}}function we(a,b,c){for(var d,e,w,f,g,h,x=0;x<a.length;x+=3){g=a[x];
h=a[x+1];if(b<g)e=0,w=1,f="left";else if(b<h)e=b-g,w=e+1;else if(x==a.length-3||b==h&&a[x+3]>b)w=h-g,e=w-1,b>=h&&(f="right");if(null!=e){d=a[x+2];g==h&&c==(d.insertLeft?"left":"right")&&(f=c);if("left"==c&&0==e)for(;x&&a[x-2]==a[x-3]&&a[x-1].insertLeft;)d=a[(x-=3)+2],f="left";if("right"==c&&e==h-g)for(;x<a.length-3&&a[x+3]==a[x+4]&&!a[x+5].insertLeft;)d=a[(x+=3)+2],f="right";break}}return{node:d,start:e,end:w,collapse:f,coverStart:g,coverEnd:h}}function ye(a){if(a.measure&&(a.measure.cache={},a.measure.heights=
null,a.rest))for(var b=0;b<a.rest.length;b++)a.measure.caches[b]={}}function ze(a){a.display.externalMeasure=null;f(a.display.lineMeasure);for(var b=0;b<a.display.view.length;b++)ye(a.display.view[b])}function Tb(a){ze(a);a.display.cachedCharWidth=a.display.cachedTextHeight=a.display.cachedPaddingH=null;a.options.lineWrapping||(a.display.maxLineChanged=!0);a.display.lineNumChars=null}function Ae(){return Cc&&Dc?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):
window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Be(){return Cc&&Dc?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function od(a){var b=0;if(a.widgets)for(var c=0;c<a.widgets.length;++c)a.widgets[c].above&&(b+=Rb(a.widgets[c]));return b}function Ec(a,b,c,d,e){e||(e=od(b),c.top+=e,c.bottom+=e);if("line"==d)return c;d||(d="local");b=Ia(b);b="local"==
d?b+a.display.lineSpace.offsetTop:b-a.display.viewOffset;if("page"==d||"window"==d)a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+("window"==d?0:Be()),d=a.left+("window"==d?0:Ae()),c.left+=d,c.right+=d;c.top+=b;c.bottom+=b;return c}function Ce(a,b,c){if("div"==c)return b;var d=b.left;b=b.top;"page"==c?(d-=Ae(),b-=Be()):"local"!=c&&c||(c=a.display.sizer.getBoundingClientRect(),d+=c.left,b+=c.top);a=a.display.lineSpace.getBoundingClientRect();return{left:d-a.left,top:b-a.top}}function pd(a,
b,c,d,e){d||(d=K(a.doc,b.line));var w=d;b=b.ch;d=Da(a,fb(a,d),b,e);return Ec(a,w,d,c)}function Ea(a,b,c,d,e,f){function w(b,w){b=Da(a,e,b,w?"right":"left",f);w?b.left=b.right:b.right=b.left;return Ec(a,d,b,c)}function g(a,b,c){return w(c?a-1:a,1==h[b].level!=c)}d=d||K(a.doc,b.line);e||(e=fb(a,d));var h=Pa(d,a.doc.direction),x=b.ch;b=b.sticky;x>=d.text.length?(x=d.text.length,b="before"):0>=x&&(x=0,b="after");if(!h)return w("before"==b?x-1:x,"before"==b);var l=Jb(h,x,b),m=Lb;l=g(x,l,"before"==b);null!=
m&&(l.other=g(x,m,"before"!=b));return l}function De(a,b){var c=0;b=O(a.doc,b);a.options.lineWrapping||(c=Sb(a.display)*b.ch);b=K(a.doc,b.line);a=Ia(b)+a.display.lineSpace.offsetTop;return{left:c,right:c,top:a,bottom:a+b.height}}function qd(a,b,c,d,e){a=I(a,b,c);a.xRel=e;d&&(a.outside=!0);return a}function rd(a,b,c){var d=a.doc;c+=a.display.viewOffset;if(0>c)return qd(d.first,0,null,!0,-1);var e=S(d,c),w=d.first+d.size-1;if(e>w)return qd(d.first+d.size-1,K(d,w).text.length,null,!0,1);0>b&&(b=0);for(d=
K(d,e);;)if(e=rg(a,d,e,b,c),w=(d=Ma(d,!1))&&d.find(0,!0),d&&(e.ch>w.from.ch||e.ch==w.from.ch&&0<e.xRel))e=L(d=w.to.line);else return e}function Ee(a,b,c,d){d-=od(b);b=b.text.length;var e=F(function(b){return Da(a,c,b-1).bottom<=d},b,0);b=F(function(b){return Da(a,c,b).top>d},e,b);return{begin:e,end:b}}function Fe(a,b,c,d){c||(c=fb(a,b));d=Ec(a,b,Da(a,c,d),"line").top;return Ee(a,b,c,d)}function sd(a,b,c,d){return a.bottom<=c?!1:a.top>c?!0:(d?a.left:a.right)>b}function rg(a,b,c,d,e){e-=Ia(b);var w=
fb(a,b),f=od(b),g=0,h=b.text.length,x=!0,l=Pa(b,a.doc.direction);l&&(l=(a.options.lineWrapping?sg:tg)(a,b,c,w,l,d,e),g=(x=1!=l.level)?l.from:l.to-1,h=x?l.to:l.from-1);var m=null,U=null;l=F(function(b){var c=Da(a,w,b);c.top+=f;c.bottom+=f;if(!sd(c,d,e,!1))return!1;c.top<=e&&c.left<=d&&(m=b,U=c);return!0},g,h);var k=!1;U?(g=d-U.left<U.right-d,x=g==x,l=m+(x?0:1),x=x?"after":"before",g=g?U.left:U.right):(x||l!=h&&l!=g||l++,x=0==l?"after":l==b.text.length?"before":Da(a,w,l-(x?1:0)).bottom+f<=e==x?"after":
"before",k=Ea(a,I(c,l,x),"line",b,w),g=k.left,k=e<k.top||e>=k.bottom);l=J(b.text,l,1);return qd(c,l,x,k,d-g)}function tg(a,b,c,d,e,f,g){var w=F(function(w){w=e[w];var h=1!=w.level;return sd(Ea(a,I(c,h?w.to:w.from,h?"before":"after"),"line",b,d),f,g,!0)},0,e.length-1),h=e[w];if(0<w){var x=1!=h.level;x=Ea(a,I(c,x?h.from:h.to,x?"after":"before"),"line",b,d);sd(x,f,g,!0)&&x.top>g&&(h=e[w-1])}return h}function sg(a,b,c,d,e,f,g){g=Ee(a,b,d,g);c=g.begin;g=g.end;/\s/.test(b.text.charAt(g-1))&&g--;for(var w=
b=null,h=0;h<e.length;h++){var x=e[h];if(!(x.from>=g||x.to<=c)){var l=Da(a,d,1!=x.level?Math.min(g,x.to)-1:Math.max(c,x.from)).right;l=l<f?f-l+1E9:l-f;if(!b||w>l)b=x,w=l}}b||(b=e[e.length-1]);b.from<c&&(b={from:c,to:b.to,level:b.level});b.to>g&&(b={from:b.from,to:g,level:b.level});return b}function gb(b){if(null!=b.cachedTextHeight)return b.cachedTextHeight;if(null==hb){hb=a("pre");for(var c=0;49>c;++c)hb.appendChild(document.createTextNode("x")),hb.appendChild(a("br"));hb.appendChild(document.createTextNode("x"))}q(b.measure,
hb);c=hb.offsetHeight/50;3<c&&(b.cachedTextHeight=c);f(b.measure);return c||1}function Sb(b){if(null!=b.cachedCharWidth)return b.cachedCharWidth;var c=a("span","xxxxxxxxxx"),d=a("pre",[c]);q(b.measure,d);c=c.getBoundingClientRect();c=(c.right-c.left)/10;2<c&&(b.cachedCharWidth=c);return c||10}function md(a){for(var b=a.display,c={},d={},e=b.gutters.clientLeft,w=b.gutters.firstChild,f=0;w;w=w.nextSibling,++f)c[a.options.gutters[f]]=w.offsetLeft+w.clientLeft+e,d[a.options.gutters[f]]=w.clientWidth;
return{fixedPos:td(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function td(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function Ge(a){var b=gb(a.display),c=a.options.lineWrapping,d=c&&Math.max(5,a.display.scroller.clientWidth/Sb(a.display)-3);return function(e){if(bb(a.doc,e))return 0;var w=0;if(e.widgets)for(var f=0;f<e.widgets.length;f++)e.widgets[f].height&&(w+=e.widgets[f].height);return c?
w+(Math.ceil(e.text.length/d)||1)*b:w+b}}function ud(a){var b=a.doc,c=Ge(a);b.iter(function(a){var b=c(a);b!=a.height&&T(a,b)})}function ib(a,b,c,d){var f=a.display;if(!c&&"true"==(b.target||b.srcElement).getAttribute("cm-not-content"))return null;c=f.lineSpace.getBoundingClientRect();try{var w=b.clientX-c.left;var g=b.clientY-c.top}catch($d){return null}b=rd(a,w,g);var h;d&&1==b.xRel&&(h=K(a.doc,b.line).text).length==b.ch&&(d=e(h,h.length,a.options.tabSize)-h.length,b=I(b.line,Math.max(0,Math.round((w-
ue(a.display).left)/Sb(a.display))-d)));return b}function eb(a,b){if(b>=a.display.viewTo)return null;b-=a.display.viewFrom;if(0>b)return null;a=a.display.view;for(var c=0;c<a.length;c++)if(b-=a[c].size,0>b)return c}function Ub(a){a.display.input.showSelection(a.display.input.prepareSelection())}function He(a,b){void 0===b&&(b=!0);for(var c=a.doc,d={},e=d.cursors=document.createDocumentFragment(),f=d.selection=document.createDocumentFragment(),w=0;w<c.sel.ranges.length;w++)if(b||w!=c.sel.primIndex){var g=
c.sel.ranges[w];if(!(g.from().line>=a.display.viewTo||g.to().line<a.display.viewFrom)){var h=g.empty();(h||a.options.showCursorWhenSelecting)&&Ie(a,g.head,e);h||ug(a,g,f)}}return d}function Ie(b,c,d){c=Ea(b,c,"div",null,null,!b.options.singleCursorHeightPerLine);var e=d.appendChild(a("div","\u00a0","CodeMirror-cursor"));e.style.left=c.left+"px";e.style.top=c.top+"px";e.style.height=Math.max(0,c.bottom-c.top)*b.options.cursorHeight+"px";c.other&&(b=d.appendChild(a("div","\u00a0","CodeMirror-cursor CodeMirror-secondarycursor")),
b.style.display="",b.style.left=c.other.left+"px",b.style.top=c.other.top+"px",b.style.height=.85*(c.other.bottom-c.other.top)+"px")}function Fc(a,b){return a.top-b.top||a.left-b.left}function ug(b,c,d){function e(b,c,d,e){0>c&&(c=0);c=Math.round(c);e=Math.round(e);h.appendChild(a("div",null,"CodeMirror-selected","position: absolute; left: "+b+"px;\n                             top: "+c+"px; width: "+(null==d?m-b:d)+"px;\n                             height: "+(e-c)+"px"))}function f(a,c,d){function f(c,
d){return pd(b,I(a,c),"div",h,d)}function w(a,c,d){a=Fe(b,h,null,a);c="ltr"==c==("after"==d)?"left":"right";d="after"==d?a.begin:a.end-(/\s/.test(h.text.charAt(a.end-1))?2:1);return f(d,c)[c]}var h=K(g,a),x=h.text.length,U,r,t=Pa(h,g.direction);Zd(t,c||0,null==d?x:d,function(a,b,g,h){var u="ltr"==g,q=f(a,u?"left":"right"),W=f(b-1,u?"right":"left"),p=null==c&&0==a,Aa=null==d&&b==x,v=0==h;h=!t||h==t.length-1;3>=W.top-q.top?(b=(k?p:Aa)&&v?l:(u?q:W).left,e(b,q.top,((k?Aa:p)&&h?m:(u?W:q).right)-b,q.bottom)):
(u?(u=k&&p&&v?l:q.left,p=k?m:w(a,g,"before"),a=k?l:w(b,g,"after"),Aa=k&&Aa&&h?m:W.right):(u=k?w(a,g,"before"):l,p=!k&&p&&v?m:q.right,a=!k&&Aa&&h?l:W.left,Aa=k?w(b,g,"after"):m),e(u,q.top,p-u,q.bottom),q.bottom<W.top&&e(l,q.bottom,null,W.top),e(a,W.top,Aa-a,W.bottom));if(!U||0>Fc(q,U))U=q;0>Fc(W,U)&&(U=W);if(!r||0>Fc(q,r))r=q;0>Fc(W,r)&&(r=W)});return{start:U,end:r}}var w=b.display,g=b.doc,h=document.createDocumentFragment(),x=ue(b.display),l=x.left,m=Math.max(w.sizerWidth,db(b)-w.sizer.offsetLeft)-
x.right,k="ltr"==g.direction;w=c.from();c=c.to();if(w.line==c.line)f(w.line,w.ch,c.ch);else{var r=K(g,w.line);x=K(g,c.line);x=Ha(r)==Ha(x);w=f(w.line,w.ch,x?r.text.length+1:null).end;c=f(c.line,x?0:null,c.ch).start;x&&(w.top<c.top-2?(e(w.right,w.top,null,w.bottom),e(l,c.top,c.left,c.bottom)):e(w.right,w.top,c.left-w.right,w.bottom));w.bottom<c.top&&e(l,w.bottom,null,c.top)}d.appendChild(h)}function vd(a){if(a.state.focused){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursorDiv.style.visibility=
"";0<a.options.cursorBlinkRate?b.blinker=setInterval(function(){return b.cursorDiv.style.visibility=(c=!c)?"":"hidden"},a.options.cursorBlinkRate):0>a.options.cursorBlinkRate&&(b.cursorDiv.style.visibility="hidden")}}function Je(a){a.state.focused||(a.display.input.focus(),wd(a))}function Ke(a){a.state.delayingBlurEvent=!0;setTimeout(function(){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1,Vb(a))},100)}function wd(a,b){a.state.delayingBlurEvent&&(a.state.delayingBlurEvent=!1);"nocursor"!=
a.options.readOnly&&(a.state.focused||(ea(a,"focus",a,b),a.state.focused=!0,v(a.display.wrapper,"CodeMirror-focused"),a.curOp||a.display.selForContextMenu==a.doc.sel||(a.display.input.reset(),oa&&setTimeout(function(){return a.display.input.reset(!0)},20)),a.display.input.receivedFocus()),vd(a))}function Vb(a,b){a.state.delayingBlurEvent||(a.state.focused&&(ea(a,"blur",a,b),a.state.focused=!1,jb(a.display.wrapper,"CodeMirror-focused")),clearInterval(a.display.blinker),setTimeout(function(){a.state.focused||
(a.display.shift=!1)},150))}function Gc(a){a=a.display;for(var b=a.lineDiv.offsetTop,c=0;c<a.view.length;c++){var d=a.view[c];if(!d.hidden){if(X&&8>ba){var e=d.node.offsetTop+d.node.offsetHeight;var f=e-b;b=e}else f=d.node.getBoundingClientRect(),f=f.bottom-f.top;e=d.line.height-f;2>f&&(f=gb(a));if(.005<e||-.005>e)if(T(d.line,f),Le(d.line),d.rest)for(f=0;f<d.rest.length;f++)Le(d.rest[f])}}}function Le(a){if(a.widgets)for(var b=0;b<a.widgets.length;++b)a.widgets[b].height=a.widgets[b].node.parentNode.offsetHeight}
function xd(a,b,c){var d=c&&null!=c.top?Math.max(0,c.top):a.scroller.scrollTop;d=Math.floor(d-a.lineSpace.offsetTop);var e=c&&null!=c.bottom?c.bottom:d+a.wrapper.clientHeight;d=S(b,d);e=S(b,e);if(c&&c.ensure){var f=c.ensure.from.line;c=c.ensure.to.line;f<d?(d=f,e=S(b,Ia(K(b,f))+a.wrapper.clientHeight)):Math.min(c,b.lastLine())>=e&&(d=S(b,Ia(K(b,c))-a.wrapper.clientHeight),e=c)}return{from:d,to:Math.max(e,d+1)}}function Me(a){var b=a.display,c=b.view;if(b.alignWidgets||b.gutters.firstChild&&a.options.fixedGutter){for(var d=
td(b)-b.scroller.scrollLeft+a.doc.scrollLeft,e=b.gutters.offsetWidth,f=d+"px",w=0;w<c.length;w++)if(!c[w].hidden){a.options.fixedGutter&&(c[w].gutter&&(c[w].gutter.style.left=f),c[w].gutterBackground&&(c[w].gutterBackground.style.left=f));var g=c[w].alignable;if(g)for(var h=0;h<g.length;h++)g[h].style.left=f}a.options.fixedGutter&&(b.gutters.style.left=d+e+"px")}}function Ne(b){if(!b.options.lineNumbers)return!1;var c=b.doc;c=ha(b.options,c.first+c.size-1);var d=b.display;if(c.length!=d.lineNumChars){var e=
d.measure.appendChild(a("div",[a("div",c)],"CodeMirror-linenumber CodeMirror-gutter-elt")),f=e.firstChild.offsetWidth;e=e.offsetWidth-f;d.lineGutter.style.width="";d.lineNumInnerWidth=Math.max(f,d.lineGutter.offsetWidth-e)+1;d.lineNumWidth=d.lineNumInnerWidth+e;d.lineNumChars=d.lineNumInnerWidth?c.length:-1;d.lineGutter.style.width=d.lineNumWidth+"px";yd(b);return!0}return!1}function zd(a,b){var c=a.display,d=gb(a.display);0>b.top&&(b.top=0);var e=a.curOp&&null!=a.curOp.scrollTop?a.curOp.scrollTop:
c.scroller.scrollTop,f=kd(a),w={};b.bottom-b.top>f&&(b.bottom=b.top+f);var g=a.doc.height+jd(c),h=b.top<d;d=b.bottom>g-d;b.top<e?w.scrollTop=h?0:b.top:b.bottom>e+f&&(f=Math.min(b.top,(d?g:b.bottom)-f),f!=e&&(w.scrollTop=f));e=a.curOp&&null!=a.curOp.scrollLeft?a.curOp.scrollLeft:c.scroller.scrollLeft;a=db(a)-(a.options.fixedGutter?c.gutters.offsetWidth:0);if(c=b.right-b.left>a)b.right=b.left+a;10>b.left?w.scrollLeft=0:b.left<e?w.scrollLeft=Math.max(0,b.left-(c?0:10)):b.right>a+e-3&&(w.scrollLeft=b.right+
(c?0:10)-a);return w}function Hc(a,b){null!=b&&(Ic(a),a.curOp.scrollTop=(null==a.curOp.scrollTop?a.doc.scrollTop:a.curOp.scrollTop)+b)}function wb(a){Ic(a);var b=a.getCursor();a.curOp.scrollToPos={from:b,to:b,margin:a.options.cursorScrollMargin}}function Wb(a,b,c){null==b&&null==c||Ic(a);null!=b&&(a.curOp.scrollLeft=b);null!=c&&(a.curOp.scrollTop=c)}function Ic(a){var b=a.curOp.scrollToPos;if(b){a.curOp.scrollToPos=null;var c=De(a,b.from),d=De(a,b.to);Oe(a,c,d,b.margin)}}function Oe(a,b,c,d){b=zd(a,
{left:Math.min(b.left,c.left),top:Math.min(b.top,c.top)-d,right:Math.max(b.right,c.right),bottom:Math.max(b.bottom,c.bottom)+d});Wb(a,b.scrollLeft,b.scrollTop)}function Xb(a,b){2>Math.abs(a.doc.scrollTop-b)||(Ua||Ad(a,{top:b}),Pe(a,b,!0),Ua&&Ad(a),Yb(a,100))}function Pe(a,b,c){b=Math.min(a.display.scroller.scrollHeight-a.display.scroller.clientHeight,b);if(a.display.scroller.scrollTop!=b||c)a.doc.scrollTop=b,a.display.scrollbars.setScrollTop(b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=
b)}function kb(a,b,c,d){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);(c?b==a.doc.scrollLeft:2>Math.abs(a.doc.scrollLeft-b))&&!d||(a.doc.scrollLeft=b,Me(a),a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b),a.display.scrollbars.setScrollLeft(b))}function Zb(a){var b=a.display,c=b.gutters.offsetWidth,d=Math.round(a.doc.height+jd(a.display));return{clientHeight:b.scroller.clientHeight,viewHeight:b.wrapper.clientHeight,scrollWidth:b.scroller.scrollWidth,
clientWidth:b.scroller.clientWidth,viewWidth:b.wrapper.clientWidth,barLeft:a.options.fixedGutter?c:0,docHeight:d,scrollHeight:d+Ka(a)+b.barHeight,nativeBarWidth:b.nativeBarWidth,gutterWidth:c}}function xb(a,b){b||(b=Zb(a));var c=a.display.barWidth,d=a.display.barHeight;Qe(a,b);for(b=0;4>b&&c!=a.display.barWidth||d!=a.display.barHeight;b++)c!=a.display.barWidth&&a.options.lineWrapping&&Gc(a),Qe(a,Zb(a)),c=a.display.barWidth,d=a.display.barHeight}function Qe(a,b){var c=a.display,d=c.scrollbars.update(b);
c.sizer.style.paddingRight=(c.barWidth=d.right)+"px";c.sizer.style.paddingBottom=(c.barHeight=d.bottom)+"px";c.heightForcer.style.borderBottom=d.bottom+"px solid transparent";d.right&&d.bottom?(c.scrollbarFiller.style.display="block",c.scrollbarFiller.style.height=d.bottom+"px",c.scrollbarFiller.style.width=d.right+"px"):c.scrollbarFiller.style.display="";d.bottom&&a.options.coverGutterNextToScrollbar&&a.options.fixedGutter?(c.gutterFiller.style.display="block",c.gutterFiller.style.height=d.bottom+
"px",c.gutterFiller.style.width=b.gutterWidth+"px"):c.gutterFiller.style.display=""}function Re(a){a.display.scrollbars&&(a.display.scrollbars.clear(),a.display.scrollbars.addClass&&jb(a.display.wrapper,a.display.scrollbars.addClass));a.display.scrollbars=new Se[a.options.scrollbarStyle](function(b){a.display.wrapper.insertBefore(b,a.display.scrollbarFiller);Q(b,"mousedown",function(){a.state.focused&&setTimeout(function(){return a.display.input.focus()},0)});b.setAttribute("cm-not-content","true")},
function(b,c){"horizontal"==c?kb(a,b):Xb(a,b)},a);a.display.scrollbars.addClass&&v(a.display.wrapper,a.display.scrollbars.addClass)}function lb(a){a.curOp={cm:a,viewChanged:!1,startHeight:a.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++vg};a=a.curOp;vb?vb.ops.push(a):a.ownsGroup=vb={ops:[a],delayedCallbacks:[]}}function mb(b){og(b.curOp,
function(b){for(var c=0;c<b.ops.length;c++)b.ops[c].cm.curOp=null;b=b.ops;for(c=0;c<b.length;c++){var d=b[c],e=d.cm,f=e.display,w=e.display;!w.scrollbarsClipped&&w.scroller.offsetWidth&&(w.nativeBarWidth=w.scroller.offsetWidth-w.scroller.clientWidth,w.heightForcer.style.height=Ka(e)+"px",w.sizer.style.marginBottom=-w.nativeBarWidth+"px",w.sizer.style.borderRightWidth=Ka(e)+"px",w.scrollbarsClipped=!0);d.updateMaxLine&&$c(e);d.mustUpdate=d.viewChanged||d.forceUpdate||null!=d.scrollTop||d.scrollToPos&&
(d.scrollToPos.from.line<f.viewFrom||d.scrollToPos.to.line>=f.viewTo)||f.maxLineChanged&&e.options.lineWrapping;d.update=d.mustUpdate&&new Jc(e,d.mustUpdate&&{top:d.scrollTop,ensure:d.scrollToPos},d.forceUpdate)}for(c=0;c<b.length;c++)d=b[c],d.updatedDisplay=d.mustUpdate&&Bd(d.cm,d.update);for(c=0;c<b.length;c++)if(d=b[c],e=d.cm,f=e.display,d.updatedDisplay&&Gc(e),d.barMeasure=Zb(e),f.maxLineChanged&&!e.options.lineWrapping&&(w=f.maxLine.text.length,w=Da(e,fb(e,f.maxLine),w,void 0),d.adjustWidthTo=
w.left+3,e.display.sizerWidth=d.adjustWidthTo,d.barMeasure.scrollWidth=Math.max(f.scroller.clientWidth,f.sizer.offsetLeft+d.adjustWidthTo+Ka(e)+e.display.barWidth),d.maxScrollLeft=Math.max(0,f.sizer.offsetLeft+d.adjustWidthTo-db(e))),d.updatedDisplay||d.selectionChanged)d.preparedSelection=f.input.prepareSelection();for(c=0;c<b.length;c++)d=b[c],e=d.cm,null!=d.adjustWidthTo&&(e.display.sizer.style.minWidth=d.adjustWidthTo+"px",d.maxScrollLeft<e.doc.scrollLeft&&kb(e,Math.min(e.display.scroller.scrollLeft,
d.maxScrollLeft),!0),e.display.maxLineChanged=!1),f=d.focus&&d.focus==u(),d.preparedSelection&&e.display.input.showSelection(d.preparedSelection,f),(d.updatedDisplay||d.startHeight!=e.doc.height)&&xb(e,d.barMeasure),d.updatedDisplay&&Cd(e,d.barMeasure),d.selectionChanged&&vd(e),e.state.focused&&d.updateInput&&e.display.input.reset(d.typing),f&&Je(d.cm);for(c=0;c<b.length;c++){var g=void 0;d=b[c];e=d.cm;f=e.display;w=e.doc;d.updatedDisplay&&Te(e,d.update);null==f.wheelStartX||null==d.scrollTop&&null==
d.scrollLeft&&!d.scrollToPos||(f.wheelStartX=f.wheelStartY=null);null!=d.scrollTop&&Pe(e,d.scrollTop,d.forceScroll);null!=d.scrollLeft&&kb(e,d.scrollLeft,!0,!0);if(d.scrollToPos){var h=O(w,d.scrollToPos.from),x=O(w,d.scrollToPos.to),l=d.scrollToPos.margin;null==l&&(l=0);e.options.lineWrapping||h!=x||(h=h.ch?I(h.line,"before"==h.sticky?h.ch-1:h.ch,"after"):h,x="before"==h.sticky?I(h.line,h.ch+1,"before"):h);for(var m=0;5>m;m++){var k=!1;g=Ea(e,h);var r=x&&x!=h?Ea(e,x):g;g={left:Math.min(g.left,r.left),
top:Math.min(g.top,r.top)-l,right:Math.max(g.left,r.left),bottom:Math.max(g.bottom,r.bottom)+l};r=zd(e,g);var t=e.doc.scrollTop,q=e.doc.scrollLeft;null!=r.scrollTop&&(Xb(e,r.scrollTop),1<Math.abs(e.doc.scrollTop-t)&&(k=!0));null!=r.scrollLeft&&(kb(e,r.scrollLeft),1<Math.abs(e.doc.scrollLeft-q)&&(k=!0));if(!k)break}x=g;ja(e,"scrollCursorIntoView")||(l=e.display,m=l.sizer.getBoundingClientRect(),h=null,0>x.top+m.top?h=!0:x.bottom+m.top>(window.innerHeight||document.documentElement.clientHeight)&&(h=
!1),null==h||wg||(x=a("div","\u200b",null,"position: absolute;\n                         top: "+(x.top-l.viewOffset-e.display.lineSpace.offsetTop)+"px;\n                         height: "+(x.bottom-x.top+Ka(e)+l.barHeight)+"px;\n                         left: "+x.left+"px; width: "+Math.max(2,x.right-x.left)+"px;"),e.display.lineSpace.appendChild(x),x.scrollIntoView(h),e.display.lineSpace.removeChild(x)))}x=d.maybeHiddenMarkers;h=d.maybeUnhiddenMarkers;if(x)for(l=0;l<x.length;++l)x[l].lines.length||
ea(x[l],"hide");if(h)for(x=0;x<h.length;++x)h[x].lines.length&&ea(h[x],"unhide");f.wrapper.offsetHeight&&(w.scrollTop=e.display.scroller.scrollTop);d.changeObjs&&ea(e,"changes",e,d.changeObjs);d.update&&d.update.finish()}})}function ua(a,b){if(a.curOp)return b();lb(a);try{return b()}finally{mb(a)}}function ka(a,b){return function(){if(a.curOp)return b.apply(a,arguments);lb(a);try{return b.apply(a,arguments)}finally{mb(a)}}}function qa(a){return function(){if(this.curOp)return a.apply(this,arguments);
lb(this);try{return a.apply(this,arguments)}finally{mb(this)}}}function la(a){return function(){var b=this.cm;if(!b||b.curOp)return a.apply(this,arguments);lb(b);try{return a.apply(this,arguments)}finally{mb(b)}}}function sa(a,b,c,d){null==b&&(b=a.doc.first);null==c&&(c=a.doc.first+a.doc.size);d||(d=0);var e=a.display;d&&c<e.viewTo&&(null==e.updateLineNumbers||e.updateLineNumbers>b)&&(e.updateLineNumbers=b);a.curOp.viewChanged=!0;if(b>=e.viewTo)Va&&Yc(a.doc,b)<e.viewTo&&Wa(a);else if(c<=e.viewFrom)Va&&
Yd(a.doc,c+d)>e.viewFrom?Wa(a):(e.viewFrom+=d,e.viewTo+=d);else if(b<=e.viewFrom&&c>=e.viewTo)Wa(a);else if(b<=e.viewFrom){var f=Kc(a,c,c+d,1);f?(e.view=e.view.slice(f.index),e.viewFrom=f.lineN,e.viewTo+=d):Wa(a)}else if(c>=e.viewTo)(f=Kc(a,b,b,-1))?(e.view=e.view.slice(0,f.index),e.viewTo=f.lineN):Wa(a);else{f=Kc(a,b,b,-1);var w=Kc(a,c,c+d,1);f&&w?(e.view=e.view.slice(0,f.index).concat(Bc(a,f.lineN,w.lineN)).concat(e.view.slice(w.index)),e.viewTo+=d):Wa(a)}if(a=e.externalMeasured)c<a.lineN?a.lineN+=
d:b<a.lineN+a.size&&(e.externalMeasured=null)}function Xa(a,b,c){a.curOp.viewChanged=!0;var e=a.display,f=a.display.externalMeasured;f&&b>=f.lineN&&b<f.lineN+f.size&&(e.externalMeasured=null);b<e.viewFrom||b>=e.viewTo||(a=e.view[eb(a,b)],null!=a.node&&(a=a.changes||(a.changes=[]),-1==d(a,c)&&a.push(c)))}function Wa(a){a.display.viewFrom=a.display.viewTo=a.doc.first;a.display.view=[];a.display.viewOffset=0}function Kc(a,b,c,d){var e=eb(a,b),f=a.display.view;if(!Va||c==a.doc.first+a.doc.size)return{index:e,
lineN:c};for(var g=a.display.viewFrom,w=0;w<e;w++)g+=f[w].size;if(g!=b){if(0<d){if(e==f.length-1)return null;b=g+f[e].size-b;e++}else b=g-b;c+=b}for(;Yc(a.doc,c)!=c;){if(e==(0>d?0:f.length-1))return null;c+=d*f[e-(0>d?1:0)].size;e+=d}return{index:e,lineN:c}}function Ue(a){a=a.display.view;for(var b=0,c=0;c<a.length;c++){var d=a[c];d.hidden||d.node&&!d.changes||++b}return b}function Yb(a,b){a.doc.highlightFrontier<a.display.viewTo&&a.state.highlight.set(b,l(xg,a))}function xg(a){var b=a.doc;if(!(b.highlightFrontier>=
a.display.viewTo)){var c=+new Date+a.options.workTime,d=Nb(a,b.highlightFrontier),e=[];b.iter(d.line,Math.min(b.first+b.size,a.display.viewTo+500),function(f){if(d.line>=a.display.viewFrom){var g=f.styles,w=f.text.length>a.options.maxHighlightLength?cb(b.mode,d.state):null,h=ee(a,f,d,!0);w&&(d.state=w);f.styles=h.styles;w=f.styleClasses;(h=h.classes)?f.styleClasses=h:w&&(f.styleClasses=null);h=!g||g.length!=f.styles.length||w!=h&&(!w||!h||w.bgClass!=h.bgClass||w.textClass!=h.textClass);for(w=0;!h&&
w<g.length;++w)h=g[w]!=f.styles[w];h&&e.push(d.line);f.stateAfter=d.save()}else f.text.length<=a.options.maxHighlightLength&&fd(a,f.text,d),f.stateAfter=0==d.line%5?d.save():null;d.nextLine();if(+new Date>c)return Yb(a,a.options.workDelay),!0});b.highlightFrontier=d.line;b.modeFrontier=Math.max(b.modeFrontier,d.line);e.length&&ua(a,function(){for(var b=0;b<e.length;b++)Xa(a,e[b],"text")})}}function Bd(a,b){var c=a.display,d=a.doc;if(b.editorIsHidden)return Wa(a),!1;if(!b.force&&b.visible.from>=c.viewFrom&&
b.visible.to<=c.viewTo&&(null==c.updateLineNumbers||c.updateLineNumbers>=c.viewTo)&&c.renderedView==c.view&&0==Ue(a))return!1;Ne(a)&&(Wa(a),b.dims=md(a));var e=d.first+d.size,g=Math.max(b.visible.from-a.options.viewportMargin,d.first),w=Math.min(e,b.visible.to+a.options.viewportMargin);c.viewFrom<g&&20>g-c.viewFrom&&(g=Math.max(d.first,c.viewFrom));c.viewTo>w&&20>c.viewTo-w&&(w=Math.min(e,c.viewTo));Va&&(g=Yc(a.doc,g),w=Yd(a.doc,w));d=g!=c.viewFrom||w!=c.viewTo||c.lastWrapHeight!=b.wrapperHeight||
c.lastWrapWidth!=b.wrapperWidth;e=a.display;0==e.view.length||g>=e.viewTo||w<=e.viewFrom?(e.view=Bc(a,g,w),e.viewFrom=g):(e.viewFrom>g?e.view=Bc(a,g,e.viewFrom).concat(e.view):e.viewFrom<g&&(e.view=e.view.slice(eb(a,g))),e.viewFrom=g,e.viewTo<w?e.view=e.view.concat(Bc(a,e.viewTo,w)):e.viewTo>w&&(e.view=e.view.slice(0,eb(a,w))));e.viewTo=w;c.viewOffset=Ia(K(a.doc,c.viewFrom));a.display.mover.style.top=c.viewOffset+"px";w=Ue(a);if(!d&&0==w&&!b.force&&c.renderedView==c.view&&(null==c.updateLineNumbers||
c.updateLineNumbers>=c.viewTo))return!1;a.hasFocus()?g=null:(g=u())&&m(a.display.lineDiv,g)?(g={activeElt:g},window.getSelection&&(e=window.getSelection(),e.anchorNode&&e.extend&&m(a.display.lineDiv,e.anchorNode)&&(g.anchorNode=e.anchorNode,g.anchorOffset=e.anchorOffset,g.focusNode=e.focusNode,g.focusOffset=e.focusOffset))):g=null;4<w&&(c.lineDiv.style.display="none");yg(a,c.updateLineNumbers,b.dims);4<w&&(c.lineDiv.style.display="");c.renderedView=c.view;(w=g)&&w.activeElt&&w.activeElt!=u()&&(w.activeElt.focus(),
w.anchorNode&&m(document.body,w.anchorNode)&&m(document.body,w.focusNode)&&(g=window.getSelection(),e=document.createRange(),e.setEnd(w.anchorNode,w.anchorOffset),e.collapse(!1),g.removeAllRanges(),g.addRange(e),g.extend(w.focusNode,w.focusOffset)));f(c.cursorDiv);f(c.selectionDiv);c.gutters.style.height=c.sizer.style.minHeight=0;d&&(c.lastWrapHeight=b.wrapperHeight,c.lastWrapWidth=b.wrapperWidth,Yb(a,400));c.updateLineNumbers=null;return!0}function Te(a,b){for(var c=b.viewport,d=!0;;d=!1){if(!d||
!a.options.lineWrapping||b.oldDisplayWidth==db(a))if(c&&null!=c.top&&(c={top:Math.min(a.doc.height+jd(a.display)-kd(a),c.top)}),b.visible=xd(a.display,a.doc,c),b.visible.from>=a.display.viewFrom&&b.visible.to<=a.display.viewTo)break;if(!Bd(a,b))break;Gc(a);d=Zb(a);Ub(a);xb(a,d);Cd(a,d);b.force=!1}b.signal(a,"update",a);if(a.display.viewFrom!=a.display.reportedViewFrom||a.display.viewTo!=a.display.reportedViewTo)b.signal(a,"viewportChange",a,a.display.viewFrom,a.display.viewTo),a.display.reportedViewFrom=
a.display.viewFrom,a.display.reportedViewTo=a.display.viewTo}function Ad(a,b){b=new Jc(a,b);if(Bd(a,b)){Gc(a);Te(a,b);var c=Zb(a);Ub(a);xb(a,c);Cd(a,c);b.finish()}}function yg(a,b,c){function e(b){var c=b.nextSibling;oa&&Ca&&a.display.currentWheelTarget==b?b.style.display="none":b.parentNode.removeChild(b);return c}var g=a.display,w=a.options.lineNumbers,h=g.lineDiv,l=h.firstChild,m=g.view;g=g.viewFrom;for(var x=0;x<m.length;x++){var k=m[x];if(!k.hidden)if(k.node&&k.node.parentNode==h){for(;l!=k.node;)l=
e(l);l=w&&null!=b&&b<=g&&k.lineNumber;k.changes&&(-1<d(k.changes,"gutter")&&(l=!1),pe(a,k,g,c));l&&(f(k.lineNumber),k.lineNumber.appendChild(document.createTextNode(ha(a.options,g))));l=k.node.nextSibling}else{var r=qg(a,k,g,c);h.insertBefore(r,l)}g+=k.size}for(;l;)l=e(l)}function yd(a){a.display.sizer.style.marginLeft=a.display.gutters.offsetWidth+"px"}function Cd(a,b){a.display.sizer.style.minHeight=b.docHeight+"px";a.display.heightForcer.style.top=b.docHeight+"px";a.display.gutters.style.height=
b.docHeight+a.display.barHeight+Ka(a)+"px"}function Ve(b){var c=b.display.gutters,d=b.options.gutters;f(c);for(var e=0;e<d.length;++e){var g=d[e],w=c.appendChild(a("div",null,"CodeMirror-gutter "+g));"CodeMirror-linenumbers"==g&&(b.display.lineGutter=w,w.style.width=(b.display.lineNumWidth||1)+"px")}c.style.display=e?"":"none";yd(b)}function Dd(a){var b=d(a.gutters,"CodeMirror-linenumbers");-1==b&&a.lineNumbers?a.gutters=a.gutters.concat(["CodeMirror-linenumbers"]):-1<b&&!a.lineNumbers&&(a.gutters=
a.gutters.slice(0),a.gutters.splice(b,1))}function We(a){var b=a.wheelDeltaX,c=a.wheelDeltaY;null==b&&a.detail&&a.axis==a.HORIZONTAL_AXIS&&(b=a.detail);null==c&&a.detail&&a.axis==a.VERTICAL_AXIS?c=a.detail:null==c&&(c=a.wheelDelta);return{x:b,y:c}}function zg(a){a=We(a);a.x*=xa;a.y*=xa;return a}function Xe(a,b){var c=We(b),d=c.x;c=c.y;var e=a.display,f=e.scroller,g=f.scrollWidth>f.clientWidth,w=f.scrollHeight>f.clientHeight;if(d&&g||c&&w){if(c&&Ca&&oa){g=b.target;var h=e.view;a:for(;g!=f;g=g.parentNode)for(var l=
0;l<h.length;l++)if(h[l].node==g){a.display.currentWheelTarget=g;break a}}!d||Ua||Fa||null==xa?(c&&null!=xa&&(b=c*xa,w=a.doc.scrollTop,g=w+e.wrapper.clientHeight,0>b?w=Math.max(0,w+b-50):g=Math.min(a.doc.height,g+b+50),Ad(a,{top:w,bottom:g})),20>Lc&&(null==e.wheelStartX?(e.wheelStartX=f.scrollLeft,e.wheelStartY=f.scrollTop,e.wheelDX=d,e.wheelDY=c,setTimeout(function(){if(null!=e.wheelStartX){var a=f.scrollLeft-e.wheelStartX,b=f.scrollTop-e.wheelStartY;a=b&&e.wheelDY&&b/e.wheelDY||a&&e.wheelDX&&a/
e.wheelDX;e.wheelStartX=e.wheelStartY=null;a&&(xa=(xa*Lc+a)/(Lc+1),++Lc)}},200)):(e.wheelDX+=d,e.wheelDY+=c))):(c&&w&&Xb(a,Math.max(0,f.scrollTop+c*xa)),kb(a,Math.max(0,f.scrollLeft+d*xa)),(!c||c&&w)&&pa(b),e.wheelStartX=null)}}function Ga(a,b){b=a[b];a.sort(function(a,b){return P(a.from(),b.from())});b=d(a,b);for(var c=1;c<a.length;c++){var e=a[c],f=a[c-1];if(0<=P(f.to(),e.from())){var g=da(f.from(),e.from()),w=Oa(f.to(),e.to());e=f.empty()?e.from()==e.head:f.from()==f.head;c<=b&&--b;a.splice(--c,
2,new Z(e?w:g,e?g:w))}}return new ya(a,b)}function Ra(a,b){return new ya([new Z(a,b||a)],0)}function Ya(a){return a.text?I(a.from.line+a.text.length-1,n(a.text).length+(1==a.text.length?a.from.ch:0)):a.to}function Ye(a,b){if(0>P(a,b.from))return a;if(0>=P(a,b.to))return Ya(b);var c=a.line+b.text.length-(b.to.line-b.from.line)-1,d=a.ch;a.line==b.to.line&&(d+=Ya(b).ch-b.to.ch);return I(c,d)}function Ed(a,b){for(var c=[],d=0;d<a.sel.ranges.length;d++){var e=a.sel.ranges[d];c.push(new Z(Ye(e.anchor,b),
Ye(e.head,b)))}return Ga(c,a.sel.primIndex)}function Ze(a,b,c){return a.line==b.line?I(c.line,a.ch-b.ch+c.ch):I(c.line+(a.line-b.line),a.ch)}function Fd(a){a.doc.mode=dd(a.options,a.doc.modeOption);$b(a)}function $b(a){a.doc.iter(function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.doc.modeFrontier=a.doc.highlightFrontier=a.doc.first;Yb(a,100);a.state.modeGen++;a.curOp&&sa(a)}function $e(a,b){return 0==b.from.ch&&0==b.to.ch&&""==n(b.text)&&(!a.cm||a.cm.options.wholeLineUpdateBefore)}
function Gd(a,b,c,d){function e(a,c,e){a.text=c;a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null);null!=a.order&&(a.order=null);rb(a);Xd(a,e);c=d?d(a):1;c!=a.height&&T(a,c);ma(a,"change",a,b)}function f(a,b){for(var e=[];a<b;++a)e.push(new yb(h[a],c?c[a]:null,d));return e}var g=b.from,w=b.to,h=b.text,l=K(a,g.line),m=K(a,w.line),x=n(h),k=c?c[h.length-1]:null,r=w.line-g.line;b.full?(a.insert(0,f(0,h.length)),a.remove(h.length,a.size-h.length)):$e(a,b)?(w=f(0,h.length-1),e(m,m.text,k),r&&a.remove(g.line,
r),w.length&&a.insert(g.line,w)):l==m?1==h.length?e(l,l.text.slice(0,g.ch)+x+l.text.slice(w.ch),k):(r=f(1,h.length-1),r.push(new yb(x+l.text.slice(w.ch),k,d)),e(l,l.text.slice(0,g.ch)+h[0],c?c[0]:null),a.insert(g.line+1,r)):1==h.length?(e(l,l.text.slice(0,g.ch)+h[0]+m.text.slice(w.ch),c?c[0]:null),a.remove(g.line+1,r)):(e(l,l.text.slice(0,g.ch)+h[0],c?c[0]:null),e(m,x+m.text.slice(w.ch),k),k=f(1,h.length-1),1<r&&a.remove(g.line+1,r-1),a.insert(g.line+1,k));ma(a,"change",a,b)}function nb(a,b,c){function d(a,
e,f){if(a.linked)for(var g=0;g<a.linked.length;++g){var w=a.linked[g];if(w.doc!=e){var h=f&&w.sharedHist;if(!c||h)b(w.doc,h),d(w.doc,a,h)}}}d(a,null,!0)}function af(a,b){if(b.cm)throw Error("This document is already in use.");a.doc=b;b.cm=a;ud(a);Fd(a);bf(a);a.options.lineWrapping||$c(a);a.options.mode=b.modeOption;sa(a)}function bf(a){("rtl"==a.doc.direction?v:jb)(a.display.lineDiv,"CodeMirror-rtl")}function Ag(a){ua(a,function(){bf(a);sa(a)})}function Mc(a){this.done=[];this.undone=[];this.undoDepth=
Infinity;this.lastModTime=this.lastSelTime=0;this.lastOrigin=this.lastSelOrigin=this.lastOp=this.lastSelOp=null;this.generation=this.maxGeneration=a||1}function Hd(a,b){var c={from:M(b.from),to:Ya(b),text:N(a,b.from,b.to)};cf(a,c,b.from.line,b.to.line+1);nb(a,function(a){return cf(a,c,b.from.line,b.to.line+1)},!0);return c}function df(a){for(;a.length;)if(n(a).ranges)a.pop();else break}function ef(a,b,c,d){var e=a.history;e.undone.length=0;var f=+new Date,g;if(g=e.lastOp==d||e.lastOrigin==b.origin&&
b.origin&&("+"==b.origin.charAt(0)&&a.cm&&e.lastModTime>f-a.cm.options.historyEventDelay||"*"==b.origin.charAt(0))){if(e.lastOp==d){df(e.done);var h=n(e.done)}else e.done.length&&!n(e.done).ranges?h=n(e.done):1<e.done.length&&!e.done[e.done.length-2].ranges?(e.done.pop(),h=n(e.done)):h=void 0;g=h}if(g){var w=n(h.changes);0==P(b.from,b.to)&&0==P(b.from,w.to)?w.to=Ya(b):h.changes.push(Hd(a,b))}else for((h=n(e.done))&&h.ranges||Nc(a.sel,e.done),h={changes:[Hd(a,b)],generation:e.generation},e.done.push(h);e.done.length>
e.undoDepth;)e.done.shift(),e.done[0].ranges||e.done.shift();e.done.push(c);e.generation=++e.maxGeneration;e.lastModTime=e.lastSelTime=f;e.lastOp=e.lastSelOp=d;e.lastOrigin=e.lastSelOrigin=b.origin;w||ea(a,"historyAdded")}function Nc(a,b){var c=n(b);c&&c.ranges&&c.equals(a)||b.push(a)}function cf(a,b,c,d){var e=b["spans_"+a.id],f=0;a.iter(Math.max(a.first,c),Math.min(a.first+a.size,d),function(c){c.markedSpans&&((e||(e=b["spans_"+a.id]={}))[f]=c.markedSpans);++f})}function Bg(a){if(!a)return null;
for(var b,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return b?b.length?b:null:a}function ff(a,b){var c;if(c=b["spans_"+a.id]){for(var d=[],e=0;e<b.text.length;++e)d.push(Bg(c[e]));c=d}else c=null;a=Ib(a,b);if(!c)return a;if(!a)return c;for(b=0;b<c.length;++b)if(d=c[b],e=a[b],d&&e){var f=0;a:for(;f<e.length;++f){for(var g=e[f],h=0;h<d.length;++h)if(d[h].marker==g.marker)continue a;d.push(g)}}else e&&(c[b]=e);return c}function zb(a,b,c){for(var e=[],f=0;f<a.length;++f){var g=
a[f];if(g.ranges)e.push(c?ya.prototype.deepCopy.call(g):g);else{g=g.changes;var h=[];e.push({changes:h});for(var w=0;w<g.length;++w){var l=g[w],m;h.push({from:l.from,to:l.to,text:l.text});if(b)for(var x in l)(m=x.match(/^spans_(\d+)$/))&&-1<d(b,Number(m[1]))&&(n(h)[x]=l[x],delete l[x])}}}return e}function Id(a,b,c,d){return d?(a=a.anchor,c&&(d=0>P(b,a),d!=0>P(c,a)?(a=b,b=c):d!=0>P(b,c)&&(b=c)),new Z(a,b)):new Z(c||b,b)}function Oc(a,b,c,d,e){null==e&&(e=a.cm&&(a.cm.display.shift||a.extend));na(a,
new ya([Id(a.sel.primary(),b,c,e)],0),d)}function gf(a,b,c){for(var d=[],e=a.cm&&(a.cm.display.shift||a.extend),f=0;f<a.sel.ranges.length;f++)d[f]=Id(a.sel.ranges[f],b[f],null,e);b=Ga(d,a.sel.primIndex);na(a,b,c)}function Jd(a,b,c,d){var e=a.sel.ranges.slice(0);e[b]=c;na(a,Ga(e,a.sel.primIndex),d)}function Cg(a,b,c){c={ranges:b.ranges,update:function(b){this.ranges=[];for(var c=0;c<b.length;c++)this.ranges[c]=new Z(O(a,b[c].anchor),O(a,b[c].head))},origin:c&&c.origin};ea(a,"beforeSelectionChange",
a,c);a.cm&&ea(a.cm,"beforeSelectionChange",a.cm,c);return c.ranges!=b.ranges?Ga(c.ranges,c.ranges.length-1):b}function hf(a,b,c){var d=a.history.done,e=n(d);e&&e.ranges?(d[d.length-1]=b,Pc(a,b,c)):na(a,b,c)}function na(a,b,c){Pc(a,b,c);b=a.sel;var d=a.cm?a.cm.curOp.id:NaN,e=a.history,f=c&&c.origin,g;if(!(g=d==e.lastSelOp)&&(g=f&&e.lastSelOrigin==f)&&!(g=e.lastModTime==e.lastSelTime&&e.lastOrigin==f)){g=n(e.done);var h=f.charAt(0);g="*"==h||"+"==h&&g.ranges.length==b.ranges.length&&g.somethingSelected()==
b.somethingSelected()&&new Date-a.history.lastSelTime<=(a.cm?a.cm.options.historyEventDelay:500)}g?e.done[e.done.length-1]=b:Nc(b,e.done);e.lastSelTime=+new Date;e.lastSelOrigin=f;e.lastSelOp=d;c&&!1!==c.clearRedo&&df(e.undone)}function Pc(a,b,c){if(Ba(a,"beforeSelectionChange")||a.cm&&Ba(a.cm,"beforeSelectionChange"))b=Cg(a,b,c);var d=c&&c.bias||(0>P(b.primary().head,a.sel.primary().head)?-1:1);jf(a,kf(a,b,d,!0));c&&!1===c.scroll||!a.cm||wb(a.cm)}function jf(a,b){b.equals(a.sel)||(a.sel=b,a.cm&&
(a.cm.curOp.updateInput=a.cm.curOp.selectionChanged=!0,ae(a.cm)),ma(a,"cursorActivity",a))}function lf(a){jf(a,kf(a,a.sel,null,!1))}function kf(a,b,c,d){for(var e,f=0;f<b.ranges.length;f++){var g=b.ranges[f],h=b.ranges.length==a.sel.ranges.length&&a.sel.ranges[f],w=Kd(a,g.anchor,h&&h.anchor,c,d);h=Kd(a,g.head,h&&h.head,c,d);if(e||w!=g.anchor||h!=g.head)e||(e=b.ranges.slice(0,f)),e[f]=new Z(w,h)}return e?Ga(e,b.primIndex):b}function Ab(a,b,c,d,e){var f=K(a,b.line);if(f.markedSpans)for(var g=0;g<f.markedSpans.length;++g){var h=
f.markedSpans[g],w=h.marker;if((null==h.from||(w.inclusiveLeft?h.from<=b.ch:h.from<b.ch))&&(null==h.to||(w.inclusiveRight?h.to>=b.ch:h.to>b.ch))){if(e&&(ea(w,"beforeCursorEnter"),w.explicitlyCleared))if(f.markedSpans){--g;continue}else break;if(w.atomic){if(c){g=w.find(0>d?1:-1);h=void 0;if(0>d?w.inclusiveRight:w.inclusiveLeft)g=mf(a,g,-d,g&&g.line==b.line?f:null);if(g&&g.line==b.line&&(h=P(g,c))&&(0>d?0>h:0<h))return Ab(a,g,b,d,e)}c=w.find(0>d?-1:1);if(0>d?w.inclusiveLeft:w.inclusiveRight)c=mf(a,
c,d,c.line==b.line?f:null);return c?Ab(a,c,b,d,e):null}}}return b}function Kd(a,b,c,d,e){d=d||1;b=Ab(a,b,c,d,e)||!e&&Ab(a,b,c,d,!0)||Ab(a,b,c,-d,e)||!e&&Ab(a,b,c,-d,!0);return b?b:(a.cantEdit=!0,I(a.first,0))}function mf(a,b,c,d){return 0>c&&0==b.ch?b.line>a.first?O(a,I(b.line-1)):null:0<c&&b.ch==(d||K(a,b.line)).text.length?b.line<a.first+a.size-1?I(b.line+1,0):null:new I(b.line,b.ch+c)}function nf(a){a.setSelection(I(a.firstLine(),0),I(a.lastLine()),La)}function of(a,b,c){var d={canceled:!1,from:b.from,
to:b.to,text:b.text,origin:b.origin,cancel:function(){return d.canceled=!0}};c&&(d.update=function(b,c,e,f){b&&(d.from=O(a,b));c&&(d.to=O(a,c));e&&(d.text=e);void 0!==f&&(d.origin=f)});ea(a,"beforeChange",a,d);a.cm&&ea(a.cm,"beforeChange",a.cm,d);return d.canceled?null:{from:d.from,to:d.to,text:d.text,origin:d.origin}}function Bb(a,b,c){if(a.cm){if(!a.cm.curOp)return ka(a.cm,Bb)(a,b,c);if(a.cm.state.suppressEdits)return}if(Ba(a,"beforeChange")||a.cm&&Ba(a.cm,"beforeChange"))if(b=of(a,b,!0),!b)return;
if(c=pf&&!c&&ag(a,b.from,b.to))for(var d=c.length-1;0<=d;--d)qf(a,{from:c[d].from,to:c[d].to,text:d?[""]:b.text,origin:b.origin});else qf(a,b)}function qf(a,b){if(1!=b.text.length||""!=b.text[0]||0!=P(b.from,b.to)){var c=Ed(a,b);ef(a,b,c,a.cm?a.cm.curOp.id:NaN);ac(a,b,c,Ib(a,b));var e=[];nb(a,function(a,c){c||-1!=d(e,a.history)||(rf(a.history,b),e.push(a.history));ac(a,b,null,Ib(a,b))})}}function Qc(a,b,c){if(!a.cm||!a.cm.state.suppressEdits||c){for(var e=a.history,f,g=a.sel,h="undo"==b?e.done:e.undone,
w="undo"==b?e.undone:e.done,l=0;l<h.length&&(f=h[l],c?!f.ranges||f.equals(a.sel):f.ranges);l++);if(l!=h.length){for(e.lastOrigin=e.lastSelOrigin=null;;)if(f=h.pop(),f.ranges){Nc(f,w);if(c&&!f.equals(a.sel)){na(a,f,{clearRedo:!1});return}g=f}else break;var m=[];Nc(g,w);w.push({changes:m,generation:e.generation});e.generation=f.generation||++e.maxGeneration;var x=Ba(a,"beforeChange")||a.cm&&Ba(a.cm,"beforeChange");c=function(c){var e=f.changes[c];e.origin=b;if(x&&!of(a,e,!1))return h.length=0,{};m.push(Hd(a,
e));var g=c?Ed(a,e):n(h);ac(a,e,g,ff(a,e));!c&&a.cm&&a.cm.scrollIntoView({from:e.from,to:Ya(e)});var w=[];nb(a,function(a,b){b||-1!=d(w,a.history)||(rf(a.history,e),w.push(a.history));ac(a,e,null,ff(a,e))})};for(e=f.changes.length-1;0<=e;--e)if(g=c(e))return g.v}}}function sf(a,b){if(0!=b&&(a.first+=b,a.sel=new ya(C(a.sel.ranges,function(a){return new Z(I(a.anchor.line+b,a.anchor.ch),I(a.head.line+b,a.head.ch))}),a.sel.primIndex),a.cm)){sa(a.cm,a.first,a.first-b,b);for(var c=a.cm.display,d=c.viewFrom;d<
c.viewTo;d++)Xa(a.cm,d,"gutter")}}function ac(a,b,c,d){if(a.cm&&!a.cm.curOp)return ka(a.cm,ac)(a,b,c,d);if(b.to.line<a.first)sf(a,b.text.length-1-(b.to.line-b.from.line));else if(!(b.from.line>a.lastLine())){if(b.from.line<a.first){var e=b.text.length-1-(a.first-b.from.line);sf(a,e);b={from:I(a.first,0),to:I(b.to.line+e,b.to.ch),text:[n(b.text)],origin:b.origin}}e=a.lastLine();b.to.line>e&&(b={from:b.from,to:I(e,K(a,e).text.length),text:[b.text[0]],origin:b.origin});b.removed=N(a,b.from,b.to);c||
(c=Ed(a,b));a.cm?Dg(a.cm,b,d):Gd(a,b,d);Pc(a,c,La)}}function Dg(a,b,c){var d=a.doc,e=a.display,f=b.from,g=b.to,h=!1,w=f.line;a.options.lineWrapping||(w=L(Ha(K(d,f.line))),d.iter(w,g.line+1,function(a){if(a==e.maxLine)return h=!0}));-1<d.sel.contains(b.from,b.to)&&ae(a);Gd(d,b,c,Ge(a));a.options.lineWrapping||(d.iter(w,f.line+b.text.length,function(a){var b=wc(a);b>e.maxLineLength&&(e.maxLine=a,e.maxLineLength=b,e.maxLineChanged=!0,h=!1)}),h&&(a.curOp.updateMaxLine=!0));ig(d,f.line);Yb(a,400);c=b.text.length-
(g.line-f.line)-1;b.full?sa(a):f.line!=g.line||1!=b.text.length||$e(a.doc,b)?sa(a,f.line,g.line+1,c):Xa(a,f.line,"text");c=Ba(a,"changes");if((d=Ba(a,"change"))||c)b={from:f,to:g,text:b.text,removed:b.removed,origin:b.origin},d&&ma(a,"change",a,b),c&&(a.curOp.changeObjs||(a.curOp.changeObjs=[])).push(b);a.display.selForContextMenu=null}function Cb(a,b,c,d,e){d||(d=c);if(0>P(d,c)){var f=[d,c];c=f[0];d=f[1];f}"string"==typeof b&&(b=a.splitLines(b));Bb(a,{from:c,to:d,text:b,origin:e})}function tf(a,
b,c,d){c<a.line?a.line+=d:b<a.line&&(a.line=b,a.ch=0)}function uf(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e],g=!0;if(f.ranges)for(f.copied||(f=a[e]=f.deepCopy(),f.copied=!0),g=0;g<f.ranges.length;g++)tf(f.ranges[g].anchor,b,c,d),tf(f.ranges[g].head,b,c,d);else{for(var h=0;h<f.changes.length;++h){var w=f.changes[h];if(c<w.from.line)w.from=I(w.from.line+d,w.from.ch),w.to=I(w.to.line+d,w.to.ch);else if(b<=w.to.line){g=!1;break}}g||(a.splice(0,e+1),e=0)}}}function rf(a,b){var c=b.from.line,d=b.to.line;
b=b.text.length-(d-c)-1;uf(a.done,c,d,b);uf(a.undone,c,d,b)}function bc(a,b,c,d){var e=b,f=b;"number"==typeof b?f=K(a,Math.max(a.first,Math.min(b,a.first+a.size-1))):e=L(b);if(null==e)return null;d(f,e)&&a.cm&&Xa(a.cm,e,c);return f}function cc(a){this.lines=a;this.parent=null;for(var b=0,c=0;c<a.length;++c)a[c].parent=this,b+=a[c].height;this.height=b}function dc(a){this.children=a;for(var b=0,c=0,d=0;d<a.length;++d){var e=a[d];b+=e.chunkSize();c+=e.height;e.parent=this}this.size=b;this.height=c;
this.parent=null}function Eg(a,b,c,d){var e=new ec(a,c,d),f=a.cm;f&&e.noHScroll&&(f.display.alignWidgets=!0);bc(a,b,"widget",function(b){var c=b.widgets||(b.widgets=[]);null==e.insertAt?c.push(e):c.splice(Math.min(c.length-1,Math.max(0,e.insertAt)),0,e);e.line=b;f&&!bb(a,b)&&(c=Ia(b)<a.scrollTop,T(b,b.height+Rb(e)),c&&Hc(f,e.height),f.curOp.forceUpdate=!0);return!0});ma(f,"lineWidgetAdded",f,e,"number"==typeof b?b:L(b));return e}function Db(a,c,d,e,f){if(e&&e.shared)return Fg(a,c,d,e,f);if(a.cm&&
!a.cm.curOp)return ka(a.cm,Db)(a,c,d,e,f);var h=new Za(a,f);f=P(c,d);e&&g(e,h,!1);if(0<f||0==f&&!1!==h.clearWhenEmpty)return h;h.replacedWith&&(h.collapsed=!0,h.widgetNode=b("span",[h.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||h.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(h.widgetNode.insertLeft=!0));if(h.collapsed){if(vc(a,c.line,c,d,h)||c.line!=d.line&&vc(a,d.line,c,d,h))throw Error("Inserting collapsed marker partially overlapping an existing one");Va=!0}h.addToHistory&&
ef(a,{from:c,to:d,origin:"markText"},a.sel,NaN);var w=c.line,l=a.cm,m;a.iter(w,d.line+1,function(a){l&&h.collapsed&&!l.options.lineWrapping&&Ha(a)==l.display.maxLine&&(m=!0);h.collapsed&&w!=c.line&&T(a,0);var b=new Ta(h,w==c.line?c.ch:null,w==d.line?d.ch:null);a.markedSpans=a.markedSpans?a.markedSpans.concat([b]):[b];b.marker.attachLine(a);++w});h.collapsed&&a.iter(c.line,d.line+1,function(b){bb(a,b)&&T(b,0)});h.clearOnEnter&&Q(h,"beforeCursorEnter",function(){return h.clear()});h.readOnly&&(pf=!0,
(a.history.done.length||a.history.undone.length)&&a.clearHistory());h.collapsed&&(h.id=++vf,h.atomic=!0);if(l){m&&(l.curOp.updateMaxLine=!0);if(h.collapsed)sa(l,c.line,d.line+1);else if(h.className||h.title||h.startStyle||h.endStyle||h.css)for(e=c.line;e<=d.line;e++)Xa(l,e,"text");h.atomic&&lf(l.doc);ma(l,"markerAdded",l,h)}return h}function Fg(a,b,c,d,e){d=g(d);d.shared=!1;var f=[Db(a,b,c,d,e)],h=f[0],w=d.widgetNode;nb(a,function(a){w&&(d.widgetNode=w.cloneNode(!0));f.push(Db(a,O(a,b),O(a,c),d,e));
for(var g=0;g<a.linked.length;++g)if(a.linked[g].isParent)return;h=n(f)});return new fc(f,h)}function wf(a){return a.findMarks(I(a.first,0),a.clipPos(I(a.lastLine())),function(a){return a.parent})}function Gg(a){for(var b=function(b){b=a[b];var c=[b.primary.doc];nb(b.primary.doc,function(a){return c.push(a)});for(var e=0;e<b.markers.length;e++){var f=b.markers[e];-1==d(c,f.doc)&&(f.parent=null,b.markers.splice(e--,1))}},c=0;c<a.length;c++)b(c)}function Hg(a){var b=this;xf(b);if(!ja(b,a)&&!Qa(b.display,
a)){pa(a);X&&(yf=+new Date);var c=ib(b,a,!0),e=a.dataTransfer.files;if(c&&!b.isReadOnly())if(e&&e.length&&window.FileReader&&window.File)for(var f=e.length,g=Array(f),h=0,w=function(a,e){if(!b.options.allowDropFileTypes||-1!=d(b.options.allowDropFileTypes,a.type)){var w=new FileReader;w.onload=ka(b,function(){var a=w.result;/[\x00-\x08\x0e-\x1f]{2}/.test(a)&&(a="");g[e]=a;++h==f&&(c=O(b.doc,c),a={from:c,to:c,text:b.doc.splitLines(g.join(b.doc.lineSeparator())),origin:"paste"},Bb(b.doc,a),hf(b.doc,
Ra(c,Ya(a))))});w.readAsText(a)}},l=0;l<f;++l)w(e[l],l);else if(b.state.draggingText&&-1<b.doc.sel.contains(c))b.state.draggingText(a),setTimeout(function(){return b.display.input.focus()},20);else try{if(w=a.dataTransfer.getData("Text")){b.state.draggingText&&!b.state.draggingText.copy&&(l=b.listSelections());Pc(b.doc,Ra(c,c));if(l)for(e=0;e<l.length;++e)Cb(b.doc,"",l[e].anchor,l[e].head,"drag");b.replaceSelection(w,"around","paste");b.display.input.focus()}}catch(mh){}}}function xf(a){a.display.dragCursor&&
(a.display.lineSpace.removeChild(a.display.dragCursor),a.display.dragCursor=null)}function zf(a){if(document.getElementsByClassName)for(var b=document.getElementsByClassName("CodeMirror"),c=0;c<b.length;c++){var d=b[c].CodeMirror;d&&a(d)}}function Ig(){var a;Q(window,"resize",function(){null==a&&(a=setTimeout(function(){a=null;zf(Jg)},100))});Q(window,"blur",function(){return zf(Vb)})}function Jg(a){var b=a.display;if(b.lastWrapHeight!=b.wrapper.clientHeight||b.lastWrapWidth!=b.wrapper.clientWidth)b.cachedCharWidth=
b.cachedTextHeight=b.cachedPaddingH=null,b.scrollbarsClipped=!1,a.setSize()}function Kg(a){var b=a.split(/-(?!$)/);a=b[b.length-1];for(var c,d,e,f,g=0;g<b.length-1;g++){var h=b[g];if(/^(cmd|meta|m)$/i.test(h))f=!0;else if(/^a(lt)?$/i.test(h))c=!0;else if(/^(c|ctrl|control)$/i.test(h))d=!0;else if(/^s(hift)?$/i.test(h))e=!0;else throw Error("Unrecognized modifier name: "+h);}c&&(a="Alt-"+a);d&&(a="Ctrl-"+a);f&&(a="Cmd-"+a);e&&(a="Shift-"+a);return a}function Lg(a){var b={},c;for(c in a)if(a.hasOwnProperty(c)){var d=
a[c];if(!/^(name|fallthrough|(de|at)tach)$/.test(c)){if("..."!=d)for(var e=C(c.split(" "),Kg),f=0;f<e.length;f++){if(f==e.length-1){var g=e.join(" ");var h=d}else g=e.slice(0,f+1).join(" "),h="...";var w=b[g];if(!w)b[g]=h;else if(w!=h)throw Error("Inconsistent bindings for "+g);}delete a[c]}}for(var l in b)a[l]=b[l];return a}function Eb(a,b,c,d){b=Rc(b);var e=b.call?b.call(a,d):b[a];if(!1===e)return"nothing";if("..."===e)return"multi";if(null!=e&&c(e))return"handled";if(b.fallthrough){if("[object Array]"!=
Object.prototype.toString.call(b.fallthrough))return Eb(a,b.fallthrough,c,d);for(e=0;e<b.fallthrough.length;e++){var f=Eb(a,b.fallthrough[e],c,d);if(f)return f}}}function Af(a){a="string"==typeof a?a:$a[a.keyCode];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Bf(a,b,c){var d=a;b.altKey&&"Alt"!=d&&(a="Alt-"+a);(Cf?b.metaKey:b.ctrlKey)&&"Ctrl"!=d&&(a="Ctrl-"+a);(Cf?b.ctrlKey:b.metaKey)&&"Cmd"!=d&&(a="Cmd-"+a);!c&&b.shiftKey&&"Shift"!=d&&(a="Shift-"+a);return a}function Df(a,b){if(Fa&&34==
a.keyCode&&a["char"])return!1;var c=$a[a.keyCode];return null==c||a.altGraphKey?!1:Bf(c,a,b)}function Rc(a){return"string"==typeof a?gc[a]:a}function Fb(a,b){for(var c=a.doc.sel.ranges,d=[],e=0;e<c.length;e++){for(var f=b(c[e]);d.length&&0>=P(f.from,n(d).to);){var g=d.pop();if(0>P(g.from,f.from)){f.from=g.from;break}}d.push(f)}ua(a,function(){for(var b=d.length-1;0<=b;b--)Cb(a.doc,"",d[b].from,d[b].to,"+delete");wb(a)})}function Ld(a,b,c){b=J(a.text,b+c,c);return 0>b||b>a.text.length?null:b}function Md(a,
b,c){a=Ld(a,b.ch,c);return null==a?null:new I(b.line,a,0>c?"after":"before")}function Nd(a,b,c,d,e){if(a&&(a=Pa(c,b.doc.direction))){a=0>e?n(a):a[0];var f=0>e==(1==a.level)?"after":"before";if(0<a.level||"rtl"==b.doc.direction){var g=fb(b,c);var h=0>e?c.text.length-1:0;var w=Da(b,g,h).top;h=F(function(a){return Da(b,g,a).top==w},0>e==(1==a.level)?a.from:a.to-1,h);"before"==f&&(h=Ld(c,h,1))}else h=0>e?a.to:a.from;return new I(d,h,f)}return new I(d,0>e?c.text.length:0,0>e?"before":"after")}function Mg(a,
b,c,d){var e=Pa(b,a.doc.direction);if(!e)return Md(b,c,d);c.ch>=b.text.length?(c.ch=b.text.length,c.sticky="before"):0>=c.ch&&(c.ch=0,c.sticky="after");var f=Jb(e,c.ch,c.sticky),g=e[f];if("ltr"==a.doc.direction&&0==g.level%2&&(0<d?g.to>c.ch:g.from<c.ch))return Md(b,c,d);var h=function(a,c){return Ld(b,a instanceof I?a.ch:a,c)},w,l=function(c){if(!a.options.lineWrapping)return{begin:0,end:b.text.length};w=w||fb(a,b);return Fe(a,b,w,c)},m=l("before"==c.sticky?h(c,-1):c.ch);if("rtl"==a.doc.direction||
1==g.level){var k=1==g.level==0>d,r=h(c,k?1:-1);if(null!=r&&(k?r<=g.to&&r<=m.end:r>=g.from&&r>=m.begin))return new I(c.line,r,k?"before":"after")}g=function(a,b,d){for(var f=function(a,b){return b?new I(c.line,h(a,1),"before"):new I(c.line,a,"after")};0<=a&&a<e.length;a+=b){var g=e[a],w=0<b==(1!=g.level),l=w?d.begin:h(d.end,-1);if(g.from<=l&&l<g.to)return f(l,w);l=w?g.from:h(g.to,-1);if(d.begin<=l&&l<d.end)return f(l,w)}};if(f=g(f+d,d,m))return f;m=0<d?m.end:h(m.begin,-1);return null==m||0<d&&m==
b.text.length||!(f=g(0<d?0:e.length-1,d,l(m)))?null:f}function Ef(a,b){var c=K(a.doc,b),d=Ha(c);d!=c&&(b=L(d));return Nd(!0,a,d,b,1)}function Ff(a,b){var c=Ef(a,b.line),d=K(a.doc,c.line);a=Pa(d,a.doc.direction);return a&&0!=a[0].level?c:(d=Math.max(0,d.text.search(/\S/)),I(c.line,b.line==c.line&&b.ch<=d&&b.ch?0:d,c.sticky))}function Sc(a,b,c){if("string"==typeof b&&(b=hc[b],!b))return!1;a.display.input.ensurePolled();var d=a.display.shift,e=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),c&&(a.display.shift=
!1),e=b(a)!=Tc}finally{a.display.shift=d,a.state.suppressEdits=!1}return e}function Ng(a,b,c){for(var d=0;d<a.state.keyMaps.length;d++){var e=Eb(b,a.state.keyMaps[d],c,a);if(e)return e}return a.options.extraKeys&&Eb(b,a.options.extraKeys,c,a)||Eb(b,a.options.keyMap,c,a)}function ic(a,b,c,d){var e=a.state.keySeq;if(e){if(Af(b))return"handled";Og.set(50,function(){a.state.keySeq==e&&(a.state.keySeq=null,a.display.input.reset())});b=e+" "+b}d=Ng(a,b,d);"multi"==d&&(a.state.keySeq=b);"handled"==d&&ma(a,
"keyHandled",a,b,c);if("handled"==d||"multi"==d)pa(c),vd(a);return e&&!d&&/\'$/.test(b)?(pa(c),!0):!!d}function Gf(a,b){var c=Df(b,!0);return c?b.shiftKey&&!a.state.keySeq?ic(a,"Shift-"+c,b,function(b){return Sc(a,b,!0)})||ic(a,c,b,function(b){if("string"==typeof b?/^go[A-Z]/.test(b):b.motion)return Sc(a,b)}):ic(a,c,b,function(b){return Sc(a,b)}):!1}function Pg(a,b,c){return ic(a,"'"+c+"'",b,function(b){return Sc(a,b,!0)})}function Hf(a){this.curOp.focus=u();if(!ja(this,a)){X&&11>ba&&27==a.keyCode&&
(a.returnValue=!1);var b=a.keyCode;this.display.shift=16==b||a.shiftKey;var c=Gf(this,a);Fa&&(Od=c?b:null,!c&&88==b&&!Qg&&(Ca?a.metaKey:a.ctrlKey)&&this.replaceSelection("",null,"cut"));18!=b||/\bCodeMirror-crosshair\b/.test(this.display.lineDiv.className)||Rg(this)}}function Rg(a){function b(a){18!=a.keyCode&&a.altKey||(jb(c,"CodeMirror-crosshair"),wa(document,"keyup",b),wa(document,"mouseover",b))}var c=a.display.lineDiv;v(c,"CodeMirror-crosshair");Q(document,"keyup",b);Q(document,"mouseover",b)}
function If(a){16==a.keyCode&&(this.doc.sel.shift=!1);ja(this,a)}function Jf(a){if(!(Qa(this.display,a)||ja(this,a)||a.ctrlKey&&!a.altKey||Ca&&a.metaKey)){var b=a.keyCode,c=a.charCode;if(Fa&&b==Od)Od=null,pa(a);else if(!Fa||a.which&&!(10>a.which)||!Gf(this,a))if(b=String.fromCharCode(null==c?b:c),"\b"!=b&&!Pg(this,a,b))this.display.input.onKeyPress(a)}}function Sg(a,b){var c=+new Date;if(jc&&jc.compare(c,a,b))return kc=jc=null,"triple";if(kc&&kc.compare(c,a,b))return jc=new Pd(c,a,b),kc=null,"double";
kc=new Pd(c,a,b);jc=null;return"single"}function Kf(a){var b=this.display;if(!(ja(this,a)||b.activeTouch&&b.input.supportsTouch()))if(b.input.ensurePolled(),b.shift=a.shiftKey,Qa(b,a))oa||(b.scroller.draggable=!1,setTimeout(function(){return b.scroller.draggable=!0},100));else if(!Uc(this,a,"gutterClick",!0)){var c=ib(this,a),d=ce(a),e=c?Sg(c,d):"single";window.focus();1==d&&this.state.selectingText&&this.state.selectingText(a);c&&Tg(this,d,c,e,a)||(1==d?c?Ug(this,c,e,a):(a.target||a.srcElement)==
b.scroller&&pa(a):2==d?(c&&Oc(this.doc,c),setTimeout(function(){return b.input.focus()},20)):3==d&&(Qd?Lf(this,a):Ke(this)))}}function Tg(a,b,c,d,e){var f="Click";"double"==d?f="Double"+f:"triple"==d&&(f="Triple"+f);return ic(a,Bf((1==b?"Left":2==b?"Middle":"Right")+f,e),e,function(b){"string"==typeof b&&(b=hc[b]);if(!b)return!1;var d=!1;try{a.isReadOnly()&&(a.state.suppressEdits=!0),d=b(a,c)!=Tc}finally{a.state.suppressEdits=!1}return d})}function Ug(a,b,c,d){X?setTimeout(l(Je,a),0):a.curOp.focus=
u();var e=a.getOption("configureMouse");e=e?e(a,c,d):{};null==e.unit&&(e.unit=(Vg?d.shiftKey&&d.metaKey:d.altKey)?"rectangle":"single"==c?"char":"double"==c?"word":"line");if(null==e.extend||a.doc.extend)e.extend=a.doc.extend||d.shiftKey;null==e.addNew&&(e.addNew=Ca?d.metaKey:d.ctrlKey);null==e.moveOnDrag&&(e.moveOnDrag=!(Ca?d.altKey:d.ctrlKey));var f=a.doc.sel,g;a.options.dragDrop&&Wg&&!a.isReadOnly()&&"single"==c&&-1<(g=f.contains(b))&&(0>P((g=f.ranges[g]).from(),b)||0<b.xRel)&&(0<P(g.to(),b)||
0>b.xRel)?Xg(a,d,b,e):Yg(a,d,b,e)}function Xg(a,b,c,d){var e=a.display,f=!1,g=ka(a,function(b){oa&&(e.scroller.draggable=!1);a.state.draggingText=!1;wa(document,"mouseup",g);wa(document,"mousemove",h);wa(e.scroller,"dragstart",l);wa(e.scroller,"drop",g);f||(pa(b),d.addNew||Oc(a.doc,c,null,null,d.extend),oa||X&&9==ba?setTimeout(function(){document.body.focus();e.input.focus()},20):e.input.focus())}),h=function(a){f=f||10<=Math.abs(b.clientX-a.clientX)+Math.abs(b.clientY-a.clientY)},l=function(){return f=
!0};oa&&(e.scroller.draggable=!0);a.state.draggingText=g;g.copy=!d.moveOnDrag;e.scroller.dragDrop&&e.scroller.dragDrop();Q(document,"mouseup",g);Q(document,"mousemove",h);Q(e.scroller,"dragstart",l);Q(e.scroller,"drop",g);Ke(a);setTimeout(function(){return e.input.focus()},20)}function Mf(a,b,c){if("char"==c)return new Z(b,b);if("word"==c)return a.findWordAt(b);if("line"==c)return new Z(I(b.line,0),O(a.doc,I(b.line+1,0)));a=c(a,b);return new Z(a.from,a.to)}function Yg(a,b,c,d){function f(b){if(0!=
P(p,b))if(p=b,"rectangle"==d.unit){var f=[],g=a.options.tabSize,l=e(K(m,c.line).text,c.ch,g),w=e(K(m,b.line).text,b.ch,g),r=Math.min(l,w);l=Math.max(l,w);w=Math.min(c.line,b.line);for(var u=Math.min(a.lastLine(),Math.max(c.line,b.line));w<=u;w++){var v=K(m,w).text,x=h(v,r,g);r==l?f.push(new Z(I(w,x),I(w,x))):v.length>x&&f.push(new Z(I(w,x),I(w,h(v,l,g))))}f.length||f.push(new Z(c,c));na(m,Ga(k.ranges.slice(0,t).concat(f),t),{origin:"*mouse",scroll:!1});a.scrollIntoView(b)}else f=q,r=Mf(a,b,d.unit),
b=f.anchor,0<P(r.anchor,b)?(g=r.head,b=da(f.from(),r.anchor)):(g=r.anchor,b=Oa(f.to(),r.head)),f=k.ranges.slice(0),f[t]=Zg(a,new Z(O(m,b),g)),na(m,Ga(f,t),Rd)}function g(b){var c=++x,e=ib(a,b,!0,"rectangle"==d.unit);if(e)if(0!=P(e,p)){a.curOp.focus=u();f(e);var h=xd(w,m);(e.line>=h.to||e.line<h.from)&&setTimeout(ka(a,function(){x==c&&g(b)}),150)}else{var l=b.clientY<v.top?-20:b.clientY>v.bottom?20:0;l&&setTimeout(ka(a,function(){x==c&&(w.scroller.scrollTop+=l,g(b))}),50)}}function l(b){a.state.selectingText=
!1;x=Infinity;pa(b);w.input.focus();wa(document,"mousemove",n);wa(document,"mouseup",A);m.history.lastSelOrigin=null}var w=a.display,m=a.doc;pa(b);var k=m.sel,r=k.ranges;if(d.addNew&&!d.extend){var t=m.sel.contains(c);var q=-1<t?r[t]:new Z(c,c)}else q=m.sel.primary(),t=m.sel.primIndex;"rectangle"==d.unit?(d.addNew||(q=new Z(c,c)),c=ib(a,b,!0,!0),t=-1):(b=Mf(a,c,d.unit),q=d.extend?Id(q,b.anchor,b.head,d.extend):b);d.addNew?-1==t?(t=r.length,na(m,Ga(r.concat([q]),t),{scroll:!1,origin:"*mouse"})):1<
r.length&&r[t].empty()&&"char"==d.unit&&!d.extend?(na(m,Ga(r.slice(0,t).concat(r.slice(t+1)),0),{scroll:!1,origin:"*mouse"}),k=m.sel):Jd(m,t,q,Rd):(t=0,na(m,new ya([q],0),Rd),k=m.sel);var p=c,v=w.wrapper.getBoundingClientRect(),x=0,n=ka(a,function(a){ce(a)?g(a):l(a)}),A=ka(a,l);a.state.selectingText=A;Q(document,"mousemove",n);Q(document,"mouseup",A)}function Zg(a,b){var c=b.anchor,d=b.head,e=K(a.doc,c.line);if(0==P(c,d)&&c.sticky==d.sticky)return b;e=Pa(e);if(!e)return b;var f=Jb(e,c.ch,c.sticky),
g=e[f];if(g.from!=c.ch&&g.to!=c.ch)return b;var h=f+(g.from==c.ch==(1!=g.level)?0:1);if(0==h||h==e.length)return b;d.line!=c.line?a=0<(d.line-c.line)*("ltr"==a.doc.direction?1:-1):(a=Jb(e,d.ch,d.sticky),f=a-f||(d.ch-c.ch)*(1==g.level?-1:1),a=a==h-1||a==h?0>f:0<f);e=e[h+(a?-1:0)];e=(h=a==(1==e.level))?e.from:e.to;h=h?"after":"before";return c.ch==e&&c.sticky==h?b:new Z(new I(c.line,e,h),d)}function Uc(a,b,c,d){if(b.touches){var e=b.touches[0].clientX;var f=b.touches[0].clientY}else try{e=b.clientX,
f=b.clientY}catch($d){return!1}if(e>=Math.floor(a.display.gutters.getBoundingClientRect().right))return!1;d&&pa(b);d=a.display;var g=d.lineDiv.getBoundingClientRect();if(f>g.bottom||!Ba(a,c))return ad(b);f-=g.top-d.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=d.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=e)return e=S(a.doc,f),ea(a,c,a,e,a.options.gutters[g],b),ad(b)}}function Lf(a,b){var c;(c=Qa(a.display,b))||(c=Ba(a,"gutterContextMenu")?Uc(a,b,"gutterContextMenu",!1):
!1);if(!c&&!ja(a,b,"contextmenu"))a.display.input.onContextMenu(b)}function Nf(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");Tb(a)}function lc(a){Ve(a);sa(a);Me(a)}function $g(a,b,c){!b!=!(c&&c!=Gb)&&(c=a.display.dragFunctions,b=b?Q:wa,b(a.display.scroller,"dragstart",c.start),b(a.display.scroller,"dragenter",c.enter),b(a.display.scroller,"dragover",c.over),b(a.display.scroller,"dragleave",c.leave),b(a.display.scroller,
"drop",c.drop))}function ah(a){a.options.lineWrapping?(v(a.display.wrapper,"CodeMirror-wrap"),a.display.sizer.style.minWidth="",a.display.sizerWidth=null):(jb(a.display.wrapper,"CodeMirror-wrap"),$c(a));ud(a);sa(a);Tb(a);setTimeout(function(){return xb(a)},100)}function ca(a,b){var c=this;if(!(this instanceof ca))return new ca(a,b);this.options=b=b?g(b):{};g(Of,b,!1);Dd(b);var d=b.value;"string"==typeof d&&(d=new ta(d,b.mode,null,b.lineSeparator,b.direction));this.doc=d;var e=new ca.inputStyles[b.inputStyle](this);
a=this.display=new R(a,d,e);a.wrapper.CodeMirror=this;Ve(this);Nf(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");Re(this);this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new ob,keySeq:null,specialChars:null};b.autofocus&&!Kb&&a.input.focus();X&&11>ba&&setTimeout(function(){return c.display.input.reset(!0)},20);bh(this);Pf||(Ig(),Pf=!0);lb(this);
this.curOp.forceUpdate=!0;af(this,d);b.autofocus&&!Kb||this.hasFocus()?setTimeout(l(wd,this),20):Vb(this);for(var f in Vc)if(Vc.hasOwnProperty(f))Vc[f](c,b[f],Gb);Ne(this);b.finishInit&&b.finishInit(this);for(d=0;d<Sd.length;++d)Sd[d](c);mb(this);oa&&b.lineWrapping&&"optimizelegibility"==getComputedStyle(a.lineDiv).textRendering&&(a.lineDiv.style.textRendering="auto")}function bh(b){function c(){e.activeTouch&&(f=setTimeout(function(){return e.activeTouch=null},1E3),g=e.activeTouch,g.end=+new Date)}
function d(a,b){if(null==b.left)return!0;var c=b.left-a.left;a=b.top-a.top;return 400<c*c+a*a}var e=b.display;Q(e.scroller,"mousedown",ka(b,Kf));X&&11>ba?Q(e.scroller,"dblclick",ka(b,function(a){if(!ja(b,a)){var c=ib(b,a);!c||Uc(b,a,"gutterClick",!0)||Qa(b.display,a)||(pa(a),a=b.findWordAt(c),Oc(b.doc,a.anchor,a.head))}})):Q(e.scroller,"dblclick",function(a){return ja(b,a)||pa(a)});Qd||Q(e.scroller,"contextmenu",function(a){return Lf(b,a)});var f,g={end:0};Q(e.scroller,"touchstart",function(a){var c;
if(c=!ja(b,a))1!=a.touches.length?c=!1:(c=a.touches[0],c=1>=c.radiusX&&1>=c.radiusY),c=!c;c&&!Uc(b,a,"gutterClick",!0)&&(e.input.ensurePolled(),clearTimeout(f),c=+new Date,e.activeTouch={start:c,moved:!1,prev:300>=c-g.end?g:null},1==a.touches.length&&(e.activeTouch.left=a.touches[0].pageX,e.activeTouch.top=a.touches[0].pageY))});Q(e.scroller,"touchmove",function(){e.activeTouch&&(e.activeTouch.moved=!0)});Q(e.scroller,"touchend",function(a){var f=e.activeTouch;if(f&&!Qa(e,a)&&null!=f.left&&!f.moved&&
300>new Date-f.start){var g=b.coordsChar(e.activeTouch,"page");f=!f.prev||d(f,f.prev)?new Z(g,g):!f.prev.prev||d(f,f.prev.prev)?b.findWordAt(g):new Z(I(g.line,0),O(b.doc,I(g.line+1,0)));b.setSelection(f.anchor,f.head);b.focus();pa(a)}c()});Q(e.scroller,"touchcancel",c);Q(e.scroller,"scroll",function(){e.scroller.clientHeight&&(Xb(b,e.scroller.scrollTop),kb(b,e.scroller.scrollLeft,!0),ea(b,"scroll",b))});Q(e.scroller,"mousewheel",function(a){return Xe(b,a)});Q(e.scroller,"DOMMouseScroll",function(a){return Xe(b,
a)});Q(e.wrapper,"scroll",function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0});e.dragFunctions={enter:function(a){ja(b,a)||Mb(a)},over:function(c){if(!ja(b,c)){var d=ib(b,c);if(d){var e=document.createDocumentFragment();Ie(b,d,e);b.display.dragCursor||(b.display.dragCursor=a("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),b.display.lineSpace.insertBefore(b.display.dragCursor,b.display.cursorDiv));q(b.display.dragCursor,e)}Mb(c)}},start:function(c){if(X&&(!b.state.draggingText||100>
+new Date-yf))Mb(c);else if(!ja(b,c)&&!Qa(b.display,c)&&(c.dataTransfer.setData("Text",b.getSelection()),c.dataTransfer.effectAllowed="copyMove",c.dataTransfer.setDragImage&&!Qf)){var d=a("img",null,null,"position: fixed; left: 0; top: 0;");d.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";Fa&&(d.width=d.height=1,b.display.wrapper.appendChild(d),d._top=d.offsetTop);c.dataTransfer.setDragImage(d,0,0);Fa&&d.parentNode.removeChild(d)}},drop:ka(b,Hg),leave:function(a){ja(b,
a)||xf(b)}};var h=e.input.getField();Q(h,"keyup",function(a){return If.call(b,a)});Q(h,"keydown",ka(b,Hf));Q(h,"keypress",ka(b,Jf));Q(h,"focus",function(a){return wd(b,a)});Q(h,"blur",function(a){return Vb(b,a)})}function mc(a,b,c,d){var f=a.doc,g;null==c&&(c="add");"smart"==c&&(f.mode.indent?g=Nb(a,b).state:c="prev");var h=a.options.tabSize,l=K(f,b),m=e(l.text,null,h);l.stateAfter&&(l.stateAfter=null);var w=l.text.match(/^\s*/)[0];if(!d&&!/\S/.test(l.text)){var k=0;c="not"}else if("smart"==c&&(k=
f.mode.indent(g,l.text.slice(w.length),l.text),k==Tc||150<k)){if(!d)return;c="prev"}"prev"==c?k=b>f.first?e(K(f,b-1).text,null,h):0:"add"==c?k=m+a.options.indentUnit:"subtract"==c?k=m-a.options.indentUnit:"number"==typeof c&&(k=m+c);k=Math.max(0,k);c="";d=0;if(a.options.indentWithTabs)for(a=Math.floor(k/h);a;--a)d+=h,c+="\t";d<k&&(c+=r(k-d));if(c!=w)return Cb(f,c,I(b,0),I(b,w.length),"+input"),l.stateAfter=null,!0;for(h=0;h<f.sel.ranges.length;h++)if(l=f.sel.ranges[h],l.head.line==b&&l.head.ch<w.length){b=
I(b,w.length);Jd(f,h,new Z(b,b));break}}function Td(a,b,c,d,e){var f=a.doc;a.display.shift=!1;d||(d=f.sel);var g=a.state.pasteIncoming||"paste"==e,h=Ud(b),l=null;if(g&&1<d.ranges.length)if(va&&va.text.join("\n")==b){if(0==d.ranges.length%va.text.length){l=[];for(var m=0;m<va.text.length;m++)l.push(f.splitLines(va.text[m]))}}else h.length==d.ranges.length&&a.options.pasteLinesPerSelection&&(l=C(h,function(a){return[a]}));for(m=d.ranges.length-1;0<=m;m--){var w=d.ranges[m];var k=w.from(),r=w.to();w.empty()&&
(c&&0<c?k=I(k.line,k.ch-c):a.state.overwrite&&!g?r=I(r.line,Math.min(K(f,r.line).text.length,r.ch+n(h).length)):va&&va.lineWise&&va.text.join("\n")==b&&(k=r=I(k.line,0)));w=a.curOp.updateInput;k={from:k,to:r,text:l?l[m%l.length]:h,origin:e||(g?"paste":a.state.cutIncoming?"cut":"+input")};Bb(a.doc,k);ma(a,"inputRead",a,k)}b&&!g&&Rf(a,b);wb(a);a.curOp.updateInput=w;a.curOp.typing=!0;a.state.pasteIncoming=a.state.cutIncoming=!1}function Sf(a,b){var c=a.clipboardData&&a.clipboardData.getData("Text");
if(c)return a.preventDefault(),b.isReadOnly()||b.options.disableInput||ua(b,function(){return Td(b,c,0,null,"paste")}),!0}function Rf(a,b){if(a.options.electricChars&&a.options.smartIndent)for(var c=a.doc.sel,d=c.ranges.length-1;0<=d;d--){var e=c.ranges[d];if(!(100<e.head.ch||d&&c.ranges[d-1].head.line==e.head.line)){var f=a.getModeAt(e.head),g=!1;if(f.electricChars)for(var h=0;h<f.electricChars.length;h++){if(-1<b.indexOf(f.electricChars.charAt(h))){g=mc(a,e.head.line,"smart");break}}else f.electricInput&&
f.electricInput.test(K(a.doc,e.head.line).text.slice(0,e.head.ch))&&(g=mc(a,e.head.line,"smart"));g&&ma(a,"electricInput",a,e.head.line)}}}function Tf(a){for(var b=[],c=[],d=0;d<a.doc.sel.ranges.length;d++){var e=a.doc.sel.ranges[d].head.line;e={anchor:I(e,0),head:I(e+1,0)};c.push(e);b.push(a.getRange(e.anchor,e.head))}return{text:b,ranges:c}}function Uf(a,b){a.setAttribute("autocorrect","off");a.setAttribute("autocapitalize","off");a.setAttribute("spellcheck",!!b)}function Vf(){var b=a("textarea",
null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),c=a("div",[b],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");oa?b.style.width="1000px":b.setAttribute("wrap","off");nc&&(b.style.border="1px solid black");Uf(b);return c}function Vd(a,b,c,d,e){function f(d){var f=e?Mg(a.cm,l,b,c):Md(l,b,c);if(null==f){if(d=!d)d=b.line+c,d<a.first||d>=a.first+a.size?d=!1:(b=new I(d,b.ch,b.sticky),d=l=K(a,d));if(d)b=Nd(e,a.cm,l,b.line,c);else return!1}else b=
f;return!0}var g=b,h=c,l=K(a,b.line);if("char"==d)f();else if("column"==d)f(!0);else if("word"==d||"group"==d){var m=null;d="group"==d;for(var w=a.cm&&a.cm.getHelper(b,"wordChars"),k=!0;!(0>c)||f(!k);k=!1){var r=l.text.charAt(b.ch)||"\n";r=A(r,w)?"w":d&&"\n"==r?"n":!d||/\s/.test(r)?null:"p";!d||k||r||(r="s");if(m&&m!=r){0>c&&(c=1,f(),b.sticky="after");break}r&&(m=r);if(0<c&&!f(!k))break}}h=Kd(a,b,g,h,!0);Na(g,h)&&(h.hitSide=!0);return h}function Wf(a,b,c,d){var e=a.doc,f=b.left;if("page"==d){var g=
Math.max(Math.min(a.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight)-.5*gb(a.display),3);g=(0<c?b.bottom:b.top)+c*g}else"line"==d&&(g=0<c?b.bottom+3:b.top-3);for(;;){b=rd(a,f,g);if(!b.outside)break;if(0>c?0>=g:g>=e.height){b.hitSide=!0;break}g+=5*c}return b}function Xf(a,b){var c=ld(a,b.line);if(!c||c.hidden)return null;var d=K(a.doc,b.line);c=ve(c,d,b.line);a=Pa(d,a.doc.direction);d="left";a&&(d=Jb(a,b.ch)%2?"right":"left");b=we(c.map,b.ch,d);b.offset="right"==
b.collapse?b.end:b.start;return b}function ch(a){for(;a;a=a.parentNode)if(/CodeMirror-gutter-wrapper/.test(a.className))return!0;return!1}function Hb(a,b){b&&(a.bad=!0);return a}function dh(a,b,c,d,e){function f(a){return function(b){return b.id==a}}function g(a){a&&(m&&(l+=w,m=!1),l+=a)}function h(b){if(1==b.nodeType){var c=b.getAttribute("cm-text");if(null!=c)g(c||b.textContent.replace(/\u200b/g,""));else{c=b.getAttribute("cm-marker");var k;if(c)b=a.findMarks(I(d,0),I(e+1,0),f(+c)),b.length&&(k=
b[0].find(0))&&g(N(a.doc,k.from,k.to).join(w));else if("false"!=b.getAttribute("contenteditable")){(k=/^(pre|div|p)$/i.test(b.nodeName))&&m&&(l+=w,m=!1);for(c=0;c<b.childNodes.length;c++)h(b.childNodes[c]);k&&(m=!0)}}}else 3==b.nodeType&&g(b.nodeValue)}for(var l="",m=!1,w=a.doc.lineSeparator();;){h(b);if(b==c)break;b=b.nextSibling}return l}function Wc(a,b,c){if(b==a.display.lineDiv){var d=a.display.lineDiv.childNodes[c];if(!d)return Hb(a.clipPos(I(a.display.viewTo-1)),!0);b=null;c=0}else for(d=b;;d=
d.parentNode){if(!d||d==a.display.lineDiv)return null;if(d.parentNode&&d.parentNode==a.display.lineDiv)break}for(var e=0;e<a.display.view.length;e++){var f=a.display.view[e];if(f.node==d)return eh(f,b,c)}}function eh(a,b,c){function d(b,c,d){for(var e=-1;e<(w?w.length:0);e++)for(var f=0>e?l.map:w[e],g=0;g<f.length;g+=3){var h=f[g+2];if(h==b||h==c){c=L(0>e?a.line:a.rest[e]);e=f[g]+d;if(0>d||h!=b)e=f[g+(d?1:0)];return I(c,e)}}}var e=a.text.firstChild,f=!1;if(!b||!m(e,b))return Hb(I(L(a.line),0),!0);
if(b==e&&(f=!0,b=e.childNodes[c],c=0,!b))return c=a.rest?n(a.rest):a.line,Hb(I(L(c),c.text.length),f);var g=3==b.nodeType?b:null,h=b;g||1!=b.childNodes.length||3!=b.firstChild.nodeType||(g=b.firstChild,c&&(c=g.nodeValue.length));for(;h.parentNode!=e;)h=h.parentNode;var l=a.measure,w=l.maps;if(b=d(g,h,c))return Hb(b,f);e=h.nextSibling;for(g=g?g.nodeValue.length-c:0;e;e=e.nextSibling){if(b=d(e,e.firstChild,0))return Hb(I(b.line,b.ch-g),f);g+=e.textContent.length}for(h=h.previousSibling;h;h=h.previousSibling){if(b=
d(h,h.firstChild,-1))return Hb(I(b.line,b.ch+c),f);c+=h.textContent.length}}var ra=navigator.userAgent,Yf=navigator.platform,Ua=/gecko\/\d/i.test(ra),Zf=/MSIE \d/.test(ra),$f=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(ra),oc=/Edge\/(\d+)/.exec(ra),X=Zf||$f||oc,ba=X&&(Zf?document.documentMode||6:+(oc||$f)[1]),oa=!oc&&/WebKit\//.test(ra),fh=oa&&/Qt\/\d+\.\d+/.test(ra),Cc=!oc&&/Chrome\//.test(ra),Fa=/Opera\//.test(ra),Qf=/Apple Computer/.test(navigator.vendor),gh=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(ra),
wg=/PhantomJS/.test(ra),nc=!oc&&/AppleWebKit/.test(ra)&&/Mobile\/\w+/.test(ra),Dc=/Android/.test(ra),Kb=nc||Dc||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(ra),Ca=nc||/Mac/.test(Yf),Vg=/\bCrOS\b/.test(ra),hh=/win/i.test(Yf),pb=Fa&&ra.match(/Version\/(\d*\.\d*)/);pb&&(pb=Number(pb[1]));pb&&15<=pb&&(Fa=!1,oa=!0);var Cf=Ca&&(fh||Fa&&(null==pb||12.11>pb)),Qd=Ua||X&&9<=ba,jb=function(a,b){var d=a.className;if(b=c(b).exec(d)){var e=d.slice(b.index+b[0].length);a.className=d.slice(0,b.index)+
(e?b[1]+e:"")}};var Ob=document.createRange?function(a,b,c,d){var e=document.createRange();e.setEnd(d||a,c);e.setStart(a,b);return e}:function(a,b,c){var d=document.body.createTextRange();try{d.moveToElementText(a.parentNode)}catch(Aa){return d}d.collapse(!0);d.moveEnd("character",c);d.moveStart("character",b);return d};var pc=function(a){a.select()};nc?pc=function(a){a.selectionStart=0;a.selectionEnd=a.value.length}:X&&(pc=function(a){try{a.select()}catch(x){}});var ob=function(){this.id=null};ob.prototype.set=
function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)};var Tc={toString:function(){return"CodeMirror.Pass"}},La={scroll:!1},Rd={origin:"*mouse"},qc={origin:"+move"},xc=[""],bg=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,cg=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/,
pf=!1,Va=!1,Lb=null,dg=function(){function a(a){return 247>=a?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1785>=a?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(a-
1536):1774<=a&&2220>=a?"r":8192<=a&&8203>=a?"w":8204==a?"b":"L"}function b(a,b,c){this.level=a;this.from=b;this.to=c}var c=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,d=/[stwN]/,e=/[LRr]/,f=/[Lb1n]/,g=/[1n]/;return function(h,l){var m="ltr"==l?"L":"R";if(0==h.length||"ltr"==l&&!c.test(h))return!1;for(var w=h.length,k=[],r=0;r<w;++r)k.push(a(h.charCodeAt(r)));r=0;for(var t=m;r<w;++r){var u=k[r];"m"==u?k[r]=t:t=u}r=0;for(t=m;r<w;++r)u=k[r],"1"==u&&"r"==t?k[r]="n":e.test(u)&&(t=u,"r"==u&&(k[r]="R"));
r=1;for(t=k[0];r<w-1;++r)u=k[r],"+"==u&&"1"==t&&"1"==k[r+1]?k[r]="1":","!=u||t!=k[r+1]||"1"!=t&&"n"!=t||(k[r]=t),t=u;for(r=0;r<w;++r)if(t=k[r],","==t)k[r]="N";else if("%"==t){for(t=r+1;t<w&&"%"==k[t];++t);for(u=r&&"!"==k[r-1]||t<w&&"1"==k[t]?"1":"N";r<t;++r)k[r]=u;r=t-1}r=0;for(t=m;r<w;++r)u=k[r],"L"==t&&"1"==u?k[r]="L":e.test(u)&&(t=u);for(t=0;t<w;++t)if(d.test(k[t])){for(r=t+1;r<w&&d.test(k[r]);++r);u="L"==(t?k[t-1]:m);for(u=u==("L"==(r<w?k[r]:m))?u?"L":"R":m;t<r;++t)k[t]=u;t=r-1}m=[];var q;for(r=
0;r<w;)if(f.test(k[r])){t=r;for(++r;r<w&&f.test(k[r]);++r);m.push(new b(0,t,r))}else{var p=r;t=m.length;for(++r;r<w&&"L"!=k[r];++r);for(u=p;u<r;)if(g.test(k[u])){p<u&&m.splice(t,0,new b(1,p,u));p=u;for(++u;u<r&&g.test(k[u]);++u);m.splice(t,0,new b(2,p,u));p=u}else++u;p<r&&m.splice(t,0,new b(1,p,r))}"ltr"==l&&(1==m[0].level&&(q=h.match(/^\s+/))&&(m[0].from=q[0].length,m.unshift(new b(0,0,q[0].length))),1==n(m).level&&(q=h.match(/\s+$/))&&(n(m).to-=q[0].length,m.push(new b(0,w-q[0].length,w))));return"rtl"==
l?m.reverse():m}}(),yc=[],Q=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),a[b]=(a[b]||yc).concat(c))},Wg=function(){if(X&&9>ba)return!1;var b=a("div");return"draggable"in b||"dragDrop"in b}(),bd,hd,Ud=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=
g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)},ih=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(x){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(W){}return b&&b.parentElement()==a?0!=b.compareEndPoints("StartToEnd",b):!1},Qg=function(){var b=a("div");if("oncopy"in b)return!0;b.setAttribute("oncopy","return;");return"function"==typeof b.oncopy}(),nd=null,cd={},tb={},ub={},fa=function(a,b,c){this.pos=this.start=
0;this.string=a;this.tabSize=b||8;this.lineStart=this.lastColumnPos=this.lastColumnValue=0;this.lineOracle=c};fa.prototype.eol=function(){return this.pos>=this.string.length};fa.prototype.sol=function(){return this.pos==this.lineStart};fa.prototype.peek=function(){return this.string.charAt(this.pos)||void 0};fa.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)};fa.prototype.eat=function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&
(a.test?a.test(b):a(b)))return++this.pos,b};fa.prototype.eatWhile=function(a){for(var b=this.pos;this.eat(a););return this.pos>b};fa.prototype.eatSpace=function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a};fa.prototype.skipToEnd=function(){this.pos=this.string.length};fa.prototype.skipTo=function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0};fa.prototype.backUp=function(a){this.pos-=a};fa.prototype.column=function(){this.lastColumnPos<
this.start&&(this.lastColumnValue=e(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start);return this.lastColumnValue-(this.lineStart?e(this.string,this.lineStart,this.tabSize):0)};fa.prototype.indentation=function(){return e(this.string,null,this.tabSize)-(this.lineStart?e(this.string,this.lineStart,this.tabSize):0)};fa.prototype.match=function(a,b,c){if("string"==typeof a){var d=function(a){return c?a.toLowerCase():a},e=this.string.substr(this.pos,
a.length);if(d(e)==d(a))return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}};fa.prototype.current=function(){return this.string.slice(this.start,this.pos)};fa.prototype.hideFirstChars=function(a,b){this.lineStart+=a;try{return b()}finally{this.lineStart-=a}};fa.prototype.lookAhead=function(a){var b=this.lineOracle;return b&&b.lookAhead(a)};fa.prototype.baseToken=function(){var a=this.lineOracle;
return a&&a.baseToken(this.pos)};var Ac=function(a,b){this.state=a;this.lookAhead=b},Ja=function(a,b,c,d){this.state=b;this.doc=a;this.line=c;this.maxLookAhead=d||0;this.baseTokens=null;this.baseTokenPos=1};Ja.prototype.lookAhead=function(a){var b=this.doc.getLine(this.line+a);null!=b&&a>this.maxLookAhead&&(this.maxLookAhead=a);return b};Ja.prototype.baseToken=function(a){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=a;)this.baseTokenPos+=2;var b=this.baseTokens[this.baseTokenPos+
1];return{type:b&&b.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-a}};Ja.prototype.nextLine=function(){this.line++;0<this.maxLookAhead&&this.maxLookAhead--};Ja.fromSaved=function(a,b,c){return b instanceof Ac?new Ja(a,cb(a.mode,b.state),c,b.lookAhead):new Ja(a,cb(a.mode,b),c)};Ja.prototype.save=function(a){a=!1!==a?cb(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new Ac(a,this.maxLookAhead):a};var je=function(a,b,c){this.start=a.start;this.end=a.pos;this.string=
a.current();this.type=b||null;this.state=c},yb=function(a,b,c){this.text=a;Xd(this,b);this.height=c?c(this):1};yb.prototype.lineNo=function(){return L(this)};sb(yb);var kg={},jg={},vb=null,Pb=null,xe={left:0,right:0,top:0,bottom:0},hb,qb=function(b,c,d){this.cm=d;var e=this.vert=a("div",[a("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),f=this.horiz=a("div",[a("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");b(e);b(f);Q(e,"scroll",function(){e.clientHeight&&c(e.scrollTop,
"vertical")});Q(f,"scroll",function(){f.clientWidth&&c(f.scrollLeft,"horizontal")});this.checkedZeroWidth=!1;X&&8>ba&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};qb.prototype.update=function(a){var b=a.scrollWidth>a.clientWidth+1,c=a.scrollHeight>a.clientHeight+1,d=a.nativeBarWidth;c?(this.vert.style.display="block",this.vert.style.bottom=b?d+"px":"0",this.vert.firstChild.style.height=Math.max(0,a.scrollHeight-a.clientHeight+(a.viewHeight-(b?d:0)))+"px"):(this.vert.style.display=
"",this.vert.firstChild.style.height="0");b?(this.horiz.style.display="block",this.horiz.style.right=c?d+"px":"0",this.horiz.style.left=a.barLeft+"px",this.horiz.firstChild.style.width=Math.max(0,a.scrollWidth-a.clientWidth+(a.viewWidth-a.barLeft-(c?d:0)))+"px"):(this.horiz.style.display="",this.horiz.firstChild.style.width="0");!this.checkedZeroWidth&&0<a.clientHeight&&(0==d&&this.zeroWidthHack(),this.checkedZeroWidth=!0);return{right:c?d:0,bottom:b?d:0}};qb.prototype.setScrollLeft=function(a){this.horiz.scrollLeft!=
a&&(this.horiz.scrollLeft=a);this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")};qb.prototype.setScrollTop=function(a){this.vert.scrollTop!=a&&(this.vert.scrollTop=a);this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")};qb.prototype.zeroWidthHack=function(){this.horiz.style.height=this.vert.style.width=Ca&&!gh?"12px":"18px";this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new ob;this.disableVert=new ob};qb.prototype.enableZeroWidthBar=
function(a,b,c){function d(){var e=a.getBoundingClientRect();("vert"==c?document.elementFromPoint(e.right-1,(e.top+e.bottom)/2):document.elementFromPoint((e.right+e.left)/2,e.bottom-1))!=a?a.style.pointerEvents="none":b.set(1E3,d)}a.style.pointerEvents="auto";b.set(1E3,d)};qb.prototype.clear=function(){var a=this.horiz.parentNode;a.removeChild(this.horiz);a.removeChild(this.vert)};var rc=function(){};rc.prototype.update=function(){return{bottom:0,right:0}};rc.prototype.setScrollLeft=function(){};
rc.prototype.setScrollTop=function(){};rc.prototype.clear=function(){};var Se={"native":qb,"null":rc},vg=0,Jc=function(a,b,c){var d=a.display;this.viewport=b;this.visible=xd(d,a.doc,b);this.editorIsHidden=!d.wrapper.offsetWidth;this.wrapperHeight=d.wrapper.clientHeight;this.wrapperWidth=d.wrapper.clientWidth;this.oldDisplayWidth=db(a);this.force=c;this.dims=md(a);this.events=[]};Jc.prototype.signal=function(a,b){Ba(a,b)&&this.events.push(arguments)};Jc.prototype.finish=function(){for(var a=0;a<this.events.length;a++)ea.apply(null,
this.events[a])};var Lc=0,xa=null;X?xa=-.53:Ua?xa=15:Cc?xa=-.7:Qf&&(xa=-1/3);var ya=function(a,b){this.ranges=a;this.primIndex=b};ya.prototype.primary=function(){return this.ranges[this.primIndex]};ya.prototype.equals=function(a){if(a==this)return!0;if(a.primIndex!=this.primIndex||a.ranges.length!=this.ranges.length)return!1;for(var b=0;b<this.ranges.length;b++){var c=this.ranges[b],d=a.ranges[b];if(!Na(c.anchor,d.anchor)||!Na(c.head,d.head))return!1}return!0};ya.prototype.deepCopy=function(){for(var a=
[],b=0;b<this.ranges.length;b++)a[b]=new Z(M(this.ranges[b].anchor),M(this.ranges[b].head));return new ya(a,this.primIndex)};ya.prototype.somethingSelected=function(){for(var a=0;a<this.ranges.length;a++)if(!this.ranges[a].empty())return!0;return!1};ya.prototype.contains=function(a,b){b||(b=a);for(var c=0;c<this.ranges.length;c++){var d=this.ranges[c];if(0<=P(b,d.from())&&0>=P(a,d.to()))return c}return-1};var Z=function(a,b){this.anchor=a;this.head=b};Z.prototype.from=function(){return da(this.anchor,
this.head)};Z.prototype.to=function(){return Oa(this.anchor,this.head)};Z.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch};cc.prototype={chunkSize:function(){return this.lines.length},removeInner:function(a,b){for(var c=a,d=a+b;c<d;++c){var e=this.lines[c];this.height-=e.height;var f=e;f.parent=null;rb(f);ma(e,"delete")}this.lines.splice(a,b)},collapse:function(a){a.push.apply(a,this.lines)},insertInner:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,
a).concat(b).concat(this.lines.slice(a));for(a=0;a<b.length;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};dc.prototype={chunkSize:function(){return this.size},removeInner:function(a,b){this.size-=b;for(var c=0;c<this.children.length;++c){var d=this.children[c],e=d.chunkSize();if(a<e){var f=Math.min(b,e-a),g=d.height;d.removeInner(a,f);this.height-=g-d.height;e==f&&(this.children.splice(c--,1),d.parent=null);if(0==(b-=f))break;a=0}else a-=e}25>this.size-
b&&(1<this.children.length||!(this.children[0]instanceof cc))&&(a=[],this.collapse(a),this.children=[new cc(a)],this.children[0].parent=this)},collapse:function(a){for(var b=0;b<this.children.length;++b)this.children[b].collapse(a)},insertInner:function(a,b,c){this.size+=b.length;this.height+=c;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<=f){e.insertInner(a,b,c);if(e.lines&&50<e.lines.length){for(b=a=e.lines.length%25+25;b<e.lines.length;)c=new cc(e.lines.slice(b,
b+=25)),e.height-=c.height,this.children.splice(++d,0,c),c.parent=this;e.lines=e.lines.slice(0,a);this.maybeSpill()}break}a-=f}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5);b=new dc(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=d(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new dc(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iterN:function(a,
b,c){for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){f=Math.min(b,f-a);if(e.iterN(a,f,c))return!0;if(0==(b-=f))break;a=0}else a-=f}}};var ec=function(a,b,c){if(c)for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.doc=a;this.node=b};ec.prototype.clear=function(){var a=this.doc.cm,b=this.line.widgets,c=this.line,d=L(c);if(null!=d&&b){for(var e=0;e<b.length;++e)b[e]==this&&b.splice(e--,1);b.length||(c.widgets=null);var f=Rb(this);T(c,Math.max(0,c.height-f));
a&&(ua(a,function(){var b=-f;Ia(c)<(a.curOp&&a.curOp.scrollTop||a.doc.scrollTop)&&Hc(a,b);Xa(a,d,"widget")}),ma(a,"lineWidgetCleared",a,this,d))}};ec.prototype.changed=function(){var a=this,b=this.height,c=this.doc.cm,d=this.line;this.height=null;var e=Rb(this)-b;e&&(T(d,d.height+e),c&&ua(c,function(){c.curOp.forceUpdate=!0;Ia(d)<(c.curOp&&c.curOp.scrollTop||c.doc.scrollTop)&&Hc(c,e);ma(c,"lineWidgetChanged",c,a,L(d))}))};sb(ec);var vf=0,Za=function(a,b){this.lines=[];this.type=b;this.doc=a;this.id=
++vf};Za.prototype.clear=function(){if(!this.explicitlyCleared){var a=this.doc.cm,b=a&&!a.curOp;b&&lb(a);if(Ba(this,"clear")){var c=this.find();c&&ma(this,"clear",c.from,c.to)}for(var d=c=null,e=0;e<this.lines.length;++e){var f=this.lines[e],g=za(f.markedSpans,this);a&&!this.collapsed?Xa(a,L(f),"text"):a&&(null!=g.to&&(d=L(f)),null!=g.from&&(c=L(f)));for(var h=f,l=void 0,m=f.markedSpans,k=g,r=0;r<m.length;++r)m[r]!=k&&(l||(l=[])).push(m[r]);h.markedSpans=l;null==g.from&&this.collapsed&&!bb(this.doc,
f)&&a&&T(f,gb(a.display))}if(a&&this.collapsed&&!a.options.lineWrapping)for(e=0;e<this.lines.length;++e)f=Ha(this.lines[e]),g=wc(f),g>a.display.maxLineLength&&(a.display.maxLine=f,a.display.maxLineLength=g,a.display.maxLineChanged=!0);null!=c&&a&&this.collapsed&&sa(a,c,d+1);this.lines.length=0;this.explicitlyCleared=!0;this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,a&&lf(a.doc));a&&ma(a,"markerCleared",a,this,c,d);b&&mb(a);this.parent&&this.parent.clear()}};Za.prototype.find=function(a,b){null==
a&&"bookmark"==this.type&&(a=1);for(var c,d,e=0;e<this.lines.length;++e){var f=this.lines[e],g=za(f.markedSpans,this);if(null!=g.from&&(c=I(b?f:L(f),g.from),-1==a))return c;if(null!=g.to&&(d=I(b?f:L(f),g.to),1==a))return d}return c&&{from:c,to:d}};Za.prototype.changed=function(){var a=this,b=this.find(-1,!0),c=this,d=this.doc.cm;b&&d&&ua(d,function(){var e=b.line,f=L(b.line);if(f=ld(d,f))ye(f),d.curOp.selectionChanged=d.curOp.forceUpdate=!0;d.curOp.updateMaxLine=!0;bb(c.doc,e)||null==c.height||(f=
c.height,c.height=null,(f=Rb(c)-f)&&T(e,e.height+f));ma(d,"markerChanged",d,a)})};Za.prototype.attachLine=function(a){if(!this.lines.length&&this.doc.cm){var b=this.doc.cm.curOp;b.maybeHiddenMarkers&&-1!=d(b.maybeHiddenMarkers,this)||(b.maybeUnhiddenMarkers||(b.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(a)};Za.prototype.detachLine=function(a){this.lines.splice(d(this.lines,a),1);!this.lines.length&&this.doc.cm&&(a=this.doc.cm.curOp,(a.maybeHiddenMarkers||(a.maybeHiddenMarkers=[])).push(this))};
sb(Za);var fc=function(a,b){this.markers=a;this.primary=b;for(b=0;b<a.length;++b)a[b].parent=this};fc.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var a=0;a<this.markers.length;++a)this.markers[a].clear();ma(this,"clear")}};fc.prototype.find=function(a,b){return this.primary.find(a,b)};sb(fc);var jh=0,ta=function(a,b,c,d,e){if(!(this instanceof ta))return new ta(a,b,c,d,e);null==c&&(c=0);dc.call(this,[new cc([new yb("",null)])]);this.first=c;this.scrollTop=
this.scrollLeft=0;this.cantEdit=!1;this.cleanGeneration=1;this.modeFrontier=this.highlightFrontier=c;c=I(c,0);this.sel=Ra(c);this.history=new Mc(null);this.id=++jh;this.modeOption=b;this.lineSep=d;this.direction="rtl"==e?"rtl":"ltr";this.extend=!1;"string"==typeof a&&(a=this.splitLines(a));Gd(this,{from:c,to:c,text:a});na(this,Ra(c),La)};ta.prototype=y(dc.prototype,{constructor:ta,iter:function(a,b,c){c?this.iterN(a-this.first,b-a,c):this.iterN(this.first,this.first+this.size,a)},insert:function(a,
b){for(var c=0,d=0;d<b.length;++d)c+=b[d].height;this.insertInner(a-this.first,b,c)},remove:function(a,b){this.removeInner(a-this.first,b)},getValue:function(a){var b=V(this,this.first,this.first+this.size);return!1===a?b:b.join(a||this.lineSeparator())},setValue:la(function(a){var b=I(this.first,0),c=this.first+this.size-1;Bb(this,{from:b,to:I(c,K(this,c).text.length),text:this.splitLines(a),origin:"setValue",full:!0},!0);this.cm&&Wb(this.cm,0,0);na(this,Ra(b),La)}),replaceRange:function(a,b,c,d){b=
O(this,b);c=c?O(this,c):b;Cb(this,a,b,c,d)},getRange:function(a,b,c){a=N(this,O(this,a),O(this,b));return!1===c?a:a.join(c||this.lineSeparator())},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){if(Y(this,a))return K(this,a)},getLineNumber:function(a){return L(a)},getLineHandleVisualStart:function(a){"number"==typeof a&&(a=K(this,a));return Ha(a)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+
this.size-1},clipPos:function(a){return O(this,a)},getCursor:function(a){var b=this.sel.primary();return null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||"to"==a||!1===a?b.to():b.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:la(function(a,b,c){a=O(this,"number"==typeof a?I(a,b||0):a);na(this,Ra(a,null),c)}),setSelection:la(function(a,b,c){var d=O(this,a);a=O(this,b||a);na(this,Ra(d,a),c)}),extendSelection:la(function(a,
b,c){Oc(this,O(this,a),b&&O(this,b),c)}),extendSelections:la(function(a,b){gf(this,Sa(this,a),b)}),extendSelectionsBy:la(function(a,b){a=C(this.sel.ranges,a);gf(this,Sa(this,a),b)}),setSelections:la(function(a,b,c){if(a.length){for(var d=[],e=0;e<a.length;e++)d[e]=new Z(O(this,a[e].anchor),O(this,a[e].head));null==b&&(b=Math.min(a.length-1,this.sel.primIndex));na(this,Ga(d,b),c)}}),addSelection:la(function(a,b,c){var d=this.sel.ranges.slice(0);d.push(new Z(O(this,a),O(this,b||a)));na(this,Ga(d,d.length-
1),c)}),getSelection:function(a){for(var b=this.sel.ranges,c,d=0;d<b.length;d++){var e=N(this,b[d].from(),b[d].to());c=c?c.concat(e):e}return!1===a?c:c.join(a||this.lineSeparator())},getSelections:function(a){for(var b=[],c=this.sel.ranges,d=0;d<c.length;d++){var e=N(this,c[d].from(),c[d].to());!1!==a&&(e=e.join(a||this.lineSeparator()));b[d]=e}return b},replaceSelection:function(a,b,c){for(var d=[],e=0;e<this.sel.ranges.length;e++)d[e]=a;this.replaceSelections(d,b,c||"+input")},replaceSelections:la(function(a,
b,c){for(var d=[],e=this.sel,f=0;f<e.ranges.length;f++){var g=e.ranges[f];d[f]={from:g.from(),to:g.to(),text:this.splitLines(a[f]),origin:c}}if(a=b&&"end"!=b){a=[];e=c=I(this.first,0);for(f=0;f<d.length;f++){var h=d[f];g=Ze(h.from,c,e);var l=Ze(Ya(h),c,e);c=h.to;e=l;"around"==b?(h=this.sel.ranges[f],h=0>P(h.head,h.anchor),a[f]=new Z(h?l:g,h?g:l)):a[f]=new Z(g,g)}a=new ya(a,this.sel.primIndex)}b=a;for(a=d.length-1;0<=a;a--)Bb(this,d[a]);b?hf(this,b):this.cm&&wb(this.cm)}),undo:la(function(){Qc(this,
"undo")}),redo:la(function(){Qc(this,"redo")}),undoSelection:la(function(){Qc(this,"undo",!0)}),redoSelection:la(function(){Qc(this,"redo",!0)}),setExtending:function(a){this.extend=a},getExtending:function(){return this.extend},historySize:function(){for(var a=this.history,b=0,c=0,d=0;d<a.done.length;d++)a.done[d].ranges||++b;for(d=0;d<a.undone.length;d++)a.undone[d].ranges||++c;return{undo:b,redo:c}},clearHistory:function(){this.history=new Mc(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=
this.changeGeneration(!0)},changeGeneration:function(a){a&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null);return this.history.generation},isClean:function(a){return this.history.generation==(a||this.cleanGeneration)},getHistory:function(){return{done:zb(this.history.done),undone:zb(this.history.undone)}},setHistory:function(a){var b=this.history=new Mc(this.history.maxGeneration);b.done=zb(a.done.slice(0),null,!0);b.undone=zb(a.undone.slice(0),null,!0)},setGutterMarker:la(function(a,
b,c){return bc(this,a,"gutter",function(a){var d=a.gutterMarkers||(a.gutterMarkers={});d[b]=c;!c&&G(d)&&(a.gutterMarkers=null);return!0})}),clearGutter:la(function(a){var b=this;this.iter(function(c){c.gutterMarkers&&c.gutterMarkers[a]&&bc(b,c,"gutter",function(){c.gutterMarkers[a]=null;G(c.gutterMarkers)&&(c.gutterMarkers=null);return!0})})}),lineInfo:function(a){if("number"==typeof a){if(!Y(this,a))return null;var b=a;a=K(this,a);if(!a)return null}else if(b=L(a),null==b)return null;return{line:b,
handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},addLineClass:la(function(a,b,d){return bc(this,a,"gutter"==b?"gutter":"class",function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass";if(a[e]){if(c(d).test(a[e]))return!1;a[e]+=" "+d}else a[e]=d;return!0})}),removeLineClass:la(function(a,b,d){return bc(this,a,"gutter"==b?"gutter":"class",function(a){var e="text"==b?"textClass":
"background"==b?"bgClass":"gutter"==b?"gutterClass":"wrapClass",f=a[e];if(f)if(null==d)a[e]=null;else{var g=f.match(c(d));if(!g)return!1;var h=g.index+g[0].length;a[e]=f.slice(0,g.index)+(g.index&&h!=f.length?" ":"")+f.slice(h)||null}else return!1;return!0})}),addLineWidget:la(function(a,b,c){return Eg(this,a,b,c)}),removeLineWidget:function(a){a.clear()},markText:function(a,b,c){return Db(this,O(this,a),O(this,b),c,c&&c.type||"range")},setBookmark:function(a,b){b={replacedWith:b&&(null==b.nodeType?
b.widget:b),insertLeft:b&&b.insertLeft,clearWhenEmpty:!1,shared:b&&b.shared,handleMouseEvents:b&&b.handleMouseEvents};a=O(this,a);return Db(this,a,a,b,"bookmark")},findMarksAt:function(a){a=O(this,a);var b=[],c=K(this,a.line).markedSpans;if(c)for(var d=0;d<c.length;++d){var e=c[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&b.push(e.marker.parent||e.marker)}return b},findMarks:function(a,b,c){a=O(this,a);b=O(this,b);var d=[],e=a.line;this.iter(a.line,b.line+1,function(f){if(f=f.markedSpans)for(var g=
0;g<f.length;g++){var h=f[g];null!=h.to&&e==a.line&&a.ch>=h.to||null==h.from&&e!=a.line||null!=h.from&&e==b.line&&h.from>=b.ch||c&&!c(h.marker)||d.push(h.marker.parent||h.marker)}++e});return d},getAllMarks:function(){var a=[];this.iter(function(b){if(b=b.markedSpans)for(var c=0;c<b.length;++c)null!=b[c].from&&a.push(b[c].marker)});return a},posFromIndex:function(a){var b,c=this.first,d=this.lineSeparator().length;this.iter(function(e){e=e.text.length+d;if(e>a)return b=a,!0;a-=e;++c});return O(this,
I(c,b))},indexFromPos:function(a){a=O(this,a);var b=a.ch;if(a.line<this.first||0>a.ch)return 0;var c=this.lineSeparator().length;this.iter(this.first,a.line,function(a){b+=a.text.length+c});return b},copy:function(a){var b=new ta(V(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);b.scrollTop=this.scrollTop;b.scrollLeft=this.scrollLeft;b.sel=this.sel;b.extend=!1;a&&(b.history.undoDepth=this.history.undoDepth,b.setHistory(this.getHistory()));return b},linkedDoc:function(a){a||
(a={});var b=this.first,c=this.first+this.size;null!=a.from&&a.from>b&&(b=a.from);null!=a.to&&a.to<c&&(c=a.to);b=new ta(V(this,b,c),a.mode||this.modeOption,b,this.lineSep,this.direction);a.sharedHist&&(b.history=this.history);(this.linked||(this.linked=[])).push({doc:b,sharedHist:a.sharedHist});b.linked=[{doc:this,isParent:!0,sharedHist:a.sharedHist}];a=wf(this);for(c=0;c<a.length;c++){var d=a[c],e=d.find(),f=b.clipPos(e.from);e=b.clipPos(e.to);P(f,e)&&(f=Db(b,f,e,d.primary,d.primary.type),d.markers.push(f),
f.parent=d)}return b},unlinkDoc:function(a){a instanceof ca&&(a=a.doc);if(this.linked)for(var b=0;b<this.linked.length;++b)if(this.linked[b].doc==a){this.linked.splice(b,1);a.unlinkDoc(this);Gg(wf(this));break}if(a.history==this.history){var c=[a.id];nb(a,function(a){return c.push(a.id)},!0);a.history=new Mc(null);a.history.done=zb(this.history.done,c);a.history.undone=zb(this.history.undone,c)}},iterLinkedDocs:function(a){nb(this,a)},getMode:function(){return this.mode},getEditor:function(){return this.cm},
splitLines:function(a){return this.lineSep?a.split(this.lineSep):Ud(a)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:la(function(a){"rtl"!=a&&(a="ltr");a!=this.direction&&(this.direction=a,this.iter(function(a){return a.order=null}),this.cm&&Ag(this.cm))})});ta.prototype.eachLine=ta.prototype.iter;for(var yf=0,Pf=!1,$a={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",
37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},sc=0;10>sc;sc++)$a[sc+48]=$a[sc+96]=String(sc);for(var Xc=65;90>=Xc;Xc++)$a[Xc]=String.fromCharCode(Xc);
for(var tc=1;12>=tc;tc++)$a[tc+111]=$a[tc+63235]="F"+tc;var gc={basic:{Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},pcDefault:{"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo",
"Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection",
"Alt-U":"redoSelection",fallthrough:"basic"},emacsy:{"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},macDefault:{"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo",
"Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft",
"Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]}};gc["default"]=Ca?gc.macDefault:gc.pcDefault;var hc={selectAll:nf,singleSelection:function(a){return a.setSelection(a.getCursor("anchor"),a.getCursor("head"),La)},killLine:function(a){return Fb(a,function(b){if(b.empty()){var c=K(a.doc,b.head.line).text.length;return b.head.ch==c&&b.head.line<a.lastLine()?{from:b.head,to:I(b.head.line+
1,0)}:{from:b.head,to:I(b.head.line,c)}}return{from:b.from(),to:b.to()}})},deleteLine:function(a){return Fb(a,function(b){return{from:I(b.from().line,0),to:O(a.doc,I(b.to().line+1,0))}})},delLineLeft:function(a){return Fb(a,function(a){return{from:I(a.from().line,0),to:a.from()}})},delWrappedLineLeft:function(a){return Fb(a,function(b){var c=a.charCoords(b.head,"div").top+5;return{from:a.coordsChar({left:0,top:c},"div"),to:b.from()}})},delWrappedLineRight:function(a){return Fb(a,function(b){var c=
a.charCoords(b.head,"div").top+5;c=a.coordsChar({left:a.display.lineDiv.offsetWidth+100,top:c},"div");return{from:b.from(),to:c}})},undo:function(a){return a.undo()},redo:function(a){return a.redo()},undoSelection:function(a){return a.undoSelection()},redoSelection:function(a){return a.redoSelection()},goDocStart:function(a){return a.extendSelection(I(a.firstLine(),0))},goDocEnd:function(a){return a.extendSelection(I(a.lastLine()))},goLineStart:function(a){return a.extendSelectionsBy(function(b){return Ef(a,
b.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(a){return a.extendSelectionsBy(function(b){return Ff(a,b.head)},{origin:"+move",bias:1})},goLineEnd:function(a){return a.extendSelectionsBy(function(b){b=b.head.line;var c=K(a.doc,b);var d=c;for(var e;e=Ma(d,!1);)d=e.find(1,!0).line;d!=c&&(b=L(d));return Nd(!0,a,c,b,-1)},{origin:"+move",bias:-1})},goLineRight:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:a.display.lineDiv.offsetWidth+
100,top:b},"div")},qc)},goLineLeft:function(a){return a.extendSelectionsBy(function(b){b=a.cursorCoords(b.head,"div").top+5;return a.coordsChar({left:0,top:b},"div")},qc)},goLineLeftSmart:function(a){return a.extendSelectionsBy(function(b){var c=a.cursorCoords(b.head,"div").top+5;c=a.coordsChar({left:0,top:c},"div");return c.ch<a.getLine(c.line).search(/\S/)?Ff(a,b.head):c},qc)},goLineUp:function(a){return a.moveV(-1,"line")},goLineDown:function(a){return a.moveV(1,"line")},goPageUp:function(a){return a.moveV(-1,
"page")},goPageDown:function(a){return a.moveV(1,"page")},goCharLeft:function(a){return a.moveH(-1,"char")},goCharRight:function(a){return a.moveH(1,"char")},goColumnLeft:function(a){return a.moveH(-1,"column")},goColumnRight:function(a){return a.moveH(1,"column")},goWordLeft:function(a){return a.moveH(-1,"word")},goGroupRight:function(a){return a.moveH(1,"group")},goGroupLeft:function(a){return a.moveH(-1,"group")},goWordRight:function(a){return a.moveH(1,"word")},delCharBefore:function(a){return a.deleteH(-1,
"char")},delCharAfter:function(a){return a.deleteH(1,"char")},delWordBefore:function(a){return a.deleteH(-1,"word")},delWordAfter:function(a){return a.deleteH(1,"word")},delGroupBefore:function(a){return a.deleteH(-1,"group")},delGroupAfter:function(a){return a.deleteH(1,"group")},indentAuto:function(a){return a.indentSelection("smart")},indentMore:function(a){return a.indentSelection("add")},indentLess:function(a){return a.indentSelection("subtract")},insertTab:function(a){return a.replaceSelection("\t")},
insertSoftTab:function(a){for(var b=[],c=a.listSelections(),d=a.options.tabSize,f=0;f<c.length;f++){var g=c[f].from();g=e(a.getLine(g.line),g.ch,d);b.push(r(d-g%d))}a.replaceSelections(b)},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.execCommand("insertTab")},transposeChars:function(a){return ua(a,function(){for(var b=a.listSelections(),c=[],d=0;d<b.length;d++)if(b[d].empty()){var e=b[d].head,f=K(a.doc,e.line).text;if(f)if(e.ch==f.length&&(e=new I(e.line,e.ch-1)),0<e.ch)e=
new I(e.line,e.ch+1),a.replaceRange(f.charAt(e.ch-1)+f.charAt(e.ch-2),I(e.line,e.ch-2),e,"+transpose");else if(e.line>a.doc.first){var g=K(a.doc,e.line-1).text;g&&(e=new I(e.line,1),a.replaceRange(f.charAt(0)+a.doc.lineSeparator()+g.charAt(g.length-1),I(e.line-1,g.length-1),e,"+transpose"))}c.push(new Z(e,e))}a.setSelections(c)})},newlineAndIndent:function(a){return ua(a,function(){for(var b=a.listSelections(),c=b.length-1;0<=c;c--)a.replaceRange(a.doc.lineSeparator(),b[c].anchor,b[c].head,"+input");
b=a.listSelections();for(c=0;c<b.length;c++)a.indentLine(b[c].from().line,null,!0);wb(a)})},openLine:function(a){return a.replaceSelection("\n","start")},toggleOverwrite:function(a){return a.toggleOverwrite()}},Og=new ob,Od=null,Pd=function(a,b,c){this.time=a;this.pos=b;this.button=c};Pd.prototype.compare=function(a,b,c){return this.time+400>a&&0==P(b,this.pos)&&c==this.button};var kc,jc,Gb={toString:function(){return"CodeMirror.Init"}},Of={},Vc={};ca.defaults=Of;ca.optionHandlers=Vc;var Sd=[];ca.defineInitHook=
function(a){return Sd.push(a)};var va=null,aa=function(a){this.cm=a;this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null;this.polling=new ob;this.composing=null;this.gracePeriod=!1;this.readDOMTimeout=null};aa.prototype.init=function(a){function b(a){if(!ja(e,a)){if(e.somethingSelected())va={lineWise:!1,text:e.getSelections()},"cut"==a.type&&e.replaceSelection("",null,"cut");else if(e.options.lineWiseCopyCut){var b=Tf(e);va={lineWise:!0,text:b.text};"cut"==a.type&&
e.operation(function(){e.setSelections(b.ranges,0,La);e.replaceSelection("",null,"cut")})}else return;if(a.clipboardData){a.clipboardData.clearData();var c=va.text.join("\n");a.clipboardData.setData("Text",c);if(a.clipboardData.getData("Text")==c){a.preventDefault();return}}var g=Vf();a=g.firstChild;e.display.lineSpace.insertBefore(g,e.display.lineSpace.firstChild);a.value=va.text.join("\n");var h=document.activeElement;pc(a);setTimeout(function(){e.display.lineSpace.removeChild(g);h.focus();h==f&&
d.showPrimarySelection()},50)}}var c=this,d=this,e=d.cm,f=d.div=a.lineDiv;Uf(f,e.options.spellcheck);Q(f,"paste",function(a){ja(e,a)||Sf(a,e)||11>=ba&&setTimeout(ka(e,function(){return c.updateFromDOM()}),20)});Q(f,"compositionstart",function(a){c.composing={data:a.data,done:!1}});Q(f,"compositionupdate",function(a){c.composing||(c.composing={data:a.data,done:!1})});Q(f,"compositionend",function(a){c.composing&&(a.data!=c.composing.data&&c.readFromDOMSoon(),c.composing.done=!0)});Q(f,"touchstart",
function(){return d.forceCompositionEnd()});Q(f,"input",function(){c.composing||c.readFromDOMSoon()});Q(f,"copy",b);Q(f,"cut",b)};aa.prototype.prepareSelection=function(){var a=He(this.cm,!1);a.focus=this.cm.state.focused;return a};aa.prototype.showSelection=function(a,b){a&&this.cm.display.view.length&&((a.focus||b)&&this.showPrimarySelection(),this.showMultipleSelections(a))};aa.prototype.showPrimarySelection=function(){var a=window.getSelection(),b=this.cm,c=b.doc.sel.primary(),d=c.from();c=c.to();
if(b.display.viewTo==b.display.viewFrom||d.line>=b.display.viewTo||c.line<b.display.viewFrom)a.removeAllRanges();else{var e=Wc(b,a.anchorNode,a.anchorOffset),f=Wc(b,a.focusNode,a.focusOffset);if(!e||e.bad||!f||f.bad||0!=P(da(e,f),d)||0!=P(Oa(e,f),c))if(e=b.display.view,d=d.line>=b.display.viewFrom&&Xf(b,d)||{node:e[0].measure.map[2],offset:0},c=c.line<b.display.viewTo&&Xf(b,c),c||(c=e[e.length-1].measure,c=c.maps?c.maps[c.maps.length-1]:c.map,c={node:c[c.length-1],offset:c[c.length-2]-c[c.length-
3]}),d&&c){e=a.rangeCount&&a.getRangeAt(0);try{var g=Ob(d.node,d.offset,c.offset,c.node)}catch(lh){}g&&(!Ua&&b.state.focused?(a.collapse(d.node,d.offset),g.collapsed||(a.removeAllRanges(),a.addRange(g))):(a.removeAllRanges(),a.addRange(g)),e&&null==a.anchorNode?a.addRange(e):Ua&&this.startGracePeriod());this.rememberSelection()}else a.removeAllRanges()}};aa.prototype.startGracePeriod=function(){var a=this;clearTimeout(this.gracePeriod);this.gracePeriod=setTimeout(function(){a.gracePeriod=!1;a.selectionChanged()&&
a.cm.operation(function(){return a.cm.curOp.selectionChanged=!0})},20)};aa.prototype.showMultipleSelections=function(a){q(this.cm.display.cursorDiv,a.cursors);q(this.cm.display.selectionDiv,a.selection)};aa.prototype.rememberSelection=function(){var a=window.getSelection();this.lastAnchorNode=a.anchorNode;this.lastAnchorOffset=a.anchorOffset;this.lastFocusNode=a.focusNode;this.lastFocusOffset=a.focusOffset};aa.prototype.selectionInEditor=function(){var a=window.getSelection();if(!a.rangeCount)return!1;
a=a.getRangeAt(0).commonAncestorContainer;return m(this.div,a)};aa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())};aa.prototype.blur=function(){this.div.blur()};aa.prototype.getField=function(){return this.div};aa.prototype.supportsTouch=function(){return!0};aa.prototype.receivedFocus=function(){function a(){b.cm.state.focused&&(b.pollSelection(),b.polling.set(b.cm.options.pollInterval,a))}
var b=this;this.selectionInEditor()?this.pollSelection():ua(this.cm,function(){return b.cm.curOp.selectionChanged=!0});this.polling.set(this.cm.options.pollInterval,a)};aa.prototype.selectionChanged=function(){var a=window.getSelection();return a.anchorNode!=this.lastAnchorNode||a.anchorOffset!=this.lastAnchorOffset||a.focusNode!=this.lastFocusNode||a.focusOffset!=this.lastFocusOffset};aa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var a=
window.getSelection(),b=this.cm;if(Dc&&Cc&&this.cm.options.gutters.length&&ch(a.anchorNode))this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),this.focus();else if(!this.composing){this.rememberSelection();var c=Wc(b,a.anchorNode,a.anchorOffset),d=Wc(b,a.focusNode,a.focusOffset);c&&d&&ua(b,function(){na(b.doc,Ra(c,d),La);if(c.bad||d.bad)b.curOp.selectionChanged=!0})}}};aa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),
this.readDOMTimeout=null);var a=this.cm,b=a.display,c=a.doc.sel.primary(),d=c.from(),e=c.to();0==d.ch&&d.line>a.firstLine()&&(d=I(d.line-1,K(a.doc,d.line-1).length));e.ch==K(a.doc,e.line).text.length&&e.line<a.lastLine()&&(e=I(e.line+1,0));if(d.line<b.viewFrom||e.line>b.viewTo-1)return!1;var f;d.line==b.viewFrom||0==(f=eb(a,d.line))?(c=L(b.view[0].line),f=b.view[0].node):(c=L(b.view[f].line),f=b.view[f-1].node.nextSibling);var g=eb(a,e.line);g==b.view.length-1?(e=b.viewTo-1,b=b.lineDiv.lastChild):
(e=L(b.view[g+1].line)-1,b=b.view[g+1].node.previousSibling);if(!f)return!1;b=a.doc.splitLines(dh(a,f,b,c,e));for(f=N(a.doc,I(c,0),I(e,K(a.doc,e).text.length));1<b.length&&1<f.length;)if(n(b)==n(f))b.pop(),f.pop(),e--;else if(b[0]==f[0])b.shift(),f.shift(),c++;else break;var h=0;g=0;for(var l=b[0],m=f[0],k=Math.min(l.length,m.length);h<k&&l.charCodeAt(h)==m.charCodeAt(h);)++h;l=n(b);m=n(f);for(k=Math.min(l.length-(1==b.length?h:0),m.length-(1==f.length?h:0));g<k&&l.charCodeAt(l.length-g-1)==m.charCodeAt(m.length-
g-1);)++g;if(1==b.length&&1==f.length&&c==d.line)for(;h&&h>d.ch&&l.charCodeAt(l.length-g-1)==m.charCodeAt(m.length-g-1);)h--,g++;b[b.length-1]=l.slice(0,l.length-g).replace(/^\u200b+/,"");b[0]=b[0].slice(h).replace(/\u200b+$/,"");d=I(c,h);c=I(e,f.length?n(f).length-g:0);if(1<b.length||b[0]||P(d,c))return Cb(a.doc,b,d,c,"+input"),!0};aa.prototype.ensurePolled=function(){this.forceCompositionEnd()};aa.prototype.reset=function(){this.forceCompositionEnd()};aa.prototype.forceCompositionEnd=function(){this.composing&&
(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())};aa.prototype.readFromDOMSoon=function(){var a=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){a.readDOMTimeout=null;if(a.composing)if(a.composing.done)a.composing=null;else return;a.updateFromDOM()},80))};aa.prototype.updateFromDOM=function(){var a=this;!this.cm.isReadOnly()&&this.pollContent()||ua(this.cm,function(){return sa(a.cm)})};aa.prototype.setUneditable=
function(a){a.contentEditable="false"};aa.prototype.onKeyPress=function(a){0!=a.charCode&&(a.preventDefault(),this.cm.isReadOnly()||ka(this.cm,Td)(this.cm,String.fromCharCode(null==a.charCode?a.keyCode:a.charCode),0))};aa.prototype.readOnlyChanged=function(a){this.div.contentEditable=String("nocursor"!=a)};aa.prototype.onContextMenu=function(){};aa.prototype.resetPosition=function(){};aa.prototype.needsContentAttribute=!0;var ia=function(a){this.cm=a;this.prevInput="";this.pollingFast=!1;this.polling=
new ob;this.hasSelection=!1;this.composing=null};ia.prototype.init=function(a){function b(a){if(!ja(e,a)){if(e.somethingSelected())va={lineWise:!1,text:e.getSelections()};else if(e.options.lineWiseCopyCut){var b=Tf(e);va={lineWise:!0,text:b.text};"cut"==a.type?e.setSelections(b.ranges,null,La):(d.prevInput="",g.value=b.text.join("\n"),pc(g))}else return;"cut"==a.type&&(e.state.cutIncoming=!0)}}var c=this,d=this,e=this.cm,f=this.wrapper=Vf(),g=this.textarea=f.firstChild;a.wrapper.insertBefore(f,a.wrapper.firstChild);
nc&&(g.style.width="0px");Q(g,"input",function(){X&&9<=ba&&c.hasSelection&&(c.hasSelection=null);d.poll()});Q(g,"paste",function(a){ja(e,a)||Sf(a,e)||(e.state.pasteIncoming=!0,d.fastPoll())});Q(g,"cut",b);Q(g,"copy",b);Q(a.scroller,"paste",function(b){Qa(a,b)||ja(e,b)||(e.state.pasteIncoming=!0,d.focus())});Q(a.lineSpace,"selectstart",function(b){Qa(a,b)||pa(b)});Q(g,"compositionstart",function(){var a=e.getCursor("from");d.composing&&d.composing.range.clear();d.composing={start:a,range:e.markText(a,
e.getCursor("to"),{className:"CodeMirror-composing"})}});Q(g,"compositionend",function(){d.composing&&(d.poll(),d.composing.range.clear(),d.composing=null)})};ia.prototype.prepareSelection=function(){var a=this.cm,b=a.display,c=a.doc,d=He(a);if(a.options.moveInputWithCursor){a=Ea(a,c.sel.primary().head,"div");c=b.wrapper.getBoundingClientRect();var e=b.lineDiv.getBoundingClientRect();d.teTop=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+e.top-c.top));d.teLeft=Math.max(0,Math.min(b.wrapper.clientWidth-
10,a.left+e.left-c.left))}return d};ia.prototype.showSelection=function(a){var b=this.cm.display;q(b.cursorDiv,a.cursors);q(b.selectionDiv,a.selection);null!=a.teTop&&(this.wrapper.style.top=a.teTop+"px",this.wrapper.style.left=a.teLeft+"px")};ia.prototype.reset=function(a){if(!this.contextMenuPending&&!this.composing){var b=this.cm;b.somethingSelected()?(this.prevInput="",a=b.getSelection(),this.textarea.value=a,b.state.focused&&pc(this.textarea),X&&9<=ba&&(this.hasSelection=a)):a||(this.prevInput=
this.textarea.value="",X&&9<=ba&&(this.hasSelection=null))}};ia.prototype.getField=function(){return this.textarea};ia.prototype.supportsTouch=function(){return!1};ia.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!Kb||u()!=this.textarea))try{this.textarea.focus()}catch(w){}};ia.prototype.blur=function(){this.textarea.blur()};ia.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0};ia.prototype.receivedFocus=function(){this.slowPoll()};ia.prototype.slowPoll=
function(){var a=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){a.poll();a.cm.state.focused&&a.slowPoll()})};ia.prototype.fastPoll=function(){function a(){c.poll()||b?(c.pollingFast=!1,c.slowPoll()):(b=!0,c.polling.set(60,a))}var b=!1,c=this;c.pollingFast=!0;c.polling.set(20,a)};ia.prototype.poll=function(){var a=this,b=this.cm,c=this.textarea,d=this.prevInput;if(this.contextMenuPending||!b.state.focused||ih(c)&&!d&&!this.composing||b.isReadOnly()||b.options.disableInput||
b.state.keySeq)return!1;var e=c.value;if(e==d&&!b.somethingSelected())return!1;if(X&&9<=ba&&this.hasSelection===e||Ca&&/[\uf700-\uf7ff]/.test(e))return b.display.input.reset(),!1;if(b.doc.sel==b.display.selForContextMenu){var f=e.charCodeAt(0);8203!=f||d||(d="\u200b");if(8666==f)return this.reset(),this.cm.execCommand("undo")}var g=0;for(f=Math.min(d.length,e.length);g<f&&d.charCodeAt(g)==e.charCodeAt(g);)++g;ua(b,function(){Td(b,e.slice(g),d.length-g,null,a.composing?"*compose":null);1E3<e.length||
-1<e.indexOf("\n")?c.value=a.prevInput="":a.prevInput=e;a.composing&&(a.composing.range.clear(),a.composing.range=b.markText(a.composing.start,b.getCursor("to"),{className:"CodeMirror-composing"}))});return!0};ia.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)};ia.prototype.onKeyPress=function(){X&&9<=ba&&(this.hasSelection=null);this.fastPoll()};ia.prototype.onContextMenu=function(a){function b(){if(null!=g.selectionStart){var a=e.somethingSelected(),b="\u200b"+
(a?g.value:"");g.value="\u21da";g.value=b;d.prevInput=a?"":"\u200b";g.selectionStart=1;g.selectionEnd=b.length;f.selForContextMenu=e.doc.sel}}function c(){d.contextMenuPending=!1;d.wrapper.style.cssText=k;g.style.cssText=m;X&&9>ba&&f.scrollbars.setScrollTop(f.scroller.scrollTop=l);if(null!=g.selectionStart){(!X||X&&9>ba)&&b();var a=0,c=function(){f.selForContextMenu==e.doc.sel&&0==g.selectionStart&&0<g.selectionEnd&&"\u200b"==d.prevInput?ka(e,nf)(e):10>a++?f.detectingSelectAll=setTimeout(c,500):(f.selForContextMenu=
null,f.input.reset())};f.detectingSelectAll=setTimeout(c,200)}}var d=this,e=d.cm,f=e.display,g=d.textarea,h=ib(e,a),l=f.scroller.scrollTop;if(h&&!Fa){e.options.resetSelectionOnContextMenu&&-1==e.doc.sel.contains(h)&&ka(e,na)(e.doc,Ra(h),La);var m=g.style.cssText,k=d.wrapper.style.cssText;d.wrapper.style.cssText="position: absolute";h=d.wrapper.getBoundingClientRect();g.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(a.clientY-h.top-5)+"px; left: "+(a.clientX-h.left-5)+
"px;\n      z-index: 1000; background: "+(X?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";if(oa)var r=window.scrollY;f.input.focus();oa&&window.scrollTo(null,r);f.input.reset();e.somethingSelected()||(g.value=d.prevInput=" ");d.contextMenuPending=!0;f.selForContextMenu=e.doc.sel;clearTimeout(f.detectingSelectAll);X&&9<=ba&&b();if(Qd){Mb(a);var t=function(){wa(window,"mouseup",t);setTimeout(c,
20)};Q(window,"mouseup",t)}else setTimeout(c,50)}};ia.prototype.readOnlyChanged=function(a){a||this.reset();this.textarea.disabled="nocursor"==a};ia.prototype.setUneditable=function(){};ia.prototype.needsContentAttribute=!1;(function(a){function b(b,d,e,f){a.defaults[b]=d;e&&(c[b]=f?function(a,b,c){c!=Gb&&e(a,b,c)}:e)}var c=a.optionHandlers;a.defineOption=b;a.Init=Gb;b("value","",function(a,b){return a.setValue(b)},!0);b("mode",null,function(a,b){a.doc.modeOption=b;Fd(a)},!0);b("indentUnit",2,Fd,
!0);b("indentWithTabs",!1);b("smartIndent",!0);b("tabSize",4,function(a){$b(a);Tb(a);sa(a)},!0);b("lineSeparator",null,function(a,b){if(a.doc.lineSep=b){var c=[],d=a.doc.first;a.doc.iter(function(a){for(var e=0;;){var f=a.text.indexOf(b,e);if(-1==f)break;e=f+b.length;c.push(I(d,f))}d++});for(var e=c.length-1;0<=e;e--)Cb(a.doc,b,c[e],I(c[e].line,c[e].ch+b.length))}});b("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(a,b,c){a.state.specialChars=new RegExp(b.source+
(b.test("\t")?"":"|\t"),"g");c!=Gb&&a.refresh()});b("specialCharPlaceholder",ng,function(a){return a.refresh()},!0);b("electricChars",!0);b("inputStyle",Kb?"contenteditable":"textarea",function(){throw Error("inputStyle can not (yet) be changed in a running editor");},!0);b("spellcheck",!1,function(a,b){return a.getInputField().spellcheck=b},!0);b("rtlMoveVisually",!hh);b("wholeLineUpdateBefore",!0);b("theme","default",function(a){Nf(a);lc(a)},!0);b("keyMap","default",function(a,b,c){b=Rc(b);(c=c!=
Gb&&Rc(c))&&c.detach&&c.detach(a,b);b.attach&&b.attach(a,c||null)});b("extraKeys",null);b("configureMouse",null);b("lineWrapping",!1,ah,!0);b("gutters",[],function(a){Dd(a.options);lc(a)},!0);b("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?td(a.display)+"px":"0";a.refresh()},!0);b("coverGutterNextToScrollbar",!1,function(a){return xb(a)},!0);b("scrollbarStyle","native",function(a){Re(a);xb(a);a.display.scrollbars.setScrollTop(a.doc.scrollTop);a.display.scrollbars.setScrollLeft(a.doc.scrollLeft)},
!0);b("lineNumbers",!1,function(a){Dd(a.options);lc(a)},!0);b("firstLineNumber",1,lc,!0);b("lineNumberFormatter",function(a){return a},lc,!0);b("showCursorWhenSelecting",!1,Ub,!0);b("resetSelectionOnContextMenu",!0);b("lineWiseCopyCut",!0);b("pasteLinesPerSelection",!0);b("readOnly",!1,function(a,b){"nocursor"==b&&(Vb(a),a.display.input.blur());a.display.input.readOnlyChanged(b)});b("disableInput",!1,function(a,b){b||a.display.input.reset()},!0);b("dragDrop",!0,$g);b("allowDropFileTypes",null);b("cursorBlinkRate",
530);b("cursorScrollMargin",0);b("cursorHeight",1,Ub,!0);b("singleCursorHeightPerLine",!0,Ub,!0);b("workTime",100);b("workDelay",100);b("flattenSpans",!0,$b,!0);b("addModeClass",!1,$b,!0);b("pollInterval",100);b("undoDepth",200,function(a,b){return a.doc.history.undoDepth=b});b("historyEventDelay",1250);b("viewportMargin",10,function(a){return a.refresh()},!0);b("maxHighlightLength",1E4,$b,!0);b("moveInputWithCursor",!0,function(a,b){b||a.display.input.resetPosition()});b("tabindex",null,function(a,
b){return a.display.input.getField().tabIndex=b||""});b("autofocus",null);b("direction","ltr",function(a,b){return a.doc.setDirection(b)},!0)})(ca);(function(a){var b=a.optionHandlers,c=a.helpers={};a.prototype={constructor:a,focus:function(){window.focus();this.display.input.focus()},setOption:function(a,c){var d=this.options,e=d[a];if(d[a]!=c||"mode"==a)d[a]=c,b.hasOwnProperty(a)&&ka(this,b[a])(this,c,e),ea(this,"optionChange",this,a)},getOption:function(a){return this.options[a]},getDoc:function(){return this.doc},
addKeyMap:function(a,b){this.state.keyMaps[b?"push":"unshift"](Rc(a))},removeKeyMap:function(a){for(var b=this.state.keyMaps,c=0;c<b.length;++c)if(b[c]==a||b[c].name==a)return b.splice(c,1),!0},addOverlay:qa(function(b,c){var d=b.token?b:a.getMode(this.options,b);if(d.startState)throw Error("Overlays may not be stateful.");D(this.state.overlays,{mode:d,modeSpec:b,opaque:c&&c.opaque,priority:c&&c.priority||0},function(a){return a.priority});this.state.modeGen++;sa(this)}),removeOverlay:qa(function(a){for(var b=
this.state.overlays,c=0;c<b.length;++c){var d=b[c].modeSpec;if(d==a||"string"==typeof a&&d.name==a){b.splice(c,1);this.state.modeGen++;sa(this);break}}}),indentLine:qa(function(a,b,c){"string"!=typeof b&&"number"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");Y(this.doc,a)&&mc(this,a,b,c)}),indentSelection:qa(function(a){for(var b=this.doc.sel.ranges,c=-1,d=0;d<b.length;d++){var e=b[d];if(e.empty())e.head.line>c&&(mc(this,e.head.line,a,!0),c=e.head.line,d==this.doc.sel.primIndex&&
wb(this));else{var f=e.from();e=e.to();var g=Math.max(c,f.line);c=Math.min(this.lastLine(),e.line-(e.ch?0:1))+1;for(e=g;e<c;++e)mc(this,e,a);e=this.doc.sel.ranges;0==f.ch&&b.length==e.length&&0<e[d].from().ch&&Jd(this.doc,d,new Z(f,e[d].to()),La)}}}),getTokenAt:function(a,b){return ie(this,a,b)},getLineTokens:function(a,b){return ie(this,I(a),b,!0)},getTokenTypeAt:function(a){a=O(this.doc,a);var b=ge(this,K(this.doc,a.line)),c=0,d=(b.length-1)/2;a=a.ch;if(0==a)b=b[2];else for(;;){var e=c+d>>1;if((e?
b[2*e-1]:0)>=a)d=e;else if(b[2*e+1]<a)c=e+1;else{b=b[2*e+2];break}}c=b?b.indexOf("overlay "):-1;return 0>c?b:0==c?null:b.slice(0,c-1)},getModeAt:function(b){var c=this.doc.mode;return c.innerMode?a.innerMode(c,this.getTokenAt(b).state).mode:c},getHelper:function(a,b){return this.getHelpers(a,b)[0]},getHelpers:function(a,b){var e=[];if(!c.hasOwnProperty(b))return e;var f=c[b];a=this.getModeAt(a);if("string"==typeof a[b])f[a[b]]&&e.push(f[a[b]]);else if(a[b])for(var g=0;g<a[b].length;g++){var h=f[a[b][g]];
h&&e.push(h)}else a.helperType&&f[a.helperType]?e.push(f[a.helperType]):f[a.name]&&e.push(f[a.name]);for(b=0;b<f._global.length;b++)g=f._global[b],g.pred(a,this)&&-1==d(e,g.val)&&e.push(g.val);return e},getStateAfter:function(a,b){var c=this.doc;a=Math.max(c.first,Math.min(null==a?c.first+c.size-1:a,c.first+c.size-1));return Nb(this,a+1,b).state},cursorCoords:function(a,b){var c=this.doc.sel.primary();a=null==a?c.head:"object"==typeof a?O(this.doc,a):a?c.from():c.to();return Ea(this,a,b||"page")},
charCoords:function(a,b){return pd(this,O(this.doc,a),b||"page")},coordsChar:function(a,b){a=Ce(this,a,b||"page");return rd(this,a.left,a.top)},lineAtHeight:function(a,b){a=Ce(this,{top:a,left:0},b||"page").top;return S(this.doc,a+this.display.viewOffset)},heightAtLine:function(a,b,c){var d=!1;if("number"==typeof a){var e=this.doc.first+this.doc.size-1;a<this.doc.first?a=this.doc.first:a>e&&(a=e,d=!0);a=K(this.doc,a)}return Ec(this,a,{top:0,left:0},b||"page",c||d).top+(d?this.doc.height-Ia(a):0)},
defaultTextHeight:function(){return gb(this.display)},defaultCharWidth:function(){return Sb(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(a,b,c,d,e){var f=this.display;a=Ea(this,O(this.doc,a));var g=a.bottom,h=a.left;b.style.position="absolute";b.setAttribute("cm-ignore-events","true");this.display.input.setUneditable(b);f.sizer.appendChild(b);if("over"==d)g=a.top;else if("above"==d||"near"==d){var l=Math.max(f.wrapper.clientHeight,
this.doc.height),m=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);("above"==d||a.bottom+b.offsetHeight>l)&&a.top>b.offsetHeight?g=a.top-b.offsetHeight:a.bottom+b.offsetHeight<=l&&(g=a.bottom);h+b.offsetWidth>m&&(h=m-b.offsetWidth)}b.style.top=g+"px";b.style.left=b.style.right="";"right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px");c&&(a=zd(this,{left:h,top:g,right:h+b.offsetWidth,bottom:g+
b.offsetHeight}),null!=a.scrollTop&&Xb(this,a.scrollTop),null!=a.scrollLeft&&kb(this,a.scrollLeft))},triggerOnKeyDown:qa(Hf),triggerOnKeyPress:qa(Jf),triggerOnKeyUp:If,triggerOnMouseDown:qa(Kf),execCommand:function(a){if(hc.hasOwnProperty(a))return hc[a].call(null,this)},triggerElectric:qa(function(a){Rf(this,a)}),findPosH:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);a=O(this.doc,a);for(var f=0;f<b&&(a=Vd(this.doc,a,e,c,d),!a.hitSide);++f);return a},moveH:qa(function(a,b){var c=this;this.extendSelectionsBy(function(d){return c.display.shift||
c.doc.extend||d.empty()?Vd(c.doc,d.head,a,b,c.options.rtlMoveVisually):0>a?d.from():d.to()},qc)}),deleteH:qa(function(a,b){var c=this.doc;this.doc.sel.somethingSelected()?c.replaceSelection("",null,"+delete"):Fb(this,function(d){var e=Vd(c,d.head,a,b,!1);return 0>a?{from:e,to:d.head}:{from:d.head,to:e}})}),findPosV:function(a,b,c,d){var e=1;0>b&&(e=-1,b=-b);var f=O(this.doc,a);for(a=0;a<b&&(f=Ea(this,f,"div"),null==d?d=f.left:f.left=d,f=Wf(this,f,e,c),!f.hitSide);++a);return f},moveV:qa(function(a,
b){var c=this,d=this.doc,e=[],f=!this.display.shift&&!d.extend&&d.sel.somethingSelected();d.extendSelectionsBy(function(g){if(f)return 0>a?g.from():g.to();var h=Ea(c,g.head,"div");null!=g.goalColumn&&(h.left=g.goalColumn);e.push(h.left);var l=Wf(c,h,a,b);"page"==b&&g==d.sel.primary()&&Hc(c,pd(c,l,"div").top-h.top);return l},qc);if(e.length)for(var g=0;g<d.sel.ranges.length;g++)d.sel.ranges[g].goalColumn=e[g]}),findWordAt:function(a){var b=K(this.doc,a.line).text,c=a.ch,d=a.ch;if(b){var e=this.getHelper(a,
"wordChars");"before"!=a.sticky&&d!=b.length||!c?++d:--c;var f=b.charAt(c);for(f=A(f,e)?function(a){return A(a,e)}:/\s/.test(f)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!A(a)};0<c&&f(b.charAt(c-1));)--c;for(;d<b.length&&f(b.charAt(d));)++d}return new Z(I(a.line,c),I(a.line,d))},toggleOverwrite:function(a){if(null==a||a!=this.state.overwrite)(this.state.overwrite=!this.state.overwrite)?v(this.display.cursorDiv,"CodeMirror-overwrite"):jb(this.display.cursorDiv,"CodeMirror-overwrite"),
ea(this,"overwriteToggle",this,this.state.overwrite)},hasFocus:function(){return this.display.input.getField()==u()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:qa(function(a,b){Wb(this,a,b)}),getScrollInfo:function(){var a=this.display.scroller;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-Ka(this)-this.display.barHeight,width:a.scrollWidth-Ka(this)-this.display.barWidth,clientHeight:kd(this),clientWidth:db(this)}},scrollIntoView:qa(function(a,
b){null==a?(a={from:this.doc.sel.primary().head,to:null},null==b&&(b=this.options.cursorScrollMargin)):"number"==typeof a?a={from:I(a,0),to:null}:null==a.from&&(a={from:a,to:null});a.to||(a.to=a.from);a.margin=b||0;null!=a.from.line?(Ic(this),this.curOp.scrollToPos=a):Oe(this,a.from,a.to,a.margin)}),setSize:qa(function(a,b){var c=this,d=function(a){return"number"==typeof a||/^\d+$/.test(String(a))?a+"px":a};null!=a&&(this.display.wrapper.style.width=d(a));null!=b&&(this.display.wrapper.style.height=
d(b));this.options.lineWrapping&&ze(this);var e=this.display.viewFrom;this.doc.iter(e,this.display.viewTo,function(a){if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].noHScroll){Xa(c,e,"widget");break}++e});this.curOp.forceUpdate=!0;ea(this,"refresh",this)}),operation:function(a){return ua(this,a)},startOperation:function(){return lb(this)},endOperation:function(){return mb(this)},refresh:qa(function(){var a=this.display.cachedTextHeight;sa(this);this.curOp.forceUpdate=!0;Tb(this);
Wb(this,this.doc.scrollLeft,this.doc.scrollTop);yd(this);(null==a||.5<Math.abs(a-gb(this.display)))&&ud(this);ea(this,"refresh",this)}),swapDoc:qa(function(a){var b=this.doc;b.cm=null;af(this,a);Tb(this);this.display.input.reset();Wb(this,a.scrollLeft,a.scrollTop);this.curOp.forceScroll=!0;ma(this,"swapDoc",this,b);return b}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},
getGutterElement:function(){return this.display.gutters}};sb(a);a.registerHelper=function(b,d,e){c.hasOwnProperty(b)||(c[b]=a[b]={_global:[]});c[b][d]=e};a.registerGlobalHelper=function(b,d,e,f){a.registerHelper(b,d,f);c[b]._global.push({pred:e,val:f})}})(ca);var kh="iter insert remove copy getEditor constructor".split(" "),uc;for(uc in ta.prototype)ta.prototype.hasOwnProperty(uc)&&0>d(kh,uc)&&(ca.prototype[uc]=function(a){return function(){return a.apply(this.doc,arguments)}}(ta.prototype[uc]));
sb(ta);ca.inputStyles={textarea:ia,contenteditable:aa};ca.defineMode=function(a){ca.defaults.mode||"null"==a||(ca.defaults.mode=a);fg.apply(this,arguments)};ca.defineMIME=function(a,b){tb[a]=b};ca.defineMode("null",function(){return{token:function(a){return a.skipToEnd()}}});ca.defineMIME("text/plain","null");ca.defineExtension=function(a,b){ca.prototype[a]=b};ca.defineDocExtension=function(a,b){ta.prototype[a]=b};ca.fromTextArea=function(a,b){function c(){a.value=l.getValue()}b=b?g(b):{};b.value=
a.value;!b.tabindex&&a.tabIndex&&(b.tabindex=a.tabIndex);!b.placeholder&&a.placeholder&&(b.placeholder=a.placeholder);if(null==b.autofocus){var d=u();b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form&&(Q(a.form,"submit",c),!b.leaveSubmitMethodAlone)){var e=a.form;var f=e.submit;try{var h=e.submit=function(){c();e.submit=f;e.submit();e.submit=h}}catch($d){}}b.finishInit=function(b){b.save=c;b.getTextArea=function(){return a};b.toTextArea=function(){b.toTextArea=isNaN;
c();a.parentNode.removeChild(b.getWrapperElement());a.style.display="";a.form&&(wa(a.form,"submit",c),"function"==typeof a.form.submit&&(a.form.submit=f))}};a.style.display="none";var l=ca(function(b){return a.parentNode.insertBefore(b,a.nextSibling)},b);return l};(function(a){a.off=wa;a.on=Q;a.wheelEventPixels=zg;a.Doc=ta;a.splitLines=Ud;a.countColumn=e;a.findColumn=h;a.isWordChar=E;a.Pass=Tc;a.signal=ea;a.Line=yb;a.changeEnd=Ya;a.scrollbarModel=Se;a.Pos=I;a.cmpPos=P;a.modes=cd;a.mimeModes=tb;a.resolveMode=
zc;a.getMode=dd;a.modeExtensions=ub;a.extendMode=gg;a.copyState=cb;a.startState=de;a.innerMode=ed;a.commands=hc;a.keyMap=gc;a.keyName=Df;a.isModifierKey=Af;a.lookupKey=Eb;a.normalizeKeyMap=Lg;a.StringStream=fa;a.SharedTextMarker=fc;a.TextMarker=Za;a.LineWidget=ec;a.e_preventDefault=pa;a.e_stopPropagation=be;a.e_stop=Mb;a.addClass=v;a.contains=m;a.rmClass=jb;a.keyNames=$a})(ca);ca.version="5.31.0";return ca})},function(n,f){},function(n,f){},function(n,f,c){f.a=function(c){return new p.a(void 0===
c?1:c,k.o)};var p=c(8),k=c(2)},function(n,f,c){f.a=function(a){a=void 0===a?p.p.create():a;return new b(a,a)};var p=c(1),k=c(2),q=c(4),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function(){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.value_=
a;this.defaultValue=c;this.changed=new q.a}a(b,[{key:"toJSON",value:function(){if(this.value_!==this.defaultValue)return this.value_.toString()}},{key:"restoreState",value:function(a){try{this.value=Object(k.l)(a.split(","))}catch(v){this.value=this.defaultValue}}},{key:"reset",value:function(){this.value=this.defaultValue}},{key:"value",get:function(){return this.value_},set:function(a){a!==this.value_&&(this.value_=a,this.changed.dispatch())}}]);return b}()},function(n,f,c){function p(a,b){if(!(a instanceof
b))throw new TypeError("Cannot call a class as a function");}function k(a){return a-Math.floor(a)}c.d(f,"b",function(){return t});c.d(f,"a",function(){return e});var q=c(76),a=c(121),b=c(205),m=c(4),u=c(14),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(){function b(a){p(this,b);this.prefix=
a;this.aName=this.prefix+"_a";this.bName=this.prefix+"_b"}v(b,[{key:"defineShader",value:function(b){var c=this.aName,d=this.bName;b.addUniform("highp vec4",c,4);b.addUniform("highp float",d,4);b.addFragmentCode(u.l);b.addFragmentCode(a.d);b.addFragmentCode(u.g);for(var e="\nvec3 "+this.prefix+"(uint64_t x) {\n  vec2 v;\n  float primeModulus = float("+q.b+");\n",f=0;2>f;++f){var g=2*f,h=2*f;e+="\n  v["+f+"] = computeHash(x,\n                        "+c+"["+h+"], "+c+"["+(h+1)+"],\n                        "+
d+"["+g+"], "+d+"["+(g+1)+"],\n                        primeModulus, 1.0 / 256.0);\n"}b.addFragmentCode(e+"\n  vec3 hsv = vec3(v.x, 0.5 + v.y * 0.5, 1.0);\n  return hsvToRgb(hsv);\n}\n")}},{key:"enable",value:function(a,b,c){a.uniform4fv(b.uniform(this.aName),c.a_);a.uniform1fv(b.uniform(this.bName),c.b_)}}]);return b}(),l=new Float32Array(2),g=new Float32Array(3),e=function(){function a(b){p(this,a);this.a_=new Float32Array(16);this.b_=new Float32Array(4);this.changed=new m.a;null==b?(this.hashFunctions=
Array(2),this.randomize_()):this.hashFunctions=b;this.computeGPUCoefficients_()}v(a,[{key:"compute",value:function(a,c){var d=c.low;c=c.high;for(var e=this.hashFunctions,f=0;2>f;++f)l[f]=k(e[f].compute(d,c)/256);Object(b.a)(a,l[0],.5+.5*l[1],1);return a}},{key:"computeCssColor",value:function(a){this.compute(g,a);return"rgb("+100*g[0]+"%,"+100*g[1]+"%,"+100*g[2]+"%)"}},{key:"debugCompute",value:function(a,b){var c=b.low;b=b.high;for(var d=this.b_,e=q.b,f=0;2>f;++f){for(var g=2*f,h=2*f,l=new Float32Array(2),
m=0;4>m;++m)l[0]+=this.a_[4*h+m]*(c>>8*m&255),l[1]+=this.a_[4*(h+1)+m]*(b>>8*m&255);h=(l[0]+l[1])%e;m=h*h%e;var r=m*d[g+1]%e,t=(d[g]+h+r)%e;console.log("b = "+d[g]+", sums="+l[0]+" "+l[1]+", dotResult="+h+", "+("prod = "+h*h+" dotResult2="+m+", y="+r+", ")+("modResult="+t));a[f]=k(1/256*t)}return a}},{key:"randomize_",value:function(){for(var a=0;2>a;++a)this.hashFunctions[a]=q.a.generate()}},{key:"randomize",value:function(){this.randomize_();this.computeGPUCoefficients_();this.changed.dispatch()}},
{key:"toString",value:function(){return"new SegmentColorHash(["+this.hashFunctions+"])"}},{key:"computeGPUCoefficients_",value:function(){for(var a=this.hashFunctions,b=this.a_,c=this.b_,d=0;2>d;++d){var e=a[d],f=2*d,g=8*d;c[f]=1*e.b;c[f+1]=1*e.c;for(f=0;4>f;++f)b[g+f]=1*e.a0[f],b[g+4+f]=1*e.a1[f]}}}],[{key:"getDefault",value:function(){return new a([new q.a(Float32Array.of(609,2364,3749,2289),Float32Array.of(2840,1186,3660,1833),1718,1109),new q.a(Float32Array.of(3466,3835,3345,2040),Float32Array.of(3382,
901,18,3444),1534,1432)])}}]);return a}()},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,
enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return g});c.d(f,"c",function(){return e});c.d(f,"b",function(){return d});var a=c(76),b=c(77);n=c(0);var m=c(14),u=c(56),v=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),
t=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},l=[m.o,m.l,m.d,m.h,"\nfloat computeHash(uint64_t x, vec4 a0, vec4 a1, float b, float c, float modulus, float scalar) {\n  x.low = unnormalizeUint8(x.low);\n  x.high = unnormalizeUint8(x.high);\n  float dotResult = imod(exactDot(a0, x.low) + exactDot(a1, x.high), modulus);\n  float dotResult2 = imod(dotResult * dotResult, modulus);\n  float y = imod(dotResult2 * c, modulus);\n  float modResult = imod(dotResult + y + b, modulus);\n  return fract(modResult * scalar);\n}\n"];
f.d=l;var g=function(b){function c(a,b){p(this,c);var d=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.gl=a;d.hashTable=b;d.hashFunctions=null;d.generation=-1;d.texture=null;b=b.hashFunctions.length;d.a=new Float32Array(16*b);d.b=new Float32Array(4*b+5);d.texture=a.createTexture();return d}q(c,b);v(c,[{key:"computeCoefficients",value:function(){var b=this.hashTable,c=b.hashFunctions;if(this.hashFunctions!==c){this.hashFunctions=c;for(var d=this.a,e=this.b,f=c.length,g=b.width,l=[1/g,
1/b.height],m=0;2>m;++m)e[4*f+m]=a.b,e[4*f+3+m]=l[m];e[4*f+2]=1/(b.entryStride*g);for(g=0;g<f;++g)for(l=c[g],m=0;2>m;++m){var k=l[m],r=4*g+2*m,t=4*(4*g+2*m);e[r]=k.b+(0===m?.5/b.entryStride:.5);e[r+1]=k.c;for(r=0;4>r;++r)d[t+r]=k.a0[r],d[t+4+r]=k.a1[r]}}}},{key:"copyToGPU",value:function(){this.computeCoefficients();var a=this.hashTable,b=a.generation;if(this.generation!==b){this.generation=b;var c=a.width,d=a.height,e=this.gl;b=this.texture;e.activeTexture(e.TEXTURE0+e.tempTextureUnit);e.bindTexture(e.TEXTURE_2D,
b);e.pixelStorei(e.UNPACK_ALIGNMENT,1);Object(u.b)(e);var f=e.RGBA;a.tableWithMungedEmptyKey(function(b){e.texImage2D(e.TEXTURE_2D,0,f,c*a.entryStride,d,0,f,e.UNSIGNED_BYTE,new Uint8Array(b.buffer))});e.bindTexture(e.TEXTURE_2D,null)}}},{key:"disposed",value:function(){this.gl.deleteTexture(this.texture);this.texture=null;this.hashTable=this.gl=void 0;this.hashFunctions=null;t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}],[{key:"get",value:function(a,b){var c=
this;return a.memoize.get(b,function(){return new c(a,b)})}}]);return c}(n.a),e=function(){function a(c,d){d=void 0===d?b.c:d;p(this,a);this.prefix=c;this.numAlternatives=d;$jscomp.initSymbol();this.textureUnitSymbol=Symbol.for("gpuhashtable:"+this.prefix);this.aName=this.prefix+"_a";this.bName=this.prefix+"_b";this.samplerName=this.prefix+"_sampler"}v(a,[{key:"defineShader",value:function(a){var b=this.aName,c=this.bName,d=this.samplerName,e=this.numAlternatives;a.addUniform("highp vec4",b,4*e);
a.addUniform("highp float",c,4*e+5);a.addTextureSampler2D(d,this.textureUnitSymbol);a.addFragmentCode(l);for(var f="",g=0;g<e;++g){for(var m=0;2>m;++m){var k=4*g+2*m,r=4*g+2*m;f+="\nfloat "+this.prefix+"_computeHash_"+g+"_"+m+"(uint64_t x) {\n  float primeModulus = "+c+"["+(4*e+m)+"];\n  float scalar = "+c+"["+(4*e+3+m)+"];\n  return computeHash(x,\n                     "+b+"["+r+"], "+b+"["+(r+1)+"],\n                     "+c+"["+k+"], "+c+"["+(k+1)+"],\n                     primeModulus, scalar);\n}\n"}f+=
"\nvec2 "+this.prefix+"_computeHash_"+g+"(uint64_t x) {\n  vec2 v;\n  v[0] = "+this.prefix+"_computeHash_"+g+"_0(x);\n  v[1] = "+this.prefix+"_computeHash_"+g+"_1(x);\n  return v;\n}\n"}f+="\nbool "+this.hasFunctionName+"(uint64_t x) {\n  float highOffset = "+c+"["+(4*e+2)+"];\n";for(b=0;b<e;++b)f+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+b+"(x);\n    vec4 lowResult = texture2D("+d+", v);\n    vec4 highResult = texture2D("+d+", vec2(v.x + highOffset, v.y));\n    if (lowResult == x.low && highResult == x.high) {\n      return true;\n    }\n  }\n";
a.addFragmentCode(f+"\n  return false;\n}\n")}},{key:"enable",value:function(a,b,c){c.copyToGPU();var d=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+d);a.bindTexture(a.TEXTURE_2D,c.texture);a.uniform4fv(b.uniform(this.aName),c.a);a.uniform1fv(b.uniform(this.bName),c.b)}},{key:"disable",value:function(a,b){b=b.textureUnit(this.textureUnitSymbol);a.activeTexture(a.TEXTURE0+b);a.bindTexture(a.TEXTURE_2D,null)}},{key:"hasFunctionName",get:function(){return this.prefix+"_has"}}]);return a}(),
d=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);v(b,[{key:"defineShader",value:function(a){t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);for(var c=this.samplerName,d=this.numAlternatives,e="\nbool "+this.getFunctionName+"(uint64_t x, out uint64_t value) {\n  float highOffset = "+this.bName+"["+(4*d+2)+"];\n",f=0;f<d;++f)e+="\n  {\n    vec2 v = "+this.prefix+"_computeHash_"+f+"(x);\n    vec4 lowResult = texture2D("+
c+", v);\n    vec4 highResult = texture2D("+c+", vec2(v.x + highOffset, v.y));\n    if (lowResult == x.low && highResult == x.high) {\n      value.low = texture2D("+c+", vec2(v.x + 2.0 * highOffset, v.y));\n      value.high = texture2D("+c+", vec2(v.x + 3.0 * highOffset, v.y));\n      return true;\n    }\n  }\n";a.addFragmentCode(e+"\n  return false;\n}\n")}},{key:"getFunctionName",get:function(){return this.prefix+"_get"}}]);return b}(e)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}f.c=function(a,b,c){c=void 0===c?!1:c;b=b.attribute("aIndexRaw");0<=b&&(c&&a.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(b,0),a.disableVertexAttribArray(b))};f.d=function(a){return a.memoize.get("IndexBuffer",
function(){return new u(a)})};f.b=function(a){a.addAttribute("highp vec3","aIndexRaw");a.addVertexCode(b.k);a.addVertexCode("\nuint32_t getPrimitiveIndex() {\n  uint32_t result;\n  result.value = vec4(aIndexRaw, 0.0);\n  return result;\n}\n")};c.d(f,"a",function(){return v});f.e=function(b,c){return q.a.fromData(b,new Uint8Array(c.buffer,c.byteOffset,c.byteLength),a.a,a.k)};n=c(0);var q=c(24),a=c(29),b=c(14),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),u=function(b){function c(a){p(this,c);var b=(c.__proto__||Object.getPrototypeOf(c)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.gl=a;b.buffer=b.registerDisposer(new q.a(a));return b}k(c,b);m(c,[{key:"resize",value:function(a){var b;
if(256>a){var c=b=new Uint8Array(a);for(var f=0;f<a;++f)c[f]=f;c=1}else if(65536>a){c=b=new Uint8Array(2*a);f=0;for(var g=2*a,l=0;l<g;l+=2)c[l]=f,c[l+1]=f>>8,++f;c=2}else if(16777216>a){c=b=new Uint8Array(3*a);f=3*a;for(l=g=0;l<f;l+=3)c[l]=g,c[l+1]=g>>8,c[l+2]=g>>16,++g;c=3}else throw Error("Length of index buffer must not exceed 2^24.");this.buffer.setData(b);this.numComponents=c;this.length=a}},{key:"ensure",value:function(a){(void 0===this.length||this.length<a)&&this.resize(a);return this}},{key:"bindToVertexAttrib",
value:function(b){this.buffer.bindToVertexAttrib(b,this.numComponents,a.t,!0)}},{key:"bind",value:function(a,b){b=void 0===b?0:b;a=a.attribute("aIndexRaw");0<=a&&(this.bindToVertexAttrib(a),0!==b&&this.gl.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(a,b))}}]);return c}(n.a),v=function(){function b(a){p(this,b);this.name=a;this.attributeName="a"+this.name;this.getterName="get"+this.name}m(b,[{key:"defineShader",value:function(a){a.addAttribute("highp vec4",this.attributeName);a.addVertexCode("\nfloat "+
this.getterName+" () {\n  vec4 temp = "+this.attributeName+";\n  return temp.x + temp.y * 256.0 + temp.z * 65536.0;\n}\n")}},{key:"bind",value:function(b,c){b.bindToVertexAttrib(c.attribute(this.attributeName),4,a.t,!1)}},{key:"disable",value:function(a){a.gl.disableVertexAttribArray(a.attribute(this.attributeName))}}]);return b}()},function(n,f,c){(function(f){function k(b){b=b||f.location||{};var c={},d=typeof b,g;if("blob:"===b.protocol)c=new a(unescape(b.pathname),{});else if("string"===d)for(g in c=
new a(b,{}),l)delete c[g];else if("object"===d){for(g in b)g in l||(c[g]=b[g]);void 0===c.slashes&&(c.slashes=p.test(b.href))}return c}function q(a){a=u.exec(a);return{protocol:a[1]?a[1].toLowerCase():"",slashes:!!a[2],rest:a[3]}}function a(c,e,d){if(!(this instanceof a))return new a(c,e,d);var f=t.slice();var g=typeof e;var l=0;"object"!==g&&"string"!==g&&(d=e,e=null);d&&"function"!==typeof d&&(d=m.parse);e=k(e);var u=q(c||"");g=!u.protocol&&!u.slashes;this.slashes=u.slashes||g&&e.slashes;this.protocol=
u.protocol||e.protocol||"";c=u.rest;for(u.slashes||(f[2]=[/(.*)/,"pathname"]);l<f.length;l++){u=f[l];var p=u[0];var v=u[1];if(p!==p)this[v]=c;else if("string"===typeof p)~(p=c.indexOf(p))&&("number"===typeof u[2]?(this[v]=c.slice(0,p),c=c.slice(p+u[2])):(this[v]=c.slice(p),c=c.slice(0,p)));else if(p=p.exec(c))this[v]=p[1],c=c.slice(0,p.index);this[v]=this[v]||(g&&u[3]?e[v]||"":"");u[4]&&(this[v]=this[v].toLowerCase())}d&&(this.query=d(this.query));if(g&&e.slashes&&"/"!==this.pathname.charAt(0)&&(""!==
this.pathname||""!==e.pathname)){c=this.pathname;e=(e.pathname||"/").split("/").slice(0,-1).concat(c.split("/"));c=e.length;d=e[c-1];f=!1;for(l=0;c--;)"."===e[c]?e.splice(c,1):".."===e[c]?(e.splice(c,1),l++):l&&(0===c&&(f=!0),e.splice(c,1),l--);f&&e.unshift("");"."!==d&&".."!==d||e.push("");this.pathname=e.join("/")}b(this.port,this.protocol)||(this.host=this.hostname,this.port="");this.username=this.password="";this.auth&&(u=this.auth.split(":"),this.username=u[0]||"",this.password=u[1]||"");this.origin=
this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null";this.href=this.toString()}var b=c(238),m=c(239),u=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,p=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,t=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],l={hash:1,query:1};a.prototype={set:function(a,c,d){switch(a){case "query":"string"===typeof c&&c.length&&(c=(d||m.parse)(c));this[a]=c;break;case "port":this[a]=
c;b(c,this.protocol)?c&&(this.host=this.hostname+":"+c):(this.host=this.hostname,this[a]="");break;case "hostname":this[a]=c;this.port&&(c+=":"+this.port);this.host=c;break;case "host":this[a]=c;/:\d+$/.test(c)?(c=c.split(":"),this.port=c.pop(),this.hostname=c.join(":")):(this.hostname=c,this.port="");break;case "protocol":this.protocol=c.toLowerCase();this.slashes=!d;break;case "pathname":this.pathname=c.length&&"/"!==c.charAt(0)?"/"+c:c;break;default:this[a]=c}for(a=0;a<t.length;a++)c=t[a],c[4]&&
(this[c[1]]=this[c[1]].toLowerCase());this.origin=this.protocol&&this.host&&"file:"!==this.protocol?this.protocol+"//"+this.host:"null";this.href=this.toString();return this},toString:function(a){a&&"function"===typeof a||(a=m.stringify);var b=this.protocol;b&&":"!==b.charAt(b.length-1)&&(b+=":");b+=this.slashes?"//":"";this.username&&(b+=this.username,this.password&&(b+=":"+this.password),b+="@");b+=this.host+this.pathname;(a="object"===typeof this.query?a(this.query):this.query)&&(b+="?"!==a.charAt(0)?
"?"+a:a);this.hash&&(b+=this.hash);return b}};a.extractProtocol=q;a.location=k;a.qs=m;n.exports=a}).call(f,c(5))},function(n,f,c){function p(){this._listeners={}}p.prototype.addEventListener=function(c,f){c in this._listeners||(this._listeners[c]=[]);var a=this._listeners[c];-1===a.indexOf(f)&&(a=a.concat([f]));this._listeners[c]=a};p.prototype.removeEventListener=function(c,f){var a=this._listeners[c];a&&(f=a.indexOf(f),-1!==f&&(1<a.length?this._listeners[c]=a.slice(0,f).concat(a.slice(f+1)):delete this._listeners[c]))};
p.prototype.dispatchEvent=function(){var c=arguments[0],f=c.type;c=1===arguments.length?[c]:Array.apply(null,arguments);this["on"+f]&&this["on"+f].apply(this,c);if(f in this._listeners){f=this._listeners[f];for(var a=0;a<f.length;a++)f[a].apply(this,c)}};n.exports=p},function(n,f,c){(function(f){function k(c,f,l,g,e){f=a.addPath(c,f);u(f);var d=this;b.call(this,c,l);this.poll=new m(g,f,e);this.poll.on("message",function(a){u("poll message",a);d.emit("message",a)});this.poll.once("close",function(a,
b){u("poll close",a,b);d.poll=null;d.emit("close",a,b);d.close()})}var q=c(3),a=c(18),b=c(244),m=c(245),u=function(){};"production"!==f.env.NODE_ENV&&(u=c(7)("sockjs-client:sender-receiver"));q(k,b);k.prototype.close=function(){b.prototype.close.call(this);u("close");this.removeAllListeners();this.poll&&(this.poll.abort(),this.poll=null)};n.exports=k}).call(f,c(6))},function(n,f,c){(function(f,k){function q(b,c,d,f){t(b,c);var e=this;a.call(this);setTimeout(function(){e._start(b,c,d,f)},0)}var a=
c(10).EventEmitter,b=c(3),m=c(33),u=c(18),p=f.XMLHttpRequest,t=function(){};"production"!==k.env.NODE_ENV&&(t=c(7)("sockjs-client:browser:xhr"));b(q,a);q.prototype._start=function(a,b,c,f){var d=this;try{this.xhr=new p}catch(C){}if(this.xhr){b=u.addQuery(b,"t="+ +new Date);this.unloadRef=m.unloadAdd(function(){t("unload cleanup");d._cleanup(!0)});try{this.xhr.open(a,b,!0),this.timeout&&"timeout"in this.xhr&&(this.xhr.timeout=this.timeout,this.xhr.ontimeout=function(){t("xhr timeout");d.emit("finish",
0,"");d._cleanup(!1)})}catch(C){t("exception",C);this.emit("finish",0,"");this._cleanup(!1);return}f&&f.noCredentials||!q.supportsCORS||(t("withCredentials"),this.xhr.withCredentials="true");if(f&&f.headers)for(var e in f.headers)this.xhr.setRequestHeader(e,f.headers[e]);this.xhr.onreadystatechange=function(){if(d.xhr){var a=d.xhr;t("readyState",a.readyState);switch(a.readyState){case 3:try{var b=a.status;var c=a.responseText}catch(y){}t("status",b);1223===b&&(b=204);200===b&&c&&0<c.length&&(t("chunk"),
d.emit("chunk",b,c));break;case 4:b=a.status;t("status",b);1223===b&&(b=204);if(12005===b||12029===b)b=0;t("finish",b,a.responseText);d.emit("finish",b,a.responseText);d._cleanup(!1)}}};try{d.xhr.send(c)}catch(C){d.emit("finish",0,""),d._cleanup(!1)}}else t("no xhr"),this.emit("finish",0,"no xhr support"),this._cleanup()};q.prototype._cleanup=function(a){t("cleanup");if(this.xhr){this.removeAllListeners();m.unloadDel(this.unloadRef);this.xhr.onreadystatechange=function(){};this.xhr.ontimeout&&(this.xhr.ontimeout=
null);if(a)try{this.xhr.abort()}catch(e){}this.unloadRef=this.xhr=null}};q.prototype.close=function(){t("close");this._cleanup(!0)};q.enabled=!!p;var l=["Active"].concat("Object").join("X");!q.enabled&&l in f&&(t("overriding xmlhttprequest"),p=function(){try{return new f[l]("Microsoft.XMLHTTP")}catch(g){return null}},q.enabled=!!new p);k=!1;try{k="withCredentials"in new p}catch(g){}q.supportsCORS=k;n.exports=q}).call(f,c(5),c(6))},function(n,f,c){function p(b){if(!a.enabled)throw Error("Transport created when disabled");
k.call(this,b,"/xhr_streaming",q,a)}f=c(3);var k=c(41),q=c(58),a=c(80);f(p,k);p.enabled=function(b){return b.cookie_needed||b.nullOrigin?!1:a.enabled&&b.sameScheme};p.transportName="xdr-streaming";p.roundTrips=2;n.exports=p},function(n,f,c){function p(b){if(!p.enabled())throw Error("Transport created when disabled");k.call(this,b,"/eventsource",q,a)}f=c(3);var k=c(41),q=c(246),a=c(59),b=c(129);f(p,k);p.enabled=function(){return!!b};p.transportName="eventsource";p.roundTrips=2;n.exports=p},function(n,
f,c){f=c(5);n.exports=f.EventSource},function(n,f,c){(function(f){function k(a,c,f){if(!k.enabled())throw Error("Transport created when disabled");b.call(this);var d=this;this.origin=u.getOrigin(f);this.baseUrl=f;this.transUrl=c;this.transport=a;this.windowId=l.string(8);f=u.addPath(f,"/iframe.html")+"#"+this.windowId;g(a,c,f);this.iframeObj=p.createIframe(f,function(a){g("err callback");d.emit("close",1006,"Unable to load an iframe ("+a+")");d.close()});this.onmessageCallback=this._message.bind(this);
t.attachEvent("message",this.onmessageCallback)}var q=c(3),a=c(26),b=c(10).EventEmitter,m=c(131),u=c(18),p=c(51),t=c(33),l=c(40),g=function(){};"production"!==f.env.NODE_ENV&&(g=c(7)("sockjs-client:transport:iframe"));q(k,b);k.prototype.close=function(){g("close");this.removeAllListeners();if(this.iframeObj){t.detachEvent("message",this.onmessageCallback);try{this.postMessage("c")}catch(e){}this.iframeObj.cleanup();this.onmessageCallback=this.iframeObj=this.iframeObj=null}};k.prototype._message=function(b){g("message",
b.data);if(u.isOriginEqual(b.origin,this.origin)){try{var c=a.parse(b.data)}catch(r){g("bad json",b.data);return}if(c.windowId!==this.windowId)g("mismatched window id",c.windowId,this.windowId);else switch(c.type){case "s":this.iframeObj.loaded();this.postMessage("s",a.stringify([m,this.transport,this.transUrl,this.baseUrl]));break;case "t":this.emit("message",c.data);break;case "c":try{var e=a.parse(c.data)}catch(r){g("bad json",c.data);break}this.emit("close",e[0],e[1]);this.close()}}else g("not same origin",
b.origin,this.origin)};k.prototype.postMessage=function(b,c){g("postMessage",b,c);this.iframeObj.post(a.stringify({windowId:this.windowId,type:b,data:c||""}),this.origin)};k.prototype.send=function(a){g("send",a);this.postMessage("m",a)};k.enabled=function(){return p.iframeEnabled};k.transportName="iframe";k.roundTrips=2;n.exports=k}).call(f,c(6))},function(n,f){n.exports="1.1.4"},function(n,f,c){function p(b){if(!k.enabled)throw Error("Transport created when disabled");a.call(this,b,"/htmlfile",
k,q)}f=c(3);var k=c(249),q=c(49),a=c(41);f(p,a);p.enabled=function(a){return k.enabled&&a.sameOrigin};p.transportName="htmlfile";p.roundTrips=2;n.exports=p},function(n,f,c){function p(c){if(!b.enabled&&!a.enabled)throw Error("Transport created when disabled");k.call(this,c,"/xhr",q,a)}f=c(3);var k=c(41),q=c(58),a=c(59),b=c(49);f(p,k);p.enabled=function(c){return c.nullOrigin?!1:b.enabled&&c.sameOrigin?!0:a.enabled};p.transportName="xhr-polling";p.roundTrips=2;n.exports=p},function(n,f,c){f=c(5);n.exports=
f.location||{origin:"http://localhost:80",protocol:"http",host:"localhost",port:80,href:"http://localhost/",hash:""}},function(n,f,c){function p(c){var f=this;k.call(this);this.ir=new b(c,a);this.ir.once("finish",function(a,b){f.ir=null;f.emit("message",q.stringify([a,b]))})}f=c(3);var k=c(10).EventEmitter,q=c(26),a=c(49),b=c(136);f(p,k);p.transportName="iframe-info-receiver";p.prototype.close=function(){this.ir&&(this.ir.close(),this.ir=null);this.removeAllListeners()};n.exports=p},function(n,f,
c){(function(f){function k(a,c){q.call(this);var f=this,g=+new Date;this.xo=new c("GET",a);this.xo.once("finish",function(a,c){if(200===a){var d=+new Date-g;if(c)try{var e=b.parse(c)}catch(B){u("bad json",c)}m.isObject(e)||(e={})}f.emit("finish",e,d);f.removeAllListeners()})}var q=c(10).EventEmitter,a=c(3),b=c(26),m=c(82),u=function(){};"production"!==f.env.NODE_ENV&&(u=c(7)("sockjs-client:info-ajax"));a(k,q);k.prototype.close=function(){this.removeAllListeners();this.xo.close()};n.exports=k}).call(f,
c(6))},function(n,f,c){f.a=function(c){if(!window.getSelection().isCollapsed)return!0;c=c.target.tagName;return"TEXTAREA"===c||"INPUT"===c?!0:!1};f.b=function(c,f){f=void 0===f?"text/plain":f;var a=!1,b=Object(p.c)(document,"copy",function(b){b.clipboardData.setData(f,c);a=!0;b.stopPropagation();b.preventDefault()},!0);try{document.execCommand("copy")}finally{b()}return a};var p=c(0)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,
b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});c.d(f,
"b",function(){return t});n=c(21);c=c(0);var a=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},b=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,f){c&&a(b.prototype,
c);f&&a(b,f);return b}}();$jscomp.initSymbol();var m=Symbol("SingleTextureVolumeChunk.textureUnit");$jscomp.initSymbol();var u=Symbol("SingleTextureVolumeChunk.textureLayout"),v=function(a){function c(a){p(this,c);var b=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.shaderKey=a;return b}q(c,a);b(c,[{key:"defineShader",value:function(a){a.addTextureSampler2D("uVolumeChunkSampler",m)}},{key:"beginDrawing",value:function(a,b){var c=b.textureUnit(m);a.activeTexture(a.TEXTURE0+c);b[u]=null}},
{key:"endDrawing",value:function(a,b){a.bindTexture(a.TEXTURE_2D,null);b[u]=null}},{key:"bindChunk",value:function(a,b,c){var d=c.textureLayout;b[u]!==d&&(b[u]=d,this.setupTextureLayout(a,b,d));a.bindTexture(a.TEXTURE_2D,c.texture)}},{key:"beginSource",value:function(a,b){}}]);return c}(c.a),t=function(c){function e(a,b){p(this,e);a=k(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,a,b));a.texture=null;a.data=b.data;return a}q(e,c);b(e,[{key:"copyToGPU",value:function(b){a(e.prototype.__proto__||
Object.getPrototypeOf(e.prototype),"copyToGPU",this).call(this,b);var c=this.texture=b.createTexture();b.bindTexture(b.TEXTURE_2D,c);this.setTextureData(b);b.bindTexture(b.TEXTURE_2D,null)}},{key:"freeGPUMemory",value:function(b){a(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"freeGPUMemory",this).call(this,b);b.deleteTexture(this.texture);this.texture=null;this.textureLayout.dispose();this.textureLayout=null}}]);return e}(n.a)},function(n,f,c){f.a=function(c,f,q,a,b,m){for(var k=0,p=
0,t=1,l=1,g=0;3>g;++g){var e=b[g],d=a[g],h=e%d;k+=Math.floor(e/d)*t;t*=Math.ceil(q[g]/d);p+=h*l;l*=d}a=f+2*k;q=c[a];a=c[a+1];b=q&16777215;q=q>>24&255;0<q&&(b+=m*(c[(f+a&16777215)+Math.floor(p*q/32)]>>p*q%32&(1<<q)-1));return b}},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(a,b){b=void 0===b?a.navigationState:new h.e(new h.g(a.navigationState.pose.position,h.f.makeRelative(a.navigationState.pose.orientation,b)),a.navigationState.zoomFactor);return new B.a(a.chunkManager,a.layerManager,
b)}function b(b){return new Map([["xy",a(b,J.get("xy"))],["xz",a(b,J.get("xz"))],["yz",a(b,J.get("yz"))]])}function m(a){return{mouseState:a.mouseState,layerManager:a.layerManager,showAxisLines:a.showAxisLines,visibility:a.visibility}}function u(a){return Object.assign({},m(a),{navigationState:a.perspectiveNavigationState,inputEventMap:a.inputEventBindings.perspectiveView})}function v(a){return Object.assign({},m(a),{navigationState:a.navigationState,inputEventMap:a.inputEventBindings.sliceView})}
function t(a,b,c){for(var d={},e=0;2>e;d={relatedLayout:d.relatedLayout},++e)d.relatedLayout=c[Math.min(c.length-1,e)],a.registerDisposer(Object(E.c)(b.element,0===e?"toggle-layout":"toggle-layout-alternative",function(b){return function(c){a.container.name=b.relatedLayout;c.stopPropagation()}}(d)))}function l(a){var b=V.get(a);if(void 0===b)throw Error("Invalid layout name: "+JSON.stringify(a)+".");return b}function g(a){l(a);return a}c.d(f,"b",function(){return H});c.d(f,"a",function(){return L});
n=c(9);var e=c.n(n),d=c(277),h=c(60),r=c(279),B=c(46),C=c(65),D=c(57),z=c(8);n=c(0);var y=c(12),E=c(17);f=c(1);var A=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),G=function Y(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),
null!==a)return Y(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(61);var H=function ha(){q(this,ha);this.perspectiveView=new E.a;this.sliceView=new E.a},J=new Map([["xy",void 0],["xz",f.l.rotateX(f.l.create(),f.l.create(),Math.PI/2)],["yz",f.l.rotateY(f.l.create(),f.l.create(),Math.PI/2)]]),F=function(a){function c(a,e,f){q(this,c);var g=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));g.container=a;g.rootElement=e;g.viewer=f;var h=b(f),l=f.display,
m=Object.assign({},u(f),{showSliceViews:f.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),k=Object.assign({},v(f),{showScaleBar:f.showScaleBar}),n=Object.assign({},v(f),{showScaleBar:new D.a(!1,!1)}),A=function(a,b,c){b=g.registerDisposer(new C.a(l,b,h.get(a),c));t(g,b,[a,a+"-3d"]);return b};a=[d.b(1,d.a("column",[d.b(1,d.a("row",[d.b(1,function(a){A("xy",a,k)}),d.b(1,function(a){A("xz",a,n)})])),d.b(1,d.a("row",[d.b(1,function(a){a=g.registerDisposer(new r.a(l,a,m));for(var b=$jscomp.makeIterator(h.values()),
c=b.next();!c.done;c=b.next())a.sliceViews.add(c.value.addRef());t(g,a,["3d"])}),d.b(1,function(a){A("yz",a,n)})]))]))];d.a("row",a)(e);l.onResize();return g}k(c,a);A(c,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);G(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),R=function(b){function c(b,e,f,g,h){q(this,c);var l=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));l.container=b;l.rootElement=e;l.viewer=f;l.direction=
g;var m=a(f,J.get(h)),k=f.display,n=Object.assign({},u(f),{showSliceViews:f.showPerspectiveSliceViews,showSliceViewsCheckbox:!0}),A=Object.assign({},v(f),{showScaleBar:f.showScaleBar});d.b(1,d.a(g,[d.b(1,function(a){a=l.registerDisposer(new C.a(k,a,m,A));t(l,a,[h,"4panel"])}),d.b(1,function(a){a=l.registerDisposer(new r.a(k,a,n));a.sliceViews.add(m.addRef());t(l,a,["3d","4panel"])})]))(e);k.onResize();return l}k(c,b);A(c,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);G(c.prototype.__proto__||
Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),K=function(b){function c(b,e,f,g){q(this,c);var h=p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));h.container=b;h.rootElement=e;h.viewer=f;var l=a(f,J.get(g)),m=Object.assign({},v(f),{showScaleBar:f.showScaleBar});d.a("row",[d.b(1,function(a){a=h.registerDisposer(new C.a(f.display,a,l,m));t(h,a,["4panel",g+"-3d"])})])(e);f.display.onResize();return h}k(c,b);A(c,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);
G(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(n.a),N=function(a){function b(a,c,e){q(this,b);var f=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.container=a;f.rootElement=c;f.viewer=e;var g=Object.assign({},u(e),{showSliceViews:new D.a(!1,!1)});d.a("row",[d.b(1,function(a){a=f.registerDisposer(new r.a(e.display,a,g));t(f,a,["4panel"])})])(c);e.display.onResize();return f}k(b,a);A(b,[{key:"disposed",value:function(){Object(y.a)(this.rootElement);
G(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}}]);return b}(n.a),V=new Map([["4panel",{factory:function(a,b,c){return new F(a,b,c)}}],["3d",{factory:function(a,b,c){return new N(a,b,c)}}]]);c={};f=$jscomp.makeIterator(J.keys());for(var T=f.next();!T.done;c={axes:c.axes},T=f.next())c.axes=T.value,V.set(c.axes,{factory:function(a){return function(b,c,d){return new K(b,c,d,a.axes)}}(c)}),V.set(c.axes+"-3d",{factory:function(a){return function(b,c,d){return new R(b,
c,d,"row",a.axes)}}(c)});var L=function(a){function b(a,c){c=void 0===c?"xy":c;q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.viewer=a;d.element=document.createElement("div");d.element.style.flex="1";d.layoutName=new z.a(c,g);var f=d.registerCancellable(e()(function(){return d.updateLayout()},0));d.layoutName.changed.add(f);d.registerDisposer(d.viewer.display.updateStarted.add(function(){return f.flush()}));f();return d}k(b,a);A(b,[{key:"toJSON",value:function(){return this.layoutName.toJSON()}},
{key:"restoreState",value:function(a){this.layoutName.restoreState(a)}},{key:"reset",value:function(){this.layoutName.reset()}},{key:"disposeLayout",value:function(){var a=this.layout;void 0!==a&&(a.dispose(),this.layout=void 0)}},{key:"updateLayout",value:function(){this.disposeLayout();this.layout=l(this.layoutName.value).factory(this,this.element,this.viewer)}},{key:"disposed",value:function(){this.disposeLayout();G(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},
{key:"name",get:function(){return this.layoutName.value},set:function(a){this.layoutName.value=a}},{key:"changed",get:function(){return this.layoutName.changed}}]);return b}(n.a)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);
a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return l});var q=c(15);n=c(39);var a=c(11),b=c(27),m=c(142),u=c(283),v=c(288),t=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,
f);return b}}();c(289);var l=function(c){function e(a,b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.manager=a;c.existingLayer=b;c.statusElement=document.createElement("div");c.submitElement=document.createElement("button");c.namePromptElement=document.createElement("label");c.nameInputElement=document.createElement("input");c.volumeCancellationSource=void 0;c.sourceValid=!1;c.nameValid=!0;var d=
c.content;d.classList.add("add-layer-overlay");var f=document.createElement("form");f.className="source-form";c.registerEventListener(f,"submit",function(a){a.preventDefault();c.validateSource(!0)});var g=document.createElement("label");g.textContent="Source:";a=c.sourceInput=c.registerDisposer(new u.a({completer:function(a,b){return c.manager.dataSourceProvider.volumeCompleter(a,c.manager.chunkManager,b).then(function(a){return{completions:a.completions,makeElement:u.b,offset:a.offset,showSingleResult:!0}})},
delay:0}));a.element.classList.add("add-layer-source");a.inputElement.addEventListener("blur",function(){c.validateSource(!1)});c.submitElement.disabled=!0;a.inputChanged.add(function(){var a=c.volumeCancellationSource;void 0!==a&&(a.cancel(),c.volumeCancellationSource=void 0);c.sourceValid=!1;c.submitElement.disabled=!0;c.statusElement.textContent=""});f.appendChild(g);f.appendChild(a.element);Object(m.a)(g,a.inputElement);g=Object(v.a)();f.appendChild(g);d.appendChild(f);var h=c.statusElement,l=
c.namePromptElement,k=c.nameInputElement;f=c.submitElement;h.className="dialog-status";g=document.createElement("form");g.className="name-form";l.textContent="Name:";k.className="add-layer-name";k.autocomplete="off";k.spellcheck=!1;k.type="text";c.registerEventListener(k,"input",function(){c.validateName()});f.type="submit";Object(m.a)(l,k);g.appendChild(l);g.appendChild(k);g.appendChild(f);d.appendChild(g);d.appendChild(h);void 0!==b?(void 0!==b.sourceUrl?(a.value=b.sourceUrl,c.validateSource()):
c.sourceValid=!0,a.disabled=!0,k.value=b.name,c.validateName(),f.textContent="Save",k.focus()):(b=c.manager.layerManager.managedLayers,0<b.length&&(b=b[b.length-1],b instanceof q.b&&(b=b.sourceUrl,void 0!==b&&(d=c.manager.dataSourceProvider.findSourceGroup(b),a.value=b.substring(0,d),a.inputElement.setSelectionRange(0,d)))),a.inputElement.focus(),f.textContent="Add Layer");c.registerEventListener(g,"submit",function(a){a.preventDefault();c.submit()});return c}k(e,c);t(e,[{key:"isNameValid",value:function(){var a=
this.nameInputElement.value;if(""===a)return!1;a=this.manager.layerManager.getLayerByName(a);return void 0===a||a===this.existingLayer}},{key:"submit",value:function(){this.sourceValid&&this.isNameValid()&&(this.existingLayer?(this.existingLayer.name=this.nameInputElement.value,this.manager.layerManager.layersChanged.dispatch()):this.manager.add(this.manager.getLayer(this.nameInputElement.value,this.sourceInput.value)),this.dispose())}},{key:"validateName",value:function(){var a=this.nameInputElement;
(this.nameValid=this.isNameValid())?(a.classList.add("valid-input"),a.classList.remove("invalid-input")):(a.classList.remove("valid-input"),a.classList.add("invalid-input"));this.validityChanged()}},{key:"validityChanged",value:function(){this.submitElement.disabled=!(this.nameValid&&this.sourceValid)}},{key:"validateSource",value:function(c){var d=this;c=void 0===c?!1:c;var e=this.sourceInput.value;if(""!==e){try{var f=this.manager.dataSourceProvider.suggestLayerName(e),g=this.nameInputElement;if(""===
this.nameInputElement.value){var l=this.manager.layerManager.getUniqueLayerName(f);g.value=l;g.setSelectionRange(0,l.length);this.validateName()}c&&g.focus()}catch(y){this.setError(y.message);return}this.setInfo("Validating volume source...");var m=this.volumeCancellationSource=new b.b;this.manager.dataSourceProvider.getVolume(this.manager.chunkManager,e,void 0,m).then(function(b){m.isCanceled||(d.volumeCancellationSource=void 0,d.sourceValid=!0,d.setInfo(a.d[b.volumeType].toLowerCase()+": "+(b.numChannels+
"-channel "+a.a[b.dataType].toLowerCase())),d.validityChanged())}).catch(function(a){m.isCanceled||(d.volumeCancellationSource=void 0,d.setError(a.message))})}}},{key:"setInfo",value:function(a){this.statusElement.className="dialog-status dialog-status-info";this.statusElement.textContent=a}},{key:"setError",value:function(a){this.statusElement.className="dialog-status dialog-status-error";this.statusElement.textContent=a}}]);return e}(n.a)},function(n,f,c){f.a=function(c,f){""===f.id&&(f.id="unique-id-for-association-"+
p++);c.setAttribute("for",f.id)};var p=0},function(n,f,c){f.a=function(c){var f=-1;return Object.assign(function(){-1===f&&(f=requestAnimationFrame(function(){f=-1;c()}))},{flush:function(){-1!==f&&(f=-1,c())},cancel:function(){-1!==f&&(cancelAnimationFrame(f),f=-1)}})}},function(n,f,c){f.a=function(c,a){var b=Object(p.c)(c,"drop",function(b){b.preventDefault();if(-1!==b.dataTransfer.types.indexOf(k.d)){var c=JSON.parse(b.dataTransfer.getData(k.d));a.restoreState(c);b.stopPropagation()}}),f=Object(p.c)(c,
"dragover",function(a){-1!==a.dataTransfer.types.indexOf(k.d)&&(a.dataTransfer.dropEffect="link",a.preventDefault(),a.stopPropagation())});return function(){f();b()}};var p=c(0),k=c(87)},function(n,f,c){c(88);c(177);c(70);c(178);c(107);c(180);c(108);c(182);c(110);c(183);c(111);c(185);c(112);c(187);c(188);c(189);c(113);c(191);c(200);c(204);c(215);c(219);n.exports=c(226)},function(n,f,c){c(22)},function(n,f,c){c(22)},function(n,f,c){function p(a,b,c){var f=b[0],m=b[1],k=b[2],l=b[3],g=b[4],e=b[5],d=
b[6],h=b[7],r=b[8],q=b[9],p=b[10],n=b[11],z=b[12],y=b[13],E=b[14];b=b[15];var A=c[0],G=c[1],H=c[2],J=c[3];a[0]=A*f+G*g+H*r+J*z;a[1]=A*m+G*e+H*q+J*y;a[2]=A*k+G*d+H*p+J*E;a[3]=A*l+G*h+H*n+J*b;A=c[4];G=c[5];H=c[6];J=c[7];a[4]=A*f+G*g+H*r+J*z;a[5]=A*m+G*e+H*q+J*y;a[6]=A*k+G*d+H*p+J*E;a[7]=A*l+G*h+H*n+J*b;A=c[8];G=c[9];H=c[10];J=c[11];a[8]=A*f+G*g+H*r+J*z;a[9]=A*m+G*e+H*q+J*y;a[10]=A*k+G*d+H*p+J*E;a[11]=A*l+G*h+H*n+J*b;A=c[12];G=c[13];H=c[14];J=c[15];a[12]=A*f+G*g+H*r+J*z;a[13]=A*m+G*e+H*q+J*y;a[14]=A*
k+G*d+H*p+J*E;a[15]=A*l+G*h+H*n+J*b;return a}function k(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];a[2]=b[2]-c[2];a[3]=b[3]-c[3];a[4]=b[4]-c[4];a[5]=b[5]-c[5];a[6]=b[6]-c[6];a[7]=b[7]-c[7];a[8]=b[8]-c[8];a[9]=b[9]-c[9];a[10]=b[10]-c[10];a[11]=b[11]-c[11];a[12]=b[12]-c[12];a[13]=b[13]-c[13];a[14]=b[14]-c[14];a[15]=b[15]-c[15];return a}Object.defineProperty(f,"__esModule",{value:!0});f.create=function(){var a=new q.a(16);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=
0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.clone=function(a){var b=new q.a(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};f.copy=function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];a[3]=b[3];a[4]=b[4];a[5]=b[5];a[6]=b[6];a[7]=b[7];a[8]=b[8];a[9]=b[9];a[10]=b[10];a[11]=b[11];a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};f.fromValues=function(a,b,c,f,k,t,
l,g,e,d,h,r,p,n,D,z){var m=new q.a(16);m[0]=a;m[1]=b;m[2]=c;m[3]=f;m[4]=k;m[5]=t;m[6]=l;m[7]=g;m[8]=e;m[9]=d;m[10]=h;m[11]=r;m[12]=p;m[13]=n;m[14]=D;m[15]=z;return m};f.set=function(a,b,c,f,k,t,l,g,e,d,h,r,q,p,n,z,y){a[0]=b;a[1]=c;a[2]=f;a[3]=k;a[4]=t;a[5]=l;a[6]=g;a[7]=e;a[8]=d;a[9]=h;a[10]=r;a[11]=q;a[12]=p;a[13]=n;a[14]=z;a[15]=y;return a};f.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.transpose=
function(a,b){if(a===b){var c=b[1],f=b[2],k=b[3],t=b[6],l=b[7],g=b[11];a[1]=b[4];a[2]=b[8];a[3]=b[12];a[4]=c;a[6]=b[9];a[7]=b[13];a[8]=f;a[9]=t;a[11]=b[14];a[12]=k;a[13]=l;a[14]=g}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a};f.invert=function(a,b){var c=b[0],f=b[1],k=b[2],t=b[3],l=b[4],g=b[5],e=b[6],d=b[7],h=b[8],r=b[9],q=b[10],p=b[11],n=b[12],z=b[13],y=b[14];
b=b[15];var E=c*g-f*l,A=c*e-k*l,G=c*d-t*l,H=f*e-k*g,J=f*d-t*g,F=k*d-t*e,R=h*z-r*n,K=h*y-q*n,N=h*b-p*n,V=r*y-q*z,T=r*b-p*z,L=q*b-p*y,S=E*L-A*T+G*V+H*N-J*K+F*R;if(!S)return null;S=1/S;a[0]=(g*L-e*T+d*V)*S;a[1]=(k*T-f*L-t*V)*S;a[2]=(z*F-y*J+b*H)*S;a[3]=(q*J-r*F-p*H)*S;a[4]=(e*N-l*L-d*K)*S;a[5]=(c*L-k*N+t*K)*S;a[6]=(y*G-n*F-b*A)*S;a[7]=(h*F-q*G+p*A)*S;a[8]=(l*T-g*N+d*R)*S;a[9]=(f*N-c*T-t*R)*S;a[10]=(n*J-z*G+b*E)*S;a[11]=(r*G-h*J-p*E)*S;a[12]=(g*K-l*V-e*R)*S;a[13]=(c*V-f*K+k*R)*S;a[14]=(z*A-n*H-y*E)*S;
a[15]=(h*H-r*A+q*E)*S;return a};f.adjoint=function(a,b){var c=b[0],f=b[1],k=b[2],t=b[3],l=b[4],g=b[5],e=b[6],d=b[7],h=b[8],r=b[9],q=b[10],p=b[11],n=b[12],z=b[13],y=b[14];b=b[15];a[0]=g*(q*b-p*y)-r*(e*b-d*y)+z*(e*p-d*q);a[1]=-(f*(q*b-p*y)-r*(k*b-t*y)+z*(k*p-t*q));a[2]=f*(e*b-d*y)-g*(k*b-t*y)+z*(k*d-t*e);a[3]=-(f*(e*p-d*q)-g*(k*p-t*q)+r*(k*d-t*e));a[4]=-(l*(q*b-p*y)-h*(e*b-d*y)+n*(e*p-d*q));a[5]=c*(q*b-p*y)-h*(k*b-t*y)+n*(k*p-t*q);a[6]=-(c*(e*b-d*y)-l*(k*b-t*y)+n*(k*d-t*e));a[7]=c*(e*p-d*q)-l*(k*p-
t*q)+h*(k*d-t*e);a[8]=l*(r*b-p*z)-h*(g*b-d*z)+n*(g*p-d*r);a[9]=-(c*(r*b-p*z)-h*(f*b-t*z)+n*(f*p-t*r));a[10]=c*(g*b-d*z)-l*(f*b-t*z)+n*(f*d-t*g);a[11]=-(c*(g*p-d*r)-l*(f*p-t*r)+h*(f*d-t*g));a[12]=-(l*(r*y-q*z)-h*(g*y-e*z)+n*(g*q-e*r));a[13]=c*(r*y-q*z)-h*(f*y-k*z)+n*(f*q-k*r);a[14]=-(c*(g*y-e*z)-l*(f*y-k*z)+n*(f*e-k*g));a[15]=c*(g*q-e*r)-l*(f*q-k*r)+h*(f*e-k*g);return a};f.determinant=function(a){var b=a[0],c=a[1],f=a[2],k=a[3],t=a[4],l=a[5],g=a[6],e=a[7],d=a[8],h=a[9],r=a[10],q=a[11],p=a[12],n=a[13],
z=a[14];a=a[15];return(b*l-c*t)*(r*a-q*z)-(b*g-f*t)*(h*a-q*n)+(b*e-k*t)*(h*z-r*n)+(c*g-f*l)*(d*a-q*p)-(c*e-k*l)*(d*z-r*p)+(f*e-k*g)*(d*n-h*p)};f.multiply=p;f.translate=function(a,b,c){var f=c[0],m=c[1];c=c[2];if(b===a)a[12]=b[0]*f+b[4]*m+b[8]*c+b[12],a[13]=b[1]*f+b[5]*m+b[9]*c+b[13],a[14]=b[2]*f+b[6]*m+b[10]*c+b[14],a[15]=b[3]*f+b[7]*m+b[11]*c+b[15];else{var k=b[0];var l=b[1];var g=b[2];var e=b[3];var d=b[4];var h=b[5];var r=b[6];var q=b[7];var p=b[8];var n=b[9];var z=b[10];var y=b[11];a[0]=k;a[1]=
l;a[2]=g;a[3]=e;a[4]=d;a[5]=h;a[6]=r;a[7]=q;a[8]=p;a[9]=n;a[10]=z;a[11]=y;a[12]=k*f+d*m+p*c+b[12];a[13]=l*f+h*m+n*c+b[13];a[14]=g*f+r*m+z*c+b[14];a[15]=e*f+q*m+y*c+b[15]}return a};f.scale=function(a,b,c){var f=c[0],m=c[1];c=c[2];a[0]=b[0]*f;a[1]=b[1]*f;a[2]=b[2]*f;a[3]=b[3]*f;a[4]=b[4]*m;a[5]=b[5]*m;a[6]=b[6]*m;a[7]=b[7]*m;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};f.rotate=function(a,b,c,f){var m=f[0],k=f[1];f=f[2];var l=Math.sqrt(m*
m+k*k+f*f);if(Math.abs(l)<q.b)return null;l=1/l;m*=l;k*=l;f*=l;var g=Math.sin(c);var e=Math.cos(c);var d=1-e;c=b[0];l=b[1];var h=b[2];var r=b[3];var p=b[4];var u=b[5];var n=b[6];var z=b[7];var y=b[8];var E=b[9];var A=b[10];var G=b[11];var H=m*m*d+e;var J=k*m*d+f*g;var F=f*m*d-k*g;var R=m*k*d-f*g;var K=k*k*d+e;var N=f*k*d+m*g;var V=m*f*d+k*g;m=k*f*d-m*g;k=f*f*d+e;a[0]=c*H+p*J+y*F;a[1]=l*H+u*J+E*F;a[2]=h*H+n*J+A*F;a[3]=r*H+z*J+G*F;a[4]=c*R+p*K+y*N;a[5]=l*R+u*K+E*N;a[6]=h*R+n*K+A*N;a[7]=r*R+z*K+G*N;
a[8]=c*V+p*m+y*k;a[9]=l*V+u*m+E*k;a[10]=h*V+n*m+A*k;a[11]=r*V+z*m+G*k;b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a};f.rotateX=function(a,b,c){var f=Math.sin(c);c=Math.cos(c);var m=b[4],k=b[5],l=b[6],g=b[7],e=b[8],d=b[9],h=b[10],r=b[11];b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[4]=m*c+e*f;a[5]=k*c+d*f;a[6]=l*c+h*f;a[7]=g*c+r*f;a[8]=e*c-m*f;a[9]=d*c-k*f;a[10]=h*c-l*f;a[11]=r*c-g*f;return a};f.rotateY=function(a,b,c){var f=
Math.sin(c);c=Math.cos(c);var m=b[0],k=b[1],l=b[2],g=b[3],e=b[8],d=b[9],h=b[10],r=b[11];b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);a[0]=m*c-e*f;a[1]=k*c-d*f;a[2]=l*c-h*f;a[3]=g*c-r*f;a[8]=m*f+e*c;a[9]=k*f+d*c;a[10]=l*f+h*c;a[11]=g*f+r*c;return a};f.rotateZ=function(a,b,c){var f=Math.sin(c);c=Math.cos(c);var m=b[0],k=b[1],l=b[2],g=b[3],e=b[4],d=b[5],h=b[6],r=b[7];b!==a&&(a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=
b[14],a[15]=b[15]);a[0]=m*c+e*f;a[1]=k*c+d*f;a[2]=l*c+h*f;a[3]=g*c+r*f;a[4]=e*c-m*f;a[5]=d*c-k*f;a[6]=h*c-l*f;a[7]=r*c-g*f;return a};f.fromTranslation=function(a,b){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=b[0];a[13]=b[1];a[14]=b[2];a[15]=1;return a};f.fromScaling=function(a,b){a[0]=b[0];a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b[1];a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=b[2];a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromRotation=function(a,b,c){var f=
c[0],m=c[1];c=c[2];var k=Math.sqrt(f*f+m*m+c*c);if(Math.abs(k)<q.b)return null;k=1/k;f*=k;m*=k;c*=k;k=Math.sin(b);b=Math.cos(b);var l=1-b;a[0]=f*f*l+b;a[1]=m*f*l+c*k;a[2]=c*f*l-m*k;a[3]=0;a[4]=f*m*l-c*k;a[5]=m*m*l+b;a[6]=c*m*l+f*k;a[7]=0;a[8]=f*c*l+m*k;a[9]=m*c*l-f*k;a[10]=c*c*l+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromXRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=c;a[7]=0;a[8]=0;a[9]=-c;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=
0;a[15]=1;return a};f.fromYRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=0;a[2]=-c;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=c;a[9]=0;a[10]=b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromZRotation=function(a,b){var c=Math.sin(b);b=Math.cos(b);a[0]=b;a[1]=c;a[2]=0;a[3]=0;a[4]=-c;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.fromRotationTranslation=function(a,b,c){var f=b[0],m=b[1],k=b[2],l=b[3],g=f+f,e=m+m,d=k+k;b=f*g;var h=
f*e;f*=d;var r=m*e;m*=d;k*=d;g*=l;e*=l;l*=d;a[0]=1-(r+k);a[1]=h+l;a[2]=f-e;a[3]=0;a[4]=h-l;a[5]=1-(b+k);a[6]=m+g;a[7]=0;a[8]=f+e;a[9]=m-g;a[10]=1-(b+r);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};f.getTranslation=function(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];return a};f.getScaling=function(a,b){var c=b[0],f=b[1],k=b[2],t=b[4],l=b[5],g=b[6],e=b[8],d=b[9];b=b[10];a[0]=Math.sqrt(c*c+f*f+k*k);a[1]=Math.sqrt(t*t+l*l+g*g);a[2]=Math.sqrt(e*e+d*d+b*b);return a};f.getRotation=function(a,b){var c=
b[0]+b[5]+b[10];0<c?(c=2*Math.sqrt(c+1),a[3]=.25*c,a[0]=(b[6]-b[9])/c,a[1]=(b[8]-b[2])/c,a[2]=(b[1]-b[4])/c):b[0]>b[5]&b[0]>b[10]?(c=2*Math.sqrt(1+b[0]-b[5]-b[10]),a[3]=(b[6]-b[9])/c,a[0]=.25*c,a[1]=(b[1]+b[4])/c,a[2]=(b[8]+b[2])/c):b[5]>b[10]?(c=2*Math.sqrt(1+b[5]-b[0]-b[10]),a[3]=(b[8]-b[2])/c,a[0]=(b[1]+b[4])/c,a[1]=.25*c,a[2]=(b[6]+b[9])/c):(c=2*Math.sqrt(1+b[10]-b[0]-b[5]),a[3]=(b[1]-b[4])/c,a[0]=(b[8]+b[2])/c,a[1]=(b[6]+b[9])/c,a[2]=.25*c);return a};f.fromRotationTranslationScale=function(a,
b,c,f){var m=b[0],k=b[1],l=b[2],g=b[3],e=m+m,d=k+k,h=l+l;b=m*e;var r=m*d;m*=h;var q=k*d;k*=h;l*=h;e*=g;d*=g;g*=h;h=f[0];var p=f[1];f=f[2];a[0]=(1-(q+l))*h;a[1]=(r+g)*h;a[2]=(m-d)*h;a[3]=0;a[4]=(r-g)*p;a[5]=(1-(b+l))*p;a[6]=(k+e)*p;a[7]=0;a[8]=(m+d)*f;a[9]=(k-e)*f;a[10]=(1-(b+q))*f;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};f.fromRotationTranslationScaleOrigin=function(a,b,c,f,k){var m=b[0],l=b[1],g=b[2],e=b[3],d=m+m,h=l+l,r=g+g;b=m*d;var p=m*h;m*=r;var q=l*h;l*=r;g*=r;d*=e;h*=e;e*=
r;r=f[0];var n=f[1];f=f[2];var u=k[0],v=k[1];k=k[2];a[0]=(1-(q+g))*r;a[1]=(p+e)*r;a[2]=(m-h)*r;a[3]=0;a[4]=(p-e)*n;a[5]=(1-(b+g))*n;a[6]=(l+d)*n;a[7]=0;a[8]=(m+h)*f;a[9]=(l-d)*f;a[10]=(1-(b+q))*f;a[11]=0;a[12]=c[0]+u-(a[0]*u+a[4]*v+a[8]*k);a[13]=c[1]+v-(a[1]*u+a[5]*v+a[9]*k);a[14]=c[2]+k-(a[2]*u+a[6]*v+a[10]*k);a[15]=1;return a};f.fromQuat=function(a,b){var c=b[0],f=b[1],k=b[2];b=b[3];var t=c+c,l=f+f,g=k+k;c*=t;var e=f*t;f*=l;var d=k*t,h=k*l;k*=g;t*=b;l*=b;b*=g;a[0]=1-f-k;a[1]=e+b;a[2]=d-l;a[3]=0;
a[4]=e-b;a[5]=1-c-k;a[6]=h+t;a[7]=0;a[8]=d+l;a[9]=h-t;a[10]=1-c-f;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};f.frustum=function(a,b,c,f,k,t,l){var g=1/(c-b),e=1/(k-f),d=1/(t-l);a[0]=2*t*g;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*t*e;a[6]=0;a[7]=0;a[8]=(c+b)*g;a[9]=(k+f)*e;a[10]=(l+t)*d;a[11]=-1;a[12]=0;a[13]=0;a[14]=l*t*2*d;a[15]=0;return a};f.perspective=function(a,b,c,f,k){b=1/Math.tan(b/2);var m=1/(f-k);a[0]=b/c;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=b;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=(k+f)*m;a[11]=
-1;a[12]=0;a[13]=0;a[14]=2*k*f*m;a[15]=0;return a};f.perspectiveFromFieldOfView=function(a,b,c,f){var m=Math.tan(b.upDegrees*Math.PI/180),k=Math.tan(b.downDegrees*Math.PI/180),l=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var g=2/(l+b),e=2/(m+k);a[0]=g;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=e;a[6]=0;a[7]=0;a[8]=-((l-b)*g*.5);a[9]=(m-k)*e*.5;a[10]=f/(c-f);a[11]=-1;a[12]=0;a[13]=0;a[14]=f*c/(c-f);a[15]=0;return a};f.ortho=function(a,b,c,f,k,p,l){var g=1/(b-c),e=1/(f-k),d=1/
(p-l);a[0]=-2*g;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*e;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*d;a[11]=0;a[12]=(b+c)*g;a[13]=(k+f)*e;a[14]=(l+p)*d;a[15]=1;return a};f.lookAt=function(a,b,c,f){var m=b[0],k=b[1];b=b[2];var l=f[0];var g=f[1];var e=f[2];var d=c[0];f=c[1];var h=c[2];if(Math.abs(m-d)<q.b&&Math.abs(k-f)<q.b&&Math.abs(b-h)<q.b)return mat4.identity(a);c=m-d;f=k-f;d=b-h;var r=1/Math.sqrt(c*c+f*f+d*d);c*=r;f*=r;d*=r;h=g*d-e*f;e=e*c-l*d;l=l*f-g*c;(r=Math.sqrt(h*h+e*e+l*l))?(r=1/r,h*=r,e*=r,l*=r):
l=e=h=0;g=f*l-d*e;var p=d*h-c*l;var n=c*e-f*h;(r=Math.sqrt(g*g+p*p+n*n))?(r=1/r,g*=r,p*=r,n*=r):n=p=g=0;a[0]=h;a[1]=g;a[2]=c;a[3]=0;a[4]=e;a[5]=p;a[6]=f;a[7]=0;a[8]=l;a[9]=n;a[10]=d;a[11]=0;a[12]=-(h*m+e*k+l*b);a[13]=-(g*m+p*k+n*b);a[14]=-(c*m+f*k+d*b);a[15]=1;return a};f.targetTo=function(a,b,c,f){var m=b[0],k=b[1];b=b[2];var l=f[0],g=f[1],e=f[2];f=m-c[0];var d=k-c[1];c=b-c[2];var h=f*f+d*d+c*c;0<h&&(h=1/Math.sqrt(h),f*=h,d*=h,c*=h);h=g*c-e*d;e=e*f-l*c;l=l*d-g*f;a[0]=h;a[1]=e;a[2]=l;a[3]=0;a[4]=
d*l-c*e;a[5]=c*h-f*l;a[6]=f*e-d*h;a[7]=0;a[8]=f;a[9]=d;a[10]=c;a[11]=0;a[12]=m;a[13]=k;a[14]=b;a[15]=1;return a};f.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"};f.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],
2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))};f.add=function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];a[2]=b[2]+c[2];a[3]=b[3]+c[3];a[4]=b[4]+c[4];a[5]=b[5]+c[5];a[6]=b[6]+c[6];a[7]=b[7]+c[7];a[8]=b[8]+c[8];a[9]=b[9]+c[9];a[10]=b[10]+c[10];a[11]=b[11]+c[11];a[12]=b[12]+c[12];a[13]=b[13]+c[13];a[14]=b[14]+c[14];a[15]=b[15]+c[15];return a};f.subtract=k;f.multiplyScalar=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;a[2]=b[2]*c;a[3]=b[3]*c;a[4]=
b[4]*c;a[5]=b[5]*c;a[6]=b[6]*c;a[7]=b[7]*c;a[8]=b[8]*c;a[9]=b[9]*c;a[10]=b[10]*c;a[11]=b[11]*c;a[12]=b[12]*c;a[13]=b[13]*c;a[14]=b[14]*c;a[15]=b[15]*c;return a};f.multiplyScalarAndAdd=function(a,b,c,f){a[0]=b[0]+c[0]*f;a[1]=b[1]+c[1]*f;a[2]=b[2]+c[2]*f;a[3]=b[3]+c[3]*f;a[4]=b[4]+c[4]*f;a[5]=b[5]+c[5]*f;a[6]=b[6]+c[6]*f;a[7]=b[7]+c[7]*f;a[8]=b[8]+c[8]*f;a[9]=b[9]+c[9]*f;a[10]=b[10]+c[10]*f;a[11]=b[11]+c[11]*f;a[12]=b[12]+c[12]*f;a[13]=b[13]+c[13]*f;a[14]=b[14]+c[14]*f;a[15]=b[15]+c[15]*f;return a};
f.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]};f.equals=function(a,b){var c=a[0],f=a[1],k=a[2],p=a[3],l=a[4],g=a[5],e=a[6],d=a[7],h=a[8],r=a[9],n=a[10],C=a[11],D=a[12],z=a[13],y=a[14];a=a[15];var E=b[0],A=b[1],G=b[2],H=b[3],J=b[4],F=b[5],R=b[6],K=b[7],N=b[8],V=b[9],T=b[10],L=b[11],S=b[12],Y=b[13],
ha=b[14];b=b[15];return Math.abs(c-E)<=q.b*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(f-A)<=q.b*Math.max(1,Math.abs(f),Math.abs(A))&&Math.abs(k-G)<=q.b*Math.max(1,Math.abs(k),Math.abs(G))&&Math.abs(p-H)<=q.b*Math.max(1,Math.abs(p),Math.abs(H))&&Math.abs(l-J)<=q.b*Math.max(1,Math.abs(l),Math.abs(J))&&Math.abs(g-F)<=q.b*Math.max(1,Math.abs(g),Math.abs(F))&&Math.abs(e-R)<=q.b*Math.max(1,Math.abs(e),Math.abs(R))&&Math.abs(d-K)<=q.b*Math.max(1,Math.abs(d),Math.abs(K))&&Math.abs(h-N)<=q.b*Math.max(1,
Math.abs(h),Math.abs(N))&&Math.abs(r-V)<=q.b*Math.max(1,Math.abs(r),Math.abs(V))&&Math.abs(n-T)<=q.b*Math.max(1,Math.abs(n),Math.abs(T))&&Math.abs(C-L)<=q.b*Math.max(1,Math.abs(C),Math.abs(L))&&Math.abs(D-S)<=q.b*Math.max(1,Math.abs(D),Math.abs(S))&&Math.abs(z-Y)<=q.b*Math.max(1,Math.abs(z),Math.abs(Y))&&Math.abs(y-ha)<=q.b*Math.max(1,Math.abs(y),Math.abs(ha))&&Math.abs(a-b)<=q.b*Math.max(1,Math.abs(a),Math.abs(b))};var q=c(22);f.mul=p;f.sub=k},function(n,f,c){function p(){var a=new m.a(4);a[0]=0;
a[1]=0;a[2]=0;a[3]=1;return a}function k(a,b,c){c*=.5;var d=Math.sin(c);a[0]=d*b[0];a[1]=d*b[1];a[2]=d*b[2];a[3]=Math.cos(c);return a}function q(a,b,c){var d=b[0],e=b[1],f=b[2];b=b[3];var g=c[0],l=c[1],k=c[2];c=c[3];a[0]=d*c+b*g+e*k-f*l;a[1]=e*c+b*l+f*g-d*k;a[2]=f*c+b*k+d*l-e*g;a[3]=b*c-d*g-e*l-f*k;return a}function a(a,b,c,d){var e=b[0],f=b[1],g=b[2];b=b[3];var l=c[0],k=c[1],m=c[2];c=c[3];var p=e*l+f*k+g*m+b*c;0>p&&(p=-p,l=-l,k=-k,m=-m,c=-c);if(1E-6<1-p){var q=Math.acos(p);var t=Math.sin(q);p=Math.sin((1-
d)*q)/t;d=Math.sin(d*q)/t}else p=1-d;a[0]=p*e+d*l;a[1]=p*f+d*k;a[2]=p*g+d*m;a[3]=p*b+d*c;return a}function b(a,b){var c=b[0]+b[4]+b[8];if(0<c)c=Math.sqrt(c+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var d=0;b[4]>b[0]&&(d=1);b[8]>b[3*d+d]&&(d=2);var f=(d+1)%3,g=(d+2)%3;c=Math.sqrt(b[3*d+d]-b[3*f+f]-b[3*g+g]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*f+g]-b[3*g+f])*c;a[f]=(b[3*f+d]+b[3*d+f])*c;a[g]=(b[3*g+d]+b[3*d+g])*c}return a}Object.defineProperty(f,"__esModule",{value:!0});
f.create=p;f.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};f.setAxisAngle=k;f.getAxisAngle=function(a,b){var c=2*Math.acos(b[3]),d=Math.sin(c/2);0!=d?(a[0]=b[0]/d,a[1]=b[1]/d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0);return c};f.multiply=q;f.rotateX=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+b*g;a[1]=e*c+f*g;a[2]=f*c-e*g;a[3]=b*c-d*g;return a};f.rotateY=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);
a[0]=d*c-f*g;a[1]=e*c+b*g;a[2]=f*c+d*g;a[3]=b*c-e*g;return a};f.rotateZ=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2];b=b[3];var g=Math.sin(c);c=Math.cos(c);a[0]=d*c+e*g;a[1]=e*c-d*g;a[2]=f*c+b*g;a[3]=b*c-f*g;return a};f.calculateW=function(a,b){var c=b[0],d=b[1];b=b[2];a[0]=c;a[1]=d;a[2]=b;a[3]=Math.sqrt(Math.abs(1-c*c-d*d-b*b));return a};f.slerp=a;f.invert=function(a,b){var c=b[0],d=b[1],f=b[2];b=b[3];var g=c*c+d*d+f*f+b*b;g=g?1/g:0;a[0]=-c*g;a[1]=-d*g;a[2]=-f*g;a[3]=b*g;return a};f.conjugate=
function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a};f.fromMat3=b;f.fromEuler=function(a,b,c,d){var e=.5*Math.PI/180;b*=e;c*=e;d*=e;e=Math.sin(b);b=Math.cos(b);var f=Math.sin(c);c=Math.cos(c);var g=Math.sin(d);d=Math.cos(d);a[0]=e*c*d-b*f*g;a[1]=b*f*d+e*c*g;a[2]=b*c*g-e*f*d;a[3]=b*c*d+e*f*g;return a};f.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};var m=c(22),u=c(90),v=c(91);n=c(92);f.clone=n.clone;f.fromValues=n.fromValues;f.copy=n.copy;f.set=n.set;f.add=n.add;
f.mul=q;f.scale=n.scale;f.dot=n.dot;f.lerp=n.lerp;c=n.length;f.length=c;f.len=c;c=n.squaredLength;f.squaredLength=c;f.sqrLen=c;var t=n.normalize;f.normalize=t;f.exactEquals=n.exactEquals;f.equals=n.equals;n=function(){var a=v.create(),b=v.fromValues(1,0,0),c=v.fromValues(0,1,0);return function(d,e,f){var g=v.dot(e,f);if(-.999999>g)return v.cross(a,b,e),1E-6>v.len(a)&&v.cross(a,c,e),v.normalize(a,a),k(d,a,Math.PI),d;if(.999999<g)return d[0]=0,d[1]=0,d[2]=0,d[3]=1,d;v.cross(a,e,f);d[0]=a[0];d[1]=a[1];
d[2]=a[2];d[3]=1+g;return t(d,d)}}();f.rotationTo=n;n=function(){var b=p(),c=p();return function(e,d,f,g,l,k){a(b,d,l,k);a(c,f,g,k);a(e,b,c,2*k*(1-k));return e}}();f.sqlerp=n;n=function(){var a=u.create();return function(c,e,d,f){a[0]=d[0];a[3]=d[1];a[6]=d[2];a[1]=f[0];a[4]=f[1];a[7]=f[2];a[2]=-e[0];a[5]=-e[1];a[8]=-e[2];return t(c,b(c,a))}}();f.setAxes=n},function(n,f,c){function p(){var c=new k.a(2);c[0]=0;c[1]=0;return c}var k=c(22);(function(){var c=p();return function(a,b,f,k,p,q){b||(b=2);f||
(f=0);for(k=k?Math.min(k*b+f,a.length):a.length;f<k;f+=b)c[0]=a[f],c[1]=a[f+1],p(c,c,q),a[f]=c[0],a[f+1]=c[1];return a}})()},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(b,c){var f=b.memoize.get({type:"getSharedCredentialsProvider",
credentialsProvider:Object(a.a)(c)},function(){return new q.a(c.addRef(),b.rpc)}),l=f.addCounterpartRef();f.dispose();return l}f.a=function(){return function(c){return function(c){function f(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var d;c=(d=f.__proto__||Object.getPrototypeOf(f)).call.apply(d,[].concat([this],$jscomp.arrayFromIterable(b)));if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
d=!c||"object"!==typeof c&&"function"!==typeof c?this:c;d.credentialsProvider=b[1].credentialsProvider.addRef();return d}p(f,c);b(f,[{key:"initializeCounterpart",value:function(a,b){b.credentialsProvider=k(this.chunkManager,this.credentialsProvider);m(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"initializeCounterpart",this).call(this,a,b)}}],[{key:"encodeOptions",value:function(b){var c=m(f.__proto__||Object.getPrototypeOf(f),"encodeOptions",this).call(this,b);c.credentialsProvider=
Object(a.a)(b.credentialsProvider);return c}}]);return f}(c)}};var q=c(152),a=c(23),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),m=function v(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in
e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}}},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return q});n=c(153);c=c(13);var k=function(){function a(a,c){for(var b=0;b<c.length;b++){var f=
c[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}();f=this&&this.__decorate||function(a,b,c,f){var k=arguments.length,m=3>k?b:null===f?f=Object.getOwnPropertyDescriptor(b,c):f,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)m=Reflect.decorate(a,b,c,f);else for(var g=a.length-1;0<=g;g--)if(l=a[g])m=(3>k?l(m):3<k?l(b,c,m):l(b,c))||m;return 3<k&&m&&Object.defineProperty(b,
c,m),m};var q=function(a){function b(a,c){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var f=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");f=!f||"object"!==typeof f&&"function"!==typeof f?this:f;f.provider=a;f.registerDisposer(a);f.initializeCounterpart(c);return f}p(b,a);k(b,[{key:"get",value:function(a,b){return this.provider.get(a,b)}}]);return b}(c.b);q=f([Object(c.g)(n.b)],
q);Object(c.d)(n.a,function(a,b){return this.get(a.providerId).get(a.invalidCredentials,b).then(function(a){return{value:a}})})},function(n,f,c){f.b="CredentialsProvider";f.a="CredentialsProvider.get"},function(n,f,c){f.a=function(c){for(var f=0,p=c.length,a=0;a<p;++a)f=31*f+c.charCodeAt(a)|0;return f}},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,
{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"c",function(){return q});c.d(f,"d",function(){return a});c.d(f,"a",function(){return b});c.d(f,"b",function(){return m});var q;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(q||(q={}));var a=function v(){k(this,
v)};a.RPC_ID="brainmaps/VolumeChunkSource";var b=function t(){k(this,t)};b.RPC_ID="brainmaps/MeshSource";var m=function(a){function b(){k(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);return b}(b);m.RPC_ID="brainmaps/SkeletonSource"},function(n,f,c){f.b="mesh/MeshLayer";f.a="mesh/FragmentSource"},function(n,
f,c){var p=c(94);n.exports=function(){return p.Date.now()}},function(n,f,c){f=c(5);n.exports="object"==typeof f&&f&&f.Object===Object&&f},function(n,f,c){var p=c(63),k=c(160),q=0/0,a=/^\s+|\s+$/g,b=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,u=/^0o[0-7]+$/i,v=parseInt;n.exports=function(c){if("number"==typeof c)return c;if(k(c))return q;p(c)&&(c="function"==typeof c.valueOf?c.valueOf():c,c=p(c)?c+"":c);if("string"!=typeof c)return 0===c?c:+c;c=c.replace(a,"");var f=m.test(c);return f||u.test(c)?v(c.slice(2),
f?2:8):b.test(c)?q:+c}},function(n,f,c){var p=c(161),k=c(164);n.exports=function(c){return"symbol"==typeof c||k(c)&&"[object Symbol]"==p(c)}},function(n,f,c){f=c(95);var p=c(162),k=c(163),q=f?f.toStringTag:void 0;n.exports=function(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":q&&q in Object(a)?p(a):k(a)}},function(n,f,c){f=c(95);c=Object.prototype;var p=c.hasOwnProperty,k=c.toString,q=f?f.toStringTag:void 0;n.exports=function(a){var b=p.call(a,q),c=a[q];try{a[q]=void 0;var f=
!0}catch(t){}var n=k.call(a);f&&(b?a[q]=c:delete a[q]);return n}},function(n,f){var c=Object.prototype.toString;n.exports=function(f){return c.call(f)}},function(n,f){n.exports=function(c){return null!=c&&"object"==typeof c}},function(n,f,c){f.b=function(c,f){c.remove(f)};f.a=function(c,f){c.add(f)}},function(n,f,c){f.b=function(c,f){return c.low+","+c.high+(f?"_"+f.center.toString()+"_"+f.size.toString():"")};f.a=function(c,f){var k=c.segmentEquivalences;c=$jscomp.makeIterator(c.visibleSegments);
for(var a=c.next();!a.done;a=c.next())if(a=a.value,k.disjointSets.isMinElement(a))for(var b=$jscomp.makeIterator(k.setElements(a)),m=b.next();!m.done;m=b.next())f(m.value,a)}},function(n,f,c){c.d(f,"b",function(){return p});var p;(function(c){c[c.LITTLE=0]="LITTLE";c[c.BIG=1]="BIG"})(p||(p={}));n=function(){var c=Uint16Array.of(4386);return 17===(new Uint8Array(c.buffer))[0]?p.BIG:p.LITTLE}();f.a=n},function(n,f,c){f.a="skeleton/SkeletonLayer"},function(n,f,c){f.a=function(c){var f={antialias:!1,
stencil:!0};c=c.getContext("webgl",f)||c.getContext("experimental-webgl",f);if(null==c)throw Error("WebGL not supported.");c.memoize=new p.a;c.maxTextureSize=c.getParameter(c.MAX_TEXTURE_SIZE);c.maxTextureImageUnits=c.getParameter(c.MAX_TEXTURE_IMAGE_UNITS);c.tempTextureUnit=c.maxTextureImageUnits-1;c.WEBGL_draw_buffers=c.getExtension("WEBGL_draw_buffers");if(!c.WEBGL_draw_buffers)throw Error("WEBGL_draw_buffers extension not available");c.ANGLE_instanced_arrays=c.getExtension("ANGLE_instanced_arrays");
if(!c.ANGLE_instanced_arrays)throw Error("ANGLE_instanced_ararys extension not available");f=$jscomp.makeIterator(["OES_texture_float","OES_element_index_uint"]);for(var a=f.next();!a.done;a=f.next())if(a=a.value,!c.getExtension(a))throw Error(a+" extension not available");return c};var p=c(52)},function(n,f,c){var p=function(){function c(c,a){for(var b=0;b<a.length;b++){var f=a[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(c,f.key,f)}}return function(f,
a,b){a&&c(f.prototype,a);b&&c(f,b);return f}}();n=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");}p(c,null,[{key:"insertAfter",value:function(c,a){var b=c.next0;a.next0=b;a.prev0=c;c.next0=a;b.prev0=a}},{key:"insertBefore",value:function(c,a){var b=c.prev0;a.prev0=b;a.next0=c;c.prev0=a;b.next0=a}},{key:"front",value:function(c){var a=c.next0;return a===c?null:a}},{key:"back",value:function(c){var a=c.prev0;return a===c?null:a}},{key:"pop",
value:function(c){var a=c.next0,b=c.prev0;a.prev0=b;b.next0=a;c.next0=null;c.prev0=null;return c}},{key:"iterator",value:function(c){function a(a,k){for(;;)switch(b){case 0:f=c.next0;case 1:if(f===c){b=3;break}b=4;return{value:f,done:!1};case 4:if(void 0===k){b=5;break}b=-1;throw k;case 5:case 2:f=f.next0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,f,k={next:function(b){return a(b,void 0)},throw:function(b){return a(void 0,b)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();k[Symbol.iterator]=function(){return this};return k}},{key:"reverseIterator",value:function(c){function a(a,k){for(;;)switch(b){case 0:f=c.prev0;case 1:if(f===c){b=3;break}b=4;return{value:f,done:!1};case 4:if(void 0===k){b=5;break}b=-1;throw k;case 5:case 2:f=f.prev0;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,f,k={next:function(b){return a(b,void 0)},throw:function(b){return a(void 0,b)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();k[Symbol.iterator]=function(){return this};return k}},{key:"initializeHead",value:function(c){c.next0=c.prev0=c}}]);return c}();f.a=n},function(n,f,c){c.d(f,"a",function(){return k});var p=function(){function c(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,b,f){b&&c(a.prototype,b);f&&c(a,f);return a}}(),k=function(){function c(a){if(!(this instanceof
c))throw new TypeError("Cannot call a class as a function");this.parents=[];this.parentPriorities=[];this.bindings=new Map;if(void 0!==a){this.parents.push.apply(this.parents,[].concat($jscomp.arrayFromIterable(a.parents)));this.parentPriorities.push.apply(this.parentPriorities,[].concat($jscomp.arrayFromIterable(a.parentPriorities)));a=$jscomp.makeIterator(a.bindings);for(var b=a.next();!b.done;b=a.next()){var f=$jscomp.makeIterator(b.value);b=f.next().value;f=f.next().value;this.bindings.set(b,
f)}}}p(c,[{key:"addParent",value:function(a,b){for(var c=this,f=this.parents,k=this.parentPriorities,p=0,l=f.length;p<l&&b<k[p];)++p;f.splice(p,0,a);k.splice(p,0,b);return function(){c.removeParent(a)}}},{key:"removeParent",value:function(a){a=this.parents.indexOf(a);if(-1===a)throw Error("Attempt to remove non-existent parent map.");this.parents.splice(a,1);this.parentPriorities.splice(a,1)}},{key:"set",value:function(a,b){this.bindings.set(a,b)}},{key:"delete",value:function(a){this.bindings.delete(a)}},
{key:"clear",value:function(){this.bindings.clear();this.parents.length=0;this.parentPriorities.length=0}},{key:"get",value:function(a){for(var b=this.parents,c=this.parentPriorities,f=c.length,k=0,p;k<f&&0<c[k];++k)if(p=b[k].get(a),void 0!==p)return p;p=this.bindings.get(a);if(void 0!==p)return p;for(;k<f;++k)if(p=b[k].get(a),void 0!==p)return p}},{key:"getAll",value:function(a){function b(b,h){for(;;)switch(c){case 0:e=d,g=e.parents,l=e.parentPriorities,p=l.length,k=0;case 1:if(!(k<p&&0<l[k])){c=
2;break}f=g[k].get(a);if(void 0===f){c=3;break}c=4;return{value:f,done:!1};case 4:if(void 0===h){c=5;break}c=-1;throw h;case 5:case 3:c=1;break;case 2:f=d.bindings.get(a);if(void 0===f){c=6;break}c=7;return{value:f,done:!1};case 7:if(void 0===h){c=8;break}c=-1;throw h;case 8:case 6:case 9:if(!(k<p)){c=10;break}f=g[k].get(a);if(void 0===f){c=11;break}c=12;return{value:f,done:!1};case 12:if(void 0===h){c=13;break}c=-1;throw h;case 13:case 11:c=9;break;case 10:c=-1;default:return{value:void 0,done:!0}}}
var c=0,f,k,p,l,g,e,d=this,h={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();h[Symbol.iterator]=function(){return this};return h}}]);return c}()},function(n,f,c){f.a=function(c){var f=0;switch(c.deltaMode){case 0:f=.005;break;case 1:f=.1;break;case 2:f=2}return Math.exp(c.deltaY*f)}},function(n,f){},function(n,f,c){c.d(f,"a",function(){return q});var p=c(1),k=function(){function a(a,c){for(var b=
0;b<c.length;b++){var f=c[b];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),q=function(){function a(b,c){c=void 0===c?p.d:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.size=p.p.clone(b);this.transform=p.j.clone(c);this.invTransform=p.j.invert(p.j.create(),c)}k(a,[{key:"toObject",value:function(a){a.size=this.size;a.transform=this.transform}},
{key:"localSpatialToGlobal",value:function(a,c){return p.p.transformMat4(a,c,this.transform)}},{key:"globalToLocalSpatial",value:function(a,c){return p.p.transformMat4(a,c,this.invTransform)}},{key:"globalToLocalGrid",value:function(a,c){this.globalToLocalSpatial(a,c);p.p.divide(a,a,this.size);return a}},{key:"localSpatialVectorToGlobal",value:function(a,c){return Object(p.n)(a,c,this.transform)}},{key:"globalToLocalSpatialVector",value:function(a,c){return Object(p.n)(a,c,this.invTransform)}},{key:"assignLocalSpatialToGlobalMat4",
value:function(a){return p.j.copy(a,this.transform)}}],[{key:"get",value:function(b,c){c=void 0===c?p.d:c;var f=a.cache,k=JSON.stringify([Array.from(b),Array.from(c)]),m=f.get(k);void 0===m&&(m=new a(b,c),f.set(k,m));return m}},{key:"fromObject",value:function(b){return a.get(b.size,b.transform)}}]);return a}();q.cache=new Map},function(n,f,c){f.a=function(c,f){return c===f?!0:1E-6>Math.abs(c-f)/Math.min(Math.abs(c),Math.abs(f))}},function(n,f){},function(n,f,c){Object.defineProperty(f,"__esModule",
{value:!0});var p=c(88),k=c(93);n=c(25);Object(n.b)("brainmaps",function(c){return new p.BrainmapsDataSource(p.productionInstance,c.credentialsManager.getCredentialsProvider(k.a))})},function(n,f,c){Object.defineProperty(f,"__esModule",{value:!0});var p=c(70);n=c(25);Object(n.b)("ndstore",function(){return new p.NDStoreDataSource})},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==
typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"c",function(){return a});c.d(f,"d",function(){return b});c.d(f,"b",function(){return m});
c.d(f,"a",function(){return u});var a;(function(a){a[a.JPEG=0]="JPEG";a[a.COMPRESSED_SEGMENTATION=1]="COMPRESSED_SEGMENTATION"})(a||(a={}));n=function t(){q(this,t)};var b=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(n);b.RPC_ID="dvid/VolumeChunkSource";var m;(function(a){a[a.JPEG=0]="JPEG"})(m||(m={}));var u=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}
k(b,a);return b}(n);u.RPC_ID="dvid/TileChunkSource"},function(n,f,c){Object.defineProperty(f,"__esModule",{value:!0});var p=c(107);n=c(25);Object(n.b)("dvid",function(){return new p.DVIDDataSource})},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"b",function(){return a});c.d(f,"a",function(){return b});n=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(function u(){q(this,u)});
var a=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(n);a.RPC_ID="render/TileChunkSource";var b=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(n);b.RPC_ID="render/PointMatchSource"},function(n,f,c){Object.defineProperty(f,"__esModule",{value:!0});n=c(25);var p=c(108);Object(n.b)("render",function(){return new p.RenderDataSource})},function(n,
f,c){Object.defineProperty(f,"__esModule",{value:!0});var p=c(110);n=c(25);Object(n.b)("openconnectome",function(){return new p.OpenConnectomeDataSource})},function(n,f,c){function p(a,c){if(!(a instanceof c))throw new TypeError("Cannot call a class as a function");}c.d(f,"b",function(){return k});c.d(f,"c",function(){return q});c.d(f,"a",function(){return a});var k;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(k||(k={}));var q=function m(){p(this,
m)};q.RPC_ID="precomputed/VolumeChunkSource";var a=function u(){p(this,u)};a.RPC_ID="precomputed/MeshSource"},function(n,f,c){Object.defineProperty(f,"__esModule",{value:!0});var p=c(111);n=c(25);Object(n.b)("precomputed",function(){return new p.PrecomputedDataSource})},function(n,f,c){c.d(f,"b",function(){return k});f.a="nifti/getNiftiVolumeInfo";var p;(function(c){c[c.NONE=0]="NONE";c[c.BINARY=1]="BINARY";c[c.UINT8=2]="UINT8";c[c.INT16=4]="INT16";c[c.INT32=8]="INT32";c[c.FLOAT32=16]="FLOAT32";c[c.COMPLEX64=
32]="COMPLEX64";c[c.FLOAT64=64]="FLOAT64";c[c.RGB24=128]="RGB24";c[c.INT8=256]="INT8";c[c.UINT16=512]="UINT16";c[c.UINT32=768]="UINT32";c[c.INT64=1024]="INT64";c[c.UINT64=1280]="UINT64";c[c.FLOAT128=1536]="FLOAT128";c[c.COMPLEX128=1792]="COMPLEX128";c[c.COMPLEX256=2048]="COMPLEX256"})(p||(p={}));var k=function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");};k.RPC_ID="nifti/VolumeChunkSource"},function(n,f,c){Object.defineProperty(f,"__esModule",{value:!0});var p=
c(112);n=c(25);Object(n.b)("nifti",function(){return new p.NiftiDataSource})},function(n,f){},function(n,f){},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"c",function(){return a});c.d(f,"d",function(){return b});c.d(f,"a",function(){return m});c.d(f,"b",function(){return u});var a;(function(a){a[a.JPEG=0]="JPEG";a[a.NPZ=1]="NPZ";a[a.RAW=2]="RAW"})(a||(a={}));n=function t(){q(this,t)};var b=function(a){function b(){q(this,b);return p(this,(b.__proto__||
Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(n);b.RPC_ID="python/VolumeChunkSource";var m=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(n);m.RPC_ID="python/MeshSource";var u=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(n);u.RPC_ID="python/SkeletonSource"},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){return new d.a({shaderError:a.shaderError,
fragmentMain:a.fragmentMain,fragmentMainStartLine:v.a})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"ImageUserLayer",function(){return r});var b=c(72);n=c(20);var m=c(15);f=c(39);var u=c(11),v=c(193),t=c(48),l=c(1),g=c(38),e=c(73),d=c(74),h=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(116);
c(75);c(117);var r=function(a){function c(a,d){p(this,c);var e=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.opacity=Object(t.a)(.5);e.fragmentMain=Object(v.c)();e.shaderError=Object(g.b)();e.transform=new b.a;var f=d.source;if("string"!==typeof f)throw Error("Invalid image layer specification");e.opacity.restoreState(d.opacity);e.fragmentMain.restoreState(d.shader);e.transform.restoreState(d.transform);e.registerDisposer(e.fragmentMain.changed.add(function(){e.specificationChanged.dispatch()}));
e.volumePath=f;Object(m.d)(a.dataSourceProvider,a.chunkManager,f).then(function(a){e.wasDisposed||(a=e.renderLayer=new v.b(a,{opacity:e.opacity,fragmentMain:e.fragmentMain,shaderError:e.shaderError,sourceOptions:{transform:l.j.clone(e.transform.transform)}}),e.addRenderLayer(a),e.shaderError.changed.dispatch())});return e}q(c,a);h(c,[{key:"toJSON",value:function(){var a={type:"image"};a.source=this.volumePath;a.opacity=this.opacity.toJSON();a.shader=this.fragmentMain.toJSON();a.transform=this.transform.toJSON();
return a}},{key:"makeDropdown",value:function(a){return new B(a,this)}}]);return c}(n.f),B=function(b){function c(b,d){p(this,c);var f=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.element=b;f.layer=d;f.opacityWidget=f.registerDisposer(new e.a(f.layer.opacity));f.codeWidget=f.registerDisposer(a(f.layer));b.classList.add("image-dropdown");var g=f.opacityWidget;d=document.createElement("div");d.className="image-dropdown-top-row";g.promptElement.textContent="Opacity";g=document.createElement("div");
g.style.flex="1";var h=document.createElement("a"),l=document.createElement("button");l.type="button";l.textContent="?";l.className="help-link";h.appendChild(l);h.title="Documentation on image layer rendering";h.target="_blank";h.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";l=document.createElement("button");l.innerHTML="&square;";l.className="maximize-button";l.title="Show larger editor view";f.registerEventListener(l,"click",function(){new C(f.layer)});
d.appendChild(f.opacityWidget.element);d.appendChild(g);d.appendChild(l);d.appendChild(h);b.appendChild(d);b.appendChild(f.codeWidget.element);f.codeWidget.textEditor.refresh();return f}q(c,b);h(c,[{key:"onShow",value:function(){this.codeWidget.textEditor.refresh()}}]);return c}(n.g),C=function(b){function c(b){p(this,c);var d=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.layer=b;d.codeWidget=d.registerDisposer(a(d.layer));d.content.classList.add("image-layer-shader-overlay");d.content.appendChild(d.codeWidget.element);
d.codeWidget.textEditor.refresh();return d}q(c,b);return c}(f.a);Object(m.e)("image",r);Object(m.f)(u.d.IMAGE,r)},function(n,f){},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,
enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a){return Object(b.a)(void 0===a?"void main() {\n  emitGrayscale(toNormalized(getDataValue()));\n}\n":a)}f.c=q;c.d(f,"b",function(){return t});n=c(114);var a=c(48),b=c(38),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,d){c&&
a(b.prototype,c);d&&a(b,d);return b}}(),u=function g(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return g(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};f.a="//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START";var v=c(69),t=function(c){function e(c,f){var d=void 0===f?{}:f;f=void 0===d.opacity?Object(a.a)(.5):d.opacity;var g=void 0===d.fragmentMain?q():d.fragmentMain,
h=void 0===d.shaderError?Object(b.b)():d.shaderError;d=void 0===d.sourceOptions?{}:d.sourceOptions;if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var k=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,c,{shaderError:h,sourceOptions:d}));k.fragmentMain=g;k.opacity=f;k.registerDisposer(f.changed.add(function(){k.redrawNeeded.dispatch()}));k.registerDisposer(g.changed.add(function(){k.shaderUpdated=!0;k.redrawNeeded.dispatch()}));return k}k(e,c);m(e,[{key:"getShaderKey",
value:function(){return"volume.ImageRenderLayer:"+JSON.stringify(this.fragmentMain.value)}},{key:"getValueAt",value:function(a){for(var b=$jscomp.makeIterator(this.sources),c=b.next();!c.done;c=b.next()){c=$jscomp.makeIterator(c.value);for(var d=c.next();!d.done;d=c.next())if(d=d.value.getValueAt(a),null!=d)return d}return null}},{key:"defineShader",value:function(a){u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"defineShader",this).call(this,a);a.addUniform("highp float","uOpacity");
a.addFragmentCode("\nvoid emitRGBA(vec4 rgba) {\n  emit(vec4(rgba.rgb, rgba.a * uOpacity));\n}\nvoid emitRGB(vec3 rgb) {\n  emit(vec4(rgb, uOpacity));\n}\nvoid emitGrayscale(float value) {\n  emit(vec4(value, value, value, uOpacity));\n}\nvoid emitTransparent() {\n  emit(vec4(0.0, 0.0, 0.0, 0.0));\n}\n");a.addFragmentCode(v);a.setFragmentMainFunction("//NEUROGLANCER_IMAGE_RENDERLAYER_FRAGMENT_MAIN_START\n"+this.fragmentMain.value)}},{key:"beginSlice",value:function(a){a=u(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),
"beginSlice",this).call(this,a);this.gl.uniform1f(a.uniform("uOpacity"),this.opacity.value);return a}}]);return e}(n.a)},function(n,f){},function(n,f,c){(function(c){function f(a,b){function d(a){if(!e.parentNode)return c.off(document,"mousemove",d);e.style.top=Math.max(0,a.clientY-e.offsetHeight-5)+"px";e.style.left=a.clientX+5+"px"}var e=document.createElement("div");e.className="CodeMirror-lint-tooltip";e.appendChild(b.cloneNode(!0));document.body.appendChild(e);c.on(document,"mousemove",d);d(a);
null!=e.style.opacity&&(e.style.opacity=1);return e}function p(a){a.parentNode&&(null==a.style.opacity&&a.parentNode&&a.parentNode.removeChild(a),a.style.opacity=0,setTimeout(function(){a.parentNode&&a.parentNode.removeChild(a)},600))}function a(a,b,e){function d(){c.off(e,"mouseout",d);g&&(p(g),g=null)}var g=f(a,b),h=setInterval(function(){if(g)for(var a=e;;a=a.parentNode){a&&11==a.nodeType&&(a=a.host);if(a==document.body)return;if(!a){d();break}}if(!g)return clearInterval(h)},400);c.on(e,"mouseout",
d)}function b(b,c,e){this.marked=[];this.options=c;this.timeout=null;this.hasGutter=e;this.onMouseOver=function(c){var d=c.target||c.srcElement;if(/\bCodeMirror-lint-mark-/.test(d.className)){d=d.getBoundingClientRect();var e=b.findMarksAt(b.coordsChar({left:(d.left+d.right)/2,top:(d.top+d.bottom)/2},"client"));d=[];for(var f=0;f<e.length;++f){var g=e[f].__annotation;g&&d.push(g)}if(d.length){e=c.target||c.srcElement;f=document.createDocumentFragment();for(g=0;g<d.length;g++)f.appendChild(v(d[g]));
a(c,f,e)}}};this.waitingFor=0}function m(a){var b=a.state.lint;b.hasGutter&&a.clearGutter("CodeMirror-lint-markers");for(a=0;a<b.marked.length;++a)b.marked[a].clear();b.marked.length=0}function n(b,e,f,g){var d=document.createElement("div"),h=d;d.className="CodeMirror-lint-marker-"+e;f&&(h=d.appendChild(document.createElement("div")),h.className="CodeMirror-lint-marker-multiple");if(0!=g)c.on(h,"mouseover",function(c){a(c,b,h)});return d}function v(a){var b=a.severity;b||(b="error");var c=document.createElement("div");
c.className="CodeMirror-lint-message-"+b;"undefined"!=typeof a.messageHTML?c.innerHTML=a.messageHTML:c.appendChild(document.createTextNode(a.message));return c}function t(a,b,e){function d(){h=-1;a.off("change",d)}var f=a.state.lint,h=++f.waitingFor;a.on("change",d);b(a.getValue(),function(b,e){a.off("change",d);f.waitingFor==h&&(e&&b instanceof c&&(b=e),g(a,b))},e,a)}function l(a){var b=a.state.lint.options,d=b.options||b,e=b.getAnnotations||a.getHelper(c.Pos(0,0),"lint");e&&(b.async||e.async?t(a,
e,d):(b=e(a.getValue(),d,a))&&(b.then?b.then(function(b){g(a,b)}):g(a,b)))}function g(a,b){m(a);for(var c=a.state.lint,d=c.options,e=[],f=0;f<b.length;++f){var g=b[f],h=g.from.line;(e[h]||(e[h]=[])).push(g)}for(f=0;f<e.length;++f)if(g=e[f]){h=null;for(var l=c.hasGutter&&document.createDocumentFragment(),k=0;k<g.length;++k){var p=g[k],q=p.severity;q||(q="error");"error"!=h&&(h=q);d.formatAnnotation&&(p=d.formatAnnotation(p));c.hasGutter&&l.appendChild(v(p));p.to&&c.marked.push(a.markText(p.from,p.to,
{className:"CodeMirror-lint-mark-"+q,__annotation:p}))}c.hasGutter&&a.setGutterMarker(f,"CodeMirror-lint-markers",n(l,h,1<g.length,c.options.tooltips))}if(d.onUpdateLinting)d.onUpdateLinting(b,e,a)}function e(a){var b=a.state.lint;b&&(clearTimeout(b.timeout),b.timeout=setTimeout(function(){l(a)},b.options.delay||500))}c.defineOption("lint",!1,function(a,f,g){g&&g!=c.Init&&(m(a),!1!==a.state.lint.options.lintOnChange&&a.off("change",e),c.off(a.getWrapperElement(),"mouseover",a.state.lint.onMouseOver),
clearTimeout(a.state.lint.timeout),delete a.state.lint);if(f){var d=a.getOption("gutters");g=!1;for(var h=0;h<d.length;++h)"CodeMirror-lint-markers"==d[h]&&(g=!0);d=a.state;f instanceof Function?f={getAnnotations:f}:f&&!0!==f||(f={});g=d.lint=new b(a,f,g);if(!1!==g.options.lintOnChange)a.on("change",e);if(0!=g.options.tooltips&&"gutter"!=g.options.tooltips)c.on(a.getWrapperElement(),"mouseover",g.onMouseOver);l(a)}});c.defineExtension("performLint",function(){this.state.lint&&l(this)})})(c(115))},
function(n,f){},function(n,f){},function(n,f){},function(n,f){n.exports=function(c){function f(a){var b={};a=a.split(" ");for(var c=0;c<a.length;++c)b[a[c]]=!0;return b}c.defineMode("glsl",function(a,b){function c(a,b){var c=a.next();if(C[c]){var e=C[c](a,b);if(!1!==e)return e}if('"'==c||"'"==c)return b.tokenize=p(c),b.tokenize(a,b);if(/[\[\]{}\(\),;\:\.]/.test(c))return y=c,"bracket";if(/\d/.test(c))return a.eatWhile(/[\w\.]/),"number";if("/"==c){if(a.eat("*"))return b.tokenize=q,q(a,b);if(a.eat("/"))return a.skipToEnd(),
"comment"}if("#"==c)return a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),a.eatWhile(/[\S]+/),a.eatWhile(/[\s]+/),"comment";if(z.test(c))return a.eatWhile(z),"operator";a.eatWhile(/[\w\$_]/);a=a.current();return d.propertyIsEnumerable(a)?(r.propertyIsEnumerable(a)&&(y="newstatement"),"keyword"):h.propertyIsEnumerable(a)?"builtin":B.propertyIsEnumerable(a)?"atom":"word"}function p(a){return function(b,d){for(var e=!1,f,g=!1;null!=(f=b.next());){if(f==a&&!e){g=!0;break}e=!e&&"\\"==f}if(g||!e&&!D)d.tokenize=
c;return"string"}}function q(a,b){for(var d=!1,e;e=a.next();){if("/"==e&&d){b.tokenize=c;break}d="*"==e}return"comment"}function t(a,b,c,d,e){this.indented=a;this.column=b;this.type=c;this.align=d;this.prev=e}function l(a,b,c){return a.context=new t(a.indented,b,c,null,a.context)}function g(a){var b=a.context.type;if(")"==b||"]"==b||"}"==b)a.indented=a.context.indented;return a.context=a.context.prev}var e=a.indentUnit,d=b.keywords||f(k),h=b.builtins||f(n),r=b.blockKeywords||f("case do else for if switch while struct"),
B=b.atoms||f("null"),C=b.hooks||{},D=b.multiLineStrings,z=/[+\-*&%=<>!?|\/]/,y;return{startState:function(a){return{tokenize:null,context:new t((a||0)-e,0,"top",!1),indented:0,startOfLine:!0}},token:function(a,b){var d=b.context;a.sol()&&(null==d.align&&(d.align=!1),b.indented=a.indentation(),b.startOfLine=!0);if(a.eatSpace())return null;y=null;var e=(b.tokenize||c)(a,b);if("comment"==e||"meta"==e)return e;null==d.align&&(d.align=!0);if(";"!=y&&":"!=y||"statement"!=d.type)if("{"==y)l(b,a.column(),
"}");else if("["==y)l(b,a.column(),"]");else if("("==y)l(b,a.column(),")");else if("}"==y){for(;"statement"==d.type;)d=g(b);for("}"==d.type&&(d=g(b));"statement"==d.type;)d=g(b)}else y==d.type?g(b):("}"==d.type||"top"==d.type||"statement"==d.type&&"newstatement"==y)&&l(b,a.column(),"statement");else g(b);b.startOfLine=!1;return e},indent:function(a,b){if(a.tokenize!=c&&null!=a.tokenize)return 0;b=b&&b.charAt(0);a=a.context;var d=b==a.type;return"statement"==a.type?a.indented+("{"==b?0:e):a.align?
a.column+(d?0:1):a.indented+(d?0:e)},electricChars:"{}"}});var k="attribute const uniform varying break continue do for while if else in out inout float int void bool true false lowp mediump highp precision invariant discard return mat2 mat3 mat4 vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 sampler2D samplerCube struct gl_FragCoord gl_FragColor",n="radians degrees sin cos tan asin acos atan pow exp log exp2 log2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not dFdx dFdy fwidth texture2D texture2DProj texture2DLod texture2DProjLod textureCube textureCubeLod require export";
c.defineMIME("text/x-glsl",{name:"glsl",keywords:f(k),builtins:f(n),blockKeywords:f("case do else for if switch while struct"),atoms:f("null"),hooks:{"#":function(a,b){if(!b.startOfLine)return!1;a.skipToEnd();return"meta"}}})}},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:
b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b,c,d){d=void 0===d?{}:d;return u.a.forPromise(new Promise(function(e){e(a.getVectorGraphicsSource(b,c,d))}),{initialMessage:"Retrieving metadata for vector graphics source "+
c+".",delay:!0,errorPrefix:"Error retrieving metadata for vector graphics source "+c+": "})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"VectorGraphicsUserLayer",function(){return B});n=c(20);f=c(15);var b=c(71),m=c(201),u=c(31),v=c(48),t=c(118),l=c(119),g=c(1),e=c(2),d=c(73),h=c(202),r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&
a(b.prototype,c);d&&a(b,d);return b}}();c(116);c(75);c(117);var B=function(c){function d(c,f){p(this,d);var h=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));h.opacity=Object(v.a)(.5);h.lineWidth=Object(t.a)(10);h.color=Object(l.a)(g.p.fromValues(1,1,1));h.opacity.restoreState(f.opacity);h.lineWidth.restoreState(f.linewidth);h.color.restoreState(f.color);h.lineWidth.changed.add(function(){h.specificationChanged.dispatch()});h.color.changed.add(function(){h.specificationChanged.dispatch()});
h.vectorGraphicsLayerType=Object(e.n)(f.type,b.c);f=h.vectorGraphicsPath=Object(e.z)(f.source);void 0!==f&&h.vectorGraphicsLayerType===b.c.LINE&&a(c.dataSourceProvider,c.chunkManager,f).then(function(a){h.wasDisposed||(a=h.renderLayer=new m.a(a,{opacity:h.opacity,lineWidth:h.lineWidth,color:h.color,sourceOptions:{}}),h.addRenderLayer(a))});return h}q(d,c);r(d,[{key:"toJSON",value:function(){var a={type:this.getLayerType()};a.source=this.vectorGraphicsPath;a.opacity=this.opacity.toJSON();a.linewidth=
this.lineWidth.toJSON();a.color=this.color.toJSON();return a}},{key:"getLayerType",value:function(){return b.c[this.vectorGraphicsLayerType].toLowerCase()}},{key:"makeDropdown",value:function(a){return new C(a,this)}}]);return d}(n.f),C=function(a){function b(a,c){p(this,b);var e=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.element=a;e.layer=c;e.opacityWidget=e.registerDisposer(new d.a(e.layer.opacity));e.lineWidthWidget=e.registerDisposer(new d.a(e.layer.lineWidth,{min:0,max:50,step:1}));
e.colorWidget=e.registerDisposer(new D(e.layer.color));a.classList.add("image-dropdown");var f=e.opacityWidget,g=e.lineWidthWidget,h=e.colorWidget;c=document.createElement("div");c.className="image-dropdown-top-row";f.promptElement.textContent="Opacity";g.promptElement.textContent="Line Width";h.promptElement.textContent="Color";f=document.createElement("div");f.style.flex="1";g=document.createElement("a");h=document.createElement("button");h.type="button";h.textContent="?";h.className="help-link";
g.appendChild(h);g.title="Documentation on vector graphics layer rendering";g.target="_blank";g.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/vectorgraphics_layer_rendering.md";c.appendChild(f);c.appendChild(g);a.appendChild(c);a.appendChild(e.opacityWidget.element);a.appendChild(e.lineWidthWidget.element);a.appendChild(e.colorWidget.element);return e}q(b,a);return b}(n.g),D=function(a){function b(a){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
a))}q(b,a);r(b,[{key:"verifyValue",value:function(a){a=Object(e.o)(a);a/=255;return 0>a?0:1<a?1:a}},{key:"updateInput",value:function(){this.inputx.valueAsNumber=Math.round(255*this.model.value[0]);this.inputy.valueAsNumber=Math.round(255*this.model.value[1]);this.inputz.valueAsNumber=Math.round(255*this.model.value[2])}}]);return b}(h.a);Object(f.e)("line",B)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==
typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return d});var q=c(34);n=c(109);var a=c(48),b=c(118),m=c(119),u=c(1),v=c(24),t=c(29),l=function(){function a(a,b){for(var c=0;c<
b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},e=u.j.create(),d=function(c){function d(c,e){var f=void 0===
e?{}:e;e=void 0===f.opacity?Object(a.a)(.5):f.opacity;var g=void 0===f.lineWidth?Object(b.a)(10):f.lineWidth,l=void 0===f.color?Object(m.a)(u.p.fromValues(255,255,255)):f.color;f=void 0===f.sourceOptions?{}:f.sourceOptions;if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var k=p(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,c,{sourceOptions:f}));k.opacity=e;k.registerDisposer(e.changed.add(function(){k.redrawNeeded.dispatch()}));k.lineWidth=g;k.registerDisposer(g.changed.add(function(){k.redrawNeeded.dispatch()}));
k.color=l;k.registerDisposer(l.changed.add(function(){k.redrawNeeded.dispatch()}));c=k.gl;e=new Float32Array([1,0,0,1,1,0,0,1]);k.vertexIndexBuffer=v.a.fromData(c,e,c.ARRAY_BUFFER,c.STATIC_DRAW);e=new Float32Array([1,1,-1,-1]);k.normalDirectionBuffer=v.a.fromData(c,e,c.ARRAY_BUFFER,c.STATIC_DRAW);return k}k(d,c);l(d,[{key:"getShaderKey",value:function(){return"vectorgraphics.VectorGraphicsLineRenderLayer"}},{key:"defineShader",value:function(a){g(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),
"defineShader",this).call(this,a);a.addUniform("highp float","uOpacity");a.addUniform("highp float","ulineWidth");a.addUniform("highp vec3","uColor");a.addVarying("vec3","vNormal");a.addAttribute("highp float","aNormalDirection");a.addAttribute("highp vec2","aVertexIndex");a.addAttribute("highp vec3","aVertexFirst");a.addAttribute("highp vec3","aVertexSecond");a.addUniform("highp mat4","uProjection");a.setFragmentMain("    \nfloat distance = length(vNormal);\n\nfloat antialiasing = 0.5;\n\nif (distance >= 1.0 - antialiasing) {\n  emitRGBA(vec4(uColor, (distance - 1.0) / -antialiasing )); \n}\nelse if (distance < 1.0 - antialiasing) {\n  emitRGB(uColor);\n}\n");
a.setVertexMain("\nvec3 direction = vec3(0., 0., 0.); \ndirection.z = aNormalDirection;\n\nvec3 difference = aVertexSecond - aVertexFirst;\ndifference.z = 0.; \n\nvec3 normal = cross(difference, direction);\nnormal = normalize(normal); \nvNormal = normal; \n\nvec4 delta = vec4(normal * ulineWidth, 0.0);\nvec4 pos = vec4(aVertexFirst * aVertexIndex.x + aVertexSecond * aVertexIndex.y, 1.0);\n\ngl_Position = uProjection * (pos + delta);\n")}},{key:"beginSlice",value:function(a){g(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"beginSlice",this).call(this,a);a=this.gl;var b=this.shader;a.uniform1f(b.uniform("uOpacity"),this.opacity.value);a.uniform1f(b.uniform("ulineWidth"),this.lineWidth.value);a.uniform3fv(b.uniform("uColor"),this.color.value);this.vertexIndexBuffer.bindToVertexAttrib(b.attribute("aVertexIndex"),2);this.normalDirectionBuffer.bindToVertexAttrib(b.attribute("aNormalDirection"),1);return b}},{key:"endSlice",value:function(a){var b=this.gl;b.disableVertexAttribArray(a.attribute("aVertexIndex"));
b.disableVertexAttribArray(a.attribute("aNormalDirection"));b.disableVertexAttribArray(a.attribute("aVertexFirst"));b.disableVertexAttribArray(a.attribute("aVertexSecond"))}},{key:"draw",value:function(a){var b=a.visibleLayers.get(this);if(0!==b.length)if(this.initializeShader(),void 0===this.shader)console.log("error: shader undefined");else{var c=this.gl,d=this.beginSlice(a);b=$jscomp.makeIterator(b);for(var f=b.next();!f.done;f=b.next()){var g=f.value,l=g.spec.chunkLayout,k=g.spec.voxelSize;f=
g.chunks;var m=e;u.j.identity(m);g.vectorGraphicsCoordinatesInVoxels&&u.j.scale(m,m,k);u.j.multiply(m,l.transform,m);c.uniformMatrix4fv(d.uniform("uProjection"),!1,u.j.multiply(e,a.dataToDevice,m));if(g=a.visibleChunks.get(l))for(g=$jscomp.makeIterator(g),l=g.next();!l.done;l=g.next())if((l=f.get(l.value))&&l.state===q.d.GPU_MEMORY){k=l.numPoints/2;m=d.attribute("aVertexFirst");l.vertexBuffer.bindToVertexAttrib(m,3,t.c,!1,24,0);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(m,1);var p=d.attribute("aVertexSecond");
l.vertexBuffer.bindToVertexAttrib(p,3,t.c,!1,24,12);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(p,1);c.ANGLE_instanced_arrays.drawArraysInstancedANGLE(c.TRIANGLE_STRIP,0,4,k);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(m,0);c.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(p,0)}}this.endSlice(d)}}}]);return d}(n.a)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?
a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});n=c(0);var q=c(1),a=c(2),b=c(4),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in
d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),u=function l(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(203);var v=function(c){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=p(this,(f.__proto__||
Object.getPrototypeOf(f)).call(this));c.model=a;c.promptElement=document.createElement("span");c.element=document.createElement("label");c.inputx=document.createElement("input");c.inputy=document.createElement("input");c.inputz=document.createElement("input");c.valueEntered=new b.b;a=c.inputx;var e=c.inputy,g=c.inputz,l=c.element,k=c.promptElement;l.className="vec3-input-row";k.className="vec3-input-label";l.appendChild(k);l.appendChild(a);l.appendChild(e);l.appendChild(g);a.type=e.type=g.type="number";
c.updateInput();l=function(){c.model.value=c.getVec3Values()};c.registerEventListener(a,"change",l);c.registerEventListener(e,"change",l);c.registerEventListener(g,"change",l);c.model.changed.add(function(){c.updateInput()});return c}k(f,c);m(f,[{key:"getVec3Values",value:function(){var a=q.p.create();a[0]=this.verifyValue(this.inputx.valueAsNumber);a[1]=this.verifyValue(this.inputy.valueAsNumber);a[2]=this.verifyValue(this.inputz.valueAsNumber);return a}},{key:"verifyValue",value:function(b){return Object(a.o)(b)}},
{key:"updateInput",value:function(){this.inputx.valueAsNumber=this.model.value[0];this.inputy.valueAsNumber=this.model.value[1];this.inputz.valueAsNumber=this.model.value[2]}},{key:"disposed",value:function(){var a=this.inputx,b=this.inputy,c=this.inputz,g=this.element;a.parentElement&&a.parentElement.removeChild(a);b.parentElement&&b.parentElement.removeChild(b);c.parentElement&&c.parentElement.removeChild(c);g.parentElement&&g.parentElement.removeChild(g);u(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),
"disposed",this).call(this)}}]);return f}(n.a)},function(n,f){},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){return new A.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:g.a})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"SegmentationUserLayer",function(){return F});var b=c(72);n=c(20);var m=c(15),u=c(53);f=c(39);var v=c(120),t=c(54),l=c(206),g=c(64),e=c(11),d=c(208),h=c(48),r=c(57),
B=c(209),C=c(2),D=c(19),z=c(38),y=c(73),E=c(210),A=c(74),G=c(212),H=c(62),J=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(30);c(214);var F=function(a){function c(a,f){p(this,c);var n=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,[]));n.manager=a;n.displayState={segmentColorHash:v.a.getDefault(),
segmentSelectionState:new t.a,selectedAlpha:Object(h.a)(.5),notSelectedAlpha:Object(h.a)(0),objectAlpha:Object(h.a)(1),clipBounds:H.a.make(n.manager.worker,void 0),hideSegmentZero:new r.a(!0,!0),visibleSegments:B.a.makeWithCounterpart(n.manager.worker),segmentEquivalences:l.a.makeWithCounterpart(n.manager.worker),volumeSourceOptions:{},objectToDataTransform:new b.a,fragmentMain:Object(g.f)(),shaderError:Object(z.b)()};n.displayState.visibleSegments.changed.add(function(){n.specificationChanged.dispatch()});
n.displayState.segmentEquivalences.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.segmentSelectionState.bindTo(a.layerSelectedValues,n);n.displayState.selectedAlpha.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.notSelectedAlpha.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.objectAlpha.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.hideSegmentZero.changed.add(function(){n.specificationChanged.dispatch()});
n.displayState.fragmentMain.changed.add(function(){n.specificationChanged.dispatch()});n.displayState.selectedAlpha.restoreState(f.selectedAlpha);n.displayState.notSelectedAlpha.restoreState(f.notSelectedAlpha);n.displayState.objectAlpha.restoreState(f.objectAlpha);n.displayState.hideSegmentZero.restoreState(f.hideSegmentZero);n.displayState.objectToDataTransform.restoreState(f.transform);n.displayState.volumeSourceOptions.transform=n.displayState.objectToDataTransform.transform;n.displayState.fragmentMain.restoreState(f.skeletonShader);
var q=n.volumePath=Object(C.z)(f.source),u=n.meshPath=null===f.mesh?null:Object(C.z)(f.mesh),A=n.skeletonsPath=Object(C.z)(f.skeletons);void 0!==q&&Object(m.d)(a.dataSourceProvider,a.chunkManager,q,{volumeType:e.d.SEGMENTATION}).then(function(a){n.wasDisposed||(n.addRenderLayer(new d.a(a,n.displayState)),void 0===u&&(a=a.getMeshSource(),null!=a&&n.addMesh(a)))});null!=u&&n.manager.dataSourceProvider.getMeshSource(a.chunkManager,u).then(function(a){n.wasDisposed||n.addMesh(a)});void 0!==A&&n.manager.dataSourceProvider.getSkeletonSource(a.chunkManager,
A).then(function(b){n.wasDisposed||(b=new g.c(a.chunkManager,b,a.voxelSize,n.displayState),n.addRenderLayer(new g.b(b.addRef())),n.addRenderLayer(new g.e(b)))});Object(C.w)(f,"equivalences",function(a){n.displayState.segmentEquivalences.restoreState(a)});Object(C.w)(f,"segments",function(a){if(void 0!==a){var b=n.displayState,c=b.visibleSegments,d=b.segmentEquivalences;Object(C.a)(a,function(a){a=D.a.parseString(String(a),10);c.add(d.get(a))})}});Object(C.w)(f,"clipBounds",function(a){if(void 0!==
a){var b,c;Object(C.w)(a,"center",function(a){return b=Object(C.l)(a)});Object(C.w)(a,"size",function(a){return c=Object(C.l)(a)});b&&c&&(n.displayState.clipBounds.value={center:b,size:c})}});return n}q(c,a);J(c,[{key:"addMesh",value:function(a){this.meshLayer=new u.a(this.manager.chunkManager,a,this.displayState);this.addRenderLayer(this.meshLayer)}},{key:"toJSON",value:function(){var a={type:"segmentation"};a.source=this.volumePath;a.mesh=this.meshPath;a.skeletons=this.skeletonsPath;a.selectedAlpha=
this.displayState.selectedAlpha.toJSON();a.notSelectedAlpha=this.displayState.notSelectedAlpha.toJSON();a.objectAlpha=this.displayState.objectAlpha.toJSON();a.hideSegmentZero=this.displayState.hideSegmentZero.toJSON();var b=this.displayState.visibleSegments;0<b.size&&(a.segments=b.toJSON());b=this.displayState.segmentEquivalences;0<b.size&&(a.equivalences=b.toJSON());b=this.displayState.clipBounds;b.value&&(a.clipBounds={center:b.value.center,size:b.value.size});a.transform=this.displayState.objectToDataTransform.toJSON();
a.skeletonShader=this.displayState.fragmentMain.toJSON();return a}},{key:"transformPickedValue",value:function(a){if(null==a)return a;var b=this.displayState.segmentEquivalences;if(0===b.size)return a;"number"===typeof a&&(a=new D.a(a,0));b=b.get(a);return D.a.equal(b,a)?a:new t.c(a,b)}},{key:"makeDropdown",value:function(a){return new R(a,this)}},{key:"handleAction",value:function(a){switch(a){case "recolor":this.displayState.segmentColorHash.randomize();break;case "clear-segments":this.displayState.visibleSegments.clear();
break;case "select":if(a=this.displayState.segmentSelectionState,a.hasSelectedSegment){a=a.selectedSegment;var b=this.displayState.visibleSegments;b.has(a)?b.delete(a):b.add(a)}}}}]);return c}(n.f),R=function(b){function c(b,d){p(this,c);var e=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.element=b;e.layer=d;e.visibleSegmentWidget=e.registerDisposer(new E.a(e.layer.displayState));e.addSegmentWidget=e.registerDisposer(new G.a);e.selectedAlphaWidget=e.registerDisposer(new y.a(e.layer.displayState.selectedAlpha));
e.notSelectedAlphaWidget=e.registerDisposer(new y.a(e.layer.displayState.notSelectedAlpha));e.objectAlphaWidget=e.registerDisposer(new y.a(e.layer.displayState.objectAlpha));b.classList.add("segmentation-dropdown");var f=e.notSelectedAlphaWidget,g=e.objectAlphaWidget;e.selectedAlphaWidget.promptElement.textContent="Opacity (on)";f.promptElement.textContent="Opacity (off)";g.promptElement.textContent="Opacity (3d)";b.appendChild(e.selectedAlphaWidget.element);b.appendChild(e.notSelectedAlphaWidget.element);
b.appendChild(e.objectAlphaWidget.element);d=e.registerDisposer(new r.b(d.displayState.hideSegmentZero));d.element.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";f=document.createElement("label");f.className="neuroglancer-segmentation-dropdown-hide-segment-zero neuroglancer-noselect";f.appendChild(document.createTextNode("Hide segment ID 0"));f.appendChild(d.element);b.appendChild(f);e.addSegmentWidget.element.classList.add("add-segment");e.addSegmentWidget.element.title=
"Add one or more segment IDs";b.appendChild(e.registerDisposer(e.addSegmentWidget).element);e.registerDisposer(e.addSegmentWidget.valuesEntered.add(function(a){a=$jscomp.makeIterator(a);for(var b=a.next();!b.done;b=a.next())e.layer.displayState.visibleSegments.add(b.value)}));b.appendChild(e.registerDisposer(e.visibleSegmentWidget).element);if(void 0!==e.layer.skeletonsPath){d=document.createElement("div");d.className="neuroglancer-segmentation-dropdown-skeleton-shader-header";f=document.createElement("div");
f.style.flex="1";f.textContent="Skeleton shader:";g=document.createElement("a");var h=document.createElement("button");h.type="button";h.textContent="?";h.className="help-link";g.appendChild(h);g.title="Documentation on skeleton rendering";g.target="_blank";g.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";h=document.createElement("button");h.innerHTML="&square;";h.className="maximize-button";h.title="Show larger editor view";e.registerEventListener(h,
"click",function(){new K(e.layer)});d.appendChild(f);d.appendChild(h);d.appendChild(g);b.appendChild(d);d=e.codeWidget=e.registerDisposer(a(e.layer));b.appendChild(d.element);d.textEditor.refresh()}return e}q(c,b);J(c,[{key:"onShow",value:function(){void 0!==this.codeWidget&&this.codeWidget.textEditor.refresh()}}]);return c}(n.g),K=function(b){function c(b){p(this,c);var d=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));d.layer=b;d.codeWidget=d.registerDisposer(a(d.layer));d.content.classList.add("neuroglancer-segmentation-layer-skeleton-shader-overlay");
d.content.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();return d}q(c,b);return c}(f.a);Object(m.e)("segmentation",F);Object(m.f)(e.d.SEGMENTATION,F)},function(n,f,c){f.a=function(c,f,n,a){f*=6;var b=Math.floor(f),k=f-b;f=a*(1-n);var p=a*(1-n*k);n=a*(1-n*(1-k));switch(b%6){case 0:c[0]=a;c[1]=n;c[2]=f;break;case 1:c[0]=p;c[1]=a;c[2]=f;break;case 2:c[0]=f;c[1]=a;c[2]=n;break;case 3:c[0]=f;c[1]=p;c[2]=a;break;case 4:c[0]=n;c[1]=f;c[2]=a;break;case 5:c[0]=a,c[1]=f,c[2]=p}return c}},
function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});var k=c(207),q=c(2),a=c(4),b=c(19);n=c(13);var m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),u=function e(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return e(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};f=this&&this.__decorate||function(a,b,c,f){var d=arguments.length,e=3>d?b:null===f?f=Object.getOwnPropertyDescriptor(b,
c):f,h;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)e=Reflect.decorate(a,b,c,f);else for(var l=a.length-1;0<=l;l--)if(h=a[l])e=(3>d?h(e):3<d?h(b,c,e):h(b,c))||e;return 3<d&&e&&Object.defineProperty(b,c,e),e};var v=function(c){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");var b=(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
b=!b||"object"!==typeof b&&"function"!==typeof b?this:b;b.disjointSets=new k.a;b.changed=new a.a;return b}p(d,c);m(d,[{key:"disposed",value:function(){this.changed=this.disjointSets=void 0;u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"link",value:function(a,b){if(this.disjointSets.link(a,b)){var c=this.rpc;c&&c.invoke("DisjointUint64Sets.add",{id:this.rpcId,al:a.low,ah:a.high,bl:b.low,bh:b.high});this.changed.dispatch()}}},{key:"get",value:function(a){return this.disjointSets.get(a)}},
{key:"clear",value:function(){if(this.disjointSets.clear()){var a=this.rpc;a&&a.invoke("DisjointUint64Sets.clear",{id:this.rpcId});this.changed.dispatch()}}},{key:"setElements",value:function(a){return this.disjointSets.setElements(a)}},{key:"toJSON",value:function(){return this.disjointSets.toJSON()}},{key:"restoreState",value:function(a){var c=this;this.clear();if(void 0!==a){var d=[new b.a,new b.a];Object(q.a)(a,function(a){Object(q.a)(a,function(a,b){d[b%2].parseString(String(a),10);0!==b&&c.link(d[0],
d[1])})})}}},{key:"size",get:function(){return this.disjointSets.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new this;b.initializeCounterpart(a);return b}}]);return d}(n.c);v=f([Object(n.f)("DisjointUint64Sets")],v);var t=new b.a,l=new b.a;Object(n.e)("DisjointUint64Sets.add",function(a){var b=this.get(a.id);t.low=a.al;t.high=a.ah;l.low=a.bl;l.high=a.bh;b.disjointSets.link(t,l)&&b.changed.dispatch()});Object(n.e)("DisjointUint64Sets.clear",function(a){a=this.get(a.id);a.disjointSets.clear()&&
a.changed.dispatch()})},function(n,f,c){function p(a){for(var b=a,c=a[m];c!==a;)a=c,c=a[m];for(a=b[m];c!==a;)b[m]=c,b=a,a=b[m];return c}function k(a){function b(b,d){for(;;)switch(c){case 0:g=!0,f=a;case 1:if(!g&&f===a){c=3;break}c=4;return{value:f,done:!1};case 4:if(void 0===d){c=5;break}c=-1;throw d;case 5:f=f[u];case 2:g=!1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,f,g,l={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");
}};$jscomp.initSymbolIterator();l[Symbol.iterator]=function(){return this};return l}c.d(f,"a",function(){return l});var q=c(19),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}();$jscomp.initSymbol();var b=Symbol("disjoint_sets:rank");$jscomp.initSymbol();var m=Symbol("disjoint_sets:parent");$jscomp.initSymbol();
var u=Symbol("disjoint_sets:next");$jscomp.initSymbol();var v=Symbol("disjoint_sets:prev");$jscomp.initSymbol();var t=Symbol("disjoint_sets:min"),l=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.map=new Map;this.generation=0}$jscomp.initSymbol();$jscomp.initSymbolIterator();a(c,[{key:"get",value:function(a){var b=this.map.get(a.toString());return void 0===b?a:p(b)[t]}},{key:"isMinElement",value:function(a){var b=this.get(a);return b===
a||q.a.equal(b,a)}},{key:"makeSet",value:function(a){var c=a.toString(),e=this.map,f=e.get(c);return void 0===f?(a=f=a.clone(),a[m]=a,a[b]=0,a[u]=a[v]=a,f[t]=f,e.set(c,f),f):p(f)}},{key:"link",value:function(a,c){a=this.makeSet(a);c=this.makeSet(c);if(a===c)return!1;this.generation++;var d=a;var e=c,f=d[b],g=e[b];f>g?e[m]=d:(d[m]=e,f===g&&(e[b]=g+1),d=e);e=a;f=c;g=e[v];var l=f[v];f[v]=g;g[u]=f;e[v]=l;l[u]=e;a=a[t];c=c[t];d[t]=q.a.less(a,c)?a:c;return!0}},{key:"setElements",value:function(a){function b(b,
d){for(;;)switch(c){case 0:l=a.toString();g=m.map.get(l);if(void 0!==g){c=1;break}c=3;return{value:a,done:!1};case 3:if(void 0===d){c=4;break}c=-1;throw d;case 4:c=2;break;case 1:f=$jscomp.makeIterator(k(g));case 5:if((e=f.next(b)).done){c=6;break}c=7;return{value:e.value,done:!1};case 7:if(void 0===d){c=8;break}c=-1;throw d;case 8:c=5;break;case 6:case 2:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,f,g,l,m=this,p={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},
return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();p[Symbol.iterator]=function(){return this};return p}},{key:"clear",value:function(){var a=this.map;if(0===a.size)return!1;++this.generation;a.clear();return!0}},{key:"mappings",value:function(a){function b(b,d){for(;;)switch(c){case 0:a=void 0===a?Array(2):a,g=$jscomp.makeIterator(l.map.values()),f=g.next();case 1:if(f.done){c=3;break}e=f.value;a[0]=e;a[1]=p(e)[t];c=4;return{value:a,done:!1};case 4:if(void 0===d){c=
5;break}c=-1;throw d;case 5:case 2:f=g.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,e,f,g,l=this,k={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();k[Symbol.iterator]=function(){return this};return k}},{key:Symbol.iterator,value:function(){return this.mappings()}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this.map.values()),c=b.next();!c.done;c=
b.next()){var f=c.value;if(f[m]===f){c=[];f=$jscomp.makeIterator(k(f));for(var g=f.next();!g.done;g=f.next())c.push(g.value);c.sort(q.a.compare);a.push(c)}}a.sort(function(a,b){return q.a.compare(a[0],b[0])});return a.map(function(a){return a.map(function(a){return a.toString()})})}},{key:"size",get:function(){return this.map.size}}]);return c}()},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&
"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"a",function(){return d});var a=c(77),b=c(121),m=c(120),u=
c(54);n=c(114);var v=c(14),t=function r(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return r(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,
d);return b}}(),g=new Float32Array(8),e=function(){function b(c){q(this,b);this.disjointSets=c;this.generation=Number.NaN;this.hashMap=new a.a}l(b,[{key:"update",value:function(){var a=this.disjointSets,b=a.generation;if(this.generation!==b){this.generation=b;b=this.hashMap;b.clear();a=$jscomp.makeIterator(a.mappings());for(var c=a.next();!c.done;c=a.next()){var d=$jscomp.makeIterator(c.value);c=d.next().value;d=d.next().value;b.set(c,d)}}}}]);return b}(),d=function(a){function c(a,d){q(this,c);var f=
p(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,a,{sourceOptions:d.volumeSourceOptions}));f.displayState=d;f.segmentColorShaderManager=new m.b("segmentColorHash");f.hashTableManager=new b.c("visibleSegments");f.gpuHashTable=b.a.get(f.gl,f.displayState.visibleSegments.hashTable);f.equivalencesShaderManager=new b.b("equivalences");f.equivalencesHashMap=new e(f.displayState.segmentEquivalences.disjointSets);f.gpuEquivalencesHashTable=b.a.get(f.gl,f.equivalencesHashMap.hashMap);Object(u.g)(d,
f);f.registerDisposer(d.selectedAlpha.changed.add(function(){f.redrawNeeded.dispatch()}));f.registerDisposer(d.hideSegmentZero.changed.add(function(){f.redrawNeeded.dispatch();f.shaderUpdated=!0}));f.hasEquivalences=0!==f.displayState.segmentEquivalences.size;d.segmentEquivalences.changed.add(function(){var a=0!==f.displayState.segmentEquivalences.size;a!==f.hasEquivalences&&(f.hasEquivalences=a,f.shaderUpdated=!0)});f.registerDisposer(d.notSelectedAlpha.changed.add(function(){f.redrawNeeded.dispatch()}));
return f}k(c,a);l(c,[{key:"getValueAt",value:function(a){for(var b=$jscomp.makeIterator(this.sources),c=b.next();!c.done;c=b.next()){c=$jscomp.makeIterator(c.value);for(var d=c.next();!d.done;d=c.next())if(d=d.value.getValueAt(a),null!=d)return d}return null}},{key:"getShaderKey",value:function(){return"sliceview.SegmentationRenderLayer/"+this.hasEquivalences+"/"+this.displayState.hideSegmentZero.value}},{key:"defineShader",value:function(a){t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),
"defineShader",this).call(this,a);this.hashTableManager.defineShader(a);a.addFragmentCode("\nuint64_t getUint64DataValue() {\n  return toUint64(getDataValue());\n}\n");this.hasEquivalences?(this.equivalencesShaderManager.defineShader(a),a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  uint64_t value = getUint64DataValue();\n  uint64_t mappedValue;\n  if ("+this.equivalencesShaderManager.getFunctionName+"(value, mappedValue)) {\n    return mappedValue;\n  }\n  return value;\n}\n")):a.addFragmentCode("\nuint64_t getMappedObjectId() {\n  return getUint64DataValue();\n}\n");
this.segmentColorShaderManager.defineShader(a);a.addUniform("highp vec4","uSelectedSegment",2);a.addUniform("highp float","uShowAllSegments");a.addUniform("highp float","uSelectedAlpha");a.addUniform("highp float","uNotSelectedAlpha");a.addFragmentCode(v.o);var b="\n  uint64_t value = getMappedObjectId();\n  \n  float alpha = uSelectedAlpha;\n  float saturation = 1.0;\n";this.displayState.hideSegmentZero.value&&(b+="\n  if (value.low == vec4(0,0,0,0) && value.high == vec4(0,0,0,0)) {\n    emit(vec4(vec4(0, 0, 0, 0)));\n    return;\n  }\n");
b+="\n  bool has = uShowAllSegments > 0.0 ? true : "+this.hashTableManager.hasFunctionName+"(value);\n  if (uSelectedSegment[0] == unnormalizeUint8(value.low) &&\n      uSelectedSegment[1] == unnormalizeUint8(value.high)) {\n    saturation = has ? 0.5 : 0.75;\n  } else if (!has) {\n    alpha = uNotSelectedAlpha;\n  }\n  vec3 rgb = segmentColorHash(value);\n  emit(vec4(mix(vec3(1.0,1.0,1.0), rgb, saturation), alpha));\n";a.setFragmentMain(b)}},{key:"beginSlice",value:function(a){a=t(c.prototype.__proto__||
Object.getPrototypeOf(c.prototype),"beginSlice",this).call(this,a);var b=this.gl,d=this.displayState,e=this.displayState,f=e.segmentSelectionState;e=e.visibleSegments;if(f.hasSelectedSegment){var l=f.selectedSegment;f=l.low;l=l.high;for(var k=0;4>k;++k)g[k]=f>>8*k&255,g[4+k]=l>>8*k&255}else g.fill(0);b.uniform1f(a.uniform("uSelectedAlpha"),this.displayState.selectedAlpha.value);b.uniform1f(a.uniform("uNotSelectedAlpha"),this.displayState.notSelectedAlpha.value);b.uniform4fv(a.uniform("uSelectedSegment"),
g);b.uniform1f(a.uniform("uShowAllSegments"),e.hashTable.size?0:1);this.hashTableManager.enable(b,a,this.gpuHashTable);this.hasEquivalences&&(this.equivalencesHashMap.update(),this.equivalencesShaderManager.enable(b,a,this.gpuEquivalencesHashTable));this.segmentColorShaderManager.enable(b,a,d.segmentColorHash);return a}},{key:"endSlice",value:function(a){this.hashTableManager.disable(this.gl,a);t(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"endSlice",this).call(this,a)}}]);return c}(n.a)},
function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return m});var k=c(77),q=c(4);n=c(13);var a=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=
!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function t(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return t(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};f=this&&this.__decorate||function(a,b,c,e){var d=arguments.length,f=3>d?b:null===e?e=Object.getOwnPropertyDescriptor(b,c):e,
g;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)f=Reflect.decorate(a,b,c,e);else for(var l=a.length-1;0<=l;l--)if(g=a[l])f=(3>d?g(f):3<d?g(b,c,f):g(b,c))||f;return 3<d&&f&&Object.defineProperty(b,c,f),f};var m=u=function(c){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var a=(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
a=!a||"object"!==typeof a&&"function"!==typeof a?this:a;a.hashTable=new k.b;a.changed=new q.b;return a}p(f,c);$jscomp.initSymbol();$jscomp.initSymbolIterator();a(f,[{key:"disposed",value:function(){b(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this);this.changed=this.hashTable=void 0}},{key:"add_",value:function(a){return this.hashTable.add(a)}},{key:"add",value:function(a){if(this.add_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.add",{id:this.rpcId,value:a});this.changed.dispatch(a,
!0)}}},{key:"has",value:function(a){return this.hashTable.has(a)}},{key:Symbol.iterator,value:function(){return this.hashTable.keys()}},{key:"delete_",value:function(a){return this.hashTable.delete(a)}},{key:"delete",value:function(a){if(this.delete_(a)){var b=this.rpc;b&&b.invoke("Uint64Set.delete",{id:this.rpcId,value:a});this.changed.dispatch(a,!1)}}},{key:"clear",value:function(){if(this.hashTable.clear()){var a=this.rpc;a&&a.invoke("Uint64Set.clear",{id:this.rpcId});this.changed.dispatch(null,
!1)}}},{key:"toJSON",value:function(){for(var a=[],b=$jscomp.makeIterator(this),c=b.next();!c.done;c=b.next())a.push(c.value.toString());return a}},{key:"size",get:function(){return this.hashTable.size}}],[{key:"makeWithCounterpart",value:function(a){var b=new u;b.initializeCounterpart(a);return b}}]);return f}(n.c);m=u=f([Object(n.f)("Uint64Set")],m);Object(n.e)("Uint64Set.add",function(a){var b=this.get(a.id);b.add_(a.value)&&b.changed.dispatch()});Object(n.e)("Uint64Set.delete",function(a){var b=
this.get(a.id);b.delete_(a.value)&&b.changed.dispatch()});Object(n.e)("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});var u},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=
Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return m});n=c(0);f=c(19);var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),a=function v(a,b,c){null===a&&(a=Function.prototype);
var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return v(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}};c(30);c(211);var b=new f.a,m=function(c){function f(a){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var b=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));b.displayState=a;b.element=document.createElement("div");b.clearButton=document.createElement("button");b.itemContainer=
document.createElement("span");b.items=new Map;var c=b.element,d=b.clearButton,h=b.itemContainer;c.className="segment-set-widget neuroglancer-noselect";d.className="clear-button";d.title="Remove all segment IDs";b.registerEventListener(d,"click",function(){b.visibleSegments.clear()});h.className="item-container";c.appendChild(h);h.appendChild(d);b.registerDisposer(a.visibleSegments.changed.add(function(a,c){b.handleSetChanged(a,c)}));b.registerDisposer(a.segmentColorHash.changed.add(function(){b.handleColorChanged()}));
a=$jscomp.makeIterator(a.visibleSegments);for(c=a.next();!c.done;c=a.next())b.addElement(c.value.toString());b.updateClearButtonVisibility();return b}k(f,c);q(f,[{key:"updateClearButtonVisibility",value:function(){this.clearButton.style.display=0<this.displayState.visibleSegments.size?"":"none"}},{key:"handleSetChanged",value:function(a,b){this.updateClearButtonVisibility();var c=this.items;if(null===a){a=this.itemContainer;for(b=this.clearButton;;){var d=a.lastElementChild;if(d===b)break;a.removeChild(d)}c.clear()}else b?
this.addElement(a.toString()):(a=a.toString(),b=c.get(a),b.parentElement.removeChild(b),c.delete(a))}},{key:"addElement",value:function(a){var c=document.createElement("button");c.className="segment-button";c.textContent=a;c.title="Remove segment ID "+a;var e=this;c.addEventListener("click",function(){b.tryParseString(this.textContent);e.visibleSegments.delete(b)});c.addEventListener("mouseenter",function(){b.tryParseString(this.textContent);e.segmentSelectionState.set(b)});c.addEventListener("mouseleave",
function(){b.tryParseString(this.textContent);e.segmentSelectionState.set(null)});this.setItemColor(c);this.itemContainer.appendChild(c);this.items.set(a,c)}},{key:"setItemColor",value:function(a){b.tryParseString(a.textContent);a.style.backgroundColor=this.segmentColorHash.computeCssColor(b)}},{key:"handleColorChanged",value:function(){var a=this;this.items.forEach(function(b){a.setItemColor(b)})}},{key:"disposed",value:function(){var b=this.element,c=b.parentElement;c&&c.removeChild(b);a(f.prototype.__proto__||
Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"visibleSegments",get:function(){return this.displayState.visibleSegments}},{key:"segmentColorHash",get:function(){return this.displayState.segmentColorHash}},{key:"segmentSelectionState",get:function(){return this.displayState.segmentSelectionState}}]);return f}(n.a)},function(n,f){},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==
typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});n=c(0);var q=c(12),a=c(4),b=c(19),m=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),u=function l(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return l(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(30);c(213);var v=function(c){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");
var b=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));b.element=document.createElement("form");b.label=document.createElement("label");b.input=document.createElement("input");b.valuesEntered=new a.b;var c=b.element,g=b.label,k=b.input;c.className="uint64-entry neuroglancer-noselect";c.appendChild(g);g.appendChild(k);b.registerEventListener(c,"submit",function(a){a.preventDefault();a=b.validateInput();void 0!==a&&(b.input.value="",b.input.classList.remove("valid-input","invalid-input"),
b.valuesEntered.dispatch(a))});b.registerEventListener(c,"input",function(){""===b.input.value?b.input.classList.remove("valid-input","invalid-input"):b.validateInput()?b.input.classList.remove("invalid-input"):b.input.classList.add("invalid-input")});return b}k(f,c);m(f,[{key:"validateInput",value:function(){var a=this.input.value;a=a.replace(/[\s,\(\)\[\]\{\};]+/g," ");a=a.trim();var c=a.split(" ");if(0!==c.length){a=[];c=$jscomp.makeIterator(c);for(var f=c.next();!f.done;f=c.next()){f=f.value;
var g=new b.a;if(!g.tryParseString(f))return;a.push(g)}return a}}},{key:"disposed",value:function(){Object(q.b)(this.element);u(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(n.a)},function(n,f){},function(n,f){},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==
typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){return a.split(/[^a-zA-Z0-9]+/).filter(function(a){return a}).join("_")}function b(b){var c=new Set,d=[];b=$jscomp.makeIterator(b);for(var e=
b.next();!e.done;e=b.next()){e=a(e.value);for(var f="",g=0;c.has(e+f);)f=""+ ++g;d.push(e+f)}return d}function m(a){return new h.a({fragmentMain:a.displayState.fragmentMain,shaderError:a.displayState.shaderError,fragmentMainStartLine:l.a})}function u(a){return new C(a.displayState.attributeNames,function(){return a.meshSource&&a.meshSource.info.vertexAttributes})}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"SingleMeshUserLayer",function(){return B});n=c(9);var v=c.n(n);n=c(20);f=c(15);
var t=c(39),l=c(216),g=c(0),e=c(12),d=c(2),h=c(74),r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(218);var B=function(a){function c(a,e){p(this,c);var f=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this,[]));f.manager=a;f.displayState=new l.b;f.parameters={meshSourceUrl:Object(d.w)(e,"source",
d.B),attributeSourceUrls:Object(d.w)(e,"vertexAttributeSources",function(a){return void 0!==a?Object(d.a)(a,d.B):[]})};f.displayState.objectToDataTransform.restoreState(e.transform);f.displayState.fragmentMain.restoreState(e.shader);f.userSpecifiedAttributeNames=Object(d.w)(e,"vertexAttributeNames",function(a){if(void 0!==a)return Object(d.a)(a,function(a){if(a=Object(d.z)(a))return a})});Object(l.e)(a.chunkManager,f.parameters).then(function(a){if(!f.wasDisposed){f.meshSource=a;var c=f.defaultAttributeNames=
b(a.info.vertexAttributes.map(function(a){return a.name})),d=f.userSpecifiedAttributeNames;void 0!==d&&d.length===c.length?(c=d,f.userSpecifiedAttributeNames=void 0):c=Array.from(c);f.displayState.attributeNames.value=c;f.addRenderLayer(new l.c(a,f.displayState))}});f.registerDisposer(f.displayState.fragmentMain.changed.add(function(){f.specificationChanged.dispatch()}));f.registerDisposer(f.displayState.attributeNames.changed.add(function(){f.specificationChanged.dispatch()}));return f}q(c,a);r(c,
[{key:"toJSON",value:function(){var a={type:"mesh"},b=this.parameters.attributeSourceUrls;a.source=this.parameters.meshSourceUrl;b&&(a.vertexAttributeSources=b);a.shader=this.displayState.fragmentMain.toJSON();a.transform=this.displayState.objectToDataTransform.toJSON();if(void 0===this.meshSource)b=this.userSpecifiedAttributeNames;else{b=this.defaultAttributeNames;for(var c=this.displayState.attributeNames.value,d=!0,e=c.length,f=0;f<e;++f)if(c[f]!==b[f]){d=!1;break}b=d?void 0:Array.from(c)}a.vertexAttributeNames=
b;return a}},{key:"makeDropdown",value:function(a){return new D(a,this)}}]);return c}(n.f),C=function(a){function b(a,c){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.attributeNames=a;d.getAttributeInfo=c;d.element=document.createElement("div");d.debouncedValueUpdater=v()(function(){d.updateAttributeNames()},500);d.element.className="neuroglancer-single-mesh-attribute-widget";d.updateInputElements();d.registerDisposer(a.changed.add(function(){d.updateInputElements()}));
return d}q(b,a);r(b,[{key:"updateInputElements",value:function(){var a=this.attributeNames,b=this.attributeNameElements;if(void 0===b){var c=this.getAttributeInfo();if(void 0===c)return;b=this.attributeNameElements=[];for(var d=void 0,e=a.value.length,f=this.element,g=0;g<e;++g){var h=c[g],k=h.source;if(k!==d&&void 0!==k){d=k;var m=document.createElement("div");m.className="neuroglancer-single-mesh-source-header";m.textContent=k;f.appendChild(m)}k=document.createElement("div");k.className="neuroglancer-single-mesh-attribute";
m=document.createElement("input");m.title=h.name;this.registerEventListener(m,"input",this.debouncedValueUpdater);m.type="text";k.textContent=Object(l.d)(h);k.appendChild(m);if(void 0!==h.min&&void 0!==h.max){var p=document.createElement("span");p.className="neuroglancer-single-mesh-attribute-range";p.textContent="["+h.min.toPrecision(6)+", "+h.max.toPrecision(6)+"]";k.appendChild(p)}b[g]=m;f.appendChild(k)}}a.value.forEach(function(a,c){b[c].value=a||""})}},{key:"disposed",value:function(){Object(e.b)(this.element)}},
{key:"updateAttributeNames",value:function(){var a=this.attributeNames.value,b=this.attributeNameElements,c=!1;a.forEach(function(d,e){var f=b[e].value;f||(f=void 0);f!==d&&(c=!0,a[e]=f)});c&&this.attributeNames.changed.dispatch()}}]);return b}(g.a),D=function(a){function b(a,c){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.element=a;d.layer=c;d.attributeWidget=d.registerDisposer(u(d.layer));d.codeWidget=d.registerDisposer(m(d.layer));a.classList.add("neuroglancer-single-mesh-dropdown");
c=document.createElement("div");c.className="neuroglancer-single-mesh-dropdown-top-row";var e=document.createElement("div");e.style.flex="1";var f=document.createElement("a"),g=document.createElement("button");g.type="button";g.textContent="?";g.className="help-link";f.appendChild(g);f.title="Documentation on single mesh layer rendering";f.target="_blank";f.href="https://github.com/google/neuroglancer/blob/master/src/neuroglancer/sliceview/image_layer_rendering.md";g=document.createElement("button");
g.innerHTML="&square;";g.className="maximize-button";g.title="Show larger editor view";d.registerEventListener(g,"click",function(){new z(d.layer)});c.appendChild(e);c.appendChild(g);c.appendChild(f);a.appendChild(c);a.appendChild(d.attributeWidget.element);a.appendChild(d.codeWidget.element);d.codeWidget.textEditor.refresh();return d}q(b,a);r(b,[{key:"onShow",value:function(){this.codeWidget.textEditor.refresh()}}]);return b}(n.g),z=function(a){function b(a){p(this,b);var c=k(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this));c.layer=a;c.attributeWidget=c.registerDisposer(u(c.layer));c.codeWidget=c.registerDisposer(m(c.layer));c.content.classList.add("neuroglancer-single-mesh-layer-shader-overlay");c.content.appendChild(c.attributeWidget.element);c.content.appendChild(c.codeWidget.element);c.codeWidget.textEditor.refresh();return c}q(b,a);return b}(t.a);Object(f.e)("mesh",B)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function a(){return new e.a([],function(a){return Object(r.a)(a,
r.z)})}function b(a){return Object(A.a)(a.dataType,a.numComponents)}function m(a){return a.map(function(a){return Object(y.c)(new y.b,a.dataType,a.numComponents)})}function u(a,b){return a.memoize.getUncounted({type:"single_mesh:getMeshInfo",parameters:b},function(){return a.rpc.promiseInvoke(g.a,{chunkManager:a.addCounterpartRef(),parameters:b})})}c.d(f,"b",function(){return R});f.d=b;c.d(f,"c",function(){return ha});f.e=function(a,b){return u(a,b).then(function(c){return a.getChunkSource(S,{parameters:Object.assign({},
b,{info:c})})})};var v=c(34);n=c(16);var t=c(72),l=c(43),g=c(217),e=c(8),d=c(37),h=c(1),r=c(2),B=c(23),C=c(44),D=c(38),z=c(122),y=c(78),E=c(35),A=c(14),G=c(13),H=function P(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return P(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},J=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||
!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();f.a="//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START";var F=c(69),R=function Na(){q(this,Na);this.shaderError=Object(D.b)();var b=void 0;this.fragmentMain=new e.a(void 0===b?"void main() {\n  emitGray();\n}\n":b,r.B);this.attributeNames=a();this.objectToDataTransform=new t.a};$jscomp.initSymbol();var K=Symbol("SingleMeshShaderManager.vertexAttributeTextureUnit"),
N=Object(y.c)(new y.b,d.b.FLOAT32,3),V=function(){function a(b,c,d){q(this,a);this.attributeNames=b;this.attributeInfo=c;this.fragmentMain=d;this.tempLightVec=new Float32Array(4);this.tempPickID=new Float32Array(4);this.textureAccessHelper=new y.a("vertexData");this.indexBufferHelper=new z.a("VertexIndex")}J(a,[{key:"defineAttributeAccess",value:function(a,c){var e=this.textureAccessHelper;e.defineShader(a);a.addVertexCode(e.getAccessor("readVertexPosition","uVertexAttributeSampler[0]",d.b.FLOAT32,
3));a.addVertexCode(e.getAccessor("readVertexNormal","uVertexAttributeSampler[1]",d.b.FLOAT32,3));var f=2,g="\nvec3 vertexPosition = readVertexPosition("+c+");\nvec3 vertexNormal = readVertexNormal("+c+");\n",h=this.attributeNames;this.attributeInfo.forEach(function(d,k){if(void 0!==h[k]){var l=b(d);a.addVarying("highp "+l,"vCustom"+k);a.addFragmentCode("\n#define "+h[k]+" vCustom"+k+"\n");a.addVertexCode(e.getAccessor("readAttribute"+k,"uVertexAttributeSampler["+f+"]",d.dataType,d.numComponents));
g+="vCustom"+k+" = readAttribute"+k+"("+c+");\n";f+=1}});a.addTextureSampler2D("uVertexAttributeSampler",K,f);a.addVertexMain(g)}},{key:"defineShader",value:function(a){a.require(z.b);this.indexBufferHelper.defineShader(a);a.addVarying("highp float","vLightingFactor");a.addUniform("highp vec4","uLightDirection");a.addUniform("highp vec4","uColor");a.addUniform("highp mat4","uModelMatrix");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");a.addVarying("highp vec4","vPickID");
a.addVertexCode(A.b);a.addVertexCode(A.c);a.addVertexMain("\nfloat vertexIndex = getVertexIndex();\nuint32_t triangleIndex;\ndivmod(getPrimitiveIndex(), 3.0, triangleIndex);\nuint32_t pickID; pickID.value = uPickID;\nvPickID = add(pickID, triangleIndex).value;\n");a.addFragmentCode("\nvoid emitPremultipliedRGBA(vec4 color) {\n  emit(vec4(color.rgb * vLightingFactor, color.a), vPickID);\n}\nvoid emitRGBA(vec4 color) {\n  color = clamp(color, 0.0, 1.0);\n  color.xyz *= color.a;\n  emitPremultipliedRGBA(color);\n}\nvoid emitRGB(vec3 color) {\n  emitRGBA(vec4(color, 1.0));\n}\nvoid emitGray() {\n  emitRGB(vec3(1.0, 1.0, 1.0));\n}\n");
a.addFragmentCode(F);this.defineAttributeAccess(a,"vertexIndex");a.addVertexMain("\ngl_Position = uProjection * (uModelMatrix * vec4(vertexPosition, 1.0));\nvec3 normal = normalize((uModelMatrix * vec4(vertexNormal, 0.0)).xyz);\nvLightingFactor = abs(dot(normal, uLightDirection.xyz)) + uLightDirection.w;\n");a.setFragmentMainFunction("//NEUROGLANCER_SINGLE_MESH_LAYER_FRAGMENT_MAIN_START\n"+this.fragmentMain)}},{key:"beginLayer",value:function(a,b,c){var d=c.dataToDevice,e=c.lightDirection,f=c.ambientLighting;
c=c.directionalLighting;a.uniformMatrix4fv(b.uniform("uProjection"),!1,d);d=this.tempLightVec;h.p.scale(d,e,c);d[3]=f;a.uniform4fv(b.uniform("uLightDirection"),d)}},{key:"setPickID",value:function(a,b,c){a.uniform4fv(b.uniform("uPickID"),Object(A.p)(this.tempPickID,c))}},{key:"beginObject",value:function(a,b,c){a.uniformMatrix4fv(b.uniform("uModelMatrix"),!1,c)}},{key:"getShader",value:function(a,b){var c=this,d={attributeNames:this.attributeNames,attributeInfo:this.attributeInfo,fragmentMain:this.fragmentMain};
return a.memoize.get("single_mesh/SingleMeshShaderManager:"+Object(B.a)(b)+":"+Object(r.g)(d),function(){var d=new E.a(a);d.require(b);c.defineShader(d);return d.build()})}},{key:"bindVertexData",value:function(a,b,c){this.textureAccessHelper.setupTextureLayout(a,b,c);var d=b.textureUnit(K)+a.TEXTURE0,e=function(b){a.activeTexture(d++);a.bindTexture(a.TEXTURE_2D,b)};e(c.vertexTexture);e(c.normalTexture);var f=this.attributeNames;c.vertexAttributeTextures.forEach(function(a,b){void 0!==f[b]&&e(a)})}},
{key:"disableVertexData",value:function(a,b){for(var c=2,d=this.attributeInfo.length,e=this.attributeNames,f=0;f<d;++f)void 0!==e[f]&&++c;b=b.textureUnit(K)+a.TEXTURE0;for(d=0;d<c;++d)a.activeTexture(b++),a.bindTexture(a.TEXTURE_2D,null)}},{key:"drawFragment",value:function(a,b,c,d){d.ensure(c.numIndices).bind(b);this.bindVertexData(a,b,c.vertexData);this.indexBufferHelper.bind(c.indexBuffer,b);a.drawArrays(a.TRIANGLES,0,c.numIndices)}},{key:"endLayer",value:function(a,b){Object(z.c)(a,b);this.indexBufferHelper.disable(b);
this.disableVertexData(a,b)}}]);return a}(),T=function(){function a(){q(this,a)}J(a,[{key:"copyToGPU",value:function(a,b){var c=this;Object(y.d)(this,a,1,this.vertexPositions.length/3);var d=function(b,d){var e=a.createTexture();a.bindTexture(a.TEXTURE_2D,e);Object(y.f)(a,c,d,b);return e};this.vertexTexture=d(this.vertexPositions,N);this.normalTexture=d(this.vertexNormals,N);this.vertexAttributeTextures=this.vertexAttributes.map(function(a,c){return d(a,b[c])});a.bindTexture(a.TEXTURE_2D,null)}},
{key:"freeGPUMemory",value:function(a){a.deleteTexture(this.vertexTexture);a.deleteTexture(this.normalTexture);for(var b=this.vertexAttributeTextures,c=$jscomp.makeIterator(b),d=c.next();!d.done;d=c.next())a.deleteTexture(d.value);b.length=0}}]);return a}(),L=function(a){function b(a,c){q(this,b);a=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));var d=a.vertexData=new T;d.vertexPositions=c.vertexPositions;d.vertexNormals=c.vertexNormals;d.vertexAttributes=c.vertexAttributes;c=a.indices=
c.indices;a.numIndices=c.length;return a}k(b,a);J(b,[{key:"copyToGPU",value:function(a){H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"copyToGPU",this).call(this,a);this.vertexData.copyToGPU(a,this.source.attributeTextureFormats);this.indexBuffer=Object(z.e)(a,this.indices)}},{key:"freeGPUMemory",value:function(a){H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"freeGPUMemory",this).call(this,a);this.vertexData.freeGPUMemory(a);this.indexBuffer.dispose()}}]);return b}(n.b),
S=function(a){function b(){q(this,b);var a=p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.attributeTextureFormats=m(a.info.vertexAttributes);return a}k(b,a);J(b,[{key:"getChunk",value:function(a){return new L(this,a)}},{key:"info",get:function(){return this.parameters.info}}]);return b}(Object(n.f)(n.e,g.d)),Y=function(a){function b(){q(this,b);return p(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}k(b,a);return b}(Object(C.c)(G.b)),ha=function(a){function b(a,
c){q(this,b);var d=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.source=a;d.displayState=c;d.shaders=new Map;d.sharedObject=d.registerDisposer(new Y);d.fallbackFragmentMain="void main() {\n  emitGray();\n}\n";d.countingBuffer=d.registerDisposer(Object(z.d)(d.gl));d.displayState.shaderError.value=void 0;var e=function(){d.shaderManager=void 0;d.displayState.shaderError.value=void 0;d.disposeShaders();d.redrawNeeded.dispatch()};d.registerDisposer(c.fragmentMain.changed.add(e));d.registerDisposer(c.attributeNames.changed.add(e));
d.registerDisposer(c.objectToDataTransform.changed.add(function(){d.redrawNeeded.dispatch()}));d.displayState.shaderError.value=void 0;c=d.sharedObject;c.visibility.add(d.visibility);c.RPC_TYPE_ID=g.c;c.initializeCounterpart(a.chunkManager.rpc,{chunkManager:a.chunkManager.rpcId,source:a.addCounterpartRef()});d.setReady(!0);return d}k(b,a);J(b,[{key:"disposeShaders",value:function(){for(var a=this.shaders,b=$jscomp.makeIterator(a.values()),c=b.next();!c.done;c=b.next())c=c.value,null!==c&&c.dispose();
a.clear()}},{key:"disposed",value:function(){this.disposeShaders();H(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"makeShaderManager",value:function(a){a=void 0===a?this.displayState.fragmentMain.value:a;return new V(this.displayState.attributeNames.value,this.source.info.vertexAttributes,a)}},{key:"getShader",value:function(a){var b=this.shaders,c=b.get(a);if(void 0===c){c=null;var d=this.shaderManager;void 0===d&&(d=this.shaderManager=this.makeShaderManager());
var e=this.displayState.fragmentMain.value;try{c=d.getShader(this.gl,a),this.fallbackFragmentMain=e,this.displayState.shaderError.value=null}catch(za){if(this.displayState.shaderError.value=za,d=this.fallbackFragmentMain,d!==e){d=this.shaderManager=this.makeShaderManager(d);try{c=d.getShader(this.gl,a)}catch(Ib){}}}b.set(a,c)}return c}},{key:"draw",value:function(a){if(a.emitColor||!a.alreadyEmittedPickID){var b=this.source.chunks.get(g.b);if(void 0!==b&&b.state===v.d.GPU_MEMORY){var c=this.getShader(a.emitter);
if(null!==c){var d=this.gl,e=this.shaderManager;c.bind();e.beginLayer(d,c,a);var f=a.pickIDs;e.beginObject(d,c,this.displayState.objectToDataTransform.transform);a.emitPickID&&e.setPickID(d,c,f.register(this,b.numIndices/3));e.drawFragment(d,c,b,this.countingBuffer);e.endLayer(d,c)}}}}},{key:"drawPicking",value:function(a){this.draw(a)}},{key:"transformPickedValue",value:function(a,b){a=this.source.chunks.get(g.b);if(void 0!==a){b*=3;var c=a.indices;if(!(b>=c.length)){var d=c[b],e=[],f=this.displayState.attributeNames.value;
a.vertexData.vertexAttributes.forEach(function(a,b){b=f[b];void 0!==b&&e.push(b+"="+a[d].toPrecision(6))});return e.join(", ")}}}},{key:"isTransparent",get:function(){return null!==this.displayState.fragmentMain.value.match(/emitRGBA|emitPremultipliedRGBA/)}},{key:"gl",get:function(){return this.source.gl}}]);return b}(l.a)},function(n,f,c){function p(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function k(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}c.d(f,"d",function(){return q});f.c="single_mesh/SingleMeshLayer";f.a="single_mesh/getSingleMeshInfo";f.b="";var q=function(a){function b(){k(this,b);var a=(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!a||"object"!==typeof a&&"function"!==typeof a?this:a}p(b,a);return b}(function b(){k(this,b)});q.RPC_ID="single_mesh/SingleMeshSource"},function(n,f){},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}Object.defineProperty(f,"__esModule",{value:!0});c.d(f,"AnnotationPointListUserLayer",function(){return g});var a=c(220),b=c(221);n=c(20);f=c(15);var m=c(8),u=c(1),v=c(223),t=function h(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==
a)return h(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},l=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}();c(225);var g=function(c){function f(c,e){p(this,f);var g=k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,[]));g.manager=c;g.selectedIndex=new m.b(null);
g.layer=new a.a(g.manager.chunkManager,new b.a,g.manager.voxelSize,g.selectedIndex);g.layer.pointList.restoreState(e.points);g.registerDisposer(g.layer.pointList.changed.add(function(){g.specificationChanged.dispatch()}));g.addRenderLayer(new a.b(g.layer));g.addRenderLayer(new a.c(g.layer));var h=c.layerSelectedValues;g.registerDisposer(h.changed.add(function(){var a=h.get(g);g.selectedIndex.value="number"===typeof a?a:null}));return g}q(f,c);l(f,[{key:"toJSON",value:function(){var a={type:"pointAnnotation"};
a.points=this.layer.pointList.toJSON();return a}},{key:"handleAction",value:function(a){switch(a){case "annotate":a=this.manager.layerSelectedValues.get(this),void 0!==a?this.layer.pointList.delete(a):this.manager.layerSelectedValues.mouseState.active&&this.layer.pointList.append(this.manager.voxelSize.voxelFromSpatial(u.p.create(),this.manager.layerSelectedValues.mouseState.position))}}},{key:"makeDropdown",value:function(a){return new e(a,this)}}]);return f}(n.f),e=function(a){function b(a,c){p(this,
b);var e=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.element=a;e.layer=c;e.pointListWidget=e.registerDisposer(new v.a(e.layer.layer.pointList,e.layer.selectedIndex));a.classList.add("neuroglancer-annotation-point-list-dropdown");a.appendChild(e.pointListWidget.element);e.registerDisposer(e.pointListWidget.pointSelected.add(function(a){e.layer.manager.setVoxelCoordinates(e.layer.layer.pointList.get(a))}));return e}q(b,a);l(b,[{key:"onShow",value:function(){t(b.prototype.__proto__||
Object.getPrototypeOf(b.prototype),"onShow",this).call(this);this.pointListWidget.visible=!0}},{key:"onHide",value:function(){t(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"onHide",this).call(this);this.pointListWidget.visible=!1}}]);return b}(n.g);Object(f.e)("pointAnnotation",g)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return B});c.d(f,"b",function(){return D});c.d(f,"c",function(){return y});n=c(43);f=c(65);var a=c(0),b=c(1),
m=c(4),u=c(24),v=c(122),t=c(35),l=c(14),g=c(68),e=function A(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return A(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,
c);d&&a(b,d);return b}}(),h=b.j.create(),r=new Float32Array(4),B=function(a){function c(a,b,d,e){p(this,c);var f=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));f.chunkManager=a;f.pointList=b;f.voxelSizeObject=d;f.selectedIndex=e;f.generation=-1;f.redrawNeeded=new m.a;f.color=Float32Array.of(1,1,0,1);f.selectedColor=Float32Array.of(0,1,0,1);f.buffer=new u.a(a.gl);f.registerDisposer(b.changed.add(function(){f.selectedIndex.value=null;f.redrawNeeded.dispatch()}));f.registerDisposer(e.changed.add(function(){f.redrawNeeded.dispatch()}));
return f}q(c,a);d(c,[{key:"updateBuffer",value:function(){var a=this.pointList,b=a.generation;this.generation!==b&&(this.generation=b,this.buffer.setData(a.points.view))}},{key:"updateMouseState",value:function(a,c){b.p.multiply(a.position,this.pointList.get(c),this.voxelSizeObject.size)}},{key:"gl",get:function(){return this.chunkManager.gl}}]);return c}(a.a);c=function(a){function c(a){p(this,c);var b=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));b.gl=a;b.shaders=new Map;b.squareCornersBuffer=
Object(g.a)(b.gl);b.countingBuffer=b.registerDisposer(Object(v.d)(b.gl));return b}q(c,a);d(c,[{key:"defineShader",value:function(a){a.addAttribute("highp vec3","aVertexPosition");a.addAttribute("highp vec2","aCornerOffset");a.addUniform("highp vec2","uPointRadii");a.addUniform("highp vec4","uColor");a.addUniform("highp vec4","uColorSelected");a.addUniform("highp vec4","uSelectedIndex");a.addVarying("highp vec4","vColor");a.addUniform("highp mat4","uProjection");a.addUniform("highp vec4","uPickID");
a.addVarying("highp vec4","vPickID");a.addVarying("highp vec2","vPointCoord");a.require(v.b);a.addVertexCode(l.b);a.setVertexMain("\ngl_Position = uProjection * vec4(aVertexPosition, 1.0);\ngl_Position.xy += aCornerOffset * uPointRadii * gl_Position.w;\nvPointCoord = aCornerOffset;\n\nuint32_t primitiveIndex = getPrimitiveIndex();\n\nuint32_t pickID; pickID.value = uPickID;\nvPickID = add(pickID, primitiveIndex).value;\n\nif (uSelectedIndex == primitiveIndex.value) {\n  vColor = uColorSelected;\n} else {\n  vColor = uColor;\n}\n");
a.setFragmentMain("\nif (dot(vPointCoord, vPointCoord) > 1.0) {\n  discard;\n}\nemit(getColor(), vPickID);\n")}},{key:"getShader",value:function(a){var b=this.shaders,c=b.get(a);void 0===c&&(c=new t.a(this.gl),c.require(a),this.defineShader(c),c=this.registerDisposer(c.build()),b.set(a,c));return c}},{key:"draw",value:function(a,c,d){var e=this.getShader(d.emitter),f=this.gl;e.bind();c.updateBuffer();var g=c.pointList.length,k=e.attribute("aVertexPosition"),m=e.attribute("aCornerOffset");c.buffer.bindToVertexAttrib(k,
3);f.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(k,1);this.squareCornersBuffer.bindToVertexAttrib(m,2);this.countingBuffer.ensure(g).bind(e,1);b.j.identity(h);b.j.scale(h,h,c.voxelSizeObject.size);b.j.multiply(h,d.dataToDevice,h);f.uniformMatrix4fv(e.uniform("uProjection"),!1,h);f.uniform2f(e.uniform("uPointRadii"),8/d.viewportWidth,8/d.viewportHeight);d.emitPickID&&(a=d.pickIDs.register(a,g),f.uniform4fv(e.uniform("uPickID"),Object(l.p)(r,a)));d.emitColor&&(f.uniform4fv(e.uniform("uColor"),c.color),
f.uniform4fv(e.uniform("uColorSelected"),c.selectedColor),c=c.selectedIndex.value,null===c&&(c=4294967295),f.uniform4fv(e.uniform("uSelectedIndex"),Object(l.p)(r,c)));f.ANGLE_instanced_arrays.drawArraysInstancedANGLE(f.TRIANGLE_FAN,0,4,g);f.ANGLE_instanced_arrays.vertexAttribDivisorANGLE(k,0);Object(v.c)(f,e,!0);f.disableVertexAttribArray(k)}}]);return c}(a.a);var C=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);d(b,[{key:"defineShader",
value:function(a){e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addFragmentCode("\nvec4 getColor () { return vColor; }\n")}}]);return b}(c),D=function(a){function b(a){p(this,b);var c=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;c.renderHelper=c.registerDisposer(new C(c.gl));c.registerDisposer(a);c.registerDisposer(a.redrawNeeded.add(function(){c.redrawNeeded.dispatch()}));c.setReady(!0);return c}q(b,a);d(b,[{key:"draw",value:function(a){this.renderHelper.draw(this,
this.base,a)}},{key:"updateMouseState",value:function(a,b,c){this.base.updateMouseState(a,c)}},{key:"transformPickedValue",value:function(a,b){return b}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return b}(n.a),z=function(a){function b(){p(this,b);return k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}q(b,a);d(b,[{key:"defineShader",value:function(a){e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);a.addFragmentCode("\nvec4 getColor() {\n  float scalar = 1.0 - 2.0 * abs(0.5 - gl_FragCoord.z);\n  return vec4(vColor.xyz, scalar * vColor.a);\n}\n")}}]);
return b}(c),y=function(a){function b(a){p(this,b);var c=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.base=a;c.renderHelper=c.registerDisposer(new z(c.gl));c.registerDisposer(a);c.registerDisposer(a.redrawNeeded.add(function(){c.redrawNeeded.dispatch()}));c.setReady(!0);return c}q(b,a);d(b,[{key:"draw",value:function(a){this.renderHelper.draw(this,this.base,a)}},{key:"updateMouseState",value:function(a,b,c){this.base.updateMouseState(a,c)}},{key:"transformPickedValue",value:function(a,
b){return b}},{key:"gl",get:function(){return this.base.chunkManager.gl}}]);return b}(f.b)},function(n,f,c){c.d(f,"a",function(){return b});var p=c(222),k=c(2),q=c(4),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
this.points=new p.a;this.changed=new q.a;this.generation=0}a(b,[{key:"delete",value:function(a){this.points.eraseRange(3*a,3*a+3);++this.generation;this.changed.dispatch()}},{key:"get",value:function(a){return this.points.data.subarray(3*a,3*a+3)}},{key:"append",value:function(a){this.points.appendArray(a.subarray(0,3));++this.generation;this.changed.dispatch()}},{key:"reset",value:function(){this.points.clear();++this.generation;this.changed.dispatch()}},{key:"restoreState",value:function(a){try{if(Array.isArray(a)){var b=
a.length,c=this.points;c.resize(3*b);var f=c.data;for(c=0;c<b;++c){var g=3*c;Object(k.c)(f.subarray(g,g+3),a[c],k.o)}++this.generation;this.changed.dispatch()}}catch(e){this.reset()}}},{key:"toJSON",value:function(){for(var a=this.length,b=this.points.data,c=Array(a),f=0;f<a;++f){var g=3*f;c[f]=[b[g],b[g+1],b[g+2]]}return c}},{key:"length",get:function(){return this.points.length/3}}]);return b}()},function(n,f,c){c.d(f,"a",function(){return k});var p=function(){function c(a,b){for(var c=0;c<b.length;c++){var f=
b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(a,b,f){b&&c(a.prototype,b);f&&c(a,f);return a}}(),k=function(){function c(a){a=void 0===a?16:a;if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.length=0;this.data=new Float32Array(a)}p(c,[{key:"resize",value:function(a){var b=this.data;if(a>b.length){var c=new Float32Array(Math.max(a,2*b.length));c.set(b.subarray(0,this.length));this.data=
c}this.length=a}},{key:"shrinkToFit",value:function(){this.data=new Float32Array(this.view)}},{key:"clear",value:function(){this.length=0}},{key:"appendArray",value:function(a){var b=this.length;this.resize(b+a.length);this.data.set(a,b)}},{key:"eraseRange",value:function(a,b){this.data.copyWithin(a,b,this.length);this.length-=b-a}},{key:"view",get:function(){var a=this.data;return new Float32Array(a.buffer,a.byteOffset,this.length)}}]);return c}()},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return u});n=c(0);var q=c(12),a=c(4),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=
e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),m=function t(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return t(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(30);c(224);var u=function(c){function f(b,c){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");
var d=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.pointList=b;d.selectionIndex=c;d.element=document.createElement("div");d.clearButton=document.createElement("button");d.itemContainer=document.createElement("div");d.generation=-1;d.pointSelected=new a.b;d.visible_=!1;c=d.element;var e=d.clearButton,g=d.itemContainer;c.className="neuroglancer-point-list-widget";e.className="neuroglancer-clear-button";e.textContent="Delete all points";d.registerEventListener(e,"click",function(){d.pointList.reset()});
g.className="neuroglancer-item-container neuroglancer-select-text";c.appendChild(e);c.appendChild(g);d.registerDisposer(b.changed.add(function(){d.maybeUpdate()}));return d}k(f,c);b(f,[{key:"maybeUpdate",value:function(){var a=this;if(this.visible_){var b=this.pointList;if(this.generation!==b.generation){this.generation=b.generation;var c=this.itemContainer;Object(q.a)(c);var f=b.length;b=b.points.data;for(var k={i:0};k.i<f;k={i:k.i},++k.i){var l=document.createElement("div");l.className="neuroglancer-point-list-item";
var m=3*k.i;l.textContent=Math.round(b[m])+" "+Math.round(b[m+1])+" "+Math.round(b[m+2]);l.addEventListener("click",function(b){return function(){a.pointSelected.dispatch(b.i)}}(k));l.addEventListener("mouseenter",function(b){return function(){a.selectionIndex.value=b.i}}(k));l.addEventListener("mouseleave",function(){a.selectionIndex.value=null});c.appendChild(l)}}}}},{key:"disposed",value:function(){Object(q.b)(this.element);this.clearButton=this.itemContainer=this.element=void 0;m(f.prototype.__proto__||
Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"visible",get:function(){return this.visible_},set:function(a){this.visible_!==a&&(this.visible_=a,!0===a&&this.maybeUpdate())}}]);return f}(n.a)},function(n,f){},function(n,f){},function(n,f,c){function p(a){var b=new C.a,c=new v.a;b.add("viewer",c);a.global.addParent(c.eventActionMap,1E3);c=new v.a;b.add("sliceView",c);a.sliceView.addParent(c.eventActionMap,1E3);c=new v.a;b.add("perspectiveView",c);a.perspectiveView.addParent(c.eventActionMap,
1E3);c=new v.a;b.add("dataView",c);a.perspectiveView.addParent(c.eventActionMap,999);a.sliceView.addParent(c.eventActionMap,999);return b}function k(a){var b=new e.a({},function(a){for(var b=$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=b.next()){c=c.value;var d=a[c];if("number"!==typeof d)throw Error("Expected key "+JSON.stringify(c)+" to have a numeric value, but received: "+JSON.stringify(d)+".");}return a});b.changed.add(q()(function(){for(var c=b.value,d=$jscomp.makeIterator(Object.keys(c)),
e=d.next();!e.done;e=d.next())e=e.value,a.setSourceGeneration(e,c[e]);d=$jscomp.makeIterator(a.sourceGenerations.keys());for(e=d.next();!e.done;e=d.next())e=e.value,c.hasOwnProperty(e)||a.deleteSourceGeneration(e)},0));return b}Object.defineProperty(f,"__esModule",{value:!0});n=c(9);var q=c.n(n),a=c(79),b=c(25),m=c(113),u=c(227),v=c(228),t=c(229),l=c(230),g=c(231),e=c(8),d=c(266),h=c(267),r=c(268),B=c(303),C=c(32);window.addEventListener("DOMContentLoaded",function(){var c=new C.a,e=new C.a,f=new u.a;
c.add("credentials",f.inputState);e.add("credentials",f.outputState);f=Object(b.a)({credentialsManager:new a.a(f)});var n=new m.PythonDataSource;f.register("python",n);c.add("sourceGenerations",k(n));f=window.viewer=Object(r.a)({showLayerDialog:!1,resetStateWhenEmpty:!1,dataSourceProvider:f});Object(h.a)(f.inputEventBindings);c.add("inputEventBindings",p(f.inputEventBindings));n=new t.a(f);window.remoteActionHandler=n;c.add("actions",n.actionSet);c.add("statusMessages",new l.a);var q=f.state;window.location.hash&&
(f.registerDisposer(new B.a(f.state)).updateFromUrlHash(),q=void 0);var v=new g.a(q,e,c);n.sendActionRequested.add(function(a,b){return v.sendActionNotification(a,b)});Object(d.a)(f);Object(d.b)(f)})},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==
typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return g});var a=c(79),b=c(8),m=c(52),u=c(32),v=c(2),t=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);
Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),l=function(c){function d(){p(this,d);var c=k(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));c.invalidCredentials=new b.a(void 0,function(a){return a});c.validCredentials=new b.a(void 0,function(a){return a});c.get=Object(a.d)(function(a){return new Promise(function(b){var d=c.validCredentials.value,e=void 0!==a?a.generation:null;if(void 0!==d&&e!==d.generation)b(d);else{c.invalidCredentials.value=
e;var f=c.validCredentials.changed.add(function(){var a=c.validCredentials.value;void 0!==a&&e!==a.generation&&(f(),b(a))})}})});return c}q(d,c);return d}(a.c),g=function(){function a(){p(this,a);this.inputState=new u.b;this.outputState=new u.b;this.memoize=new m.a}t(a,[{key:"getCredentialsProvider",value:function(a,b){var c=this;void 0===b&&(b=null);var d=Object(v.g)({key:a,parameters:b});return this.memoize.get(d,function(){var a=new l;a.registerDisposer(c.inputState.add(d,a.validCredentials));
a.registerDisposer(c.outputState.add(d,a.invalidCredentials));return a})}}]);return a}()},function(n,f,c){c.d(f,"a",function(){return b});var p=c(2),k=c(4),q=c(17),a=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),b=function(){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
this.eventActionMap=new q.a;this.changed=new k.a}a(b,[{key:"reset",value:function(){this.eventActionMap.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){Object(p.u)(a);for(var b=this.eventActionMap,c=$jscomp.makeIterator(Object.keys(a)),f=c.next();!f.done;f=c.next()){f=f.value;var g=Object(p.B)(a[f]);b.set(f,g)}this.changed.dispatch()}},{key:"toJSON",value:function(){for(var a={},b=$jscomp.makeIterator(this.eventActionMap.bindings),c=b.next();!c.done;c=b.next()){var f=$jscomp.makeIterator(c.value);
c=f.next().value;f=f.next().value;a[c]=f.action}return a}}]);return b}()},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});
b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return e});n=c(9);var q=c.n(n),a=c(8);n=c(0);var b=c(17),m=c(1),u=c(2),v=c(4),t=c(32),l=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),g=function h(a,b,c){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,
b);if(void 0===e){if(a=Object.getPrototypeOf(a),null!==a)return h(a,b,c)}else{if("value"in e)return e.value;b=e.get;return void 0===b?void 0:b.call(c)}},e=function(c){function e(b){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function");var c=p(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));c.viewer=b;c.actionSet=new a.a(new Set,function(a){return new Set(Object(u.C)(a))});c.actionDisposers=[];c.sendActionRequested=new v.b;c.actionSet.changed.add(q()(function(){return c.updateActions()},
0));return c}k(e,c);l(e,[{key:"clearListeners",value:function(){for(var a=$jscomp.makeIterator(this.actionDisposers),b=a.next();!b.done;b=a.next())b=b.value,b();this.actionDisposers.length=0}},{key:"disposed",value:function(){this.clearListeners();g(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"disposed",this).call(this)}},{key:"updateActions",value:function(){var a=this;this.clearListeners();for(var c={},e=$jscomp.makeIterator(this.actionSet.value),f=e.next();!f.done;c={action:c.action},
f=e.next())c.action=f.value,this.actionDisposers.push(Object(b.c)(this.viewer.element,c.action,function(b){return function(){return a.handleAction(b.action)}}(c)))}},{key:"handleAction",value:function(a){var b=this.viewer,c=b.mouseState;b=b.layerSelectedValues;var e={};if(c.updateUnconditionally()){e.mouseSpatialCoordinates=Array.prototype.slice.call(c.position);var f=this.viewer.navigationState.voxelSize;f.valid&&(e.mouseVoxelCoordinates=Array.prototype.slice.call(m.p.divide(m.p.create(),c.position,
f.size)))}e.selectedValues=b;e.viewerState=Object(t.c)(this.viewer.state).value;this.sendActionRequested.dispatch(a,JSON.parse(JSON.stringify(e)))}}]);return e}(n.a)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&
b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});n=c(9);var q=c.n(n),a=c(31),b=c(4);n=c(0);var m=c(2),u=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),v=function(c){function f(){if(!(this instanceof
f))throw new TypeError("Cannot call a class as a function");var a=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));a.existingMessages=new Map;a.changed=new b.a;a.messages=new Map;a.changed.add(a.registerCancellable(q()(function(){return a.updateMessages()},0)));return a}k(f,c);u(f,[{key:"reset",value:function(){this.messages.clear();this.changed.dispatch()}},{key:"restoreState",value:function(a){Object(m.u)(a);this.messages.clear();for(var b=$jscomp.makeIterator(Object.keys(a)),c=b.next();!c.done;c=
b.next()){c=c.value;var f=Object(m.B)(a[c]);this.messages.set(c,f)}this.changed.dispatch()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.existingMessages.values()),b=a.next();!b.done;b=a.next())b.value.dispose();this.existingMessages.clear()}},{key:"updateMessages",value:function(){for(var b=this.existingMessages,c=this.messages,d=$jscomp.makeIterator(b),f=d.next();!f.done;f=d.next()){var k=$jscomp.makeIterator(f.value);f=k.next().value;k=k.next().value;var l=c.get(f);void 0===
l?(k.dispose(),b.delete(f)):k.setText(l)}c=$jscomp.makeIterator(c);for(d=c.next();!d.done;d=c.next())f=$jscomp.makeIterator(d.value),d=f.next().value,f=f.next().value,b.has(d)||(k=new a.a,k.setText(f),b.set(d,k))}},{key:"toJSON",value:function(){for(var a={},b=$jscomp.makeIterator(this.messages),c=b.next();!c.done;c=b.next()){var f=$jscomp.makeIterator(c.value);c=f.next().value;f=f.next().value;a[c]=f}return a}}]);return f}(n.a)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(){var a=window.location.pathname.match(/^\/v\/([^\/]+)/);if(null===a)throw Error("Failed to determine token from URL.");
return window.location.origin+"/socket/"+a[1]}c.d(f,"a",function(){return v});var a=c(232);n=c(0);f=c(234);var b=c.n(f),m=c(31),u=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),v=function(c){function f(b,c,d,h){h=void 0===h?q():h;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");
var e=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));e.sharedState=b;e.privateState=c;e.configState=d;e.url=h;e.reconnectionDelay=1E3;e.waitingToReconnect=-1;e.isOpen=!1;e.updateClients=new Map;e.status=e.registerDisposer(new m.a(!0));e.actionQueue=[];e.nextActionId=0;e.lastActionAcknowledged=-1;c=[{key:"p",state:c,receiveUpdates:!1,sendUpdates:0},{key:"c",state:d,receiveUpdates:!0,sendUpdates:null}];void 0!==b&&c.push({key:"s",state:b,receiveUpdates:!0,sendUpdates:100});b={};c=$jscomp.makeIterator(c);
for(d=c.next();!d.done;b={key:b.key},d=c.next()){var g=d.value;b.key=g.key;d=g.receiveUpdates;h=g.sendUpdates;g=e.registerDisposer(new a.a(g.state,h,d));e.updateClients.set(b.key,g);null!==h&&g.sendUpdateRequested.add(function(a){return function(b,c){return e.send("setState",{k:a.key,s:b,g:c})}}(b));d&&g.receiveUpdateRequested.add(function(a){return function(b){return e.send("getState",{g:b,k:a.key})}}(b))}e.connect();return e}k(f,c);u(f,[{key:"dispose",value:function(){void 0!==this.socket&&(this.socket.close(),
this.socket=void 0);-1!==this.waitingToReconnect&&(clearInterval(this.waitingToReconnect),this.waitingToReconnect=-1)}},{key:"send",value:function(a,b){b.t=a;this.socket.send(JSON.stringify(b))}},{key:"connect",value:function(){var a=this;this.status.setText("Connecting to Python server");this.status.setVisible(!0);var c=this.socket=new b.a(this.url,{transports:["websocket","xhr-streaming"]});c.onopen=function(){a.isOpen=!0;a.reconnectionDelay=1E3;a.status.setVisible(!1);for(var b=$jscomp.makeIterator(a.updateClients.values()),
c=b.next();!c.done;c=b.next())c.value.connected=!0;a.flushActionQueue()};c.onclose=function(){a.isOpen=!1;for(var b=a.reconnectionDelay,c=$jscomp.makeIterator(a.updateClients.values()),e=c.next();!e.done;e=c.next())e.value.connected=!1;var f=Date.now()+b;a.status.setVisible(!0);var g=function(b){a.status.setText("Disconnected from Python server.  "+("Retrying in "+Math.ceil(b/1E3)+" seconds."))};a.waitingToReconnect=setInterval(function(){var b=f-Date.now();0>b?(clearInterval(a.waitingToReconnect),
a.waitingToReconnect=-1,a.connect()):g(b)},1E3);g(b);a.reconnectionDelay=Math.min(3E4,2*b)};c.onmessage=function(b){b=JSON.parse(b.data);if("object"!==typeof b||Array.isArray(b))throw Error("Invalid message received over server connection.");switch(b.t){case "setState":var c=a.updateClients.get(b.k);if(void 0===c)throw Error("Invalid state key: "+JSON.stringify(b.k));c.setState(b.s,b.g);break;case "ackAction":b=parseInt(b.id,10);if(b<a.lastActionAcknowledged||b>=a.nextActionId)throw Error("Invalid action acknowledged message");
a.actionQueue.splice(0,b-a.lastActionAcknowledged);a.lastActionAcknowledged=b}}}},{key:"flushActionQueue",value:function(){var a=this.actionQueue;0!==a.length&&this.send("action",{id:this.nextActionId-1,actions:a})}},{key:"sendActionNotification",value:function(a,b){this.actionQueue.push({action:a,state:b});++this.nextActionId;this.isOpen&&this.flushActionQueue()}}]);return f}(n.a)},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return t});n=c(9);var q=c.n(n);n=c(96);var a=c.n(n);n=c(0);var b=c(233),m=c(4),u=c(32),v=function(){function a(a,
b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),t=function(c){function f(b,c,g){c=void 0===c?100:c;g=void 0===g?!0:g;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var d=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.state=b;d.receiveUpdates=g;d.serverGeneration="";d.clientGeneration=
-1;d.connected_=!1;d.receiveUpdateRequested=new m.b;d.sendUpdateRequested=new m.b;null!==c?(d.sendUpdates=!0,d.registerDisposer(b.changed.add(d.registerCancellable(a()(d.registerCancellable(q()(function(){return d.handleStateChanged()},0)),c,{leading:!1}))))):d.sendUpdates=!1;return d}k(f,c);v(f,[{key:"setState",value:function(a,b){this.receiveUpdates&&b!==this.serverGeneration&&(this.lastServerState=JSON.stringify(a),this.state.reset(),this.state.restoreState(a),this.serverGeneration=b,this.clientGeneration=
this.state.changed.count)}},{key:"handleStateChanged",value:function(){if(this.sendUpdates&&this.connected_&&(!this.receiveUpdates||""!==this.serverGeneration)&&this.clientGeneration!==this.state.changed.count){var a=Object(u.c)(this.state).value,c=JSON.stringify(a);if(c===this.lastServerState)this.clientGeneration=this.state.changed.count;else{var f=Object(b.a)(160);this.serverGeneration=f;this.lastServerState=c;this.sendUpdateRequested.dispatch(a,f)}}}},{key:"connected",set:function(a){a!==this.connected_&&
(this.connected_=a,!0===a&&(this.receiveUpdates&&this.receiveUpdateRequested.dispatch(this.serverGeneration),this.handleStateChanged()))},get:function(){return this.connected_}}]);return f}(n.a)},function(n,f,c){f.a=function(c){c=Math.ceil((void 0===c?128:c)/32);var f=new Uint32Array(c);crypto.getRandomValues(f);for(var p="",a=0;a<c;++a)p+=("00000000"+f[a].toString(16)).slice(-8);return p}},function(n,f,c){f=c(5);var p=c(235);n.exports=c(254)(p);"_sockjs_onload"in f&&setTimeout(f._sockjs_onload,1)},
function(n,f,c){n.exports=[c(236),c(243),c(127),c(128),c(81)(c(128)),c(132),c(81)(c(132)),c(133),c(250),c(81)(c(133)),c(251)]},function(n,f,c){(function(f){function k(b,c,f){if(!k.enabled())throw Error("Transport created when disabled");m.call(this);v("constructor",b);var e=this;b=a.addPath(b,"/websocket");this.url=b="https"===b.slice(0,5)?"wss"+b.slice(5):"ws"+b.slice(4);this.ws=new u(this.url,[],f);this.ws.onmessage=function(a){v("message event",a.data);e.emit("message",a.data)};this.unloadRef=
p.unloadAdd(function(){v("unload");e.ws.close()});this.ws.onclose=function(a){v("close event",a.code,a.reason);e.emit("close",a.code,a.reason);e._cleanup()};this.ws.onerror=function(a){v("error event",a);e.emit("close",1006,"WebSocket connection broken");e._cleanup()}}var p=c(33),a=c(18),b=c(3),m=c(10).EventEmitter,u=c(242),v=function(){};"production"!==f.env.NODE_ENV&&(v=c(7)("sockjs-client:websocket"));b(k,m);k.prototype.send=function(a){a="["+a+"]";v("send",a);this.ws.send(a)};k.prototype.close=
function(){v("close");var a=this.ws;this._cleanup();a&&a.close()};k.prototype._cleanup=function(){v("_cleanup");var a=this.ws;a&&(a.onmessage=a.onclose=a.onerror=null);p.unloadDel(this.unloadRef);this.unloadRef=this.ws=null;this.removeAllListeners()};k.enabled=function(){v("enabled");return!!u};k.transportName="websocket";k.roundTrips=2;n.exports=k}).call(f,c(6))},function(n,f,c){(function(c){n.exports.randomBytes=c.crypto&&c.crypto.getRandomValues?function(f){f=new Uint8Array(f);c.crypto.getRandomValues(f);
return f}:function(c){for(var f=Array(c),a=0;a<c;a++)f[a]=Math.floor(256*Math.random());return f}}).call(f,c(5))},function(n,f,c){n.exports=function(c,f){f=f.split(":")[0];c=+c;if(!c)return!1;switch(f){case "http":case "ws":return 80!==c;case "https":case "wss":return 443!==c;case "ftp":return 21!==c;case "gopher":return 70!==c;case "file":return!1}return 0!==c}},function(n,f,c){var p=Object.prototype.hasOwnProperty;f.stringify=function(c,f){f=f||"";var a=[];"string"!==typeof f&&(f="?");for(var b in c)p.call(c,
b)&&a.push(encodeURIComponent(b)+"="+encodeURIComponent(c[b]));return a.length?f+a.join("&"):""};f.parse=function(c){for(var f=/([^=?&]+)=?([^&]*)/g,a={},b;b=f.exec(c);a[decodeURIComponent(b[1].replace(/\+/g," "))]=decodeURIComponent(b[2].replace(/\+/g," ")));return a}},function(n,f,c){function p(a){var b=0,c;for(c in a)b=(b<<5)-b+a.charCodeAt(c),b|=0;return f.colors[Math.abs(b)%f.colors.length]}function k(a){function b(){if(b.enabled){var a=+new Date;b.diff=a-(q||a);b.prev=q;q=b.curr=a;var c=Array(arguments.length);
for(a=0;a<c.length;a++)c[a]=arguments[a];c[0]=f.coerce(c[0]);"string"!==typeof c[0]&&c.unshift("%O");var k=0;c[0]=c[0].replace(/%([a-zA-Z%])/g,function(a,l){if("%%"===a)return a;k++;l=f.formatters[l];"function"===typeof l&&(a=l.call(b,c[k]),c.splice(k,1),k--);return a});f.formatArgs.call(b,c);(b.log||f.log||console.log.bind(console)).apply(b,c)}}b.namespace=a;b.enabled=f.enabled(a);b.useColors=f.useColors();b.color=p(a);"function"===typeof f.init&&f.init(b);return b}f=n.exports=k.debug=k["default"]=
k;f.coerce=function(a){return a instanceof Error?a.stack||a.message:a};f.disable=function(){f.enable("")};f.enable=function(a){f.save(a);f.names=[];f.skips=[];for(var b=("string"===typeof a?a:"").split(/[\s,]+/),c=b.length,k=0;k<c;k++)b[k]&&(a=b[k].replace(/\*/g,".*?"),"-"===a[0]?f.skips.push(new RegExp("^"+a.substr(1)+"$")):f.names.push(new RegExp("^"+a+"$")))};f.enabled=function(a){var b;var c=0;for(b=f.skips.length;c<b;c++)if(f.skips[c].test(a))return!1;c=0;for(b=f.names.length;c<b;c++)if(f.names[c].test(a))return!0;
return!1};f.humanize=c(241);f.names=[];f.skips=[];f.formatters={};var q},function(n,f){function c(a){a=String(a);if(!(100<a.length)&&(a=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(a))){var b=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return b*q;case "days":case "day":case "d":return b*k;case "hours":case "hour":case "hrs":case "hr":case "h":return 36E5*b;
case "minutes":case "minute":case "mins":case "min":case "m":return 6E4*b;case "seconds":case "second":case "secs":case "sec":case "s":return 1E3*b;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return b}}}function p(a,b,c){if(!(a<b))return a<1.5*b?Math.floor(a/b)+" "+c:Math.ceil(a/b)+" "+c+"s"}var k=864E5,q=365.25*k;n.exports=function(a,b){b=b||{};var f=typeof a;if("string"===f&&0<a.length)return c(a);if("number"===f&&!1===isNaN(a))return b.long?p(a,k,"day")||p(a,36E5,
"hour")||p(a,6E4,"minute")||p(a,1E3,"second")||a+" ms":a>=k?Math.round(a/k)+"d":36E5<=a?Math.round(a/36E5)+"h":6E4<=a?Math.round(a/6E4)+"m":1E3<=a?Math.round(a/1E3)+"s":a+"ms";throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a));}},function(n,f,c){(function(c){var f=c.WebSocket||c.MozWebSocket;n.exports=f?function(c){return new f(c)}:void 0}).call(f,c(5))},function(n,f,c){(function(f){function k(c){if(!u.enabled&&!m.enabled)throw Error("Transport created when disabled");
a.call(this,c,"/xhr_streaming",b,m)}var p=c(3),a=c(41),b=c(58),m=c(59),u=c(49),v=c(50);p(k,a);k.enabled=function(a){return a.nullOrigin||v.isOpera()?!1:m.enabled};k.transportName="xhr-streaming";k.roundTrips=2;k.needBody=!!f.document;n.exports=k}).call(f,c(5))},function(n,f,c){(function(f){function k(c,f){b(c);a.call(this);this.sendBuffer=[];this.sender=f;this.url=c}var p=c(3),a=c(10).EventEmitter,b=function(){};"production"!==f.env.NODE_ENV&&(b=c(7)("sockjs-client:buffered-sender"));p(k,a);k.prototype.send=
function(a){b("send",a);this.sendBuffer.push(a);this.sendStop||this.sendSchedule()};k.prototype.sendScheduleWait=function(){b("sendScheduleWait");var a=this;this.sendStop=function(){b("sendStop");a.sendStop=null;clearTimeout(c)};var c=setTimeout(function(){b("timeout");a.sendStop=null;a.sendSchedule()},25)};k.prototype.sendSchedule=function(){b("sendSchedule",this.sendBuffer.length);var a=this;if(0<this.sendBuffer.length){var c="["+this.sendBuffer.join(",")+"]";this.sendStop=this.sender(this.url,
c,function(c){a.sendStop=null;c?(b("error",c),a.emit("close",c.code||1006,"Sending error: "+c),a.close()):a.sendScheduleWait()});this.sendBuffer=[]}};k.prototype._cleanup=function(){b("_cleanup");this.removeAllListeners()};k.prototype.close=function(){b("close");this._cleanup();this.sendStop&&(this.sendStop(),this.sendStop=null)};n.exports=k}).call(f,c(6))},function(n,f,c){(function(f){function k(c,f,k){b(f);a.call(this);this.Receiver=c;this.receiveUrl=f;this.AjaxObject=k;this._scheduleReceiver()}
var p=c(3),a=c(10).EventEmitter,b=function(){};"production"!==f.env.NODE_ENV&&(b=c(7)("sockjs-client:polling"));p(k,a);k.prototype._scheduleReceiver=function(){b("_scheduleReceiver");var a=this,c=this.poll=new this.Receiver(this.receiveUrl,this.AjaxObject);c.on("message",function(c){b("message",c);a.emit("message",c)});c.once("close",function(f,k){b("close",f,k,a.pollIsClosing);a.poll=c=null;a.pollIsClosing||("network"===k?a._scheduleReceiver():(a.emit("close",f||1006,k),a.removeAllListeners()))})};
k.prototype.abort=function(){b("abort");this.removeAllListeners();this.pollIsClosing=!0;this.poll&&this.poll.abort()};n.exports=k}).call(f,c(6))},function(n,f,c){(function(f){function k(c){m(c);a.call(this);var f=this,k=this.es=new b(c);k.onmessage=function(a){m("message",a.data);f.emit("message",decodeURI(a.data))};k.onerror=function(a){m("error",k.readyState,a);a=2!==k.readyState?"network":"permanent";f._cleanup();f._close(a)}}var p=c(3),a=c(10).EventEmitter,b=c(129),m=function(){};"production"!==
f.env.NODE_ENV&&(m=c(7)("sockjs-client:receiver:eventsource"));p(k,a);k.prototype.abort=function(){m("abort");this._cleanup();this._close("user")};k.prototype._cleanup=function(){m("cleanup");var a=this.es;a&&(a.onmessage=a.onerror=null,a.close(),this.es=null)};k.prototype._close=function(a){m("close",a);var b=this;setTimeout(function(){b.emit("close",null,a);b.removeAllListeners()},200)};n.exports=k}).call(f,c(6))},function(n,f){n.exports=function(c){c.webpackPolyfill||(c.deprecate=function(){},
c.paths=[],c.children||(c.children=[]),Object.defineProperty(c,"loaded",{enumerable:!0,get:function(){return c.l}}),Object.defineProperty(c,"id",{enumerable:!0,get:function(){return c.i}}),c.webpackPolyfill=1);return c}},function(n,f){n.exports={}},function(n,f,c){(function(f,k){function p(a){t(a);u.call(this);var c=this;b.polluteGlobalNamespace();this.id="a"+v.string(6);a=m.addQuery(a,"c="+decodeURIComponent(b.WPrefix+"."+this.id));t("using htmlfile",p.htmlfileEnabled);var e=p.htmlfileEnabled?b.createHtmlfile:
b.createIframe;k[b.WPrefix][this.id]={start:function(){t("start");c.iframeObj.loaded()},message:function(a){t("message",a);c.emit("message",a)},stop:function(){t("stop");c._cleanup();c._close("network")}};this.iframeObj=e(a,function(){t("callback");c._cleanup();c._close("permanent")})}var a=c(3),b=c(51),m=c(18),u=c(10).EventEmitter,v=c(40),t=function(){};"production"!==f.env.NODE_ENV&&(t=c(7)("sockjs-client:receiver:htmlfile"));a(p,u);p.prototype.abort=function(){t("abort");this._cleanup();this._close("user")};
p.prototype._cleanup=function(){t("_cleanup");this.iframeObj&&(this.iframeObj.cleanup(),this.iframeObj=null);delete k[b.WPrefix][this.id]};p.prototype._close=function(a){t("_close",a);this.emit("close",null,a);this.removeAllListeners()};p.htmlfileEnabled=!1;f=["Active"].concat("Object").join("X");if(f in k)try{p.htmlfileEnabled=!!new k[f]("htmlfile")}catch(l){}p.enabled=p.htmlfileEnabled||b.iframeEnabled;n.exports=p}).call(f,c(6),c(5))},function(n,f,c){function p(c){if(!b.enabled)throw Error("Transport created when disabled");
k.call(this,c,"/xhr",a,b)}f=c(3);var k=c(41),q=c(127),a=c(58),b=c(80);f(p,k);p.enabled=q.enabled;p.transportName="xdr-polling";p.roundTrips=2;n.exports=p},function(n,f,c){(function(f){function k(c){if(!k.enabled())throw Error("Transport created when disabled");a.call(this,c,"/jsonp",m,b)}var p=c(3),a=c(125),b=c(252),m=c(253);p(k,a);k.enabled=function(){return!!f.document};k.transportName="jsonp-polling";k.roundTrips=1;k.needBody=!0;n.exports=k}).call(f,c(5))},function(n,f,c){(function(f,k){function p(c){l(c);
var e=this;t.call(this);a.polluteGlobalNamespace();this.id="a"+b.string(6);c=u.addQuery(c,"c="+encodeURIComponent(a.WPrefix+"."+this.id));k[a.WPrefix][this.id]=this._callback.bind(this);this._createScript(c);this.timeoutId=setTimeout(function(){l("timeout");e._abort(Error("JSONP script loaded abnormally (timeout)"))},p.timeout)}var a=c(51),b=c(40),m=c(50),u=c(18),v=c(3),t=c(10).EventEmitter,l=function(){};"production"!==f.env.NODE_ENV&&(l=c(7)("sockjs-client:receiver:jsonp"));v(p,t);p.prototype.abort=
function(){l("abort");if(k[a.WPrefix][this.id]){var b=Error("JSONP user aborted read");b.code=1E3;this._abort(b)}};p.timeout=35E3;p.scriptErrorTimeout=1E3;p.prototype._callback=function(a){l("_callback",a);this._cleanup();this.aborting||(a&&(l("message",a),this.emit("message",a)),this.emit("close",null,"network"),this.removeAllListeners())};p.prototype._abort=function(a){l("_abort",a);this._cleanup();this.aborting=!0;this.emit("close",a.code,a.message);this.removeAllListeners()};p.prototype._cleanup=
function(){l("_cleanup");clearTimeout(this.timeoutId);this.script2&&(this.script2.parentNode.removeChild(this.script2),this.script2=null);if(this.script){var b=this.script;b.parentNode.removeChild(b);this.script=b.onreadystatechange=b.onerror=b.onload=b.onclick=null}delete k[a.WPrefix][this.id]};p.prototype._scriptError=function(){l("_scriptError");var a=this;this.errorTimer||(this.errorTimer=setTimeout(function(){a.loadedOkay||a._abort(Error("JSONP script loaded abnormally (onerror)"))},p.scriptErrorTimeout))};
p.prototype._createScript=function(a){l("_createScript",a);var c=this,d=this.script=k.document.createElement("script");d.id="a"+b.string(8);d.src=a;d.type="text/javascript";d.charset="UTF-8";d.onerror=this._scriptError.bind(this);d.onload=function(){l("onload");c._abort(Error("JSONP script loaded abnormally (onload)"))};d.onreadystatechange=function(){l("onreadystatechange",d.readyState);if(/loaded|closed/.test(d.readyState)){if(d&&d.htmlFor&&d.onclick){c.loadedOkay=!0;try{d.onclick()}catch(r){}}d&&
c._abort(Error("JSONP script loaded abnormally (onreadystatechange)"))}};if("undefined"===typeof d.async&&k.document.attachEvent)if(m.isOpera()){var f=this.script2=k.document.createElement("script");f.text="try{var a = document.getElementById('"+d.id+"'); if(a)a.onerror();}catch(x){};";d.async=f.async=!1}else{try{d.htmlFor=d.id,d.event="onclick"}catch(r){}d.async=!0}"undefined"!==typeof d.async&&(d.async=!0);a=k.document.getElementsByTagName("head")[0];a.insertBefore(d,a.firstChild);f&&a.insertBefore(f,
a.firstChild)};n.exports=p}).call(f,c(6),c(5))},function(n,f,c){(function(f,k){function p(a){m("createIframe",a);try{return k.document.createElement('<iframe name="'+a+'">')}catch(g){var b=k.document.createElement("iframe");b.name=a;return b}}var a=c(40),b=c(18),m=function(){};"production"!==f.env.NODE_ENV&&(m=c(7)("sockjs-client:sender:jsonp"));var u,v;n.exports=function(c,f,g){m(c,f);u||(m("createForm"),u=k.document.createElement("form"),u.style.display="none",u.style.position="absolute",u.method=
"POST",u.enctype="application/x-www-form-urlencoded",u.acceptCharset="UTF-8",v=k.document.createElement("textarea"),v.name="d",u.appendChild(v),k.document.body.appendChild(u));var e="a"+a.string(8);u.target=e;u.action=b.addQuery(b.addPath(c,"/jsonp_send"),"i="+e);var d=p(e);d.id=e;d.style.display="none";u.appendChild(d);try{v.value=f}catch(r){}u.submit();var h=function(a){m("completed",e,a);d.onerror&&(d.onreadystatechange=d.onerror=d.onload=null,setTimeout(function(){m("cleaning up",e);d.parentNode.removeChild(d);
d=null},500),v.value="",g(a))};d.onerror=function(){m("onerror",e);h()};d.onload=function(){m("onload",e);h()};d.onreadystatechange=function(a){m("onreadystatechange",e,d.readyState,a);"complete"===d.readyState&&h()};return function(){m("aborted",e);h(Error("Aborted"))}}}).call(f,c(6),c(5))},function(n,f,c){(function(f,k){function p(b,c,e){if(!(this instanceof p))return new p(b,c,e);if(1>arguments.length)throw new TypeError("Failed to construct 'SockJS: 1 argument required, but only 0 present");B.call(this);
this.readyState=p.CONNECTING;this.protocol=this.extensions="";e=e||{};e.protocols_whitelist&&h.warn("'protocols_whitelist' is DEPRECATED. Use 'transports' instead.");this._transportsWhitelist=e.transports;this._transportOptions=e.transportOptions||{};var f=e.sessionId||8;if("function"===typeof f)this._generateSessionId=f;else if("number"===typeof f)this._generateSessionId=function(){return u.string(f)};else throw new TypeError("If sessionId is used in the options, it needs to be a number or a function.");
this._server=e.server||u.numberString(1E3);var g=new a(b);if(g.host&&g.protocol){if(g.hash)throw new SyntaxError("The URL must not contain a fragment");if("http:"!==g.protocol&&"https:"!==g.protocol)throw new SyntaxError("The URL's scheme must be either 'http:' or 'https:'. '"+g.protocol+"' is not allowed.");}else throw new SyntaxError("The URL '"+b+"' is invalid");var k="https:"===g.protocol;if("https"===C.protocol&&!k)throw Error("SecurityError: An insecure SockJS connection may not be initiated from a page loaded over HTTPS");
c?Array.isArray(c)||(c=[c]):c=[];var l=c.sort();l.forEach(function(a,b){if(!a)throw new SyntaxError("The protocols entry '"+a+"' is invalid.");if(b<l.length-1&&a===l[b+1])throw new SyntaxError("The protocols entry '"+a+"' is duplicated.");});this._origin=(k=t.getOrigin(C.href))?k.toLowerCase():null;g.set("pathname",g.pathname.replace(/\/+$/,""));this.url=g.href;E("using url",this.url);this._urlInfo={nullOrigin:!d.hasDomain(),sameOrigin:t.isOriginEqual(this.url,C.href),sameScheme:t.isSchemeEqual(this.url,
C.href)};this._ir=new y(this.url,this._urlInfo);this._ir.once("finish",this._receiveInfo.bind(this))}c(255);var a=c(123),b=c(3),m=c(26),u=c(40),v=c(256),t=c(18),l=c(33),g=c(257),e=c(82),d=c(50),h=c(258),r=c(83),B=c(124),C=c(134),D=c(259),z=c(260),y=c(261),E=function(){};"production"!==f.env.NODE_ENV&&(E=c(7)("sockjs-client:main"));var A;b(p,B);p.prototype.close=function(a,b){if(a&&!(1E3===a||3E3<=a&&4999>=a))throw Error("InvalidAccessError: Invalid code");if(b&&123<b.length)throw new SyntaxError("reason argument has an invalid length");
this.readyState!==p.CLOSING&&this.readyState!==p.CLOSED&&this._close(a||1E3,b||"Normal closure",!0)};p.prototype.send=function(a){"string"!==typeof a&&(a=""+a);if(this.readyState===p.CONNECTING)throw Error("InvalidStateError: The connection has not been established yet");this.readyState===p.OPEN&&this._transport.send(v.quote(a))};p.version=c(131);p.CONNECTING=0;p.OPEN=1;p.CLOSING=2;p.CLOSED=3;p.prototype._receiveInfo=function(a,b){E("_receiveInfo",b);this._ir=null;a?(this._rto=this.countRTO(b),this._transUrl=
a.base_url?a.base_url:this.url,a=e.extend(a,this._urlInfo),E("info",a),this._transports=A.filterToEnabled(this._transportsWhitelist,a).main,E(this._transports.length+" enabled transports"),this._connect()):this._close(1002,"Cannot connect to server")};p.prototype._connect=function(){for(var a=this._transports.shift();a;){E("attempt",a.transportName);if(a.needBody&&(!k.document.body||"undefined"!==typeof k.document.readyState&&"complete"!==k.document.readyState&&"interactive"!==k.document.readyState)){E("waiting for body");
this._transports.unshift(a);l.attachEvent("load",this._connect.bind(this));return}var b=this._rto*a.roundTrips||5E3;this._transportTimeoutId=setTimeout(this._transportTimeout.bind(this),b);E("using timeout",b);b=t.addPath(this._transUrl,"/"+this._server+"/"+this._generateSessionId());var c=this._transportOptions[a.transportName];E("transport url",b);b=new a(b,this._transUrl,c);b.on("message",this._transportMessage.bind(this));b.once("close",this._transportClose.bind(this));b.transportName=a.transportName;
this._transport=b;return}this._close(2E3,"All transports failed",!1)};p.prototype._transportTimeout=function(){E("_transportTimeout");this.readyState===p.CONNECTING&&this._transportClose(2007,"Transport timed out")};p.prototype._transportMessage=function(a){E("_transportMessage",a);var b=this,c=a.slice(0,1);a=a.slice(1);switch(c){case "o":this._open();return;case "h":this.dispatchEvent(new r("heartbeat"));E("heartbeat",this.transport);return}if(a)try{var d=m.parse(a)}catch(R){E("bad json",a)}if("undefined"===
typeof d)E("empty payload",a);else switch(c){case "a":Array.isArray(d)&&d.forEach(function(a){E("message",b.transport,a);b.dispatchEvent(new z(a))});break;case "m":E("message",this.transport,d);this.dispatchEvent(new z(d));break;case "c":Array.isArray(d)&&2===d.length&&this._close(d[0],d[1],!0)}};p.prototype._transportClose=function(a,b){E("_transportClose",this.transport,a,b);this._transport&&(this._transport.removeAllListeners(),this.transport=this._transport=null);1E3===a||3E3<=a&&4999>=a||2E3===
a||this.readyState!==p.CONNECTING?this._close(a,b):this._connect()};p.prototype._open=function(){E("_open",this._transport.transportName,this.readyState);this.readyState===p.CONNECTING?(this._transportTimeoutId&&(clearTimeout(this._transportTimeoutId),this._transportTimeoutId=null),this.readyState=p.OPEN,this.transport=this._transport.transportName,this.dispatchEvent(new r("open")),E("connected",this.transport)):this._close(1006,"Server lost session")};p.prototype._close=function(a,b,c){E("_close",
this.transport,a,b,c,this.readyState);var d=!1;this._ir&&(d=!0,this._ir.close(),this._ir=null);this._transport&&(this._transport.close(),this.transport=this._transport=null);if(this.readyState===p.CLOSED)throw Error("InvalidStateError: SockJS has already been closed");this.readyState=p.CLOSING;setTimeout(function(){this.readyState=p.CLOSED;d&&this.dispatchEvent(new r("error"));var e=new D("close");e.wasClean=c||!1;e.code=a||1E3;e.reason=b;this.dispatchEvent(e);this.onmessage=this.onclose=this.onerror=
null;E("disconnected")}.bind(this),0)};p.prototype.countRTO=function(a){return 100<a?4*a:300+a};n.exports=function(a){A=g(a);c(264)(p,a);return p}}).call(f,c(6),c(5))},function(n,f,c){function p(){}var k=Array.prototype,q=Object.prototype;f=Function.prototype;var a=String.prototype,b=k.slice,m=q.toString;if(n=Object.defineProperty)try{Object.defineProperty({},"x",{}),n=!0}catch(e){n=!1}var u=n?function(a,b,c,f){!f&&b in a||Object.defineProperty(a,b,{configurable:!0,enumerable:!1,writable:!0,value:c})}:
function(a,b,c,f){!f&&b in a||(a[b]=c)};n=function(a,b,c){for(var d in b)q.hasOwnProperty.call(b,d)&&u(a,d,b[d],c)};var v=function(a){if(null==a)throw new TypeError("can't convert "+a+" to object");return Object(a)};n(f,{bind:function(a){var c=this;if("[object Function]"!==q.toString.call(c))throw new TypeError("Function.prototype.bind called on incompatible "+c);for(var e=b.call(arguments,1),f=Math.max(0,c.length-e.length),g=[],k=0;k<f;k++)g.push("$"+k);var l=Function("binder","return function ("+
g.join(",")+"){ return binder.apply(this, arguments); }")(function(){if(this instanceof l){var d=c.apply(this,e.concat(b.call(arguments)));return Object(d)===d?d:this}return c.apply(a,e.concat(b.call(arguments)))});c.prototype&&(p.prototype=c.prototype,l.prototype=new p,p.prototype=null);return l}});n(Array,{isArray:function(a){return"[object Array]"===m.call(a)}});f=Object("a");var t="a"!==f[0]||!(0 in f);n(k,{forEach:function(a,b){var c=v(this),d=t&&"[object String]"===m.call(this)?this.split(""):
c,e=-1,f=d.length>>>0;if("[object Function]"!==q.toString.call(a))throw new TypeError;for(;++e<f;)e in d&&a.call(b,d[e],e,c)}},!function(a){var b=!0,c=!0;a&&(a.call("foo",function(a,c,d){"object"!==typeof d&&(b=!1)}),a.call([1],function(){c="string"===typeof this},"x"));return!!a&&b&&c}(k.forEach));f=Array.prototype.indexOf&&-1!==[0,1].indexOf(1,2);n(k,{indexOf:function(a){var b=t&&"[object String]"===m.call(this)?this.split(""):v(this),c=b.length>>>0;if(!c)return-1;var e=0;1<arguments.length&&(e=
+arguments[1],e!==e?e=0:0!==e&&e!==1/0&&e!==-(1/0)&&(e=(0<e||-1)*Math.floor(Math.abs(e))));for(e=0<=e?e:Math.max(0,c+e);e<c;e++)if(e in b&&b[e]===a)return e;return-1}},f);var l=a.split;2!=="ab".split(/(?:ab)*/).length||4!==".".split(/(.?)(.?)/).length||"t"==="tesst".split(/(s)*/)[1]||4!=="test".split(/(?:)/,-1).length||"".split(/.?/).length||1<".".split(/()()/).length?function(){var b=void 0===/()??/.exec("")[1];a.split=function(a,c){var d=this;if(void 0===a&&0===c)return[];if("[object RegExp]"!==
m.call(a))return l.call(this,a,c);var e=[],f=(a.ignoreCase?"i":"")+(a.multiline?"m":"")+(a.extended?"x":"")+(a.sticky?"y":""),g=0,h,p;a=new RegExp(a.source,f+"g");d+="";b||(h=new RegExp("^"+a.source+"$(?!\\s)",f));for(c=void 0===c?4294967295:c>>>0;p=a.exec(d);){f=p.index+p[0].length;if(f>g){e.push(d.slice(g,p.index));!b&&1<p.length&&p[0].replace(h,function(){for(var a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(p[a]=void 0)});1<p.length&&p.index<d.length&&k.push.apply(e,p.slice(1));var n=p[0].length;
g=f;if(e.length>=c)break}a.lastIndex===p.index&&a.lastIndex++}g===d.length?!n&&a.test("")||e.push(""):e.push(d.slice(g));return e.length>c?e.slice(0,c):e}}():"0".split(void 0,0).length&&(a.split=function(a,b){return void 0===a&&0===b?[]:l.call(this,a,b)});var g=a.substr;f="".substr&&"b"!=="0b".substr(-1);n(a,{substr:function(a,b){return g.call(this,0>a?0>(a=this.length+a)?0:a:a,b)}},f)},function(n,f,c){var p=c(26),k=/[\x00-\x1f\ud800-\udfff\ufffe\uffff\u0300-\u0333\u033d-\u0346\u034a-\u034c\u0350-\u0352\u0357-\u0358\u035c-\u0362\u0374\u037e\u0387\u0591-\u05af\u05c4\u0610-\u0617\u0653-\u0654\u0657-\u065b\u065d-\u065e\u06df-\u06e2\u06eb-\u06ec\u0730\u0732-\u0733\u0735-\u0736\u073a\u073d\u073f-\u0741\u0743\u0745\u0747\u07eb-\u07f1\u0951\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e38-\u0e39\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u0f72-\u0f76\u0f78\u0f80-\u0f83\u0f93\u0f9d\u0fa2\u0fa7\u0fac\u0fb9\u1939-\u193a\u1a17\u1b6b\u1cda-\u1cdb\u1dc0-\u1dcf\u1dfc\u1dfe\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbe\u1fc9\u1fcb\u1fd3\u1fdb\u1fe3\u1feb\u1fee-\u1fef\u1ff9\u1ffb\u1ffd\u2000-\u2001\u20d0-\u20d1\u20d4-\u20d7\u20e7-\u20e9\u2126\u212a-\u212b\u2329-\u232a\u2adc\u302b-\u302c\uaab2-\uaab3\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa2d\ufa30-\ufa6d\ufa70-\ufad9\ufb1d\ufb1f\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufb4e\ufff0-\uffff]/g,
q,a=function(a){var b,c={},f=[];for(b=0;65536>b;b++)f.push(String.fromCharCode(b));a.lastIndex=0;f.join("").replace(a,function(a){c[a]="\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4);return""});a.lastIndex=0;return c};n.exports={quote:function(b){b=p.stringify(b);k.lastIndex=0;if(!k.test(b))return b;q||(q=a(k));return b.replace(k,function(a){return q[a]})}}},function(n,f,c){(function(f){var k=function(){};"production"!==f.env.NODE_ENV&&(k=c(7)("sockjs-client:utils:transport"));n.exports=function(c){return{filterToEnabled:function(a,
b){var f={main:[],facade:[]};a?"string"===typeof a&&(a=[a]):a=[];c.forEach(function(c){c&&("websocket"===c.transportName&&!1===b.websocket?k("disabled from server","websocket"):a.length&&-1===a.indexOf(c.transportName)?k("not in whitelist",c.transportName):c.enabled(b)?(k("enabled",c.transportName),f.main.push(c),c.facadeTransport&&f.facade.push(c.facadeTransport)):k("disabled",c.transportName))});return f}}}}).call(f,c(6))},function(n,f,c){(function(c){var f={};["log","debug","warn"].forEach(function(k){try{var a=
c.console&&c.console[k]&&c.console[k].apply}catch(b){}f[k]=a?function(){return c.console[k].apply(c.console,arguments)}:"log"===k?function(){}:f.log});n.exports=f}).call(f,c(5))},function(n,f,c){function p(){k.call(this);this.initEvent("close",!1,!1);this.wasClean=!1;this.code=0;this.reason=""}f=c(3);var k=c(83);f(p,k);n.exports=p},function(n,f,c){function p(c){k.call(this);this.initEvent("message",!1,!1);this.data=c}f=c(3);var k=c(83);f(p,k);n.exports=p},function(n,f,c){(function(f){function k(a,
b){e(a);var c=this;p.call(this);setTimeout(function(){c.doXhr(a,b)},0)}var p=c(10).EventEmitter,a=c(3),b=c(18),m=c(80),u=c(59),v=c(49),t=c(262),l=c(263),g=c(136),e=function(){};"production"!==f.env.NODE_ENV&&(e=c(7)("sockjs-client:info-receiver"));a(k,p);k._getReceiver=function(a,b,c){return c.sameOrigin?new g(b,v):u.enabled?new g(b,u):m.enabled&&c.sameScheme?new g(b,m):l.enabled()?new l(a,b):new g(b,t)};k.prototype.doXhr=function(a,c){var d=this,f=b.addPath(a,"/info");e("doXhr",f);this.xo=k._getReceiver(a,
f,c);this.timeoutRef=setTimeout(function(){e("timeout");d._cleanup(!1);d.emit("finish")},k.timeout);this.xo.once("finish",function(a,b){e("finish",a,b);d._cleanup(!0);d.emit("finish",a,b)})};k.prototype._cleanup=function(a){e("_cleanup");clearTimeout(this.timeoutRef);this.timeoutRef=null;!a&&this.xo&&this.xo.close();this.xo=null};k.prototype.close=function(){e("close");this.removeAllListeners();this._cleanup(!1)};k.timeout=8E3;n.exports=k}).call(f,c(6))},function(n,f,c){function p(){var c=this;k.call(this);
this.to=setTimeout(function(){c.emit("finish",200,"{}")},p.timeout)}var k=c(10).EventEmitter;c(3)(p,k);p.prototype.close=function(){clearTimeout(this.to)};p.timeout=2E3;n.exports=p},function(n,f,c){(function(f,k){function p(b,c){var d=this;a.call(this);var e=function(){var a=d.ifr=new v(t.transportName,c,b);a.once("message",function(a){if(a){try{var b=m.parse(a)}catch(D){l("bad json",a);d.emit("finish");d.close();return}d.emit("finish",b[0],b[1])}d.close()});a.once("close",function(){d.emit("finish");
d.close()})};k.document.body?e():u.attachEvent("load",e)}var a=c(10).EventEmitter,b=c(3),m=c(26),u=c(33),v=c(130),t=c(135),l=function(){};"production"!==f.env.NODE_ENV&&(l=c(7)("sockjs-client:info-iframe"));b(p,a);p.enabled=function(){return v.enabled()};p.prototype.close=function(){this.ifr&&this.ifr.close();this.removeAllListeners();this.ifr=null};n.exports=p}).call(f,c(6),c(5))},function(n,f,c){(function(f){var k=c(18),p=c(33),a=c(26),b=c(265),m=c(135),u=c(51),v=c(134),t=function(){};"production"!==
f.env.NODE_ENV&&(t=c(7)("sockjs-client:iframe-bootstrap"));n.exports=function(c,f){var e={};f.forEach(function(a){a.facadeTransport&&(e[a.facadeTransport.transportName]=a.facadeTransport)});e[m.transportName]=m;var d;c.bootstrap_iframe=function(){var f;u.currentWindowId=v.hash.slice(1);p.attachEvent("message",function(g){if(g.source===parent&&("undefined"===typeof d&&(d=g.origin),g.origin===d)){try{var h=a.parse(g.data)}catch(z){t("bad json",g.data);return}if(h.windowId===u.currentWindowId)switch(h.type){case "s":try{var l=
a.parse(h.data)}catch(z){t("bad json",h.data);break}g=l[0];h=l[1];var m=l[2];l=l[3];t(g,h,m,l);if(g!==c.version)throw Error('Incompatible SockJS! Main site uses: "'+g+'", the iframe: "'+c.version+'".');if(!k.isOriginEqual(m,v.href)||!k.isOriginEqual(l,v.href))throw Error("Can't connect to different domain from within an iframe. ("+v.href+", "+m+", "+l+")");f=new b(new e[h](m,l));break;case "m":f._send(h.data);break;case "c":f&&f._close(),f=null}}});u.postMessage("s")}}}).call(f,c(6))},function(n,
f,c){function p(a){this._transport=a;a.on("message",this._transportMessage.bind(this));a.on("close",this._transportClose.bind(this))}var k=c(26),q=c(51);p.prototype._transportClose=function(a,b){q.postMessage("c",k.stringify([a,b]))};p.prototype._transportMessage=function(a){q.postMessage("t",a)};p.prototype._send=function(a){this._transport.send(a)};p.prototype._close=function(){this._transport.close();this._transport.removeAllListeners()};n.exports=p},function(n,f,c){f.a=function(a){a.registerEventListener(document,
"copy",function(b){if(!Object(p.a)(b)){var c=Object(q.c)(a.state).value;b.clipboardData.setData("text/plain",JSON.stringify(c,void 0,"  "));b.preventDefault()}})};f.b=function(a){a.registerEventListener(document,"paste",function(b){if(!Object(p.a)(b)){var c=b.clipboardData.getData("text/plain").match(/^[\[\]{}()\s,]*(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[,\s]+(\d+(?:\.\d+)?)[\[\]{}()\s,]*$/);c=null!==c?k.p.fromValues(parseFloat(c[1]),parseFloat(c[2]),parseFloat(c[3])):void 0;void 0!==c&&a.navigationState.position.setVoxelCoordinates(c);
b.preventDefault()}})};var p=c(137),k=c(1),q=c(32)},function(n,f,c){function p(){if(void 0===m){var a=new b.a;a.set("keyl","recolor");a.set("keyx","clear-segments");a.set("keys","toggle-show-slices");a.set("keyb","toggle-scale-bar");a.set("keya","toggle-axis-lines");for(var c=1;9>=c;++c)a.set("digit"+c,"toggle-layer-"+c);a.set("keyn","add-layer");a.set("keyh","help");a.set("space","toggle-layout");a.set("shift+space","toggle-layout-alternative");m=a}return m}function k(){void 0===u&&(u=b.a.fromObject({arrowleft:"x-",
arrowright:"x+",arrowup:"y-",arrowdown:"y+",comma:"z-",period:"z+",keyz:"snap","control+equal":"zoom-in","control+shift+equal":"zoom-in","control+minus":"zoom-out",keyr:"rotate-relative-z-",keye:"rotate-relative-z+","shift+arrowdown":"rotate-relative-x-","shift+arrowup":"rotate-relative-x+","shift+arrowleft":"rotate-relative-y-","shift+arrowright":"rotate-relative-y+","at:control+wheel":{action:"zoom-via-wheel",preventDefault:!0},"at:wheel":{action:"z+1-via-wheel",preventDefault:!0},"at:shift+wheel":{action:"z+10-via-wheel",
preventDefault:!0},"at:dblclick0":"select","at:control+mousedown0":"annotate","at:mousedown2":"move-to-mouse-position"},{label:"All Data Panels"}));return u}function q(){void 0===v&&(v=b.a.fromObject({"at:mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0},"at:shift+mousedown0":{action:"translate-via-mouse-drag",stopPropagation:!0}},{parents:[[k(),Number.NEGATIVE_INFINITY]]}));return v}function a(){void 0===t&&(t=b.a.fromObject({"at:mousedown0":{action:"translate-via-mouse-drag",stopPropagation:!0},
"at:shift+mousedown0":{action:"rotate-via-mouse-drag",stopPropagation:!0}},{parents:[[k(),Number.NEGATIVE_INFINITY]]}));return t}f.a=function(b){b.global.addParent(p(),Number.NEGATIVE_INFINITY);b.sliceView.addParent(a(),Number.NEGATIVE_INFINITY);b.perspectiveView.addParent(q(),Number.NEGATIVE_INFINITY)};var b=c(17),m,u,v,t},function(n,f,c){f.a=function(b){Object(a.a)();Object(a.b)();try{var c=new k.a(document.getElementById("neuroglancer-container"));return new q.a(c,b)}catch(u){throw p.a.showMessage("Error: "+
u.message),u;}};c(270);var p=c(31),k=c(101),q=c(275),a=c(302);c(269)},function(n,f){},function(n,f,c){c(271);c(272)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}n=c(138);var a=c(11);f=c(21);var b=c(0),m=c(1),u=c(19),v=c(78),t=c(14),l=function C(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return C(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},
g=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),e=function(a){function b(a,c,d,e){p(this,b);var f=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));f.chunkDataSize=c;f.channelStride=c[0]*c[1]*c[2];Object(v.e)(f,a,d,c[0],c[1],c[2]*e);return f}q(b,a);g(b,null,[{key:"get",value:function(a,c,d,e){return a.memoize.get("sliceview.UncompressedTextureLayout:"+
Object(m.q)(c)+","+(d+","+e),function(){return new b(a,c,d,e)})}}]);return b}(b.a),d=function(a){function b(a,c,d,e){p(this,b);a=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,e));a.dataType=c;a.numChannels=d;Object(v.c)(a,c);a.textureAccessHelper=new v.a("chunkData");return a}q(b,a);g(b,[{key:"defineShader",value:function(a){l(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);var c=this.textureAccessHelper;c.defineShader(a);a.addFragmentCode(c.getAccessor("readVolumeData",
"uVolumeChunkSampler",this.dataType));1<this.numChannels?(a.addUniform("highp float","uChannelStride"),a.addFragmentCode("\nfloat getChannelOffset(int channelIndex) {\n  return float(channelIndex) * uChannelStride;\n}\n")):a.addFragmentCode("float getChannelOffset(int channelIndex) { return 0.0; }");a.addFragmentCode("\nfloat getIndexIntoChunk (int channelIndex) {\n  vec3 chunkDataPosition = getPositionWithinChunk();\n  return chunkDataPosition.x + uChunkDataSize.x * (chunkDataPosition.y + uChunkDataSize.y * chunkDataPosition.z) + getChannelOffset(channelIndex);\n}\n");
c=Object(t.a)(this.dataType);a.addFragmentCode("\n"+c+" getDataValue (int channelIndex) {\n  return readVolumeData(getIndexIntoChunk(channelIndex));\n}\n")}},{key:"setupTextureLayout",value:function(a,b,c){1<this.numChannels&&a.uniform1f(b.uniform("uChannelStride"),c.channelStride);this.textureAccessHelper.setupTextureLayout(a,b,c)}},{key:"getTextureLayout",value:function(a,b){return e.get(a,b,this.texelsPerElement,this.numChannels)}},{key:"setTextureData",value:function(a,b,c){Object(v.f)(a,b,this,
c)}}],[{key:"get",value:function(a,c,d){var e="sliceview.UncompressedChunkFormat:"+c+":"+d;return a.memoize.get(e,function(){return new b(a,c,d,e)})}}]);return b}(n.a),h=function(b){function c(){p(this,c);return k(this,(c.__proto__||Object.getPrototypeOf(c)).apply(this,arguments))}q(c,b);g(c,[{key:"setTextureData",value:function(a){var b=this.source,c=b.chunkFormatHandler,d=c.chunkFormat,e;this.textureLayout=this.chunkDataSize===b.spec.chunkDataSize?e=c.textureLayout.addRef():e=d.getTextureLayout(a,
this.chunkDataSize);this.chunkFormat.setTextureData(a,e,this.data)}},{key:"getChannelValueAt",value:function(b,c){var d=this.chunkDataSize;c=b[0]+d[0]*(b[1]+d[1]*(b[2]+d[2]*c));d=this.chunkFormat.dataType;b=this.data;switch(d){case a.a.UINT8:case a.a.FLOAT32:case a.a.UINT16:case a.a.UINT32:return b[c];case a.a.UINT64:return c*=2,new u.a(b[c],b[c+1])}throw Error("Invalid data type: "+d);}}]);return c}(n.b),r=function(a){function b(a,c){p(this,b);var e=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
e.chunkFormat=e.registerDisposer(d.get(a,c.dataType,c.numChannels));e.textureLayout=e.registerDisposer(e.chunkFormat.getTextureLayout(a,c.chunkDataSize));return e}q(b,a);g(b,[{key:"getChunk",value:function(a,b){return new h(a,b)}}]);return b}(b.a);Object(f.c)(function(a,b){return null==b.compressedSegmentationBlockSize?new r(a,b):null})},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}var a=c(273),b=c(274);n=c(138);var m=c(11);f=c(21);var u=c(0),v=c(1),t=c(19),l=c(78),g=c(14),e=function y(a,b,c){null===a&&(a=Function.prototype);
var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return y(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),h=function(a){function b(a,c,d,e){p(this,b);var f=k(this,(b.__proto__||
Object.getPrototypeOf(b)).call(this));f.chunkDataSize=c;f.subchunkSize=d;Object(l.d)(f,a,1,e);a=f.subchunkGridSize=v.p.create();for(e=0;3>e;++e)a[e]=Math.ceil(c[e]/d[e]);return f}q(b,a);d(b,null,[{key:"get",value:function(a,c,d,e){return a.memoize.get("sliceview.CompressedSegmentationTextureLayout:"+Object(v.q)(c)+","+(Object(v.q)(d)+","+e),function(){return new b(a,c,d,e)})}}]);return b}(u.a),r=Object(l.c)(new l.b,m.a.UINT32),B=function(a){function b(a,c,d,e){p(this,b);e=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,
e));e.dataType=a;e.subchunkSize=c;e.numChannels=d;e.textureAccessHelper=new l.a("chunkData");return e}q(b,a);d(b,[{key:"defineShader",value:function(a){e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"defineShader",this).call(this,a);var c=this.textureAccessHelper;c.defineShader(a);var d=function(a){return"compressedSegmentationChunkFormat_"+a};a.addUniform("highp vec3","uSubchunkGridSize");a.addUniform("highp vec3","uSubchunkSize");a.addFragmentCode(g.f);var f=this.dataType,h=Object(g.a)(f);
f===m.a.UINT64&&a.addFragmentCode(g.l);a.addFragmentCode(c.getAccessor(d("readTextureValue"),"uVolumeChunkSampler",m.a.UINT32));a.addFragmentCode(g.o);a.addFragmentCode(g.n);c="\nfloat "+d("getChannelOffset")+"(int channelIndex) {\n  if (channelIndex == 0) {\n    return "+this.numChannels+".0;\n  }\n  vec4 v = "+d("readTextureValue")+"(float(channelIndex)).value;\n  return uintleToFloat(v.xyz);\n}\n"+h+" getDataValue (int channelIndex) {\n  vec3 chunkPosition = getPositionWithinChunk();\n\n  // TODO: maybe premultiply this and store as uniform.\n  vec3 subchunkGridPosition = floor(chunkPosition / uSubchunkSize);\n  float subchunkGridOffset = getFortranOrderIndex(subchunkGridPosition, uSubchunkGridSize);\n\n  float channelOffset = "+
d("getChannelOffset")+"(channelIndex);\n\n  // TODO: Maybe just combine this offset into subchunkGridStrides.\n  float subchunkHeaderOffset = subchunkGridOffset * 2.0 + channelOffset;\n\n  vec4 subchunkHeader0 = "+d("readTextureValue")+"(subchunkHeaderOffset).value;\n  vec4 subchunkHeader1 = "+d("readTextureValue")+"(subchunkHeaderOffset + 1.0).value;\n\n  float outputValueOffset = uintleToFloat(subchunkHeader0.xyz) + channelOffset;\n  float encodingBits = unnormalizeUint8(subchunkHeader0[3]);\n  if (encodingBits > 0.0) {\n    vec3 subchunkPosition = floor(min(chunkPosition - subchunkGridPosition * uSubchunkSize, uSubchunkSize - 1.0));\n    float subchunkOffset = getFortranOrderIndex(subchunkPosition, uSubchunkSize);\n    highp float encodedValueBaseOffset = uintleToFloat(subchunkHeader1.xyz) + channelOffset;\n    highp float encodedValueOffset = floor(encodedValueBaseOffset + subchunkOffset * encodingBits / 32.0);\n    vec4 encodedValue = "+
d("readTextureValue")+"(encodedValueOffset).value;\n    float wordOffset = mod(subchunkOffset * encodingBits, 32.0);\n    // If the value is in the first byte, then 0 <= wordOffset < 8.\n    // We need to mod by 2**encodedBits\n    float wordShifter = pow(2.0, -wordOffset);\n    float encodedValueMod = pow(2.0, encodingBits);\n    float encodedValueShifted;\n    if (wordOffset < 16.0) {\n      encodedValueShifted = dot(unnormalizeUint8(encodedValue.xy), vec2(1.0, 256.0));\n    } else {\n      encodedValueShifted = dot(unnormalizeUint8(encodedValue.zw), vec2(256.0 * 256.0, 256.0 * 256.0 * 256.0));\n    }\n    encodedValueShifted = floor(encodedValueShifted * wordShifter);\n    float decodedValue = mod(encodedValueShifted, encodedValueMod);\n    outputValueOffset += decodedValue * "+
(this.dataType===m.a.UINT64?"2.0":"1.0")+";\n  }\n  "+h+" result;\n";c=f===m.a.UINT64?c+("\n  result.low = "+d("readTextureValue")+"(outputValueOffset).value;\n  result.high = "+d("readTextureValue")+"(outputValueOffset+1.0).value;\n"):c+("\n  result.value = "+d("readTextureValue")+"(outputValueOffset).value;\n");a.addFragmentCode(c+"\n  return result;\n}\n")}},{key:"setupTextureLayout",value:function(a,b,c){a.uniform3fv(b.uniform("uSubchunkGridSize"),c.subchunkGridSize);this.textureAccessHelper.setupTextureLayout(a,
b,c)}},{key:"setTextureData",value:function(a,b,c){Object(l.f)(a,b,r,c)}},{key:"getTextureLayout",value:function(a,b,c){return h.get(a,b,this.subchunkSize,c)}},{key:"beginSource",value:function(a,c){e(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"beginSource",this).call(this,a,c);a.uniform3fv(c.uniform("uSubchunkSize"),this.subchunkSize)}}],[{key:"get",value:function(a,c,d,e){var f="sliceview.CompressedSegmentationChunkFormat:"+c+":"+e,g=f+":"+Object(v.q)(d);return a.memoize.get(g,function(){return new b(c,
d,e,f)})}}]);return b}(n.a),C=function(c){function e(){p(this,e);return k(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}q(e,c);d(e,[{key:"setTextureData",value:function(a){var b=this.data,c=this.chunkFormat,d=this.textureLayout=c.getTextureLayout(a,this.chunkDataSize,b.length);c.setTextureData(a,d,b)}},{key:"getChannelValueAt",value:function(c,d){var e=this.chunkDataSize,f=this.chunkFormat,g=this.data;d=g[d];if(f.dataType===m.a.UINT64){var h=new t.a;Object(b.a)(h,g,d,e,f.subchunkSize,
c);return h}return Object(a.a)(g,d,e,f.subchunkSize,c)}}]);return e}(n.b),D=function(a){function b(a,c){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this)),e=c.dataType;if(e!==m.a.UINT64&&e!==m.a.UINT32)throw Error("Unsupported compressed segmentation data type: "+m.a[e]);d.chunkFormat=d.registerDisposer(B.get(a,c.dataType,c.compressedSegmentationBlockSize,c.numChannels));return d}q(b,a);d(b,[{key:"getChunk",value:function(a,b){return new C(a,b)}}]);return b}(u.a);Object(f.c)(function(a,
b){return null!=b.compressedSegmentationBlockSize?new D(a,b):null})},function(n,f,c){f.a=function(c,f,a,b,m){f=Object(p.a)(c,f,a,b,m,1)+f;return c[f]};var p=c(139)},function(n,f,c){f.a=function(c,f,a,b,m,n){a=Object(p.a)(f,a,b,m,n,2)+a;c.low=f[a];c.high=f[a+1];return c};var p=c(139)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a){var b=new C.a,c=b.element;c.classList.add("neuroglancer-viewer-context-menu");var d=function(a,d){a=b.registerDisposer(new F.a(d,
{label:a}));a.element.classList.add("neuroglancer-viewer-context-menu-limit-widget");c.appendChild(a.element)};d("GPU memory limit",a.chunkQueueManager.capacities.gpuMemory.sizeLimit);d("System memory limit",a.chunkQueueManager.capacities.systemMemory.sizeLimit);d("Concurrent chunk requests",a.chunkQueueManager.capacities.download.itemLimit);d=function(a,d){var e=document.createElement("label");e.textContent=a;a=b.registerDisposer(new B.b(d));e.appendChild(a.element);c.appendChild(e)};d("Show axis lines",
a.showAxisLines);d("Show scale bar",a.showScaleBar);d("Show cross sections in 3-d",a.showPerspectiveSliceViews);return b}c.d(f,"a",function(){return L});n=c(9);var b=c.n(n),m=c(16),u=c(276);n=c(140);var v=c(25),t=c(281),l=c(20),g=c(141),e=c(290),d=c(15),h=c(60),r=c(39),B=c(57),C=c(84),D=c(144),z=c(55);f=c(0);var y=c(12),E=c(17),A=c(45),G=c(4),H=c(32),J=c(44),F=c(300),R=c(87),K=c(13),N=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;
"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(301);c(75);c(30);c(61);var V=function(a){function b(a){p(this,b);var c=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.gl=a;c.worker=new Worker("chunk_worker.bundle.js");c.chunkQueueManager=c.registerDisposer(new m.d(new K.a(c.worker),c.gl,{gpuMemory:new m.a({defaultItemLimit:1E6,defaultSizeLimit:1E9}),systemMemory:new m.a({defaultItemLimit:1E7,defaultSizeLimit:2E9}),
download:new m.a({defaultItemLimit:32,defaultSizeLimit:Number.POSITIVE_INFINITY})}));c.chunkManager=c.registerDisposer(new m.c(c.chunkQueueManager));c.chunkQueueManager.registerDisposer(function(){return c.worker.terminate()});return c}q(b,a);N(b,[{key:"rpc",get:function(){return this.chunkQueueManager.rpc}}]);return b}(f.a);(function(a){function b(){p(this,b);var a=k(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments));a.global=new A.a;return a}q(b,a);return b})(n.b);var T={showHelpButton:!0,
showLayerDialog:!0,showLayerPanel:!0,showLocation:!0,resetStateWhenEmpty:!0},L=function(c){function f(a,c){c=void 0===c?{}:c;p(this,f);var e=k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));e.display=a;e.navigationState=e.registerDisposer(new h.e);e.perspectiveNavigationState=new h.e(new h.g(e.navigationState.position),1);e.mouseState=new l.d;e.layerManager=e.registerDisposer(new l.a);e.showAxisLines=new B.a(!0,!0);e.showScaleBar=new B.a(!0,!0);e.showPerspectiveSliceViews=new B.a(!0,!0);
e.layerSelectedValues=e.registerDisposer(new l.b(e.layerManager,e.mouseState));e.resetInitiated=new G.a;e.state=new H.a;e.visible=!0;var m=c,n=void 0===m.dataContext?new V(a.gl):m.dataContext,q=void 0===m.visibility?new J.b(J.b.VISIBLE):m.visibility,t=void 0===m.inputEventBindings?{global:new A.a,sliceView:new A.a,perspectiveView:new A.a}:m.inputEventBindings,F=void 0===m.element?a.makeCanvasOverlayElement():m.element;m=void 0===m.dataSourceProvider?Object(v.a)({credentialsManager:u.a}):m.dataSourceProvider;
e.registerDisposer(function(){return Object(y.b)(e.element)});e.registerDisposer(n);e.options=Object.assign({},T,c,{dataContext:n,visibility:q,inputEventBindings:t,element:F,dataSourceProvider:m});e.layerSpecification=new d.c(e.dataSourceProvider,e.layerManager,e.chunkManager,e.layerSelectedValues,e.navigationState.voxelSize);e.registerDisposer(a.updateStarted.add(function(){e.onUpdateDisplay()}));e.registerDisposer(a.updateFinished.add(function(){e.onUpdateDisplayFinished()}));c=e.state;c.add("layers",
e.layerSpecification);c.add("navigation",e.navigationState);c.add("showAxisLines",e.showAxisLines);c.add("showScaleBar",e.showScaleBar);c.add("perspectiveOrientation",e.perspectiveNavigationState.pose.orientation);c.add("perspectiveZoom",e.perspectiveNavigationState.zoomFactor);c.add("showSlices",e.showPerspectiveSliceViews);c.add("gpuMemoryLimit",e.dataContext.chunkQueueManager.capacities.gpuMemory.sizeLimit);c.add("systemMemoryLimit",e.dataContext.chunkQueueManager.capacities.systemMemory.sizeLimit);
c.add("concurrentDownloads",e.dataContext.chunkQueueManager.capacities.download.itemLimit);e.registerDisposer(e.navigationState.changed.add(function(){e.handleNavigationStateChanged()}));e.layerManager.initializePosition(e.navigationState.position);e.registerDisposer(e.layerSpecification.voxelCoordinatesSet.add(function(a){e.navigationState.position.setVoxelCoordinates(a)}));n=e.registerCancellable(b()(function(){!e.wasDisposed&&0===e.layerManager.managedLayers.length&&e.options.resetStateWhenEmpty&&
(e.navigationState.reset(),e.perspectiveNavigationState.pose.orientation.reset(),e.perspectiveNavigationState.zoomFactor.reset(),e.resetInitiated.dispatch(),!r.b&&e.options.showLayerDialog&&e.visibility.visible&&new g.a(e.layerSpecification))}));e.layerManager.layersChanged.add(n);n();e.registerDisposer(e.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){e.layerSelectedValues.handleLayerChange()}));e.registerDisposer(e.dataContext.chunkQueueManager.visibleChunksChanged.add(function(){e.visible&&
a.scheduleRedraw()}));e.makeUI();c.add("layout",e.layout);e.registerActionListeners();e.registerEventActionBindings();e.registerDisposer(Object(D.a)(F,e.navigationState.position));return e}q(f,c);N(f,[{key:"makeUI",value:function(){var b=this,c=this.options,d=this.element;d.classList.add("neuroglancer-viewer");d.classList.add("neuroglancer-noselect");d.style.display="flex";d.style.flexDirection="column";if(c.showHelpButton||c.showLocation){var f=document.createElement("div");f.title="Right click for settings";
this.registerDisposer(a(this)).registerParent(f);f.style.display="flex";f.style.flexDirection="row";f.style.alignItems="stretch";if(c.showLocation){var g=this.registerDisposer(new R.c(document.createElement("div"),this.navigationState.voxelSize));f.appendChild(g.element);g=this.registerDisposer(new R.b(this.navigationState.position));f.appendChild(g.element);g=this.registerDisposer(new R.a(document.createElement("div"),this.mouseState,this.navigationState.voxelSize));g.element.style.flex="1";g.element.style.alignSelf=
"center";f.appendChild(g.element)}c.showHelpButton&&(c=document.createElement("div"),c.className="neuroglancer-help-button neuroglancer-button",c.textContent="?",c.title="Help",this.registerEventListener(c,"click",function(){b.showHelpDialog()}),f.appendChild(c));d.appendChild(f)}this.layout=this.registerDisposer(new e.a(this,"4panel"));d.appendChild(this.layout.element);this.display.onResize();f=function(){var a=b.visibility.visible;a!==b.visible&&(d.style.visibility=a?"inherit":"hidden",b.visible=
a)};f();this.registerDisposer(this.visibility.changed.add(f))}},{key:"registerEventActionBindings",value:function(){var a=this.element;this.registerDisposer(new A.b(a,this.inputEventMap));this.registerDisposer(new z.a(a))}},{key:"bindAction",value:function(a,b){this.registerDisposer(Object(E.c)(this.element,a,b))}},{key:"registerActionListeners",value:function(){for(var a=this,b={},c=$jscomp.makeIterator(["recolor","clear-segments"]),d=c.next();!d.done;b={action:b.action},d=c.next())b.action=d.value,
this.bindAction(b.action,function(b){return function(){a.layerManager.invokeAction(b.action)}}(b));b={};c=$jscomp.makeIterator(["select","annotate"]);for(d=c.next();!d.done;b={action$247:b.action$247},d=c.next())b.action$247=d.value,this.bindAction(b.action$247,function(b){return function(){a.mouseState.updateUnconditionally();a.layerManager.invokeAction(b.action$247)}}(b));this.bindAction("help",function(){return a.showHelpDialog()});for(d={i:1};9>=d.i;d={i:d.i},++d.i)this.bindAction("toggle-layer-"+
d.i,function(b){return function(){var c=b.i-1,d=a.layerManager.managedLayers;c<d.length&&(c=d[c],c.setVisible(!c.visible))}}(d));this.bindAction("toggle-axis-lines",function(){return a.showAxisLines.toggle()});this.bindAction("toggle-scale-bar",function(){return a.showScaleBar.toggle()});this.bindAction("toggle-show-slices",function(){return a.showPerspectiveSliceViews.toggle()})}},{key:"showHelpDialog",value:function(){var a=this.inputEventBindings;new t.a([["Global",a.global],["Slice View",a.sliceView],
["Perspective View",a.perspectiveView]])}},{key:"onUpdateDisplay",value:function(){this.visible&&(this.dataContext.chunkQueueManager.chunkUpdateDeadline=null)}},{key:"onUpdateDisplayFinished",value:function(){this.visible&&this.mouseState.updateIfStale()}},{key:"handleNavigationStateChanged",value:function(){if(this.visible){var a=this.dataContext.chunkQueueManager;null===a.chunkUpdateDeadline&&(a.chunkUpdateDeadline=Date.now()+10)}this.mouseState.stale=!0}},{key:"chunkManager",get:function(){return this.dataContext.chunkManager}},
{key:"chunkQueueManager",get:function(){return this.dataContext.chunkQueueManager}},{key:"dataContext",get:function(){return this.options.dataContext}},{key:"visibility",get:function(){return this.options.visibility}},{key:"inputEventBindings",get:function(){return this.options.inputEventBindings}},{key:"inputEventMap",get:function(){return this.inputEventBindings.global}},{key:"element",get:function(){return this.options.element}},{key:"dataSourceProvider",get:function(){return this.options.dataSourceProvider}},
{key:"gl",get:function(){return this.display.gl}}]);return f}(f.a)},function(n,f,c){n=new (c(79).b);f.a=n},function(n,f,c){f.b=function(c,f){return function(k){k.style.flex=c;f(k)}};f.a=function(c,f){return function(k){k.style.display="flex";k.style.flexDirection=c;for(var a=$jscomp.makeIterator(f),b=a.next();!b.done;b=a.next()){b=b.value;var m=k.ownerDocument.createElement("div");k.appendChild(m);b(m)}}}},function(n,f,c){c.d(f,"a",function(){return a});var p=c(2),k=c(4),q=function(){function a(a,
b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),a=function(){function a(b,c,f){f=void 0===f?c:f;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.enumType=b;this.value_=c;this.defaultValue=f;this.changed=new k.a}q(a,[{key:"reset",value:function(){this.value=this.defaultValue}},{key:"restoreState",
value:function(a){this.value=Object(p.n)(a,this.enumType)}},{key:"toJSON",value:function(){return this.enumType[this.value_].toLowerCase()}},{key:"value",set:function(a){this.value_!==a&&(this.value_=a,this.changed.dispatch())},get:function(){return this.value_}}]);return a}()},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&
null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a){a.addFragmentExtension("GL_EXT_draw_buffers");a.addFragmentCode(y)}function a(a){a.addFragmentExtension("GL_EXT_draw_buffers");a.addFragmentCode(E)}function b(a){a.setFragmentMain("\nvec4 v0 = getValue0();\nvec4 v1 = getValue1();\nvec4 accum = vec4(v0.rgb, v1.r);\nfloat revealage = v0.a;\n\ngl_FragColor = vec4(accum.rgb / accum.a, revealage);\n")}
c.d(f,"a",function(){return H});var m=c(97),u=c(20),v=c(99),t=c(43);n=c(100);var l=c(46),g=c(57),e=c(17),d=c(1),h=c(104),r=c(67),B=c(14),C=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),D=function F(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),
null!==a)return F(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(30);c(280);var z;(function(a){a[a.COLOR=0]="COLOR";a[a.Z=1]="Z";a[a.PICK=2]="PICK";a[a.NUM_TEXTURES=3]="NUM_TEXTURES"})(z||(z={}));var y=[B.i,"\nvoid emit(vec4 color, vec4 pickId) {\n  gl_FragData["+z.COLOR+"] = color;\n  gl_FragData["+z.Z+"] = packFloat01ToFixedPoint(1.0 - gl_FragCoord.z);\n  gl_FragData["+z.PICK+"] = pickId;\n}\n"],E=["\nfloat computeOITWeight(float alpha) {\n  float a = min(1.0, alpha) * 8.0 + 0.01;\n  float b = -gl_FragCoord.z * 0.95 + 1.0;\n  return a * a * a * b * b * b;\n}\n",
"\nvoid emit(vec4 color, vec4 pickId) {\n  float weight = computeOITWeight(color.a);\n  vec4 accum = color * weight;\n  gl_FragData[0] = vec4(accum.rgb, color.a);\n  gl_FragData[1] = vec4(accum.a, 0.0, 0.0, 0.0);\n}\n"],A=d.p.create(),G=d.j.create(),H=function(c){function f(a,c,k){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var n=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this,a,c,k));n.visibleLayerTracker=Object(u.i)(n.viewer.layerManager,t.a,n);n.sliceViews=
new Set;n.projectionMat=d.j.create();n.inverseProjectionMat=d.j.create();n.modelViewMat=d.j.create();n.width=0;n.height=0;n.pickIDs=new v.a;n.axesLineHelper=n.registerDisposer(m.a.get(n.gl));n.sliceViewRenderHelper=n.registerDisposer(l.d.get(n.gl,q));n.offscreenFramebuffer=n.registerDisposer(new r.b(n.gl,{colorBuffers:Object(r.e)(n.gl,z.NUM_TEXTURES),depthBuffer:new r.a(n.gl)}));n.offscreenCopyHelper=n.registerDisposer(r.c.get(n.gl));n.transparencyCopyHelper=n.registerDisposer(r.c.get(n.gl,b,2));
n.registerDisposer(n.navigationState.changed.add(function(){n.viewportChanged()}));Object(e.c)(c,"translate-via-mouse-drag",function(a){Object(h.a)(a.detail,function(a,b,c){a=n.width;var e=n.height,f=n.viewer.navigationState.position,g=f.spatialCoordinates;d.p.transformMat4(A,g,n.projectionMat);A[0]=2*b/a;A[1]=-2*c/e;d.p.transformMat4(g,A,n.inverseProjectionMat);f.changed.dispatch()})});Object(e.c)(c,"rotate-via-mouse-drag",function(a){Object(h.a)(a.detail,function(a,b,c){n.navigationState.pose.rotateRelative(d.e[1],
-b/4*Math.PI/180);n.navigationState.pose.rotateRelative(d.e[0],c/4*Math.PI/180);n.viewer.navigationState.changed.dispatch()})});k.showSliceViewsCheckbox&&(a=n.registerDisposer(new g.b(k.showSliceViews)),a.element.className="perspective-panel-show-slice-views neuroglancer-noselect",c=document.createElement("label"),c.className="perspective-panel-show-slice-views neuroglancer-noselect",c.appendChild(document.createTextNode("Slices")),c.appendChild(a.element),n.element.appendChild(c));n.registerDisposer(k.showSliceViews.changed.add(function(){n.scheduleRedraw()}));
n.registerDisposer(k.showAxisLines.changed.add(function(){n.scheduleRedraw()}));return n}k(f,c);C(f,[{key:"updateProjectionMatrix",value:function(){var a=this.projectionMat;d.j.perspective(a,Math.PI/4,this.width/this.height,10,5E3);var b=this.modelViewMat;this.navigationState.toMat4(b);d.p.set(A,1,-1,-1);d.j.scale(b,b,A);var c=d.p.set(A,0,0,100);d.j.translate(b,b,c);d.j.invert(G,b);d.j.multiply(a,a,G);d.j.invert(this.inverseProjectionMat,a)}},{key:"viewportChanged",value:function(){this.context.scheduleRedraw()}},
{key:"onResize",value:function(){var a=this.element,b=a.clientHeight;if(a.clientWidth!==this.width||b!==this.height)this.width=this.element.clientWidth,this.height=this.element.clientHeight,this.viewportChanged()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.sliceViews),b=a.next();!b.done;b=a.next())b.value.dispose();this.sliceViews.clear();D(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"updateMouseState",value:function(a){a.pickedRenderLayer=
null;if(!this.navigationState.valid)return!1;var b=a.position,c=this.offscreenFramebuffer,e=this.width,f=this.height;if(!c.hasSize(e,f))return!1;var g=this.mouseX,h=f-this.mouseY,k=c.readPixel(z.Z,g,h);k=1-Object(B.q)(k);if(1===k)return!1;b[0]=2*g/e-1;b[1]=2*h/f-1;b[2]=2*k-1;d.p.transformMat4(b,b,this.inverseProjectionMat);this.pickIDs.setMouseState(a,c.readPixelAsUint32(z.PICK,g,h));return!0}},{key:"draw",value:function(){if(this.navigationState.valid){this.onResize();var b=this.width,c=this.height;
if(0!==b&&0!==c){if(this.viewer.showSliceViews.value)for(var e=$jscomp.makeIterator(this.sliceViews),f=e.next();!f.done;f=e.next())f.value.updateRendering();e=this.gl;this.offscreenFramebuffer.bind(b,c);e.disable(e.SCISSOR_TEST);this.gl.clearColor(0,0,0,0);e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT);e.enable(e.DEPTH_TEST);f=this.projectionMat;this.updateProjectionMatrix();var g=d.p.create();Object(d.n)(g,d.e[2],this.modelViewMat);d.p.normalize(g,g);var h=this.pickIDs;h.clear();f={dataToDevice:f,
lightDirection:g,ambientLighting:.2,directionalLighting:.8,pickIDs:h,emitter:q,emitColor:!0,emitPickID:!0,alreadyEmittedPickID:!1,viewportWidth:b,viewportHeight:c};g=this.visibleLayerTracker.getVisibleLayers();var k=!1,l=$jscomp.makeIterator(g);for(h=l.next();!h.done;h=l.next())h=h.value,h.isTransparent?k=!0:h.draw(f);this.viewer.showSliceViews.value&&this.drawSliceViews(f);this.viewer.showAxisLines.value&&this.drawAxisLines();if(k){e.depthMask(!1);e.enable(e.BLEND);k=this.transparentConfiguration;
k.bind(b,c);this.gl.clearColor(0,0,0,1);e.clear(e.COLOR_BUFFER_BIT);f.emitter=a;e.blendFuncSeparate(e.ONE,e.ONE,e.ZERO,e.ONE_MINUS_SRC_ALPHA);f.emitPickID=!1;l=$jscomp.makeIterator(g);for(h=l.next();!h.done;h=l.next())h=h.value,h.isTransparent&&h.draw(f);e.disable(e.DEPTH_TEST);this.offscreenFramebuffer.bindSingle(z.COLOR);e.blendFunc(e.ONE_MINUS_SRC_ALPHA,e.SRC_ALPHA);this.transparencyCopyHelper.draw(k.colorBuffers[0].texture,k.colorBuffers[1].texture);e.depthMask(!0);e.disable(e.BLEND);e.enable(e.DEPTH_TEST);
this.offscreenFramebuffer.bind(b,c)}e.WEBGL_draw_buffers.drawBuffersWEBGL([e.NONE,e.WEBGL_draw_buffers.COLOR_ATTACHMENT1_WEBGL,e.WEBGL_draw_buffers.COLOR_ATTACHMENT2_WEBGL]);f.emitter=q;f.emitPickID=!0;f.emitColor=!1;b=$jscomp.makeIterator(g);for(h=b.next();!h.done;h=b.next())c=h.value,f.alreadyEmittedPickID=!c.isTransparent,c.draw(f);e.disable(e.DEPTH_TEST);this.offscreenFramebuffer.unbind();this.setGLViewport();this.offscreenCopyHelper.draw(this.offscreenFramebuffer.colorBuffers[z.COLOR].texture)}}}},
{key:"drawSliceViews",value:function(a){var b=this.sliceViewRenderHelper,c=a.lightDirection,e=a.ambientLighting,f=a.directionalLighting;a=a.dataToDevice;for(var g=$jscomp.makeIterator(this.sliceViews),h=g.next();!h.done;h=g.next())if(h=h.value,0!==h.width&&0!==h.height){var k=Math.abs(d.p.dot(c,h.viewportAxes[2]));k=e+k*f;var l=G;d.j.identity(l);l[0]=h.width/2;l[5]=-h.height/2;d.j.multiply(l,h.viewportToData,l);d.j.multiply(l,a,l);b.draw(h.offscreenFramebuffer.colorBuffers[0].texture,l,d.r.fromValues(k,
k,k,1),d.r.fromValues(.5,.5,.5,1),0,0,1,1)}}},{key:"drawAxisLines",value:function(){var a=this.gl;d.j.identity(G);G[0]=1600;G[5]=1600;G[10]=1600;var b=this.navigationState.position.spatialCoordinates;G[12]=b[0];G[13]=b[1];G[14]=b[2];G[15]=1;d.j.multiply(G,this.projectionMat,G);a.WEBGL_draw_buffers.drawBuffersWEBGL([a.WEBGL_draw_buffers.COLOR_ATTACHMENT0_WEBGL]);this.axesLineHelper.draw(G,!1)}},{key:"zoomByMouse",value:function(a){this.navigationState.zoomBy(a)}},{key:"navigationState",get:function(){return this.viewer.navigationState}},
{key:"transparentConfiguration",get:function(){var a=this.transparentConfiguration_;void 0===a&&(a=this.transparentConfiguration_=this.registerDisposer(new r.b(this.gl,{colorBuffers:Object(r.e)(this.gl,2,this.gl.RGBA,this.gl.FLOAT)})));return a}}]);return f}(n.a)},function(n,f){},function(n,f,c){function p(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function k(a,c){if("function"!==typeof c&&
null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}function q(a){return a.startsWith("key")?a.substring(3):a.startsWith("digit")||a.startsWith("arrow")?a.substring(5):a}c.d(f,"a",function(){return a});n=c(39);c(282);var a=function(a){function b(a){function c(a,b){for(var d=$jscomp.makeIterator(a.parents),
e=d.next();!e.done;e=d.next())e=e.value,void 0!==e.label?f(e.label,e):c(e,b);a=$jscomp.makeIterator(a.bindings.entries());for(d=a.next();!d.done;d=a.next()){e=$jscomp.makeIterator(d.value);d=e.next().value;e=e.next().value;var g=d.indexOf(":");d=d.substring(g+1);b.set(d,e.action)}}function f(a,b){d.has(b)||(a={label:a,entries:new Map},c(b,a.entries),d.set(b,a))}if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var k=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this)),
g=k.content;g.classList.add("describe-key-bindings");var e=document.createElement("div");e.classList.add("describe-key-bindings-container");var d=new Map;a=$jscomp.makeIterator(a);for(var h=a.next();!h.done;h=a.next()){var m=$jscomp.makeIterator(h.value);h=m.next().value;m=m.next().value;f(h,m)}a=$jscomp.makeIterator(d.values());for(h=a.next();!h.done;h=a.next()){m=h.value;h=document.createElement("h2");h.textContent=m.label;e.appendChild(h);h=document.createElement("div");h.className="dl";m=$jscomp.makeIterator(m.entries);
for(var n=m.next();!n.done;n=m.next()){var u=$jscomp.makeIterator(n.value);n=u.next().value;u=u.next().value;var D=document.createElement("div"),z=document.createElement("div");z.className="definition-outer-container";D.className="definition-container";var y=document.createElement("div");y.className="dt";y.textContent=n.split("+").map(q).join("+");n=document.createElement("div");n.className="dd";n.textContent=u;D.appendChild(y);D.appendChild(n);h.appendChild(z);z.appendChild(D)}e.appendChild(h)}g.appendChild(e);
return k}k(b,a);return b}(n.a)},function(n,f){},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
Object.setPrototypeOf(a,b):a.__proto__=b)}function q(a){var b=document.createElement("div");b.textContent=a.value;return b}f.b=function(a){var b=document.createElement("div");b.className="autocomplete-completion-with-description";b.textContent=a.value;var c=document.createElement("div");c.className="autocomplete-completion-description";c.textContent=a.description||"";b.appendChild(c);return b};c.d(f,"a",function(){return C});n=c(9);var a=c.n(n),b=c(27);n=c(0);var m=c(12),u=c(284),v=c(45),t=c(285),
l=c(286),g=c(4),e=c(142),d=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),h=function z(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return z(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:
b.call(c)}};c(287);$jscomp.initSymbol();var r=Symbol("autocompleteIndex"),B=v.a.fromObject({arrowdown:{action:"cycle-next-active-completion"},arrowup:{action:"cycle-prev-active-completion"},tab:{action:"choose-active-completion-or-prefix",preventDefault:!1},enter:{action:"choose-active-completion",preventDefault:!1},escape:{action:"cancel",preventDefault:!1,stopPropagation:!1}}),C=function(c){function f(c){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var d=p(this,
(f.__proto__||Object.getPrototypeOf(f)).call(this));d.inputChanged=new g.b;d.prevInputValue="";d.completionsVisible=!1;d.activeCompletionPromise=null;d.activeCompletionCancellationToken=void 0;d.hasFocus=!1;d.completionResult=null;d.dropdownContentsStale=!0;d.updateHintScrollPositionTimer=null;d.completionElements=null;d.hasResultForDropdown=!1;d.commonPrefix="";d.activeIndex=-1;d.dropdownStyleStale=!0;d.completer=c.completer;c=void 0===c.delay?200:c.delay;var h=d.scheduleUpdateCompletions=a()(function(){var a=
d.activeCompletionCancellationToken=new b.b,c=d.activeCompletionPromise=d.completer(d.value,a);null!==c&&c.then(function(a){d.activeCompletionPromise===c&&(d.setCompletions(a),d.activeCompletionPromise=null)})},c);d.registerDisposer(function(){h.cancel()});c=d.element=document.createElement("div");c.className="autocomplete";var k=document.createElement("div");k.className="autocomplete-dropdown-wrapper";var l=d.dropdownElement=document.createElement("div");l.className="autocomplete-dropdown";var m=
d.promptElement=document.createElement("label");m.className="autocomplete-prompt";var n=d.inputWrapperElement=document.createElement("div");n.className="autocomplete-input-wrapper";c.appendChild(m);var q=d.inputElement=document.createElement("input");q.type="text";q.autocomplete="off";q.spellcheck=!1;q.className="autocomplete-input";Object(e.a)(m,q);m=d.hintElement=document.createElement("input");m.type="text";m.spellcheck=!1;m.className="autocomplete-hint";m.disabled=!0;n.appendChild(m);n.appendChild(q);
k.appendChild(n);k.appendChild(l);c.appendChild(k);d.registerInputHandler();d.handleInputChanged("");d.registerEventListener(d.inputElement,"focus",function(){d.hasFocus||(d.hasFocus=!0,d.dropdownStyleStale=!0,d.updateDropdown())});d.registerEventListener(d.inputElement,"blur",function(){d.hasFocus&&(d.hasFocus=!1,d.updateDropdown())});d.registerEventListener(c.ownerDocument.defaultView,"resize",function(){d.dropdownStyleStale=!0});d.registerEventListener(c.ownerDocument.defaultView,"scroll",function(){d.dropdownStyleStale=
!0});d.registerEventListener(d.dropdownElement,"mousedown",d.handleDropdownMousedown.bind(d));d.registerEventListener(d.inputElement,"keydown",function(){d.hintScrollPositionMayBeStale()});d.registerEventListener(d.inputElement,"mousemove",function(a){0!==a.buttons&&d.hintScrollPositionMayBeStale()});d.registerDisposer(new v.b(q,B)).allShortcutsAreGlobal=!0;Object(v.c)(q,"cycle-next-active-completion",function(){d.cycleActiveCompletion(1)});Object(v.c)(q,"cycle-prev-active-completion",function(){d.cycleActiveCompletion(-1)});
Object(v.c)(q,"choose-active-completion-or-prefix",function(a){d.selectActiveCompletion(!0)&&a.preventDefault()});Object(v.c)(q,"choose-active-completion",function(a){d.selectActiveCompletion(!1)&&a.preventDefault()});Object(v.c)(q,"cancel",function(a){a.stopPropagation();d.cancel()&&(a.detail.preventDefault(),a.detail.stopPropagation())});return d}k(f,c);d(f,[{key:"hintScrollPositionMayBeStale",value:function(){""!==this.hintElement.value&&this.scheduleUpdateHintScrollPosition()}},{key:"handleDropdownMousedown",
value:function(a){this.inputElement.focus();for(var b=this.dropdownElement,c=a.target;c instanceof HTMLElement;c=c.parentElement){var d=c[r];if(void 0!==d){this.selectCompletion(d);break}if(c===b)break}a.preventDefault()}},{key:"cycleActiveCompletion",value:function(a){if(null!==this.completionResult){var b=this.activeIndex,c=this.completionResult.completions.length;this.setActiveIndex(-1===b?0<a?0:c-1:(b+a+c)%c)}}},{key:"registerInputHandler",value:function(){for(var a=this,b=function(b){b=a.inputElement.value;
b!==a.prevInputValue&&(a.prevInputValue=b,a.handleInputChanged(b))},c=$jscomp.makeIterator(["input"]),d=c.next();!d.done;d=c.next())this.registerEventListener(this.inputElement,d.value,b,!1)}},{key:"shouldShowDropdown",value:function(){return null!==this.completionResult&&this.hasFocus?this.hasResultForDropdown:!1}},{key:"updateDropdownStyle",value:function(){Object(u.a)(this.dropdownElement,this.inputElement,{horizontal:!1});this.dropdownStyleStale=!1}},{key:"updateDropdown",value:function(){if(this.shouldShowDropdown()){var a=
this.dropdownElement,b=this.activeIndex;if(this.dropdownContentsStale){var c=this.completionResult,d=void 0===c.makeElement?q:c.makeElement;this.completionElements=c.completions.map(function(e,f){e=d.call(c,e);e[r]=f;e.classList.add("autocomplete-completion");b===f&&e.classList.add("autocomplete-completion-active");a.appendChild(e);return e});this.dropdownContentsStale=!1}this.dropdownStyleStale&&this.updateDropdownStyle();this.completionsVisible||(a.style.display="block",this.completionsVisible=
!0);-1!==b&&Object(l.a)(this.completionElements[b])}else this.completionsVisible&&(this.dropdownElement.style.display="none",this.completionsVisible=!1)}},{key:"setCompletions",value:function(a){this.clearCompletions();var b=a.completions;0!==b.length&&(this.completionResult=a,1===b.length?(b=b[0],a.showSingleResult?this.hasResultForDropdown=!0:b.value.startsWith(this.prevInputValue)?this.hasResultForDropdown=!1:this.hasResultForDropdown=!0,a.selectSingleResult?this.setActiveIndex(0):this.setHintValue(this.getCompletedValueByIndex(0))):
(this.hasResultForDropdown=!0,b=Object(t.a)(function(){function b(b,g){for(;;)switch(c){case 0:f=$jscomp.makeIterator(a.completions),e=f.next();case 1:if(e.done){c=3;break}d=e.value;c=4;return{value:d.value,done:!1};case 4:if(void 0===g){c=5;break}c=-1;throw g;case 5:case 2:e=f.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,e,f,g={next:function(a){return b(a,void 0)},throw:function(a){return b(void 0,a)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();
g[Symbol.iterator]=function(){return this};return g}()),b=this.getCompletedValue(b),b.startsWith(this.prevInputValue)&&(this.commonPrefix=b,this.setHintValue(b))),this.updateDropdown())}},{key:"scheduleUpdateHintScrollPosition",value:function(){var a=this;null===this.updateHintScrollPositionTimer&&(this.updateHintScrollPositionTimer=setTimeout(function(){a.updateHintScrollPosition()},0))}},{key:"setHintValue",value:function(a){var b=this.prevInputValue;a!==b&&a.startsWith(b)||(a="");this.hintElement.value=
a;this.scheduleUpdateHintScrollPosition()}},{key:"setActiveIndex",value:function(a){if(!this.dropdownContentsStale){var b=this.activeIndex;-1!==b&&this.completionElements[b].classList.remove("autocomplete-completion-active");-1!==a&&(b=this.completionElements[a],b.classList.add("autocomplete-completion-active"),Object(l.a)(b))}-1!==a&&this.setHintValue(this.getCompletedValueByIndex(a));this.activeIndex=a}},{key:"getCompletedValueByIndex",value:function(a){return this.getCompletedValue(this.completionResult.completions[a].value)}},
{key:"getCompletedValue",value:function(a){return this.prevInputValue.substring(0,this.completionResult.offset)+a}},{key:"selectActiveCompletion",value:function(a){var b=this.activeIndex;if(-1===b){if(!a)return!1;a=this.completionResult;if(null!==a&&1===a.completions.length)b=0;else return a=this.commonPrefix,a.length>this.value.length?(this.value=a,!0):!1}a=this.getCompletedValueByIndex(b);if(this.value===a)return!1;this.value=a;return!0}},{key:"selectCompletion",value:function(a){this.value=this.getCompletedValueByIndex(a)}},
{key:"cancel",value:function(){return!1}},{key:"updateHintScrollPosition",value:function(){this.updateHintScrollPositionTimer=null;this.hintElement.scrollLeft=this.inputElement.scrollLeft}},{key:"cancelActiveCompletion",value:function(){var a=this.activeCompletionCancellationToken;void 0!==a&&a.cancel();this.activeCompletionCancellationToken=void 0;this.activeCompletionPromise=null}},{key:"handleInputChanged",value:function(a){this.cancelActiveCompletion();this.hintElement.value="";this.clearCompletions();
this.inputChanged.dispatch(a);this.scheduleUpdateCompletions()}},{key:"clearCompletions",value:function(){null!==this.completionResult&&(this.activeIndex=-1,this.completionElements=this.completionResult=null,this.dropdownStyleStale=this.dropdownContentsStale=!0,this.commonPrefix="",Object(m.a)(this.dropdownElement),this.updateDropdown())}},{key:"disposed",value:function(){Object(m.b)(this.element);this.cancelActiveCompletion();null!==this.updateHintScrollPositionTimer&&(clearTimeout(this.updateHintScrollPositionTimer),
this.updateHintScrollPositionTimer=null);h(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"disabled",get:function(){return this.inputElement.disabled},set:function(a){this.inputElement.disabled=a}},{key:"value",get:function(){return this.prevInputValue},set:function(a){a!==this.prevInputValue&&(this.prevInputValue=this.inputElement.value=a,this.handleInputChanged(a))}}]);return f}(n.a)},function(n,f,c){f.a=function(c,f,n){var a=void 0===n?{}:n,b=void 0===
a.horizontal?!1:a.horizontal,k=void 0===a.vertical?!0:a.vertical,p=void 0===a.topMargin?6:a.topMargin,q=void 0===a.bottomMargin?6:a.bottomMargin,t=void 0===a.leftMargin?6:a.leftMargin,l=void 0===a.rightMargin?6:a.rightMargin;n=void 0===a.maxHeight?!0:a.maxHeight;a=void 0===a.maxWidth?!0:a.maxWidth;f=f.getBoundingClientRect();if(b){b=f.right;var g=c.ownerDocument.documentElement.clientHeight-f.left;b>g?(c.style.left="",c.style.right="0",a&&(c.style.maxWidth=b-t+"px")):(c.style.right="",c.style.left=
"0",a&&(c.style.maxWidth=g-l+"px"))}k&&(k=f.top-p,q=c.ownerDocument.documentElement.clientHeight-f.bottom-q,k>3*q?(c.style.top="",c.style.bottom="100%",n&&(c.style.maxHeight=k+"px")):(c.style.top="100%",c.style.bottom="",n&&(c.style.maxHeight=q+"px")))}},function(n,f,c){f.a=function(c){$jscomp.initSymbol();$jscomp.initSymbolIterator();c=c[Symbol.iterator]();var f=c.next(),n=f.value;if(f.done)return"";for(f=n.length;0<f;){var a=c.next(),b=a.value;if(a.done)break;for(a=0;a<f&&n.charCodeAt(a)===b.charCodeAt(a);++a);
f=a}return n.substring(0,f)}},function(n,f,c){f.a=function(c){var f=c.parentElement,n=c.offsetLeft-f.clientLeft,a=c.offsetTop-f.clientTop,b=f.scrollLeft,m=f.scrollTop;a=Math.max(0,a+c.offsetHeight-(m+f.clientHeight))||Math.min(0,a-m);f.scrollLeft+=Math.max(0,n+c.offsetWidth-(b+f.clientWidth))||Math.min(0,n-b);f.scrollTop+=a}},function(n,f){},function(n,f,c){f.a=function(){var c=document.createElement("button");c.type="submit";c.className="hidden-submit-button";c.style.margin="0";c.style.border="0";
c.style.padding="0";c.style.width="0";c.style.height="0";c.style.overflow="hidden";c.tabIndex=-1;return c}},function(n,f){},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+
typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b,c){var d=Object(l.c)(a,"dragenter",function(b){void 0!==Object(t.c)(b)&&a.classList.add("neuroglancer-drag-over")}),f=Object(l.c)(a,"dragleave",function(){a.classList.remove("neuroglancer-drag-over")}),g=Object(l.c)(a,"dragover",function(a){Object(u.c)(a)?(Object(e.e)(a,Object(u.b)(a,b)),a.stopPropagation(),
a.preventDefault()):void 0!==Object(t.c)(a)&&(Object(t.f)(a,b,!0),a.stopPropagation(),a.preventDefault())}),h=Object(l.c)(a,"drop",function(d){a.classList.remove("neuroglancer-drag-over");if(Object(u.c)(d)){d.stopPropagation();try{var f=JSON.parse(d.dataTransfer.getData(u.d))}catch(S){return}var g=Object(t.b)(d,b,!1,!1,!0);if(void 0!==g&&g.finalize(d)){d.preventDefault();d.dataTransfer.dropEffect=Object(e.c)();Object(t.a)(d);var h=c();g=$jscomp.makeIterator(g.layers.keys());for(d=g.next();!d.done;d=
g.next())h.layerSpecification.add(d.value);try{h.restoreState(f)}catch(S){}}}else if(h=Object(t.b)(d,b,"copy"===Object(e.c)(),!1,!0),void 0!==h&&h.finalize(d))for(d.preventDefault(),d.dataTransfer.dropEffect=Object(e.c)(),Object(t.a)(d),f=c(),h=$jscomp.makeIterator(h.layers.keys()),d=h.next();!d.done;d=h.next())f.layerSpecification.add(d.value)});return function(){h();g();f();d()}}function b(a,b){var c=document.createElement("div");c.style.flex="1";c.style.width="0px";if("string"===typeof b){if(void 0!==
a.parent)throw Error("Invalid layout component specification: "+JSON.stringify(b));return new z(c,b,a.viewer)}Object(d.u)(b);var e=Object(d.w)(b,"type",d.B);switch(e){case "row":case "column":return new y(c,e,Object(d.w)(b,"children",function(b){b=Object(d.a)(b,function(a){return a});if(void 0===a.parent&&0===b.length)throw Error("Stack layout requires at least one child.");return b}),a);case "viewer":e=a.viewer;var f=new v.a(e.layerSpecification.addRef());c=new u.a(c,{display:e.display,navigationState:e.navigationState.addRef(),
perspectiveNavigationState:e.perspectiveNavigationState.addRef(),mouseState:e.mouseState,showAxisLines:e.showAxisLines,showScaleBar:e.showScaleBar,showPerspectiveSliceViews:e.showPerspectiveSliceViews,layerSpecification:f,inputEventBindings:e.inputEventBindings,visibility:e.visibility},{showLayerPanel:e.options.showLayerPanel,showViewerMenu:!0});try{c.restoreState(b)}catch(R){throw c.dispose(),R;}return c}throw Error("Invalid layout component specification: "+JSON.stringify(b));}c.d(f,"a",function(){return E});
n=c(9);var m=c.n(n),u=c(291),v=c(15),t=c(85),l=c(0),g=c(12),e=c(86),d=c(2),h=c(4),r=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),B=function G(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return G(a,b,c)}else{if("value"in
d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(299);$jscomp.initSymbol();var C=Symbol("layoutComponentContainer"),D=function(c){function d(b,c,e){p(this,d);var f=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));f.viewer=b;f.parent=e;f.changed=new h.a;f.element=document.createElement("div");var g=f.element;g.style.display="flex";g.style.flex="1";g.style.position="relative";g.style.alignItems="stretch";g.foo="hello";g[C]=f;f.setSpecification(c);var l=[];b=function(b){var c=
document.createElement("div");c.className="neuroglancer-layout-split-drop-zone";c.style[b]="0";switch(b){case "left":case "right":var d="row";c.style.width="10px";c.style.height="100%";break;case "top":case "bottom":d="column",c.style.height="10px",c.style.width="100%"}c.style.display="none";l.push({element:c,direction:d,orientation:b});g.appendChild(c);f.registerDisposer(a(c,f.viewer.layerSpecification,function(){return f.split(b).newContainer.component}))};b("left");b("right");b("top");b("bottom");
var m=!1;f.registerEventListener(g,"dragenter",function(a){if(!m&&void 0!==Object(t.c)(a)){m=!0;a=$jscomp.makeIterator(l);for(var b=a.next();!b.done;b=a.next()){var c=b.value;b=c.element;var d=c.direction;c=c.orientation;if(void 0===e||d!==e.direction||("left"!==c&&"top"!==c||e.get(0)===f)&&("bottom"!==c&&"right"!==c||e.get(e.length-1)===f))c=f.component,c instanceof y&&c.direction===d||(b.style.display="block")}}},!0);f.registerEventListener(g,"drop",function(a){if(m){m=!1;a=$jscomp.makeIterator(l);
for(var b=a.next();!b.done;b=a.next())b.value.element.style.display="none"}});f.registerEventListener(g,"dragleave",function(a){a=a.relatedTarget;if(m&&!(a instanceof HTMLElement&&f.element.contains(a))){m=!1;a=$jscomp.makeIterator(l);for(var b=a.next();!b.done;b=a.next())b.value.element.style.display="none"}},!0);return f}q(d,c);r(d,[{key:"unsetComponent",value:function(){var a=this.componentValue;void 0!==a&&(a.changed.remove(this.changed.dispatch),this.element.removeChild(a.element),a.dispose())}},
{key:"setComponent",value:function(a){var b=this;this.unsetComponent();this.componentValue=a;a.changed.add(this.changed.dispatch);this.element.appendChild(a.element);if(a instanceof u.a){var c=a.layerManager,d=a.registerCancellable(m()(function(){0===c.managedLayers.length&&b.dispose()},0));a.registerDisposer(c.layersChanged.add(function(){0===c.managedLayers.length&&d()}));d()}else if(a instanceof y){var e=a.registerCancellable(m()(function(){var c=a.length;if(0===c&&void 0!==b.parent)b.dispose();
else if(1===c){c=a.get(0).component;if(void 0===b.parent&&c instanceof u.a){var d=c.layout.name;c.viewerNavigationState.copyToParent();var e=new Set(c.layerManager.managedLayers),f=c.layerSpecification;f.rootLayers.filter(function(a){return e.has(a)});f.rootLayers.managedLayers=Array.from(c.layerManager.managedLayers);f.rootLayers.layersChanged.dispatch()}else d=c.toJSON();b.setSpecification(d)}},0));a.registerDisposer(a.changed.add(function(){2>a.length&&e()}));e()}}},{key:"toJSON",value:function(){return this.component.toJSON()}},
{key:"setSpecification",value:function(a){this.setComponent(b(this,a))}},{key:"disposed",value:function(){this.unsetComponent();this.componentValue=void 0;B(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"split",value:function(a){var b={type:"viewer"},c=this.parent;if(void 0!==c){if("left"===a&&"row"===c.direction||"top"===a&&"column"===c.direction)return{newContainer:c.insertChild(b,this),existingContainer:this};if("right"===a&&"row"===c.direction||"bottom"===
a&&"column"===c.direction)return{newContainer:c.insertChild(b),existingContainer:this}}c=this.component;c=c instanceof z?c.layerGroupViewer.toJSON():c.toJSON();var d="left"===a||"right"===a?"row":"column";switch(a){case "left":case "top":var e={type:d,children:[b,c]};var f=0;break;case "right":case "bottom":e={type:d,children:[c,b]},f=1}this.setSpecification(e);a=this.component;return{newContainer:a.get(f),existingContainer:a.get(1-f)}}},{key:"component",get:function(){return this.componentValue}}],
[{key:"getFromElement",value:function(a){return a[C]}}]);return d}(l.a),z=function(a){function b(a,c,d){p(this,b);var e=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));e.element=a;e.layerGroupViewer=e.registerDisposer(new u.a(a,{display:d.display,navigationState:d.navigationState.addRef(),perspectiveNavigationState:d.perspectiveNavigationState.addRef(),mouseState:d.mouseState,showAxisLines:d.showAxisLines,showScaleBar:d.showScaleBar,showPerspectiveSliceViews:d.showPerspectiveSliceViews,
layerSpecification:d.layerSpecification.addRef(),inputEventBindings:d.inputEventBindings,visibility:d.visibility},{showLayerPanel:d.options.showLayerPanel,showViewerMenu:!1}));e.layerGroupViewer.layout.name=c;return e}q(b,a);r(b,[{key:"toJSON",value:function(){return this.layerGroupViewer.layout.name}},{key:"changed",get:function(){return this.layerGroupViewer.layout.changed}}]);return b}(l.a),y=function(b){function c(a,b,d,e){p(this,c);var f=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));
f.element=a;f.direction=b;f.container=e;f.changed=new h.a;a.classList.add("neuroglancer-stack-layout");a.classList.add("neuroglancer-stack-layout-"+b);a.style.display="flex";a.style.flexDirection=b;a.appendChild(f.makeDropPlaceholder(f));a=$jscomp.makeIterator(d);for(b=a.next();!b.done;b=a.next())f.insertChild(b.value);return f}q(c,b);$jscomp.initSymbol();$jscomp.initSymbolIterator();r(c,[{key:"makeDropPlaceholder",value:function(b){var c=this,d=document.createElement("div");d.className="neuroglancer-stack-layout-drop-placeholder";
b.registerDisposer(a(d,this.viewer.layerSpecification,function(){var a=d.nextElementSibling,b;null!==a&&(b=D.getFromElement(a));return c.insertChild({type:"viewer",layers:[]},b).component}));b.registerDisposer(function(){Object(g.b)(d)});return d}},{key:"get",value:function(a){return D.getFromElement(this.element.children[2*a+1])}},{key:"insertChild",value:function(a,b){var c=this,d=new D(this.viewer,a,this);a=this.makeDropPlaceholder(d);d.element.classList.add("neuroglancer-stack-layout-child");
d.registerDisposer(d.changed.add(this.changed.dispatch));d.registerDisposer(function(){c.element.removeChild(d.element);c.changed.dispatch()});b=void 0!==b?b.element:null;this.element.insertBefore(d.element,b);this.element.insertBefore(a,b);this.changed.dispatch();return d}},{key:"disposed",value:function(){this.clear();B(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}},{key:"clear",value:function(){for(;0!==this.length;)this.get(0).dispose()}},{key:Symbol.iterator,
value:function(){function a(a,g){for(;;)switch(b){case 0:e=f,d=e.length,c=0;case 1:if(!(c<d)){b=3;break}b=4;return{value:f.get(c),done:!1};case 4:if(void 0===g){b=5;break}b=-1;throw g;case 5:case 2:++c;b=1;break;case 3:b=-1;default:return{value:void 0,done:!0}}}var b=0,c,d,e,f=this,g={next:function(b){return a(b,void 0)},throw:function(b){return a(void 0,b)},return:function(a){throw Error("Not yet implemented");}};$jscomp.initSymbolIterator();g[Symbol.iterator]=function(){return this};return g}},
{key:"toJSON",value:function(){return{type:this.direction,children:Array.from(this).map(function(a){return a.toJSON()})}}},{key:"length",get:function(){return(this.element.childElementCount-1)/2}},{key:"viewer",get:function(){return this.container.viewer}}]);return c}(l.a),E=function(a){function b(a,c){p(this,b);var d=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));d.viewer=a;d.defaultSpecification=c;d.container=d.registerDisposer(new D(d.viewer,d.defaultSpecification,void 0));return d}
q(b,a);r(b,[{key:"reset",value:function(){this.container.setSpecification(this.defaultSpecification)}},{key:"restoreState",value:function(a){this.container.setSpecification(a)}},{key:"disposed",value:function(){B(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"disposed",this).call(this)}},{key:"toJSON",value:function(){var a=this.container.toJSON();if(a!==this.defaultSpecification)return a}},{key:"changed",get:function(){return this.container.changed}},{key:"element",get:function(){return this.container.element}}]);
return b}(l.a)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,
writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){a=new t.a(a);var c=a.element;c.classList.add("neuroglancer-layer-group-viewer-context-menu");var d=document.createElement("button");d.textContent="Remove layer group";c.appendChild(d);a.registerEventListener(d,"click",function(){b.layerSpecification.layerManager.clear()});d=b.viewerNavigationState;d=$jscomp.makeIterator([["Position",d.position.link],["Cross-section orientation",d.crossSectionOrientation.link],
["Cross-section zoom",d.crossSectionZoom.link],["Perspective orientation",d.perspectiveOrientation.link],["Perspective zoom",d.perspectiveZoom.link]]);for(var e=d.next();!e.done;e=d.next()){var f=$jscomp.makeIterator(e.value);e=f.next().value;f=f.next().value;f=a.registerDisposer(new B.a(f));var g=document.createElement("label");g.style.display="flex";g.style.flexDirection="row";g.style.whiteSpace="nowrap";g.textContent=e;g.appendChild(f.element);c.appendChild(g)}return a}f.c=function(a){return-1!==
a.dataTransfer.types.indexOf("neuroglancer-layer-group-viewer")};f.b=function(a,b){if(a.shiftKey)return"copy";if(a.ctrlKey)return"move";a=z&&z.viewer.layerSpecification.rootLayers===b.rootLayers?z.viewer:void 0;return void 0!==a?"move":"copy"};c.d(f,"a",function(){return E});var b=c(140),m=c(292),u=c(15),v=c(60),t=c(84),l=c(85),g=c(144),e=c(55);n=c(0);var d=c(12),h=c(17),r=c(32),B=c(297),C=function G(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=
Object.getPrototypeOf(a),null!==a)return G(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},D=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}();c(298);f.d="neuroglancer-layer-group-viewer";var z,y=function(a){function b(a){p(this,b);var c=k(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));
c.position=new v.b(a.navigationState.position.addRef());c.crossSectionOrientation=new v.a(a.navigationState.pose.orientation.addRef());c.crossSectionZoom=new v.c(a.navigationState.zoomFactor.addRef());c.navigationState=c.registerDisposer(new v.e(new v.g(c.position.value,c.crossSectionOrientation.value),c.crossSectionZoom.value));c.perspectiveOrientation=new v.a(a.perspectiveNavigationState.pose.orientation.addRef());c.perspectiveZoom=new v.c(a.perspectiveNavigationState.zoomFactor.addRef());c.perspectiveNavigationState=
c.registerDisposer(new v.e(new v.g(c.position.value.addRef(),c.perspectiveOrientation.value),c.perspectiveZoom.value));return c}q(b,a);D(b,[{key:"copyToParent",value:function(){for(var a=$jscomp.makeIterator([this.position,this.crossSectionOrientation,this.crossSectionZoom,this.perspectiveOrientation,this.perspectiveZoom]),b=a.next();!b.done;b=a.next())b.value.copyToPeer()}},{key:"register",value:function(a){a.add("position",this.position);a.add("crossSectionOrientation",this.crossSectionOrientation);
a.add("crossSectionZoom",this.crossSectionZoom);a.add("perspectiveOrientation",this.perspectiveOrientation);a.add("perspectiveZoom",this.perspectiveZoom)}}]);return b}(n.a),E=function(c){function f(a,c,d){d=void 0===d?{}:d;p(this,f);var h=k(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));h.element=a;h.viewerState=c;h.state=new r.a;h.options=Object.assign({showLayerPanel:!0,showViewerMenu:!1},d);h.layerSpecification=h.registerDisposer(c.layerSpecification);h.viewerNavigationState=h.registerDisposer(new y(c));
h.viewerNavigationState.register(h.state);h.layerSpecification instanceof u.a?h.state.add("layers",h.layerSpecification):h.state.add("layers",{changed:h.layerSpecification.changed,toJSON:function(){return h.layerSpecification.layerManager.managedLayers.map(function(a){return a.name})},reset:function(){throw Error("not implemented");},restoreState:function(){throw Error("not implemented");}});a.classList.add("neuroglancer-layer-group-viewer");h.registerDisposer(new e.a(a));h.layout=h.registerDisposer(new b.a(h,
"xy"));h.state.add("layout",h.layout);h.registerActionBindings();h.registerDisposer(h.layerManager.useDirectly());h.registerDisposer(Object(g.a)(a,h.navigationState.position));h.makeUI();return h}q(f,c);D(f,[{key:"bindAction",value:function(a,b){this.registerDisposer(Object(h.c)(this.element,a,b))}},{key:"registerActionBindings",value:function(){var a=this;this.bindAction("add-layer",function(){a.layerPanel&&a.layerPanel.addLayerMenu()})}},{key:"toJSON",value:function(){return Object.assign({type:"viewer"},
this.state.toJSON())}},{key:"reset",value:function(){this.state.reset()}},{key:"restoreState",value:function(a){this.state.restoreState(a)}},{key:"makeUI",value:function(){var b=this;this.element.style.flex="1";this.element.style.display="flex";this.element.style.flexDirection="column";var c=this.options;if(c.showLayerPanel){var d=this.layerPanel=this.registerDisposer(new m.a(this.display,this.layerSpecification,this.viewerNavigationState));c.showViewerMenu?(this.registerDisposer(a(d.element,this)),
d.element.title="Right click for options, drag to move/copy layer group."):d.element.title="Drag to move/copy layer group.";d.element.draggable=!0;this.registerEventListener(d.element,"dragstart",function(a){Object(l.e)(a,{manager:b.layerSpecification,layers:b.layerManager.managedLayers});var c=function(){z&&z.viewer===b&&(z=void 0);b.unregisterDisposer(c)};z={viewer:b,disposer:c};b.registerDisposer(c);var d=b.toJSON();delete d.layers;a.dataTransfer.setData("neuroglancer-layer-group-viewer",JSON.stringify(d))});
this.registerEventListener(d.element,"dragend",function(a){Object(l.a)(a);void 0!==z&&z.viewer===b&&z.disposer()});this.element.appendChild(d.element)}this.element.appendChild(this.layout.element)}},{key:"disposed",value:function(){Object(d.a)(this.element);C(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}},{key:"perspectiveNavigationState",get:function(){return this.viewerNavigationState.perspectiveNavigationState}},{key:"navigationState",get:function(){return this.viewerNavigationState.navigationState}},
{key:"display",get:function(){return this.viewerState.display}},{key:"layerManager",get:function(){return this.layerSpecification.layerManager}},{key:"chunkManager",get:function(){return this.layerSpecification.chunkManager}},{key:"mouseState",get:function(){return this.viewerState.mouseState}},{key:"showAxisLines",get:function(){return this.viewerState.showAxisLines}},{key:"showScaleBar",get:function(){return this.viewerState.showScaleBar}},{key:"showPerspectiveSliceViews",get:function(){return this.viewerState.showPerspectiveSliceViews}},
{key:"inputEventBindings",get:function(){return this.viewerState.inputEventBindings}},{key:"visibility",get:function(){return this.viewerState.visibility}},{key:"changed",get:function(){return this.state.changed}}]);return f}(n.a)},function(n,f,c){function p(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function k(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?
a:b}function q(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function a(a,b){if("move"===a.method)return!1;a.manager.layerManager.filter(function(b){return!a.layers.has(b)});return void 0!==b&&a.layers.has(b)}function b(b,c,d){function f(c,e){var f=
b.dropLayers,g=e?Object(l.d)(c,b.manager):Object(h.c)(),k=!0;if(void 0!==f&&(e&&Object(h.e)(c,g),!f.compatibleWithMethod(g)&&(b.dropLayers=void 0,a(f,d))))return;if(void 0===f){f=b.dropLayers=Object(l.b)(c,b.manager,"copy"===g,!0,!1);if(void 0===f)return;k="move"===f.method}if(void 0!==d&&f.layers.has(d))return f;if(k){var m=b.manager.layerManager,n=new Set,p=Number.POSITIVE_INFINITY;c=m.managedLayers=m.managedLayers.filter(function(a,b){return f.layers.has(a)?(p===Number.POSITIVE_INFINITY&&(p=b),
n.add(a),!1):!0});void 0!==d?(e=c.indexOf(d),p<=e&&++e):e=c.length;g=$jscomp.makeIterator(f.layers.keys());for(k=g.next();!k.done;k=g.next())k=k.value,n.has(k)||f.layers.delete(k);c.splice.apply(c,[].concat([e,0],$jscomp.arrayFromIterable(f.layers.keys())));m.layersChanged.dispatch()}else for(void 0!==d&&(m=b.manager.layerManager.managedLayers.indexOf(d)),c=$jscomp.makeIterator(f.layers.keys()),e=c.next();!e.done;e=c.next())b.manager.add(e.value,m);return f}var g=Object(e.c)(c,"dragenter",function(a){void 0!==
f(a,!0)&&a.preventDefault()}),k=Object(e.c)(c,"drop",function(c){c.preventDefault();var d=f(c,!1);void 0!==d&&(d.finalize(c)?(c.dataTransfer.dropEffect=Object(h.c)(),Object(l.a)("move"===d.method?void 0:c)):a(d));b.dropLayers=void 0}),m=Object(e.c)(c,"dragover",function(a){void 0!==f(a,!0)&&(a.preventDefault(),a.stopPropagation())});return function(){m();k();g()}}c.d(f,"a",function(){return z});var m=c(141),u=c(15),v=c(60),t=c(84),l=c(85),g=c(143),e=c(0),d=c(12),h=c(86),r=c(87),B=function(){function a(a,
b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,d){c&&a(b.prototype,c);d&&a(b,d);return b}}(),C=function E(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return E(a,b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}};c(30);c(296);c(61);var D=function(a){function c(a,
d){p(this,c);var e=k(this,(c.__proto__||Object.getPrototypeOf(c)).call(this));e.layer=a;e.panel=d;var f=e.element=document.createElement("div");f.title="Right click for layer options, drag to move/copy.";f.className="neuroglancer-layer-item neuroglancer-noselect";var g=e.labelElement=document.createElement("span");g.className="neuroglancer-layer-item-label";var h=e.layerNumberElement=document.createElement("span");h.className="neuroglancer-layer-item-number";var n=e.valueElement=document.createElement("span");
n.className="neuroglancer-layer-item-value";var q=document.createElement("span");q.title="Delete layer";q.className="neuroglancer-layer-item-close";e.registerEventListener(q,"click",function(a){e.panel.layerManager.removeManagedLayer(e.layer);a.stopPropagation()});f.appendChild(h);f.appendChild(g);f.appendChild(n);f.appendChild(q);e.registerEventListener(f,"click",function(b){a.setVisible(!a.visible)});g=e.contextMenu=e.registerDisposer(new t.a(f));g.element.classList.add("neuroglancer-layer-dropdown");
g.opened.add(function(){if(void 0!==e.dropdown)e.dropdown.onShow()});g.closed.add(function(){if(void 0!==e.dropdown)e.dropdown.onHide()});f.draggable=!0;e.registerEventListener(f,"dragstart",function(a){Object(l.e)(a,{manager:d.manager,layers:[e.layer]});a.stopPropagation()});e.registerEventListener(f,"dragend",function(a){Object(l.a)(a)});e.registerDisposer(b(e.panel,f,e.layer));e.registerEventListener(f,"dblclick",function(b){a instanceof u.b&&new m.a(e.panel.manager,a)});e.handleLayerChanged();
e.registerDisposer(a.layerChanged.add(function(){e.handleLayerChanged()}));return e}q(c,a);B(c,[{key:"update",value:function(){var a=this.layer;this.labelElement.textContent=a.name;this.element.setAttribute("layer-visible",a.visible.toString())}},{key:"handleLayerChanged",value:function(){var a=this.layer.layer;if(a!==this.userLayer)if(this.dropdown&&(this.dropdown.dispose(),Object(d.a)(this.contextMenu.element)),this.userLayer=a){var b=document.createElement("div");this.contextMenu.element.appendChild(b);
this.dropdown=a.makeDropdown(b)}else this.dropdown=void 0;this.contextMenu.disabled=void 0===this.dropdown}},{key:"disposed",value:function(){this.dropdown&&this.dropdown.dispose();this.element.parentElement.removeChild(this.element);C(c.prototype.__proto__||Object.getPrototypeOf(c.prototype),"disposed",this).call(this)}}]);return c}(e.a),z=function(c){function d(c,e,f){p(this,d);var l=k(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));l.display=c;l.manager=e;l.viewerNavigationState=f;l.layerWidgets=
new Map;l.element=document.createElement("div");l.layerUpdateNeeded=!0;l.valueUpdateNeeded=!1;l.layerWidgetInsertionPoint=document.createElement("div");l.positionWidget=l.registerDisposer(new r.b(l.viewerNavigationState.position.value));l.scheduleUpdate=l.registerCancellable(Object(g.a)(function(){return l.update()}));var m=l.element;m.className="neuroglancer-layer-panel";l.registerDisposer(e.layerSelectedValues.changed.add(function(){l.handleLayerValuesChanged()}));l.registerDisposer(e.layerManager.layersChanged.add(function(){l.handleLayersChanged()}));
l.layerWidgetInsertionPoint.style.display="none";l.element.appendChild(l.layerWidgetInsertionPoint);e=l.addButton=document.createElement("div");e.className="neuroglancer-layer-add-button neuroglancer-button";e.title="Add layer";e.textContent="+";f=l.dropZone=document.createElement("div");f.className="neuroglancer-layer-panel-drop-zone";l.registerEventListener(e,"click",function(){l.addLayerMenu()});m.appendChild(e);m.appendChild(f);l.registerDisposer(Object(h.d)(e));m.appendChild(l.positionWidget.element);
var n=function(){l.positionWidget.element.style.display=l.viewerNavigationState.position.link.value===v.d.LINKED?"none":null};l.registerDisposer(l.viewerNavigationState.position.link.changed.add(n));n();l.update();l.registerEventListener(m,"dragleave",function(b){b.relatedTarget&&m.contains(b.relatedTarget)||(b=l.dropLayers,void 0!==b&&(a(b),l.dropLayers=void 0))});l.registerDisposer(b(l,e,void 0));l.registerDisposer(b(l,f,void 0));l.registerDisposer(c.updateStarted.add(function(){return l.updateLayers()}));
return l}q(d,c);B(d,[{key:"disposed",value:function(){this.layerWidgets.forEach(function(a){return a.dispose()});this.layerWidgets=void 0;C(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"disposed",this).call(this)}},{key:"handleLayersChanged",value:function(){this.layerUpdateNeeded=!0;this.handleLayerValuesChanged()}},{key:"handleLayerValuesChanged",value:function(){this.valueUpdateNeeded||(this.valueUpdateNeeded=!0,this.scheduleUpdate())}},{key:"update",value:function(){this.valueUpdateNeeded=
!1;this.updateLayers();for(var a=this.manager.layerSelectedValues,b=$jscomp.makeIterator(this.layerWidgets),c=b.next();!c.done;c=b.next()){c=$jscomp.makeIterator(c.value);var d=c.next().value;c=c.next().value;var e=d.layer;d="";null!==e&&(e=a.get(e),void 0!==e&&(d=""+e));c.valueElement.textContent=d}}},{key:"updateLayers",value:function(){var a=this;if(this.layerUpdateNeeded){this.layerUpdateNeeded=!1;var b=this.element,c=new Set,d=this.layerWidgetInsertionPoint.nextElementSibling;this.manager.layerManager.managedLayers.forEach(function(e){c.add(e);
var f=a.layerWidgets.get(e),g=a.manager.rootLayers.managedLayers.indexOf(e);void 0===f&&(f=new D(e,a),a.layerWidgets.set(e,f));f.layerNumberElement.textContent=""+(1+g);f.update();e=f.element;e!==d&&b.insertBefore(f.element,d);d=e.nextElementSibling});for(var e=$jscomp.makeIterator(this.layerWidgets),f=e.next();!f.done;f=e.next()){var g=$jscomp.makeIterator(f.value);f=g.next().value;g=g.next().value;c.has(f)||(this.layerWidgets.delete(f),g.dispose())}}}},{key:"addLayerMenu",value:function(){new m.a(this.manager)}},
{key:"layerManager",get:function(){return this.manager.layerManager}}]);return d}(e.a)},function(n,f){},function(n,f,c){f.b=function(c){return Array.prototype.map.call(c,function(c){return("0"+c.toString(16)).slice(-2)}).join("")};f.a=function(c){if(!/^(?:[0-9a-fA-F]{2})*$/.test(c))throw Error("Invalid hex-encoded string");for(var f=c.length/2,n=new Uint8Array(f),a=0;a<f;++a)n[a]=parseInt(c.substr(2*a,2),16);return n}},function(n,f){},function(n,f){},function(n,f,c){function p(a,c){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return!c||"object"!==typeof c&&"function"!==typeof c?a:c}function k(a,c){if("function"!==typeof c&&null!==c)throw new TypeError("Super expression must either be null or a function, not "+typeof c);a.prototype=Object.create(c&&c.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});c&&(Object.setPrototypeOf?Object.setPrototypeOf(a,c):a.__proto__=c)}c.d(f,"a",function(){return a});n=c(0);var q=function(){function a(a,b){for(var c=0;c<b.length;c++){var f=b[c];f.enumerable=f.enumerable||
!1;f.configurable=!0;"value"in f&&(f.writable=!0);Object.defineProperty(a,f.key,f)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),a=function(a){function b(a){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");var c=p(this,(b.__proto__||Object.getPrototypeOf(b)).call(this));c.model=a;c.element=document.createElement("select");c.valueIndexMap=new Map;for(var f=c.element,k=c.valueIndexMap,g=0,e=$jscomp.makeIterator(Object.keys(a.enumType)),d=e.next();!d.done;d=
e.next())if(d=d.value,isNaN(Number(d))){var h=document.createElement("option");h.textContent=h.value=d.toLowerCase();f.appendChild(h);k.set(a.enumType[d],g);++g}c.registerDisposer(a.changed.add(function(){return c.updateView()}));c.registerEventListener(f,"change",function(){return c.updateModel()});c.updateView();return c}k(b,a);q(b,[{key:"updateView",value:function(){this.element.selectedIndex=this.valueIndexMap.get(this.model.value)}},{key:"updateModel",value:function(){this.model.restoreState(this.element.value)}}]);
return b}(n.a)},function(n,f){},function(n,f){},function(n,f,c){function p(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?
Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return u});var q=c(8);n=c(0);var a=c(12),b=function(){function a(a,b){for(var c=0;c<b.length;c++){var e=b[c];e.enumerable=e.enumerable||!1;e.configurable=!0;"value"in e&&(e.writable=!0);Object.defineProperty(a,e.key,e)}}return function(b,c,f){c&&a(b.prototype,c);f&&a(b,f);return b}}(),m=function t(a,b,c){null===a&&(a=Function.prototype);var d=Object.getOwnPropertyDescriptor(a,b);if(void 0===d){if(a=Object.getPrototypeOf(a),null!==a)return t(a,
b,c)}else{if("value"in d)return d.value;b=d.get;return void 0===b?void 0:b.call(c)}},u=function(c){function f(a,b){b=void 0===b?{}:b;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var c=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));c.model=a;c.element=document.createElement("label");c.inputElement=document.createElement("input");var e=b;b=e.validator;e=e.label;var g=c.element,k=c.inputElement;void 0===b&&(b=a instanceof q.a?a.validator:function(a){return a});
c.validator=b;void 0!==e&&(g.textContent=e);g.appendChild(k);g.className="neuroglancer-number-input";k.type="input";c.registerDisposer(c.model.changed.add(function(){return c.updateView()}));c.registerEventListener(k,"change",function(){return c.updateModel()});c.updateView();return c}k(f,c);b(f,[{key:"updateView",value:function(){this.inputElement.value=""+this.model.value}},{key:"updateModel",value:function(){var a=parseFloat(this.inputElement.value.trim());if(Number.isNaN(a))this.updateView();
else try{a=this.validator(a),this.model.value=a}catch(e){this.updateView()}}},{key:"disposed",value:function(){Object(a.b)(this.element);m(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"disposed",this).call(this)}}]);return f}(n.a)},function(n,f){},function(n,f,c){f.a=function(){return Object(p.c)(document,"contextmenu",function(c){c.preventDefault()})};f.b=function(){return Object(p.c)(document,"wheel",function(c){c.ctrlKey&&c.preventDefault()})};var p=c(0)},function(n,f,c){function p(a,
b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!==typeof b&&"function"!==typeof b?a:b}function k(a,b){if("function"!==typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}});b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}c.d(f,"a",function(){return v});n=
c(9);var q=c.n(n),a=c(8);n=c(0);var b=c(2),m=c(32),u=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,e){c&&a(b.prototype,c);e&&a(b,e);return b}}(),v=function(c){function f(b,c){c=void 0===c?200:c;if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");var d=p(this,(f.__proto__||Object.getPrototypeOf(f)).call(this));d.root=b;d.parseError=
new a.b(void 0);d.registerEventListener(window,"hashchange",function(){return d.updateFromUrlHash()});var e=q()(function(){return d.setUrlHash()},c);d.registerDisposer(b.changed.add(e));d.registerDisposer(function(){return e.cancel()});return d}k(f,c);u(f,[{key:"setUrlHash",value:function(){var a=Object(m.c)(this.root);a.generation!==this.prevStateGeneration&&(this.prevStateGeneration=a.generation,a=Object(b.i)(a.value),a!==this.prevStateString&&(this.prevStateString=a,"{}"===a?history.replaceState(null,
"","#"):history.replaceState(null,"","#!"+a)))}},{key:"updateFromUrlHash",value:function(){try{var a=location.href.replace(/^[^#]+/,"");if(""===a||"#"===a||"#!"===a)a="#!{}";if(a.startsWith("#!+")){a=a.slice(3);a=decodeURI(a);var c=Object(b.h)(a);Object(b.u)(c);this.root.restoreState(c);this.prevStateString=void 0}else if(a.startsWith("#!")){a=a.slice(2);a=decodeURI(a);if(a===this.prevStateString)return;this.prevStateString=a;this.root.reset();var d=Object(b.h)(a);Object(b.u)(d);this.root.restoreState(d)}else throw Error('URL hash is expected to be of the form "#!{...}" or "#!+{...}".');
this.parseError.value=void 0}catch(h){this.parseError.value=h}}}]);return f}(n.a)}]);
