/*

 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 2015 Mozilla Foundation

 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.
*/
var $jscomp={scope:{}};$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(n,h,f){if(f.get||f.set)throw new TypeError("ES3 does not support getters and setters.");n!=Array.prototype&&n!=Object.prototype&&(n[h]=f.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 h=0;return $jscomp.iteratorPrototype(function(){return h<n.length?{done:!1,value:n[h++]}:{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 h=n[Symbol.iterator];return h?h.call(n):$jscomp.arrayIterator(n)};$jscomp.arrayFromIterator=function(n){for(var h,f=[];!(h=n.next()).done;)f.push(h.value);return f};$jscomp.arrayFromIterable=function(n){return n instanceof Array?n:$jscomp.arrayFromIterator($jscomp.makeIterator(n))};
$jscomp.owns=function(n,h){return Object.prototype.hasOwnProperty.call(n,h)};$jscomp.polyfill=function(n,h,f,e){if(h){f=$jscomp.global;n=n.split(".");for(e=0;e<n.length-1;e++){var c=n[e];c in f||(f[c]={});f=f[c]}n=n[n.length-1];e=f[n];h=h(e);h!=e&&null!=h&&$jscomp.defineProperty(f,n,{configurable:!0,writable:!0,value:h})}};
$jscomp.polyfill("WeakMap",function(n){function h(a){$jscomp.owns(a,e)||$jscomp.defineProperty(a,e,{value:{}})}function f(a){var b=Object[a];b&&(Object[a]=function(a){h(a);return b(a)})}if(function(){if(!n||!Object.seal)return!1;try{var a=Object.seal({}),d=Object.seal({}),c=new n([[a,2],[d,3]]);if(2!=c.get(a)||3!=c.get(d))return!1;c.delete(a);c.set(d,4);return!c.has(a)&&4==c.get(d)}catch(k){return!1}}())return n;var e="$jscomp_hidden_"+Math.random().toString().substring(2);f("freeze");f("preventExtensions");
f("seal");var c=0,a=function(a){this.id_=(c+=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])}};a.prototype.set=function(a,d){h(a);if(!$jscomp.owns(a,e))throw Error("WeakMap key fail: "+a);a[e][this.id_]=d;return this};a.prototype.get=function(a){return $jscomp.owns(a,e)?a[e][this.id_]:void 0};a.prototype.has=function(a){return $jscomp.owns(a,e)&&$jscomp.owns(a[e],this.id_)};a.prototype.delete=
function(a){return $jscomp.owns(a,e)&&$jscomp.owns(a[e],this.id_)?delete a[e][this.id_]:!1};return a},"es6-impl","es3");$jscomp.ASSUME_NO_NATIVE_MAP=!1;
$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}),b=new n($jscomp.makeIterator([[a,"s"]]));if("s"!=b.get(a)||1!=b.size||b.get({x:4})||b.set({x:4},"t")!=b||2!=b.size)return!1;var c=b.entries(),m=c.next();if(m.done||m.value[0]!=a||"s"!=m.value[1])return!1;m=c.next();return m.done||4!=m.value[0].x||"t"!=m.value[1]||!c.next().done?!1:!0}catch(l){return!1}}())return n;$jscomp.initSymbol();
$jscomp.initSymbolIterator();var h=new WeakMap,f=function(b){this.data_={};this.head_=a();this.size=0;if(b){b=$jscomp.makeIterator(b);for(var d;!(d=b.next()).done;)d=d.value,this.set(d[0],d[1])}};f.prototype.set=function(a,b){var d=e(this,a);d.list||(d.list=this.data_[d.id]=[]);d.entry?d.entry.value=b:(d.entry={next:this.head_,previous:this.head_.previous,head:this.head_,key:a,value:b},d.list.push(d.entry),this.head_.previous.next=d.entry,this.head_.previous=d.entry,this.size++);return this};f.prototype.delete=
function(a){a=e(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};f.prototype.clear=function(){this.data_={};this.head_=this.head_.previous=a();this.size=0};f.prototype.has=function(a){return!!e(this,a).entry};f.prototype.get=function(a){return(a=e(this,a).entry)&&a.value};f.prototype.entries=function(){return c(this,function(a){return[a.key,
a.value]})};f.prototype.keys=function(){return c(this,function(a){return a.key})};f.prototype.values=function(){return c(this,function(a){return a.value})};f.prototype.forEach=function(a,b){for(var d=this.entries(),c;!(c=d.next()).done;)c=c.value,a.call(b,c[1],c[0],this)};f.prototype[Symbol.iterator]=f.prototype.entries;var e=function(a,c){var d;d=c&&typeof c;"object"==d||"function"==d?h.has(c)?d=h.get(c):(d=""+ ++b,h.set(c,d)):d="p_"+c;var g=a.data_[d];if(g&&$jscomp.owns(a.data_,d))for(a=0;a<g.length;a++){var l=
g[a];if(c!==c&&l.key!==l.key||c===l.key)return{id:d,list:g,index:a,entry:l}}return{id:d,list:g,index:-1,entry:void 0}},c=function(a,b){var d=a.head_;return $jscomp.iteratorPrototype(function(){if(d){for(;d.head!=a.head_;)d=d.previous;for(;d.next!=d.head;)return d=d.next,{done:!1,value:b(d)};d=null}return{done:!0,value:void 0}})},a=function(){var a={};return a.previous=a.next=a.head=a},b=0;return f},"es6-impl","es3");$jscomp.array=$jscomp.array||{};
$jscomp.iteratorFromArray=function(n,h){$jscomp.initSymbolIterator();n instanceof String&&(n+="");var f=0,e={next:function(){if(f<n.length){var c=f++;return{value:h(c,n[c]),done:!1}}e.next=function(){return{done:!0,value:void 0}};return e.next()}};e[Symbol.iterator]=function(){return e};return e};$jscomp.polyfill("Array.prototype.keys",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(h){return h})}},"es6-impl","es3");$jscomp.EXPOSE_ASYNC_EXECUTOR=!0;
$jscomp.FORCE_POLYFILL_PROMISE=!1;
$jscomp.polyfill("Promise",function(n){function h(){this.batch_=null}if(n&&!$jscomp.FORCE_POLYFILL_PROMISE)return n;h.prototype.asyncExecute=function(a){null==this.batch_&&(this.batch_=[],this.asyncExecuteBatch_());this.batch_.push(a);return this};h.prototype.asyncExecuteBatch_=function(){var a=this;this.asyncExecuteFunction(function(){a.executeBatch_()})};var f=$jscomp.global.setTimeout;h.prototype.asyncExecuteFunction=function(a){f(a,0)};h.prototype.executeBatch_=function(){for(;this.batch_&&this.batch_.length;){var a=
this.batch_;this.batch_=[];for(var b=0;b<a.length;++b){var d=a[b];delete a[b];try{d()}catch(g){this.asyncThrow_(g)}}}this.batch_=null};h.prototype.asyncThrow_=function(a){this.asyncExecuteFunction(function(){throw a;})};var e=function(a){this.state_=0;this.result_=void 0;this.onSettledCallbacks_=[];var b=this.createResolveAndReject_();try{a(b.resolve,b.reject)}catch(d){b.reject(d)}};e.prototype.createResolveAndReject_=function(){function a(a){return function(c){d||(d=!0,a.call(b,c))}}var b=this,d=
!1;return{resolve:a(this.resolveTo_),reject:a(this.reject_)}};e.prototype.resolveTo_=function(a){if(a===this)this.reject_(new TypeError("A Promise cannot resolve to itself"));else if(a instanceof e)this.settleSameAsPromise_(a);else{var b;a:switch(typeof a){case "object":b=null!=a;break a;case "function":b=!0;break a;default:b=!1}b?this.resolveToNonPromiseObj_(a):this.fulfill_(a)}};e.prototype.resolveToNonPromiseObj_=function(a){var b=void 0;try{b=a.then}catch(d){this.reject_(d);return}"function"==
typeof b?this.settleSameAsThenable_(b,a):this.fulfill_(a)};e.prototype.reject_=function(a){this.settle_(2,a)};e.prototype.fulfill_=function(a){this.settle_(1,a)};e.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_()};e.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 c=new h;e.prototype.settleSameAsPromise_=function(a){var b=this.createResolveAndReject_();a.callWhenSettled_(b.resolve,b.reject)};e.prototype.settleSameAsThenable_=function(a,b){var d=this.createResolveAndReject_();try{a.call(b,d.resolve,d.reject)}catch(g){d.reject(g)}};e.prototype.then=function(a,b){function d(a,b){return"function"==typeof a?function(b){try{c(a(b))}catch(v){k(v)}}:b}var c,k,m=new e(function(a,b){c=a;k=b});this.callWhenSettled_(d(a,c),
d(b,k));return m};e.prototype.catch=function(a){return this.then(void 0,a)};e.prototype.callWhenSettled_=function(a,b){function d(){switch(g.state_){case 1:a(g.result_);break;case 2:b(g.result_);break;default:throw Error("Unexpected state: "+g.state_);}}var g=this;null==this.onSettledCallbacks_?c.asyncExecute(d):this.onSettledCallbacks_.push(function(){c.asyncExecute(d)})};e.resolve=function(a){return a instanceof e?a:new e(function(b,d){b(a)})};e.reject=function(a){return new e(function(b,d){d(a)})};
e.race=function(a){return new e(function(b,d){for(var c=$jscomp.makeIterator(a),k=c.next();!k.done;k=c.next())e.resolve(k.value).callWhenSettled_(b,d)})};e.all=function(a){var b=$jscomp.makeIterator(a),d=b.next();return d.done?e.resolve([]):new e(function(a,c){function g(b){return function(d){k[b]=d;u--;0==u&&a(k)}}var k=[],u=0;do k.push(void 0),u++,e.resolve(d.value).callWhenSettled_(g(k.length-1),c),d=b.next();while(!d.done)})};$jscomp.EXPOSE_ASYNC_EXECUTOR&&(e.$jscomp$new$AsyncExecutor=function(){return new h});
return e},"es6-impl","es3");$jscomp.polyfill("Number.isNaN",function(n){return n?n:function(h){return"number"===typeof h&&isNaN(h)}},"es6-impl","es3");$jscomp.polyfill("Number.isFinite",function(n){return n?n:function(h){return"number"!==typeof h?!1:!isNaN(h)&&Infinity!==h&&-Infinity!==h}},"es6-impl","es3");$jscomp.polyfill("Number.isInteger",function(n){return n?n:function(h){return Number.isFinite(h)?h===Math.floor(h):!1}},"es6-impl","es3");
$jscomp.polyfill("Array.from",function(n){return n?n:function(h,f,e){$jscomp.initSymbolIterator();f=null!=f?f:function(a){return a};var c=[],a=h[Symbol.iterator];if("function"==typeof a)for(h=a.call(h);!(a=h.next()).done;)c.push(f.call(e,a.value));else for(var a=h.length,b=0;b<a;b++)c.push(f.call(e,h[b]));return c}},"es6-impl","es3");
$jscomp.checkStringArgs=function(n,h,f){if(null==n)throw new TypeError("The 'this' value for String.prototype."+f+" must not be null or undefined");if(h instanceof RegExp)throw new TypeError("First argument to String.prototype."+f+" must not be a regular expression");return n+""};
$jscomp.polyfill("String.prototype.startsWith",function(n){return n?n:function(h,f){var e=$jscomp.checkStringArgs(this,h,"startsWith");h+="";var c=e.length,a=h.length;f=Math.max(0,Math.min(f|0,e.length));for(var b=0;b<a&&f<c;)if(e[f++]!=h[b++])return!1;return b>=a}},"es6-impl","es3");$jscomp.ASSUME_NO_NATIVE_SET=!1;
$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 f=Object.seal({x:4}),e=new n($jscomp.makeIterator([f]));if(!e.has(f)||1!=e.size||e.add(f)!=e||1!=e.size||e.add({x:4})!=e||2!=e.size)return!1;var c=e.entries(),a=c.next();if(a.done||a.value[0]!=f||a.value[1]!=f)return!1;a=c.next();return a.done||a.value[0]==f||4!=a.value[0].x||a.value[1]!=a.value[0]?!1:c.next().done}catch(b){return!1}}())return n;
$jscomp.initSymbol();$jscomp.initSymbolIterator();var h=function(f){this.map_=new Map;if(f){f=$jscomp.makeIterator(f);for(var e;!(e=f.next()).done;)this.add(e.value)}this.size=this.map_.size};h.prototype.add=function(f){this.map_.set(f,f);this.size=this.map_.size;return this};h.prototype.delete=function(f){f=this.map_.delete(f);this.size=this.map_.size;return f};h.prototype.clear=function(){this.map_.clear();this.size=0};h.prototype.has=function(f){return this.map_.has(f)};h.prototype.entries=function(){return this.map_.entries()};
h.prototype.values=function(){return this.map_.values()};h.prototype.keys=h.prototype.values;h.prototype[Symbol.iterator]=h.prototype.values;h.prototype.forEach=function(f,e){var c=this;this.map_.forEach(function(a){return f.call(e,a,a,c)})};return h},"es6-impl","es3");$jscomp.polyfill("Math.log2",function(n){return n?n:function(h){return Math.log(h)/Math.LN2}},"es6-impl","es3");
$jscomp.polyfill("String.prototype.repeat",function(n){return n?n:function(h){var f=$jscomp.checkStringArgs(this,null,"repeat");if(0>h||1342177279<h)throw new RangeError("Invalid count value");h|=0;for(var e="";h;)if(h&1&&(e+=f),h>>>=1)f+=f;return e}},"es6-impl","es3");$jscomp.polyfill("Object.assign",function(n){return n?n:function(h,f){for(var e=1;e<arguments.length;e++){var c=arguments[e];if(c)for(var a in c)$jscomp.owns(c,a)&&(h[a]=c[a])}return h}},"es6-impl","es3");
$jscomp.polyfill("Array.prototype.values",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(h,f){return f})}},"es6","es3");$jscomp.polyfill("Array.prototype.entries",function(n){return n?n:function(){return $jscomp.iteratorFromArray(this,function(h,f){return[h,f]})}},"es6-impl","es3");
$jscomp.polyfill("Array.prototype.fill",function(n){return n?n:function(h,f,e){var c=this.length||0;0>f&&(f=Math.max(0,c+f));if(null==e||e>c)e=c;e=Number(e);0>e&&(e=Math.max(0,c+e));for(f=Number(f||0);f<e;f++)this[f]=h;return this}},"es6-impl","es3");
$jscomp.polyfill("Array.prototype.copyWithin",function(n){return n?n:function(h,f,e){var c=this.length;h=Number(h);f=Number(f);e=Number(null!=e?e:c);if(h<f)for(e=Math.min(e,c);f<e;)f in this?this[h++]=this[f++]:(delete this[h++],f++);else for(e=Math.min(e,c+f-h),h+=e-f;e>f;)--e in this?this[--h]=this[e]:delete this[h];return this}},"es6-impl","es3");
(function(n){function h(e){if(f[e])return f[e].exports;var c=f[e]={i:e,l:!1,exports:{}};n[e].call(c.exports,c,c.exports,h);c.l=!0;return c.exports}var f={};h.m=n;h.c=f;h.i=function(e){return e};h.d=function(e,c,a){h.o(e,c)||Object.defineProperty(e,c,{configurable:!1,enumerable:!0,get:a})};h.n=function(e){var c=e&&e.__esModule?function(){return e["default"]}:function(){return e};h.d(c,"a",c);return c};h.o=function(e,c){return Object.prototype.hasOwnProperty.call(e,c)};h.p="";return h(h.s=106)})([function(n,
h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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 b(a,b){l.set(a,b)}function d(a,b,d){d=void 0===d?{}:d;null!=b&&a.initializeSharedObject(b,d.id)}var g=f(14);n=f(23);h.d=b;h.c=function(a,d){b(a,function(a){var b=this,c=a.id,k=new g.d;a=d.call(this,a,k);this.set(c,{promise:a,cancellationToken:k});a.then(function(a){var d=a.value;a=a.transfers;b.delete(c);b.invoke("rpc.promise.response",{id:c,value:d},a)},function(a){b.delete(c);b.invoke("rpc.promise.response",{id:c,error:a.message,
errorName:a.name})})})};f.d(h,"g",function(){return p});f.d(h,"e",function(){return v});h.f=d;f.d(h,"b",function(){return r});h.a=function(a){return function(b){y.set(a,b);b.prototype.RPC_TYPE_ID=a}};var k=function q(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 q(a,b,d)}else{if("value"in c)return c.value;b=c.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 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=new Map,u=function(b){function d(a,b){e(this,d);var g=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b));g.name=a;g.message=b;return g}a(d,b);return d}(Error);b("rpc.promise.cancel",function(a){this.get(a.id).cancellationToken.cancel()});b("rpc.promise.response",function(a){var b=a.id,d=this.get(b),c=d.resolve,
d=d.reject;this.delete(b);a.hasOwnProperty("value")?c(a.value):a.errorName===g.b.name?d(g.b):d(new u(a.errorName,a.error))});var p=function(){function a(b){var d=this;e(this,a);this.target=b;this.objects=new Map;this.nextId=-1;b.onmessage=function(a){a=a.data;l.get(a.functionName).call(d,a)}}m(a,[{key:"set",value:function(a,b){this.objects.set(a,b)}},{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 b=
this.get(a.id);b.referencedGeneration=a.gen;b.addRef();return b}},{key:"invoke",value:function(a,b,d){b.functionName=a;this.target.postMessage(b,d)}},{key:"promiseInvoke",value:function(a,b,d,c){d=void 0===d?g.c:d;var k=this;return f.i(g.a)(d,function(d,g,x){var m=b.id=k.newId();k.set(m,{resolve:d,reject:g});k.invoke(a,b,c);x.add(function(){k.invoke("rpc.promise.cancel",{id:m})})})}},{key:"newId",value:function(){return this.nextId--}},{key:"numObjects",get:function(){return this.objects.size}}]);
return a}(),v=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.rpc=null;a.rpcId=null;return a}a(d,b);m(d,[{key:"initializeSharedObject",value:function(a,b){b=void 0===b?a.newId():b;this.rpc=a;this.rpcId=b;this.isOwner=!1;a.set(b,this)}},{key:"initializeCounterpart",value:function(a,b){b=void 0===b?{}:b;this.initializeSharedObject(a);this.referencedGeneration=this.unreferencedGeneration=0;this.isOwner=!0;b.id=this.rpcId;b.type=this.RPC_TYPE_ID;
a.invoke("SharedObject.new",b)}},{key:"dispose",value:function(){k(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}):
k(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"refCountReachedZero",this).call(this)}},{key:"ownerDispose",value:function(){var a=this.rpc,b=this.rpcId;k(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"refCountReachedZero",this).call(this);a.delete(b);a.invoke("SharedObject.dispose",{id:b})}},{key:"counterpartRefCountReachedZero",value:function(a){this.unreferencedGeneration=a;0===this.refCount&&a===this.referencedGeneration&&this.ownerDispose()}}]);return d}(n.a),r=function(b){function g(a,
b){b=void 0===b?{}:b;e(this,g);var k=c(this,(g.__proto__||Object.getPrototypeOf(g)).call(this));d(k,a,b);return k}a(g,b);return g}(v);b("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});b("SharedObject.refCountReachedZero",function(a){this.get(a.id).counterpartRefCountReachedZero(a.gen)});var y=new Map;b("SharedObject.new",function(a){--(new (y.get(a.type))(this,
a)).refCount})},function(n,h,f){function e(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 c(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(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function b(a){var b=a.downloadCancellationToken=new r.d;a.source.download(a,b).then(function(){a.downloadCancellationToken===b&&(a.downloadCancellationToken=void 0,a.downloadSucceeded())},function(d){a.downloadCancellationToken===b&&(a.downloadCancellationToken=void 0,a.downloadFailed(d),console.log("Error retrieving chunk "+a+": "+d))})}function d(a){return new C(new v.a(a),l.a)}function g(a,b,d,c,g,
k){for(;1>b.availableItems||b.availableSize<a;){var x=g.next().value;if(void 0===x)return!1;var m=x.priorityTier;if(m<d||m===d&&x.priority>=c)return!1;k(x)}return!0}Object.defineProperty(h,"__esModule",{value:!0});var k=f(6),m=f(82),l=f(83),u=f(84),p=f(87),v=f(88),r=f(14),y=f(15),D=f(0);f.d(h,"Chunk",function(){return B});f.d(h,"ChunkSourceBase",function(){return t});f.d(h,"ChunkSource",function(){return E});f.d(h,"ChunkQueueManager",function(){return z});f.d(h,"ChunkManager",function(){return G});
h.registerChunkSource=function(a){return function(b){f.i(D.a)(a.RPC_ID)(b);b.prototype.toString=function(){return a.stringify(this.parameters)}}};var q=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}}();n=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,
d):c,x;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var m=a.length-1;0<=m;m--)if(x=a[m])k=(3>g?x(k):3<g?x(b,d,k):x(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var B=function(){function b(){a(this,b);this.key=this.source=this.prev1=this.next1=this.child1=this.prev0=this.next0=this.child0=null;this.state=k.a.NEW;this.error=null;this.newPriority=this.priority=0;this.newPriorityTier=this.priorityTier=k.b.RECENT;this.backendOnly=!1;
this.downloadCancellationToken=void 0}q(b,[{key:"initialize",value:function(a){this.key=a;this.state=k.a.NEW;this.priority=Number.NEGATIVE_INFINITY;this.priorityTier=k.b.RECENT;this.newPriority=Number.NEGATIVE_INFINITY;this.newPriorityTier=k.b.RECENT;this.error=null}},{key:"updatePriorityProperties",value:function(){this.priorityTier=this.newPriorityTier;this.priority=this.newPriority;this.newPriorityTier=k.b.RECENT;this.newPriority=Number.NEGATIVE_INFINITY}},{key:"dispose",value:function(){this.error=
this.source=null}},{key:"downloadFailed",value:function(a){this.error=a;this.queueManager.updateChunkState(this,k.a.FAILED)}},{key:"downloadSucceeded",value:function(){this.queueManager.updateChunkState(this,k.a.SYSTEM_MEMORY_WORKER)}},{key:"freeSystemMemory",value:function(){}},{key:"serialize",value:function(a,b){a.id=this.key;a.source=this.source.rpcId;a["new"]=!0}},{key:"toString",value:function(){return this.key}},{key:"chunkManager",get:function(){return this.source.chunkManager}},{key:"queueManager",
get:function(){return this.source.chunkManager.queueManager}}],[{key:"priorityLess",value:function(a,b){return a.priority<b.priority}},{key:"priorityGreater",value:function(a,b){return a.priority>b.priority}}]);return b}(),t=function(b){function d(b){a(this,d);var c=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));c.chunkManager=b;c.chunks=new Map;c.freeChunks=[];return c}c(d,b);q(d,[{key:"getNewChunk_",value:function(a){var b=this.freeChunks,d=b.length;if(0<d)return a=b[d-1],b.length=d-
1,a.source=this,a;b=new a;b.source=this;return b}},{key:"addChunk",value:function(a){var b=this.chunks;0===b.size&&this.addRef();b.set(a.key,a)}},{key:"removeChunk",value:function(a){var b=this.chunks,d=this.freeChunks;b.delete(a.key);a.dispose();d[d.length]=a;0===b.size&&this.dispose()}}]);return d}(D.e),E=function(b){function d(b,c){a(this,d);var g=b.get(c.chunkManager),g=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,g));f.i(D.f)(g,b,c);return g}c(d,b);return d}(t),C=function(){function b(d,
c){a(this,b);this.heapOperations=d;this.linkedListOperations=c;this.heapRoots=[null,null];this.recentHead=new B;c.initializeHead(this.recentHead)}q(b,[{key:"add",value:function(a){var b=a.priorityTier;if(b===k.b.RECENT)this.linkedListOperations.insertAfter(this.recentHead,a);else{var d=this.heapRoots;d[b]=this.heapOperations.meld(d[b],a)}}},{key:"candidates",value:function(){function a(a,x){for(;;)switch(b){case 0:if(h.heapOperations.compare!==B.priorityLess){b=1;break}H=h;z=H.linkedListOperations;
r=H.recentHead;case 3:t=z.back(r);if(null!=t){b=5;break}b=4;break;case 5:return b=7,{value:t,done:!1};case 7:if(void 0===x){b=8;break}b=-1;throw x;case 8:case 6:b=3;break;case 4:f=h,G=f.heapRoots,v=k.b.LAST_ORDERED_TIER;case 9:if(!(v>=k.b.FIRST_ORDERED_TIER)){b=11;break}case 12:p=G[v];if(null!=p){b=14;break}b=13;break;case 14:return b=16,{value:p,done:!1};case 16:if(void 0===x){b=17;break}b=-1;throw x;case 17:case 15:b=12;break;case 13:case 10:--v;b=9;break;case 11:b=2;break;case 1:e=h.heapRoots,
u=k.b.FIRST_ORDERED_TIER;case 18:if(!(u<=k.b.LAST_ORDERED_TIER)){b=20;break}case 21:l=e[u];if(null!=l){b=23;break}b=22;break;case 23:return b=25,{value:l,done:!1};case 25:if(void 0===x){b=26;break}b=-1;throw x;case 26:case 24:b=21;break;case 22:case 19:++u;b=18;break;case 20:m=h,g=m.linkedListOperations,c=m.recentHead;case 27:d=g.front(c);if(null!=d){b=29;break}b=28;break;case 29:return b=31,{value:d,done:!1};case 31:if(void 0===x){b=32;break}b=-1;throw x;case 32:case 30:b=27;break;case 28:case 2:b=
-1;default:return{value:void 0,done:!0}}}var b=0,d,c,g,m,l,u,e,p,v,G,f,t,r,z,H,h=this,C={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();C[Symbol.iterator]=function(){return this};return C}},{key:"delete",value:function(a){var b=a.priorityTier;if(b===k.b.RECENT)this.linkedListOperations.pop(a);else{var d=this.heapRoots;d[b]=this.heapOperations.remove(d[b],a)}}}]);return b}(),z=function(l){function x(b,
c){a(this,x);b=e(this,(x.__proto__||Object.getPrototypeOf(x)).call(this,b,c));b.queuedPromotionQueue=d(B.priorityGreater);b.downloadEvictionQueue=d(B.priorityLess);b.systemMemoryEvictionQueue=new C(new p.a(B.priorityLess),m.a);b.gpuMemoryPromotionQueue=d(B.priorityGreater);b.gpuMemoryEvictionQueue=d(B.priorityLess);b.updatePending=null;b.numQueued=0;b.numFailed=0;b.gpuMemoryCapacity=k.c.fromObject(c.gpuMemoryCapacity);b.systemMemoryCapacity=k.c.fromObject(c.systemMemoryCapacity);b.downloadCapacity=
k.c.fromObject(c.downloadCapacity);return b}c(x,l);q(x,[{key:"scheduleUpdate",value:function(){null===this.updatePending&&(this.updatePending=setTimeout(this.process.bind(this),0))}},{key:"chunkQueuesForChunk",value:function(a){function b(b,l){for(;;)switch(d){case 0:g=!1;c=a.state;if(!g&&c!==k.a.QUEUED){d=2;break}g=!0;d=3;return{value:m.queuedPromotionQueue,done:!1};case 3:if(void 0===l){d=4;break}d=-1;throw l;case 4:d=1;break;case 2:if(!g&&c!==k.a.DOWNLOADING){d=5;break}g=!0;d=6;return{value:m.downloadEvictionQueue,
done:!1};case 6:if(void 0===l){d=7;break}d=-1;throw l;case 7:return d=8,{value:m.systemMemoryEvictionQueue,done:!1};case 8:if(void 0===l){d=9;break}d=-1;throw l;case 9:d=1;break;case 5:if(g||c===k.a.SYSTEM_MEMORY_WORKER)g=!0;if(!g&&c!==k.a.SYSTEM_MEMORY){d=10;break}g=!0;d=11;return{value:m.systemMemoryEvictionQueue,done:!1};case 11:if(void 0===l){d=12;break}d=-1;throw l;case 12:if(a.priorityTier===k.b.RECENT||a.backendOnly){d=13;break}d=14;return{value:m.gpuMemoryPromotionQueue,done:!1};case 14:if(void 0===
l){d=15;break}d=-1;throw l;case 15:case 13:d=1;break;case 10:if(!g&&c!==k.a.GPU_MEMORY){d=16;break}g=!0;d=17;return{value:m.systemMemoryEvictionQueue,done:!1};case 17:if(void 0===l){d=18;break}d=-1;throw l;case 18:return d=19,{value:m.gpuMemoryEvictionQueue,done:!1};case 19:if(void 0===l){d=20;break}d=-1;throw l;case 20:d=1;break;case 16:case 1:d=-1;default:return{value:void 0,done:!0}}}var d=0,c,g,m=this,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}},{key:"adjustCapacitiesForChunk",value:function(a,b){b=b?-1:1;switch(a.state){case k.a.FAILED:this.numFailed-=b;break;case k.a.QUEUED:this.numQueued-=b;break;case k.a.DOWNLOADING:this.downloadCapacity.adjust(b,0);this.systemMemoryCapacity.adjust(b,0);break;case k.a.SYSTEM_MEMORY:case k.a.SYSTEM_MEMORY_WORKER:this.systemMemoryCapacity.adjust(b,b*a.systemMemoryBytes);break;case k.a.GPU_MEMORY:this.systemMemoryCapacity.adjust(b,
b*a.systemMemoryBytes),this.gpuMemoryCapacity.adjust(b,b*a.gpuMemoryBytes)}}},{key:"removeChunkFromQueues_",value:function(a){for(var b=$jscomp.makeIterator(this.chunkQueuesForChunk(a)),d=b.next();!d.done;d=b.next())d.value.delete(a)}},{key:"addChunkToQueues_",value:function(a){if(a.state===k.a.QUEUED&&a.priorityTier===k.b.RECENT)return a.source.removeChunk(a),this.adjustCapacitiesForChunk(a,!1),!1;for(var b=$jscomp.makeIterator(this.chunkQueuesForChunk(a)),d=b.next();!d.done;d=b.next())d.value.add(a);
return!0}},{key:"performChunkPriorityUpdate",value:function(a){a.priorityTier===a.newPriorityTier&&a.priority===a.newPriority?(a.newPriorityTier=k.b.RECENT,a.newPriority=Number.NEGATIVE_INFINITY):(this.removeChunkFromQueues_(a),a.updatePriorityProperties(),a.state===k.a.NEW&&(a.state=k.a.QUEUED,this.adjustCapacitiesForChunk(a,!0)),this.addChunkToQueues_(a))}},{key:"updateChunkState",value:function(a,b){b!==a.state&&(this.adjustCapacitiesForChunk(a,!1),this.removeChunkFromQueues_(a),a.state=b,this.adjustCapacitiesForChunk(a,
!0),this.addChunkToQueues_(a),this.scheduleUpdate())}},{key:"processGPUPromotions_",value:function(){function a(a){b.freeChunkGPUMemory(a);a.source.chunkManager.queueManager.updateChunkState(a,k.a.SYSTEM_MEMORY)}for(var b=this,d=this.gpuMemoryPromotionQueue.candidates(),c=this.gpuMemoryEvictionQueue.candidates(),m=this.gpuMemoryCapacity;;){var l=d.next().value;if(void 0===l)break;else{if(!g(l.gpuMemoryBytes,m,l.priorityTier,l.priority,c,a))break;this.copyChunkToGPU(l);this.updateChunkState(l,k.a.GPU_MEMORY)}}}},
{key:"freeChunkGPUMemory",value:function(a){this.rpc.invoke("Chunk.update",{id:a.key,state:k.a.SYSTEM_MEMORY,source:a.source.rpcId})}},{key:"freeChunkSystemMemory",value:function(a){a.state===k.a.SYSTEM_MEMORY_WORKER?a.freeSystemMemory():this.rpc.invoke("Chunk.update",{id:a.key,state:k.a.EXPIRED,source:a.source.rpcId})}},{key:"copyChunkToGPU",value:function(a){var b=this.rpc;if(a.state===k.a.SYSTEM_MEMORY)b.invoke("Chunk.update",{id:a.key,source:a.source.rpcId,state:k.a.GPU_MEMORY});else{var d={},
c=[];a.serialize(d,c);d.state=k.a.GPU_MEMORY;b.invoke("Chunk.update",d,c)}}},{key:"processQueuePromotions_",value:function(){function a(a){switch(a.state){case k.a.DOWNLOADING:var b=a.downloadCancellationToken;a.downloadCancellationToken=void 0;b.cancel();break;case k.a.GPU_MEMORY:d.freeChunkGPUMemory(a);case k.a.SYSTEM_MEMORY_WORKER:case k.a.SYSTEM_MEMORY:d.freeChunkSystemMemory(a)}a.source.chunkManager.queueManager.updateChunkState(a,k.a.QUEUED)}for(var d=this,c=this.queuedPromotionQueue.candidates(),
l=this.downloadEvictionQueue.candidates(),m=this.systemMemoryEvictionQueue.candidates(),x=this.downloadCapacity,u=this.systemMemoryCapacity;;){var e=c.next();if(e.done)break;var e=e.value,p=e.priorityTier,v=e.priority;if(!g(0,x,p,v,l,a))break;if(!g(0,u,p,v,m,a))break;this.updateChunkState(e,k.a.DOWNLOADING);b(e)}}},{key:"process",value:function(){this.updatePending&&(this.updatePending=null,this.processGPUPromotions_(),this.processQueuePromotions_(),this.logStatistics())}},{key:"logStatistics",value:function(){}}]);
return x}(D.b),z=n([f.i(D.a)(k.d)],z);h.RECOMPUTE_CHUNK_PRIORITIES_LAST=-1E3;var G=function(b){function d(b,c){a(this,d);var g=e(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,b,c));g.existingTierChunks=[];g.newTierChunks=[];g.updatePending=null;g.recomputeChunkPriorities=new y.b;g.recomputeChunkPrioritiesLate=new y.b;g.memoize=new u.a;g.queueManager=b.get(c.chunkQueueManager).addRef();for(b=k.b.FIRST_TIER;b<=k.b.LAST_TIER;++b)b!==k.b.RECENT&&(g.existingTierChunks[b]=[]);return g}c(d,b);q(d,
[{key:"scheduleUpdateChunkPriorities",value:function(){null===this.updatePending&&(this.updatePending=setTimeout(this.recomputeChunkPriorities_.bind(this),0))}},{key:"recomputeChunkPriorities_",value:function(){this.updatePending=null;this.recomputeChunkPriorities.dispatch();this.recomputeChunkPrioritiesLate.dispatch();this.updateQueueState([k.b.VISIBLE])}},{key:"requestChunk",value:function(a,b,d){a.newPriorityTier===k.b.RECENT&&this.newTierChunks.push(a);a.newPriorityTier=b;a.newPriority=d}},{key:"updateQueueState",
value:function(a){var b=this.existingTierChunks,d=this.queueManager;a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next()){for(var g=b[c.value],l=$jscomp.makeIterator(g),c=l.next();!c.done;c=l.next())c=c.value,c.newPriorityTier===k.b.RECENT&&d.performChunkPriorityUpdate(c);g.length=0}a=this.newTierChunks;g=$jscomp.makeIterator(a);for(c=g.next();!c.done;c=g.next())c=c.value,d.performChunkPriorityUpdate(c),b[c.priorityTier].push(c);a.length=0;this.queueManager.scheduleUpdate()}}]);return d}(D.b),
G=n([f.i(D.a)(k.e)],G)},function(n,h,f){function e(a,b){var d=Math.abs(a[b]),c=Math.abs(a[b+1]),k=Math.abs(a[b+2]),m=Math.max(d,c,k);1E-4>d/m&&(a[b]=0);1E-4>c/m&&(a[b+1]=0);1E-4>k/m&&(a[b+2]=0)}var c=f(38);f.n(c);f.o(c,"mat4")&&f.d(h,"b",function(){return c.mat4});f.o(c,"quat")&&f.d(h,"c",function(){return c.quat});f.o(c,"vec3")&&f.d(h,"a",function(){return c.vec3});h.d=function(a){return a[0]*a[1]*a[2]};h.l=function(a){return a[0]+","+a[1]+","+a[2]};h.e=function(a){e(a,0);e(a,4);e(a,8)};h.g=function(a,
b,d){var c=b[0],k=b[1];b=b[2];a[0]=d[0]*c+d[4]*k+d[8]*b;a[1]=d[1]*c+d[5]*k+d[9]*b;a[2]=d[2]*c+d[6]*k+d[10]*b;return a};h.j=function(a,b){var d=b[0],c=b[1],k=b[2],m=b[4],l=b[5],u=b[6],e=b[8],v=b[9];b=b[10];a[0]=Math.sqrt(d*d+c*c+k*k);a[1]=Math.sqrt(m*m+l*l+u*u);a[2]=Math.sqrt(e*e+v*v+b*b);return a};n=c.mat4.create();h.i=n;n=[c.vec3.fromValues(1,0,0),c.vec3.fromValues(0,1,0),c.vec3.fromValues(0,0,1)];h.h=n;n=c.vec3.fromValues(0,0,0);h.f=n;c.vec3.fromValues(1,1,1);n=c.vec3.fromValues(Infinity,Infinity,
Infinity);h.k=n;c.quat.create()},function(n,h){var f={EPSILON:1E-6};f.ARRAY_TYPE="undefined"!==typeof Float32Array?Float32Array:Array;f.RANDOM=Math.random;f.ENABLE_SIMD=!1;f.SIMD_AVAILABLE=f.ARRAY_TYPE===Float32Array&&"SIMD"in this;f.USE_SIMD=f.ENABLE_SIMD&&f.SIMD_AVAILABLE;f.setMatrixArrayType=function(c){f.ARRAY_TYPE=c};var e=Math.PI/180;f.toRadian=function(c){return c*e};f.equals=function(c,a){return Math.abs(c-a)<=f.EPSILON*Math.max(1,Math.abs(c),Math.abs(a))};n.exports=f},function(n,h,f){function e(a,
b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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(h,"__esModule",{value:!0});n=f(1);var b=f(6),d=f(17),g=f(2),k=f(0),m=f(15);f.d(h,"SliceView",function(){return y});f.d(h,"VolumeChunk",function(){return D});f.d(h,"VolumeChunkSource",function(){return q});f.d(h,"RenderLayer",function(){return B});f.d(h,"ParameterizedVolumeChunkSource",function(){return t});var l=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}}(),u=function C(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 C(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===
typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var m=a.length-1;0<=m;m--)if(l=a[m])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var p=g.a.create(),v=g.a.create(),r=g.a.create(),y=function(d){function k(a,b){e(this,k);var d=c(this,(k.__proto__||Object.getPrototypeOf(k)).call(this));d.handleLayerChanged=function(){d.hasValidViewport&&d.chunkManager.scheduleUpdateChunkPriorities()};d.initializeSharedObject(a,b.id);d.chunkManager=
d.registerDisposer(a.get(b.chunkManager).addRef());d.registerDisposer(d.chunkManager.recomputeChunkPriorities.add(function(){d.updateVisibleChunks()}));return d}a(k,d);l(k,[{key:"onViewportChanged",value:function(){this.chunkManager.scheduleUpdateChunkPriorities()}},{key:"updateVisibleChunks",value:function(){var a=this,d=this.centerDataPosition,c=this.chunkManager;this.computeVisibleChunks(function(b){b.globalToLocalSpatial(r,d);return a.visibleChunkLayouts.get(b)},function(a,d,k,l){g.a.multiply(p,
k,a.size);a=-g.a.distance(r,p);l=$jscomp.makeIterator(l);for(var m=l.next();!m.done;m=l.next()){var x=m.value,m=d.get(x),x=x.getChunk(k);c.requestChunk(x,b.b.VISIBLE,-1E12+a+1E9*m)}})}},{key:"removeVisibleLayer",value:function(a){this.visibleLayers.delete(a);a.layerChanged.remove(this.handleLayerChanged);this.visibleSourcesStale=!0;this.hasValidViewport&&this.chunkManager.scheduleUpdateChunkPriorities()}},{key:"disposed",value:function(){for(var a=$jscomp.makeIterator(this.visibleLayers.keys()),b=
a.next();!b.done;b=a.next())this.removeVisibleLayer(b.value);u(k.prototype.__proto__||Object.getPrototypeOf(k.prototype),"disposed",this).call(this)}}]);return k}(d.c),y=h([f.i(k.a)(d.d)],y);f.i(k.d)("SliceView.updateView",function(a){var b=this.get(a.id);a.width&&b.setViewportSize(a.width,a.height);a.viewportToData&&b.setViewportToDataMatrix(a.viewportToData)});f.i(k.d)("SliceView.addVisibleLayer",function(a){var b=this.get(a.id);a=this.get(a.layerId);b.visibleLayers.set(a,[]);a.layerChanged.add(b.handleLayerChanged);
b.visibleSourcesStale=!0;b.hasValidViewport&&b.chunkManager.scheduleUpdateChunkPriorities()});f.i(k.d)("SliceView.removeVisibleLayer",function(a){var b=this.get(a.id);a=this.get(a.layerId);b.removeVisibleLayer(a)});var D=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));a.source=null;a.chunkGridPosition=g.a.create();return a}a(d,b);l(d,[{key:"initializeVolumeChunk",value:function(a,b){u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initialize",
this).call(this,a);a=this.source;g.a.copy(this.chunkGridPosition,b);this.gpuMemoryBytes=this.systemMemoryBytes=a.spec.chunkBytes;this.data=this.chunkDataSize=null}},{key:"serialize",value:function(a,b){u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"serialize",this).call(this,a,b);var c=a.data=this.data,g=this.chunkDataSize;g!==this.source.spec.chunkDataSize&&(a.chunkDataSize=g);a.chunkGridPosition=this.chunkGridPosition;b.push(c.buffer);this.data=null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=
this.gpuMemoryBytes=this.data.byteLength;u(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"downloadSucceeded",this).call(this)}},{key:"freeSystemMemory",value:function(){this.data=null}},{key:"toString",value:function(){return this.source.toString()+":"+f.i(g.l)(this.chunkGridPosition)}}]);return d}(n.Chunk),q=function(b){function k(a,b){e(this,k);a=c(this,(k.__proto__||Object.getPrototypeOf(k)).call(this,a,b));a.spec=d.e.fromObject(b.spec);return a}a(k,b);l(k,[{key:"getChunk",value:function(a){var b=
f.i(g.l)(a),d=this.chunks.get(b);void 0===d&&(d=this.getNewChunk_(D),d.initializeVolumeChunk(b,a),this.addChunk(d));return d}},{key:"computeChunkBounds",value:function(a){for(var b=this.spec,d=b.upperVoxelBound,b=b.chunkDataSize,c=g.a.multiply(p,a.chunkGridPosition,b),k=!1,l=0;3>l;++l)(v[l]=Math.min(d[l],c[l]+b[l])-c[l])!==b[l]&&(k=!0);g.a.add(c,c,this.spec.baseVoxelOffset);a.chunkDataSize=k?g.a.clone(v):b;return c}}]);return k}(n.ChunkSource),B=function(b){function d(a,b){e(this,d);var g=c(this,
(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));g.layerChanged=new m.b;var k=g.sources=[];b=$jscomp.makeIterator(b.sources);for(var l=b.next();!l.done;l=b.next()){var u=l.value,l=[];k.push(l);for(var u=$jscomp.makeIterator(u),p=u.next();!p.done;p=u.next())p=a.get(p.value),g.registerDisposer(p.addRef()),l.push(p)}return g}a(d,b);return d}(k.b),B=h([f.i(k.a)(d.f)],B),t=function(b){function d(a,b){e(this,d);a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));a.parameters=b.parameters;
return a}a(d,b);return d}(q)},function(n,h,f){n="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Int32Array;h.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var d=b.shift();if(d){if("object"!==typeof d)throw new TypeError(d+"must be non-object");for(var c in d)d.hasOwnProperty(c)&&(a[c]=d[c])}}return a};h.shrinkBuf=function(a,b){if(a.length===b)return a;if(a.subarray)return a.subarray(0,b);a.length=b;return a};var e={arraySet:function(a,
b,d,c,k){if(b.subarray&&a.subarray)a.set(b.subarray(d,d+c),k);else for(var g=0;g<c;g++)a[k+g]=b[d+g]},flattenChunks:function(a){var b,d,c,k,m;b=c=0;for(d=a.length;b<d;b++)c+=a[b].length;m=new Uint8Array(c);b=c=0;for(d=a.length;b<d;b++)k=a[b],m.set(k,c),c+=k.length;return m}},c={arraySet:function(a,b,d,c,k){for(var g=0;g<c;g++)a[k+g]=b[d+g]},flattenChunks:function(a){return[].concat.apply([],a)}};h.setTyped=function(a){a?(h.Buf8=Uint8Array,h.Buf16=Uint16Array,h.Buf32=Int32Array,h.assign(h,e)):(h.Buf8=
Array,h.Buf16=Array,h.Buf32=Array,h.assign(h,c))};h.setTyped(n)},function(n,h,f){f.d(h,"a",function(){return c});f.d(h,"b",function(){return a});f.d(h,"c",function(){return b});var e=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}}(),c;(function(a){a[a.GPU_MEMORY=0]="GPU_MEMORY";a[a.SYSTEM_MEMORY=1]="SYSTEM_MEMORY";
a[a.SYSTEM_MEMORY_WORKER=2]="SYSTEM_MEMORY_WORKER";a[a.DOWNLOADING=3]="DOWNLOADING";a[a.QUEUED=4]="QUEUED";a[a.NEW=5]="NEW";a[a.FAILED=6]="FAILED";a[a.EXPIRED=7]="EXPIRED"})(c||(c={}));var a;(function(a){a[a.FIRST_TIER=0]="FIRST_TIER";a[a.FIRST_ORDERED_TIER=0]="FIRST_ORDERED_TIER";a[a.VISIBLE=0]="VISIBLE";a[a.PREFETCH=1]="PREFETCH";a[a.LAST_ORDERED_TIER=1]="LAST_ORDERED_TIER";a[a.RECENT=2]="RECENT";a[a.LAST_TIER=2]="LAST_TIER"})(a||(a={}));var b=function(){function a(b,d){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");
this.itemCapacity=this.availableItems=b;this.sizeCapacity=this.availableSize=d}e(a,[{key:"adjust",value:function(a,b){this.availableItems+=a;this.availableSize+=b}},{key:"toString",value:function(){return this.availableItems+"/"+this.itemCapacity+" items, "+this.availableSize+"/"+this.sizeCapacity+" size"}},{key:"toObject",value:function(){return{itemCapacity:this.itemCapacity,sizeCapacity:this.sizeCapacity}}}],[{key:"fromObject",value:function(b){return new a(b.itemCapacity,b.sizeCapacity)}}]);return a}();
b.INFINITE=new b(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);h.d="ChunkQueueManager";h.e="ChunkManager"},function(n,h,f){f.d(h,"b",function(){return e});h.d=function(a,b,d){d=void 0===d?c:d;if(b!==d)for(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),b=0,d=a.length;b<d;b+=2){var g=a[b];a[b]=a[b+1];a[b+1]=g}};h.a=function(a,b,d){d=void 0===d?c:d;if(b!==d)for(a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength),b=0,d=a.length;b<d;b+=4){var g=a[b];a[b]=a[b+3];a[b+3]=g;g=a[b+1];a[b+1]=a[b+
2];a[b+2]=g}};var e;(function(a){a[a.LITTLE=0]="LITTLE";a[a.BIG=1]="BIG"})(e||(e={}));var c=function(){var a=Uint16Array.of(4386);return 17===(new Uint8Array(a.buffer))[0]?e.BIG:e.LITTLE}();h.c=c},function(n,h,f){function e(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 c=f(81),a=f(14);f.d(h,"d",function(){return k});h.b=function(a,b){b=void 0===b?"GET":b;var c=new XMLHttpRequest;c[g]=b;c[d]=a;c.open(b,a);return c};h.c=function(a,b,k){k=void 0===k?"GET":k;var l=new XMLHttpRequest;if(Array.isArray(a)){var m=a.length,m=1===m?0:Math.abs(f.i(c.a)(b))%m;a=a[m]+b}else a+=b;l[g]=k;l[d]=a;l.open(k,a);return l};h.a=function(b,d,c){c=void 0===c?a.c:c;b.responseType=d;return new Promise(function(a,d){var g=function(){b.abort()};c.add(g);b.onloadend=function(){var l=
this.status;c.remove(g);200<=l&&300>l?a(this.response):d(k.fromXhr(b))};b.send()})};var b=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}}();$jscomp.initSymbol();var d=Symbol("url");$jscomp.initSymbol();var g=Symbol("method"),k=function(a){function c(a,b,d,g){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");
var k=a+" "+JSON.stringify(b)+" resulted in HTTP error "+d;g&&(k+=": "+g);var k=k+".",l;l=(c.__proto__||Object.getPrototypeOf(c)).call(this,k);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");l=!l||"object"!==typeof l&&"function"!==typeof l?this:l;l.name="HttpError";l.message=k;l.method=a;l.url=b;l.code=d;l.statusMessage=g;return l}e(c,a);b(c,null,[{key:"fromXhr",value:function(a){return new c(a[g],a[d],a.status,a.statusText)}}]);return c}(Error)},function(n,
h,f){var e=f(22),c=f(77);h.a=function(a,b){f.i(e.a)(a,f.i(c.a)(new Uint8Array(b),a.chunkDataSize,a.source.spec.numChannels))}},function(n,h,f){var e=f(22),c=f(11),a=f(7),b=f(2);h.a=function(d,g,k){k=void 0===k?a.c:k;var m=d.source.spec,l=m.dataType,u=f.i(b.d)(d.chunkDataSize),p=c.b[l],m=u*p*m.numChannels;if(m!==g.byteLength)throw Error("Raw-format chunk is "+g.byteLength+" bytes, but "+u+" * "+p+" = "+m+" bytes are expected.");switch(l){case c.a.UINT8:g=new Uint8Array(g);break;case c.a.UINT16:g=new Uint16Array(g);
f.i(a.d)(g,k);break;case c.a.UINT32:case c.a.UINT64:g=new Uint32Array(g);f.i(a.a)(g,k);break;case c.a.FLOAT32:g=new Float32Array(g);f.i(a.a)(g,k);break;default:throw Error("Unexpected data type: "+l+".");}f.i(e.a)(d,g)}},function(n,h,f){f.d(h,"a",function(){return e});var e;(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"})(e||(e={}));n=[];h.b=n;n[e.UINT8]=1;n[e.UINT16]=2;n[e.UINT32]=4;n[e.UINT64]=8;n[e.FLOAT32]=4},function(n,
h,f){function e(a){if("object"===typeof a){if(null===a)return"null";if(Array.isArray(a)){var b="[",d=a.length,c=0;if(c<d)for(b+=e(a[c]);++c<d;)b+=",",b+=e(a[c]);return b+"]"}var b="{",d=Object.keys(a).sort(),c=0,l=d.length;if(c<l)for(var u=d[c],b=b+JSON.stringify(u),b=b+":"+e(a[u]);++c<l;)b+=",",u=d[c],b+=JSON.stringify(u),b+=":",b+=e(a[u]);return b+"}"}return JSON.stringify(a)}function c(d){for(var c="";0<d.length;){var k=d.match(a),m;if(null===k)m=d,k=d="";else{m=d.substr(0,k.index);d=d.substr(k.index+
k[0].length);var l=k[1];if(void 0!==l){if(k=l,2<=k.length&&"'"===k.charAt(0)&&"'"===k.charAt(k.length-1)){k=k.substr(1,k.length-2);for(l='"';0<k.length;){var u=k.match(b);if(null===u){l+=k;break}l+=u[1];l+="\\";l+='"';k=k.substr(u.index+u[0].length)}k=l+'"'}}else k=k[2]}c+=m.replace(/\(/g,"[").replace(/\)/g,"]").replace("True","true").replace("False","false").replace(/,\s*([\}\]])/g,"$1");c+=k}return c}f(2);h.a=e;h.f=function(a){return JSON.parse(c(a))};h.e=function(a,b){if(!Array.isArray(a))throw Error("Expected array, but received: "+
JSON.stringify(a)+".");return a.map(b)};h.b=function(a){if("object"!==typeof a||null==a||Array.isArray(a))throw Error("Expected JSON object, but received: "+JSON.stringify(a)+".");return a};h.c=function(a,b,c){a=a.hasOwnProperty(b)?a[b]:void 0;try{return c(a)}catch(m){throw Error("Error parsing "+JSON.stringify(b)+" property: "+m.message);}};h.d=function(a){if(!Array.isArray(a))throw Error("Expected array, received: "+JSON.stringify(a)+".");for(var b=$jscomp.makeIterator(a),d=b.next();!d.done;d=b.next())if(d=
d.value,"string"!==typeof d)throw Error("Expected string, received: "+JSON.stringify(d)+".");return a};var a=new RegExp(/('(?:[^'\\]|(?:\\.))*')/.source+"|"+/("(?:[^'\\]|(?:\\.))*")/.source),b=/^((?:[^"'\\]|(?:\\.))*)"/},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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 b(a,b){for(var d=p.a.create(),c=p.a.create(),g=p.a.create(),k=new Float32Array(a.length),l=new Float32Array(a.length/3),m=b.length,u=0;u<m;u+=3)for(var e=0;3>e;++e)l[b[u+e]]+=1;for(u=0;u<m;u+=
3){for(var e=3*b[u],v=3*b[u+1],f=3*b[u+2],t=0;3>t;++t)c[t]=a[v+t]-a[e+t],g[t]=a[f+t]-a[v+t];p.a.cross(d,c,g);p.a.normalize(d,d);for(e=0;3>e;++e)for(f=b[u+e],v=1/l[f],f*=3,t=0;3>t;++t)k[f+t]+=v*d[t]}a=k.length;for(b=0;b<a;b+=3)d=k.subarray(b,3),p.a.normalize(d,d);return k}function d(a,b,d,c,g,k,l,m){var x=new Float32Array(d,g,3*k);f.i(u.a)(x,c);void 0===l&&(l=g+12*k);var e;void 0!==m&&(e=m*b);d=void 0===e?new Uint32Array(d,l):new Uint32Array(d,l,e);if(0!==d.length%b)throw Error("Number of indices is not a multiple of "+
b+": "+d.length+".");f.i(u.a)(d,c);a.vertexPositions=x;a.indices=d}var g=f(1),k=f(6);n=f(68);var m=f(32),l=f(21),u=f(7),p=f(2),v=f(12),r=f(16),y=f(0);h.e=function(a,b,d){f.i(v.b)(b);a.fragmentIds=f.i(v.c)(b,d,v.d)};h.a=b;h.d=d;h.b=function(a,c,g,k,l,m,u){d(a,3,c,g,k,l,m,u);a.vertexNormals=b(a.vertexPositions,a.indices)};f.d(h,"c",function(){return E});var 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}}(),q=function z(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 z(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&
"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var m=a.length-1;0<=m;m--)if(l=a[m])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var B=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));a.backendOnly=!0;a.objectId=new r.a;return a}a(d,b);D(d,[{key:"initializeManifestChunk",value:function(a,b){q(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initialize",this).call(this,a);this.objectId.assign(b)}},
{key:"freeSystemMemory",value:function(){this.fragmentIds=null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=100;q(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"downloadSucceeded",this).call(this);this.priorityTier===k.b.VISIBLE&&this.source.chunkManager.scheduleUpdateChunkPriorities()}},{key:"toString",value:function(){return this.objectId.toString()}}]);return d}(g.Chunk),t=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));
a.manifestChunk=null;a.fragmentId=null;a.vertexPositions=null;a.indices=null;a.vertexNormals=null;return a}a(d,b);D(d,[{key:"initializeFragmentChunk",value:function(a,b,c){q(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initialize",this).call(this,a);this.manifestChunk=b;this.fragmentId=c}},{key:"freeSystemMemory",value:function(){this.fragmentId=this.vertexPositions=this.indices=this.vertexNormals=this.manifestChunk=null}},{key:"serialize",value:function(a,b){q(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"serialize",this).call(this,a,b);a.objectKey=this.manifestChunk.key;var c=this.vertexPositions,g=this.indices,k=this.vertexNormals;a.vertexPositions=c;a.indices=g;a.vertexNormals=k;a=c.buffer;b.push(a);g=g.buffer;g!==a&&b.push(g);k=k.buffer;k!==a&&k!==g&&b.push(k);this.vertexPositions=this.indices=this.vertexNormals=null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.vertexPositions.byteLength+this.indices.byteLength+
this.vertexNormals.byteLength;q(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"downloadSucceeded",this).call(this)}}]);return d}(g.Chunk),E=function(b){function d(a,b){e(this,d);a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));a.parameters=b.parameters;return a}a(d,b);return d}(function(b){function d(a,b){e(this,d);var g=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));return(g.fragmentSource=g.registerDisposer(a.getRef(b.fragmentSource))).meshSource=g}a(d,
b);D(d,[{key:"getChunk",value:function(a){var b=f.i(l.a)(a),d=this.chunks.get(b);void 0===d&&(d=this.getNewChunk_(B),d.initializeManifestChunk(b,a),this.addChunk(d));return d}},{key:"getFragmentChunk",value:function(a,b){var d=a.key+"/"+b,c=this.fragmentSource,g=c.chunks.get(d);void 0===g&&(g=c.getNewChunk_(t),g.initializeFragmentChunk(d,a,b),c.addChunk(g));return g}}]);return d}(g.ChunkSource)),g=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));
a.meshSource=null;return a}a(d,b);D(d,[{key:"download",value:function(a,b){return this.meshSource.downloadFragment(a,b)}}]);return d}(g.ChunkSource),g=h([f.i(y.a)(n.a)],g),m=function(b){function d(a,b){e(this,d);var g=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));g.source=g.registerDisposer(a.getRef(b.source));g.registerDisposer(g.chunkManager.recomputeChunkPriorities.add(function(){g.updateChunkPriorities()}));return g}a(d,b);D(d,[{key:"updateChunkPriorities",value:function(){if(this.visible){var a=
this.source,b=this.chunkManager;f.i(l.b)(this,function(d){d=a.getChunk(d);b.requestChunk(d,k.b.VISIBLE,100);if(d.state===k.a.SYSTEM_MEMORY_WORKER)for(var c=$jscomp.makeIterator(d.fragmentIds),g=c.next();!g.done;g=c.next())g=a.getFragmentChunk(d,g.value),b.requestChunk(g,k.b.VISIBLE,50)})}}}]);return d}(m.a),m=h([f.i(y.a)(n.b)],m)},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}f.d(h,"d",function(){return d});h.a=function(a,c){return new Promise(function(g,
k){if(a===b)c(g,k,b);else{var l=new d,m=a.add(function(){l.cancel()});c(function(a){m();g(a)},function(a){m();k(a)},l)}})};var c=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}}();n=new (function(){function a(){e(this,a);this.name="CancellationError";this.message="CANCELED"}c(a,[{key:"toString",value:function(){return"CANCELED"}}]);
return a}());h.b=n;var a=function(){},b={isCanceled:!1,add:function(){return a},remove:a};h.c=b;var d=function(){function b(){e(this,b)}c(b,[{key:"cancel",value:function(){var a=this.handlers;if(null!==a&&(this.handlers=null,void 0!==a))for(var a=$jscomp.makeIterator(a),b=a.next();!b.done;b=a.next())b=b.value,b()}},{key:"add",value:function(b){var d=this,c=this.handlers;if(null===c)return b(),a;void 0===c&&(c=this.handlers=new Set);c.add(b);return function(){d.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}()},function(n,h,f){function e(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 c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");
}f.d(h,"a",function(){return b});f.d(h,"b",function(){return d});var a=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}}(),b=function(){function b(){c(this,b);this.handlers=new Set;this.count=0;var a=this;this.dispatch=function(){var b=this,d=arguments;++a.count;a.handlers.forEach(function(a){a.apply(b,d)})}}
a(b,[{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 b}(),d=function(a){function b(){c(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}e(b,
a);return b}(b)},function(n,h,f){f.d(h,"a",function(){return k});var e=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}}(),c=new Uint32Array(2),a=[];for(n=2;36>=n;++n){h=Math.floor(32/Math.log2(n));f=Math.pow(n,h);var b=Math.floor(h/2),d=Math.pow(n,b),b=Math.pow(n,h-b),g="^[0-"+String.fromCharCode(48+Math.min(9,
n-1));10<n&&(g+="a-"+String.fromCharCode(97+n-11),g+="A-"+String.fromCharCode(65+n-11));g+="]{1,"+Math.ceil(64/Math.log2(n))+"}$";a[n]={lowDigits:h,lowBase:f,lowBase1:d,lowBase2:b,pattern:new RegExp(g)}}var k=function(){function b(a,d){a=void 0===a?0:a;d=void 0===d?0:d;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");this.low=a;this.high=d}e(b,[{key:"clone",value:function(){return new b(this.low,this.high)}},{key:"assign",value:function(a){this.low=a.low;this.high=
a.high}},{key:"toString",value:function(b){b=void 0===b?10:b;var d=this.low,c=this.high;if(0===c)return d.toString(b);var c=4294967296*c,g=a[b],k=g.lowBase,g=g.lowDigits,l=c%k,c=Math.floor(c/k),d=d+l,c=c+Math.floor(d/k),d=(d%k).toString(b);return c.toString(b)+"0".repeat(g-d.length)+d}},{key:"tryParseString",value:function(b,d){d=void 0===d?10:d;var c=a[d],g=c.lowDigits,k=c.lowBase,l=c.lowBase1,m=c.lowBase2;if(!c.pattern.test(b))return!1;if(b.length<=g)return this.low=parseInt(b,d),this.high=0,!0;
g=b.length-g;c=parseInt(b.substr(g),d);b=parseInt(b.substr(0,g),d);k=Math.floor(b*k/4294967296);l=c+b%4294967296*l%4294967296*m%4294967296;4294967296<l&&(++k,l-=4294967296);if(l>>>0!==l||k>>>0!==k)return!1;this.low=l;this.high=k;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:"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(a,d){return b.less(a,d)?a:d}},{key:"random",value:function(){crypto.getRandomValues(c);return new b(c[0],c[1])}},{key:"parseString",value:function(a,d){d=void 0===d?10:d;return(new b).parseString(a,
d)}}]);return b}();k.ZERO=new k(0,0)},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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,d){for(var c=0;3>c;++c)a[c]=
Number.POSITIVE_INFINITY,b[c]=Number.NEGATIVE_INFINITY;d=$jscomp.makeIterator(d);for(c=d.next();!c.done;c=d.next())for(var g=c.value.spec,c=g.lowerChunkBound,g=g.upperChunkBound,k=0;3>k;++k)a[k]=Math.min(a[k],c[k]),b[k]=Math.max(b[k],g[k])}function b(a,b,d,c){for(var g=q.FULLY_INSIDE,k=0;3>k;++k){var l;l=a[k];var m=b[k],x=d[k],e=c[k];l=l>=e||m<=x?q.FULLY_OUTSIDE:l>=x&&m<=e?q.FULLY_INSIDE:q.PARTIALLY_INSIDE;switch(l){case q.FULLY_OUTSIDE:return l;case q.PARTIALLY_INSIDE:g=l}}return g}function d(a,
b){var d=b.length,c=0;if(1<d)for(var g=0,k=0;k<d;++k){var l=b[k].spec.chunkLayout,m;m=l.size;for(var l=l.globalToLocalSpatialVector(D,a),e=0,u=0,p=1,v=0;3>v;++v)var f=m[v],p=p*f,f=f*l[v],e=Math.min(e,f),u=Math.max(u,f);m=p/(u-e);m>g&&(g=m,c=k)}return b[c]}function g(a){var b=a.voxelSize,d=void 0===a.lowerVoxelBound?r.f:a.lowerVoxelBound,c=a.upperVoxelBound,g=void 0===a.maxVoxelsPerChunkLog2?18:a.maxVoxelsPerChunkLog2;a=void 0===a.transform?r.i:a.transform;a=f.i(r.j)(r.a.create(),a);b=r.a.multiply(a,
a,b);a=r.a.fromValues(1,1,1);var k;if(void 0===c)k=r.k;else{k=r.a.create();for(var l=0;3>l;++l)k[l]=Math.pow(2,Math.floor(Math.log2(c[l]-d[l])))}for(d=0;d<g;++d){for(var c=Infinity,l=-1,m=0;3>m;++m)if(!(a[m]>=k[m])){var e=a[m]*b[m];e<c&&(c=e,l=m)}c=l;if(-1===c)break;a[c]*=2}return a}function k(a,b){b=b.transform;return void 0===b?void 0===a?r.i:a:void 0===a?b:r.b.multiply(r.b.create(),b,a)}function m(a){if(void 0!==a.chunkDataSizes)return a.chunkDataSizes;var b=void 0===a.chunkLayoutPreference?C.ISOTROPIC:
a.chunkLayoutPreference;switch(b){case C.ISOTROPIC:return[g(a)];case C.FLAT:for(var b=[],d=0;3>d;++d){var c=d,k;k=a.lowerVoxelBound;var l=a.upperVoxelBound,m=d,e=a.voxelSize,u=a.maxVoxelsPerChunkLog2,p=a.transform;r.a.subtract(D,void 0===l?r.k:l,void 0===k?r.f:k);D[m]=1;k=g({voxelSize:e,upperVoxelBound:D,maxVoxelsPerChunkLog2:u,transform:p});b[c]=k}b.push(g(a));return b}throw Error("Invalid chunk layout preference: "+b+".");}var l=f(74),u=f(19),p=f(79),v=f(11),r=f(2);n=f(0);f.d(h,"a",function(){return v.a});
f.d(h,"c",function(){return t});f.d(h,"b",function(){return E});f.d(h,"e",function(){return z});var 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}}(),D=r.a.create(),q;(function(a){a[a.FULLY_OUTSIDE=0]="FULLY_OUTSIDE";a[a.FULLY_INSIDE=1]="FULLY_INSIDE";a[a.PARTIALLY_INSIDE=2]="PARTIALLY_INSIDE"})(q||(q={}));
var B=[r.a.create(),r.a.create(),r.a.create(),r.a.create()],t=function(g){function k(){e(this,k);var a;a=(k.__proto__||Object.getPrototypeOf(k)).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=r.b.create();a.viewportAxes=[r.a.create(),r.a.create(),r.a.create()];a.previousViewportAxes=[r.a.create(),r.a.create()];
a.centerDataPosition=r.a.create();a.viewportPlaneDistanceToOrigin=0;a.visibleChunkLayouts=new Map;a.visibleLayers=new Map;a.visibleSourcesStale=!0;a.pixelSize=0;r.b.identity(a.viewportToData);return a}c(k,g);y(k,[{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,b){return a!==this.width||b!==this.height?(this.width=a,this.height=b,this.maybeSetHasValidViewport(),!0):!1}},{key:"setViewportToDataMatrix",value:function(a){if(this.hasViewportToData&&r.b.equals(this.viewportToData,a))return!1;this.hasViewportToData=!0;var b=this.viewportToData;r.b.copy(b,a);f.i(r.e)(b);r.a.transformMat4(this.centerDataPosition,r.f,a);a=0;for(var d=this.viewportAxes,c=this.previousViewportAxes,g=0;3>g;++g){var k=d[g];
f.i(r.g)(k,r.h[g],b);0===g&&(a=r.a.length(k));r.a.normalize(k,k)}this.viewportAxes=d;this.previousViewportAxes=c;if(!f.i(p.a)(a,this.pixelSize)||.95>r.a.dot(d[0],c[0])||.95>r.a.dot(d[1],c[1]))r.a.copy(c[0],d[0]),r.a.copy(c[1],d[1]),this.visibleSourcesStale=!0,this.pixelSize=a;this.viewportPlaneDistanceToOrigin=r.a.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,b=this.visibleChunkLayouts,c=this.viewportAxes[2],g=this.visibleLayers;b.clear();for(var k={},g=$jscomp.makeIterator(g),l=g.next();!l.done;k={smallestVoxelSize:k.smallestVoxelSize,visibleSources:k.visibleSources},l=g.next()){var l=$jscomp.makeIterator(l.value),m=l.next().value;k.visibleSources=l.next().value;k.visibleSources.length=0;var l=m.sources,e=l.length,m=void 0;k.smallestVoxelSize=
l[0][0].spec.voxelSize;for(var u=function(b){return function(d){for(var c=0;3>c;++c){var g=d[c];if(g>a&&g>b.smallestVoxelSize[c])return!0}return!1}}(k),p=function(a){return function(d,c){a.visibleSources[a.visibleSources.length++]=d;var g=d.spec.chunkLayout,k=b.get(g);void 0===k&&(k=new Map,b.set(g,k));k.set(d,c)}}(k),m=e-1;;){e=d(c,l[m]);p(e,m);if(0===m||!u(e.spec.voxelSize))break;--m}k.visibleSources.reverse()}}}},{key:"computeVisibleChunks",value:function(d,c){var g=this;this.updateVisibleSources();
for(var k=this.width,l=this.height,m=this.viewportToData,x=0;3>x;++x)B[0][x]=-r.h[0][x]*k/2-r.h[1][x]*l/2,B[1][x]=-r.h[0][x]*k/2+r.h[1][x]*l/2,B[2][x]=r.h[0][x]*k/2-r.h[1][x]*l/2,B[3][x]=r.h[0][x]*k/2+r.h[1][x]*l/2;for(k=0;4>k;++k)r.a.transformMat4(B[k],B[k],m);var e=r.a.create(),p=r.a.create(),v=r.a.create(),t=r.a.create(),w=r.a.create(),h=r.a.create(),G=[],y=[];this.visibleChunkLayouts.forEach(function(k,l){function m(){for(var a=0,b=0,d=0;3>d;++d)var c=h[d],g=e[d],k=p[d]-g,l=w[d]*k,a=a+c*(g+l),
b=b+c*(g+k-l);return a<E?!1:b<=E}function x(a){function d(){H=f.i(u.b)(G,0,w,function(a){var d=a.spec;switch(b(e,p,d.lowerChunkBound,d.upperChunkBound)){case q.PARTIALLY_INSIDE:return!0;case q.FULLY_INSIDE:y.push(a);default:return!1}})}if(0!==y.length||0!==H){for(var g=1,k=0;3>k;++k)g*=Math.max(0,p[k]-e[k]);if(0!==g&&m())if(1===g)c(l,A,e,y);else{for(var v;;)if(g=e[a],k=p[a],v=k-g,1===v)a=(a+1)%3;else break;v=g+Math.floor(.5*v);var t=(a+1)%3,r=y.length;p[a]=v;var w=H;d();x(t);y.length=r;H=w;p[a]=k;
e[a]=v;d();x(t);e[a]=g;y.length=r;H=w}}}var A=d(l);a(v,t,k.keys());r.a.set(e,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY);r.a.set(p,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);l.globalToLocalSpatialVector(h,g.viewportAxes[2]);for(var z=0;3>z;++z)w[z]=0<h[z]?1:0;for(var E=r.a.dot(l.globalToLocalGrid(D,g.centerDataPosition),h),z=0;4>z;++z)for(var O=l.globalToLocalGrid(D,B[z]),C=0;3>C;++C)e[C]=Math.min(e[C],Math.floor(O[C])),p[C]=Math.max(p[C],
Math.floor(O[C])+1);r.a.max(e,e,v);r.a.min(p,p,t);y.length=0;G.length=0;k=$jscomp.makeIterator(k.keys());for(z=k.next();!z.done;z=k.next())switch(z=z.value,O=z.spec,b(e,p,O.lowerChunkBound,O.upperChunkBound)){case q.FULLY_INSIDE:y.push(z);break;case q.PARTIALLY_INSIDE:G.push(z)}var H=G.length;x(0)})}}]);return k}(n.e),E;(function(a){a[a.UNKNOWN=0]="UNKNOWN";a[a.IMAGE=1]="IMAGE";a[a.SEGMENTATION=2]="SEGMENTATION"})(E||(E={}));var C;(function(a){a[a.ISOTROPIC=0]="ISOTROPIC";a[a.FLAT=1]="FLAT"})(C||
(C={}));var z=function(){function a(b){e(this,a);var d=b.dataType,c=void 0===b.lowerVoxelBound?r.f:b.lowerVoxelBound,g=b.upperVoxelBound,k=b.chunkDataSize,m=b.voxelSize,u=b.transform,p=void 0===b.baseVoxelOffset?r.f:b.baseVoxelOffset,t=b.numChannels,h=void 0===b.lowerClipBound?r.a.multiply(r.a.create(),m,c):b.lowerClipBound,q=void 0===b.upperClipBound?r.a.multiply(r.a.create(),m,g):b.upperClipBound;this.dataType=b.dataType;this.numChannels=t;this.voxelSize=m;this.chunkDataSize=k;this.chunkLayout=
l.a.get(r.a.multiply(r.a.create(),b.chunkDataSize,m),u);this.chunkBytes=f.i(r.d)(b.chunkDataSize)*v.b[d]*t;this.lowerClipBound=h;this.upperClipBound=q;this.lowerVoxelBound=c;this.upperVoxelBound=g;this.baseVoxelOffset=p;d=this.lowerChunkBound=r.a.create();m=this.upperChunkBound=r.a.create();for(u=0;3>u;++u)d[u]=Math.floor(c[u]/k[u]),m[u]=Math.floor((g[u]-1)/k[u]+1);this.compressedSegmentationBlockSize=b.compressedSegmentationBlockSize}y(a,[{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(b){return new a(Object.assign({},b,{transform:k(b.transform,b.volumeSourceOptions)}))}},{key:"fromObject",value:function(b){return new a(b)}},
{key:"withDefaultCompression",value:function(b){var d=b.compressedSegmentationBlockSize,c=b.dataType,l=b.voxelSize,m=b.transform,e=b.lowerVoxelBound,u=b.upperVoxelBound,m=k(m,b.volumeSourceOptions);void 0!==d||b.volumeType!==E.SEGMENTATION||c!==v.a.UINT32&&c!==v.a.UINT64||(d=g({voxelSize:l,transform:m,lowerVoxelBound:e,upperVoxelBound:u,maxVoxelsPerChunkLog2:9}));return new a(Object.assign({},b,{compressedSegmentationBlockSize:d,transform:m}))}},{key:"getDefaults",value:function(b){var d=Object.assign({},
b,{transform:k(b.transform,b.volumeSourceOptions)});return(void 0===b.chunkDataSizes?m(d):b.chunkDataSizes).map(function(d){return a.withDefaultCompression(Object.assign({},b,{chunkDataSize:d}))})}}]);return a}();h.d="SliceView";h.f="sliceview/RenderLayer"},function(n,h,f){function e(c,a,b,d,g,k,m){for(var l=new Map,e=Array(3),p=2,v=0;3>v;++v)var f=e[v]=Math.ceil(d[v]/a[v]),p=p*f;var v=e[0],f=e[1],e=e[2],h=d[0],D=d[1];d=d[2];var q=a[0],B=a[1],t=a[2],E=c.length,C=E,z=[0,0,0];c.resize(E+p);for(var p=
k[0],G=k[1],H=k[2],x=0;x<e;++x){z[2]=Math.min(t,d-x*t);for(var w=0;w<f;++w){z[1]=Math.min(B,D-w*B);for(var L=0;L<v;++L){z[0]=Math.min(q,h-L*q);var O=c.length-E,n=$jscomp.makeIterator(m(b,g+(x*t*H+w*B*G+L*q*p),k,a,z,E,l,c)),F=n.next().value,n=n.next().value,I=c.data;I[C++]=n|F<<24;I[C++]=O}}}}h.a=function(c,a,b,d,g,k,m,l,e){var u;if(1===g)u=0;else for(u=1;1<<u<g;)u*=2;var v=Math.ceil(u*d/32),f=c.length,h=v,D=!1,q=Array.prototype.join.call(k.subarray(0,g*e),",");d=b.get(q);void 0===d&&(D=!0,h+=g*e,
d=f+v-a,b.set(q,d));c.resize(f+h);c=c.data;if(0<u)switch(u){case 1:for(a=b=0;b<v;++b)h=0,h|=l[m[a+0]]<<0,h|=l[m[a+1]]<<1,h|=l[m[a+2]]<<2,h|=l[m[a+3]]<<3,h|=l[m[a+4]]<<4,h|=l[m[a+5]]<<5,h|=l[m[a+6]]<<6,h|=l[m[a+7]]<<7,h|=l[m[a+8]]<<8,h|=l[m[a+9]]<<9,h|=l[m[a+10]]<<10,h|=l[m[a+11]]<<11,h|=l[m[a+12]]<<12,h|=l[m[a+13]]<<13,h|=l[m[a+14]]<<14,h|=l[m[a+15]]<<15,h|=l[m[a+16]]<<16,h|=l[m[a+17]]<<17,h|=l[m[a+18]]<<18,h|=l[m[a+19]]<<19,h|=l[m[a+20]]<<20,h|=l[m[a+21]]<<21,h|=l[m[a+22]]<<22,h|=l[m[a+23]]<<23,
h|=l[m[a+24]]<<24,h|=l[m[a+25]]<<25,h|=l[m[a+26]]<<26,h|=l[m[a+27]]<<27,h|=l[m[a+28]]<<28,h|=l[m[a+29]]<<29,h|=l[m[a+30]]<<30,h|=l[m[a+31]]<<31,c[f+b]=h,a+=32;break;case 2:for(a=b=0;b<v;++b)h=0,h|=l[m[a+0]]<<0,h|=l[m[a+1]]<<2,h|=l[m[a+2]]<<4,h|=l[m[a+3]]<<6,h|=l[m[a+4]]<<8,h|=l[m[a+5]]<<10,h|=l[m[a+6]]<<12,h|=l[m[a+7]]<<14,h|=l[m[a+8]]<<16,h|=l[m[a+9]]<<18,h|=l[m[a+10]]<<20,h|=l[m[a+11]]<<22,h|=l[m[a+12]]<<24,h|=l[m[a+13]]<<26,h|=l[m[a+14]]<<28,h|=l[m[a+15]]<<30,c[f+b]=h,a+=16;break;case 4:for(a=
b=0;b<v;++b)h=0,h|=l[m[a+0]]<<0,h|=l[m[a+1]]<<4,h|=l[m[a+2]]<<8,h|=l[m[a+3]]<<12,h|=l[m[a+4]]<<16,h|=l[m[a+5]]<<20,h|=l[m[a+6]]<<24,h|=l[m[a+7]]<<28,c[f+b]=h,a+=8;break;case 8:for(a=b=0;b<v;++b)h=0,h|=l[m[a+0]]<<0,h|=l[m[a+1]]<<8,h|=l[m[a+2]]<<16,h|=l[m[a+3]]<<24,c[f+b]=h,a+=4;break;case 16:for(a=b=0;b<v;++b)h=0,h|=l[m[a+0]]<<0,h|=l[m[a+1]]<<16,c[f+b]=h,a+=2;break;case 32:for(a=b=0;b<v;++b)h=0,h|=l[m[a+0]]<<0,c[f+b]=h,a+=1}if(D)for(m=f+v,l=0,g*=e;l<g;++l)c[m++]=k[l];return[u,d]};h.b=e;h.c=function(c,
a,b,d,g,k,m){var l=c.length,u=d[3];c.resize(l+u);for(var p=0;p<u;++p)c.data[l+p]=c.length,e(c,a,b,d,g+k[3]*p,k,m)}},function(n,h,f){h.b=function(e,c,a,b){for(;c<a;){var d=e[c];b(d)?++c:(--a,e[c]=e[a],e[a]=d)}return a};h.a=function(e,c){var a=e.length,b=Array(a);c=b[0]=void 0===c?1:c;for(var d=1;d<a;++d)c*=e[d-1],b[d]=c;return b};h.c=function(e,c,a){for(var b=new e.constructor(e.length),d=0;d<c*a;d+=a)for(var g=0;g<a;g++)b[g*c+d/a]=e[d+g];return b}},function(n,h,f){function e(a,b){if(!(a instanceof
b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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=f(1);var b=f(6),d=f(14),g=f(8),k=f(86);f.d(h,"a",function(){return p});var 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,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),l=function r(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 r(a,
b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},u=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.backendOnly=!0;return a}a(d,b);m(d,[{key:"initialize",value:function(a){l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initialize",this).call(this,a);this.requesters=new Set}},{key:"downloadSucceeded",value:function(){l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"downloadSucceeded",
this).call(this);var a=this.requesters,b=this.data;this.requesters=void 0;for(var a=$jscomp.makeIterator(a),c=a.next();!c.done;c=a.next())c.value.resolve(b)}},{key:"downloadFailed",value:function(a){l(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"downloadFailed",this).call(this,a);var b=this.requesters;this.requesters=void 0;for(var b=$jscomp.makeIterator(b),c=b.next();!c.done;c=b.next())c.value.reject(a)}},{key:"freeSystemMemory",value:function(){this.data=void 0}}]);return d}(n.Chunk),
p=function(l){function p(a,b){e(this,p);var d=c(this,(p.__proto__||Object.getPrototypeOf(p)).call(this,a));d.decodeFile=b;d.registerDisposer(a);d.registerDisposer(d.chunkManager.recomputeChunkPrioritiesLate.add(function(){d.updateChunkPriorities()}));return d}a(p,l);m(p,[{key:"updateChunkPriorities",value:function(){for(var a=this.chunkManager,b=$jscomp.makeIterator(this.chunks.values()),d=b.next();!d.done;d=b.next()){var d=d.value,c=d.requesters;if(void 0!==c)for(var c=$jscomp.makeIterator(c),g=
c.next();!g.done;g=c.next())g=g.value.getPriority(),a.requestChunk(d,g.priorityTier,g.priority)}}},{key:"download",value:function(a,b){var d=this;return f.i(g.a)(f.i(g.b)(a.key),"arraybuffer",b).then(function(b){a.data=d.decodeFile(b)})}},{key:"getData",value:function(a,c,g){var k=this,l=this.chunks.get(a);void 0===l&&(l=this.getNewChunk_(u),l.initialize(a),this.addChunk(l));return f.i(d.a)(g,function(a,g,m){switch(l.state){case b.a.FAILED:g(l.error);return;case b.a.SYSTEM_MEMORY_WORKER:a(l.data);
return}var e={resolve:a,reject:g,getPriority:c};l.requesters.add(e);m.add(function(){var a=l.requesters;void 0!==a&&(a.delete(e),k.chunkManager.scheduleUpdateChunkPriorities());g(d.b)});k.chunkManager.scheduleUpdateChunkPriorities()})}}],[{key:"get",value:function(a,b){return a.memoize.get("getFileSource:"+f.i(k.a)(b),function(){return new p(a,b)})}},{key:"getData",value:function(a,b,d,c,g){a=p.get(a,b);d=a.getData(d,c,g);a.dispose();return d}}]);return p}(n.ChunkSourceBase)},function(n,h,f){h.a=
function(e){return e.low+","+e.high};h.b=function(e,c){var a=e.segmentEquivalences;e=$jscomp.makeIterator(e.visibleSegments);for(var b=e.next();!b.done;b=e.next())if(b=b.value,a.disjointSets.isMinElement(b))for(var d=$jscomp.makeIterator(a.setElements(b)),g=d.next();!g.done;g=d.next())c(g.value,b)}},function(n,h,f){var e=f(17),c=f(75),a=f(76);n=f(89);h.a=function(g,k){var m=g.source.spec;if(m.compressedSegmentationBlockSize){var l=m.dataType;b.clear();var u=g.chunkDataSize;d[0]=u[0];d[1]=u[1];d[2]=
u[2];d[3]=m.numChannels;switch(l){case e.a.UINT32:f.i(c.a)(b,m.compressedSegmentationBlockSize,k,d);break;case e.a.UINT64:f.i(a.a)(b,m.compressedSegmentationBlockSize,k,d);break;default:throw Error("Unsupported data type for compressed segmentation: "+e.a[l]);}g.data=new Uint32Array(b.view)}else g.data=k};var b=new n.a(2E4),d=Array(4)},function(n,h,f){function e(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 c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}f.d(h,"a",function(){return b});f.d(h,"b",function(){return d});var a=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}}(),b=function(){function b(){c(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 d=a[b-1];"object"===typeof d?d.dispose():d.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 d=b.indexOf(a);-1!==d&&b.splice(d,1)}return a}},{key:"registerEventListener",value:function(a,b,d,c){a.addEventListener(b,d,c);this.registerDisposer(function(){return a.removeEventListener(b,d,c)})}},{key:"registerCancellable",value:function(a){this.registerDisposer(function(){a.cancel()});
return a}}]);return b}(),d=function(a){function b(a){c(this,b);var d;d=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.value=a;return d}e(b,a);return b}(b)},function(n,h,f){function e(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=f(23);var c=f(15);f.d(h,"a",function(){return b});var a=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}}(),b=function(b){function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");
var a;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.count=0;a.dependencies=new Map;a.signChanged=new c.a;return a}e(d,b);a(d,[{key:"inc",value:function(){1===++this.count&&this.signChanged.dispatch(1)}},{key:"dec",value:function(){0===--this.count&&this.signChanged.dispatch(0)}},{key:"addDependency",value:function(a){var b=this.dependencies,
d=b.get(a);void 0!==d?d.refCount+=1:(b.set(a,{refCount:1,unregister:this.signChanged.add(function(b){return b?a.inc():a.dec()})}),0<this.count&&a.inc())}},{key:"removeDependency",value:function(a){var b=this.dependencies,d=b.get(a);if(void 0===d)throw Error("Attempted to remove non-existing dependency.");0===--d.refCount&&(b.delete(a),d.unregister(),this.count&&a.dec())}},{key:"disposed",value:function(){for(var a=this.count,b=$jscomp.makeIterator(this.dependencies),d=b.next();!d.done;d=b.next()){var d=
$jscomp.makeIterator(d.value),c=d.next().value;d.next().value.unregister();a&&c.dec()}this.dependencies.clear()}},{key:"value",get:function(){return this.count}}]);return d}(n.a)},function(n,h,f){var e=e||{};e.Utils=e.Utils||{};e.Utils.crcTable=null;e.Utils.GUNZIP_MAGIC_COOKIE1=31;e.Utils.GUNZIP_MAGIC_COOKIE2=139;e.Utils.getStringAt=function(c,a,b){for(var d="",g;a<b;a+=1)g=c.getUint8(a),0!==g&&(d+=String.fromCharCode(g));return d};e.Utils.getByteAt=function(c,a){return c.getInt8(a)};e.Utils.getShortAt=
function(c,a,b){return c.getInt16(a,b)};e.Utils.getIntAt=function(c,a,b){return c.getInt32(a,b)};e.Utils.getFloatAt=function(c,a,b){return c.getFloat32(a,b)};e.Utils.getDoubleAt=function(c,a,b){return c.getFloat64(a,b)};e.Utils.getLongAt=function(c,a,b){var d,g=[],k=0;for(d=0;8>d;d+=1)g[d]=e.Utils.getByteAt(c,a+d,b);for(d=g.length-1;0<=d;d--)k=256*k+g[d];return k};e.Utils.toArrayBuffer=function(c){var a,b,d;a=new ArrayBuffer(c.length);b=new Uint8Array(a);for(d=0;d<c.length;d+=1)b[d]=c[d];return a};
e.Utils.isString=function(c){return"string"===typeof c||c instanceof String};e.Utils.formatNumber=function(c,a){c=e.Utils.isString(c)?Number(c):c;c=a?c.toPrecision(5):c.toPrecision(7);return parseFloat(c)};e.Utils.makeCRCTable=function(){for(var c,a=[],b=0;256>b;b++){c=b;for(var d=0;8>d;d++)c=c&1?3988292384^c>>>1:c>>>1;a[b]=c}return a};e.Utils.crc32=function(c){for(var a=e.Utils.crcTable||(e.Utils.crcTable=e.Utils.makeCRCTable()),b=-1,d=0;d<c.byteLength;d++)b=b>>>8^a[(b^c.getUint8(d))&255];return(b^
-1)>>>0};"undefined"!==typeof n&&n.exports&&(n.exports=e.Utils)},function(n,h,f){h=f(5).assign;var e=f(97),c=f(98);f=f(45);var a={};h(a,e,c,f);n.exports=a},function(n,h,f){n.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(n,h,f){function e(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(h,"__esModule",{value:!0});n=f(1);h=f(60);var c=f(4),a=f(9),b=f(36),d=f(10),g=f(8),k=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}}(),m=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var m=a.length-1;0<=m;m--)if(l=a[m])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k},l=new Map;l.set("npz",b.a);l.set("jpeg",a.a);l.set("raw",d.a);c=function(a){function b(){if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
var a;a=(b.__proto__||Object.getPrototypeOf(b)).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.chunkDecoder=l.get(a.parameters.encoding);return a}e(b,a);k(b,[{key:"download",value:function(a,b){for(var d=this,c=this.parameters,k=c.urlPrefix+"/"+c.key+"/"+c.channel+"/"+(c.encoding+"/"+c.resolution),l=this.computeChunkBounds(a),m=a.chunkDataSize,e=0;3>e;++e)k+="/"+l[e]+","+
(l[e]+m[e]);c.neariso&&(k+="/neariso/");return f.i(g.a)(f.i(g.c)(c.baseUrls,k),"arraybuffer",b).then(function(b){return d.chunkDecoder(a,b)})}}]);return b}(c.ParameterizedVolumeChunkSource);c=m([f.i(n.registerChunkSource)(h.a)],c)},function(n,h,f){Object.defineProperty(h,"__esModule",{value:!0});n=f(0);f.d(h,"rpc",function(){return e});var e=new n.g(self)},function(n,h,f){var e=f(31),c=f(8),a=f(14);h.b=function(a){return g[a]};h.a=function(g,m,l){l=void 0===l?a.c:l;var k=void 0;return new Promise(function(u,
v){function p(a){null===k?--b:(k=f.i(c.c)(d[g],m.path,m.method),k.responseType=m.responseType,k.setRequestHeader("Authorization",a.tokenType+" "+a.accessToken),k.onloadend=function(){if(null===k)--b;else{var d=this.status;200<=d&&300>d?(--b,l.remove(h),u(this.response)):401===d?f.i(e.a)(a).then(p):504===d?f.i(e.a)().then(p):(--b,l.remove(h),v(c.d.fromXhr(this)))}},k.send(m.payload))}var h=function(){var b=k;k=null;null!=b&&b.abort();v(a.b)};l.add(h);f.i(e.a)().then(p)})};var b=0,d=[],g=["prod"];d[0]=
["https://brainmaps.googleapis.com"]},function(n,h,f){f.d(h,"b",function(){return e});h.a=function(b){if(null!==c&&(null===a||null==b||b.generationId!==a.generationId))return c;a=null;c=e.getNewTokenPromise(b);c.then(function(b){a=b});return c};var e=new function d(){if(!(this instanceof d))throw new TypeError("Cannot call a class as a function");},c=null,a=null},function(n,h,f){function e(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 c(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(69);f(78);f(70);var a=f(24);n=f(0);f.d(h,"a",function(){return d});var b=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}}(),d=function(d){function g(b,d){if(!(this instanceof g))throw new TypeError("Cannot call a class as a function");var c=e(this,(g.__proto__||Object.getPrototypeOf(g)).call(this,b,d));c.visibilityCount=new a.a;c.chunkManager=b.get(d.chunkManager);c.visibleSegments=b.get(d.visibleSegments);c.segmentEquivalences=b.get(d.segmentEquivalences);
b=function(){c.chunkManager.scheduleUpdateChunkPriorities()};c.registerDisposer(c.visibleSegments.changed.add(b));c.registerDisposer(c.segmentEquivalences.changed.add(b));c.visibilityCount.signChanged.add(b);return c}c(g,d);b(g,[{key:"visible",get:function(){return 0<this.visibilityCount.value}}]);return g}(n.b)},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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 b(a,b){b=b.match(C);if(null===b||void 0===b[1])throw Error('Data source URL must have the form "<protocol>://<path>".');
var d=b[1];a=a.get(d);if(void 0===a)throw Error("Unsupported data source: "+JSON.stringify(d)+".");return[a,b[2],d]}function d(a,d,c,g){var k=$jscomp.makeIterator(b(t,d));d=k.next().value;k=k.next().value;return d.getMesh(a,k,c,g)}function g(a,d,c,g){var k=$jscomp.makeIterator(b(E,d));d=k.next().value;k=k.next().value;return d.getMeshVertexAttributes(a,k,c,g)}function k(a){var b=Number.POSITIVE_INFINITY,d=Number.NEGATIVE_INFINITY;a=$jscomp.makeIterator(a);for(var c=a.next();!c.done;c=a.next())c=c.value,
b=Math.min(b,c),d=Math.max(d,c);return[b,d]}function m(a,b,c,l){for(var m=[d(a,b.meshSourceUrl,c,l)],x=$jscomp.makeIterator(b.attributeSourceUrls),e=x.next();!e.done;e=x.next())m.push(g(a,e.value,c,l));return Promise.all(m).then(function(a){function d(a,b,d){for(var c=a.length,l=0;l<c;++l){var m=a[l],x=b[l],e=d,u=$jscomp.makeIterator(k(x)),p=u.next().value,u=u.next().value;g.info.vertexAttributes.push({name:m.name,source:e,numComponents:m.numComponents,dataType:m.dataType,min:p,max:u});g.vertexAttributes.push(x)}}
var c=a[0],g={info:{numVertices:c.info.numVertices,numTriangles:c.info.numTriangles,vertexAttributes:[]},vertexPositions:c.vertexPositions,indices:c.indices,vertexNormals:c.vertexNormals,vertexAttributes:[]};d(c.info.vertexAttributes,c.vertexAttributes);b.attributeSourceUrls.forEach(function(b,g){g=a[g+1];if(g.numVertices!==c.info.numVertices)throw Error("Vertex attribute source "+JSON.stringify(b)+" specifies attributes for "+g.numVertices+" vertices, but mesh has "+c.info.numVertices+" vertices.");
d(g.attributeInfo,g.attributes,b)});return g})}var l=f(1),u=f(6),p=f(13),v=f(72),r=f(12),y=f(24);n=f(0);h.b=function(a,b){t.set(a,b)};h.a=function(a,b){E.set(a,b)};var 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}}(),q=function G(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 G(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var m=a.length-1;0<=m;m--)if(l=a[m])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};
var B=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));a.data=null;return a}a(d,b);D(d,[{key:"freeSystemMemory",value:function(){this.data=null}},{key:"serialize",value:function(a,b){q(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"serialize",this).call(this,a,b);var c=this.data,g=c.vertexPositions,k=c.indices,l=c.vertexNormals,c=c.vertexAttributes;a.vertexPositions=g;a.indices=k;a.vertexNormals=l;a.vertexAttributes=c;a=new Set;a.add(g.buffer);
a.add(k.buffer);a.add(l.buffer);g=$jscomp.makeIterator(c);for(k=g.next();!k.done;k=g.next())a.add(k.value.buffer);b.push.apply(b,[].concat($jscomp.arrayFromIterable(a)));this.data=null}},{key:"downloadSucceeded",value:function(){for(var a=this.data,b=a.vertexAttributes,a=this.gpuMemoryBytes=a.vertexPositions.byteLength+a.indices.byteLength+a.vertexNormals.byteLength,b=$jscomp.makeIterator(b),c=b.next();!c.done;c=b.next())a+=c.value.byteLength;this.systemMemoryBytes=this.gpuMemoryBytes=a;q(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"downloadSucceeded",this).call(this)}}]);return d}(l.Chunk),t=new Map,E=new Map,C=/^(?:([a-zA-Z-+_]+):\/\/)?(.*)$/,l=function(b){function d(a,b){e(this,d);a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));a.parameters=b.parameters;a.info=b.info;return a}a(d,b);D(d,[{key:"getChunk",value:function(){var a=v.a,b=this.chunks.get(a);void 0===b&&(b=this.getNewChunk_(B),b.initialize(a),this.addChunk(b));return b}},{key:"download",value:function(a,b){var d=
this;return m(this.chunkManager,this.parameters,function(){return{priorityTier:a.priorityTier,priority:a.priority}},b).then(function(b){if(f.i(r.a)(b.info)!==f.i(r.a)(d.info))throw Error("Mesh info has changed.");void 0===b.vertexNormals&&(b.vertexNormals=f.i(p.a)(b.vertexPositions,b.indices));a.data=b})}}]);return d}(l.ChunkSource),l=h([f.i(n.a)(v.b)],l),l=function(b){function d(a,b){e(this,d);var g=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));g.visibilityCount=new y.a;g.chunkManager=
a.get(b.chunkManager);g.source=g.registerDisposer(a.getRef(b.source));g.registerDisposer(g.chunkManager.recomputeChunkPriorities.add(function(){g.updateChunkPriorities()}));g.visibilityCount.signChanged.add(function(){g.chunkManager.scheduleUpdateChunkPriorities()});return g}a(d,b);D(d,[{key:"updateChunkPriorities",value:function(){if(this.visible){var a=this.chunkManager,b=this.source.getChunk();a.requestChunk(b,u.b.VISIBLE,50)}}},{key:"visible",get:function(){return 0<this.visibilityCount.value}}]);
return d}(n.b),l=h([f.i(n.a)(v.c)],l);f.i(n.c)(v.d,function(a,b){var d=this.getRef(a.chunkManager);try{return m(d,a.parameters,function(){return{priorityTier:u.b.VISIBLE,priority:1E3}},b).then(function(a){return{value:a.info}})}finally{d.dispose()}})},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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 b=f(1),d=f(6),g=f(13),k=f(32),m=f(21);n=f(73);var l=f(16),u=f(0);f.d(h,"b",function(){return y});h.a=function(a,b,d,c,k,l,m){f.i(g.d)(a,2,b,d,c,k,l,m)};var p=
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}}(),v=function q(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 q(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||
function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var m=a.length-1;0<=m;m--)if(l=a[m])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var r=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this));a.objectId=new l.a;a.vertexPositions=null;a.vertexAttributes=null;a.indices=
null;return a}a(d,b);p(d,[{key:"initializeSkeletonChunk",value:function(a,b){v(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"initialize",this).call(this,a);this.objectId.assign(b)}},{key:"freeSystemMemory",value:function(){this.vertexPositions=this.indices=null}},{key:"getVertexAttributeBytes",value:function(){var a=this.vertexPositions.byteLength,b=this.vertexAttributes;null!=b&&b.forEach(function(b){a+=b.byteLength});return a}},{key:"serialize",value:function(a,b){v(d.prototype.__proto__||
Object.getPrototypeOf(d.prototype),"serialize",this).call(this,a,b);var c=this.vertexPositions,g=this.indices;a.indices=g;b.push(g.buffer);g=this.vertexAttributes;if(null!=g&&0<g.length){var k=new Uint8Array(this.getVertexAttributeBytes());k.set(new Uint8Array(c.buffer,c.byteOffset,c.byteLength));var l=a.vertexAttributeOffsets=new Uint32Array(g.length+1);l[0]=0;var m=c.byteLength;g.forEach(function(a,b){l[b+1]=m;k.set(new Uint8Array(a.buffer,a.byteOffset,a.byteLength),m);m+=a.byteLength});b.push(k.buffer);
a.vertexAttributes=k}else a.vertexAttributes=new Uint8Array(c.buffer,c.byteOffset,c.byteLength),a.vertexAttributeOffsets=Uint32Array.of(0),c.buffer!==b[0]&&b.push(c.buffer);this.vertexPositions=this.indices=this.vertexAttributes=null}},{key:"downloadSucceeded",value:function(){this.systemMemoryBytes=this.gpuMemoryBytes=this.indices.byteLength+this.getVertexAttributeBytes();v(d.prototype.__proto__||Object.getPrototypeOf(d.prototype),"downloadSucceeded",this).call(this)}}]);return d}(b.Chunk),y=function(b){function d(a,
b){e(this,d);a=c(this,(d.__proto__||Object.getPrototypeOf(d)).call(this,a,b));a.parameters=b.parameters;return a}a(d,b);return d}(function(b){function d(){e(this,d);return c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);p(d,[{key:"getChunk",value:function(a){var b=f.i(m.a)(a),d=this.chunks.get(b);void 0===d&&(d=this.getNewChunk_(r),d.initializeSkeletonChunk(b,a),this.addChunk(d));return d}}]);return d}(b.ChunkSource)),b=function(b){function g(a,b){e(this,g);var d=c(this,
(g.__proto__||Object.getPrototypeOf(g)).call(this,a,b));d.source=d.registerDisposer(a.getRef(b.source));d.registerDisposer(d.chunkManager.recomputeChunkPriorities.add(function(){d.updateChunkPriorities()}));return d}a(g,b);p(g,[{key:"updateChunkPriorities",value:function(){if(this.visible){var a=this.source,b=this.chunkManager;f.i(m.b)(this,function(c){c=a.getChunk(c);b.requestChunk(c,d.b.VISIBLE,60)})}}}]);return g}(k.a),b=h([f.i(u.a)(n.a)],b)},function(n,h,f){h.a=function(e,c){e.data=new Uint32Array(c)}},
function(n,h,f){var e=f(22),c=f(17),a=f(2),b=f(85),d=f(26);f.n(d);h.a=function(g,k){k=f.i(b.a)(f.i(d.inflate)(new Uint8Array(k)));var m=g.chunkDataSize,l=g.source,u=l.spec.numChannels,p=k.shape;if(4!==p.length||p[0]!==u||p[1]!==m[2]||p[2]!==m[1]||p[3]!==m[0])throw Error("Shape "+JSON.stringify(p)+" does not match chunkDataSize "+f.i(a.l)(m));m=k.dataType.dataType;l=l.spec;if(m!==l.dataType)throw Error("Data type "+c.a[m]+" does not match expected data type "+c.a[l.dataType]);f.i(e.a)(g,k.data)}},
function(n,h,f){var e=f(26);f.n(e);h.a=function(c){c=c instanceof ArrayBuffer?new Uint8Array(c):new Uint8Array(c.buffer,c.byteOffset,c.byteLength);var a=new Uint8Array(c.buffer,c.byteOffset,c.byteLength);return 2<a.length&&31===a[0]&&139===a[1]?f.i(e.inflate)(c):c}},function(n,h,f){h.glMatrix=f(3);h.mat2=f(90);h.mat2d=f(91);h.mat3=f(39);h.mat4=f(92);h.quat=f(93);h.vec2=f(94);h.vec3=f(40);h.vec4=f(41)},function(n,h,f){var e=f(3);h={create:function(){var c=new e.ARRAY_TYPE(9);c[0]=1;c[1]=0;c[2]=0;c[3]=
0;c[4]=1;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c},fromMat4:function(c,a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[4];c[4]=a[5];c[5]=a[6];c[6]=a[8];c[7]=a[9];c[8]=a[10];return c},clone:function(c){var a=new e.ARRAY_TYPE(9);a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];a[4]=c[4];a[5]=c[5];a[6]=c[6];a[7]=c[7];a[8]=c[8];return a},copy:function(c,a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];c[4]=a[4];c[5]=a[5];c[6]=a[6];c[7]=a[7];c[8]=a[8];return c},fromValues:function(c,a,b,d,g,k,m,l,u){var p=new e.ARRAY_TYPE(9);p[0]=
c;p[1]=a;p[2]=b;p[3]=d;p[4]=g;p[5]=k;p[6]=m;p[7]=l;p[8]=u;return p},set:function(c,a,b,d,g,k,m,l,e,p){c[0]=a;c[1]=b;c[2]=d;c[3]=g;c[4]=k;c[5]=m;c[6]=l;c[7]=e;c[8]=p;return c},identity:function(c){c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=1;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c},transpose:function(c,a){if(c===a){var b=a[1],d=a[2],g=a[5];c[1]=a[3];c[2]=a[6];c[3]=b;c[5]=a[7];c[6]=d;c[7]=g}else c[0]=a[0],c[1]=a[3],c[2]=a[6],c[3]=a[1],c[4]=a[4],c[5]=a[7],c[6]=a[2],c[7]=a[5],c[8]=a[8];return c},invert:function(c,
a){var b=a[0],d=a[1],g=a[2],k=a[3],m=a[4],l=a[5],e=a[6],p=a[7];a=a[8];var f=a*m-l*p,h=-a*k+l*e,y=p*k-m*e,n=b*f+d*h+g*y;if(!n)return null;n=1/n;c[0]=f*n;c[1]=(-a*d+g*p)*n;c[2]=(l*d-g*m)*n;c[3]=h*n;c[4]=(a*b-g*e)*n;c[5]=(-l*b+g*k)*n;c[6]=y*n;c[7]=(-p*b+d*e)*n;c[8]=(m*b-d*k)*n;return c},adjoint:function(c,a){var b=a[0],d=a[1],g=a[2],k=a[3],m=a[4],l=a[5],e=a[6],p=a[7];a=a[8];c[0]=m*a-l*p;c[1]=g*p-d*a;c[2]=d*l-g*m;c[3]=l*e-k*a;c[4]=b*a-g*e;c[5]=g*k-b*l;c[6]=k*p-m*e;c[7]=d*e-b*p;c[8]=b*m-d*k;return c},
determinant:function(c){var a=c[3],b=c[4],d=c[5],g=c[6],k=c[7],m=c[8];return c[0]*(m*b-d*k)+c[1]*(-m*a+d*g)+c[2]*(k*a-b*g)},multiply:function(c,a,b){var d=a[0],g=a[1],k=a[2],m=a[3],l=a[4],e=a[5],p=a[6],f=a[7];a=a[8];var h=b[0],y=b[1],n=b[2],q=b[3],B=b[4],t=b[5],E=b[6],C=b[7];b=b[8];c[0]=h*d+y*m+n*p;c[1]=h*g+y*l+n*f;c[2]=h*k+y*e+n*a;c[3]=q*d+B*m+t*p;c[4]=q*g+B*l+t*f;c[5]=q*k+B*e+t*a;c[6]=E*d+C*m+b*p;c[7]=E*g+C*l+b*f;c[8]=E*k+C*e+b*a;return c}};h.mul=h.multiply;h.translate=function(c,a,b){var d=a[0],
g=a[1],k=a[2],m=a[3],l=a[4],e=a[5],p=a[6],f=a[7];a=a[8];var h=b[0];b=b[1];c[0]=d;c[1]=g;c[2]=k;c[3]=m;c[4]=l;c[5]=e;c[6]=h*d+b*m+p;c[7]=h*g+b*l+f;c[8]=h*k+b*e+a;return c};h.rotate=function(c,a,b){var d=a[0],g=a[1],k=a[2],m=a[3],l=a[4],e=a[5],p=a[6],f=a[7];a=a[8];var h=Math.sin(b);b=Math.cos(b);c[0]=b*d+h*m;c[1]=b*g+h*l;c[2]=b*k+h*e;c[3]=b*m-h*d;c[4]=b*l-h*g;c[5]=b*e-h*k;c[6]=p;c[7]=f;c[8]=a;return c};h.scale=function(c,a,b){var d=b[0];b=b[1];c[0]=d*a[0];c[1]=d*a[1];c[2]=d*a[2];c[3]=b*a[3];c[4]=b*
a[4];c[5]=b*a[5];c[6]=a[6];c[7]=a[7];c[8]=a[8];return c};h.fromTranslation=function(c,a){c[0]=1;c[1]=0;c[2]=0;c[3]=0;c[4]=1;c[5]=0;c[6]=a[0];c[7]=a[1];c[8]=1;return c};h.fromRotation=function(c,a){var b=Math.sin(a);a=Math.cos(a);c[0]=a;c[1]=b;c[2]=0;c[3]=-b;c[4]=a;c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c};h.fromScaling=function(c,a){c[0]=a[0];c[1]=0;c[2]=0;c[3]=0;c[4]=a[1];c[5]=0;c[6]=0;c[7]=0;c[8]=1;return c};h.fromMat2d=function(c,a){c[0]=a[0];c[1]=a[1];c[2]=0;c[3]=a[2];c[4]=a[3];c[5]=0;c[6]=a[4];c[7]=
a[5];c[8]=1;return c};h.fromQuat=function(c,a){var b=a[0],d=a[1],g=a[2];a=a[3];var k=b+b,m=d+d,l=g+g,b=b*k,e=d*k,d=d*m,p=g*k,f=g*m,g=g*l,k=a*k,m=a*m;a*=l;c[0]=1-d-g;c[3]=e-a;c[6]=p+m;c[1]=e+a;c[4]=1-b-g;c[7]=f-k;c[2]=p-m;c[5]=f+k;c[8]=1-b-d;return c};h.normalFromMat4=function(c,a){var b=a[0],d=a[1],g=a[2],k=a[3],m=a[4],l=a[5],e=a[6],p=a[7],f=a[8],h=a[9],y=a[10],n=a[11],q=a[12],B=a[13],t=a[14];a=a[15];var E=b*l-d*m,C=b*e-g*m,z=b*p-k*m,G=d*e-g*l,H=d*p-k*l,x=g*p-k*e,w=f*B-h*q,L=f*t-y*q,f=f*a-n*q,O=h*
t-y*B,h=h*a-n*B,y=y*a-n*t,n=E*y-C*h+z*O+G*f-H*L+x*w;if(!n)return null;n=1/n;c[0]=(l*y-e*h+p*O)*n;c[1]=(e*f-m*y-p*L)*n;c[2]=(m*h-l*f+p*w)*n;c[3]=(g*h-d*y-k*O)*n;c[4]=(b*y-g*f+k*L)*n;c[5]=(d*f-b*h-k*w)*n;c[6]=(B*x-t*H+a*G)*n;c[7]=(t*z-q*x-a*C)*n;c[8]=(q*H-B*z+a*E)*n;return c};h.str=function(c){return"mat3("+c[0]+", "+c[1]+", "+c[2]+", "+c[3]+", "+c[4]+", "+c[5]+", "+c[6]+", "+c[7]+", "+c[8]+")"};h.frob=function(c){return Math.sqrt(Math.pow(c[0],2)+Math.pow(c[1],2)+Math.pow(c[2],2)+Math.pow(c[3],2)+
Math.pow(c[4],2)+Math.pow(c[5],2)+Math.pow(c[6],2)+Math.pow(c[7],2)+Math.pow(c[8],2))};h.add=function(c,a,b){c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];c[3]=a[3]+b[3];c[4]=a[4]+b[4];c[5]=a[5]+b[5];c[6]=a[6]+b[6];c[7]=a[7]+b[7];c[8]=a[8]+b[8];return c};h.subtract=function(c,a,b){c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];c[3]=a[3]-b[3];c[4]=a[4]-b[4];c[5]=a[5]-b[5];c[6]=a[6]-b[6];c[7]=a[7]-b[7];c[8]=a[8]-b[8];return c};h.sub=h.subtract;h.multiplyScalar=function(c,a,b){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=
a[2]*b;c[3]=a[3]*b;c[4]=a[4]*b;c[5]=a[5]*b;c[6]=a[6]*b;c[7]=a[7]*b;c[8]=a[8]*b;return c};h.multiplyScalarAndAdd=function(c,a,b,d){c[0]=a[0]+b[0]*d;c[1]=a[1]+b[1]*d;c[2]=a[2]+b[2]*d;c[3]=a[3]+b[3]*d;c[4]=a[4]+b[4]*d;c[5]=a[5]+b[5]*d;c[6]=a[6]+b[6]*d;c[7]=a[7]+b[7]*d;c[8]=a[8]+b[8]*d;return c};h.exactEquals=function(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&c[3]===a[3]&&c[4]===a[4]&&c[5]===a[5]&&c[6]===a[6]&&c[7]===a[7]&&c[8]===a[8]};h.equals=function(c,a){var b=c[0],d=c[1],g=c[2],k=c[3],m=
c[4],l=c[5],f=c[6],p=c[7],h=c[8],r=a[0],n=a[1],D=a[2],q=a[3],B=a[4],t=a[5];c=c[6];var E=a[7];a=a[8];return Math.abs(b-r)<=e.EPSILON*Math.max(1,Math.abs(b),Math.abs(r))&&Math.abs(d-n)<=e.EPSILON*Math.max(1,Math.abs(d),Math.abs(n))&&Math.abs(g-D)<=e.EPSILON*Math.max(1,Math.abs(g),Math.abs(D))&&Math.abs(k-q)<=e.EPSILON*Math.max(1,Math.abs(k),Math.abs(q))&&Math.abs(m-B)<=e.EPSILON*Math.max(1,Math.abs(m),Math.abs(B))&&Math.abs(l-t)<=e.EPSILON*Math.max(1,Math.abs(l),Math.abs(t))&&Math.abs(f-c)<=e.EPSILON*
Math.max(1,Math.abs(f),Math.abs(c))&&Math.abs(p-E)<=e.EPSILON*Math.max(1,Math.abs(p),Math.abs(E))&&Math.abs(h-a)<=e.EPSILON*Math.max(1,Math.abs(h),Math.abs(a))};n.exports=h},function(n,h,f){var e=f(3),c={create:function(){var a=new e.ARRAY_TYPE(3);a[0]=0;a[1]=0;a[2]=0;return a},clone:function(a){var b=new e.ARRAY_TYPE(3);b[0]=a[0];b[1]=a[1];b[2]=a[2];return b},fromValues:function(a,b,d){var c=new e.ARRAY_TYPE(3);c[0]=a;c[1]=b;c[2]=d;return c},copy:function(a,b){a[0]=b[0];a[1]=b[1];a[2]=b[2];return a},
set:function(a,b,d,c){a[0]=b;a[1]=d;a[2]=c;return a},add:function(a,b,d){a[0]=b[0]+d[0];a[1]=b[1]+d[1];a[2]=b[2]+d[2];return a},subtract:function(a,b,d){a[0]=b[0]-d[0];a[1]=b[1]-d[1];a[2]=b[2]-d[2];return a}};c.sub=c.subtract;c.multiply=function(a,b,d){a[0]=b[0]*d[0];a[1]=b[1]*d[1];a[2]=b[2]*d[2];return a};c.mul=c.multiply;c.divide=function(a,b,d){a[0]=b[0]/d[0];a[1]=b[1]/d[1];a[2]=b[2]/d[2];return a};c.div=c.divide;c.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);a[2]=Math.ceil(b[2]);
return a};c.floor=function(a,b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);a[2]=Math.floor(b[2]);return a};c.min=function(a,b,d){a[0]=Math.min(b[0],d[0]);a[1]=Math.min(b[1],d[1]);a[2]=Math.min(b[2],d[2]);return a};c.max=function(a,b,d){a[0]=Math.max(b[0],d[0]);a[1]=Math.max(b[1],d[1]);a[2]=Math.max(b[2],d[2]);return a};c.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);a[2]=Math.round(b[2]);return a};c.scale=function(a,b,d){a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;return a};c.scaleAndAdd=
function(a,b,d,c){a[0]=b[0]+d[0]*c;a[1]=b[1]+d[1]*c;a[2]=b[2]+d[2]*c;return a};c.distance=function(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)};c.dist=c.distance;c.squaredDistance=function(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};c.sqrDist=c.squaredDistance;c.length=function(a){var b=a[0],d=a[1];a=a[2];return Math.sqrt(b*b+d*d+a*a)};c.len=c.length;c.squaredLength=function(a){var b=a[0],d=a[1];a=a[2];return b*b+d*d+a*a};c.sqrLen=c.squaredLength;
c.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];return a};c.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];a[2]=1/b[2];return a};c.normalize=function(a,b){var d=b[0],c=b[1],k=b[2],d=d*d+c*c+k*k;0<d&&(d=1/Math.sqrt(d),a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d);return a};c.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};c.cross=function(a,b,d){var c=b[0],k=b[1];b=b[2];var m=d[0],l=d[1];d=d[2];a[0]=k*d-b*l;a[1]=b*m-c*d;a[2]=c*l-k*m;return a};c.lerp=function(a,b,d,c){var g=b[0],m=b[1];b=b[2];
a[0]=g+c*(d[0]-g);a[1]=m+c*(d[1]-m);a[2]=b+c*(d[2]-b);return a};c.hermite=function(a,b,d,c,k,m){var g=m*m,e=g*(2*m-3)+1,p=g*(m-2)+m,f=g*(m-1);m=g*(3-2*m);a[0]=b[0]*e+d[0]*p+c[0]*f+k[0]*m;a[1]=b[1]*e+d[1]*p+c[1]*f+k[1]*m;a[2]=b[2]*e+d[2]*p+c[2]*f+k[2]*m;return a};c.bezier=function(a,b,d,c,k,m){var g=1-m,e=g*g,p=m*m,f=e*g,e=3*m*e,g=3*p*g;m*=p;a[0]=b[0]*f+d[0]*e+c[0]*g+k[0]*m;a[1]=b[1]*f+d[1]*e+c[1]*g+k[1]*m;a[2]=b[2]*f+d[2]*e+c[2]*g+k[2]*m;return a};c.random=function(a,b){b=b||1;var d=2*e.RANDOM()*
Math.PI,c=2*e.RANDOM()-1,k=Math.sqrt(1-c*c)*b;a[0]=Math.cos(d)*k;a[1]=Math.sin(d)*k;a[2]=c*b;return a};c.transformMat4=function(a,b,d){var c=b[0],k=b[1];b=b[2];var m=d[3]*c+d[7]*k+d[11]*b+d[15],m=m||1;a[0]=(d[0]*c+d[4]*k+d[8]*b+d[12])/m;a[1]=(d[1]*c+d[5]*k+d[9]*b+d[13])/m;a[2]=(d[2]*c+d[6]*k+d[10]*b+d[14])/m;return a};c.transformMat3=function(a,b,d){var c=b[0],k=b[1];b=b[2];a[0]=c*d[0]+k*d[3]+b*d[6];a[1]=c*d[1]+k*d[4]+b*d[7];a[2]=c*d[2]+k*d[5]+b*d[8];return a};c.transformQuat=function(a,b,d){var c=
b[0],k=b[1],m=b[2];b=d[0];var l=d[1],e=d[2];d=d[3];var p=d*c+l*m-e*k,f=d*k+e*c-b*m,h=d*m+b*k-l*c,c=-b*c-l*k-e*m;a[0]=p*d+c*-b+f*-e-h*-l;a[1]=f*d+c*-l+h*-b-p*-e;a[2]=h*d+c*-e+p*-l-f*-b;return a};c.rotateX=function(a,b,d,c){var g=[],m=[];g[0]=b[0]-d[0];g[1]=b[1]-d[1];g[2]=b[2]-d[2];m[0]=g[0];m[1]=g[1]*Math.cos(c)-g[2]*Math.sin(c);m[2]=g[1]*Math.sin(c)+g[2]*Math.cos(c);a[0]=m[0]+d[0];a[1]=m[1]+d[1];a[2]=m[2]+d[2];return a};c.rotateY=function(a,b,d,c){var g=[],m=[];g[0]=b[0]-d[0];g[1]=b[1]-d[1];g[2]=
b[2]-d[2];m[0]=g[2]*Math.sin(c)+g[0]*Math.cos(c);m[1]=g[1];m[2]=g[2]*Math.cos(c)-g[0]*Math.sin(c);a[0]=m[0]+d[0];a[1]=m[1]+d[1];a[2]=m[2]+d[2];return a};c.rotateZ=function(a,b,d,c){var g=[],m=[];g[0]=b[0]-d[0];g[1]=b[1]-d[1];g[2]=b[2]-d[2];m[0]=g[0]*Math.cos(c)-g[1]*Math.sin(c);m[1]=g[0]*Math.sin(c)+g[1]*Math.cos(c);m[2]=g[2];a[0]=m[0]+d[0];a[1]=m[1]+d[1];a[2]=m[2]+d[2];return a};c.forEach=function(){var a=c.create();return function(b,d,c,k,m,l){d||(d=3);c||(c=0);for(k=k?Math.min(k*d+c,b.length):
b.length;c<k;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],m(a,a,l),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2];return b}}();c.angle=function(a,b){a=c.fromValues(a[0],a[1],a[2]);b=c.fromValues(b[0],b[1],b[2]);c.normalize(a,a);c.normalize(b,b);b=c.dot(a,b);return 1<b?0:Math.acos(b)};c.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]};c.equals=function(a,b){var d=a[0],c=a[1];a=a[2];var k=b[0],m=b[1];b=b[2];return Math.abs(d-k)<=e.EPSILON*
Math.max(1,Math.abs(d),Math.abs(k))&&Math.abs(c-m)<=e.EPSILON*Math.max(1,Math.abs(c),Math.abs(m))&&Math.abs(a-b)<=e.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};n.exports=c},function(n,h,f){var e=f(3),c={create:function(){var a=new e.ARRAY_TYPE(4);a[0]=0;a[1]=0;a[2]=0;a[3]=0;return a},clone:function(a){var b=new e.ARRAY_TYPE(4);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b},fromValues:function(a,b,d,c){var g=new e.ARRAY_TYPE(4);g[0]=a;g[1]=b;g[2]=d;g[3]=c;return g},copy:function(a,b){a[0]=b[0];
a[1]=b[1];a[2]=b[2];a[3]=b[3];return a},set:function(a,b,d,c,k){a[0]=b;a[1]=d;a[2]=c;a[3]=k;return a},add:function(a,b,d){a[0]=b[0]+d[0];a[1]=b[1]+d[1];a[2]=b[2]+d[2];a[3]=b[3]+d[3];return a},subtract:function(a,b,d){a[0]=b[0]-d[0];a[1]=b[1]-d[1];a[2]=b[2]-d[2];a[3]=b[3]-d[3];return a}};c.sub=c.subtract;c.multiply=function(a,b,d){a[0]=b[0]*d[0];a[1]=b[1]*d[1];a[2]=b[2]*d[2];a[3]=b[3]*d[3];return a};c.mul=c.multiply;c.divide=function(a,b,d){a[0]=b[0]/d[0];a[1]=b[1]/d[1];a[2]=b[2]/d[2];a[3]=b[3]/d[3];
return a};c.div=c.divide;c.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};c.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};c.min=function(a,b,d){a[0]=Math.min(b[0],d[0]);a[1]=Math.min(b[1],d[1]);a[2]=Math.min(b[2],d[2]);a[3]=Math.min(b[3],d[3]);return a};c.max=function(a,b,d){a[0]=Math.max(b[0],d[0]);a[1]=Math.max(b[1],d[1]);a[2]=Math.max(b[2],d[2]);a[3]=Math.max(b[3],
d[3]);return a};c.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};c.scale=function(a,b,d){a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;return a};c.scaleAndAdd=function(a,b,d,c){a[0]=b[0]+d[0]*c;a[1]=b[1]+d[1]*c;a[2]=b[2]+d[2]*c;a[3]=b[3]+d[3]*c;return a};c.distance=function(a,b){var d=b[0]-a[0],c=b[1]-a[1],k=b[2]-a[2];a=b[3]-a[3];return Math.sqrt(d*d+c*c+k*k+a*a)};c.dist=c.distance;c.squaredDistance=function(a,b){var d=b[0]-
a[0],c=b[1]-a[1],k=b[2]-a[2];a=b[3]-a[3];return d*d+c*c+k*k+a*a};c.sqrDist=c.squaredDistance;c.length=function(a){var b=a[0],d=a[1],c=a[2];a=a[3];return Math.sqrt(b*b+d*d+c*c+a*a)};c.len=c.length;c.squaredLength=function(a){var b=a[0],d=a[1],c=a[2];a=a[3];return b*b+d*d+c*c+a*a};c.sqrLen=c.squaredLength;c.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=-b[3];return a};c.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};c.normalize=function(a,b){var d=b[0],
c=b[1],k=b[2];b=b[3];var m=d*d+c*c+k*k+b*b;0<m&&(m=1/Math.sqrt(m),a[0]=d*m,a[1]=c*m,a[2]=k*m,a[3]=b*m);return a};c.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]};c.lerp=function(a,b,d,c){var g=b[0],m=b[1],l=b[2];b=b[3];a[0]=g+c*(d[0]-g);a[1]=m+c*(d[1]-m);a[2]=l+c*(d[2]-l);a[3]=b+c*(d[3]-b);return a};c.random=function(a,b){b=b||1;a[0]=e.RANDOM();a[1]=e.RANDOM();a[2]=e.RANDOM();a[3]=e.RANDOM();c.normalize(a,a);c.scale(a,a,b);return a};c.transformMat4=function(a,b,d){var c=b[0],k=
b[1],m=b[2];b=b[3];a[0]=d[0]*c+d[4]*k+d[8]*m+d[12]*b;a[1]=d[1]*c+d[5]*k+d[9]*m+d[13]*b;a[2]=d[2]*c+d[6]*k+d[10]*m+d[14]*b;a[3]=d[3]*c+d[7]*k+d[11]*m+d[15]*b;return a};c.transformQuat=function(a,b,d){var c=b[0],k=b[1],m=b[2],l=d[0],e=d[1],p=d[2];d=d[3];var f=d*c+e*m-p*k,h=d*k+p*c-l*m,n=d*m+l*k-e*c,c=-l*c-e*k-p*m;a[0]=f*d+c*-l+h*-p-n*-e;a[1]=h*d+c*-e+n*-l-f*-p;a[2]=n*d+c*-p+f*-e-h*-l;a[3]=b[3];return a};c.forEach=function(){var a=c.create();return function(b,d,c,k,m,l){d||(d=4);c||(c=0);for(k=k?Math.min(k*
d+c,b.length):b.length;c<k;c+=d)a[0]=b[c],a[1]=b[c+1],a[2]=b[c+2],a[3]=b[c+3],m(a,a,l),b[c]=a[0],b[c+1]=a[1],b[c+2]=a[2],b[c+3]=a[3];return b}}();c.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]};c.equals=function(a,b){var d=a[0],c=a[1],k=a[2];a=a[3];var m=b[0],l=b[1],f=b[2];b=b[3];return Math.abs(d-m)<=e.EPSILON*Math.max(1,Math.abs(d),Math.abs(m))&&Math.abs(c-l)<=e.EPSILON*Math.max(1,Math.abs(c),
Math.abs(l))&&Math.abs(k-f)<=e.EPSILON*Math.max(1,Math.abs(k),Math.abs(f))&&Math.abs(a-b)<=e.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};n.exports=c},function(n,h,f){var e=e||{};e.Utils=e.Utils||f(25);e.NIFTI1=e.NIFTI1||function(){this.littleEndian=!1;this.dim_info=0;this.dims=[];this.slice_code=this.slice_end=this.slice_start=this.numBitsPerVoxel=this.datatypeCode=this.intent_code=this.intent_p3=this.intent_p2=this.intent_p1=0;this.pixDims=[];this.vox_offset=0;this.scl_slope=1;this.toffset=this.slice_duration=
this.cal_min=this.cal_max=this.xyzt_units=this.scl_inter=0;this.intent_name=this.aux_file=this.description="";this.qoffset_z=this.qoffset_y=this.qoffset_x=this.quatern_d=this.quatern_c=this.quatern_b=this.sform_code=this.qform_code=0;this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.magic=0;this.isHDR=!1;this.extensionFlag=[0,0,0,0];this.extensionCode=this.extensionSize=0};e.NIFTI1.TYPE_NONE=0;e.NIFTI1.TYPE_BINARY=1;e.NIFTI1.TYPE_UINT8=2;e.NIFTI1.TYPE_INT16=4;e.NIFTI1.TYPE_INT32=8;e.NIFTI1.TYPE_FLOAT32=
16;e.NIFTI1.TYPE_COMPLEX64=32;e.NIFTI1.TYPE_FLOAT64=64;e.NIFTI1.TYPE_RGB24=128;e.NIFTI1.TYPE_INT8=256;e.NIFTI1.TYPE_UINT16=512;e.NIFTI1.TYPE_UINT32=768;e.NIFTI1.TYPE_INT64=1024;e.NIFTI1.TYPE_UINT64=1280;e.NIFTI1.TYPE_FLOAT128=1536;e.NIFTI1.TYPE_COMPLEX128=1792;e.NIFTI1.TYPE_COMPLEX256=2048;e.NIFTI1.XFORM_UNKNOWN=0;e.NIFTI1.XFORM_SCANNER_ANAT=1;e.NIFTI1.XFORM_ALIGNED_ANAT=2;e.NIFTI1.XFORM_TALAIRACH=3;e.NIFTI1.XFORM_MNI_152=4;e.NIFTI1.SPATIAL_UNITS_MASK=7;e.NIFTI1.TEMPORAL_UNITS_MASK=56;e.NIFTI1.UNITS_UNKNOWN=
0;e.NIFTI1.UNITS_METER=1;e.NIFTI1.UNITS_MM=2;e.NIFTI1.UNITS_MICRON=3;e.NIFTI1.UNITS_SEC=8;e.NIFTI1.UNITS_MSEC=16;e.NIFTI1.UNITS_USEC=24;e.NIFTI1.UNITS_HZ=32;e.NIFTI1.UNITS_PPM=40;e.NIFTI1.UNITS_RADS=48;e.NIFTI1.MAGIC_COOKIE=348;e.NIFTI1.STANDARD_HEADER_SIZE=348;e.NIFTI1.MAGIC_NUMBER_LOCATION=344;e.NIFTI1.MAGIC_NUMBER=[110,43,49];e.NIFTI1.MAGIC_NUMBER2=[110,105,49];e.NIFTI1.EXTENSION_HEADER_SIZE=8;e.NIFTI1.prototype.readHeader=function(c){c=new DataView(c);var a=e.Utils.getIntAt(c,0,this.littleEndian),
b,d;a!==e.NIFTI1.MAGIC_COOKIE&&(this.littleEndian=!0,a=e.Utils.getIntAt(c,0,this.littleEndian));if(a!==e.NIFTI1.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");this.dim_info=e.Utils.getByteAt(c,39);for(b=0;8>b;b+=1)a=40+2*b,this.dims[b]=e.Utils.getShortAt(c,a,this.littleEndian);this.intent_p1=e.Utils.getFloatAt(c,56,this.littleEndian);this.intent_p2=e.Utils.getFloatAt(c,60,this.littleEndian);this.intent_p3=e.Utils.getFloatAt(c,64,this.littleEndian);this.intent_code=e.Utils.getShortAt(c,
68,this.littleEndian);this.datatypeCode=e.Utils.getShortAt(c,70,this.littleEndian);this.numBitsPerVoxel=e.Utils.getShortAt(c,72,this.littleEndian);this.slice_start=e.Utils.getShortAt(c,74,this.littleEndian);for(b=0;8>b;b+=1)a=76+4*b,this.pixDims[b]=e.Utils.getFloatAt(c,a,this.littleEndian);this.vox_offset=e.Utils.getFloatAt(c,108,this.littleEndian);this.scl_slope=e.Utils.getFloatAt(c,112,this.littleEndian);this.scl_inter=e.Utils.getFloatAt(c,116,this.littleEndian);this.slice_end=e.Utils.getShortAt(c,
120,this.littleEndian);this.slice_code=e.Utils.getByteAt(c,122);this.xyzt_units=e.Utils.getByteAt(c,123);this.cal_max=e.Utils.getFloatAt(c,124,this.littleEndian);this.cal_min=e.Utils.getFloatAt(c,128,this.littleEndian);this.slice_duration=e.Utils.getFloatAt(c,132,this.littleEndian);this.toffset=e.Utils.getFloatAt(c,136,this.littleEndian);this.description=e.Utils.getStringAt(c,148,228);this.aux_file=e.Utils.getStringAt(c,228,252);this.qform_code=e.Utils.getShortAt(c,252,this.littleEndian);this.sform_code=
e.Utils.getShortAt(c,254,this.littleEndian);this.quatern_b=e.Utils.getFloatAt(c,256,this.littleEndian);this.quatern_c=e.Utils.getFloatAt(c,260,this.littleEndian);this.quatern_d=e.Utils.getFloatAt(c,264,this.littleEndian);this.qoffset_x=e.Utils.getFloatAt(c,268,this.littleEndian);this.qoffset_y=e.Utils.getFloatAt(c,272,this.littleEndian);this.qoffset_z=e.Utils.getFloatAt(c,276,this.littleEndian);for(b=0;3>b;b+=1)for(d=0;4>d;d+=1)a=280+4*(4*b+d),this.affine[b][d]=e.Utils.getFloatAt(c,a,this.littleEndian);
this.affine[3][0]=0;this.affine[3][1]=0;this.affine[3][2]=0;this.affine[3][3]=1;this.intent_name=e.Utils.getStringAt(c,328,344);this.magic=e.Utils.getStringAt(c,344,348);this.isHDR=this.magic===e.NIFTI1.MAGIC_NUMBER2;c.byteLength>e.NIFTI1.MAGIC_COOKIE&&(this.extensionFlag[0]=e.Utils.getByteAt(c,348),this.extensionFlag[1]=e.Utils.getByteAt(c,349),this.extensionFlag[2]=e.Utils.getByteAt(c,350),this.extensionFlag[3]=e.Utils.getByteAt(c,351),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(c),
this.extensionCode=this.getExtensionCode(c)))};e.NIFTI1.prototype.toFormattedString=function(){var c=e.Utils.formatNumber,a;a=""+("Dim Info = "+this.dim_info+"\n");a+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n";a+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n";a+="Intent Code = "+this.intent_code+"\n";a+="Datatype = "+this.datatypeCode+
" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n";a+="Bits Per Voxel = "+this.numBitsPerVoxel+"\n";a+="Slice Start = "+this.slice_start+"\n";a+="Voxel Dimensions (1-8): "+c(this.pixDims[0])+", "+c(this.pixDims[1])+", "+c(this.pixDims[2])+", "+c(this.pixDims[3])+", "+c(this.pixDims[4])+", "+c(this.pixDims[5])+", "+c(this.pixDims[6])+", "+c(this.pixDims[7])+"\n";a+="Image Offset = "+this.vox_offset+"\n";a+="Data Scale:  Slope = "+c(this.scl_slope)+"  Intercept = "+c(this.scl_inter)+"\n";a+="Slice End = "+
this.slice_end+"\n";a+="Slice Code = "+this.slice_code+"\n";a+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(e.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+", "+this.getUnitsCodeString(e.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n";a+="Display Range:  Max = "+c(this.cal_max)+"  Min = "+c(this.cal_min)+"\n";a+="Slice Duration = "+this.slice_duration+"\n";a+="Time Axis Shift = "+this.toffset+"\n";a+='Description: "'+this.description+'"\n';a+='Auxiliary File: "'+this.aux_file+'"\n';
a+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n";a+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n";a+="Quaternion Parameters:  b = "+c(this.quatern_b)+"  c = "+c(this.quatern_c)+"  d = "+c(this.quatern_d)+"\n";a+="Quaternion Offsets:  x = "+this.qoffset_x+"  y = "+this.qoffset_y+"  z = "+this.qoffset_z+"\n";a+="S-Form Parameters X: "+c(this.affine[0][0])+", "+c(this.affine[0][1])+", "+c(this.affine[0][2])+", "+c(this.affine[0][3])+
"\n";a+="S-Form Parameters Y: "+c(this.affine[1][0])+", "+c(this.affine[1][1])+", "+c(this.affine[1][2])+", "+c(this.affine[1][3])+"\n";a+="S-Form Parameters Z: "+c(this.affine[2][0])+", "+c(this.affine[2][1])+", "+c(this.affine[2][2])+", "+c(this.affine[2][3])+"\n";a+='Intent Name: "'+this.intent_name+'"\n';this.extensionFlag[0]&&(a+="Extension: Size = "+this.extensionSize+"  Code = "+this.extensionCode+"\n");return a};e.NIFTI1.prototype.getDatatypeCodeString=function(c){return c===e.NIFTI1.TYPE_UINT8?
"1-Byte Unsigned Integer":c===e.NIFTI1.TYPE_INT16?"2-Byte Signed Integer":c===e.NIFTI1.TYPE_INT32?"4-Byte Signed Integer":c===e.NIFTI1.TYPE_FLOAT32?"4-Byte Float":c===e.NIFTI1.TYPE_FLOAT64?"8-Byte Float":c===e.NIFTI1.TYPE_RGB24?"RGB":c===e.NIFTI1.TYPE_INT8?"1-Byte Signed Integer":c===e.NIFTI1.TYPE_UINT16?"2-Byte Unsigned Integer":c===e.NIFTI1.TYPE_UINT32?"4-Byte Unsigned Integer":c===e.NIFTI1.TYPE_INT64?"8-Byte Signed Integer":c===e.NIFTI1.TYPE_UINT64?"8-Byte Unsigned Integer":"Unknown"};e.NIFTI1.prototype.getTransformCodeString=
function(c){return c===e.NIFTI1.XFORM_SCANNER_ANAT?"Scanner":c===e.NIFTI1.XFORM_ALIGNED_ANAT?"Aligned":c===e.NIFTI1.XFORM_TALAIRACH?"Talairach":c===e.NIFTI1.XFORM_MNI_152?"MNI":"Unknown"};e.NIFTI1.prototype.getUnitsCodeString=function(c){return c===e.NIFTI1.UNITS_METER?"Meters":c===e.NIFTI1.UNITS_MM?"Millimeters":c===e.NIFTI1.UNITS_MICRON?"Microns":c===e.NIFTI1.UNITS_SEC?"Seconds":c===e.NIFTI1.UNITS_MSEC?"Milliseconds":c===e.NIFTI1.UNITS_USEC?"Microseconds":c===e.NIFTI1.UNITS_HZ?"Hz":c===e.NIFTI1.UNITS_PPM?
"PPM":c===e.NIFTI1.UNITS_RADS?"Rads":"Unknown"};e.NIFTI1.prototype.getQformMat=function(){return this.convertNiftiQFormToNiftiSForm(this.quatern_b,this.quatern_c,this.quatern_d,this.qoffset_x,this.qoffset_y,this.qoffset_z,this.pixDims[1],this.pixDims[2],this.pixDims[3],this.pixDims[0])};e.NIFTI1.prototype.convertNiftiQFormToNiftiSForm=function(c,a,b,d,g,k,m,l,e,f){var p=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],u=b;p[3][0]=p[3][1]=p[3][2]=0;p[3][3]=1;b=1-(c*c+a*a+u*u);1E-7>b?(b=1/Math.sqrt(c*c+a*
a+u*u),c*=b,a*=b,u*=b,b=0):b=Math.sqrt(b);m=0<m?m:1;l=0<l?l:1;e=0<e?e:1;0>f&&(e=-e);p[0][0]=(b*b+c*c-a*a-u*u)*m;p[0][1]=2*(c*a-b*u)*l;p[0][2]=2*(c*u+b*a)*e;p[1][0]=2*(c*a+b*u)*m;p[1][1]=(b*b+a*a-c*c-u*u)*l;p[1][2]=2*(a*u-b*c)*e;p[2][0]=2*(c*u-b*a)*m;p[2][1]=2*(a*u+b*c)*l;p[2][2]=(b*b+u*u-a*a-c*c)*e;p[0][3]=d;p[1][3]=g;p[2][3]=k;return p};e.NIFTI1.prototype.convertNiftiSFormToNEMA=function(c){var a,b,d,g,k,m,l,e,p,f,h,n,D,q,B,t;B=[[0,0,0],[0,0,0],[0,0,0]];t=[[0,0,0],[0,0,0],[0,0,0]];a=c[0][0];b=c[0][1];
d=c[0][2];g=c[1][0];k=c[1][1];m=c[1][2];l=c[2][0];e=c[2][1];p=c[2][2];c=Math.sqrt(a*a+g*g+l*l);if(0===c)return null;a/=c;g/=c;l/=c;c=Math.sqrt(b*b+k*k+e*e);if(0===c)return null;b/=c;k/=c;e/=c;c=a*b+g*k+l*e;if(1E-4<Math.abs(c)){b-=c*a;k-=c*g;e-=c*l;c=Math.sqrt(b*b+k*k+e*e);if(0===c)return null;b/=c;k/=c;e/=c}c=Math.sqrt(d*d+m*m+p*p);0===c?(d=g*e-l*k,m=l*b-e*a,p=a*k-g*b):(d/=c,m/=c,p/=c);c=a*d+g*m+l*p;if(1E-4<Math.abs(c)){d-=c*a;m-=c*g;p-=c*l;c=Math.sqrt(d*d+m*m+p*p);if(0===c)return null;d/=c;m/=c;
p/=c}c=b*d+k*m+e*p;if(1E-4<Math.abs(c)){d-=c*b;m-=c*k;p-=c*e;c=Math.sqrt(d*d+m*m+p*p);if(0===c)return null;d/=c;m/=c;p/=c}B[0][0]=a;B[0][1]=b;B[0][2]=d;B[1][0]=g;B[1][1]=k;B[1][2]=m;B[2][0]=l;B[2][1]=e;B[2][2]=p;l=this.nifti_mat33_determ(B);if(0===l)return null;q=-666;a=g=k=m=1;b=2;d=3;for(e=1;3>=e;e+=1)for(p=1;3>=p;p+=1)if(e!==p)for(f=1;3>=f;f+=1)if(e!==f&&p!==f)for(t[0][0]=t[0][1]=t[0][2]=t[1][0]=t[1][1]=t[1][2]=t[2][0]=t[2][1]=t[2][2]=0,h=-1;1>=h;h+=2)for(n=-1;1>=n;n+=2)for(D=-1;1>=D;D+=2)t[0][e-
1]=h,t[1][p-1]=n,t[2][f-1]=D,c=this.nifti_mat33_determ(t),0<c*l&&(c=this.nifti_mat33_mul(t,B),c=c[0][0]+c[1][1]+c[2][2],c>q&&(q=c,a=e,b=p,d=f,g=h,k=n,m=D));B=t=c=l=e=p=0;switch(a*g){case 1:B="X";l="+";break;case -1:B="X";l="-";break;case 2:B="Y";l="+";break;case -2:B="Y";l="-";break;case 3:B="Z";l="+";break;case -3:B="Z",l="-"}switch(b*k){case 1:t="X";e="+";break;case -1:t="X";e="-";break;case 2:t="Y";e="+";break;case -2:t="Y";e="-";break;case 3:t="Z";e="+";break;case -3:t="Z",e="-"}switch(d*m){case 1:c=
"X";p="+";break;case -1:c="X";p="-";break;case 2:c="Y";p="+";break;case -2:c="Y";p="-";break;case 3:c="Z";p="+";break;case -3:c="Z",p="-"}return B+t+c+l+e+p};e.NIFTI1.prototype.nifti_mat33_mul=function(c,a){var b=[[0,0,0],[0,0,0],[0,0,0]],d,g;for(d=0;3>d;d+=1)for(g=0;3>g;g+=1)b[d][g]=c[d][0]*a[0][g]+c[d][1]*a[1][g]+c[d][2]*a[2][g];return b};e.NIFTI1.prototype.nifti_mat33_determ=function(c){var a,b,d,g,k,m,l,e;a=c[0][0];b=c[0][1];d=c[0][2];g=c[1][0];k=c[1][1];m=c[1][2];l=c[2][0];e=c[2][1];c=c[2][2];
return a*k*c-a*e*m-g*b*c+g*e*d+l*b*m-l*k*d};e.NIFTI1.prototype.getExtensionLocation=function(){return e.NIFTI1.MAGIC_COOKIE+4};e.NIFTI1.prototype.getExtensionSize=function(c){return e.Utils.getIntAt(c,this.getExtensionLocation(),this.littleEndian)};e.NIFTI1.prototype.getExtensionCode=function(c){return e.Utils.getIntAt(c,this.getExtensionLocation()+4,this.littleEndian)};"undefined"!==typeof n&&n.exports&&(n.exports=e.NIFTI1)},function(n,h,f){function e(d,k){if(65537>k&&(d.subarray&&b||!d.subarray&&
a))return String.fromCharCode.apply(null,c.shrinkBuf(d,k));for(var g="",l=0;l<k;l++)g+=String.fromCharCode(d[l]);return g}var c=f(5),a=!0,b=!0;try{String.fromCharCode.apply(null,[0])}catch(g){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(g){b=!1}var d=new c.Buf8(256);for(n=0;256>n;n++)d[n]=252<=n?6:248<=n?5:240<=n?4:224<=n?3:192<=n?2:1;d[254]=d[254]=1;h.string2buf=function(a){var b,d,g,e,p,f=a.length,h=0;for(e=0;e<f;e++)d=a.charCodeAt(e),55296===(d&64512)&&e+1<f&&(g=a.charCodeAt(e+
1),56320===(g&64512)&&(d=65536+(d-55296<<10)+(g-56320),e++)),h+=128>d?1:2048>d?2:65536>d?3:4;b=new c.Buf8(h);for(e=p=0;p<h;e++)d=a.charCodeAt(e),55296===(d&64512)&&e+1<f&&(g=a.charCodeAt(e+1),56320===(g&64512)&&(d=65536+(d-55296<<10)+(g-56320),e++)),128>d?b[p++]=d:(2048>d?b[p++]=192|d>>>6:(65536>d?b[p++]=224|d>>>12:(b[p++]=240|d>>>18,b[p++]=128|d>>>12&63),b[p++]=128|d>>>6&63),b[p++]=128|d&63);return b};h.buf2binstring=function(a){return e(a,a.length)};h.binstring2buf=function(a){for(var b=new c.Buf8(a.length),
d=0,g=b.length;d<g;d++)b[d]=a.charCodeAt(d);return b};h.buf2string=function(a,b){var c,g,k,f=b||a.length,h=Array(2*f);for(b=c=0;b<f;)if(g=a[b++],128>g)h[c++]=g;else if(k=d[g],4<k)h[c++]=65533,b+=k-1;else{for(g&=2===k?31:3===k?15:7;1<k&&b<f;)g=g<<6|a[b++]&63,k--;1<k?h[c++]=65533:65536>g?h[c++]=g:(g-=65536,h[c++]=55296|g>>10&1023,h[c++]=56320|g&1023)}return e(h,c)};h.utf8border=function(a,b){var c;b=b||a.length;b>a.length&&(b=a.length);for(c=b-1;0<=c&&128===(a[c]&192);)c--;return 0>c||0===c?b:c+d[a[c]]>
b?c:b}},function(n,h,f){n.exports=function(e,c,a,b){var d=e&65535|0;e=e>>>16&65535|0;for(var g;0!==a;){g=2E3<a?2E3:a;a-=g;do d=d+c[b++]|0,e=e+d|0;while(--g);d%=65521;e%=65521}return d|e<<16|0}},function(n,h,f){n.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,
Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(n,h,f){var e=function(){for(var c,a=[],b=0;256>b;b++){c=b;for(var d=0;8>d;d++)c=c&1?3988292384^c>>>1:c>>>1;a[b]=c}return a}();n.exports=function(c,a,b,d){b=d+b;for(c^=-1;d<b;d++)c=c>>>8^e[(c^a[d])&255];return c^-1}},function(n,h,f){n.exports=function(){this.input=null;this.total_in=this.avail_in=this.next_in=0;this.output=null;this.total_out=this.avail_out=this.next_out=0;this.msg="";this.state=
null;this.data_type=2;this.adler=0}},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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 b(a,b){a&&(b.change_spec={change_stack_id:a.changeStackId},a.timeStamp&&(b.change_spec.time_stamp=a.timeStamp),a.skipEquivalences&&(b.change_spec.skip_equivalences=a.skipEquivalences))}function d(a,b){return f.i(l.e)(a,b,"fragmentKey")}function g(a,b){f.i(B.b)(b);var d=f.i(B.c)(b,"fragmentKey",B.d);b=f.i(B.c)(b,"supervoxelId",B.d);if(d.length!==b.length)throw Error("Expected fragmentKey and supervoxelId arrays to have the same length.");
a.fragmentIds=b.map(function(a,b){return a+"\x00"+d[b]})}Object.defineProperty(h,"__esModule",{value:!0});f(57);n=f(1);var k=f(30),m=f(58),l=f(13),u=f(34),p=f(4),v=f(35),r=f(9),y=f(10),D=f(7),q=f(2),B=f(12);f.d(h,"SkeletonSource",function(){return C});var 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}}();
h=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var e=a.length-1;0<=e;e--)if(l=a[e])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var E=new Map([[m.a.RAW,y.a],[m.a.JPEG,r.a],[m.a.COMPRESSED_SEGMENTATION,v.a]]),p=function(d){function g(){e(this,g);var a=c(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,
arguments));a.chunkDecoder=E.get(a.parameters.encoding);return a}a(g,d);t(g,[{key:"applyEncodingParams",value:function(a){var b=this.parameters.encoding;switch(b){case m.a.RAW:a.subvolume_format="RAW";break;case m.a.JPEG:a.subvolume_format="SINGLE_IMAGE";a.image_format_options={image_format:"JPEG",jpeg_quality:70};break;case m.a.COMPRESSED_SEGMENTATION:a.subvolume_format="RAW";a.image_format_options={compressed_segmentation_block_size:f.i(q.l)(this.spec.compressedSegmentationBlockSize)};break;default:throw Error("Invalid encoding: "+
b);}}},{key:"download",value:function(a,d){var c=this,g=this.parameters,l,e=this.computeChunkBounds(a),m=a.chunkDataSize;l="/v1/volumes/"+g.volumeId+"/subvolume:binary";e={geometry:{corner:f.i(q.l)(e),size:f.i(q.l)(m),scale:g.scaleIndex}};this.applyEncodingParams(e);b(g.changeSpec,e);l={method:"POST",payload:JSON.stringify(e),path:l,responseType:"arraybuffer"};return f.i(k.a)(g.instance,l,d).then(function(b){return c.chunkDecoder(a,b)})}}]);return g}(p.ParameterizedVolumeChunkSource),p=h([f.i(n.registerChunkSource)(m.b)],
p),p=function(m){function p(){e(this,p);var a=c(this,(p.__proto__||Object.getPrototypeOf(p)).apply(this,arguments));a.manifestDecoder=void 0!==a.parameters.changeSpec?g:d;var b;b=a.parameters.changeSpec;b=void 0!==b?"&header.changeStackId="+b.changeStackId+"&return_supervoxel_ids=true":"";a.listFragmentsParams=b;return a}a(p,m);t(p,[{key:"download",value:function(a,b){var d=this,c=this.parameters,g={method:"GET",path:"/v1/objects/"+c.volumeId+"/meshes/"+(c.meshName+":listfragments?object_id="+a.objectId)+
this.listFragmentsParams,responseType:"json"};return f.i(k.a)(c.instance,g,b).then(function(b){return d.manifestDecoder(a,b)})}},{key:"downloadFragment",value:function(a,d){var c=this.parameters,g,e=a.fragmentId;if(void 0!==c.changeSpec){var m=e.indexOf("\x00");g=e.substring(0,m);e=e.substring(m+1)}else g=a.manifestChunk.objectId.toString();m="/v1/objects/"+c.volumeId+("/meshes/"+c.meshName)+"/fragment:binary";g={fragment_key:e,object_id:g};b(c.changeSpec,g);g={method:"POST",path:m,payload:JSON.stringify(g),
responseType:"arraybuffer"};return f.i(k.a)(c.instance,g,d).then(function(b){var d=new DataView(b),c=d.getUint32(0,!0);if(0!==d.getUint32(4,!0))throw Error("The number of vertices should not exceed 2^32-1.");f.i(l.b)(a,b,D.b.LITTLE,8,c)})}}]);return p}(l.c),p=h([f.i(n.registerChunkSource)(m.c)],p),C=function(d){function g(){e(this,g);return c(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments))}a(g,d);t(g,[{key:"download",value:function(a,d){var c=this.parameters,g={object_id:""+a.objectId},
l="/v1/objects/"+c.volumeId+("/meshes/"+c.meshName)+"/skeleton:binary";b(c.changeSpec,g);g={method:"POST",path:l,payload:JSON.stringify(g),responseType:"arraybuffer"};return f.i(k.a)(c.instance,g,d).then(function(b){var d=new DataView(b),c=d.getUint32(0,!0);if(0!==d.getUint32(4,!0))throw Error("The number of vertices should not exceed 2^32-1.");var g=d.getUint32(8,!0);if(0!==d.getUint32(12,!0))throw Error("The number of edges should not exceed 2^32-1.");f.i(u.a)(a,b,D.b.LITTLE,16,c,void 0,g)})}}]);
return g}(u.b),C=h([f.i(n.registerChunkSource)(m.d)],C)},function(n,h,f){function e(d){d=(new TextDecoder).decode(f.i(b.a)(d)).trim().split(/\n+/);if(!d)throw Error("CSV file is empty.");for(var c=d[0].split(","),k=c.map(function(b){return{name:b.trim(),dataType:a.a.FLOAT32,numComponents:1}}),e=d.length-1,l=c.length,c=c.map(function(){return new Float32Array(e)}),h=0;h<e;++h)for(var p=d[h+1].split(","),v=0;v<l;++v)c[v][h]=parseFloat(p[v]);return{numVertices:e,attributeInfo:k,attributes:c}}Object.defineProperty(h,
"__esModule",{value:!0});var c=f(20);n=f(33);var a=f(11),b=f(37);f.i(n.a)("csv",{description:"Comma separated value text file",getMeshVertexAttributes:function(a,b,k,m){return c.a.getData(a.addRef(),e,b,k,m)}})},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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(h,"__esModule",{value:!0});n=f(1);h=f(59);var b=f(4),d=f(9),g=f(10),k=f(8),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,d,c){d&&a(b.prototype,d);c&&a(b,c);return b}}(),l=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var e=a.length-1;0<=e;e--)if(l=a[e])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k},u=new Map([[h.a.JPEG,
d.a]]),d=function(b){function d(){e(this,d);return c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);m(d,[{key:"download",value:function(a,b){var d=this.parameters,c;c=this.computeChunkBounds(a);var l=a.chunkDataSize;c="/api/node/"+d.nodeKey+"/"+d.dataInstanceKey+"/raw/0_1_2/"+(l[0]+"_"+l[1]+"_"+l[2]+"/")+(c[0]+"_"+c[1]+"_"+c[2]+"/nd");return f.i(k.a)(f.i(k.c)(d.baseUrls,c),"arraybuffer",b).then(function(b){return f.i(g.a)(a,b)})}}]);return d}(b.ParameterizedVolumeChunkSource),
d=l([f.i(n.registerChunkSource)(h.b)],d),b=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.chunkDecoder=u.get(a.parameters.encoding);return a}a(d,b);m(d,[{key:"download",value:function(a,b){var d=this,c=this.parameters,g=a.chunkGridPosition;a.chunkDataSize=this.spec.chunkDataSize;g="/api/node/"+c.nodeKey+"/"+c.dataInstanceKey+"/tile/"+(c.dims+"/"+c.level+"/")+(g[0]+"_"+g[1]+"_"+g[2]);return f.i(k.a)(f.i(k.c)(c.baseUrls,g),"arraybuffer",
b).then(function(b){return d.chunkDecoder(a,b)})}}]);return d}(b.ParameterizedVolumeChunkSource),b=l([f.i(n.registerChunkSource)(h.c)],b)},function(n,h,f){function e(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 c(a,b){if(!(a instanceof
b))throw new TypeError("Cannot call a class as a function");}function a(a){f.i(D.isCompressed)(a)&&(a=f.i(D.decompress)(a));var b=new B;b.uncompressedData=a;a=f.i(D.readHeader)(a);if(null===a)throw Error("Failed to parse NIFTI header.");b.header=a;return b}function b(b,d,c,g){return k.a.getData(b,a,d,c,g)}function d(a,d,c){return b(a,d,function(){return{priorityTier:g.b.VISIBLE,priority:1E3}},c).then(function(a){return a.header})}Object.defineProperty(h,"__esModule",{value:!0});n=f(1);var g=f(6),
k=f(20),m=f(61),l=f(4),u=f(10),p=f(17),v=f(7),r=f(2),y=f(0),D=f(95);f.n(D);f.d(h,"NiftiFileData",function(){return B});var q=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=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===
typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var e=a.length-1;0<=e;e--)if(l=a[e])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var B=function C(){c(this,C)},t=new Map([[m.a.INT8,{dataType:p.a.UINT8,volumeType:p.b.IMAGE}],[m.a.UINT8,{dataType:p.a.UINT8,volumeType:p.b.IMAGE}],[m.a.INT16,{dataType:p.a.UINT16,volumeType:p.b.IMAGE}],[m.a.UINT16,{dataType:p.a.UINT16,volumeType:p.b.IMAGE}],[m.a.INT32,{dataType:p.a.UINT32,volumeType:p.b.SEGMENTATION}],
[m.a.UINT32,{dataType:p.a.UINT32,volumeType:p.b.SEGMENTATION}],[m.a.INT64,{dataType:p.a.UINT64,volumeType:p.b.SEGMENTATION}],[m.a.UINT64,{dataType:p.a.UINT64,volumeType:p.b.SEGMENTATION}],[m.a.FLOAT32,{dataType:p.a.FLOAT32,volumeType:p.b.IMAGE}]]);f.i(y.c)(m.b,function(a,b){return d(this.getRef(a.chunkManager),a.url,b).then(function(a){var b=t.get(a.datatypeCode);if(void 0===b)throw Error("Unsupported data type: "+(m.a[a.datatypeCode]||a.datatypeCode)+".");if(1!==a.dims[4])throw Error("Time series data not supported.");
var d=1;switch(a.xyzt_units&D.NIFTI1.SPATIAL_UNITS_MASK){case D.NIFTI1.UNITS_METER:d=1E9;break;case D.NIFTI1.UNITS_MM:d=1E6;break;case D.NIFTI1.UNITS_MICRON:d=1E3}var c=a.quatern_b,g=a.quatern_c,k=a.quatern_d,l=Math.sqrt(1-c*c-g*g-k*k),e=-1===a.pixDims[0]?-1:1,f=a.description,p;p=a.affine;p=r.b.fromValues(p[0][0],p[1][0],p[2][0],p[3][0],p[0][1],p[1][1],p[2][1],p[3][1],p[0][2],p[1][2],p[2][2],p[3][2],p[0][3],p[1][3],p[2][3],p[3][3]);return{value:{description:f,affine:p,dataType:b.dataType,numChannels:a.dims[5],
volumeType:b.volumeType,voxelSize:r.a.fromValues(d*a.pixDims[1],d*a.pixDims[2],d*a.pixDims[3]),volumeSize:r.a.fromValues(a.dims[1],a.dims[2],a.dims[3]),qoffset:r.a.fromValues(d*a.qoffset_x,d*a.qoffset_y,d*a.qoffset_z),qform_code:a.qform_code,sform_code:a.sform_code,qfac:e,quatern:r.c.fromValues(c,g,k,l)}}})});l=function(a){function d(){c(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");
return!a||"object"!==typeof a&&"function"!==typeof a?this:a}e(d,a);q(d,[{key:"download",value:function(a,d){a.chunkDataSize=this.spec.chunkDataSize;return b(this.chunkManager.addRef(),this.parameters.url,function(){return{priorityTier:a.priorityTier,priority:a.priority}},d).then(function(b){var d=f.i(D.readImage)(b.header,b.uncompressedData);f.i(u.a)(a,d,b.header.littleEndian?v.b.LITTLE:v.b.BIG)})}}]);return d}(l.ParameterizedVolumeChunkSource);l=h([f.i(n.registerChunkSource)(m.c)],l)},function(n,
h,f){Object.defineProperty(h,"__esModule",{value:!0});f(28)},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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 b(a,b){return f.i(k.e)(a,b,"fragments")}function d(a,b){var d=(new DataView(b)).getUint32(0,!0);f.i(k.b)(a,b,v.b.LITTLE,4,d)}Object.defineProperty(h,"__esModule",{value:!0});n=f(1);var g=f(62),k=f(13),m=f(4),l=f(35),u=f(9),p=f(10),v=f(7),r=f(8);h.decodeManifestChunk=b;h.decodeFragmentChunk=d;var 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}}();h=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var e=a.length-1;0<=e;e--)if(l=a[e])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,
d,k),k};var D=new Map;D.set(g.a.RAW,p.a);D.set(g.a.JPEG,u.a);D.set(g.a.COMPRESSED_SEGMENTATION,l.a);m=function(b){function d(){e(this,d);var a=c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments));a.chunkDecoder=D.get(a.parameters.encoding);return a}a(d,b);y(d,[{key:"download",value:function(a,b){var d=this,c=this.parameters,g;g=this.computeChunkBounds(a);var k=a.chunkDataSize;g=c.path+"/"+g[0]+"-"+(g[0]+k[0])+"_"+(g[1]+"-"+(g[1]+k[1])+"_")+(g[2]+"-"+(g[2]+k[2]));return f.i(r.a)(f.i(r.c)(c.baseUrls,
g),"arraybuffer",b).then(function(b){return d.chunkDecoder(a,b)})}}]);return d}(m.ParameterizedVolumeChunkSource);m=h([f.i(n.registerChunkSource)(g.b)],m);m=function(g){function k(){e(this,k);return c(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}a(k,g);y(k,[{key:"download",value:function(a,d){var c=this.parameters,g=c.path+"/"+a.objectId+":"+c.lod;return f.i(r.a)(f.i(r.c)(c.baseUrls,g),"json",d).then(function(d){return b(a,d)})}},{key:"downloadFragment",value:function(a,b){var c=
this.parameters,g=c.path+"/"+a.fragmentId;return f.i(r.a)(f.i(r.c)(c.baseUrls,g),"arraybuffer",b).then(function(b){return d(a,b)})}}]);return k}(k.c);m=h([f.i(n.registerChunkSource)(g.c)],m)},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}function c(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 a(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 b(a,b){var d=(new DataView(b)).getUint32(0,!0);f.i(g.b)(a,b,r.b.LITTLE,4,d)}Object.defineProperty(h,"__esModule",{value:!0});n=f(1);var d=f(63),g=f(13),k=f(34),m=f(4),l=f(9),u=f(36),p=f(10),v=f(11),r=f(7),y=f(8);h.decodeFragmentChunk=
b;f.d(h,"MeshSource",function(){return B});f.d(h,"SkeletonSource",function(){return t});var 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=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===
typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var e=a.length-1;0<=e;e--)if(l=a[e])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var q=new Map;q.set(d.a.NPZ,u.a);q.set(d.a.JPEG,l.a);q.set(d.a.RAW,p.a);var m=function(b){function g(){e(this,g);var a=c(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments));a.chunkDecoder=q.get(a.parameters.encoding);a.encoding=d.a[a.parameters.encoding].toLowerCase();return a}a(g,b);D(g,[{key:"download",
value:function(a,b){for(var d=this,c=this.parameters,g="/neuroglancer/"+this.encoding+"/"+c.key,k=this.computeChunkBounds(a),l=a.chunkDataSize,e=0;3>e;++e)g+="/"+k[e]+","+(k[e]+l[e]);return f.i(y.a)(f.i(y.c)(c.baseUrls,g),"arraybuffer",b).then(function(b){return d.chunkDecoder(a,b)})}}]);return g}(m.ParameterizedVolumeChunkSource),m=h([f.i(n.registerChunkSource)(d.b)],m),B=function(d){function g(){e(this,g);return c(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments))}a(g,d);D(g,[{key:"download",
value:function(a){a.fragmentIds=[""];return Promise.resolve(void 0)}},{key:"downloadFragment",value:function(a,d){var c=this.parameters,g="/neuroglancer/mesh/"+c.key+"/"+a.manifestChunk.objectId;return f.i(y.a)(f.i(y.c)(c.baseUrls,g),"arraybuffer",d).then(function(d){return b(a,d)})}}]);return g}(g.c),B=h([f.i(n.registerChunkSource)(d.c)],B),t=function(b){function d(){e(this,d);return c(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}a(d,b);D(d,[{key:"download",value:function(a,
b){var d=this.parameters,c="/neuroglancer/skeleton/"+d.key+"/"+a.objectId;return f.i(y.a)(f.i(y.c)(d.baseUrls,c),"arraybuffer",b).then(function(b){for(var c=d.vertexAttributes,g=new DataView(b),l=g.getUint32(0,!0),g=g.getUint32(4,!0),e=8+12*l,m=[],c=$jscomp.makeIterator(c.values()),p=c.next();!p.done;p=c.next()){var p=p.value,p=v.b[p.dataType]*p.numComponents,x=p*l,h=new Uint8Array(b,e,x);switch(p){case 2:f.i(r.d)(h,r.b.LITTLE);break;case 4:case 8:f.i(r.a)(h,r.b.LITTLE)}m.push(h);e+=x}a.vertexAttributes=
m;f.i(k.a)(a,b,r.b.LITTLE,8,l,e,g)})}}]);return d}(k.b),t=h([f.i(n.registerChunkSource)(d.d)],t)},function(n,h,f){function e(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(h,"__esModule",{value:!0});n=f(1);h=f(64);var c=f(4),
a=f(9),b=f(2),d=f(8),g=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}}(),k=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,l;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,d,c);else for(var e=
a.length-1;0<=e;e--)if(l=a[e])k=(3>g?l(k):3<g?l(b,d,k):l(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k},m=new Map;m.set("jpg",a.a);c=function(a){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");var a;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.chunkDecoder=m.get(a.parameters.encoding);
return a}e(c,a);g(c,[{key:"download",value:function(a,c){var g=this,k=this.parameters,l=a.chunkGridPosition,e=1/Math.pow(2,k.level);a.chunkDataSize=this.spec.chunkDataSize;var m=a.chunkDataSize[0]*Math.pow(2,k.level),p=a.chunkDataSize[1]*Math.pow(2,k.level),h=b.a.create();h[0]=l[0]*m;h[1]=l[1]*p;h[2]=l[2];l="/render-ws/v1/owner/"+k.owner+"/project/"+k.project+"/stack/"+k.stack+"/z/"+h[2]+"/box/"+h[0]+","+h[1]+","+m+","+p+","+e+"/jpeg-image";return f.i(d.a)(f.i(d.c)(k.baseUrls,l),"arraybuffer",c).then(function(b){return g.chunkDecoder(a,
b)})}}]);return c}(c.ParameterizedVolumeChunkSource);c=k([f.i(n.registerChunkSource)(h.a)],c)},function(n,h,f){function e(b){return f.i(a.a)(f.i(d.a)(b))}Object.defineProperty(h,"__esModule",{value:!0});var c=f(20),a=f(65);n=f(33);var b=f(11),d=f(37);f.i(n.b)("vtk",{description:"VTK",getMesh:function(a,d,m,l){return c.a.getData(a.addRef(),e,d,m,l).then(function(a){var d={info:{numTriangles:a.numTriangles,numVertices:a.numVertices,vertexAttributes:[]},indices:a.indices,vertexPositions:a.vertexPositions,
vertexAttributes:[]};a=$jscomp.makeIterator(a.vertexAttributes);for(var c=a.next();!c.done;c=a.next())c=c.value,d.info.vertexAttributes.push({name:c.name,dataType:b.a.FLOAT32,numComponents:c.numComponents}),d.vertexAttributes.push(c.data);return d})}})},function(n,h,f){n=f(31);h=f(0);var e=f(29),c=null;n.b.getNewTokenPromise=function(a){var b={};null!=a&&(b.invalidToken=a);a=new Promise(function(a,b){c=a});e.rpc.invoke("brainmaps.requestToken",b);return a};f.i(h.d)("brainmaps.receiveToken",function(a){c(a.authResult)})},
function(n,h,f){function e(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 c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var a=f(30);f.d(h,"a",function(){return d});f.d(h,"b",function(){return k});
f.d(h,"c",function(){return m});f.d(h,"d",function(){return l});var b=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}}(),d;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(d||(d={}));var g=function(){function a(){c(this,a)}b(a,null,[{key:"stringify",
value:function(a){return void 0===a?"":a.changeStackId+"/"+a.timeStamp+"/"+a.skipEquivalences}}]);return a}(),k=function(){function k(){c(this,k)}b(k,null,[{key:"stringify",value:function(b){return"brainmaps-"+f.i(a.b)(b.instance)+":volume/"+b.volumeId+"/"+(b.scaleIndex+"/"+d[b.encoding]+"/")+(""+g.stringify(b.changeSpec))}}]);return k}();k.RPC_ID="brainmaps/VolumeChunkSource";var m=function(){function d(){c(this,d)}b(d,null,[{key:"stringify",value:function(b){return"brainmaps:"+f.i(a.b)(b.instance)+
":mesh/"+(b.volumeId+"/"+b.meshName+"/")+(""+g.stringify(b.changeSpec))}}]);return d}();m.RPC_ID="brainmaps/MeshSource";var l=function(a){function b(){c(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}e(b,a);return b}(m);l.RPC_ID="brainmaps/SkeletonSource"},function(n,h,f){function e(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 c(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(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}f.d(h,"b",function(){return d});f.d(h,
"a",function(){return g});f.d(h,"c",function(){return k});var b=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}}();n=function l(){a(this,l)};var d=function(d){function g(){a(this,g);return e(this,(g.__proto__||Object.getPrototypeOf(g)).apply(this,arguments))}c(g,d);b(g,null,[{key:"stringify",value:function(a){return"dvid:volume:"+
a.baseUrls[0]+"/"+a.nodeKey+"/"+a.dataInstanceKey}}]);return g}(n);d.RPC_ID="dvid/VolumeChunkSource";var g;(function(a){a[a.JPEG=0]="JPEG"})(g||(g={}));var k=function(d){function k(){a(this,k);return e(this,(k.__proto__||Object.getPrototypeOf(k)).apply(this,arguments))}c(k,d);b(k,null,[{key:"stringify",value:function(a){return"dvid:volume:"+a.baseUrls[0]+"/"+a.nodeKey+"/"+a.dataInstanceKey+"/"+a.dims+"/"+a.level+"/"+g[a.encoding]}}]);return k}(n);k.RPC_ID="dvid/TileChunkSource"},function(n,h,f){f.d(h,
"a",function(){return c});var e=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];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}}(),c=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}e(a,null,[{key:"stringify",value:function(a){return"ndstore:volume:"+a.baseUrls[0]+"/"+a.key+"/"+a.channel+"/"+a.resolution+
"/"+a.encoding}}]);return a}();c.RPC_ID="ndstore/VolumeChunkSource"},function(n,h,f){f.d(h,"a",function(){return c});f.d(h,"c",function(){return a});var e=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,k){c&&a(b.prototype,c);k&&a(b,k);return b}}();h.b="nifti/getNiftiVolumeInfo";var c;(function(a){a[a.NONE=0]="NONE";a[a.BINARY=1]="BINARY";a[a.UINT8=2]=
"UINT8";a[a.INT16=4]="INT16";a[a.INT32=8]="INT32";a[a.FLOAT32=16]="FLOAT32";a[a.COMPLEX64=32]="COMPLEX64";a[a.FLOAT64=64]="FLOAT64";a[a.RGB24=128]="RGB24";a[a.INT8=256]="INT8";a[a.UINT16=512]="UINT16";a[a.UINT32=768]="UINT32";a[a.INT64=1024]="INT64";a[a.UINT64=1280]="UINT64";a[a.FLOAT128=1536]="FLOAT128";a[a.COMPLEX128=1792]="COMPLEX128";a[a.COMPLEX256=2048]="COMPLEX256"})(c||(c={}));var a=function(){function a(){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");}e(a,
null,[{key:"stringify",value:function(a){return"nifti:"+a.url}}]);return a}();a.RPC_ID="nifti/VolumeChunkSource"},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}f.d(h,"a",function(){return a});f.d(h,"b",function(){return b});f.d(h,"c",function(){return d});var c=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}}(),a;(function(a){a[a.RAW=0]="RAW";a[a.JPEG=1]="JPEG";a[a.COMPRESSED_SEGMENTATION=2]="COMPRESSED_SEGMENTATION"})(a||(a={}));var b=function(){function a(){e(this,a)}c(a,null,[{key:"stringify",value:function(a){return"precomputed:volume:"+a.baseUrls[0]+"/"+a.path}}]);return a}();b.RPC_ID="precomputed/VolumeChunkSource";var d=function(){function a(){e(this,a)}c(a,null,[{key:"stringify",value:function(a){return"precomputed:mesh:"+a.baseUrls[0]+
"/"+a.path+"/"+a.lod}}]);return a}();d.RPC_ID="precomputed/MeshSource"},function(n,h,f){function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}f.d(h,"a",function(){return a});f.d(h,"b",function(){return b});f.d(h,"c",function(){return d});f.d(h,"d",function(){return g});var c=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}}(),a;(function(a){a[a.JPEG=0]="JPEG";a[a.NPZ=1]="NPZ";a[a.RAW=2]="RAW"})(a||(a={}));var b=function(){function b(){e(this,b)}c(b,null,[{key:"stringify",value:function(b){return"python:volume:"+b.baseUrls[0]+"/"+b.key+"/"+a[b.encoding]}}]);return b}();b.RPC_ID="python/VolumeChunkSource";var d=function(){function a(){e(this,a)}c(a,null,[{key:"stringify",value:function(a){return"python:mesh:"+a.baseUrls[0]+"/"+a.key}}]);return a}();d.RPC_ID="python/MeshSource";
var g=function(){function a(){e(this,a)}c(a,null,[{key:"stringify",value:function(a){return"python:skeleton:"+a.baseUrls[0]+"/"+a.key}}]);return a}();g.RPC_ID="python/SkeletonSource"},function(n,h,f){function e(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 c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}f.d(h,"a",function(){return b});var a=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}}(),b=function(b){function d(){c(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");
return!a||"object"!==typeof a&&"function"!==typeof a?this:a}e(d,b);a(d,null,[{key:"stringify",value:function(a){return"render:tile:"+a.baseUrls[0]+"/"+a.owner+"/"+a.project+"/"+a.stack+"/"+a.level+"/"+a.encoding}}]);return d}(function g(){c(this,g)});b.RPC_ID="render/TileChunkSource"},function(n,h,f){h.a=function(a){var b=(new TextDecoder).decode(new Uint8Array(a.buffer,a.byteOffset,Math.min(a.byteLength,1E3))).match(e);if(null===b)throw Error("Failed to parse VTK file header.");var d=b[0].length,
c=b[4],g=b[3],b={version:b[1],comment:b[2],datasetType:c,dataFormat:g};a=new Uint8Array(a.buffer,a.byteOffset+d,a.byteLength-d);if("ASCII"===g){g=u.get(c);if(void 0===g)throw Error("VTK dataset type "+JSON.stringify(c)+" is not supported.");return g(b,a)}throw Error("VTK data format "+JSON.stringify(g)+" is not supported.");};var e=/^[ \t]*#[ \t]+vtk[ \t]+DataFile[ \t]+Version[ \t]+([^\s]+)[ \t]*\n(.*)\n[ \t]*(ASCII|BINARY)[ \t]*\n[ \t]*DATASET[ \t]+([^ ]+)[ \t]*\n/,c=/^[ \t]*POINT_DATA[ \t]+([0-9]+)[ \t]*$/,
a=/^[ \t]*POINTS[ \t]+([0-9]+)[ \t]+([^\s]+)[ \t]*$/,b=/^[ \t]*SCALARS[ \t]+([^\s]+)[ \t]+([^\s]+)(?:[ \t]+([0-9]+))?[ \t]*$/,d=/^[ \t]*LOOKUP_TABLE[ \t]+([^\s]+)[ \t]*$/,g=/^[ \t]*POLYGONS[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,k=/^[ \t]*3[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)[ \t]*$/,m=/^[ \t]*$/,l=function v(a,b,d,c,g,k){if(!(this instanceof v))throw new TypeError("Cannot call a class as a function");this.header=a;this.numVertices=b;this.vertexPositions=d;this.numTriangles=c;this.indices=g;this.vertexAttributes=
k},u=new Map([["POLYDATA",function(e,f){function h(a,b,d,c){c=RegExp("^[ \t]*"+"([^s]+)[ \t]+".repeat(d-1)+"([^s]+)[ \t]*$");if(n-C<b)throw Error("VTK data ended unexpectedly while parsing "+a+".");for(var g=new Float32Array(b*d),k=0,e=0;e<b;++e){var l=t[C++],m=l.match(c);if(null===m)throw Error("Failed to parse "+a+" line "+e+": "+JSON.stringify(l)+".");for(l=0;l<d;++l)g[k++]=parseFloat(m[l+1])}return g}function u(a,b){if(void 0!==x)throw Error("POINTS specified more than once.");z=a;G=h("POINTS",
a,3,b)}function v(a,b){if(void 0!==x)throw Error("VERTICES specified more than once.");if(n-C<a)throw Error("VTK data ended unexpectedly");if(b!==4*a)throw Error("Only triangular faces are supported.");H=a;x=new Uint32Array(3*a);for(var d=b=0;d<a;++d){var c=t[C++].match(k);if(null===c)throw Error("Failed to parse indices for face "+d);x[b++]=parseInt(c[1],10);x[b++]=parseInt(c[2],10);x[b++]=parseInt(c[3],10)}}function r(a){if(z!==a)throw Error("Number of vertices specified in POINT_DATA section ("+
a+") must match number of points ("+z+").");for(;C<n;)if(a=t[C],a.match(m))++C;else{var c;c=a.match(b);if(null!==c){var g;g=void 0===c[3]?1:parseInt(c[3],10);++C;a=c[1];c=c[2];if(C===n)throw Error("Expected LOOKUP_TABLE directive.");var k=t[C++],e=k.match(d);if(null===e)throw Error("Expected LOOKUP_TABLE directive in "+JSON.stringify(k)+".");k=e[1];e=h("SCALARS("+a+")",z,g,c);w.push({name:a,data:e,numComponents:g,dataType:c,tableName:k})}}}for(var t=(new TextDecoder).decode(f).split("\n"),n=t.length,
C=0,z=-1,G=void 0,H=-1,x=void 0,w=[];C<n;)if(f=t[C],f.match(m))++C;else{var L=void 0,L=f.match(a);if(null!==L)++C,u(parseInt(L[1],10),L[2]);else if(L=f.match(g),null!==L)++C,v(parseInt(L[1],10),parseInt(L[2],10));else{L=f.match(c);if(null!==L){++C;r(parseInt(L[1],10));break}throw Error("Failed to parse VTK line "+JSON.stringify(f)+".");}}if(void 0===G)throw Error("Vertex positions not specified.");if(void 0===x)throw Error("Indices not specified.");return new l(e,z,G,H,x,w)}]])},function(n,h,f){f.d(h,
"a",function(){return c});var e=function(){function a(a,d){for(var b=0;b<d.length;b++){var c=d[b];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}}(),c=function(){function a(b,d,c,k){if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.a0=b;this.a1=d;this.b=c;this.c=k}e(a,[{key:"computeDotProduct",value:function(a,d){var b=this.a0,c=this.a1;
return b[0]*(a&255)+b[1]*(a>>8&255)+b[2]*(a>>16&255)+b[3]*(a>>24&255)+(c[0]*(d&255)+c[1]*(d>>8&255)+c[2]*(d>>16&255)+c[3]*(d>>24&255))}},{key:"compute",value:function(a,d){var b=this.b,c=this.c;a=this.computeDotProduct(a,d);return(a+a*a%4093*c+b)%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 b(){return Math.floor(4093*Math.random())}return new a(Float32Array.of(b(),
b(),b(),b()),Float32Array.of(b(),b(),b(),b()),b(),b())}}]);return a}()},function(n,h,f){function e(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 c(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(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var b=f(66),d=f(16);f.d(h,"a",function(){return v});var g=function t(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 t(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}},k=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}}(),m=0,l=0,u=0,p=0;n=function(){function c(b){b=void 0===b?c.generateHashFunctions(3):b;a(this,c);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=b;this.allocate(4,1)}k(c,[{key:"updateHashFunctions",value:function(a){this.hashFunctions=c.generateHashFunctions(a);this.mungedEmptyKey=-1}},{key:"tableWithMungedEmptyKey",value:function(a){for(var b=this.hashFunctions.length,d=Array(b),c=0;c<b;++c)d[c]=this.getHash(c,this.emptyLow,this.emptyHigh);c=this.mungedEmptyKey;if(-1===c)a:for(;;){for(var c=16777216*Math.random()>>>0,g=0;g<b;++g)for(var k=this.getHash(g,c,c),e=0;e<b;++e)if(d[e]===k)continue a;this.mungedEmptyKey=
c;break}for(var g=this.table,k=this.emptyLow,e=this.emptyHigh,l=0;l<b;++l){var m=d[l];g[m]===k&&g[m+1]===e&&(g[m]=c,g[m+1]=c)}try{a(g)}finally{for(a=0;a<b;++a)l=d[a],g[l]===c&&g[l+1]===c&&(g[l]=k,g[l+1]=e)}}},{key:"getHash",value:function(a,b,d){a=this.hashFunctions[a];var c=this.width,g=this.height,c=a[0].compute(b,d)%c;b=a[1].compute(b,d)%g;return this.entryStride*(b*this.width+c)}},{key:"keys",value:function(a){function b(b,x){for(;;)switch(c){case 0:a=void 0===a?new d.a:a,u=v,t=u.emptyLow,p=u.emptyHigh,
h=u.entryStride,f=v,m=f.table,l=0,e=m.length;case 1:if(!(l<e)){c=3;break}k=m[l];g=m[l+1];if(k===t&&g===p){c=4;break}a.low=k;a.high=g;c=5;return{value:a,done:!1};case 5:if(void 0===x){c=6;break}c=-1;throw x;case 6:case 4:case 2:l+=h;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,k,e,l,m,f,h,p,t,u,v=this,r={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();r[Symbol.iterator]=
function(){return this};return r}},{key:"indexOfPair",value:function(a,b){var d=this.table,c=this.emptyHigh;if(a===this.emptyLow&&b===c)return-1;for(var c=0,g=this.hashFunctions.length;c<g;++c){var k=this.getHash(c,a,b);if(d[k]===a&&d[k+1]===b)return k}return-1}},{key:"indexOf",value:function(a){return this.indexOfPair(a.low,a.high)}},{key:"chooseAnotherEmptyKey",value:function(){for(var a=this.emptyLow,b=this.emptyHigh,d=this.table,c=this.entryStride,g,k;g=4294967296*Math.random()>>>0,k=4294967296*
Math.random()>>>0,g===a&&k===b||this.hasPair(g,k););this.emptyLow=g;this.emptyHigh=k;for(var e=0,l=d.length;e<l;e+=c)d[e]===a&&d[e+1]===b&&(d[e]=g,d[e+1]=k)}},{key:"has",value:function(a){return-1!==this.indexOf(a)}},{key:"hasPair",value:function(a,b){return-1!==this.indexOfPair(a,b)}},{key:"delete",value:function(a){a=this.indexOf(a);if(-1!==a){var b=this.table;b[a]=this.emptyLow;b[a+1]=this.emptyHigh;++this.generation;this.size--;return!0}return!1}},{key:"clearTable",value:function(){for(var a=
this.table,b=this.entryStride,d=this.emptyLow,c=this.emptyHigh,g=a.length,k=0;k<g;k+=b)a[k]=d,a[k+1]=c}},{key:"clear",value:function(){if(0===this.size)return!1;this.size=0;++this.generation;this.clearTable();return!0}},{key:"swapPending",value:function(a,b){var d=m,c=l;this.storePending(a,b);a[b]=d;a[b+1]=c}},{key:"storePending",value:function(a,b){m=a[b];l=a[b+1]}},{key:"backupPending",value:function(){u=m;p=l}},{key:"restorePending",value:function(){m=u;l=p}},{key:"tryToInsert",value:function(){for(var a=
0,b=this.emptyLow,d=this.emptyHigh,c=this.maxAttempts,g=this.table,k=this.hashFunctions.length,e=Math.floor(Math.random()*k);;){var f=this.getHash(e,m,l);this.swapPending(g,f);if(m===b&&l===d)return!0;if(++a===c)break;e=(e+Math.floor(Math.random()*(k-1))+1)%k}return!1}},{key:"allocate",value:function(a,b){var d=a*b;this.width=a;this.height=b;this.table=new Uint32Array(d*this.entryStride);this.maxAttempts=d;this.clearTable();this.capacity=d*this.loadFactor;this.mungedEmptyKey=-1}},{key:"rehash",value:function(a,
b,d){this.allocate(b,d);this.updateHashFunctions(this.hashFunctions.length);b=this.emptyLow;d=this.emptyHigh;for(var c=this.entryStride,g=0,k=a.length;g<k;g+=c){var e=a[g+1];if(a[g]!==b||e!==d)if(this.storePending(a,g),!this.tryToInsert())return!1}return!0}},{key:"grow",value:function(a){for(var b=this.table,d=this.width,c=this.height,g=this.maxWidth,k=this.maxHeight;;){var e=d*c,d=Math.min(g,Math.ceil(a/this.height));d*c<a&&(c=Math.min(k,Math.ceil(a/d)));var l=d*c;if(l<a&&l===e)throw Error("Maximum table size exceeded");
for(e=0;e<this.maxRehashAttempts;++e)if(this.rehash(b,d,c))return;a=Math.ceil(this.growFactor*a)}}},{key:"insertInternal",value:function(){++this.generation;m===this.emptyLow&&l===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(a){a=
void 0===a?3:a;for(var d=[],c=0;c<a;++c){var g=[b.a.generate(),b.a.generate()];d.push(g)}return d}}]);return c}();var v=function(b){function d(){a(this,d);return e(this,(d.__proto__||Object.getPrototypeOf(d)).apply(this,arguments))}c(d,b);$jscomp.initSymbol();$jscomp.initSymbolIterator();k(d,[{key:"add",value:function(a){var b=a.low;a=a.high;if(this.hasPair(b,a))return!1;m=b;l=a;this.insertInternal();return!0}},{key:Symbol.iterator,value:function(){return this.keys()}}]);return d}(n);v.prototype.entryStride=
2;var r=0,y=0,D=0,q=0;(function(b){function f(){a(this,f);return e(this,(f.__proto__||Object.getPrototypeOf(f)).apply(this,arguments))}c(f,b);$jscomp.initSymbol();$jscomp.initSymbolIterator();k(f,[{key:"set",value:function(a,b){var d=a.low;a=a.high;if(this.hasPair(d,a))return!1;m=d;l=a;r=b.low;y=b.high;this.insertInternal();return!0}},{key:"get",value:function(a,b){a=this.indexOf(a);if(-1===a)return!1;var d=this.table;b.low=d[a+2];b.high=d[a+3];return!0}},{key:"swapPending",value:function(a,b){var d=
r,c=y;g(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"swapPending",this).call(this,a,b);a[b+2]=d;a[b+3]=c}},{key:"storePending",value:function(a,b){g(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"storePending",this).call(this,a,b);r=a[b+2];y=a[b+3]}},{key:"backupPending",value:function(){g(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),"backupPending",this).call(this);D=r;q=y}},{key:"restorePending",value:function(){g(f.prototype.__proto__||Object.getPrototypeOf(f.prototype),
"restorePending",this).call(this);r=D;y=q}},{key:Symbol.iterator,value:function(){return this.entries()}},{key:"entries",value:function(a){function b(b,x){for(;;)switch(c){case 0:a=void 0===a?[new d.a,new d.a]:a,r=n,A=r.emptyLow,v=r.emptyHigh,u=r.entryStride,t=n,p=t.table,h=$jscomp.makeIterator(a),f=h.next().value,m=h.next().value,l=0,e=p.length;case 1:if(!(l<e)){c=3;break}k=p[l];g=p[l+1];if(k===A&&g===v){c=4;break}f.low=k;f.high=g;m.low=p[l+2];m.high=p[l+3];c=5;return{value:a,done:!1};case 5:if(void 0===
x){c=6;break}c=-1;throw x;case 6:case 4:case 2:l+=u;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,k,e,l,m,f,h,p,t,u,v,A,r,n=this,q={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();q[Symbol.iterator]=function(){return this};return q}}]);return f})(n).prototype.entryStride=4},function(n,h,f){h.b="mesh/MeshLayer";h.a="mesh/FragmentSource"},function(n,h,f){function e(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 c=f(80),a=f(12),b=f(15),d=f(16);n=f(0);var g=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}}(),k=function v(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 v(a,b,d)}else{if("value"in c)return c.value;b=c.get;return void 0===b?void 0:b.call(d)}};h=this&&this.__decorate||function(a,b,d,c){var g=arguments.length,k=3>g?b:null===c?c=Object.getOwnPropertyDescriptor(b,d):c,e;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=
Reflect.decorate(a,b,d,c);else for(var l=a.length-1;0<=l;l--)if(e=a[l])k=(3>g?e(k):3<g?e(b,d,k):e(b,d))||k;return 3<g&&k&&Object.defineProperty(b,d,k),k};var m=function(l){function m(){if(!(this instanceof m))throw new TypeError("Cannot call a class as a function");var a;a=(m.__proto__||Object.getPrototypeOf(m)).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.disjointSets=
new c.a;a.changed=new b.b;return a}e(m,l);g(m,[{key:"disposed",value:function(){this.changed=this.disjointSets=void 0;k(m.prototype.__proto__||Object.getPrototypeOf(m.prototype),"disposed",this).call(this)}},{key:"link",value:function(a,b){if(this.disjointSets.link(a,b)){var d=this.rpc;d&&d.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(b){var c=this;this.clear();if(void 0!==b){var g=[new d.a,new d.a];f.i(a.e)(b,function(b){f.i(a.e)(b,function(a,b){g[b%2].parseString(String(a),10);0!==b&&c.link(g[0],g[1])})})}}},{key:"size",get:function(){return this.disjointSets.size}}],
[{key:"makeWithCounterpart",value:function(a){var b=new this;b.initializeCounterpart(a);return b}}]);return m}(n.b),m=h([f.i(n.a)("DisjointUint64Sets")],m),l=new d.a,u=new d.a;f.i(n.d)("DisjointUint64Sets.add",function(a){var b=this.get(a.id);l.low=a.al;l.high=a.ah;u.low=a.bl;u.high=a.bh;b.disjointSets.link(l,u)&&b.changed.dispatch()});f.i(n.d)("DisjointUint64Sets.clear",function(a){a=this.get(a.id);a.disjointSets.clear()&&a.changed.dispatch()})},function(n,h,f){n=f(71);h=f(0);f.i(h.d)(n.a,function(e){var c=
this.get(e.id);e.visible?c.visibilityCount.inc():c.visibilityCount.dec()})},function(n,h,f){function e(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 c=f(24);(function(a){function b(a){a=void 0===a?new c.a:a;if(!(this instanceof b))throw new TypeError("Cannot call a class as a function");
var d;d=(b.__proto__||Object.getPrototypeOf(b)).call(this);if(!this)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");d=!d||"object"!==typeof d&&"function"!==typeof d?this:d;d.visibilityCount=a;return d}e(b,a);return b})(f(0).e);h.a="shared_visibility_count.onVisibilityChange"},function(n,h,f){var e=function(){function c(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(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}();h.c="single_mesh/SingleMeshLayer";h.b="single_mesh/SingleMeshSource";h.d="single_mesh/getSingleMeshInfo";h.a="";(function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");}e(c,null,[{key:"stringify",value:function(a){return"single_mesh:"+JSON.stringify(a)}}]);return c})().RPC_ID="single_mesh/SingleMeshSource"},function(n,h,f){h.a="skeleton/SkeletonLayer"},function(n,h,f){var e=
f(2);f.d(h,"a",function(){return a});var c=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,k){c&&a(b.prototype,c);k&&a(b,k);return b}}(),a=function(){function a(b,c){c=void 0===c?e.i:c;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.size=e.a.clone(b);this.transform=e.b.clone(c);this.invTransform=e.b.invert(e.b.create(),
c)}c(a,[{key:"toObject",value:function(a){a.size=this.size;a.transform=this.transform}},{key:"localSpatialToGlobal",value:function(a,b){return e.a.transformMat4(a,b,this.transform)}},{key:"globalToLocalSpatial",value:function(a,b){return e.a.transformMat4(a,b,this.invTransform)}},{key:"globalToLocalGrid",value:function(a,b){this.globalToLocalSpatial(a,b);e.a.divide(a,a,this.size);return a}},{key:"localSpatialVectorToGlobal",value:function(a,b){return f.i(e.g)(a,b,this.transform)}},{key:"globalToLocalSpatialVector",
value:function(a,b){return f.i(e.g)(a,b,this.invTransform)}},{key:"assignLocalSpatialToGlobalMat4",value:function(a){return e.b.copy(a,this.transform)}}],[{key:"get",value:function(b,c){c=void 0===c?e.i:c;var d=a.cache,g=JSON.stringify([Array.from(b),Array.from(c)]),l=d.get(g);void 0===l&&(l=new a(b,c),d.set(g,l));return l}},{key:"fromObject",value:function(b){return a.get(b.size,b.transform)}}]);return a}();a.cache=new Map},function(n,h,f){function e(a,e,h,v,r,n,D,q){var l=r[0],p=r[1],u=r[2];r=v[0];
var y=v[1];v=v[2];var z=h[0],G=h[1],H=h[2],H=H-G*p,G=G-z*l;if(0===l*p*u)return[0,0];h=r*y*v+31;if(void 0===b||b.length<h)b=new Uint32Array(h),d=new Uint32Array(1*h),g=new Uint32Array(1*h),k=new Uint32Array(h),m=new Uint32Array(h);h=b.subarray(0,h);h.fill(0);for(var x=d,w=g,L=k,O=m,K=0,F=a[e]+1>>>0,I=0,N=r-l,M=r*y-r*p,J=0;J<u;++J,e+=H,I+=M)for(var A=0;A<p;++A,e+=G,I+=N)for(var R=0;R<l;++R,e+=z){var V=a[e];V!==F&&(F=x[1*K]=V,L[K]=K++);h[I++]=K}L.subarray(0,K).sort(function(a,b){return x[a]-x[b]});a=
-1;l=x[1*L[0]]+1>>>0;for(p=0;p<K;++p)u=L[p],z=x[1*u],z!==l&&(++a,l=w[1*a]=z),O[u+1]=a;++a;return f.i(c.a)(q,n,D,r*y*v,a,w,h,O,1)}var c=f(18),a=f(19);h.a=function(b,d,g,k,m,h){m=void 0===m?0:m;h=void 0===h?f.i(a.a)(k,1):h;return f.i(c.c)(b,d,g,k,m,h,e)};var b,d,g,k,m},function(n,h,f){function e(a,e,h,v,r,n,D,q){var l=r[0],p=r[1],u=r[2];r=v[0];var y=v[1];v=v[2];var z=h[0],G=h[1],H=h[2],H=H-G*p,G=G-z*l;if(0===l*p*u)return[0,0];h=r*y*v+31;if(void 0===b||b.length<h)b=new Uint32Array(h),d=new Uint32Array(2*
h),g=new Uint32Array(2*h),k=new Uint32Array(h),m=new Uint32Array(h);h=b.subarray(0,h);h.fill(0);for(var x=d,w=g,L=k,O=m,K=0,F=a[e]+1>>>0,I=0,N=0,M=r-l,J=r*y-r*p,A=0;A<u;++A,e+=H,N+=J)for(var R=0;R<p;++R,e+=G,N+=M)for(var V=0;V<l;++V,e+=z){var Q=a[e],U=a[e+1];if(Q!==F||U!==I)F=x[2*K]=Q,I=x[2*K+1]=U,L[K]=K++;h[N++]=K}L.subarray(0,K).sort(function(a,b){var c=x[2*a],d=x[2*b];return x[2*a+1]-x[2*b+1]||c-d});a=-1;l=x[2*L[0]]+1>>>0;for(p=G=0;p<K;++p){u=L[p];H=2*u;z=x[H];H=x[H+1];if(z!==l||H!==G)++a,G=2*
a,l=w[G]=z,G=w[G+1]=H;O[u+1]=a}++a;return f.i(c.a)(q,n,D,r*y*v,a,w,h,O,2)}var c=f(18),a=f(19);h.a=function(b,d,g,k,m,h){m=void 0===m?0:m;h=void 0===h?f.i(a.a)(k,2):h;return f.i(c.c)(b,d,g,k,m,h,e)};var b,d,g,k,m},function(n,h,f){var e=f(105);f.n(e);var c=f(19),a=f(2);h.a=function(b,d,g){var k=new e.JpegDecoder;k.parse(b);if(k.width*k.height!==d[0]*d[1]*d[2])throw Error("JPEG data does not have the expected dimensions: width="+k.width+", height="+k.height+", chunkDataSize="+a.a.str(d));if(k.numComponents!==
g)throw Error("JPEG data does not have the expected number of components: components="+k.numComponents+", expected="+g);if(1===k.numComponents)return k.getData(k.width,k.height,!1);if(3===k.numComponents)return b=k.getData(k.width,k.height,!1),f.i(c.c)(b,k.width*k.height,3);throw Error("JPEG data has an unsupported number of components: components="+k.numComponents);}},function(n,h,f){function e(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 c=f(67);n=f(0);var a=f(15),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}}(),d=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)}};h=this&&this.__decorate||function(a,b,c,d){var g=arguments.length,k=3>g?b:null===d?d=Object.getOwnPropertyDescriptor(b,c):d,e;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)k=Reflect.decorate(a,b,c,d);else for(var l=a.length-1;0<=l;l--)if(e=a[l])k=(3>g?e(k):3<g?e(b,c,k):e(b,c))||k;return 3<
g&&k&&Object.defineProperty(b,c,k),k};var g=k=function(g){function l(){if(!(this instanceof l))throw new TypeError("Cannot call a class as a function");var b;b=(l.__proto__||Object.getPrototypeOf(l)).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.hashTable=new c.a;b.changed=new a.a;return b}e(l,g);$jscomp.initSymbol();$jscomp.initSymbolIterator();b(l,[{key:"disposed",value:function(){d(l.prototype.__proto__||
Object.getPrototypeOf(l.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 k;b.initializeCounterpart(a);return b}}]);return l}(n.b),g=k=h([f.i(n.a)("Uint64Set")],g);f.i(n.d)("Uint64Set.add",function(a){var b=this.get(a.id);b.add_(a.value)&&b.changed.dispatch()});f.i(n.d)("Uint64Set.delete",function(a){var b=this.get(a.id);b.delete_(a.value)&&b.changed.dispatch()});f.i(n.d)("Uint64Set.clear",function(a){a=this.get(a.id);a.hashTable.clear()&&a.changed.dispatch()});var k},function(n,h,f){h.a=function(e,c){return e===c?
!0:1E-6>Math.abs(e-c)/Math.min(Math.abs(e),Math.abs(c))}},function(n,h,f){function e(a){for(var b=a,c=a[g];c!==a;)a=c,c=a[g];for(a=b[g];c!==a;)b[g]=c,b=a,a=b[g];return c}function c(a){function b(b,e){for(;;)switch(c){case 0:g=!0,d=a;case 1:if(!g&&d===a){c=3;break}c=4;return{value:d,done:!1};case 4:if(void 0===e){c=5;break}c=-1;throw e;case 5:d=d[k];case 2:g=!1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,g,e={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();e[Symbol.iterator]=function(){return this};return e}var a=f(16);f.d(h,"a",function(){return u});var 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}}();$jscomp.initSymbol();var d=Symbol("disjoint_sets:rank");$jscomp.initSymbol();
var g=Symbol("disjoint_sets:parent");$jscomp.initSymbol();var k=Symbol("disjoint_sets:next");$jscomp.initSymbol();var m=Symbol("disjoint_sets:prev");$jscomp.initSymbol();var l=Symbol("disjoint_sets:min"),u=function(){function f(){if(!(this instanceof f))throw new TypeError("Cannot call a class as a function");this.map=new Map;this.generation=0}$jscomp.initSymbol();$jscomp.initSymbolIterator();b(f,[{key:"get",value:function(a){var b=this.map.get(a.toString());return void 0===b?a:e(b)[l]}},{key:"isMinElement",
value:function(b){var c=this.get(b);return c===b||a.a.equal(c,b)}},{key:"makeSet",value:function(a){var b=a.toString(),c=this.map,f=c.get(b);return void 0===f?(a=f=a.clone(),a[g]=a,a[d]=0,a[k]=a[m]=a,f[l]=f,c.set(b,f),f):e(f)}},{key:"link",value:function(b,c){b=this.makeSet(b);c=this.makeSet(c);if(b===c)return!1;this.generation++;var e;e=b;var f=c,h=e[d],p=f[d];h>p?f[g]=e:(e[g]=f,h===p&&(f[d]=p+1),e=f);var f=b,h=c,p=f[m],t=h[m];h[m]=p;p[k]=h;f[m]=t;t[k]=f;b=b[l];c=c[l];e[l]=a.a.less(b,c)?b:c;return!0}},
{key:"setElements",value:function(a){function b(b,f){for(;;)switch(d){case 0:l=a.toString();e=m.map.get(l);if(void 0!==e){d=1;break}d=3;return{value:a,done:!1};case 3:if(void 0===f){d=4;break}d=-1;throw f;case 4:d=2;break;case 1:k=$jscomp.makeIterator(c(e));case 5:if((g=k.next(b)).done){d=6;break}d=7;return{value:g.value,done:!1};case 7:if(void 0===f){d=8;break}d=-1;throw f;case 8:d=5;break;case 6:case 2:d=-1;default:return{value:void 0,done:!0}}}var d=0,g,k,e,l,m=this,f={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();f[Symbol.iterator]=function(){return this};return f}},{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,f){for(;;)switch(c){case 0:a=void 0===a?Array(2):a,k=$jscomp.makeIterator(m.map.values()),g=k.next();case 1:if(g.done){c=3;break}d=g.value;a[0]=d;a[1]=e(d)[l];c=
4;return{value:a,done:!1};case 4:if(void 0===f){c=5;break}c=-1;throw f;case 5:case 2:g=k.next();c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,d,g,k,m=this,f={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();f[Symbol.iterator]=function(){return this};return f}},{key:Symbol.iterator,value:function(){return this.mappings()}},{key:"toJSON",value:function(){for(var b=[],
d=$jscomp.makeIterator(this.map.values()),k=d.next();!k.done;k=d.next()){var e=k.value;if(e[g]===e){for(var k=[],e=$jscomp.makeIterator(c(e)),l=e.next();!l.done;l=e.next())k.push(l.value);k.sort(a.a.compare);b.push(k)}}b.sort(function(b,c){return a.a.compare(b[0],c[0])});return b.map(function(a){return a.map(function(a){return a.toString()})})}},{key:"size",get:function(){return this.map.size}}]);return f}()},function(n,h,f){h.a=function(e){for(var c=0,a=e.length,b=0;b<a;++b)c=31*c+e.charCodeAt(b)|
0;return c}},function(n,h,f){var e=function(){function c(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(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}();n=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");}e(c,null,[{key:"insertAfter",value:function(a,b){var c=a.next0;b.next0=c;b.prev0=a;a.next0=b;c.prev0=b}},{key:"insertBefore",
value:function(a,b){var c=a.prev0;b.prev0=c;b.next0=a;a.prev0=b;c.next0=b}},{key:"front",value:function(a){var b=a.next0;return b===a?null:b}},{key:"back",value:function(a){var b=a.prev0;return b===a?null:b}},{key:"pop",value:function(a){var b=a.next0,c=a.prev0;b.prev0=c;c.next0=b;a.next0=null;a.prev0=null;return a}},{key:"iterator",value:function(a){function b(b,d){for(;;)switch(c){case 0:g=a.next0;case 1:if(g===a){c=3;break}c=4;return{value:g,done:!1};case 4:if(void 0===d){c=5;break}c=-1;throw d;
case 5:case 2:g=g.next0;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,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:"reverseIterator",value:function(a){function b(b,d){for(;;)switch(c){case 0:g=a.prev0;case 1:if(g===a){c=3;break}c=4;return{value:g,done:!1};case 4:if(void 0===d){c=5;break}c=-1;throw d;
case 5:case 2:g=g.prev0;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,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:"initializeHead",value:function(a){a.next0=a.prev0=a}}]);return c}();h.a=n},function(n,h,f){var e=function(){function c(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(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}();n=function(){function c(){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");}e(c,null,[{key:"insertAfter",value:function(a,b){var c=a.next1;b.next1=c;b.prev1=a;a.next1=b;c.prev1=b}},{key:"insertBefore",value:function(a,b){var c=a.prev1;b.prev1=c;b.next1=a;a.prev1=b;c.next1=b}},{key:"front",value:function(a){var b=a.next1;
return b===a?null:b}},{key:"back",value:function(a){var b=a.prev1;return b===a?null:b}},{key:"pop",value:function(a){var b=a.next1,c=a.prev1;b.prev1=c;c.next1=b;a.next1=null;a.prev1=null;return a}},{key:"iterator",value:function(a){function b(b,d){for(;;)switch(c){case 0:g=a.next1;case 1:if(g===a){c=3;break}c=4;return{value:g,done:!1};case 4:if(void 0===d){c=5;break}c=-1;throw d;case 5:case 2:g=g.next1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,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:"reverseIterator",value:function(a){function b(b,d){for(;;)switch(c){case 0:g=a.prev1;case 1:if(g===a){c=3;break}c=4;return{value:g,done:!1};case 4:if(void 0===d){c=5;break}c=-1;throw d;case 5:case 2:g=g.prev1;c=1;break;case 3:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,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:"initializeHead",value:function(a){a.next1=a.prev1=a}}]);return c}();h.a=n},function(n,h,f){function e(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 c(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function");}var a=f(23),b=f(12);f.d(h,"a",function(){return k});var d=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)}},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}}(),k=function(k){function l(){c(this,l);var a=(l.__proto__||Object.getPrototypeOf(l)).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}e(l,k);g(l,[{key:"get",
value:function(a,c){"string"!==typeof a&&(a=f.i(b.a)(a));return d(l.prototype.__proto__||Object.getPrototypeOf(l.prototype),"get",this).call(this,a,c)}},{key:"getUncounted",value:function(b,c){return this.get(b,function(){return new a.b(c())}).value}}]);return l}(function(){function a(){c(this,a);this.map=new Map}g(a,[{key:"get",value:function(a,b){var c=this.map,d=c.get(a);void 0===d?(d=b(),d.registerDisposer(function(){c.delete(a)}),c.set(a,d)):d.addRef();return d}}]);return a}())},function(n,h,
f){n=f(11);var e=f(7),c=f(12);h.a=function(b){if(147!==b[0]||78!==b[1]||85!==b[2]||77!==b[3]||80!==b[4]||89!==b[5])throw Error("Data does not match npy format.");var d=b[6],g=b[7];if(1!==d||0!==g)throw Error("Unsupported npy version "+d+"."+g);var d=(new DataView(b.buffer,b.byteOffset,b.byteLength)).getUint16(8,!0),g=(new TextDecoder("utf-8")).decode(b.subarray(10,d+10)),k,d=d+10;try{k=f.i(c.f)(g)}catch(B){throw Error("Failed to parse npy header: "+B);}var e=k.descr,g=k.shape,l=1;if(!Array.isArray(g))throw Error("Invalid shape ${JSON.stringify(shape)}");
for(var h=$jscomp.makeIterator(g),n=h.next();!n.done;n=h.next()){n=n.value;if("number"!==typeof n)throw Error("Invalid shape ${JSON.stringify(shape)}");l*=n}h=a.get(e);if(void 0===h)throw Error("Unsupported numpy data type "+JSON.stringify(e));e=h.arrayConstructor;l*=h.javascriptElementsPerArrayElement;if(e.BYTES_PER_ELEMENT*l+d!==b.byteLength)throw Error("Expected length does not match length of data");b=new e(b.buffer,b.byteOffset+d,l);h.fixEndianness(b);return new m(b,g,h,!0===k.fortran_order)};
var a=new Map;a.set("|u1",{arrayConstructor:Uint8Array,fixEndianness:function(){},javascriptElementsPerArrayElement:1,elementBytes:1,dataType:n.a.UINT8});a.set("|i1",{arrayConstructor:Uint8Array,fixEndianness:function(){},javascriptElementsPerArrayElement:1,elementBytes:1,dataType:n.a.UINT8});h={};for(var b=$jscomp.makeIterator([["<",e.b.LITTLE],[">",e.b.BIG]]),d=b.next();!d.done;h={endianness:h.endianness},d=b.next()){var g=$jscomp.makeIterator(d.value),d=g.next().value;h.endianness=g.next().value;
for(var g=$jscomp.makeIterator(["u","i"]),k=g.next();!k.done;k=g.next())k=k.value,a.set(""+d+k+"2",{arrayConstructor:Uint16Array,elementBytes:2,fixEndianness:function(a){return function(b){f.i(e.d)(b,a.endianness)}}(h),javascriptElementsPerArrayElement:1,dataType:n.a.UINT16}),a.set(""+d+k+"4",{arrayConstructor:Uint32Array,elementBytes:4,fixEndianness:function(a){return function(b){f.i(e.a)(b,a.endianness)}}(h),javascriptElementsPerArrayElement:1,dataType:n.a.UINT32}),a.set(""+d+k+"8",{arrayConstructor:Uint32Array,
elementBytes:8,fixEndianness:function(a){return function(b){f.i(e.a)(b,a.endianness)}}(h),javascriptElementsPerArrayElement:2,dataType:n.a.UINT64});a.set(d+"f4",{arrayConstructor:Float32Array,elementBytes:4,fixEndianness:function(a){return function(b){f.i(e.a)(b,a.endianness)}}(h),javascriptElementsPerArrayElement:1,dataType:n.a.FLOAT32})}var m=function u(a,b,c,d){if(!(this instanceof u))throw new TypeError("Cannot call a class as a function");this.data=a;this.shape=b;this.dataType=c;this.fortranOrder=
d}},function(n,h,f){h.a=function(a){if(a instanceof Object){var b=a[e];void 0===b&&(b=a[e]=c++);return"o"+b}return""+JSON.stringify(a)};$jscomp.initSymbol();var e=Symbol("objectId"),c=0},function(n,h,f){var e=function(){function c(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(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}();n=function(){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");
this.compare=a}e(c,[{key:"meld",value:function(a,b){if(null===b)return a;if(null===a)return b;var c=this.compare;c(b,a)&&(c=a,a=b,b=c);c=a.child0;b.next0=c;b.prev0=a;null!==c&&(c.prev0=b);a.child0=b;return a}},{key:"combineChildren",value:function(a){var b=a.child0;if(null===b)return null;for(a=null;;){var c=b.next0,g;null===c?g=null:(g=c.next0,b=this.meld(b,c));b.next0=a;a=b;if(null===g)break;b=g}g=a;for(a=a.next0;null!==a;)b=a.next0,g=this.meld(g,a),a=b;g.prev0=null;g.next0=null;return g}},{key:"removeMin",
value:function(a){var b=this.combineChildren(a);a.next0=null;a.prev0=null;a.child0=null;return b}},{key:"remove",value:function(a,b){if(a===b)return this.removeMin(a);var c=b.prev0,g=b.next0;c.child0===b?c.child0=g:c.next0=g;null!==g&&(g.prev0=c);a=this.meld(a,this.combineChildren(b));b.next0=null;b.prev0=null;b.child0=null;return a}},{key:"entries",value:function(a){function b(b,d){for(;;)switch(c){case 0:if(null===a){c=1;break}l=a.child0;c=2;return{value:a,done:!1};case 2:if(void 0===d){c=3;break}c=
-1;throw d;case 3:case 4:if(null===l){c=5;break}e=l.next0;k=$jscomp.makeIterator(f.entries(l));case 6:if((g=k.next(b)).done){c=7;break}c=8;return{value:g.value,done:!1};case 8:if(void 0===d){c=9;break}c=-1;throw d;case 9:c=6;break;case 7:l=e;c=4;break;case 5:case 1:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,k,e,l,f=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}},{key:"removedEntries",value:function(a){function b(b,d){for(;;)switch(c){case 0:if(null===a){c=1;break}l=a.child0;a.child0=null;a.next0=null;a.prev0=null;c=2;return{value:a,done:!1};case 2:if(void 0===d){c=3;break}c=-1;throw d;case 3:case 4:if(null===l){c=5;break}e=l.next0;l.child0=null;l.next0=null;l.prev0=null;k=$jscomp.makeIterator(f.entries(l));case 6:if((g=k.next(b)).done){c=7;break}c=8;return{value:g.value,done:!1};case 8:if(void 0===d){c=9;break}c=-1;throw d;
case 9:c=6;break;case 7:l=e;c=4;break;case 5:case 1:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,k,e,l,f=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}();h.a=n},function(n,h,f){var e=function(){function c(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(a,b,d){b&&c(a.prototype,b);d&&c(a,d);return a}}();n=function(){function c(a){if(!(this instanceof c))throw new TypeError("Cannot call a class as a function");this.compare=a}e(c,[{key:"meld",value:function(a,b){if(null===b)return a;if(null===a)return b;var c=this.compare;c(b,a)&&(c=a,a=b,b=c);c=a.child1;b.next1=c;b.prev1=a;null!==c&&(c.prev1=b);a.child1=b;return a}},{key:"combineChildren",value:function(a){var b=a.child1;if(null===
b)return null;for(a=null;;){var c=b.next1,g;null===c?g=null:(g=c.next1,b=this.meld(b,c));b.next1=a;a=b;if(null===g)break;b=g}g=a;for(a=a.next1;null!==a;)b=a.next1,g=this.meld(g,a),a=b;g.prev1=null;g.next1=null;return g}},{key:"removeMin",value:function(a){var b=this.combineChildren(a);a.next1=null;a.prev1=null;a.child1=null;return b}},{key:"remove",value:function(a,b){if(a===b)return this.removeMin(a);var c=b.prev1,g=b.next1;c.child1===b?c.child1=g:c.next1=g;null!==g&&(g.prev1=c);a=this.meld(a,this.combineChildren(b));
b.next1=null;b.prev1=null;b.child1=null;return a}},{key:"entries",value:function(a){function b(b,d){for(;;)switch(c){case 0:if(null===a){c=1;break}l=a.child1;c=2;return{value:a,done:!1};case 2:if(void 0===d){c=3;break}c=-1;throw d;case 3:case 4:if(null===l){c=5;break}e=l.next1;k=$jscomp.makeIterator(f.entries(l));case 6:if((g=k.next(b)).done){c=7;break}c=8;return{value:g.value,done:!1};case 8:if(void 0===d){c=9;break}c=-1;throw d;case 9:c=6;break;case 7:l=e;c=4;break;case 5:case 1:c=-1;default:return{value:void 0,
done:!0}}}var c=0,g,k,e,l,f=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}},{key:"removedEntries",value:function(a){function b(b,d){for(;;)switch(c){case 0:if(null===a){c=1;break}l=a.child1;a.child1=null;a.next1=null;a.prev1=null;c=2;return{value:a,done:!1};case 2:if(void 0===d){c=3;break}c=-1;throw d;case 3:case 4:if(null===
l){c=5;break}e=l.next1;l.child1=null;l.next1=null;l.prev1=null;k=$jscomp.makeIterator(f.entries(l));case 6:if((g=k.next(b)).done){c=7;break}c=8;return{value:g.value,done:!1};case 8:if(void 0===d){c=9;break}c=-1;throw d;case 9:c=6;break;case 7:l=e;c=4;break;case 5:case 1:c=-1;default:return{value:void 0,done:!0}}}var c=0,g,k,e,l,f=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}();h.a=n},function(n,h,f){f.d(h,"a",function(){return c});var e=function(){function a(a,c){for(var b=0;b<c.length;b++){var d=c[b];d.enumerable=d.enumerable||!1;d.configurable=!0;"value"in d&&(d.writable=!0);Object.defineProperty(a,d.key,d)}}return function(b,c,g){c&&a(b.prototype,c);g&&a(b,g);return b}}(),c=function(){function a(b){b=void 0===b?16:b;if(!(this instanceof a))throw new TypeError("Cannot call a class as a function");this.length=
0;this.data=new Uint32Array(b)}e(a,[{key:"resize",value:function(a){var b=this.data;if(a>b.length){var c=new Uint32Array(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 Uint32Array(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,c){this.data.copyWithin(a,c,this.length);
this.length-=c-a}},{key:"view",get:function(){var a=this.data;return new Uint32Array(a.buffer,a.byteOffset,this.length)}}]);return a}()},function(n,h,f){var e=f(3);h={create:function(){var c=new e.ARRAY_TYPE(4);c[0]=1;c[1]=0;c[2]=0;c[3]=1;return c},clone:function(c){var a=new e.ARRAY_TYPE(4);a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];return a},copy:function(c,a){c[0]=a[0];c[1]=a[1];c[2]=a[2];c[3]=a[3];return c},identity:function(c){c[0]=1;c[1]=0;c[2]=0;c[3]=1;return c},fromValues:function(c,a,b,d){var g=
new e.ARRAY_TYPE(4);g[0]=c;g[1]=a;g[2]=b;g[3]=d;return g},set:function(c,a,b,d,g){c[0]=a;c[1]=b;c[2]=d;c[3]=g;return c},transpose:function(c,a){if(c===a){var b=a[1];c[1]=a[2];c[2]=b}else c[0]=a[0],c[1]=a[2],c[2]=a[1],c[3]=a[3];return c},invert:function(c,a){var b=a[0],d=a[1],g=a[2];a=a[3];var k=b*a-g*d;if(!k)return null;k=1/k;c[0]=a*k;c[1]=-d*k;c[2]=-g*k;c[3]=b*k;return c},adjoint:function(c,a){var b=a[0];c[0]=a[3];c[1]=-a[1];c[2]=-a[2];c[3]=b;return c},determinant:function(c){return c[0]*c[3]-c[2]*
c[1]},multiply:function(c,a,b){var d=a[0],g=a[1],k=a[2];a=a[3];var e=b[0],l=b[1],f=b[2];b=b[3];c[0]=d*e+k*l;c[1]=g*e+a*l;c[2]=d*f+k*b;c[3]=g*f+a*b;return c}};h.mul=h.multiply;h.rotate=function(c,a,b){var d=a[0],g=a[1],k=a[2];a=a[3];var e=Math.sin(b);b=Math.cos(b);c[0]=d*b+k*e;c[1]=g*b+a*e;c[2]=d*-e+k*b;c[3]=g*-e+a*b;return c};h.scale=function(c,a,b){var d=a[1],g=a[2],k=a[3],e=b[0];b=b[1];c[0]=a[0]*e;c[1]=d*e;c[2]=g*b;c[3]=k*b;return c};h.fromRotation=function(c,a){var b=Math.sin(a);a=Math.cos(a);
c[0]=a;c[1]=b;c[2]=-b;c[3]=a;return c};h.fromScaling=function(c,a){c[0]=a[0];c[1]=0;c[2]=0;c[3]=a[1];return c};h.str=function(c){return"mat2("+c[0]+", "+c[1]+", "+c[2]+", "+c[3]+")"};h.frob=function(c){return Math.sqrt(Math.pow(c[0],2)+Math.pow(c[1],2)+Math.pow(c[2],2)+Math.pow(c[3],2))};h.LDU=function(c,a,b,d){c[2]=d[2]/d[0];b[0]=d[0];b[1]=d[1];b[3]=d[3]-c[2]*b[1];return[c,a,b]};h.add=function(c,a,b){c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];c[3]=a[3]+b[3];return c};h.subtract=function(c,a,b){c[0]=
a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];c[3]=a[3]-b[3];return c};h.sub=h.subtract;h.exactEquals=function(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&c[3]===a[3]};h.equals=function(c,a){var b=c[0],d=c[1],g=c[2];c=c[3];var k=a[0],m=a[1],l=a[2];a=a[3];return Math.abs(b-k)<=e.EPSILON*Math.max(1,Math.abs(b),Math.abs(k))&&Math.abs(d-m)<=e.EPSILON*Math.max(1,Math.abs(d),Math.abs(m))&&Math.abs(g-l)<=e.EPSILON*Math.max(1,Math.abs(g),Math.abs(l))&&Math.abs(c-a)<=e.EPSILON*Math.max(1,Math.abs(c),Math.abs(a))};
h.multiplyScalar=function(c,a,b){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;c[3]=a[3]*b;return c};h.multiplyScalarAndAdd=function(c,a,b,d){c[0]=a[0]+b[0]*d;c[1]=a[1]+b[1]*d;c[2]=a[2]+b[2]*d;c[3]=a[3]+b[3]*d;return c};n.exports=h},function(n,h,f){var e=f(3);h={create:function(){var c=new e.ARRAY_TYPE(6);c[0]=1;c[1]=0;c[2]=0;c[3]=1;c[4]=0;c[5]=0;return c},clone:function(c){var a=new e.ARRAY_TYPE(6);a[0]=c[0];a[1]=c[1];a[2]=c[2];a[3]=c[3];a[4]=c[4];a[5]=c[5];return a},copy:function(c,a){c[0]=a[0];c[1]=a[1];
c[2]=a[2];c[3]=a[3];c[4]=a[4];c[5]=a[5];return c},identity:function(c){c[0]=1;c[1]=0;c[2]=0;c[3]=1;c[4]=0;c[5]=0;return c},fromValues:function(c,a,b,d,g,k){var m=new e.ARRAY_TYPE(6);m[0]=c;m[1]=a;m[2]=b;m[3]=d;m[4]=g;m[5]=k;return m},set:function(c,a,b,d,g,k,e){c[0]=a;c[1]=b;c[2]=d;c[3]=g;c[4]=k;c[5]=e;return c},invert:function(c,a){var b=a[0],d=a[1],g=a[2],k=a[3],e=a[4];a=a[5];var l=b*k-d*g;if(!l)return null;l=1/l;c[0]=k*l;c[1]=-d*l;c[2]=-g*l;c[3]=b*l;c[4]=(g*a-k*e)*l;c[5]=(d*e-b*a)*l;return c},
determinant:function(c){return c[0]*c[3]-c[1]*c[2]},multiply:function(c,a,b){var d=a[0],g=a[1],k=a[2],e=a[3],l=a[4];a=a[5];var f=b[0],h=b[1],n=b[2],r=b[3],y=b[4];b=b[5];c[0]=d*f+k*h;c[1]=g*f+e*h;c[2]=d*n+k*r;c[3]=g*n+e*r;c[4]=d*y+k*b+l;c[5]=g*y+e*b+a;return c}};h.mul=h.multiply;h.rotate=function(c,a,b){var d=a[0],g=a[1],k=a[2],e=a[3],l=a[4];a=a[5];var f=Math.sin(b);b=Math.cos(b);c[0]=d*b+k*f;c[1]=g*b+e*f;c[2]=d*-f+k*b;c[3]=g*-f+e*b;c[4]=l;c[5]=a;return c};h.scale=function(c,a,b){var d=a[1],g=a[2],
k=a[3],e=a[4],l=a[5],f=b[0];b=b[1];c[0]=a[0]*f;c[1]=d*f;c[2]=g*b;c[3]=k*b;c[4]=e;c[5]=l;return c};h.translate=function(c,a,b){var d=a[0],g=a[1],k=a[2],e=a[3],l=a[4];a=a[5];var f=b[0];b=b[1];c[0]=d;c[1]=g;c[2]=k;c[3]=e;c[4]=d*f+k*b+l;c[5]=g*f+e*b+a;return c};h.fromRotation=function(c,a){var b=Math.sin(a);a=Math.cos(a);c[0]=a;c[1]=b;c[2]=-b;c[3]=a;c[4]=0;c[5]=0;return c};h.fromScaling=function(c,a){c[0]=a[0];c[1]=0;c[2]=0;c[3]=a[1];c[4]=0;c[5]=0;return c};h.fromTranslation=function(c,a){c[0]=1;c[1]=
0;c[2]=0;c[3]=1;c[4]=a[0];c[5]=a[1];return c};h.str=function(c){return"mat2d("+c[0]+", "+c[1]+", "+c[2]+", "+c[3]+", "+c[4]+", "+c[5]+")"};h.frob=function(c){return Math.sqrt(Math.pow(c[0],2)+Math.pow(c[1],2)+Math.pow(c[2],2)+Math.pow(c[3],2)+Math.pow(c[4],2)+Math.pow(c[5],2)+1)};h.add=function(c,a,b){c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];c[3]=a[3]+b[3];c[4]=a[4]+b[4];c[5]=a[5]+b[5];return c};h.subtract=function(c,a,b){c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];c[3]=a[3]-b[3];c[4]=a[4]-b[4];
c[5]=a[5]-b[5];return c};h.sub=h.subtract;h.multiplyScalar=function(c,a,b){c[0]=a[0]*b;c[1]=a[1]*b;c[2]=a[2]*b;c[3]=a[3]*b;c[4]=a[4]*b;c[5]=a[5]*b;return c};h.multiplyScalarAndAdd=function(c,a,b,d){c[0]=a[0]+b[0]*d;c[1]=a[1]+b[1]*d;c[2]=a[2]+b[2]*d;c[3]=a[3]+b[3]*d;c[4]=a[4]+b[4]*d;c[5]=a[5]+b[5]*d;return c};h.exactEquals=function(c,a){return c[0]===a[0]&&c[1]===a[1]&&c[2]===a[2]&&c[3]===a[3]&&c[4]===a[4]&&c[5]===a[5]};h.equals=function(c,a){var b=c[0],d=c[1],g=c[2],k=c[3],m=c[4];c=c[5];var l=a[0],
f=a[1],h=a[2],n=a[3],r=a[4];a=a[5];return Math.abs(b-l)<=e.EPSILON*Math.max(1,Math.abs(b),Math.abs(l))&&Math.abs(d-f)<=e.EPSILON*Math.max(1,Math.abs(d),Math.abs(f))&&Math.abs(g-h)<=e.EPSILON*Math.max(1,Math.abs(g),Math.abs(h))&&Math.abs(k-n)<=e.EPSILON*Math.max(1,Math.abs(k),Math.abs(n))&&Math.abs(m-r)<=e.EPSILON*Math.max(1,Math.abs(m),Math.abs(r))&&Math.abs(c-a)<=e.EPSILON*Math.max(1,Math.abs(c),Math.abs(a))};n.exports=h},function(n,h,f){var e=f(3),c={scalar:{},SIMD:{},create:function(){var a=new e.ARRAY_TYPE(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},clone:function(a){var b=new e.ARRAY_TYPE(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},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},fromValues:function(a,b,c,g,k,m,l,f,h,n,r,y,D,q,B,t){var d=new e.ARRAY_TYPE(16);d[0]=a;d[1]=b;d[2]=c;d[3]=g;d[4]=k;d[5]=m;d[6]=l;d[7]=f;d[8]=h;d[9]=n;d[10]=r;d[11]=y;d[12]=D;d[13]=q;d[14]=B;d[15]=t;return d},set:function(a,b,c,g,k,e,l,f,h,n,r,y,D,q,B,t,E){a[0]=b;a[1]=c;a[2]=g;a[3]=k;a[4]=e;a[5]=l;a[6]=f;a[7]=h;a[8]=n;a[9]=r;a[10]=y;a[11]=D;a[12]=q;a[13]=B;a[14]=t;a[15]=E;return a},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}};c.scalar.transpose=function(a,b){if(a===b){var c=b[1],g=b[2],k=b[3],e=b[6],l=b[7],f=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]=g;a[9]=e;a[11]=b[14];a[12]=k;a[13]=l;a[14]=f}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};c.SIMD.transpose=function(a,b){var c,
g,k,e,l,f;c=SIMD.Float32x4.load(b,0);g=SIMD.Float32x4.load(b,4);k=SIMD.Float32x4.load(b,8);b=SIMD.Float32x4.load(b,12);e=SIMD.Float32x4.shuffle(c,g,0,1,4,5);l=SIMD.Float32x4.shuffle(k,b,0,1,4,5);f=SIMD.Float32x4.shuffle(e,l,0,2,4,6);e=SIMD.Float32x4.shuffle(e,l,1,3,5,7);SIMD.Float32x4.store(a,0,f);SIMD.Float32x4.store(a,4,e);e=SIMD.Float32x4.shuffle(c,g,2,3,6,7);l=SIMD.Float32x4.shuffle(k,b,2,3,6,7);c=SIMD.Float32x4.shuffle(e,l,0,2,4,6);g=SIMD.Float32x4.shuffle(e,l,1,3,5,7);SIMD.Float32x4.store(a,
8,c);SIMD.Float32x4.store(a,12,g);return a};c.transpose=e.USE_SIMD?c.SIMD.transpose:c.scalar.transpose;c.scalar.invert=function(a,b){var c=b[0],g=b[1],k=b[2],e=b[3],l=b[4],f=b[5],h=b[6],n=b[7],r=b[8],y=b[9],D=b[10],q=b[11],B=b[12],t=b[13],E=b[14];b=b[15];var C=c*f-g*l,z=c*h-k*l,G=c*n-e*l,H=g*h-k*f,x=g*n-e*f,w=k*n-e*h,L=r*t-y*B,O=r*E-D*B,K=r*b-q*B,F=y*E-D*t,I=y*b-q*t,N=D*b-q*E,M=C*N-z*I+G*F+H*K-x*O+w*L;if(!M)return null;M=1/M;a[0]=(f*N-h*I+n*F)*M;a[1]=(k*I-g*N-e*F)*M;a[2]=(t*w-E*x+b*H)*M;a[3]=(D*x-
y*w-q*H)*M;a[4]=(h*K-l*N-n*O)*M;a[5]=(c*N-k*K+e*O)*M;a[6]=(E*G-B*w-b*z)*M;a[7]=(r*w-D*G+q*z)*M;a[8]=(l*I-f*K+n*L)*M;a[9]=(g*K-c*I-e*L)*M;a[10]=(B*x-t*G+b*C)*M;a[11]=(y*G-r*x-q*C)*M;a[12]=(f*O-l*F-h*L)*M;a[13]=(c*F-g*O+k*L)*M;a[14]=(t*z-B*H-E*C)*M;a[15]=(r*H-y*z+D*C)*M;return a};c.SIMD.invert=function(a,b){var c,g,k,e,l,f,h,n;l=SIMD.Float32x4.load(b,0);f=SIMD.Float32x4.load(b,4);h=SIMD.Float32x4.load(b,8);n=SIMD.Float32x4.load(b,12);b=SIMD.Float32x4.shuffle(l,f,0,1,4,5);g=SIMD.Float32x4.shuffle(h,
n,0,1,4,5);c=SIMD.Float32x4.shuffle(b,g,0,2,4,6);g=SIMD.Float32x4.shuffle(g,b,1,3,5,7);b=SIMD.Float32x4.shuffle(l,f,2,3,6,7);e=SIMD.Float32x4.shuffle(h,n,2,3,6,7);k=SIMD.Float32x4.shuffle(b,e,0,2,4,6);e=SIMD.Float32x4.shuffle(e,b,1,3,5,7);b=SIMD.Float32x4.mul(k,e);b=SIMD.Float32x4.swizzle(b,1,0,3,2);l=SIMD.Float32x4.mul(g,b);f=SIMD.Float32x4.mul(c,b);b=SIMD.Float32x4.swizzle(b,2,3,0,1);l=SIMD.Float32x4.sub(SIMD.Float32x4.mul(g,b),l);f=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,b),f);f=SIMD.Float32x4.swizzle(f,
2,3,0,1);b=SIMD.Float32x4.mul(g,k);b=SIMD.Float32x4.swizzle(b,1,0,3,2);l=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,b),l);n=SIMD.Float32x4.mul(c,b);b=SIMD.Float32x4.swizzle(b,2,3,0,1);l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(e,b));n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,b),n);n=SIMD.Float32x4.swizzle(n,2,3,0,1);b=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(g,2,3,0,1),e);b=SIMD.Float32x4.swizzle(b,1,0,3,2);k=SIMD.Float32x4.swizzle(k,2,3,0,1);l=SIMD.Float32x4.add(SIMD.Float32x4.mul(k,b),l);h=SIMD.Float32x4.mul(c,
b);b=SIMD.Float32x4.swizzle(b,2,3,0,1);l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(k,b));h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,b),h);h=SIMD.Float32x4.swizzle(h,2,3,0,1);b=SIMD.Float32x4.mul(c,g);b=SIMD.Float32x4.swizzle(b,1,0,3,2);h=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,b),h);n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(k,b),n);b=SIMD.Float32x4.swizzle(b,2,3,0,1);h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,b),h);n=SIMD.Float32x4.sub(n,SIMD.Float32x4.mul(k,b));b=SIMD.Float32x4.mul(c,e);b=SIMD.Float32x4.swizzle(b,
1,0,3,2);f=SIMD.Float32x4.sub(f,SIMD.Float32x4.mul(k,b));h=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,b),h);b=SIMD.Float32x4.swizzle(b,2,3,0,1);f=SIMD.Float32x4.add(SIMD.Float32x4.mul(k,b),f);h=SIMD.Float32x4.sub(h,SIMD.Float32x4.mul(g,b));b=SIMD.Float32x4.mul(c,k);b=SIMD.Float32x4.swizzle(b,1,0,3,2);f=SIMD.Float32x4.add(SIMD.Float32x4.mul(e,b),f);n=SIMD.Float32x4.sub(n,SIMD.Float32x4.mul(g,b));b=SIMD.Float32x4.swizzle(b,2,3,0,1);f=SIMD.Float32x4.sub(f,SIMD.Float32x4.mul(e,b));n=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,
b),n);c=SIMD.Float32x4.mul(c,l);c=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(c,2,3,0,1),c);c=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(c,1,0,3,2),c);b=SIMD.Float32x4.reciprocalApproximation(c);c=SIMD.Float32x4.sub(SIMD.Float32x4.add(b,b),SIMD.Float32x4.mul(c,SIMD.Float32x4.mul(b,b)));c=SIMD.Float32x4.swizzle(c,0,0,0,0);if(!c)return null;SIMD.Float32x4.store(a,0,SIMD.Float32x4.mul(c,l));SIMD.Float32x4.store(a,4,SIMD.Float32x4.mul(c,f));SIMD.Float32x4.store(a,8,SIMD.Float32x4.mul(c,h));SIMD.Float32x4.store(a,
12,SIMD.Float32x4.mul(c,n));return a};c.invert=e.USE_SIMD?c.SIMD.invert:c.scalar.invert;c.scalar.adjoint=function(a,b){var c=b[0],g=b[1],k=b[2],e=b[3],l=b[4],f=b[5],h=b[6],n=b[7],r=b[8],y=b[9],D=b[10],q=b[11],B=b[12],t=b[13],E=b[14];b=b[15];a[0]=f*(D*b-q*E)-y*(h*b-n*E)+t*(h*q-n*D);a[1]=-(g*(D*b-q*E)-y*(k*b-e*E)+t*(k*q-e*D));a[2]=g*(h*b-n*E)-f*(k*b-e*E)+t*(k*n-e*h);a[3]=-(g*(h*q-n*D)-f*(k*q-e*D)+y*(k*n-e*h));a[4]=-(l*(D*b-q*E)-r*(h*b-n*E)+B*(h*q-n*D));a[5]=c*(D*b-q*E)-r*(k*b-e*E)+B*(k*q-e*D);a[6]=
-(c*(h*b-n*E)-l*(k*b-e*E)+B*(k*n-e*h));a[7]=c*(h*q-n*D)-l*(k*q-e*D)+r*(k*n-e*h);a[8]=l*(y*b-q*t)-r*(f*b-n*t)+B*(f*q-n*y);a[9]=-(c*(y*b-q*t)-r*(g*b-e*t)+B*(g*q-e*y));a[10]=c*(f*b-n*t)-l*(g*b-e*t)+B*(g*n-e*f);a[11]=-(c*(f*q-n*y)-l*(g*q-e*y)+r*(g*n-e*f));a[12]=-(l*(y*E-D*t)-r*(f*E-h*t)+B*(f*D-h*y));a[13]=c*(y*E-D*t)-r*(g*E-k*t)+B*(g*D-k*y);a[14]=-(c*(f*E-h*t)-l*(g*E-k*t)+B*(g*h-k*f));a[15]=c*(f*D-h*y)-l*(g*D-k*y)+r*(g*h-k*f);return a};c.SIMD.adjoint=function(a,b){var c,g,k,e,l,f,h,n;c=SIMD.Float32x4.load(b,
0);g=SIMD.Float32x4.load(b,4);k=SIMD.Float32x4.load(b,8);e=SIMD.Float32x4.load(b,12);f=SIMD.Float32x4.shuffle(c,g,0,1,4,5);l=SIMD.Float32x4.shuffle(k,e,0,1,4,5);b=SIMD.Float32x4.shuffle(f,l,0,2,4,6);l=SIMD.Float32x4.shuffle(l,f,1,3,5,7);f=SIMD.Float32x4.shuffle(c,g,2,3,6,7);g=SIMD.Float32x4.shuffle(k,e,2,3,6,7);c=SIMD.Float32x4.shuffle(f,g,0,2,4,6);g=SIMD.Float32x4.shuffle(g,f,1,3,5,7);f=SIMD.Float32x4.mul(c,g);f=SIMD.Float32x4.swizzle(f,1,0,3,2);k=SIMD.Float32x4.mul(l,f);e=SIMD.Float32x4.mul(b,f);
f=SIMD.Float32x4.swizzle(f,2,3,0,1);k=SIMD.Float32x4.sub(SIMD.Float32x4.mul(l,f),k);e=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,f),e);e=SIMD.Float32x4.swizzle(e,2,3,0,1);f=SIMD.Float32x4.mul(l,c);f=SIMD.Float32x4.swizzle(f,1,0,3,2);k=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,f),k);n=SIMD.Float32x4.mul(b,f);f=SIMD.Float32x4.swizzle(f,2,3,0,1);k=SIMD.Float32x4.sub(k,SIMD.Float32x4.mul(g,f));n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,f),n);n=SIMD.Float32x4.swizzle(n,2,3,0,1);f=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,
2,3,0,1),g);f=SIMD.Float32x4.swizzle(f,1,0,3,2);c=SIMD.Float32x4.swizzle(c,2,3,0,1);k=SIMD.Float32x4.add(SIMD.Float32x4.mul(c,f),k);h=SIMD.Float32x4.mul(b,f);f=SIMD.Float32x4.swizzle(f,2,3,0,1);k=SIMD.Float32x4.sub(k,SIMD.Float32x4.mul(c,f));h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,f),h);h=SIMD.Float32x4.swizzle(h,2,3,0,1);f=SIMD.Float32x4.mul(b,l);f=SIMD.Float32x4.swizzle(f,1,0,3,2);h=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,f),h);n=SIMD.Float32x4.sub(SIMD.Float32x4.mul(c,f),n);f=SIMD.Float32x4.swizzle(f,
2,3,0,1);h=SIMD.Float32x4.sub(SIMD.Float32x4.mul(g,f),h);n=SIMD.Float32x4.sub(n,SIMD.Float32x4.mul(c,f));f=SIMD.Float32x4.mul(b,g);f=SIMD.Float32x4.swizzle(f,1,0,3,2);e=SIMD.Float32x4.sub(e,SIMD.Float32x4.mul(c,f));h=SIMD.Float32x4.add(SIMD.Float32x4.mul(l,f),h);f=SIMD.Float32x4.swizzle(f,2,3,0,1);e=SIMD.Float32x4.add(SIMD.Float32x4.mul(c,f),e);h=SIMD.Float32x4.sub(h,SIMD.Float32x4.mul(l,f));f=SIMD.Float32x4.mul(b,c);f=SIMD.Float32x4.swizzle(f,1,0,3,2);e=SIMD.Float32x4.add(SIMD.Float32x4.mul(g,f),
e);n=SIMD.Float32x4.sub(n,SIMD.Float32x4.mul(l,f));f=SIMD.Float32x4.swizzle(f,2,3,0,1);e=SIMD.Float32x4.sub(e,SIMD.Float32x4.mul(g,f));n=SIMD.Float32x4.add(SIMD.Float32x4.mul(l,f),n);SIMD.Float32x4.store(a,0,k);SIMD.Float32x4.store(a,4,e);SIMD.Float32x4.store(a,8,h);SIMD.Float32x4.store(a,12,n);return a};c.adjoint=e.USE_SIMD?c.SIMD.adjoint:c.scalar.adjoint;c.determinant=function(a){var b=a[0],c=a[1],g=a[2],e=a[3],f=a[4],l=a[5],h=a[6],n=a[7],v=a[8],r=a[9],y=a[10],D=a[11],q=a[12],B=a[13],t=a[14];a=
a[15];return(b*l-c*f)*(y*a-D*t)-(b*h-g*f)*(r*a-D*B)+(b*n-e*f)*(r*t-y*B)+(c*h-g*l)*(v*a-D*q)-(c*n-e*l)*(v*t-y*q)+(g*n-e*h)*(v*B-r*q)};c.SIMD.multiply=function(a,b,c){var d=SIMD.Float32x4.load(b,0),e=SIMD.Float32x4.load(b,4),f=SIMD.Float32x4.load(b,8);b=SIMD.Float32x4.load(b,12);var l=SIMD.Float32x4.load(c,0),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,0,0,0,0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,
2,2,2,2),f),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,3,3,3,3),b))));SIMD.Float32x4.store(a,0,l);l=SIMD.Float32x4.load(c,4);l=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,0,0,0,0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,2,2,2,2),f),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,3,3,3,3),b))));SIMD.Float32x4.store(a,4,l);l=SIMD.Float32x4.load(c,8);l=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,
0,0,0,0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,2,2,2,2),f),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(l,3,3,3,3),b))));SIMD.Float32x4.store(a,8,l);c=SIMD.Float32x4.load(c,12);d=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,0,0,0,0),d),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,1,1,1,1),e),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,2,2,2,2),
f),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,3,3,3,3),b))));SIMD.Float32x4.store(a,12,d);return a};c.scalar.multiply=function(a,b,c){var d=b[0],e=b[1],f=b[2],l=b[3],h=b[4],n=b[5],v=b[6],r=b[7],y=b[8],D=b[9],q=b[10],B=b[11],t=b[12],E=b[13],C=b[14];b=b[15];var z=c[0],G=c[1],H=c[2],x=c[3];a[0]=z*d+G*h+H*y+x*t;a[1]=z*e+G*n+H*D+x*E;a[2]=z*f+G*v+H*q+x*C;a[3]=z*l+G*r+H*B+x*b;z=c[4];G=c[5];H=c[6];x=c[7];a[4]=z*d+G*h+H*y+x*t;a[5]=z*e+G*n+H*D+x*E;a[6]=z*f+G*v+H*q+x*C;a[7]=z*l+G*r+H*B+x*b;z=c[8];G=c[9];H=
c[10];x=c[11];a[8]=z*d+G*h+H*y+x*t;a[9]=z*e+G*n+H*D+x*E;a[10]=z*f+G*v+H*q+x*C;a[11]=z*l+G*r+H*B+x*b;z=c[12];G=c[13];H=c[14];x=c[15];a[12]=z*d+G*h+H*y+x*t;a[13]=z*e+G*n+H*D+x*E;a[14]=z*f+G*v+H*q+x*C;a[15]=z*l+G*r+H*B+x*b;return a};c.multiply=e.USE_SIMD?c.SIMD.multiply:c.scalar.multiply;c.mul=c.multiply;c.scalar.translate=function(a,b,c){var d=c[0],e=c[1];c=c[2];var f,l,h,n,v,r,y,D,q,B,t,E;b===a?(a[12]=b[0]*d+b[4]*e+b[8]*c+b[12],a[13]=b[1]*d+b[5]*e+b[9]*c+b[13],a[14]=b[2]*d+b[6]*e+b[10]*c+b[14],a[15]=
b[3]*d+b[7]*e+b[11]*c+b[15]):(f=b[0],l=b[1],h=b[2],n=b[3],v=b[4],r=b[5],y=b[6],D=b[7],q=b[8],B=b[9],t=b[10],E=b[11],a[0]=f,a[1]=l,a[2]=h,a[3]=n,a[4]=v,a[5]=r,a[6]=y,a[7]=D,a[8]=q,a[9]=B,a[10]=t,a[11]=E,a[12]=f*d+v*e+q*c+b[12],a[13]=l*d+r*e+B*c+b[13],a[14]=h*d+y*e+t*c+b[14],a[15]=n*d+D*e+E*c+b[15]);return a};c.SIMD.translate=function(a,b,c){var d=SIMD.Float32x4.load(b,0),e=SIMD.Float32x4.load(b,4),f=SIMD.Float32x4.load(b,8),l=SIMD.Float32x4.load(b,12);c=SIMD.Float32x4(c[0],c[1],c[2],0);b!==a&&(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]);d=SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,0,0,0,0));e=SIMD.Float32x4.mul(e,SIMD.Float32x4.swizzle(c,1,1,1,1));f=SIMD.Float32x4.mul(f,SIMD.Float32x4.swizzle(c,2,2,2,2));b=SIMD.Float32x4.add(d,SIMD.Float32x4.add(e,SIMD.Float32x4.add(f,l)));SIMD.Float32x4.store(a,12,b);return a};c.translate=e.USE_SIMD?c.SIMD.translate:c.scalar.translate;c.scalar.scale=function(a,b,c){var d=c[0],
e=c[1];c=c[2];a[0]=b[0]*d;a[1]=b[1]*d;a[2]=b[2]*d;a[3]=b[3]*d;a[4]=b[4]*e;a[5]=b[5]*e;a[6]=b[6]*e;a[7]=b[7]*e;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};c.SIMD.scale=function(a,b,c){var d;c=SIMD.Float32x4(c[0],c[1],c[2],0);d=SIMD.Float32x4.load(b,0);SIMD.Float32x4.store(a,0,SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,0,0,0,0)));d=SIMD.Float32x4.load(b,4);SIMD.Float32x4.store(a,4,SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,1,1,
1,1)));d=SIMD.Float32x4.load(b,8);SIMD.Float32x4.store(a,8,SIMD.Float32x4.mul(d,SIMD.Float32x4.swizzle(c,2,2,2,2)));a[12]=b[12];a[13]=b[13];a[14]=b[14];a[15]=b[15];return a};c.scale=e.USE_SIMD?c.SIMD.scale:c.scalar.scale;c.rotate=function(a,b,c,g){var d=g[0],f=g[1];g=g[2];var l=Math.sqrt(d*d+f*f+g*g),h,n,v,r,y,D,q,B,t,E,C,z,G,H,x,w,L,O,K,F;if(Math.abs(l)<e.EPSILON)return null;l=1/l;d*=l;f*=l;g*=l;h=Math.sin(c);n=Math.cos(c);v=1-n;c=b[0];l=b[1];r=b[2];y=b[3];D=b[4];q=b[5];B=b[6];t=b[7];E=b[8];C=b[9];
z=b[10];G=b[11];H=d*d*v+n;x=f*d*v+g*h;w=g*d*v-f*h;L=d*f*v-g*h;O=f*f*v+n;K=g*f*v+d*h;F=d*g*v+f*h;d=f*g*v-d*h;f=g*g*v+n;a[0]=c*H+D*x+E*w;a[1]=l*H+q*x+C*w;a[2]=r*H+B*x+z*w;a[3]=y*H+t*x+G*w;a[4]=c*L+D*O+E*K;a[5]=l*L+q*O+C*K;a[6]=r*L+B*O+z*K;a[7]=y*L+t*O+G*K;a[8]=c*F+D*d+E*f;a[9]=l*F+q*d+C*f;a[10]=r*F+B*d+z*f;a[11]=y*F+t*d+G*f;b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]);return a};c.scalar.rotateX=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[4],f=b[5],l=b[6],h=b[7],n=b[8],v=b[9],
r=b[10],y=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]=e*c+n*d;a[5]=f*c+v*d;a[6]=l*c+r*d;a[7]=h*c+y*d;a[8]=n*c-e*d;a[9]=v*c-f*d;a[10]=r*c-l*d;a[11]=y*c-h*d;return a};c.SIMD.rotateX=function(a,b,c){var d=SIMD.Float32x4.splat(Math.sin(c));c=SIMD.Float32x4.splat(Math.cos(c));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]);var e=SIMD.Float32x4.load(b,4);b=SIMD.Float32x4.load(b,8);SIMD.Float32x4.store(a,
4,SIMD.Float32x4.add(SIMD.Float32x4.mul(e,c),SIMD.Float32x4.mul(b,d)));SIMD.Float32x4.store(a,8,SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,c),SIMD.Float32x4.mul(e,d)));return a};c.rotateX=e.USE_SIMD?c.SIMD.rotateX:c.scalar.rotateX;c.scalar.rotateY=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[0],f=b[1],l=b[2],h=b[3],n=b[8],v=b[9],r=b[10],y=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]=e*c-n*d;a[1]=f*c-v*d;a[2]=l*c-r*d;a[3]=h*c-y*
d;a[8]=e*d+n*c;a[9]=f*d+v*c;a[10]=l*d+r*c;a[11]=h*d+y*c;return a};c.SIMD.rotateY=function(a,b,c){var d=SIMD.Float32x4.splat(Math.sin(c));c=SIMD.Float32x4.splat(Math.cos(c));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]);var e=SIMD.Float32x4.load(b,0);b=SIMD.Float32x4.load(b,8);SIMD.Float32x4.store(a,0,SIMD.Float32x4.sub(SIMD.Float32x4.mul(e,c),SIMD.Float32x4.mul(b,d)));SIMD.Float32x4.store(a,8,SIMD.Float32x4.add(SIMD.Float32x4.mul(e,d),SIMD.Float32x4.mul(b,
c)));return a};c.rotateY=e.USE_SIMD?c.SIMD.rotateY:c.scalar.rotateY;c.scalar.rotateZ=function(a,b,c){var d=Math.sin(c);c=Math.cos(c);var e=b[0],f=b[1],l=b[2],h=b[3],n=b[4],v=b[5],r=b[6],y=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]=e*c+n*d;a[1]=f*c+v*d;a[2]=l*c+r*d;a[3]=h*c+y*d;a[4]=n*c-e*d;a[5]=v*c-f*d;a[6]=r*c-l*d;a[7]=y*c-h*d;return a};c.SIMD.rotateZ=function(a,b,c){var d=SIMD.Float32x4.splat(Math.sin(c));c=SIMD.Float32x4.splat(Math.cos(c));
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]);var e=SIMD.Float32x4.load(b,0);b=SIMD.Float32x4.load(b,4);SIMD.Float32x4.store(a,0,SIMD.Float32x4.add(SIMD.Float32x4.mul(e,c),SIMD.Float32x4.mul(b,d)));SIMD.Float32x4.store(a,4,SIMD.Float32x4.sub(SIMD.Float32x4.mul(b,c),SIMD.Float32x4.mul(e,d)));return a};c.rotateZ=e.USE_SIMD?c.SIMD.rotateZ:c.scalar.rotateZ;c.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};c.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};c.fromRotation=function(a,b,c){var d=c[0],k=c[1];c=c[2];var f=Math.sqrt(d*d+k*k+c*c),l;if(Math.abs(f)<e.EPSILON)return null;f=1/f;d*=f;k*=f;c*=f;f=Math.sin(b);b=Math.cos(b);l=1-b;a[0]=d*d*l+b;a[1]=k*d*l+c*f;a[2]=c*d*l-k*f;a[3]=0;a[4]=d*k*l-c*f;a[5]=k*k*l+b;a[6]=
c*k*l+d*f;a[7]=0;a[8]=d*c*l+k*f;a[9]=k*c*l-d*f;a[10]=c*c*l+b;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};c.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};c.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};c.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};c.fromRotationTranslation=function(a,b,c){var d=b[0],e=b[1],f=b[2],l=b[3],h=d+d,n=e+e,v=f+f;b=d*h;var r=d*n,d=d*v,y=e*n,e=e*v,f=f*v,h=l*h,n=l*n,l=l*v;a[0]=1-(y+f);a[1]=r+l;a[2]=d-n;a[3]=0;a[4]=r-l;a[5]=1-(b+f);a[6]=e+h;a[7]=0;a[8]=d+n;a[9]=e-h;a[10]=1-(b+y);a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};c.getTranslation=
function(a,b){a[0]=b[12];a[1]=b[13];a[2]=b[14];return a};c.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};c.fromRotationTranslationScale=function(a,b,c,g){var d=b[0],e=b[1],f=b[2],h=b[3],n=d+d,v=e+e,r=f+f;b=d*n;var y=d*v,d=d*r,D=e*v,e=e*r,f=f*r,n=h*n,v=h*v,h=h*r,r=g[0],q=g[1];g=g[2];a[0]=(1-(D+f))*r;a[1]=(y+h)*r;a[2]=(d-v)*r;a[3]=0;a[4]=(y-h)*q;a[5]=(1-(b+f))*q;a[6]=(e+n)*q;a[7]=0;a[8]=(d+v)*g;a[9]=(e-n)*g;a[10]=(1-(b+D))*g;a[11]=0;a[12]=c[0];a[13]=c[1];a[14]=c[2];a[15]=1;return a};c.fromRotationTranslationScaleOrigin=function(a,b,c,g,e){var d=b[0],k=b[1],
f=b[2],h=b[3],n=d+d,r=k+k,y=f+f;b=d*n;var D=d*r,d=d*y,q=k*r,k=k*y,f=f*y,n=h*n,r=h*r,h=h*y,y=g[0],B=g[1];g=g[2];var t=e[0],E=e[1];e=e[2];a[0]=(1-(q+f))*y;a[1]=(D+h)*y;a[2]=(d-r)*y;a[3]=0;a[4]=(D-h)*B;a[5]=(1-(b+f))*B;a[6]=(k+n)*B;a[7]=0;a[8]=(d+r)*g;a[9]=(k-n)*g;a[10]=(1-(b+q))*g;a[11]=0;a[12]=c[0]+t-(a[0]*t+a[4]*E+a[8]*e);a[13]=c[1]+E-(a[1]*t+a[5]*E+a[9]*e);a[14]=c[2]+e-(a[2]*t+a[6]*E+a[10]*e);a[15]=1;return a};c.fromQuat=function(a,b){var c=b[0],g=b[1],e=b[2];b=b[3];var f=c+c,l=g+g,h=e+e,c=c*f,n=
g*f,g=g*l,v=e*f,r=e*l,e=e*h,f=b*f,l=b*l;b*=h;a[0]=1-g-e;a[1]=n+b;a[2]=v-l;a[3]=0;a[4]=n-b;a[5]=1-c-e;a[6]=r+f;a[7]=0;a[8]=v+l;a[9]=r-f;a[10]=1-c-g;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};c.frustum=function(a,b,c,g,e,f,l){var d=1/(c-b),k=1/(e-g),h=1/(f-l);a[0]=2*f*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=2*f*k;a[6]=0;a[7]=0;a[8]=(c+b)*d;a[9]=(e+g)*k;a[10]=(l+f)*h;a[11]=-1;a[12]=0;a[13]=0;a[14]=l*f*2*h;a[15]=0;return a};c.perspective=function(a,b,c,g,e){b=1/Math.tan(b/2);var d=1/(g-e);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]=(e+g)*d;a[11]=-1;a[12]=0;a[13]=0;a[14]=2*e*g*d;a[15]=0;return a};c.perspectiveFromFieldOfView=function(a,b,c,g){var d=Math.tan(b.upDegrees*Math.PI/180),e=Math.tan(b.downDegrees*Math.PI/180),f=Math.tan(b.leftDegrees*Math.PI/180);b=Math.tan(b.rightDegrees*Math.PI/180);var h=2/(f+b),n=2/(d+e);a[0]=h;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=n;a[6]=0;a[7]=0;a[8]=-((f-b)*h*.5);a[9]=(d-e)*n*.5;a[10]=g/(c-g);a[11]=-1;a[12]=0;a[13]=0;a[14]=g*c/(c-
g);a[15]=0;return a};c.ortho=function(a,b,c,g,e,f,l){var d=1/(b-c),k=1/(g-e),h=1/(f-l);a[0]=-2*d;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=-2*k;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=2*h;a[11]=0;a[12]=(b+c)*d;a[13]=(e+g)*k;a[14]=(l+f)*h;a[15]=1;return a};c.lookAt=function(a,b,d,g){var k,f,l,h,n,v,r,y,D=b[0],q=b[1];b=b[2];l=g[0];h=g[1];f=g[2];r=d[0];g=d[1];k=d[2];if(Math.abs(D-r)<e.EPSILON&&Math.abs(q-g)<e.EPSILON&&Math.abs(b-k)<e.EPSILON)return c.identity(a);d=D-r;g=q-g;r=b-k;y=1/Math.sqrt(d*d+g*g+r*r);d*=y;g*=
y;r*=y;k=h*r-f*g;f=f*d-l*r;l=l*g-h*d;(y=Math.sqrt(k*k+f*f+l*l))?(y=1/y,k*=y,f*=y,l*=y):l=f=k=0;h=g*l-r*f;n=r*k-d*l;v=d*f-g*k;(y=Math.sqrt(h*h+n*n+v*v))?(y=1/y,h*=y,n*=y,v*=y):v=n=h=0;a[0]=k;a[1]=h;a[2]=d;a[3]=0;a[4]=f;a[5]=n;a[6]=g;a[7]=0;a[8]=l;a[9]=v;a[10]=r;a[11]=0;a[12]=-(k*D+f*q+l*b);a[13]=-(h*D+n*q+v*b);a[14]=-(d*D+g*q+r*b);a[15]=1;return a};c.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]+")"};c.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))};c.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};c.subtract=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};c.sub=c.subtract;c.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};c.multiplyScalarAndAdd=function(a,b,c,g){a[0]=b[0]+c[0]*g;a[1]=b[1]+c[1]*g;a[2]=b[2]+c[2]*g;a[3]=b[3]+c[3]*g;a[4]=b[4]+c[4]*g;a[5]=b[5]+c[5]*g;a[6]=b[6]+c[6]*g;a[7]=b[7]+c[7]*g;a[8]=b[8]+c[8]*g;a[9]=b[9]+c[9]*g;a[10]=b[10]+c[10]*g;a[11]=b[11]+c[11]*g;a[12]=b[12]+c[12]*g;a[13]=b[13]+c[13]*g;a[14]=
b[14]+c[14]*g;a[15]=b[15]+c[15]*g;return a};c.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]};c.equals=function(a,b){var c=a[0],g=a[1],k=a[2],f=a[3],l=a[4],h=a[5],n=a[6],v=a[7],r=a[8],y=a[9],D=a[10],q=a[11],B=a[12],t=a[13],E=a[14];a=a[15];var C=b[0],z=b[1],G=b[2],H=b[3],x=b[4],w=b[5],L=b[6],O=b[7],
K=b[8],F=b[9],I=b[10],N=b[11],M=b[12],J=b[13],A=b[14];b=b[15];return Math.abs(c-C)<=e.EPSILON*Math.max(1,Math.abs(c),Math.abs(C))&&Math.abs(g-z)<=e.EPSILON*Math.max(1,Math.abs(g),Math.abs(z))&&Math.abs(k-G)<=e.EPSILON*Math.max(1,Math.abs(k),Math.abs(G))&&Math.abs(f-H)<=e.EPSILON*Math.max(1,Math.abs(f),Math.abs(H))&&Math.abs(l-x)<=e.EPSILON*Math.max(1,Math.abs(l),Math.abs(x))&&Math.abs(h-w)<=e.EPSILON*Math.max(1,Math.abs(h),Math.abs(w))&&Math.abs(n-L)<=e.EPSILON*Math.max(1,Math.abs(n),Math.abs(L))&&
Math.abs(v-O)<=e.EPSILON*Math.max(1,Math.abs(v),Math.abs(O))&&Math.abs(r-K)<=e.EPSILON*Math.max(1,Math.abs(r),Math.abs(K))&&Math.abs(y-F)<=e.EPSILON*Math.max(1,Math.abs(y),Math.abs(F))&&Math.abs(D-I)<=e.EPSILON*Math.max(1,Math.abs(D),Math.abs(I))&&Math.abs(q-N)<=e.EPSILON*Math.max(1,Math.abs(q),Math.abs(N))&&Math.abs(B-M)<=e.EPSILON*Math.max(1,Math.abs(B),Math.abs(M))&&Math.abs(t-J)<=e.EPSILON*Math.max(1,Math.abs(t),Math.abs(J))&&Math.abs(E-A)<=e.EPSILON*Math.max(1,Math.abs(E),Math.abs(A))&&Math.abs(a-
b)<=e.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};n.exports=c},function(n,h,f){var e=f(3),c=f(39),a=f(40);h=f(41);var b={create:function(){var a=new e.ARRAY_TYPE(4);a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a}};b.rotationTo=function(){var c=a.create(),g=a.fromValues(1,0,0),e=a.fromValues(0,1,0);return function(d,k,f){var l=a.dot(k,f);if(-.999999>l)return a.cross(c,g,k),1E-6>a.length(c)&&a.cross(c,e,k),a.normalize(c,c),b.setAxisAngle(d,c,Math.PI),d;if(.999999<l)return d[0]=0,d[1]=0,d[2]=0,d[3]=1,d;a.cross(c,
k,f);d[0]=c[0];d[1]=c[1];d[2]=c[2];d[3]=1+l;return b.normalize(d,d)}}();b.setAxes=function(){var a=c.create();return function(c,d,e,f){a[0]=e[0];a[3]=e[1];a[6]=e[2];a[1]=f[0];a[4]=f[1];a[7]=f[2];a[2]=-d[0];a[5]=-d[1];a[8]=-d[2];return b.normalize(c,b.fromMat3(c,a))}}();b.clone=h.clone;b.fromValues=h.fromValues;b.copy=h.copy;b.set=h.set;b.identity=function(a){a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};b.setAxisAngle=function(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};b.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};b.add=h.add;b.multiply=function(a,b,c){var d=b[0],g=b[1],e=b[2];b=b[3];var k=c[0],f=c[1],h=c[2];c=c[3];a[0]=d*c+b*k+g*h-e*f;a[1]=g*c+b*f+e*k-d*h;a[2]=e*c+b*h+d*f-g*k;a[3]=b*c-d*k-g*f-e*h;return a};b.mul=b.multiply;b.scale=h.scale;b.rotateX=function(a,b,c){c*=.5;var d=b[0],g=b[1],e=b[2];b=b[3];var k=Math.sin(c);c=Math.cos(c);a[0]=d*c+b*k;a[1]=g*
c+e*k;a[2]=e*c-g*k;a[3]=b*c-d*k;return a};b.rotateY=function(a,b,c){c*=.5;var d=b[0],g=b[1],e=b[2];b=b[3];var k=Math.sin(c);c=Math.cos(c);a[0]=d*c-e*k;a[1]=g*c+b*k;a[2]=e*c+d*k;a[3]=b*c-g*k;return a};b.rotateZ=function(a,b,c){c*=.5;var d=b[0],g=b[1],e=b[2];b=b[3];var f=Math.sin(c);c=Math.cos(c);a[0]=d*c+g*f;a[1]=g*c-d*f;a[2]=e*c+b*f;a[3]=b*c-e*f;return a};b.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};b.dot=h.dot;b.lerp=h.lerp;
b.slerp=function(a,b,c,e){var d=b[0],g=b[1],f=b[2];b=b[3];var k=c[0],h=c[1],m=c[2];c=c[3];var n,q,B;q=d*k+g*h+f*m+b*c;0>q&&(q=-q,k=-k,h=-h,m=-m,c=-c);1E-6<1-q?(n=Math.acos(q),B=Math.sin(n),q=Math.sin((1-e)*n)/B,e=Math.sin(e*n)/B):q=1-e;a[0]=q*d+e*k;a[1]=q*g+e*h;a[2]=q*f+e*m;a[3]=q*b+e*c;return a};b.sqlerp=function(){var a=b.create(),c=b.create();return function(d,e,g,f,h,n){b.slerp(a,e,h,n);b.slerp(c,g,f,n);b.slerp(d,a,c,2*n*(1-n));return d}}();b.invert=function(a,b){var c=b[0],d=b[1],e=b[2];b=b[3];
var g=c*c+d*d+e*e+b*b,g=g?1/g:0;a[0]=-c*g;a[1]=-d*g;a[2]=-e*g;a[3]=b*g;return a};b.conjugate=function(a,b){a[0]=-b[0];a[1]=-b[1];a[2]=-b[2];a[3]=b[3];return a};b.length=h.length;b.len=b.length;b.squaredLength=h.squaredLength;b.sqrLen=b.squaredLength;b.normalize=h.normalize;b.fromMat3=function(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 e=(d+1)%3,g=(d+2)%3,c=Math.sqrt(b[3*
d+d]-b[3*e+e]-b[3*g+g]+1);a[d]=.5*c;c=.5/c;a[3]=(b[3*e+g]-b[3*g+e])*c;a[e]=(b[3*e+d]+b[3*d+e])*c;a[g]=(b[3*g+d]+b[3*d+g])*c}return a};b.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"};b.exactEquals=h.exactEquals;b.equals=h.equals;n.exports=b},function(n,h,f){var e=f(3),c={create:function(){var a=new e.ARRAY_TYPE(2);a[0]=0;a[1]=0;return a},clone:function(a){var b=new e.ARRAY_TYPE(2);b[0]=a[0];b[1]=a[1];return b},fromValues:function(a,b){var c=new e.ARRAY_TYPE(2);c[0]=a;c[1]=b;
return c},copy:function(a,b){a[0]=b[0];a[1]=b[1];return a},set:function(a,b,c){a[0]=b;a[1]=c;return a},add:function(a,b,c){a[0]=b[0]+c[0];a[1]=b[1]+c[1];return a},subtract:function(a,b,c){a[0]=b[0]-c[0];a[1]=b[1]-c[1];return a}};c.sub=c.subtract;c.multiply=function(a,b,c){a[0]=b[0]*c[0];a[1]=b[1]*c[1];return a};c.mul=c.multiply;c.divide=function(a,b,c){a[0]=b[0]/c[0];a[1]=b[1]/c[1];return a};c.div=c.divide;c.ceil=function(a,b){a[0]=Math.ceil(b[0]);a[1]=Math.ceil(b[1]);return a};c.floor=function(a,
b){a[0]=Math.floor(b[0]);a[1]=Math.floor(b[1]);return a};c.min=function(a,b,c){a[0]=Math.min(b[0],c[0]);a[1]=Math.min(b[1],c[1]);return a};c.max=function(a,b,c){a[0]=Math.max(b[0],c[0]);a[1]=Math.max(b[1],c[1]);return a};c.round=function(a,b){a[0]=Math.round(b[0]);a[1]=Math.round(b[1]);return a};c.scale=function(a,b,c){a[0]=b[0]*c;a[1]=b[1]*c;return a};c.scaleAndAdd=function(a,b,c,e){a[0]=b[0]+c[0]*e;a[1]=b[1]+c[1]*e;return a};c.distance=function(a,b){var c=b[0]-a[0];a=b[1]-a[1];return Math.sqrt(c*
c+a*a)};c.dist=c.distance;c.squaredDistance=function(a,b){var c=b[0]-a[0];a=b[1]-a[1];return c*c+a*a};c.sqrDist=c.squaredDistance;c.length=function(a){var b=a[0];a=a[1];return Math.sqrt(b*b+a*a)};c.len=c.length;c.squaredLength=function(a){var b=a[0];a=a[1];return b*b+a*a};c.sqrLen=c.squaredLength;c.negate=function(a,b){a[0]=-b[0];a[1]=-b[1];return a};c.inverse=function(a,b){a[0]=1/b[0];a[1]=1/b[1];return a};c.normalize=function(a,b){var c=b[0],e=b[1],c=c*c+e*e;0<c&&(c=1/Math.sqrt(c),a[0]=b[0]*c,a[1]=
b[1]*c);return a};c.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]};c.cross=function(a,b,c){b=b[0]*c[1]-b[1]*c[0];a[0]=a[1]=0;a[2]=b;return a};c.lerp=function(a,b,c,e){var d=b[0];b=b[1];a[0]=d+e*(c[0]-d);a[1]=b+e*(c[1]-b);return a};c.random=function(a,b){b=b||1;var c=2*e.RANDOM()*Math.PI;a[0]=Math.cos(c)*b;a[1]=Math.sin(c)*b;return a};c.transformMat2=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*b;a[1]=c[1]*d+c[3]*b;return a};c.transformMat2d=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[2]*
b+c[4];a[1]=c[1]*d+c[3]*b+c[5];return a};c.transformMat3=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[3]*b+c[6];a[1]=c[1]*d+c[4]*b+c[7];return a};c.transformMat4=function(a,b,c){var d=b[0];b=b[1];a[0]=c[0]*d+c[4]*b+c[12];a[1]=c[1]*d+c[5]*b+c[13];return a};c.forEach=function(){var a=c.create();return function(b,c,e,f,h,l){c||(c=2);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],h(a,a,l),b[e]=a[0],b[e+1]=a[1];return b}}();c.str=function(a){return"vec2("+a[0]+", "+
a[1]+")"};c.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]};c.equals=function(a,b){var c=a[0];a=a[1];var g=b[0];b=b[1];return Math.abs(c-g)<=e.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(a-b)<=e.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};n.exports=c},function(n,h,f){var e=e||{};e.NIFTI1=e.NIFTI1||f(42);e.NIFTI2=e.NIFTI2||f(96);e.Utils=e.Utils||f(25);var c=c||f(26);e.isNIFTI1=function(a){var b,c;if(a.byteLength<e.NIFTI1.STANDARD_HEADER_SIZE)return!1;b=new DataView(a);a=b.getUint8(e.NIFTI1.MAGIC_NUMBER_LOCATION);
c=b.getUint8(e.NIFTI1.MAGIC_NUMBER_LOCATION+1);b=b.getUint8(e.NIFTI1.MAGIC_NUMBER_LOCATION+2);return!(a!==e.NIFTI1.MAGIC_NUMBER[0]||c!==e.NIFTI1.MAGIC_NUMBER[1]||b!==e.NIFTI1.MAGIC_NUMBER[2])};e.isNIFTI2=function(a){var b,c;if(a.byteLength<e.NIFTI1.STANDARD_HEADER_SIZE)return!1;b=new DataView(a);a=b.getUint8(e.NIFTI2.MAGIC_NUMBER_LOCATION);c=b.getUint8(e.NIFTI2.MAGIC_NUMBER_LOCATION+1);b=b.getUint8(e.NIFTI2.MAGIC_NUMBER_LOCATION+2);return!(a!==e.NIFTI2.MAGIC_NUMBER[0]||c!==e.NIFTI2.MAGIC_NUMBER[1]||
b!==e.NIFTI2.MAGIC_NUMBER[2])};e.isNIFTI=function(a){return e.isNIFTI1(a)||e.isNIFTI2(a)};e.isCompressed=function(a){var b;return a&&(b=new DataView(a),a=b.getUint8(0),b=b.getUint8(1),a===e.Utils.GUNZIP_MAGIC_COOKIE1||b===e.Utils.GUNZIP_MAGIC_COOKIE2)?!0:!1};e.decompress=function(a){return c.inflate(a).buffer};e.readHeader=function(a){var b=null;e.isCompressed(a)&&(a=e.decompress(a));e.isNIFTI1(a)?b=new e.NIFTI1:e.isNIFTI2(a)&&(b=new e.NIFTI2);b?b.readHeader(a):console.error("That file does not appear to be NIFTI!");
return b};e.hasExtension=function(a){return 0!=a.extensionFlag[0]};e.readImage=function(a,b){var c=a.vox_offset,e=1,f=1;a.dims[4]&&(e=a.dims[4]);a.dims[5]&&(f=a.dims[5]);return b.slice(c,c+a.numBitsPerVoxel/8*a.dims[2]*a.dims[3]*e*f*a.dims[1])};e.readExtension=function(a,b){var c=a.getExtensionLocation();return b.slice(c,c+a.extensionSize)};e.readExtensionData=function(a,b){var c=a.getExtensionLocation();return b.slice(c+8,c+a.extensionSize-8)};"undefined"!==typeof n&&n.exports&&(n.exports=e)},function(n,
h,f){var e=e||{};e.Utils=e.Utils||f(25);e.NIFTI1=e.NIFTI1||f(42);e.NIFTI2=e.NIFTI2||function(){this.littleEndian=!1;this.dim_info=0;this.dims=[];this.slice_code=this.slice_end=this.slice_start=this.numBitsPerVoxel=this.datatypeCode=this.intent_code=this.intent_p3=this.intent_p2=this.intent_p1=0;this.pixDims=[];this.vox_offset=0;this.scl_slope=1;this.toffset=this.slice_duration=this.cal_min=this.cal_max=this.xyzt_units=this.scl_inter=0;this.intent_name=this.aux_file=this.description="";this.qoffset_z=
this.qoffset_y=this.qoffset_x=this.quatern_d=this.quatern_c=this.quatern_b=this.sform_code=this.qform_code=0;this.affine=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];this.magic=0;this.extensionFlag=[0,0,0,0]};e.NIFTI2.MAGIC_COOKIE=540;e.NIFTI2.MAGIC_NUMBER_LOCATION=4;e.NIFTI2.MAGIC_NUMBER=[110,43,50,0,13,10,26,10];e.NIFTI2.prototype.readHeader=function(c){c=new DataView(c);var a=e.Utils.getIntAt(c,0,this.littleEndian),b,d;a!==e.NIFTI2.MAGIC_COOKIE&&(this.littleEndian=!0,a=e.Utils.getIntAt(c,0,this.littleEndian));
if(a!==e.NIFTI2.MAGIC_COOKIE)throw Error("This does not appear to be a NIFTI file!");this.datatypeCode=e.Utils.getShortAt(c,12,this.littleEndian);this.numBitsPerVoxel=e.Utils.getShortAt(c,14,this.littleEndian);for(b=0;8>b;b+=1)a=16+8*b,this.dims[b]=e.Utils.getLongAt(c,a,this.littleEndian);this.intent_p1=e.Utils.getDoubleAt(c,80,this.littleEndian);this.intent_p2=e.Utils.getDoubleAt(c,88,this.littleEndian);this.intent_p3=e.Utils.getDoubleAt(c,96,this.littleEndian);for(b=0;8>b;b+=1)a=104+8*b,this.pixDims[b]=
e.Utils.getDoubleAt(c,a,this.littleEndian);this.vox_offset=e.Utils.getLongAt(c,168,this.littleEndian);this.scl_slope=e.Utils.getDoubleAt(c,176,this.littleEndian);this.scl_inter=e.Utils.getDoubleAt(c,184,this.littleEndian);this.cal_max=e.Utils.getDoubleAt(c,192,this.littleEndian);this.cal_min=e.Utils.getDoubleAt(c,200,this.littleEndian);this.slice_duration=e.Utils.getDoubleAt(c,208,this.littleEndian);this.toffset=e.Utils.getDoubleAt(c,216,this.littleEndian);this.slice_start=e.Utils.getLongAt(c,224,
this.littleEndian);this.slice_end=e.Utils.getLongAt(c,232,this.littleEndian);this.description=e.Utils.getStringAt(c,240,320);this.aux_file=e.Utils.getStringAt(c,320,344);this.qform_code=e.Utils.getIntAt(c,344,this.littleEndian);this.sform_code=e.Utils.getIntAt(c,348,this.littleEndian);this.quatern_b=e.Utils.getDoubleAt(c,352,this.littleEndian);this.quatern_c=e.Utils.getDoubleAt(c,360,this.littleEndian);this.quatern_d=e.Utils.getDoubleAt(c,368,this.littleEndian);this.qoffset_x=e.Utils.getDoubleAt(c,
376,this.littleEndian);this.qoffset_y=e.Utils.getDoubleAt(c,384,this.littleEndian);this.qoffset_z=e.Utils.getDoubleAt(c,392,this.littleEndian);for(b=0;3>b;b+=1)for(d=0;4>d;d+=1)a=400+8*(4*b+d),this.affine[b][d]=e.Utils.getDoubleAt(c,a,this.littleEndian);this.affine[3][0]=0;this.affine[3][1]=0;this.affine[3][2]=0;this.affine[3][3]=1;this.slice_code=e.Utils.getIntAt(c,496,this.littleEndian);this.xyzt_units=e.Utils.getIntAt(c,500,this.littleEndian);this.intent_code=e.Utils.getIntAt(c,504,this.littleEndian);
this.intent_name=e.Utils.getStringAt(c,508,524);this.dim_info=e.Utils.getByteAt(c,524);c.byteLength>e.NIFTI2.MAGIC_COOKIE&&(this.extensionFlag[0]=e.Utils.getByteAt(c,540),this.extensionFlag[1]=e.Utils.getByteAt(c,541),this.extensionFlag[2]=e.Utils.getByteAt(c,542),this.extensionFlag[3]=e.Utils.getByteAt(c,543),this.extensionFlag[0]&&(this.extensionSize=this.getExtensionSize(c),this.extensionCode=this.getExtensionCode(c)))};e.NIFTI2.prototype.toFormattedString=function(){var c=e.Utils.formatNumber,
a;a=""+("Datatype = "+ +this.datatypeCode+" ("+this.getDatatypeCodeString(this.datatypeCode)+")\n");a+="Bits Per Voxel =  = "+this.numBitsPerVoxel+"\n";a+="Image Dimensions (1-8): "+this.dims[0]+", "+this.dims[1]+", "+this.dims[2]+", "+this.dims[3]+", "+this.dims[4]+", "+this.dims[5]+", "+this.dims[6]+", "+this.dims[7]+"\n";a+="Intent Parameters (1-3): "+this.intent_p1+", "+this.intent_p2+", "+this.intent_p3+"\n";a+="Voxel Dimensions (1-8): "+c(this.pixDims[0])+", "+c(this.pixDims[1])+", "+c(this.pixDims[2])+
", "+c(this.pixDims[3])+", "+c(this.pixDims[4])+", "+c(this.pixDims[5])+", "+c(this.pixDims[6])+", "+c(this.pixDims[7])+"\n";a+="Image Offset = "+this.vox_offset+"\n";a+="Data Scale:  Slope = "+c(this.scl_slope)+"  Intercept = "+c(this.scl_inter)+"\n";a+="Display Range:  Max = "+c(this.cal_max)+"  Min = "+c(this.cal_min)+"\n";a+="Slice Duration = "+this.slice_duration+"\n";a+="Time Axis Shift = "+this.toffset+"\n";a+="Slice Start = "+this.slice_start+"\n";a+="Slice End = "+this.slice_end+"\n";a+=
'Description: "'+this.description+'"\n';a+='Auxiliary File: "'+this.aux_file+'"\n';a+="Q-Form Code = "+this.qform_code+" ("+this.getTransformCodeString(this.qform_code)+")\n";a+="S-Form Code = "+this.sform_code+" ("+this.getTransformCodeString(this.sform_code)+")\n";a+="Quaternion Parameters:  b = "+c(this.quatern_b)+"  c = "+c(this.quatern_c)+"  d = "+c(this.quatern_d)+"\n";a+="Quaternion Offsets:  x = "+this.qoffset_x+"  y = "+this.qoffset_y+"  z = "+this.qoffset_z+"\n";a+="S-Form Parameters X: "+
c(this.affine[0][0])+", "+c(this.affine[0][1])+", "+c(this.affine[0][2])+", "+c(this.affine[0][3])+"\n";a+="S-Form Parameters Y: "+c(this.affine[1][0])+", "+c(this.affine[1][1])+", "+c(this.affine[1][2])+", "+c(this.affine[1][3])+"\n";a+="S-Form Parameters Z: "+c(this.affine[2][0])+", "+c(this.affine[2][1])+", "+c(this.affine[2][2])+", "+c(this.affine[2][3])+"\n";a+="Slice Code = "+this.slice_code+"\n";a+="Units Code = "+this.xyzt_units+" ("+this.getUnitsCodeString(e.NIFTI1.SPATIAL_UNITS_MASK&this.xyzt_units)+
", "+this.getUnitsCodeString(e.NIFTI1.TEMPORAL_UNITS_MASK&this.xyzt_units)+")\n";a+="Intent Code = "+this.intent_code+"\n";a+='Intent Name: "'+this.intent_name+'"\n';return a+="Dim Info = "+this.dim_info+"\n"};e.NIFTI2.prototype.getExtensionLocation=function(){return e.NIFTI2.MAGIC_COOKIE+4};e.NIFTI2.prototype.getExtensionSize=e.NIFTI1.prototype.getExtensionSize;e.NIFTI2.prototype.getExtensionCode=e.NIFTI1.prototype.getExtensionCode;e.NIFTI2.prototype.getDatatypeCodeString=e.NIFTI1.prototype.getDatatypeCodeString;
e.NIFTI2.prototype.getTransformCodeString=e.NIFTI1.prototype.getTransformCodeString;e.NIFTI2.prototype.getUnitsCodeString=e.NIFTI1.prototype.getUnitsCodeString;e.NIFTI2.prototype.getQformMat=e.NIFTI1.prototype.getQformMat;e.NIFTI2.prototype.convertNiftiQFormToNiftiSForm=e.NIFTI1.prototype.convertNiftiQFormToNiftiSForm;e.NIFTI2.prototype.convertNiftiSFormToNEMA=e.NIFTI1.prototype.convertNiftiSFormToNEMA;e.NIFTI2.prototype.nifti_mat33_mul=e.NIFTI1.prototype.nifti_mat33_mul;e.NIFTI2.prototype.nifti_mat33_determ=
e.NIFTI1.prototype.nifti_mat33_determ;"undefined"!==typeof n&&n.exports&&(n.exports=e.NIFTI2)},function(n,h,f){function e(c){if(!(this instanceof e))return new e(c);c=this.options=b.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},c||{});c.raw&&0<c.windowBits?c.windowBits=-c.windowBits:c.gzip&&0<c.windowBits&&16>c.windowBits&&(c.windowBits+=16);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new k;this.strm.avail_out=0;var f=a.deflateInit2(this.strm,
c.level,c.method,c.windowBits,c.memLevel,c.strategy);if(0!==f)throw Error(g[f]);c.header&&a.deflateSetHeader(this.strm,c.header);if(c.dictionary){c="string"===typeof c.dictionary?d.string2buf(c.dictionary):"[object ArrayBuffer]"===m.call(c.dictionary)?new Uint8Array(c.dictionary):c.dictionary;f=a.deflateSetDictionary(this.strm,c);if(0!==f)throw Error(g[f]);this._dict_set=!0}}function c(a,b){b=new e(b);b.push(a,!0);if(b.err)throw b.msg||g[b.err];return b.result}var a=f(99),b=f(5),d=f(43),g=f(27),k=
f(47),m=Object.prototype.toString;e.prototype.push=function(c,e){var g=this.strm,f=this.options.chunkSize;if(this.ended)return!1;e=e===~~e?e:!0===e?4:0;"string"===typeof c?g.input=d.string2buf(c):"[object ArrayBuffer]"===m.call(c)?g.input=new Uint8Array(c):g.input=c;g.next_in=0;g.avail_in=g.input.length;do{0===g.avail_out&&(g.output=new b.Buf8(f),g.next_out=0,g.avail_out=f);c=a.deflate(g,e);if(1!==c&&0!==c)return this.onEnd(c),this.ended=!0,!1;if(0===g.avail_out||0===g.avail_in&&(4===e||2===e))if("string"===
this.options.to)this.onData(d.buf2binstring(b.shrinkBuf(g.output,g.next_out)));else this.onData(b.shrinkBuf(g.output,g.next_out))}while((0<g.avail_in||0===g.avail_out)&&1!==c);if(4===e)return c=a.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,0===c;2===e&&(this.onEnd(0),g.avail_out=0);return!0};e.prototype.onData=function(a){this.chunks.push(a)};e.prototype.onEnd=function(a){0===a&&(this.result="string"===this.options.to?this.chunks.join(""):b.flattenChunks(this.chunks));this.chunks=[];this.err=
a;this.msg=this.strm.msg};h.Deflate=e;h.deflate=c;h.deflateRaw=function(a,b){b=b||{};b.raw=!0;return c(a,b)};h.gzip=function(a,b){b=b||{};b.gzip=!0;return c(a,b)}},function(n,h,f){function e(c){if(!(this instanceof e))return new e(c);var d=this.options=b.assign({chunkSize:16384,windowBits:0,to:""},c||{});d.raw&&0<=d.windowBits&&16>d.windowBits&&(d.windowBits=-d.windowBits,0===d.windowBits&&(d.windowBits=-15));!(0<=d.windowBits&&16>d.windowBits)||c&&c.windowBits||(d.windowBits+=32);15<d.windowBits&&
48>d.windowBits&&0===(d.windowBits&15)&&(d.windowBits|=15);this.err=0;this.msg="";this.ended=!1;this.chunks=[];this.strm=new m;this.strm.avail_out=0;c=a.inflateInit2(this.strm,d.windowBits);if(c!==g.Z_OK)throw Error(k[c]);this.header=new l;a.inflateGetHeader(this.strm,this.header)}function c(a,b){b=new e(b);b.push(a,!0);if(b.err)throw b.msg||k[b.err];return b.result}var a=f(102),b=f(5),d=f(43),g=f(45),k=f(27),m=f(47),l=f(100),u=Object.prototype.toString;e.prototype.push=function(c,e){var f=this.strm,
k=this.options.chunkSize,h=this.options.dictionary,l,m,n,p=!1;if(this.ended)return!1;e=e===~~e?e:!0===e?g.Z_FINISH:g.Z_NO_FLUSH;"string"===typeof c?f.input=d.binstring2buf(c):"[object ArrayBuffer]"===u.call(c)?f.input=new Uint8Array(c):f.input=c;f.next_in=0;f.avail_in=f.input.length;do{0===f.avail_out&&(f.output=new b.Buf8(k),f.next_out=0,f.avail_out=k);c=a.inflate(f,g.Z_NO_FLUSH);c===g.Z_NEED_DICT&&h&&(c="string"===typeof h?d.string2buf(h):"[object ArrayBuffer]"===u.call(h)?new Uint8Array(h):h,c=
a.inflateSetDictionary(this.strm,c));c===g.Z_BUF_ERROR&&!0===p&&(c=g.Z_OK,p=!1);if(c!==g.Z_STREAM_END&&c!==g.Z_OK)return this.onEnd(c),this.ended=!0,!1;if(f.next_out&&(0===f.avail_out||c===g.Z_STREAM_END||0===f.avail_in&&(e===g.Z_FINISH||e===g.Z_SYNC_FLUSH)))if("string"===this.options.to)l=d.utf8border(f.output,f.next_out),m=f.next_out-l,n=d.buf2string(f.output,l),f.next_out=m,f.avail_out=k-m,m&&b.arraySet(f.output,f.output,l,m,0),this.onData(n);else this.onData(b.shrinkBuf(f.output,f.next_out));
0===f.avail_in&&0===f.avail_out&&(p=!0)}while((0<f.avail_in||0===f.avail_out)&&c!==g.Z_STREAM_END);c===g.Z_STREAM_END&&(e=g.Z_FINISH);if(e===g.Z_FINISH)return c=a.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===g.Z_OK;e===g.Z_SYNC_FLUSH&&(this.onEnd(g.Z_OK),f.avail_out=0);return!0};e.prototype.onData=function(a){this.chunks.push(a)};e.prototype.onEnd=function(a){a===g.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):b.flattenChunks(this.chunks));this.chunks=[];this.err=a;this.msg=
this.strm.msg};h.Inflate=e;h.inflate=c;h.inflateRaw=function(a,b){b=b||{};b.raw=!0;return c(a,b)};h.ungzip=c},function(n,h,f){function e(a,b){a.msg=G[b];return b}function c(a){for(var b=a.length;0<=--b;)a[b]=0}function a(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out);0!==c&&(t.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function b(b,c){E._tr_flush_block(b,0<=b.block_start?
b.block_start:-1,b.strstart-b.block_start,c);b.block_start=b.strstart;a(b.strm)}function d(a,b){a.pending_buf[a.pending++]=b}function g(a,b){a.pending_buf[a.pending++]=b>>>8&255;a.pending_buf[a.pending++]=b&255}function k(a,b){var c=a.max_chain_length,d=a.strstart,e,g=a.prev_length,f=a.nice_match,k=a.strstart>a.w_size-262?a.strstart-(a.w_size-262):0,h=a.window,l=a.w_mask,x=a.prev,m=a.strstart+258,n=h[d+g-1],t=h[d+g];a.prev_length>=a.good_match&&(c>>=2);f>a.lookahead&&(f=a.lookahead);do if(e=b,h[e+
g]===t&&h[e+g-1]===n&&h[e]===h[d]&&h[++e]===h[d+1]){d+=2;for(e++;h[++d]===h[++e]&&h[++d]===h[++e]&&h[++d]===h[++e]&&h[++d]===h[++e]&&h[++d]===h[++e]&&h[++d]===h[++e]&&h[++d]===h[++e]&&h[++d]===h[++e]&&d<m;);e=258-(m-d);d=m-258;if(e>g){a.match_start=b;g=e;if(e>=f)break;n=h[d+g-1];t=h[d+g]}}while((b=x[b&l])>k&&0!==--c);return g<=a.lookahead?g:a.lookahead}function m(a){var b=a.w_size,c,d,e,g;do{g=a.window_size-a.lookahead-a.strstart;if(a.strstart>=b+(b-262)){t.arraySet(a.window,a.window,b,b,0);a.match_start-=
b;a.strstart-=b;a.block_start-=b;c=d=a.hash_size;do e=a.head[--c],a.head[c]=e>=b?e-b:0;while(--d);c=d=b;do e=a.prev[--c],a.prev[c]=e>=b?e-b:0;while(--d);g+=b}if(0===a.strm.avail_in)break;c=a.strm;d=a.window;e=a.strstart+a.lookahead;var f=c.avail_in;f>g&&(f=g);0===f?d=0:(c.avail_in-=f,t.arraySet(d,c.input,c.next_in,f,e),1===c.state.wrap?c.adler=C(c.adler,d,f,e):2===c.state.wrap&&(c.adler=z(c.adler,d,f,e)),c.next_in+=f,c.total_in+=f,d=f);a.lookahead+=d;if(3<=a.lookahead+a.insert)for(g=a.strstart-a.insert,
a.ins_h=a.window[g],a.ins_h=(a.ins_h<<a.hash_shift^a.window[g+1])&a.hash_mask;a.insert&&!(a.ins_h=(a.ins_h<<a.hash_shift^a.window[g+3-1])&a.hash_mask,a.prev[g&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=g,g++,a.insert--,3>a.lookahead+a.insert););}while(262>a.lookahead&&0!==a.strm.avail_in)}function l(a,c){for(var d;;){if(262>a.lookahead){m(a);if(262>a.lookahead&&0===c)return 1;if(0===a.lookahead)break}d=0;3<=a.lookahead&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,d=a.prev[a.strstart&
a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);0!==d&&a.strstart-d<=a.w_size-262&&(a.match_length=k(a,d));if(3<=a.match_length)if(d=E._tr_tally(a,a.strstart-a.match_start,a.match_length-3),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&3<=a.lookahead){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=
a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=E._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(b(a,!1),0===a.strm.avail_out))return 1}a.insert=2>a.strstart?a.strstart:2;return 4===c?(b(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(b(a,!1),0===a.strm.avail_out)?1:2}function u(a,c){for(var d,e;;){if(262>a.lookahead){m(a);if(262>a.lookahead&&0===c)return 1;if(0===a.lookahead)break}d=0;3<=a.lookahead&&
(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,d=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);a.prev_length=a.match_length;a.prev_match=a.match_start;a.match_length=2;0!==d&&a.prev_length<a.max_lazy_match&&a.strstart-d<=a.w_size-262&&(a.match_length=k(a,d),5>=a.match_length&&(1===a.strategy||3===a.match_length&&4096<a.strstart-a.match_start)&&(a.match_length=2));if(3<=a.prev_length&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-3;d=E._tr_tally(a,
a.strstart-1-a.prev_match,a.prev_length-3);a.lookahead-=a.prev_length-1;a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+3-1])&a.hash_mask,a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);a.match_available=0;a.match_length=2;a.strstart++;if(d&&(b(a,!1),0===a.strm.avail_out))return 1}else if(a.match_available){if((d=E._tr_tally(a,0,a.window[a.strstart-1]))&&b(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return 1}else a.match_available=
1,a.strstart++,a.lookahead--}a.match_available&&(E._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0);a.insert=2>a.strstart?a.strstart:2;return 4===c?(b(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(b(a,!1),0===a.strm.avail_out)?1:2}function p(a,c){for(var d,e,g,f=a.window;;){if(258>=a.lookahead){m(a);if(258>=a.lookahead&&0===c)return 1;if(0===a.lookahead)break}a.match_length=0;if(3<=a.lookahead&&0<a.strstart&&(e=a.strstart-1,d=f[e],d===f[++e]&&d===f[++e]&&d===f[++e])){for(g=a.strstart+258;d===
f[++e]&&d===f[++e]&&d===f[++e]&&d===f[++e]&&d===f[++e]&&d===f[++e]&&d===f[++e]&&d===f[++e]&&e<g;);a.match_length=258-(g-e);a.match_length>a.lookahead&&(a.match_length=a.lookahead)}3<=a.match_length?(d=E._tr_tally(a,1,a.match_length-3),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(d=E._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++);if(d&&(b(a,!1),0===a.strm.avail_out))return 1}a.insert=0;return 4===c?(b(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(b(a,!1),
0===a.strm.avail_out)?1:2}function v(a,c){for(var d;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(0===c)return 1;break}a.match_length=0;d=E._tr_tally(a,0,a.window[a.strstart]);a.lookahead--;a.strstart++;if(d&&(b(a,!1),0===a.strm.avail_out))return 1}a.insert=0;return 4===c?(b(a,!0),0===a.strm.avail_out?3:4):a.last_lit&&(b(a,!1),0===a.strm.avail_out)?1:2}function r(a,b,c,d,e){this.good_length=a;this.max_lazy=b;this.nice_length=c;this.max_chain=d;this.func=e}function y(){this.strm=null;this.status=
0;this.pending_buf=null;this.wrap=this.pending=this.pending_out=this.pending_buf_size=0;this.gzhead=null;this.gzindex=0;this.method=8;this.last_flush=-1;this.w_mask=this.w_bits=this.w_size=0;this.window=null;this.window_size=0;this.head=this.prev=null;this.nice_match=this.good_match=this.strategy=this.level=this.max_lazy_match=this.max_chain_length=this.prev_length=this.lookahead=this.match_start=this.strstart=this.match_available=this.prev_match=this.match_length=this.block_start=this.hash_shift=
this.hash_mask=this.hash_bits=this.hash_size=this.ins_h=0;this.dyn_ltree=new t.Buf16(1146);this.dyn_dtree=new t.Buf16(122);this.bl_tree=new t.Buf16(78);c(this.dyn_ltree);c(this.dyn_dtree);c(this.bl_tree);this.bl_desc=this.d_desc=this.l_desc=null;this.bl_count=new t.Buf16(16);this.heap=new t.Buf16(573);c(this.heap);this.heap_max=this.heap_len=0;this.depth=new t.Buf16(573);c(this.depth);this.bi_valid=this.bi_buf=this.insert=this.matches=this.static_len=this.opt_len=this.d_buf=this.last_lit=this.lit_bufsize=
this.l_buf=0}function D(a){var b;if(!a||!a.state)return e(a,-2);a.total_in=a.total_out=0;a.data_type=2;b=a.state;b.pending=0;b.pending_out=0;0>b.wrap&&(b.wrap=-b.wrap);b.status=b.wrap?42:113;a.adler=2===b.wrap?0:1;b.last_flush=0;E._tr_init(b);return 0}function q(a){var b=D(a);0===b&&(a=a.state,a.window_size=2*a.w_size,c(a.head),a.max_lazy_match=H[a.level].max_lazy,a.good_match=H[a.level].good_length,a.nice_match=H[a.level].nice_length,a.max_chain_length=H[a.level].max_chain,a.strstart=0,a.block_start=
0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0);return b}function B(a,b,c,d,g,f){if(!a)return-2;var k=1;-1===b&&(b=6);0>d?(k=0,d=-d):15<d&&(k=2,d-=16);if(1>g||9<g||8!==c||8>d||15<d||0>b||9<b||0>f||4<f)return e(a,-2);8===d&&(d=9);var h=new y;a.state=h;h.strm=a;h.wrap=k;h.gzhead=null;h.w_bits=d;h.w_size=1<<h.w_bits;h.w_mask=h.w_size-1;h.hash_bits=g+7;h.hash_size=1<<h.hash_bits;h.hash_mask=h.hash_size-1;h.hash_shift=~~((h.hash_bits+3-1)/3);h.window=new t.Buf8(2*
h.w_size);h.head=new t.Buf16(h.hash_size);h.prev=new t.Buf16(h.w_size);h.lit_bufsize=1<<g+6;h.pending_buf_size=4*h.lit_bufsize;h.pending_buf=new t.Buf8(h.pending_buf_size);h.d_buf=1*h.lit_bufsize;h.l_buf=3*h.lit_bufsize;h.level=b;h.strategy=f;h.method=c;return q(a)}var t=f(5),E=f(104),C=f(44),z=f(46),G=f(27),H;H=[new r(0,0,0,0,function(a,c){var d=65535;for(d>a.pending_buf_size-5&&(d=a.pending_buf_size-5);;){if(1>=a.lookahead){m(a);if(0===a.lookahead&&0===c)return 1;if(0===a.lookahead)break}a.strstart+=
a.lookahead;a.lookahead=0;var e=a.block_start+d;if(0===a.strstart||a.strstart>=e)if(a.lookahead=a.strstart-e,a.strstart=e,b(a,!1),0===a.strm.avail_out)return 1;if(a.strstart-a.block_start>=a.w_size-262&&(b(a,!1),0===a.strm.avail_out))return 1}a.insert=0;if(4===c)return b(a,!0),0===a.strm.avail_out?3:4;a.strstart>a.block_start&&b(a,!1);return 1}),new r(4,4,8,4,l),new r(4,5,16,8,l),new r(4,6,32,32,l),new r(4,4,16,16,u),new r(8,16,32,32,u),new r(8,16,128,128,u),new r(8,32,128,256,u),new r(32,128,258,
1024,u),new r(32,258,258,4096,u)];h.deflateInit=function(a,b){return B(a,b,8,15,8,0)};h.deflateInit2=B;h.deflateReset=q;h.deflateResetKeep=D;h.deflateSetHeader=function(a,b){if(!a||!a.state||2!==a.state.wrap)return-2;a.state.gzhead=b;return 0};h.deflate=function(b,f){var k,h,l,m;if(!b||!b.state||5<f||0>f)return b?e(b,-2):-2;h=b.state;if(!b.output||!b.input&&0!==b.avail_in||666===h.status&&4!==f)return e(b,0===b.avail_out?-5:-2);h.strm=b;k=h.last_flush;h.last_flush=f;42===h.status&&(2===h.wrap?(b.adler=
0,d(h,31),d(h,139),d(h,8),h.gzhead?(d(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),d(h,h.gzhead.time&255),d(h,h.gzhead.time>>8&255),d(h,h.gzhead.time>>16&255),d(h,h.gzhead.time>>24&255),d(h,9===h.level?2:2<=h.strategy||2>h.level?4:0),d(h,h.gzhead.os&255),h.gzhead.extra&&h.gzhead.extra.length&&(d(h,h.gzhead.extra.length&255),d(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(b.adler=z(b.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=
69):(d(h,0),d(h,0),d(h,0),d(h,0),d(h,0),d(h,9===h.level?2:2<=h.strategy||2>h.level?4:0),d(h,3),h.status=113)):(l=8+(h.w_bits-8<<4)<<8,l|=(2<=h.strategy||2>h.level?0:6>h.level?1:6===h.level?2:3)<<6,0!==h.strstart&&(l|=32),h.status=113,g(h,l+(31-l%31)),0!==h.strstart&&(g(h,b.adler>>>16),g(h,b.adler&65535)),b.adler=1));if(69===h.status)if(h.gzhead.extra){for(l=h.pending;h.gzindex<(h.gzhead.extra.length&65535)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>l&&(b.adler=z(b.adler,h.pending_buf,
h.pending-l,l)),a(b),l=h.pending,h.pending!==h.pending_buf_size));)d(h,h.gzhead.extra[h.gzindex]&255),h.gzindex++;h.gzhead.hcrc&&h.pending>l&&(b.adler=z(b.adler,h.pending_buf,h.pending-l,l));h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=73)}else h.status=73;if(73===h.status)if(h.gzhead.name){l=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>l&&(b.adler=z(b.adler,h.pending_buf,h.pending-l,l)),a(b),l=h.pending,h.pending===h.pending_buf_size)){m=1;break}m=h.gzindex<
h.gzhead.name.length?h.gzhead.name.charCodeAt(h.gzindex++)&255:0;d(h,m)}while(0!==m);h.gzhead.hcrc&&h.pending>l&&(b.adler=z(b.adler,h.pending_buf,h.pending-l,l));0===m&&(h.gzindex=0,h.status=91)}else h.status=91;if(91===h.status)if(h.gzhead.comment){l=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>l&&(b.adler=z(b.adler,h.pending_buf,h.pending-l,l)),a(b),l=h.pending,h.pending===h.pending_buf_size)){m=1;break}m=h.gzindex<h.gzhead.comment.length?h.gzhead.comment.charCodeAt(h.gzindex++)&
255:0;d(h,m)}while(0!==m);h.gzhead.hcrc&&h.pending>l&&(b.adler=z(b.adler,h.pending_buf,h.pending-l,l));0===m&&(h.status=103)}else h.status=103;103===h.status&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&a(b),h.pending+2<=h.pending_buf_size&&(d(h,b.adler&255),d(h,b.adler>>8&255),b.adler=0,h.status=113)):h.status=113);if(0!==h.pending){if(a(b),0===b.avail_out)return h.last_flush=-1,0}else if(0===b.avail_in&&(f<<1)-(4<f?9:0)<=(k<<1)-(4<k?9:0)&&4!==f)return e(b,-5);if(666===h.status&&0!==b.avail_in)return e(b,
-5);if(0!==b.avail_in||0!==h.lookahead||0!==f&&666!==h.status){k=2===h.strategy?v(h,f):3===h.strategy?p(h,f):H[h.level].func(h,f);if(3===k||4===k)h.status=666;if(1===k||3===k)return 0===b.avail_out&&(h.last_flush=-1),0;if(2===k&&(1===f?E._tr_align(h):5!==f&&(E._tr_stored_block(h,0,0,!1),3===f&&(c(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),a(b),0===b.avail_out))return h.last_flush=-1,0}if(4!==f)return 0;if(0>=h.wrap)return 1;2===h.wrap?(d(h,b.adler&255),d(h,b.adler>>8&255),
d(h,b.adler>>16&255),d(h,b.adler>>24&255),d(h,b.total_in&255),d(h,b.total_in>>8&255),d(h,b.total_in>>16&255),d(h,b.total_in>>24&255)):(g(h,b.adler>>>16),g(h,b.adler&65535));a(b);0<h.wrap&&(h.wrap=-h.wrap);return 0!==h.pending?0:1};h.deflateEnd=function(a){var b;if(!a||!a.state)return-2;b=a.state.status;if(42!==b&&69!==b&&73!==b&&91!==b&&103!==b&&113!==b&&666!==b)return e(a,-2);a.state=null;return 113===b?e(a,-3):0};h.deflateSetDictionary=function(a,b){var d=b.length,e,g,f,h,k;if(!a||!a.state)return-2;
e=a.state;g=e.wrap;if(2===g||1===g&&42!==e.status||e.lookahead)return-2;1===g&&(a.adler=C(a.adler,b,d,0));e.wrap=0;d>=e.w_size&&(0===g&&(c(e.head),e.strstart=0,e.block_start=0,e.insert=0),f=new t.Buf8(e.w_size),t.arraySet(f,b,d-e.w_size,e.w_size,0),b=f,d=e.w_size);f=a.avail_in;h=a.next_in;k=a.input;a.avail_in=d;a.next_in=0;a.input=b;for(m(e);3<=e.lookahead;){b=e.strstart;d=e.lookahead-2;do e.ins_h=(e.ins_h<<e.hash_shift^e.window[b+3-1])&e.hash_mask,e.prev[b&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=
b,b++;while(--d);e.strstart=b;e.lookahead=2;m(e)}e.strstart+=e.lookahead;e.block_start=e.strstart;e.insert=e.lookahead;e.lookahead=0;e.match_length=e.prev_length=2;e.match_available=0;a.next_in=h;a.input=k;a.avail_in=f;e.wrap=g;return 0};h.deflateInfo="pako deflate (from Nodeca project)"},function(n,h,f){n.exports=function(){this.os=this.xflags=this.time=this.text=0;this.extra=null;this.extra_len=0;this.comment=this.name="";this.hcrc=0;this.done=!1}},function(n,h,f){n.exports=function(e,c){var a,
b,d,g,f,h,l,n,p,v,r,y,D,q,B,t,E,C,z,G,H,x,w;a=e.state;b=e.next_in;x=e.input;d=b+(e.avail_in-5);g=e.next_out;w=e.output;c=g-(c-e.avail_out);f=g+(e.avail_out-257);h=a.dmax;l=a.wsize;n=a.whave;p=a.wnext;v=a.window;r=a.hold;y=a.bits;D=a.lencode;q=a.distcode;B=(1<<a.lenbits)-1;t=(1<<a.distbits)-1;a:do b:for(15>y&&(r+=x[b++]<<y,y+=8,r+=x[b++]<<y,y+=8),E=D[r&B];;){C=E>>>24;r>>>=C;y-=C;C=E>>>16&255;if(0===C)w[g++]=E&65535;else if(C&16){z=E&65535;if(C&=15)y<C&&(r+=x[b++]<<y,y+=8),z+=r&(1<<C)-1,r>>>=C,y-=C;
15>y&&(r+=x[b++]<<y,y+=8,r+=x[b++]<<y,y+=8);E=q[r&t];c:for(;;){C=E>>>24;r>>>=C;y-=C;C=E>>>16&255;if(C&16){E&=65535;C&=15;y<C&&(r+=x[b++]<<y,y+=8,y<C&&(r+=x[b++]<<y,y+=8));E+=r&(1<<C)-1;if(E>h){e.msg="invalid distance too far back";a.mode=30;break a}r>>>=C;y-=C;C=g-c;if(E>C){C=E-C;if(C>n&&a.sane){e.msg="invalid distance too far back";a.mode=30;break a}G=0;H=v;if(0===p){if(G+=l-C,C<z){z-=C;do w[g++]=v[G++];while(--C);G=g-E;H=w}}else if(p<C){if(G+=l+p-C,C-=p,C<z){z-=C;do w[g++]=v[G++];while(--C);G=0;
if(p<z){C=p;z-=C;do w[g++]=v[G++];while(--C);G=g-E;H=w}}}else if(G+=p-C,C<z){z-=C;do w[g++]=v[G++];while(--C);G=g-E;H=w}for(;2<z;)w[g++]=H[G++],w[g++]=H[G++],w[g++]=H[G++],z-=3;z&&(w[g++]=H[G++],1<z&&(w[g++]=H[G++]))}else{G=g-E;do w[g++]=w[G++],w[g++]=w[G++],w[g++]=w[G++],z-=3;while(2<z);z&&(w[g++]=w[G++],1<z&&(w[g++]=w[G++]))}}else if(0===(C&64)){E=q[(E&65535)+(r&(1<<C)-1)];continue c}else{e.msg="invalid distance code";a.mode=30;break a}break}}else if(0===(C&64)){E=D[(E&65535)+(r&(1<<C)-1)];continue b}else{C&
32?a.mode=12:(e.msg="invalid literal/length code",a.mode=30);break a}break}while(b<d&&g<f);z=y>>3;b-=z;y-=z<<3;e.next_in=b;e.next_out=g;e.avail_in=b<d?5+(d-b):5-(b-d);e.avail_out=g<f?257+(f-g):257-(g-f);a.hold=r&(1<<y)-1;a.bits=y}},function(n,h,f){function e(a){return(a>>>24&255)+(a>>>8&65280)+((a&65280)<<8)+((a&255)<<24)}function c(){this.mode=0;this.last=!1;this.wrap=0;this.havedict=!1;this.total=this.check=this.dmax=this.flags=0;this.head=null;this.wnext=this.whave=this.wsize=this.wbits=0;this.window=
null;this.extra=this.offset=this.length=this.bits=this.hold=0;this.distcode=this.lencode=null;this.have=this.ndist=this.nlen=this.ncode=this.distbits=this.lenbits=0;this.next=null;this.lens=new m.Buf16(320);this.work=new m.Buf16(288);this.distdyn=this.lendyn=null;this.was=this.back=this.sane=0}function a(a){var b;if(!a||!a.state)return-2;b=a.state;a.total_in=a.total_out=b.total=0;a.msg="";b.wrap&&(a.adler=b.wrap&1);b.mode=1;b.last=0;b.havedict=0;b.dmax=32768;b.head=null;b.hold=0;b.bits=0;b.lencode=
b.lendyn=new m.Buf32(852);b.distcode=b.distdyn=new m.Buf32(592);b.sane=1;b.back=-1;return 0}function b(b){var c;if(!b||!b.state)return-2;c=b.state;c.wsize=0;c.whave=0;c.wnext=0;return a(b)}function d(a,c){var d,e;if(!a||!a.state)return-2;e=a.state;0>c?(d=0,c=-c):(d=(c>>4)+1,48>c&&(c&=15));if(c&&(8>c||15<c))return-2;null!==e.window&&e.wbits!==c&&(e.window=null);e.wrap=d;e.wbits=c;return b(a)}function g(a,b){var e;if(!a)return-2;e=new c;a.state=e;e.window=null;b=d(a,b);0!==b&&(a.state=null);return b}
function k(a,b,c,d){var e=a.state;null===e.window&&(e.wsize=1<<e.wbits,e.wnext=0,e.whave=0,e.window=new m.Buf8(e.wsize));d>=e.wsize?(m.arraySet(e.window,b,c-e.wsize,e.wsize,0),e.wnext=0,e.whave=e.wsize):(a=e.wsize-e.wnext,a>d&&(a=d),m.arraySet(e.window,b,c-d,a,e.wnext),(d-=a)?(m.arraySet(e.window,b,c-d,d,0),e.wnext=d,e.whave=e.wsize):(e.wnext+=a,e.wnext===e.wsize&&(e.wnext=0),e.whave<e.wsize&&(e.whave+=a)));return 0}var m=f(5),l=f(44),u=f(46),p=f(101),v=f(103),r=!0,y,D;h.inflateReset=b;h.inflateReset2=
d;h.inflateResetKeep=a;h.inflateInit=function(a){return g(a,15)};h.inflateInit2=g;h.inflate=function(a,b){var c,d,g,f,h,n,x,w,q,B,K,F,I,N,M,J,A,R,V=new m.Buf8(4),Q=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return-2;c=a.state;12===c.mode&&(c.mode=13);h=a.next_out;g=a.output;x=a.avail_out;f=a.next_in;d=a.input;n=a.avail_in;w=c.hold;q=c.bits;B=n;K=x;R=0;a:for(;;)switch(c.mode){case 1:if(0===c.wrap){c.mode=13;break}for(;16>q;){if(0===n)break a;
n--;w+=d[f++]<<q;q+=8}if(c.wrap&2&&35615===w){c.check=0;V[0]=w&255;V[1]=w>>>8&255;c.check=u(c.check,V,2,0);q=w=0;c.mode=2;break}c.flags=0;c.head&&(c.head.done=!1);if(!(c.wrap&1)||(((w&255)<<8)+(w>>8))%31){a.msg="incorrect header check";c.mode=30;break}if(8!==(w&15)){a.msg="unknown compression method";c.mode=30;break}w>>>=4;q-=4;I=(w&15)+8;if(0===c.wbits)c.wbits=I;else if(I>c.wbits){a.msg="invalid window size";c.mode=30;break}c.dmax=1<<I;a.adler=c.check=1;c.mode=w&512?10:12;q=w=0;break;case 2:for(;16>
q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.flags=w;if(8!==(c.flags&255)){a.msg="unknown compression method";c.mode=30;break}if(c.flags&57344){a.msg="unknown header flags set";c.mode=30;break}c.head&&(c.head.text=w>>8&1);c.flags&512&&(V[0]=w&255,V[1]=w>>>8&255,c.check=u(c.check,V,2,0));q=w=0;c.mode=3;case 3:for(;32>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.head&&(c.head.time=w);c.flags&512&&(V[0]=w&255,V[1]=w>>>8&255,V[2]=w>>>16&255,V[3]=w>>>24&255,c.check=u(c.check,V,4,0));q=w=0;c.mode=4;case 4:for(;16>
q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.head&&(c.head.xflags=w&255,c.head.os=w>>8);c.flags&512&&(V[0]=w&255,V[1]=w>>>8&255,c.check=u(c.check,V,2,0));q=w=0;c.mode=5;case 5:if(c.flags&1024){for(;16>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.length=w;c.head&&(c.head.extra_len=w);c.flags&512&&(V[0]=w&255,V[1]=w>>>8&255,c.check=u(c.check,V,2,0));q=w=0}else c.head&&(c.head.extra=null);c.mode=6;case 6:if(c.flags&1024&&(F=c.length,F>n&&(F=n),F&&(c.head&&(I=c.head.extra_len-c.length,c.head.extra||(c.head.extra=
Array(c.head.extra_len)),m.arraySet(c.head.extra,d,f,F,I)),c.flags&512&&(c.check=u(c.check,d,F,f)),n-=F,f+=F,c.length-=F),c.length))break a;c.length=0;c.mode=7;case 7:if(c.flags&2048){if(0===n)break a;F=0;do I=d[f+F++],c.head&&I&&65536>c.length&&(c.head.name+=String.fromCharCode(I));while(I&&F<n);c.flags&512&&(c.check=u(c.check,d,F,f));n-=F;f+=F;if(I)break a}else c.head&&(c.head.name=null);c.length=0;c.mode=8;case 8:if(c.flags&4096){if(0===n)break a;F=0;do I=d[f+F++],c.head&&I&&65536>c.length&&(c.head.comment+=
String.fromCharCode(I));while(I&&F<n);c.flags&512&&(c.check=u(c.check,d,F,f));n-=F;f+=F;if(I)break a}else c.head&&(c.head.comment=null);c.mode=9;case 9:if(c.flags&512){for(;16>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}if(w!==(c.check&65535)){a.msg="header crc mismatch";c.mode=30;break}q=w=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0);a.adler=c.check=0;c.mode=12;break;case 10:for(;32>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}a.adler=c.check=e(w);q=w=0;c.mode=11;case 11:if(0===c.havedict)return a.next_out=
h,a.avail_out=x,a.next_in=f,a.avail_in=n,c.hold=w,c.bits=q,2;a.adler=c.check=1;c.mode=12;case 12:if(5===b||6===b)break a;case 13:if(c.last){w>>>=q&7;q-=q&7;c.mode=27;break}for(;3>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.last=w&1;w>>>=1;--q;switch(w&3){case 0:c.mode=14;break;case 1:I=c;if(r){y=new m.Buf32(512);D=new m.Buf32(32);for(F=0;144>F;)I.lens[F++]=8;for(;256>F;)I.lens[F++]=9;for(;280>F;)I.lens[F++]=7;for(;288>F;)I.lens[F++]=8;v(1,I.lens,0,288,y,0,I.work,{bits:9});for(F=0;32>F;)I.lens[F++]=
5;v(2,I.lens,0,32,D,0,I.work,{bits:5});r=!1}I.lencode=y;I.lenbits=9;I.distcode=D;I.distbits=5;c.mode=20;if(6===b){w>>>=2;q-=2;break a}break;case 2:c.mode=17;break;case 3:a.msg="invalid block type",c.mode=30}w>>>=2;q-=2;break;case 14:w>>>=q&7;for(q-=q&7;32>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}if((w&65535)!==(w>>>16^65535)){a.msg="invalid stored block lengths";c.mode=30;break}c.length=w&65535;q=w=0;c.mode=15;if(6===b)break a;case 15:c.mode=16;case 16:if(F=c.length){F>n&&(F=n);F>x&&(F=x);if(0===
F)break a;m.arraySet(g,d,f,F,h);n-=F;f+=F;x-=F;h+=F;c.length-=F;break}c.mode=12;break;case 17:for(;14>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.nlen=(w&31)+257;w>>>=5;q-=5;c.ndist=(w&31)+1;w>>>=5;q-=5;c.ncode=(w&15)+4;w>>>=4;q-=4;if(286<c.nlen||30<c.ndist){a.msg="too many length or distance symbols";c.mode=30;break}c.have=0;c.mode=18;case 18:for(;c.have<c.ncode;){for(;3>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.lens[Q[c.have++]]=w&7;w>>>=3;q-=3}for(;19>c.have;)c.lens[Q[c.have++]]=0;c.lencode=
c.lendyn;c.lenbits=7;F={bits:c.lenbits};R=v(0,c.lens,0,19,c.lencode,0,c.work,F);c.lenbits=F.bits;if(R){a.msg="invalid code lengths set";c.mode=30;break}c.have=0;c.mode=19;case 19:for(;c.have<c.nlen+c.ndist;){for(;;){M=c.lencode[w&(1<<c.lenbits)-1];F=M>>>24;M&=65535;if(F<=q)break;if(0===n)break a;n--;w+=d[f++]<<q;q+=8}if(16>M)w>>>=F,q-=F,c.lens[c.have++]=M;else{if(16===M){for(I=F+2;q<I;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}w>>>=F;q-=F;if(0===c.have){a.msg="invalid bit length repeat";c.mode=30;break}I=
c.lens[c.have-1];F=3+(w&3);w>>>=2;q-=2}else if(17===M){for(I=F+3;q<I;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}w>>>=F;q-=F;I=0;F=3+(w&7);w>>>=3;q-=3}else{for(I=F+7;q<I;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}w>>>=F;q-=F;I=0;F=11+(w&127);w>>>=7;q-=7}if(c.have+F>c.nlen+c.ndist){a.msg="invalid bit length repeat";c.mode=30;break}for(;F--;)c.lens[c.have++]=I}}if(30===c.mode)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block";c.mode=30;break}c.lenbits=9;F={bits:c.lenbits};R=v(1,c.lens,
0,c.nlen,c.lencode,0,c.work,F);c.lenbits=F.bits;if(R){a.msg="invalid literal/lengths set";c.mode=30;break}c.distbits=6;c.distcode=c.distdyn;F={bits:c.distbits};R=v(2,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,F);c.distbits=F.bits;if(R){a.msg="invalid distances set";c.mode=30;break}c.mode=20;if(6===b)break a;case 20:c.mode=21;case 21:if(6<=n&&258<=x){a.next_out=h;a.avail_out=x;a.next_in=f;a.avail_in=n;c.hold=w;c.bits=q;p(a,K);h=a.next_out;g=a.output;x=a.avail_out;f=a.next_in;d=a.input;n=a.avail_in;
w=c.hold;q=c.bits;12===c.mode&&(c.back=-1);break}for(c.back=0;;){M=c.lencode[w&(1<<c.lenbits)-1];F=M>>>24;I=M>>>16&255;M&=65535;if(F<=q)break;if(0===n)break a;n--;w+=d[f++]<<q;q+=8}if(I&&0===(I&240)){N=F;J=I;for(A=M;;){M=c.lencode[A+((w&(1<<N+J)-1)>>N)];F=M>>>24;I=M>>>16&255;M&=65535;if(N+F<=q)break;if(0===n)break a;n--;w+=d[f++]<<q;q+=8}w>>>=N;q-=N;c.back+=N}w>>>=F;q-=F;c.back+=F;c.length=M;if(0===I){c.mode=26;break}if(I&32){c.back=-1;c.mode=12;break}if(I&64){a.msg="invalid literal/length code";
c.mode=30;break}c.extra=I&15;c.mode=22;case 22:if(c.extra){for(I=c.extra;q<I;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.length+=w&(1<<c.extra)-1;w>>>=c.extra;q-=c.extra;c.back+=c.extra}c.was=c.length;c.mode=23;case 23:for(;;){M=c.distcode[w&(1<<c.distbits)-1];F=M>>>24;I=M>>>16&255;M&=65535;if(F<=q)break;if(0===n)break a;n--;w+=d[f++]<<q;q+=8}if(0===(I&240)){N=F;J=I;for(A=M;;){M=c.distcode[A+((w&(1<<N+J)-1)>>N)];F=M>>>24;I=M>>>16&255;M&=65535;if(N+F<=q)break;if(0===n)break a;n--;w+=d[f++]<<q;q+=8}w>>>=
N;q-=N;c.back+=N}w>>>=F;q-=F;c.back+=F;if(I&64){a.msg="invalid distance code";c.mode=30;break}c.offset=M;c.extra=I&15;c.mode=24;case 24:if(c.extra){for(I=c.extra;q<I;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}c.offset+=w&(1<<c.extra)-1;w>>>=c.extra;q-=c.extra;c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back";c.mode=30;break}c.mode=25;case 25:if(0===x)break a;F=K-x;if(c.offset>F){F=c.offset-F;if(F>c.whave&&c.sane){a.msg="invalid distance too far back";c.mode=30;break}F>c.wnext?
(F-=c.wnext,I=c.wsize-F):I=c.wnext-F;F>c.length&&(F=c.length);N=c.window}else N=g,I=h-c.offset,F=c.length;F>x&&(F=x);x-=F;c.length-=F;do g[h++]=N[I++];while(--F);0===c.length&&(c.mode=21);break;case 26:if(0===x)break a;g[h++]=c.length;x--;c.mode=21;break;case 27:if(c.wrap){for(;32>q;){if(0===n)break a;n--;w|=d[f++]<<q;q+=8}K-=x;a.total_out+=K;c.total+=K;K&&(a.adler=c.check=c.flags?u(c.check,g,K,h-K):l(c.check,g,K,h-K));K=x;if((c.flags?w:e(w))!==c.check){a.msg="incorrect data check";c.mode=30;break}q=
w=0}c.mode=28;case 28:if(c.wrap&&c.flags){for(;32>q;){if(0===n)break a;n--;w+=d[f++]<<q;q+=8}if(w!==(c.total&4294967295)){a.msg="incorrect length check";c.mode=30;break}q=w=0}c.mode=29;case 29:R=1;break a;case 30:R=-3;break a;case 31:return-4;default:return-2}a.next_out=h;a.avail_out=x;a.next_in=f;a.avail_in=n;c.hold=w;c.bits=q;if((c.wsize||K!==a.avail_out&&30>c.mode&&(27>c.mode||4!==b))&&k(a,a.output,a.next_out,K-a.avail_out))return c.mode=31,-4;B-=a.avail_in;K-=a.avail_out;a.total_in+=B;a.total_out+=
K;c.total+=K;c.wrap&&K&&(a.adler=c.check=c.flags?u(c.check,g,K,a.next_out-K):l(c.check,g,K,a.next_out-K));a.data_type=c.bits+(c.last?64:0)+(12===c.mode?128:0)+(20===c.mode||15===c.mode?256:0);(0===B&&0===K||4===b)&&0===R&&(R=-5);return R};h.inflateEnd=function(a){if(!a||!a.state)return-2;var b=a.state;b.window&&(b.window=null);a.state=null;return 0};h.inflateGetHeader=function(a,b){if(!a||!a.state)return-2;a=a.state;if(0===(a.wrap&2))return-2;a.head=b;b.done=!1;return 0};h.inflateSetDictionary=function(a,
b){var c=b.length,d,e;if(!a||!a.state)return-2;d=a.state;if(0!==d.wrap&&11!==d.mode)return-2;if(11===d.mode&&(e=l(1,b,c,0),e!==d.check))return-3;if(k(a,b,c,c))return d.mode=31,-4;d.havedict=1;return 0};h.inflateInfo="pako inflate (from Nodeca project)"},function(n,h,f){var e=f(5),c=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],a=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],b=[1,2,3,4,5,7,9,13,17,25,33,
49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],d=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];n.exports=function(g,f,h,l,n,p,v,r){var k=r.bits,m,q,u,t,E,C,z,G,H,x,w,L,O,K=0,F,I=new e.Buf16(16);E=new e.Buf16(16);var N,M=0,J,A,R;for(m=0;15>=m;m++)I[m]=0;for(q=0;q<l;q++)I[f[h+q]]++;t=k;for(u=15;1<=u&&0===I[u];u--);t>u&&(t=u);if(0===u)return n[p++]=20971520,n[p++]=20971520,r.bits=1,0;for(k=1;k<u&&0===I[k];k++);
t<k&&(t=k);for(m=C=1;15>=m;m++)if(C<<=1,C-=I[m],0>C)return-1;if(0<C&&(0===g||1!==u))return-1;E[1]=0;for(m=1;15>m;m++)E[m+1]=E[m]+I[m];for(q=0;q<l;q++)0!==f[h+q]&&(v[E[f[h+q]]++]=q);0===g?(O=N=v,F=19):1===g?(O=c,K-=257,N=a,M-=257,F=256):(O=b,N=d,F=-1);q=G=0;m=k;L=p;l=t;E=0;x=-1;z=1<<t;w=z-1;if(1===g&&852<z||2===g&&592<z)return 1;for(;;){J=m-E;v[q]<F?(A=0,R=v[q]):v[q]>F?(A=N[M+v[q]],R=O[K+v[q]]):(A=96,R=0);C=1<<m-E;k=H=1<<l;do H-=C,n[L+(G>>E)+H]=J<<24|A<<16|R|0;while(0!==H);for(C=1<<m-1;G&C;)C>>=1;
0!==C?(G&=C-1,G+=C):G=0;q++;if(0===--I[m]){if(m===u)break;m=f[h+v[q]]}if(m>t&&(G&w)!==x){0===E&&(E=t);L+=k;l=m-E;for(C=1<<l;l+E<u;){C-=I[l+E];if(0>=C)break;l++;C<<=1}z+=1<<l;if(1===g&&852<z||2===g&&592<z)return 1;x=G&w;n[x]=t<<24|l<<16|L-p|0}}0!==G&&(n[L+G]=m-E<<24|4194304);r.bits=t;return 0}},function(n,h,f){function e(a){for(var b=a.length;0<=--b;)a[b]=0}function c(a,b,c,d,e){this.static_tree=a;this.extra_bits=b;this.extra_base=c;this.elems=d;this.max_length=e;this.has_stree=a&&a.length}function a(a,
b){this.dyn_tree=a;this.max_code=0;this.stat_desc=b}function b(a,b){a.pending_buf[a.pending++]=b&255;a.pending_buf[a.pending++]=b>>>8&255}function d(a,c,d){a.bi_valid>16-d?(a.bi_buf|=c<<a.bi_valid&65535,b(a,a.bi_buf),a.bi_buf=c>>16-a.bi_valid,a.bi_valid+=d-16):(a.bi_buf|=c<<a.bi_valid&65535,a.bi_valid+=d)}function g(a,b,c){d(a,c[2*b],c[2*b+1])}function k(a,b){var c=0;do c|=a&1,a>>>=1,c<<=1;while(0<--b);return c>>>1}function m(a,b,c){var d=Array(16),e=0,g;for(g=1;15>=g;g++)d[g]=e=e+c[g-1]<<1;for(c=
0;c<=b;c++)e=a[2*c+1],0!==e&&(a[2*c]=k(d[e]++,e))}function l(a){var b;for(b=0;286>b;b++)a.dyn_ltree[2*b]=0;for(b=0;30>b;b++)a.dyn_dtree[2*b]=0;for(b=0;19>b;b++)a.bl_tree[2*b]=0;a.dyn_ltree[512]=1;a.opt_len=a.static_len=0;a.last_lit=a.matches=0}function u(a){8<a.bi_valid?b(a,a.bi_buf):0<a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf);a.bi_buf=0;a.bi_valid=0}function p(a,b,c,d){var e=2*b,g=2*c;return a[e]<a[g]||a[e]===a[g]&&d[b]<=d[c]}function v(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len;){e<
a.heap_len&&p(b,a.heap[e+1],a.heap[e],a.depth)&&e++;if(p(b,d,a.heap[e],a.depth))break;a.heap[c]=a.heap[e];c=e;e<<=1}a.heap[c]=d}function r(a,b,c){var e,f,h=0,k,l;if(0!==a.last_lit){do e=a.pending_buf[a.d_buf+2*h]<<8|a.pending_buf[a.d_buf+2*h+1],f=a.pending_buf[a.l_buf+h],h++,0===e?g(a,f,b):(k=O[f],g(a,k+256+1,b),l=C[k],0!==l&&(f-=K[k],d(a,f,l)),e--,k=256>e?L[e]:L[256+(e>>>7)],g(a,k,c),l=z[k],0!==l&&(e-=F[k],d(a,e,l)));while(h<a.last_lit)}g(a,256,b)}function y(a,b){var c=b.dyn_tree,d=b.stat_desc.static_tree,
e=b.stat_desc.has_stree,g=b.stat_desc.elems,f,h=-1,k;a.heap_len=0;a.heap_max=573;for(f=0;f<g;f++)0!==c[2*f]?(a.heap[++a.heap_len]=h=f,a.depth[f]=0):c[2*f+1]=0;for(;2>a.heap_len;)k=a.heap[++a.heap_len]=2>h?++h:0,c[2*k]=1,a.depth[k]=0,a.opt_len--,e&&(a.static_len-=d[2*k+1]);b.max_code=h;for(f=a.heap_len>>1;1<=f;f--)v(a,c,f);k=g;do f=a.heap[1],a.heap[1]=a.heap[a.heap_len--],v(a,c,1),d=a.heap[1],a.heap[--a.heap_max]=f,a.heap[--a.heap_max]=d,c[2*k]=c[2*f]+c[2*d],a.depth[k]=(a.depth[f]>=a.depth[d]?a.depth[f]:
a.depth[d])+1,c[2*f+1]=c[2*d+1]=k,a.heap[1]=k++,v(a,c,1);while(2<=a.heap_len);a.heap[--a.heap_max]=a.heap[1];f=b.dyn_tree;k=b.max_code;var d=b.stat_desc.static_tree,e=b.stat_desc.has_stree,g=b.stat_desc.extra_bits,l=b.stat_desc.extra_base,n=b.stat_desc.max_length,A,p,q,R,w=0;for(p=0;15>=p;p++)a.bl_count[p]=0;f[2*a.heap[a.heap_max]+1]=0;for(b=a.heap_max+1;573>b;b++)A=a.heap[b],p=f[2*f[2*A+1]+1]+1,p>n&&(p=n,w++),f[2*A+1]=p,A>k||(a.bl_count[p]++,q=0,A>=l&&(q=g[A-l]),R=f[2*A],a.opt_len+=R*(p+q),e&&(a.static_len+=
R*(d[2*A+1]+q)));if(0!==w){do{for(p=n-1;0===a.bl_count[p];)p--;a.bl_count[p]--;a.bl_count[p+1]+=2;a.bl_count[n]--;w-=2}while(0<w);for(p=n;0!==p;p--)for(A=a.bl_count[p];0!==A;)d=a.heap[--b],d>k||(f[2*d+1]!==p&&(a.opt_len+=(p-f[2*d+1])*f[2*d],f[2*d+1]=p),A--)}m(c,h,a.bl_count)}function D(a,b,c){var d,e=-1,g,f=b[1],h=0,k=7,l=4;0===f&&(k=138,l=3);b[2*(c+1)+1]=65535;for(d=0;d<=c;d++)g=f,f=b[2*(d+1)+1],++h<k&&g===f||(h<l?a.bl_tree[2*g]+=h:0!==g?(g!==e&&a.bl_tree[2*g]++,a.bl_tree[32]++):10>=h?a.bl_tree[34]++:
a.bl_tree[36]++,h=0,e=g,0===f?(k=138,l=3):g===f?(k=6,l=3):(k=7,l=4))}function q(a,b,c){var e,f=-1,h,k=b[1],l=0,n=7,m=4;0===k&&(n=138,m=3);for(e=0;e<=c;e++)if(h=k,k=b[2*(e+1)+1],!(++l<n&&h===k)){if(l<m){do g(a,h,a.bl_tree);while(0!==--l)}else 0!==h?(h!==f&&(g(a,h,a.bl_tree),l--),g(a,16,a.bl_tree),d(a,l-3,2)):10>=l?(g(a,17,a.bl_tree),d(a,l-3,3)):(g(a,18,a.bl_tree),d(a,l-11,7));l=0;f=h;0===k?(n=138,m=3):h===k?(n=6,m=3):(n=7,m=4)}}function B(a){var b=4093624447,c;for(c=0;31>=c;c++,b>>>=1)if(b&1&&0!==
a.dyn_ltree[2*c])return 0;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return 1;for(c=32;256>c;c++)if(0!==a.dyn_ltree[2*c])return 1;return 0}function t(a,c,e,g){d(a,0+(g?1:0),3);u(a);b(a,e);b(a,~e);E.arraySet(a.pending_buf,a.window,c,e,a.pending);a.pending+=e}var E=f(5),C=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],z=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],G=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],H=[16,17,18,0,8,7,9,6,10,5,11,4,12,
3,13,2,14,1,15],x=Array(576);e(x);var w=Array(60);e(w);var L=Array(512);e(L);var O=Array(256);e(O);var K=Array(29);e(K);var F=Array(30);e(F);var I,N,M,J=!1;h._tr_init=function(b){if(!J){var d,e,g,f=Array(16);for(g=e=0;28>g;g++)for(K[g]=e,d=0;d<1<<C[g];d++)O[e++]=g;O[e-1]=g;for(g=e=0;16>g;g++)for(F[g]=e,d=0;d<1<<z[g];d++)L[e++]=g;for(e>>=7;30>g;g++)for(F[g]=e<<7,d=0;d<1<<z[g]-7;d++)L[256+e++]=g;for(d=0;15>=d;d++)f[d]=0;for(d=0;143>=d;)x[2*d+1]=8,d++,f[8]++;for(;255>=d;)x[2*d+1]=9,d++,f[9]++;for(;279>=
d;)x[2*d+1]=7,d++,f[7]++;for(;287>=d;)x[2*d+1]=8,d++,f[8]++;m(x,287,f);for(d=0;30>d;d++)w[2*d+1]=5,w[2*d]=k(d,5);I=new c(x,C,257,286,15);N=new c(w,z,0,30,15);M=new c([],G,0,19,7);J=!0}b.l_desc=new a(b.dyn_ltree,I);b.d_desc=new a(b.dyn_dtree,N);b.bl_desc=new a(b.bl_tree,M);b.bi_buf=0;b.bi_valid=0;l(b)};h._tr_stored_block=t;h._tr_flush_block=function(a,b,c,e){var g,f,h=0;if(0<a.level){2===a.strm.data_type&&(a.strm.data_type=B(a));y(a,a.l_desc);y(a,a.d_desc);D(a,a.dyn_ltree,a.l_desc.max_code);D(a,a.dyn_dtree,
a.d_desc.max_code);y(a,a.bl_desc);for(h=18;3<=h&&0===a.bl_tree[2*H[h]+1];h--);a.opt_len+=3*(h+1)+14;g=a.opt_len+3+7>>>3;f=a.static_len+3+7>>>3;f<=g&&(g=f)}else g=f=c+5;if(c+4<=g&&-1!==b)t(a,b,c,e);else if(4===a.strategy||f===g)d(a,2+(e?1:0),3),r(a,x,w);else{d(a,4+(e?1:0),3);b=a.l_desc.max_code+1;c=a.d_desc.max_code+1;h+=1;d(a,b-257,5);d(a,c-1,5);d(a,h-4,4);for(g=0;g<h;g++)d(a,a.bl_tree[2*H[g]+1],3);q(a,a.dyn_ltree,b-1);q(a,a.dyn_dtree,c-1);r(a,a.dyn_ltree,a.dyn_dtree)}l(a);e&&u(a)};h._tr_tally=function(a,
b,c){a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255;a.pending_buf[a.d_buf+2*a.last_lit+1]=b&255;a.pending_buf[a.l_buf+a.last_lit]=c&255;a.last_lit++;0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(O[c]+256+1)]++,a.dyn_dtree[2*(256>b?L[b]:L[256+(b>>>7)])]++);return a.last_lit===a.lit_bufsize-1};h._tr_align=function(a){d(a,2,3);g(a,256,x);16===a.bi_valid?(b(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):8<=a.bi_valid&&(a.pending_buf[a.pending++]=a.bi_buf&255,a.bi_buf>>=8,a.bi_valid-=8)}},function(n,h,
f){function e(a,b){if(0===a.indexOf("data:")){var c=a.indexOf("base64,")+7;a=atob(a.substring(c));for(var c=new Uint8Array(a.length),e=a.length-1;0<=e;e--)c[e]=a.charCodeAt(e);b(c.buffer)}else{var f=new XMLHttpRequest;f.open("GET",a,!0);f.responseType="arraybuffer";f.onload=function(){b(f.response)};f.send(null)}}h=function(){function a(){this._src=null;this._parser=new c.JpegImage;this.onload=null}a.prototype={get src(){return this._src},set src(a){this.load(a)},get width(){return this._parser.width},
get height(){return this._parser.height},load:function(a){this._src=a;e(a,function(a){this.parse(new Uint8Array(a));if(this.onload)this.onload()}.bind(this))},parse:function(a){this._parser.parse(a)},getData:function(a,c){return this._parser.getData(a,c,!1)},copyToImageData:function(a){if(2===this._parser.numComponents||4<this._parser.numComponents)throw Error("Unsupported amount of components");var b=a.width,c=a.height,e=b*c*4;a=a.data;if(1===this._parser.numComponents)for(var f=this._parser.getData(b,
c,!1),c=b=0;b<e;){var h=f[c++];a[b++]=h;a[b++]=h;a[b++]=h;a[b++]=255}else for(f=this._parser.getData(b,c,!0),c=b=0;b<e;)a[b++]=f[c++],a[b++]=f[c++],a[b++]=f[c++],a[b++]=255}};return a}();var c;(function(a){function b(a){for(var b=1,c=0;a>b;)b<<=1,c++;return c}function c(a,b){return a[b]<<8|a[b+1]}function e(a,b){return(a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3])>>>0}function f(a,b,c){Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!1});return c}var h=function(){function a(){}function b(a,
b){for(var c=0,d=[],e,g,f=16;0<f&&!a[f-1];)f--;d.push({children:[],index:0});var h=d[0],k;for(e=0;e<f;e++){for(g=0;g<a[e];g++){h=d.pop();for(h.children[h.index]=b[c];0<h.index;)h=d.pop();h.index++;for(d.push(h);d.length<=e;)d.push(k={children:[],index:0}),h.children[h.index]=k.children,h=k;c++}e+1<f&&(d.push(k={children:[],index:0}),h.children[h.index]=k.children,h=k)}return d[0].children}function c(a,b,c,d,e,f,h,k,l){function n(){if(0<x)return x--,S>>x&1;S=a[b++];if(255===S){var c=a[b++];if(c)throw"unexpected marker: "+
(S<<8|c).toString(16);}x=7;return S>>>7}function m(a){for(;;){a=a[n()];if("number"===typeof a)return a;if("object"!==typeof a)throw"invalid huffman sequence";}}function p(a){for(var b=0;0<a;)b=b<<1|n(),a--;return b}function q(a){if(1===a)return 1===n()?1:-1;var b=p(a);return b>=1<<a-1?b:b+(-1<<a)+1}function A(a,b){var c=m(a.huffmanTableDC),c=0===c?0:q(c);a.blockData[b]=a.pred+=c;for(c=1;64>c;){var d=m(a.huffmanTableAC),e=d&15,d=d>>4;if(0===e){if(15>d)break;c+=16}else c+=d,a.blockData[b+g[c]]=q(e),
c++}}function w(a,b){var c=m(a.huffmanTableDC),c=0===c?0:q(c)<<l;a.blockData[b]=a.pred+=c}function r(a,b){a.blockData[b]|=n()<<l}function Q(a,b){if(0<v)v--;else for(var c=f;c<=h;){var d=m(a.huffmanTableAC),e=d&15,d=d>>4;if(0===e){if(15>d){v=p(d)+(1<<d)-1;break}c+=16}else c+=d,a.blockData[b+g[c]]=q(e)*(1<<l),c++}}function U(a,b){for(var c=f,d=0,e;c<=h;){e=g[c];switch(t){case 0:d=m(a.huffmanTableAC);e=d&15;d>>=4;if(0===e)15>d?(v=p(d)+(1<<d),t=4):(d=16,t=1);else{if(1!==e)throw"invalid ACn encoding";
u=q(e);t=d?2:3}continue;case 1:case 2:a.blockData[b+e]?a.blockData[b+e]+=n()<<l:(d--,0===d&&(t=2===t?3:0));break;case 3:a.blockData[b+e]?a.blockData[b+e]+=n()<<l:(a.blockData[b+e]=u<<l,t=0);break;case 4:a.blockData[b+e]&&(a.blockData[b+e]+=n()<<l)}c++}4===t&&(v--,0===v&&(t=0))}var z=c.mcusPerLine,P=b,S=0,x=0,v=0,t=0,u,y=d.length,G,B,D,F,C;k=c.progressive?0===f?0===k?w:r:0===k?Q:U:A;var E=0;c=1===y?d[0].blocksPerLine*d[0].blocksPerColumn:z*c.mcusPerColumn;e||(e=c);for(var H,K;E<c;){for(B=0;B<y;B++)d[B].pred=
0;v=0;if(1===y)for(G=d[0],C=0;C<e;C++)k(G,64*((G.blocksPerLine+1)*(E/G.blocksPerLine|0)+E%G.blocksPerLine)),E++;else for(C=0;C<e;C++){for(B=0;B<y;B++)for(G=d[B],H=G.h,K=G.v,D=0;D<K;D++)for(F=0;F<H;F++)k(G,64*((G.blocksPerLine+1)*((E/z|0)*G.v+D)+(E%z*G.h+F)));E++}x=0;G=a[b]<<8|a[b+1];if(65280>=G)throw"marker was not found";if(65488<=G&&65495>=G)b+=2;else break}return b-P}function d(a,b){a=b.blocksPerLine;for(var c=b.blocksPerColumn,d=new Int16Array(64),e=0;e<c;e++)for(var g=0;g<a;g++){for(var f,h,
k,l,n,m,p,A,q,r,Q,U,z=64*((b.blocksPerLine+1)*e+g),P=d,S=b.quantizationTable,v=b.blockData,t=0;64>t;t+=8)f=v[z+t],A=v[z+t+1],p=v[z+t+2],m=v[z+t+3],n=v[z+t+4],l=v[z+t+5],k=v[z+t+6],h=v[z+t+7],f*=S[t],0===(A|p|m|n|l|k|h)?(f=5793*f+512>>10,P[t]=f,P[t+1]=f,P[t+2]=f,P[t+3]=f,P[t+4]=f,P[t+5]=f,P[t+6]=f,P[t+7]=f):(A*=S[t+1],p*=S[t+2],m*=S[t+3],n*=S[t+4],l*=S[t+5],k*=S[t+6],h*=S[t+7],U=5793*f+128>>8,Q=5793*n+128>>8,r=p,q=k,n=2896*(A-h)+128>>8,h=2896*(A+h)+128>>8,m<<=4,l<<=4,U=U+Q+1>>1,Q=U-Q,f=3784*r+1567*
q+128>>8,r=1567*r-3784*q+128>>8,q=f,n=n+l+1>>1,l=n-l,h=h+m+1>>1,m=h-m,U=U+q+1>>1,q=U-q,Q=Q+r+1>>1,r=Q-r,f=2276*n+3406*h+2048>>12,n=3406*n-2276*h+2048>>12,h=f,f=799*m+4017*l+2048>>12,m=4017*m-799*l+2048>>12,l=f,P[t]=U+h,P[t+7]=U-h,P[t+1]=Q+l,P[t+6]=Q-l,P[t+2]=r+m,P[t+5]=r-m,P[t+3]=q+n,P[t+4]=q-n);for(S=0;8>S;++S)f=P[S],A=P[S+8],p=P[S+16],m=P[S+24],n=P[S+32],l=P[S+40],k=P[S+48],h=P[S+56],0===(A|p|m|n|l|k|h)?(f=5793*f+8192>>14,f=-2040>f?0:2024<=f?255:f+2056>>4,v[z+S]=f,v[z+S+8]=f,v[z+S+16]=f,v[z+S+24]=
f,v[z+S+32]=f,v[z+S+40]=f,v[z+S+48]=f,v[z+S+56]=f):(U=5793*f+2048>>12,Q=5793*n+2048>>12,r=p,q=k,n=2896*(A-h)+2048>>12,h=2896*(A+h)+2048>>12,U=(U+Q+1>>1)+4112,Q=U-Q,f=3784*r+1567*q+2048>>12,r=1567*r-3784*q+2048>>12,q=f,n=n+l+1>>1,l=n-l,h=h+m+1>>1,m=h-m,U=U+q+1>>1,q=U-q,Q=Q+r+1>>1,r=Q-r,f=2276*n+3406*h+2048>>12,n=3406*n-2276*h+2048>>12,h=f,f=799*m+4017*l+2048>>12,m=4017*m-799*l+2048>>12,l=f,f=U+h,h=U-h,A=Q+l,k=Q-l,p=r+m,l=r-m,m=q+n,n=q-n,f=16>f?0:4080<=f?255:f>>4,A=16>A?0:4080<=A?255:A>>4,p=16>p?0:
4080<=p?255:p>>4,m=16>m?0:4080<=m?255:m>>4,n=16>n?0:4080<=n?255:n>>4,l=16>l?0:4080<=l?255:l>>4,k=16>k?0:4080<=k?255:k>>4,h=16>h?0:4080<=h?255:h>>4,v[z+S]=f,v[z+S+8]=A,v[z+S+16]=p,v[z+S+24]=m,v[z+S+32]=n,v[z+S+40]=l,v[z+S+48]=k,v[z+S+56]=h)}return b.blockData}function e(a){return 0>=a?0:255<=a?255:a}var g=new Uint8Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,
63]);a.prototype={parse:function(a){function e(){var b=a[k]<<8|a[k+1];k+=2;return b}function f(){var b=e(),b=a.subarray(k,k+b-2);k+=b.length;return b}function h(a){for(var b=Math.ceil(a.samplesPerLine/8/a.maxH),c=Math.ceil(a.scanLines/8/a.maxV),d=0;d<a.components.length;d++){P=a.components[d];var e=Math.ceil(Math.ceil(a.samplesPerLine/8)*P.h/a.maxH),g=Math.ceil(Math.ceil(a.scanLines/8)*P.v/a.maxV);P.blockData=new Int16Array(64*c*P.v*(b*P.h+1));P.blocksPerLine=e;P.blocksPerColumn=g}a.mcusPerLine=b;
a.mcusPerColumn=c}var k=0,l=null,n=null,m,p,q=[],r=[],t=[],J=e();if(65496!==J)throw"SOI not found";for(J=e();65497!==J;){var A,v;switch(J){case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:A=f();65504===J&&74===A[0]&&70===A[1]&&73===A[2]&&70===A[3]&&0===A[4]&&(l={version:{major:A[5],minor:A[6]},densityUnits:A[7],xDensity:A[8]<<8|A[9],yDensity:A[10]<<8|A[11],thumbWidth:A[12],
thumbHeight:A[13],thumbData:A.subarray(14,14+3*A[12]*A[13])});65518===J&&65===A[0]&&100===A[1]&&111===A[2]&&98===A[3]&&101===A[4]&&0===A[5]&&(n={version:A[6],flags0:A[7]<<8|A[8],flags1:A[9]<<8|A[10],transformCode:A[11]});break;case 65499:for(var J=e()+k-2,z;k<J;){var Q=a[k++],U=new Uint16Array(64);if(0===Q>>4)for(A=0;64>A;A++)z=g[A],U[z]=a[k++];else if(1===Q>>4)for(A=0;64>A;A++)z=g[A],U[z]=e();else throw"DQT: invalid table spec";q[Q&15]=U}break;case 65472:case 65473:case 65474:if(m)throw"Only single frame JPEGs supported";
e();m={};m.extended=65473===J;m.progressive=65474===J;m.precision=a[k++];m.scanLines=e();m.samplesPerLine=e();m.components=[];m.componentIds={};A=a[k++];for(J=U=Q=0;J<A;J++){z=a[k];v=a[k+1]>>4;var u=a[k+1]&15;Q<v&&(Q=v);U<u&&(U=u);v=m.components.push({h:v,v:u,quantizationTable:q[a[k+2]]});m.componentIds[z]=v-1;k+=3}m.maxH=Q;m.maxV=U;h(m);break;case 65476:z=e();for(J=2;J<z;){Q=a[k++];U=new Uint8Array(16);for(A=v=0;16>A;A++,k++)v+=U[A]=a[k];u=new Uint8Array(v);for(A=0;A<v;A++,k++)u[A]=a[k];J+=17+v;
(0===Q>>4?t:r)[Q&15]=b(U,u)}break;case 65501:e();p=e();break;case 65498:e();z=a[k++];A=[];for(var P,J=0;J<z;J++)Q=m.componentIds[a[k++]],P=m.components[Q],Q=a[k++],P.huffmanTableDC=t[Q>>4],P.huffmanTableAC=r[Q&15],A.push(P);J=a[k++];z=a[k++];Q=a[k++];J=c(a,k,m,A,p,J,z,Q>>4,Q&15);k+=J;break;case 65535:255!==a[k]&&k--;break;default:if(255===a[k-3]&&192<=a[k-2]&&254>=a[k-2])k-=3;else throw"unknown JPEG marker "+J.toString(16);}J=e()}this.width=m.samplesPerLine;this.height=m.scanLines;this.jfif=l;this.adobe=
n;this.components=[];for(J=0;J<m.components.length;J++)P=m.components[J],this.components.push({output:d(m,P),scaleX:P.h/m.maxH,scaleY:P.v/m.maxV,blocksPerLine:P.blocksPerLine,blocksPerColumn:P.blocksPerColumn});this.numComponents=this.components.length},_getLinearizedBlockData:function(a,b){var c=this.width/a,d=this.height/b,e,g,f,h,k,l,m,n,p=this.components.length,A=a*b*p,q=new Uint8Array(A),r=new Uint32Array(a);for(l=0;l<p;l++){e=this.components[l];g=e.scaleX*c;f=e.scaleY*d;m=l;n=e.output;h=e.blocksPerLine+
1<<3;for(k=0;k<a;k++)e=0|k*g,r[k]=(e&4294967288)<<3|e&7;for(g=0;g<b;g++)for(e=0|g*f,e=h*(e&4294967288)|(e&7)<<3,k=0;k<a;k++)q[m]=n[e+r[k]],m+=p}if(b=this.decodeTransform)for(l=0;l<A;)for(a=e=0;e<p;e++,l++,a+=2)q[l]=(q[l]*b[a]>>8)+b[a+1];return q},_isColorConversionNeeded:function(){return this.adobe&&this.adobe.transformCode?!0:3===this.numComponents?!0:!1},_convertYccToRgb:function(a){for(var b,c,d,g=0,f=a.length;g<f;g+=3)b=a[g],c=a[g+1],d=a[g+2],a[g]=e(b-179.456+1.402*d),a[g+1]=e(b+135.459-.344*
c-.714*d),a[g+2]=e(b-226.816+1.772*c);return a},_convertYcckToRgb:function(a){for(var b,c,d,g,f=0,h=0,k=a.length;h<k;h+=4){b=a[h];c=a[h+1];d=a[h+2];g=a[h+3];var l=-122.67195406894+c*(-6.60635669420364E-5*c+4.37130475926232E-4*d-5.4080610064599E-5*b+4.8449797120281E-4*g-.154362151871126)+d*(-9.57964378445773E-4*d+8.17076911346625E-4*b-.00477271405408747*g+1.53380253221734)+b*(9.61250184130688E-4*b-.00266257332283933*g+.48357088451265)+g*(-3.36197177618394E-4*g+.484791561490776),m=107.268039397724+
c*(2.19927104525741E-5*c-6.40992018297945E-4*d+6.59397001245577E-4*b+4.26105652938837E-4*g-.176491792462875)+d*(-7.78269941513683E-4*d+.00130872261408275*b+7.70482631801132E-4*g-.151051492775562)+b*(.00126935368114843*b-.00265090189010898*g+.25802910206845)+g*(-3.18913117588328E-4*g-.213742400323665);b=-20.810012546947+c*(-5.70115196973677E-4*c-2.63409051004589E-5*d+.0020741088115012*b-.00288260236853442*g+.814272968359295)+d*(-1.53496057440975E-5*d-1.32689043961446E-4*b+5.60833691242812E-4*g-.195152027534049)+
b*(.00174418132927582*b-.00255243321439347*g+.116935020465145)+g*(-3.43531996510555E-4*g+.24165260232407);a[f++]=e(l);a[f++]=e(m);a[f++]=e(b)}return a},_convertYcckToCmyk:function(a){for(var b,c,d,g=0,f=a.length;g<f;g+=4)b=a[g],c=a[g+1],d=a[g+2],a[g]=e(434.456-b-1.402*d),a[g+1]=e(119.541-b+.344*c+.714*d),a[g+2]=e(481.816-b-1.772*c);return a},_convertCmykToRgb:function(a){for(var b,c,d,e,g=0,f=1/255/255,h=0,k=a.length;h<k;h+=4){b=a[h];c=a[h+1];d=a[h+2];e=a[h+3];var l=b*(-4.387332384609988*b+54.48615194189176*
c+18.82290502165302*d+212.25662451639585*e-72734.4411664936)+c*(1.7149763477362134*c-5.6096736904047315*d-17.873870861415444*e-1401.7366389350734)+d*(-2.5217340131683033*d-21.248923337353073*e+4465.541406466231)-e*(21.86122147463605*e+48317.86113160301),m=b*(8.841041422036149*b+60.118027045597366*c+6.871425592049007*d+31.159100130055922*e-20220.756542821975)+c*(-15.310361306967817*c+17.575251261109482*d+131.35250912493976*e-48691.05921601825)+d*(4.444339102852739*d+9.8632861493405*e-6341.191035517494)-
e*(20.737325471181034*e+47890.15695978492);b=b*(.8842522430003296*b+8.078677503112928*c+30.89978309703729*d-.23883238689178934*e-3616.812083916688)+c*(10.49593273432072*c+63.02378494754052*d+50.606957656360734*e-28620.90484698408)+d*(.03296041114873217*d+115.60384449646641*e-49363.43385999684)-e*(22.33816807309886*e+45932.16563550634);a[g++]=0<=l?255:-16581375>=l?0:255+l*f|0;a[g++]=0<=m?255:-16581375>=m?0:255+m*f|0;a[g++]=0<=b?255:-16581375>=b?0:255+b*f|0}return a},getData:function(a,b,c){if(4<this.numComponents)throw"Unsupported color mode";
a=this._getLinearizedBlockData(a,b);if(3===this.numComponents)return this._convertYccToRgb(a);if(4===this.numComponents){if(this._isColorConversionNeeded())return c?this._convertYcckToRgb(a):this._convertYcckToCmyk(a);if(c)return this._convertCmykToRgb(a)}return a}};return a}();"use strict";var l=function(){function a(a,b,c){this.data=a;this.bp=b;this.dataEnd=c;this.chigh=a[b];this.clow=0;this.byteIn();this.chigh=this.chigh<<7&65535|this.clow>>9&127;this.clow=this.clow<<7&65535;this.ct-=7;this.a=
32768}var b=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},
{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,
switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,
switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}];a.prototype={byteIn:function(){var a=this.data,b=this.bp;255===a[b]?143<a[b+1]?(this.clow+=65280,this.ct=8):(b++,this.clow+=a[b]<<9,this.ct=7,this.bp=b):(b++,this.clow+=b<this.dataEnd?a[b]<<
8:65280,this.ct=8,this.bp=b);65535<this.clow&&(this.chigh+=this.clow>>16,this.clow&=65535)},readBit:function(a,c){var d=a[c]>>1,e=a[c]&1,d=b[d],g=d.qe,f=this.a-g;if(this.chigh<g)f<g?(f=g,g=e,d=d.nmps):(f=g,g=1^e,1===d.switchFlag&&(e=g),d=d.nlps);else{this.chigh-=g;if(0!==(f&32768))return this.a=f,e;f<g?(g=1^e,1===d.switchFlag&&(e=g),d=d.nlps):(g=e,d=d.nmps)}do 0===this.ct&&this.byteIn(),f<<=1,this.chigh=this.chigh<<1&65535|this.clow>>15&1,this.clow=this.clow<<1&65535,this.ct--;while(0===(f&32768));
this.a=f;a[c]=d<<1|e;return g}};return a}();"use strict";var n=function(){function a(){this.failOnCorruptedImage=!1}function d(a,b,c){a=c.xcb_;c=c.ycb_;var d=1<<a,e=1<<c,g=b.tbx0>>a,f=b.tby0>>c,h=b.tbx1+d-1>>a,k=b.tby1+e-1>>c,l=b.resolution.precinctParameters,m=[],n=[],p,q,A,r;for(q=f;q<k;q++)for(p=g;p<h;p++)if(A={cbx:p,cby:q,tbx0:d*p,tby0:e*q,tbx1:d*(p+1),tby1:e*(q+1)},A.tbx0_=Math.max(b.tbx0,A.tbx0),A.tby0_=Math.max(b.tby0,A.tby0),A.tbx1_=Math.min(b.tbx1,A.tbx1),A.tby1_=Math.min(b.tby1,A.tby1),
r=Math.floor((A.tbx0_-b.tbx0)/l.precinctWidthInSubband)+Math.floor((A.tby0_-b.tby0)/l.precinctHeightInSubband)*l.numprecinctswide,A.precinctNumber=r,A.subbandType=b.type,A.Lblock=3,!(A.tbx1_<=A.tbx0_||A.tby1_<=A.tby0_)){m.push(A);var v=n[r];void 0!==v?(p<v.cbxMin?v.cbxMin=p:p>v.cbxMax&&(v.cbxMax=p),q<v.cbyMin?v.cbxMin=q:q>v.cbyMax&&(v.cbyMax=q)):n[r]=v={cbxMin:p,cbyMin:q,cbxMax:p,cbyMax:q};A.precinct=v}b.codeblockParameters={codeblockWidth:a,codeblockHeight:c,numcodeblockwide:h-g+1,numcodeblockhigh:k-
f+1};b.codeblocks=m;b.precincts=n}function g(a,b,c){var d=[];a=a.subbands;for(var e=0,g=a.length;e<g;e++)for(var f=a[e].codeblocks,h=0,k=f.length;h<k;h++){var l=f[h];l.precinctNumber===b&&d.push(l)}return{layerNumber:c,codeblocks:d}}function f(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e=0;for(a=0;a<d;a++)e=Math.max(e,b.components[a].codingStyleParameters.decompositionLevelsCount);var f=0,h=0,k=0,l=0;this.nextPacket=function(){for(;f<c;f++){for(;h<=
e;h++){for(;k<d;k++){var a=b.components[k];if(!(h>a.codingStyleParameters.decompositionLevelsCount)){for(var a=a.resolutions[h],m=a.precinctParameters.numprecincts;l<m;)return a=g(a,l,f),l++,a;l=0}}k=0}h=0}throw Error("JPX Error: Out of packets");}}function h(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e=0;for(a=0;a<d;a++)e=Math.max(e,b.components[a].codingStyleParameters.decompositionLevelsCount);var f=0,h=0,k=0,l=0;this.nextPacket=function(){for(;f<=
e;f++){for(;h<c;h++){for(;k<d;k++){var a=b.components[k];if(!(f>a.codingStyleParameters.decompositionLevelsCount)){for(var a=a.resolutions[f],m=a.precinctParameters.numprecincts;l<m;)return a=g(a,l,h),l++,a;l=0}}k=0}h=0}throw Error("JPX Error: Out of packets");}}function k(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e,f,h,k,l=0;for(h=0;h<d;h++)l=Math.max(l,b.components[h].codingStyleParameters.decompositionLevelsCount);var m=new Int32Array(l+1);
for(f=0;f<=l;++f){for(h=a=0;h<d;++h){var n=b.components[h].resolutions;f<n.length&&(a=Math.max(a,n[f].precinctParameters.numprecincts))}m[f]=a}k=h=f=e=0;this.nextPacket=function(){for(;f<=l;f++){for(;k<m[f];k++){for(;h<d;h++){var a=b.components[h];if(!(f>a.codingStyleParameters.decompositionLevelsCount||(a=a.resolutions[f],k>=a.precinctParameters.numprecincts))){for(;e<c;)return a=g(a,k,e),e++,a;e=0}}h=0}k=0}throw Error("JPX Error: Out of packets");}}function m(a){var b=a.tiles[a.currentTile.index],
c=b.codingStyleDefaultParameters.layersCount,d=a.SIZ.Csiz,e=v(b),f=0,h=0,k=0,l=0,m=0;this.nextPacket=function(){for(;m<e.maxNumHigh;m++){for(;l<e.maxNumWide;l++){for(;k<d;k++){for(var a=b.components[k],n=a.codingStyleParameters.decompositionLevelsCount;h<=n;h++){var q=a.resolutions[h],A=p(l,m,e.components[k].resolutions[h],e,q);if(null!==A){for(;f<c;)return a=g(q,A,f),f++,a;f=0}}h=0}k=0}l=0}throw Error("JPX Error: Out of packets");}}function n(a){var b=a.tiles[a.currentTile.index],c=b.codingStyleDefaultParameters.layersCount,
d=a.SIZ.Csiz,e=v(b),f=0,h=0,k=0,l=0,m=0;this.nextPacket=function(){for(;k<d;++k){for(var a=b.components[k],n=e.components[k],q=a.codingStyleParameters.decompositionLevelsCount;m<n.maxNumHigh;m++){for(;l<n.maxNumWide;l++){for(;h<=q;h++){var A=a.resolutions[h],r=p(l,m,n.resolutions[h],n,A);if(null!==r){for(;f<c;)return a=g(A,r,f),f++,a;f=0}}h=0}l=0}m=0}throw Error("JPX Error: Out of packets");}}function p(a,b,c,d,e){a*=d.minWidth;b*=d.minHeight;return 0!==a%c.width||0!==b%c.height?null:a/c.height+b/
c.width*e.precinctParameters.numprecinctswide}function v(a){for(var b=a.components.length,c=Number.MAX_VALUE,d=Number.MAX_VALUE,e=0,g=0,f=Array(b),h=0;h<b;h++){for(var k=a.components[h],l=k.codingStyleParameters.decompositionLevelsCount,m=Array(l+1),n=Number.MAX_VALUE,p=Number.MAX_VALUE,q=0,r=0,v=1;0<=l;--l){var t=k.resolutions[l],u=v*t.precinctParameters.precinctWidth,J=v*t.precinctParameters.precinctHeight,n=Math.min(n,u),p=Math.min(p,J),q=Math.max(q,t.precinctParameters.numprecinctswide),r=Math.max(r,
t.precinctParameters.numprecinctshigh);m[l]={width:u,height:J};v<<=1}c=Math.min(c,n);d=Math.min(d,p);e=Math.max(e,q);g=Math.max(g,r);f[h]={resolutions:m,minWidth:n,minHeight:p,maxNumWide:q,maxNumHigh:r}}return{components:f,minWidth:c,minHeight:d,maxNumWide:e,maxNumHigh:g}}function u(a,c,d,e){function g(a){for(;m<a;){var b=c[d+k];k++;n?(l=l<<7|b,m+=7,n=!1):(l=l<<8|b,m+=8);255===b&&(n=!0)}m-=a;return l>>>m&(1<<a)-1}function f(a){return 255===c[d+k-1]&&c[d+k]===a?(k+=1,!0):255===c[d+k]&&c[d+k+1]===a?
(k+=2,!0):!1}function h(){if(0===g(1))return 1;if(0===g(1))return 2;var a=g(2);if(3>a)return a+3;a=g(5);if(31>a)return a+6;a=g(7);return a+37}var k=0,l,m=0,n=!1,p=a.COD.sopMarkerUsed,q=a.COD.ephMarkerUsed;for(a=a.tiles[a.currentTile.index].packetsIterator;k<e;){m=0;n&&(k++,n=!1);p&&f(145)&&(k+=4);var A=a.nextPacket();if(g(1)){for(var r=A.layerNumber,v=[],t,u=0,y=A.codeblocks.length;u<y;u++){t=A.codeblocks[u];var J=t.precinct,x=t.cbx-J.cbxMin,w=t.cby-J.cbyMin,R=!1,z=!1,V;if(void 0!==t.included)R=!!g(1);
else{var J=t.precinct,D,B;void 0!==J.inclusionTree?D=J.inclusionTree:(V=J.cbxMax-J.cbxMin+1,B=J.cbyMax-J.cbyMin+1,D=new K(V,B,r),B=new O(V,B),J.inclusionTree=D,J.zeroBitPlanesTree=B);if(D.reset(x,w,r))for(;;)if(g(1)){if(V=!D.nextLevel()){R=z=t.included=!0;break}}else{D.incrementValue(r);break}}if(R){if(z){B=J.zeroBitPlanesTree;for(B.reset(x,w);;)if(g(1)){if(V=!B.nextLevel())break}else B.incrementValue();t.zeroBitPlanes=B.value}for(J=h();g(1);)t.Lblock++;x=b(J);x=g((J<1<<x?x-1:x)+t.Lblock);v.push({codeblock:t,
codingpasses:J,dataLength:x})}}m=0;n&&(k++,n=!1);for(q&&f(146);0<v.length;)A=v.shift(),t=A.codeblock,void 0===t.data&&(t.data=[]),t.data.push({data:c,start:d+k,end:d+k+A.dataLength,codingpasses:A.codingpasses}),k+=A.dataLength}}return k}var L={LL:0,LH:1,HL:1,HH:2};a.prototype={parse:function(a){if(65359===c(a,0))this.parseCodestream(a,0,a.length);else for(var b=0,d=a.length;b<d;){var g=8,f=e(a,b),h=e(a,b+4),b=b+g;1===f&&(f=4294967296*e(a,b)+e(a,b+4),b+=8,g+=8);0===f&&(f=d-b+g);if(f<g)throw Error("JPX Error: Invalid box field size");
g=f-g;f=!0;switch(h){case 1785737832:f=!1;break;case 1668246642:h=a[b];if(1===h)switch(h=e(a,b+3),h){case 16:case 17:case 18:break;default:r("Unknown colorspace "+h)}else 2===h&&y("ICC profile not supported");break;case 1785737827:this.parseCodestream(a,b,b+g);break;case 1783636E3:218793738!==e(a,b)&&r("Invalid JP2 signature");break;case 1783634458:case 1718909296:case 1920099697:case 1919251232:case 1768449138:break;default:var k=String.fromCharCode(h>>24&255,h>>16&255,h>>8&255,h&255);r("Unsupported header type "+
h+" ("+k+")")}f&&(b+=g)}},parseImageProperties:function(a){for(var b=a.getByte();0<=b;){var c=b,b=a.getByte();if(65361===(c<<8|b)){a.skip(4);var b=a.getInt32()>>>0,c=a.getInt32()>>>0,d=a.getInt32()>>>0,e=a.getInt32()>>>0;a.skip(16);a=a.getUint16();this.width=b-d;this.height=c-e;this.componentsCount=a;this.bitsPerComponent=8;return}}throw Error("JPX Error: No size marker found in JPX stream");},parseCodestream:function(a,b,g){var p={};try{for(var q=!1,A=b;A+1<g;){var v=c(a,A),A=A+2,t=0,y,x,w,R,B,z;
switch(v){case 65359:p.mainHeader=!0;break;case 65497:break;case 65361:var t=c(a,A),D={};D.Xsiz=e(a,A+4);D.Ysiz=e(a,A+8);D.XOsiz=e(a,A+12);D.YOsiz=e(a,A+16);D.XTsiz=e(a,A+20);D.YTsiz=e(a,A+24);D.XTOsiz=e(a,A+28);D.YTOsiz=e(a,A+32);var C=c(a,A+36);D.Csiz=C;var J=[];y=A+38;for(var E=0;E<C;E++){var G={precision:(a[y]&127)+1,isSigned:!!(a[y]&128),XRsiz:a[y+1],YRsiz:a[y+1]},H=G,I=D;H.x0=Math.ceil(I.XOsiz/H.XRsiz);H.x1=Math.ceil(I.Xsiz/H.XRsiz);H.y0=Math.ceil(I.YOsiz/H.YRsiz);H.y1=Math.ceil(I.Ysiz/H.YRsiz);
H.width=H.x1-H.x0;H.height=H.y1-H.y0;J.push(G)}p.SIZ=D;p.components=J;for(var K=void 0,O=p,ic=J,aa=O.SIZ,Ta=[],jc=Math.ceil((aa.Xsiz-aa.XTOsiz)/aa.XTsiz),kc=Math.ceil((aa.Ysiz-aa.YTOsiz)/aa.YTsiz),Ua=0;Ua<kc;Ua++)for(var Va=0;Va<jc;Va++)K={},K.tx0=Math.max(aa.XTOsiz+Va*aa.XTsiz,aa.XOsiz),K.ty0=Math.max(aa.YTOsiz+Ua*aa.YTsiz,aa.YOsiz),K.tx1=Math.min(aa.XTOsiz+(Va+1)*aa.XTsiz,aa.Xsiz),K.ty1=Math.min(aa.YTOsiz+(Ua+1)*aa.YTsiz,aa.Ysiz),K.width=K.tx1-K.tx0,K.height=K.ty1-K.ty0,K.components=[],Ta.push(K);
O.tiles=Ta;for(var Wa=0,lc=aa.Csiz;Wa<lc;Wa++)for(var Xa=ic[Wa],kb=0,mc=Ta.length;kb<mc;kb++){var ha={},K=Ta[kb];ha.tcx0=Math.ceil(K.tx0/Xa.XRsiz);ha.tcy0=Math.ceil(K.ty0/Xa.YRsiz);ha.tcx1=Math.ceil(K.tx1/Xa.XRsiz);ha.tcy1=Math.ceil(K.ty1/Xa.YRsiz);ha.width=ha.tcx1-ha.tcx0;ha.height=ha.tcy1-ha.tcy0;K.components[Wa]=ha}p.QCC=[];p.COC=[];break;case 65372:var t=c(a,A),Fa={};y=A+2;x=a[y++];switch(x&31){case 0:R=8;B=!0;break;case 1:R=16;B=!1;break;case 2:R=16;B=!0;break;default:throw Error("JPX Error: Invalid SQcd value "+
x);}Fa.noQuantization=8===R;Fa.scalarExpounded=B;Fa.guardBits=x>>5;for(w=[];y<t+A;){var ia={};8===R?(ia.epsilon=a[y++]>>3,ia.mu=0):(ia.epsilon=a[y]>>3,ia.mu=(a[y]&7)<<8|a[y+1],y+=2);w.push(ia)}Fa.SPqcds=w;p.mainHeader?p.QCD=Fa:(p.currentTile.QCD=Fa,p.currentTile.QCC=[]);break;case 65373:var t=c(a,A),Ga={};y=A+2;var Ya;257>p.SIZ.Csiz?Ya=a[y++]:(Ya=c(a,y),y+=2);x=a[y++];switch(x&31){case 0:R=8;B=!0;break;case 1:R=16;B=!1;break;case 2:R=16;B=!0;break;default:throw Error("JPX Error: Invalid SQcd value "+
x);}Ga.noQuantization=8===R;Ga.scalarExpounded=B;Ga.guardBits=x>>5;for(w=[];y<t+A;)ia={},8===R?(ia.epsilon=a[y++]>>3,ia.mu=0):(ia.epsilon=a[y]>>3,ia.mu=(a[y]&7)<<8|a[y+1],y+=2),w.push(ia);Ga.SPqcds=w;p.mainHeader?p.QCC[Ya]=Ga:p.currentTile.QCC[Ya]=Ga;break;case 65362:var t=c(a,A),W={};y=A+2;var lb=a[y++];W.entropyCoderWithCustomPrecincts=!!(lb&1);W.sopMarkerUsed=!!(lb&2);W.ephMarkerUsed=!!(lb&4);W.progressionOrder=a[y++];W.layersCount=c(a,y);y+=2;W.multipleComponentTransform=a[y++];W.decompositionLevelsCount=
a[y++];W.xcb=(a[y++]&15)+2;W.ycb=(a[y++]&15)+2;var Ha=a[y++];W.selectiveArithmeticCodingBypass=!!(Ha&1);W.resetContextProbabilities=!!(Ha&2);W.terminationOnEachCodingPass=!!(Ha&4);W.verticalyStripe=!!(Ha&8);W.predictableTermination=!!(Ha&16);W.segmentationSymbolUsed=!!(Ha&32);W.reversibleTransformation=a[y++];if(W.entropyCoderWithCustomPrecincts){for(var Ib=[];y<t+A;){var Jb=a[y++];Ib.push({PPx:Jb&15,PPy:Jb>>4})}W.precinctsSizes=Ib}var xa=[];W.selectiveArithmeticCodingBypass&&xa.push("selectiveArithmeticCodingBypass");
W.resetContextProbabilities&&xa.push("resetContextProbabilities");W.terminationOnEachCodingPass&&xa.push("terminationOnEachCodingPass");W.verticalyStripe&&xa.push("verticalyStripe");W.predictableTermination&&xa.push("predictableTermination");if(0<xa.length)throw q=!0,Error("JPX Error: Unsupported COD options ("+xa.join(", ")+")");p.mainHeader?p.COD=W:(p.currentTile.COD=W,p.currentTile.COC=[]);break;case 65424:t=c(a,A);z={};z.index=c(a,A+2);z.length=e(a,A+4);z.dataEnd=z.length+A-2;z.partIndex=a[A+
8];z.partsCount=a[A+9];p.mainHeader=!1;0===z.partIndex&&(z.COD=p.COD,z.COC=p.COC.slice(0),z.QCD=p.QCD,z.QCC=p.QCC.slice(0));p.currentTile=z;break;case 65427:z=p.currentTile;if(0===z.partIndex){for(var na=p,nc=na.SIZ.Csiz,Kb=na.tiles[z.index],ya=0;ya<nc;ya++){var Lb=Kb.components[ya];Lb.quantizationParameters=void 0!==na.currentTile.QCC[ya]?na.currentTile.QCC[ya]:na.currentTile.QCD;Lb.codingStyleParameters=void 0!==na.currentTile.COC[ya]?na.currentTile.COC[ya]:na.currentTile.COD}Kb.codingStyleDefaultParameters=
na.currentTile.COD;for(var ea=p,za=ea.tiles[ea.currentTile.index],oc=ea.SIZ.Csiz,mb=0;mb<oc;mb++){for(var X=za.components[mb],nb=X.codingStyleParameters.decompositionLevelsCount,Mb=[],Pa=[],Aa=0;Aa<=nb;Aa++){var oa,Za=Aa,Ba=X.codingStyleParameters,ja={};Ba.entropyCoderWithCustomPrecincts?(ja.PPx=Ba.precinctsSizes[Za].PPx,ja.PPy=Ba.precinctsSizes[Za].PPy):(ja.PPx=15,ja.PPy=15);ja.xcb_=0<Za?Math.min(Ba.xcb,ja.PPx-1):Math.min(Ba.xcb,ja.PPx);ja.ycb_=0<Za?Math.min(Ba.ycb,ja.PPy-1):Math.min(Ba.ycb,ja.PPy);
oa=ja;var Y={},ra=1<<nb-Aa;Y.trx0=Math.ceil(X.tcx0/ra);Y.try0=Math.ceil(X.tcy0/ra);Y.trx1=Math.ceil(X.tcx1/ra);Y.try1=Math.ceil(X.tcy1/ra);Y.resLevel=Aa;var ob=1<<oa.PPx,pb=1<<oa.PPy,Nb=0===Y.resLevel,Ob=Y.trx1>Y.trx0?Math.ceil(Y.trx1/ob)-Math.floor(Y.trx0/ob):0,Pb=Y.try1>Y.try0?Math.ceil(Y.try1/pb)-Math.floor(Y.try0/pb):0;Y.precinctParameters={precinctWidth:ob,precinctHeight:pb,numprecinctswide:Ob,numprecinctshigh:Pb,numprecincts:Ob*Pb,precinctWidthInSubband:1<<oa.PPx+(Nb?0:-1),precinctHeightInSubband:1<<
oa.PPy+(Nb?0:-1)};Mb.push(Y);var T;if(0===Aa)T={type:"LL"},T.tbx0=Math.ceil(X.tcx0/ra),T.tby0=Math.ceil(X.tcy0/ra),T.tbx1=Math.ceil(X.tcx1/ra),T.tby1=Math.ceil(X.tcy1/ra),T.resolution=Y,d(ea,T,oa),Pa.push(T),Y.subbands=[T];else{var fa=1<<nb-Aa+1,$a=[];T={type:"HL"};T.tbx0=Math.ceil(X.tcx0/fa-.5);T.tby0=Math.ceil(X.tcy0/fa);T.tbx1=Math.ceil(X.tcx1/fa-.5);T.tby1=Math.ceil(X.tcy1/fa);T.resolution=Y;d(ea,T,oa);Pa.push(T);$a.push(T);T={type:"LH"};T.tbx0=Math.ceil(X.tcx0/fa);T.tby0=Math.ceil(X.tcy0/fa-
.5);T.tbx1=Math.ceil(X.tcx1/fa);T.tby1=Math.ceil(X.tcy1/fa-.5);T.resolution=Y;d(ea,T,oa);Pa.push(T);$a.push(T);T={type:"HH"};T.tbx0=Math.ceil(X.tcx0/fa-.5);T.tby0=Math.ceil(X.tcy0/fa-.5);T.tbx1=Math.ceil(X.tcx1/fa-.5);T.tby1=Math.ceil(X.tcy1/fa-.5);T.resolution=Y;d(ea,T,oa);Pa.push(T);$a.push(T);Y.subbands=$a}}X.resolutions=Mb;X.subbands=Pa}var Qb=za.codingStyleDefaultParameters.progressionOrder;switch(Qb){case 0:za.packetsIterator=new f(ea);break;case 1:za.packetsIterator=new h(ea);break;case 2:za.packetsIterator=
new k(ea);break;case 3:za.packetsIterator=new m(ea);break;case 4:za.packetsIterator=new n(ea);break;default:throw Error("JPX Error: Unsupported progression order "+Qb);}}t=z.dataEnd-A;u(p,a,A,t);break;case 65365:case 65367:case 65368:case 65380:t=c(a,A);break;case 65363:throw Error("JPX Error: Codestream code 0xFF53 (COC) is not implemented");default:throw Error("JPX Error: Unknown codestream code: "+v.toString(16));}A+=t}}catch(Rb){if(q||this.failOnCorruptedImage)throw Rb;r("Trying to recover from "+
Rb.message)}for(var Sb=p.components,Ia=p.SIZ.Csiz,Tb=[],qb=0,pc=p.tiles.length;qb<pc;qb++){var rb=p.tiles[qb],Ca=[],ga;for(ga=0;ga<Ia;ga++){for(var qc=Ca,rc=ga,Da=rb.components[ga],sb=Da.codingStyleParameters,tb=Da.quantizationParameters,sc=sb.decompositionLevelsCount,ab=tb.SPqcds,tc=tb.scalarExpounded,uc=tb.guardBits,vc=sb.segmentationSymbolUsed,wc=p.components[ga].precision,ub=sb.reversibleTransformation,xc=ub?new M:new N,Ub=[],vb=0,Qa=0;Qa<=sc;Qa++){for(var Ja=Da.resolutions[Qa],wb=Ja.trx1-Ja.trx0,
Vb=Ja.try1-Ja.try0,Wb=new Float32Array(wb*Vb),xb=0,yc=Ja.subbands.length;xb<yc;xb++){var yb,bb;tc?(yb=ab[vb].mu,bb=ab[vb].epsilon,vb++):(yb=ab[0].mu,bb=ab[0].epsilon+(0<Qa?1-Qa:0));for(var Xb=Ja.subbands[xb],zc=L[Xb.type],Ac=Wb,Yb=wb,sa=Xb,Bc=ub?1:Math.pow(2,wc+zc-bb)*(1+yb/2048),zb=uc+bb-1,Zb=ub,Cc=vc,Dc=sa.tbx0,Ec=sa.tby0,cb=sa.tbx1-sa.tbx0,$b=sa.codeblocks,Fc="H"===sa.type.charAt(0)?1:0,Gc="H"===sa.type.charAt(1)?Yb:0,Ab=0,Hc=$b.length;Ab<Hc;++Ab){var la=$b[Ab],db=la.tbx1_-la.tbx0_,Bb=la.tby1_-
la.tby0_;if(0!==db&&0!==Bb&&void 0!==la.data){var pa,eb;pa=new F(db,Bb,la.subbandType,la.zeroBitPlanes,zb);eb=2;var fb=la.data,Cb=0,ac=0,ba,gb,ta;ba=0;for(gb=fb.length;ba<gb;ba++)ta=fb[ba],Cb+=ta.end-ta.start,ac+=ta.codingpasses;var bc=new Uint8Array(Cb),Ea=0;ba=0;for(gb=fb.length;ba<gb;ba++){ta=fb[ba];var cc=ta.data.subarray(ta.start,ta.end);bc.set(cc,Ea);Ea+=cc.length}var Ic=new l(bc,0,Cb);pa.setDecoder(Ic);for(ba=0;ba<ac;ba++){switch(eb){case 0:pa.runSignificancePropogationPass();break;case 1:pa.runMagnitudeRefinementPass();
break;case 2:pa.runCleanupPass(),Cc&&pa.checkSegmentationSymbol()}eb=(eb+1)%3}var Ra=la.tbx0_-Dc+(la.tby0_-Ec)*cb,Jc=pa.coefficentsSign,Kc=pa.coefficentsMagnitude,Lc=pa.bitsDecoded,Mc=Zb?0:.5,Db,ua,Eb,Ea=0,Nc="LL"!==sa.type;for(ba=0;ba<Bb;ba++){var Oc=2*(Ra/cb|0)*(Yb-cb)+Fc+Gc;for(Db=0;Db<db;Db++)ua=Kc[Ea],0!==ua&&(ua=(ua+Mc)*Bc,0!==Jc[Ea]&&(ua=-ua),Eb=Lc[Ea],Ac[Nc?Oc+(Ra<<1):Ra]=Zb&&Eb>=zb?ua:ua*(1<<zb-Eb)),Ra++,Ea++;Ra+=cb-db}}}}Ub.push({width:wb,height:Vb,items:Wb})}var Fb=xc.calculate(Ub,Da.tcx0,
Da.tcy0);qc[rc]={left:Da.tcx0,top:Da.tcy0,width:Fb.width,height:Fb.height,items:Fb.items}}var Sa=Ca[0],qa=new Uint8Array(Sa.items.length*Ia),Pc={left:Sa.left,top:Sa.top,width:Sa.width,height:Sa.height,items:qa},ca,Ka,ka,hb,Gb,da=0,Z,La,Ma,Na,Oa,va,ma,wa,ib,jb;if(rb.codingStyleDefaultParameters.multipleComponentTransform){var dc=4===Ia,Hb=Ca[0].items,ec=Ca[1].items,fc=Ca[2].items,Qc=dc?Ca[3].items:null;ca=Sb[0].precision-8;Ka=(128<<ca)+.5;ka=255*(1<<ca);Gb=.5*ka;hb=-Gb;var Rc=rb.components[0],gc=Ia-
3;La=Hb.length;if(Rc.codingStyleParameters.reversibleTransformation)for(Z=0;Z<La;Z++,da+=gc)Ma=Hb[Z]+Ka,Na=ec[Z],Oa=fc[Z],ma=Ma-(Oa+Na>>2),va=ma+Oa,wa=ma+Na,qa[da++]=0>=va?0:va>=ka?255:va>>ca,qa[da++]=0>=ma?0:ma>=ka?255:ma>>ca,qa[da++]=0>=wa?0:wa>=ka?255:wa>>ca;else for(Z=0;Z<La;Z++,da+=gc)Ma=Hb[Z]+Ka,Na=ec[Z],Oa=fc[Z],va=Ma+1.402*Oa,ma=Ma-.34413*Na-.71414*Oa,wa=Ma+1.772*Na,qa[da++]=0>=va?0:va>=ka?255:va>>ca,qa[da++]=0>=ma?0:ma>=ka?255:ma>>ca,qa[da++]=0>=wa?0:wa>=ka?255:wa>>ca;if(dc)for(Z=0,da=3;Z<
La;Z++,da+=4)ib=Qc[Z],qa[da]=ib<=hb?0:ib>=Gb?255:ib+Ka>>ca}else for(ga=0;ga<Ia;ga++){var hc=Ca[ga].items;ca=Sb[ga].precision-8;Ka=(128<<ca)+.5;ka=127.5*(1<<ca);hb=-ka;da=ga;Z=0;for(La=hc.length;Z<La;Z++)jb=hc[Z],qa[da]=jb<=hb?0:jb>=ka?255:jb+Ka>>ca,da+=Ia}Tb.push(Pc)}this.tiles=Tb;this.width=p.SIZ.Xsiz-p.SIZ.XOsiz;this.height=p.SIZ.Ysiz-p.SIZ.YOsiz;this.componentsCount=p.SIZ.Csiz}};var O=function(){function a(a,c){var d=b(Math.max(a,c))+1;this.levels=[];for(var e=0;e<d;e++)this.levels.push({width:a,
height:c,items:[]}),a=Math.ceil(a/2),c=Math.ceil(c/2)}a.prototype={reset:function(a,b){for(var c=0,d=0,e;c<this.levels.length;){e=this.levels[c];var g=a+b*e.width;if(void 0!==e.items[g]){d=e.items[g];break}e.index=g;a>>=1;b>>=1;c++}c--;e=this.levels[c];e.items[e.index]=d;this.currentLevel=c;delete this.value},incrementValue:function(){var a=this.levels[this.currentLevel];a.items[a.index]++},nextLevel:function(){var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];a--;if(0>a)return this.value=
c,!1;this.currentLevel=a;b=this.levels[a];b.items[b.index]=c;return!0}};return a}(),K=function(){function a(a,c,d){var e=b(Math.max(a,c))+1;this.levels=[];for(var g=0;g<e;g++){for(var f=new Uint8Array(a*c),h=0,k=f.length;h<k;h++)f[h]=d;this.levels.push({width:a,height:c,items:f});a=Math.ceil(a/2);c=Math.ceil(c/2)}}a.prototype={reset:function(a,b,c){for(var d=0;d<this.levels.length;){var e=this.levels[d],g=a+b*e.width;e.index=g;e=e.items[g];if(255===e)break;if(e>c)return this.currentLevel=d,this.propagateValues(),
!1;a>>=1;b>>=1;d++}this.currentLevel=d-1;return!0},incrementValue:function(a){var b=this.levels[this.currentLevel];b.items[b.index]=a+1;this.propagateValues()},propagateValues:function(){for(var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];0<=--a;)b=this.levels[a],b.items[b.index]=c},nextLevel:function(){var a=this.currentLevel,b=this.levels[a],c=b.items[b.index];b.items[b.index]=255;a--;if(0>a)return!1;this.currentLevel=a;b=this.levels[a];b.items[b.index]=c;return!0}};return a}(),F=function(){function a(a,
e,g,f,h){this.width=a;this.height=e;this.contextLabelTable="HH"===g?d:"HL"===g?c:b;a*=e;this.neighborsSignificance=new Uint8Array(a);this.coefficentsSign=new Uint8Array(a);this.coefficentsMagnitude=14<h?new Uint32Array(a):6<h?new Uint16Array(a):new Uint8Array(a);this.processingFlags=new Uint8Array(a);h=new Uint8Array(a);if(0!==f)for(e=0;e<a;e++)h[e]=f;this.bitsDecoded=h;this.reset()}var b=new Uint8Array([0,5,8,0,3,7,8,0,4,7,8,0,0,0,0,0,1,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,
0,2,6,8,0,3,7,8,0,4,7,8,0,0,0,0,0,2,6,8,0,3,7,8,0,4,7,8]),c=new Uint8Array([0,3,4,0,5,7,7,0,8,8,8,0,0,0,0,0,1,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8,0,0,0,0,0,2,3,4,0,6,7,7,0,8,8,8]),d=new Uint8Array([0,1,2,0,1,2,2,0,2,2,2,0,0,0,0,0,3,4,5,0,4,5,5,0,5,5,5,0,0,0,0,0,6,7,7,0,7,7,7,0,7,7,7,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8,0,0,0,0,0,8,8,8,0,8,8,8,0,8,8,8]);a.prototype={setDecoder:function(a){this.decoder=a},reset:function(){this.contexts=new Int8Array(19);this.contexts[0]=
8;this.contexts[17]=92;this.contexts[18]=6},setNeighborsSignificance:function(a,b,c){var d=this.neighborsSignificance,e=this.width,g=this.height,f=0<b;b=b+1<e;var h;0<a&&(h=c-e,f&&(d[h-1]+=16),b&&(d[h+1]+=16),d[h]+=4);a+1<g&&(h=c+e,f&&(d[h-1]+=16),b&&(d[h+1]+=16),d[h]+=4);f&&(d[c-1]+=1);b&&(d[c+1]+=1);d[c]|=128},runSignificancePropogationPass:function(){for(var a=this.decoder,b=this.width,c=this.height,d=this.coefficentsMagnitude,e=this.coefficentsSign,g=this.neighborsSignificance,f=this.processingFlags,
h=this.contexts,k=this.contextLabelTable,l=this.bitsDecoded,m=0;m<c;m+=4)for(var n=0;n<b;n++)for(var p=m*b+n,q=0;4>q;q++,p+=b){var r=m+q;if(r>=c)break;f[p]&=-2;if(!d[p]&&g[p]){if(a.readBit(h,k[g[p]])){var A=this.decodeSignBit(r,n,p);e[p]=A;d[p]=1;this.setNeighborsSignificance(r,n,p);f[p]|=2}l[p]++;f[p]|=1}}},decodeSignBit:function(a,b,c){var d=this.width,e=this.height,g=this.coefficentsMagnitude,f=this.coefficentsSign,h;h=0<b&&0!==g[c-1];b+1<d&&0!==g[c+1]?(b=f[c+1],h?(h=f[c-1],b=1-b-h):b=1-b-b):h?
(h=f[c-1],b=1-h-h):b=0;var k=3*b;h=0<a&&0!==g[c-d];a+1<e&&0!==g[c+d]?(b=f[c+d],h?(h=f[c-d],b=1-b-h+k):b=1-b-b+k):h?(h=f[c-d],b=1-h-h+k):b=k;return 0<=b?this.decoder.readBit(this.contexts,9+b):this.decoder.readBit(this.contexts,9-b)^1},runMagnitudeRefinementPass:function(){for(var a=this.decoder,b=this.width,c=this.coefficentsMagnitude,d=this.neighborsSignificance,e=this.contexts,g=this.bitsDecoded,f=this.processingFlags,h=b*this.height,k=4*b,l=0,m;l<h;l=m){m=Math.min(h,l+k);for(var n=0;n<b;n++)for(var p=
l+n;p<m;p+=b)if(c[p]&&0===(f[p]&1)){var q=16;0!==(f[p]&2)&&(f[p]^=2,q=0===(d[p]&127)?15:14);q=a.readBit(e,q);c[p]=c[p]<<1|q;g[p]++;f[p]|=1}}},runCleanupPass:function(){for(var a=this.decoder,b=this.width,c=this.height,d=this.neighborsSignificance,e=this.coefficentsMagnitude,g=this.coefficentsSign,f=this.contexts,h=this.contextLabelTable,k=this.bitsDecoded,l=this.processingFlags,m=2*b,n=3*b,p,q=0;q<c;q=p){p=Math.min(q+4,c);for(var r=q*b,A=q+3<c,v=0;v<b;v++){var t=r+v,y=0,u=t,x=q,w;if(A&&0===l[t]&&
0===l[t+b]&&0===l[t+m]&&0===l[t+n]&&0===d[t]&&0===d[t+b]&&0===d[t+m]&&0===d[t+n]){if(!a.readBit(f,18)){k[t]++;k[t+b]++;k[t+m]++;k[t+n]++;continue}y=a.readBit(f,17)<<1|a.readBit(f,17);0!==y&&(x=q+y,u+=y*b);w=this.decodeSignBit(x,v,u);g[u]=w;e[u]=1;this.setNeighborsSignificance(x,v,u);l[u]|=2;u=t;for(t=q;t<=x;t++,u+=b)k[u]++;y++}for(x=q+y;x<p;x++,u+=b)e[u]||0!==(l[u]&1)||(1===a.readBit(f,h[d[u]])&&(w=this.decodeSignBit(x,v,u),g[u]=w,e[u]=1,this.setNeighborsSignificance(x,v,u),l[u]|=2),k[u]++)}}},checkSegmentationSymbol:function(){var a=
this.decoder,b=this.contexts;if(10!==(a.readBit(b,17)<<3|a.readBit(b,17)<<2|a.readBit(b,17)<<1|a.readBit(b,17)))throw Error("JPX Error: Invalid segmentation symbol");}};return a}(),I=function(){function a(){}a.prototype.calculate=function(a,b,c){for(var d=a[0],e=1,g=a.length;e<g;e++)d=this.iterate(d,a[e],b,c);return d};a.prototype.extend=function(a,b,c){var d=b-1,e=b+1,g=b+c-2;b+=c;a[d--]=a[e++];a[b++]=a[g--];a[d--]=a[e++];a[b++]=a[g--];a[d--]=a[e++];a[b++]=a[g--];a[d]=a[e];a[b]=a[g]};a.prototype.iterate=
function(a,b,c,d){var e=a.width,g=a.height,f=a.items,h=b.width,k=b.height;b=b.items;var l,m,n,p;for(l=n=0;l<g;l++)for(p=2*l*h,m=0;m<e;m++,n++,p+=2)b[p]=f[n];a.items=null;a=new Float32Array(h+8);if(1===h){if(0!==(c&1))for(n=p=0;p<k;p++,n+=h)b[n]*=.5}else for(n=p=0;p<k;p++,n+=h)a.set(b.subarray(n,n+h),4),this.extend(a,4,h),this.filter(a,4,h),b.set(a.subarray(4,4+h),n);c=16;e=[];for(l=0;l<c;l++)e.push(new Float32Array(k+8));l=0;a=4+k;if(1===k){if(0!==(d&1))for(d=0;d<h;d++)b[d]*=.5}else for(d=0;d<h;d++){if(0===
l){c=Math.min(h-d,c);n=d;for(p=4;p<a;n+=h,p++)for(g=0;g<c;g++)e[g][p]=b[n+g];l=c}l--;n=e[l];this.extend(n,4,k);this.filter(n,4,k);if(0===l)for(n=d-c+1,p=4;p<a;n+=h,p++)for(g=0;g<c;g++)b[n+g]=e[g][p]}return{width:h,height:k,items:b}};return a}(),N=function(){function a(){I.call(this)}a.prototype=Object.create(I.prototype);a.prototype.filter=function(a,b,c){c>>=1;b|=0;var d,e,g,f;d=b-3;for(e=c+4;e--;d+=2)a[d]*=.8128930661159609;d=b-2;g=.443506852043971*a[d-1];for(e=c+3;e--;d+=2)if(f=.443506852043971*
a[d+1],a[d]=1.230174104914001*a[d]-g-f,e--)d+=2,g=.443506852043971*a[d+1],a[d]=1.230174104914001*a[d]-g-f;else break;d=b-1;g=.882911075530934*a[d-1];for(e=c+2;e--;d+=2)if(f=.882911075530934*a[d+1],a[d]-=g+f,e--)d+=2,g=.882911075530934*a[d+1],a[d]-=g+f;else break;d=b;g=-.052980118572961*a[d-1];for(e=c+1;e--;d+=2)if(f=-.052980118572961*a[d+1],a[d]-=g+f,e--)d+=2,g=-.052980118572961*a[d+1],a[d]-=g+f;else break;if(0!==c)for(d=b+1,g=-1.586134342059924*a[d-1],e=c;e--;d+=2)if(f=-1.586134342059924*a[d+1],
a[d]-=g+f,e--)d+=2,g=-1.586134342059924*a[d+1],a[d]-=g+f;else break};return a}(),M=function(){function a(){I.call(this)}a.prototype=Object.create(I.prototype);a.prototype.filter=function(a,b,c){c>>=1;b|=0;var d,e;d=b;for(e=c+1;e--;d+=2)a[d]-=a[d-1]+a[d+1]+2>>2;d=b+1;for(e=c;e--;d+=2)a[d]+=a[d-1]+a[d+1]>>1};return a}();return a}();"use strict";var p=function(){function a(){}function d(a,b,c){this.data=a;this.start=b;this.end=c}function g(a,b,c){function d(a){for(var b=0,d=0;d<a;d++){var f=c.readBit(e,
g);g=256>g?g<<1|f:(g<<1|f)&511|256;b=b<<1|f}return b>>>0}var e=a.getContexts(b),g=1;a=d(1);b=d(1)?d(1)?d(1)?d(1)?d(1)?d(32)+4436:d(12)+340:d(8)+84:d(6)+20:d(4)+4:d(2);return 0===a?b:0<b?-b:null}function h(a,b,c){a=a.getContexts("IAID");for(var d=1,e=0;e<c;e++)var g=b.readBit(a,d),d=d<<1|g;return 31>c?d&(1<<c)-1:d&2147483647}function k(a,b,c){var d=c.decoder;c=c.contextCache.getContexts("GB");var e,g,f,h,k,l,n,m=[];for(g=0;g<b;g++)for(k=m[g]=new Uint8Array(a),l=1>g?k:m[g-1],n=2>g?k:m[g-2],e=n[0]<<
13|n[1]<<12|n[2]<<11|l[0]<<7|l[1]<<6|l[2]<<5|l[3]<<4,f=0;f<a;f++)k[f]=h=d.readBit(c,e),e=(e&31735)<<1|(f+3<a?n[f+3]<<11:0)|(f+4<a?l[f+4]<<4:0)|h;return m}function n(a,b,c,d,e,g,f,h){a&&v("JBIG2 error: MMR encoding is not supported");if(0===d&&!g&&!e&&4===f.length&&3===f[0].x&&-1===f[0].y&&-3===f[1].x&&-1===f[1].y&&2===f[2].x&&-2===f[2].y&&-2===f[3].x&&-2===f[3].y)return k(b,c,h);a=!!g;var l=O[d].concat(f);l.sort(function(a,b){return a.y-b.y||a.x-b.x});f=l.length;var n=new Int8Array(f),m=new Int8Array(f),
p=[],q=0,r=0,t=0,y=0,u,A;for(A=0;A<f;A++)n[A]=l[A].x,m[A]=l[A].y,r=Math.min(r,l[A].x),t=Math.max(t,l[A].x),y=Math.min(y,l[A].y),A<f-1&&l[A].y===l[A+1].y&&l[A].x===l[A+1].x-1?q|=1<<f-1-A:p.push(A);var x=p.length,w=new Int8Array(x),z=new Int8Array(x),D=new Uint16Array(x);for(u=0;u<x;u++)A=p[u],w[u]=l[A].x,z[u]=l[A].y,D[u]=1<<f-1-A;l=-r;y=-y;t=b-t;d=F[d];p=new Uint8Array(b);r=[];u=h.decoder;h=h.contextCache.getContexts("GB");for(var B=0,C,E,G,N=0,J,H=0;H<c;H++){if(e&&(A=u.readBit(h,d),B^=A)){r.push(p);
continue}p=new Uint8Array(p);r.push(p);for(C=0;C<b;C++)if(a&&g[H][C])p[C]=0;else{if(C>=l&&C<t&&H>=y)for(N=N<<1&q,A=0;A<x;A++){if(E=H+z[A],G=C+w[A],E=r[E][G])E=D[A],N|=E}else for(N=0,J=f-1,A=0;A<f;A++,J--)G=C+n[A],0<=G&&G<b&&(E=H+m[A],0<=E&&(E=r[E][G])&&(N|=E<<J));A=u.readBit(h,N);p[C]=A}}return r}function m(a,b,c,d,e,g,f,h,k){var l=K[c].coding;0===c&&(l=l.concat([h[0]]));var n=l.length,m=new Int32Array(n),p=new Int32Array(n),q;for(q=0;q<n;q++)m[q]=l[q].x,p[q]=l[q].y;var r=K[c].reference;0===c&&(r=
r.concat([h[1]]));h=r.length;var l=new Int32Array(h),t=new Int32Array(h);for(q=0;q<h;q++)l[q]=r[q].x,t[q]=r[q].y;var r=d[0].length,u=d.length;c=I[c];var y=[],A=k.decoder;k=k.contextCache.getContexts("GR");for(var x=0,w=0;w<b;w++){f&&(q=A.readBit(k,c),(x^=q)&&v("JBIG2 error: prediction is not supported"));var z=new Uint8Array(a);y.push(z);for(var D=0;D<a;D++){var B,C,E=0;for(q=0;q<n;q++)B=w+p[q],C=D+m[q],E=0>B||0>C||C>=a?E<<1:E<<1|y[B][C];for(q=0;q<h;q++)B=w+t[q]+g,C=D+l[q]+e,E=0>B||B>=u||0>C||C>=
r?E<<1:E<<1|d[B][C];q=A.readBit(k,E);z[D]=q}}return y}function p(a,b,c,d,e,f,k,l,n,p,q,r,t,u,y,x,w){a&&v("JBIG2 error: huffman is not supported");a=[];var A;for(u=0;u<d;u++){A=new Uint8Array(c);if(e)for(var z=0;z<c;z++)A[z]=e;a.push(A)}d=w.decoder;e=w.contextCache;var z=-g(e,"IADT",d),D=0;for(u=0;u<f;){var B=g(e,"IADT",d),z=z+B,B=g(e,"IAFS",d),B=D+=B;do{var C=1===k?0:g(e,"IAIT",d);A=k*z+C;var C=h(e,d,n),E=b&&g(e,"IARI",d),C=l[C],F=C[0].length,G=C.length;if(E)var E=g(e,"IARDW",d),N=g(e,"IARDH",d),
H=g(e,"IARDX",d),J=g(e,"IARDY",d),F=F+E,G=G+N,C=m(F,G,y,C,(E>>1)+H,(N>>1)+J,!1,x,w);var E=A-(r&1?0:G),N=B-(r&2?F:0),I;if(p){for(H=0;H<G;H++)if(A=a[N+H]){I=C[H];var P=Math.min(c-E,F);switch(t){case 0:for(J=0;J<P;J++)A[E+J]|=I[J];break;case 2:for(J=0;J<P;J++)A[E+J]^=I[J];break;default:v("JBIG2 error: operator "+t+" is not supported")}}B+=G-1}else{for(J=0;J<G;J++)if(A=a[E+J])switch(I=C[J],t){case 0:for(H=0;H<F;H++)A[N+H]|=I[H];break;case 2:for(H=0;H<F;H++)A[N+H]^=I[H];break;default:v("JBIG2 error: operator "+
t+" is not supported")}B+=F-1}u++;C=g(e,"IADS",d);if(null===C)break;B+=C+q}while(1)}return a}function r(a,b){return{width:e(a,b),height:e(a,b+4),x:e(a,b+8),y:e(a,b+12),combinationOperator:a[b+16]&7}}function y(){}function u(){}a.prototype={getContexts:function(a){return a in this?this[a]:this[a]=new Int8Array(65536)}};d.prototype={get decoder(){var a=new l(this.data,this.start,this.end);return f(this,"decoder",a)},get contextCache(){var b=new a;return f(this,"contextCache",b)}};var L=["SymbolDictionary",
null,null,null,"IntermediateTextRegion",null,"ImmediateTextRegion","ImmediateLosslessTextRegion",null,null,null,null,null,null,null,null,"patternDictionary",null,null,null,"IntermediateHalftoneRegion",null,"ImmediateHalftoneRegion","ImmediateLosslessHalftoneRegion",null,null,null,null,null,null,null,null,null,null,null,null,"IntermediateGenericRegion",null,"ImmediateGenericRegion","ImmediateLosslessGenericRegion","IntermediateGenericRefinementRegion",null,"ImmediateGenericRefinementRegion","ImmediateLosslessGenericRefinementRegion",
null,null,null,null,"PageInformation","EndOfPage","EndOfStripe","EndOfFile","Profiles","Tables",null,null,null,null,null,null,null,null,"Extension"],O=[[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:2,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:2,y:-1},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}],[{x:-1,y:-2},{x:0,y:-2},{x:1,y:-2},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,
y:-1},{x:-2,y:0},{x:-1,y:0}],[{x:-3,y:-1},{x:-2,y:-1},{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-4,y:0},{x:-3,y:0},{x:-2,y:0},{x:-1,y:0}]],K=[{coding:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:1,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:-1,y:1},{x:0,y:1},{x:1,y:1}]},{coding:[{x:-1,y:-1},{x:0,y:-1},{x:1,y:-1},{x:-1,y:0}],reference:[{x:0,y:-1},{x:-1,y:0},{x:0,y:0},{x:1,y:0},{x:0,y:1},{x:1,y:1}]}],F=[39717,1941,229,405],I=[32,8];y.prototype={onPageInformation:function(a){this.currentPageInfo=
a;var b=new Uint8Array((a.width+7>>3)*a.height);if(a.defaultPixelValue){a=0;for(var c=b.length;a<c;a++)b[a]=255}this.buffer=b},drawBitmap:function(a,b){var c=this.currentPageInfo,d=a.width,e=a.height,g=c.width+7>>3,f=c.combinationOperatorOverride?a.combinationOperator:c.combinationOperator,c=this.buffer,h=128>>(a.x&7);a=a.y*g+(a.x>>3);var k,l,n;switch(f){case 0:for(f=0;f<e;f++){l=h;n=a;for(k=0;k<d;k++)b[f][k]&&(c[n]|=l),l>>=1,l||(l=128,n++);a+=g}break;case 2:for(f=0;f<e;f++){l=h;n=a;for(k=0;k<d;k++)b[f][k]&&
(c[n]^=l),l>>=1,l||(l=128,n++);a+=g}break;default:v("JBIG2 error: operator "+f+" is not supported")}},onImmediateGenericRegion:function(a,b,c,e){var g=a.info;b=new d(b,c,e);a=n(a.mmr,g.width,g.height,a.template,a.prediction,null,a.at,b);this.drawBitmap(g,a)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(a,c,e,f,k,l){a.huffman&&v("JBIG2 error: huffman is not supported");var q=this.symbols;q||(this.symbols=q={});for(var r=
[],t=0,u=e.length;t<u;t++)r=r.concat(q[e[t]]);l=new d(f,k,l);t=a.huffman;u=a.refinement;e=r;var r=a.numberOfNewSymbols,y=a.template,A=a.at,x=a.refinementTemplate,w=a.refinementAt;t&&v("JBIG2 error: huffman is not supported");a=[];var z=0,D=b(e.length+r);f=l.decoder;for(k=l.contextCache;a.length<r;)for(var C=g(k,"IADH",f),z=z+C,C=0;;){var B=g(k,"IADW",f);if(null===B)break;C+=B;if(u)if(B=g(k,"IAAI",f),1<B)B=p(t,u,C,z,0,B,1,e.concat(a),D,0,0,1,0,void 0,x,w,l);else var B=h(k,f,D),E=g(k,"IARDX",f),F=g(k,
"IARDY",f),B=m(C,z,x,B<e.length?e[B]:a[B-e.length],E,F,!1,w,l);else B=n(!1,C,z,y,!1,null,A,l);a.push(B)}l=[];t=[];u=!1;for(y=e.length+r;t.length<y;){for(A=g(k,"IAEX",f);A--;)t.push(u);u=!u}f=0;for(k=e.length;f<k;f++)t[f]&&l.push(e[f]);for(e=0;e<r;f++,e++)t[f]&&l.push(a[e]);q[c]=l},onImmediateTextRegion:function(a,c,e,g,f){for(var h=a.info,k=this.symbols,l=[],n=0,m=c.length;n<m;n++)l=l.concat(k[c[n]]);c=b(l.length);e=new d(e,g,f);a=p(a.huffman,a.refinement,h.width,h.height,a.defaultPixelValue,a.numberOfSymbolInstances,
a.stripSize,l,c,a.transposed,a.dsOffset,a.referenceCorner,a.combinationOperator,void 0,a.refinementTemplate,a.refinementAt,e);this.drawBitmap(h,a)},onImmediateLosslessTextRegion:function(){this.onImmediateTextRegion.apply(this,arguments)}};u.prototype={parseChunks:function(a){for(var b=new y,d=0,g=a.length;d<g;d++){for(var f=a[d],h={},k=f.data,l=f.end,n=[],m=f.start;m<l;){var p,q,f=k,t=m,m={};m.number=e(f,t);p=f[t+4];var u=p&63;L[u]||v("JBIG2 error: invalid segment type: "+u);m.type=u;m.typeName=
L[u];m.deferredNonRetain=!!(p&128);p=!!(p&64);var x=f[t+5],w=x>>5&7;q=[x&31];t+=6;if(7===x)for(w=e(f,t-1)&536870911,t+=3,x=w+7>>3,q[0]=f[t++];0<--x;)q.push(f[t++]);else 5!==x&&6!==x||v("JBIG2 error: invalid referred-to flags");m.retainBits=q;var x=256>=m.number?1:65536>=m.number?2:4,z=[];for(q=0;q<w;q++){var B=1===x?f[t]:2===x?c(f,t):e(f,t);z.push(B);t+=x}m.referredTo=z;p?(m.pageAssociation=e(f,t),t+=4):m.pageAssociation=f[t++];m.length=e(f,t);t+=4;if(4294967295===m.length)if(38===u){p=r(f,t);w=!!(f[t+
17]&1);u=new Uint8Array(6);w||(u[0]=255,u[1]=172);u[2]=p.height>>>24&255;u[3]=p.height>>16&255;u[4]=p.height>>8&255;u[5]=p.height&255;q=t;for(p=f.length;q<p;q++){for(w=0;6>w&&u[w]===f[q+w];)w++;if(6===w){m.length=q+6;break}}4294967295===m.length&&v("JBIG2 error: segment end was not found")}else v("JBIG2 error: invalid unknown segment length");m.headerEnd=t;f=m;m=f.headerEnd;t={header:f,data:k};h.randomAccess||(t.start=m,m+=f.length,t.end=m);n.push(t);if(51===f.type)break}if(h.randomAccess)for(h=0,
k=n.length;h<k;h++)n[h].start=m,m+=n[h].header.length,n[h].end=m;h=b;k=0;for(l=n.length;k<l;k++){w=void 0;p=n[k];f=h;m=p.header;t=p.data;u=p.start;p=p.end;switch(m.type){case 0:z={};w=c(t,u);z.huffman=!!(w&1);z.refinement=!!(w&2);z.huffmanDHSelector=w>>2&3;z.huffmanDWSelector=w>>4&3;z.bitmapSizeSelector=w>>6&1;z.aggregationInstancesSelector=w>>7&1;z.bitmapCodingContextUsed=!!(w&256);z.bitmapCodingContextRetained=!!(w&512);z.template=w>>10&3;z.refinementTemplate=w>>12&1;u+=2;if(!z.huffman){x=0===z.template?
4:1;q=[];for(w=0;w<x;w++)q.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;z.at=q}if(z.refinement&&!z.refinementTemplate){q=[];for(w=0;2>w;w++)q.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;z.refinementAt=q}z.numberOfExportedSymbols=e(t,u);u+=4;z.numberOfNewSymbols=e(t,u);w=[z,m.number,m.referredTo,t,u+4,p];break;case 6:case 7:x={};x.info=r(t,u);u+=17;w=c(t,u);u+=2;x.huffman=!!(w&1);x.refinement=!!(w&2);x.stripSize=1<<(w>>2&3);x.referenceCorner=w>>4&3;x.transposed=!!(w&64);x.combinationOperator=w>>7&
3;x.defaultPixelValue=w>>9&1;x.dsOffset=w<<17>>27;x.refinementTemplate=w>>15&1;x.huffman&&(w=c(t,u),u+=2,x.huffmanFS=w&3,x.huffmanDS=w>>2&3,x.huffmanDT=w>>4&3,x.huffmanRefinementDW=w>>6&3,x.huffmanRefinementDH=w>>8&3,x.huffmanRefinementDX=w>>10&3,x.huffmanRefinementDY=w>>12&3,x.huffmanRefinementSizeSelector=!!(w&14));if(x.refinement&&!x.refinementTemplate){q=[];for(w=0;2>w;w++)q.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;x.refinementAt=q}x.numberOfSymbolInstances=e(t,u);u+=4;x.huffman&&v("JBIG2 error: huffman is not supported");
w=[x,m.referredTo,t,u,p];break;case 38:case 39:z={};z.info=r(t,u);u+=17;w=t[u++];z.mmr=!!(w&1);z.template=w>>1&3;z.prediction=!!(w&8);if(!z.mmr){x=0===z.template?4:1;q=[];for(w=0;w<x;w++)q.push({x:t[u]<<24>>24,y:t[u+1]<<24>>24}),u+=2;z.at=q}w=[z,t,u,p];break;case 48:p={width:e(t,u),height:e(t,u+4),resolutionX:e(t,u+8),resolutionY:e(t,u+12)};4294967295===p.height&&delete p.height;w=t[u+16];c(t,u+17);p.lossless=!!(w&1);p.refinement=!!(w&2);p.defaultPixelValue=w>>2&1;p.combinationOperator=w>>3&3;p.requiresBuffer=
!!(w&32);p.combinationOperatorOverride=!!(w&64);w=[p];break;case 49:break;case 50:break;case 51:break;case 62:break;default:v("JBIG2 error: segment type "+m.typeName+"("+m.type+") is not implemented")}m="on"+m.typeName;m in f&&f[m].apply(f,w)}}return b}};return u}(),v=function(){console.error.apply(console,arguments);throw Error("PDFJS error: "+arguments[0]);},r=function(){console.warn.apply(console,arguments)},y=function(){console.info.apply(console,arguments)};p.prototype.parse=function(a){var b=
0,c=a.length;151===a[b]&&74===a[b+1]&&66===a[b+2]&&50===a[b+3]&&13===a[b+4]&&10===a[b+5]&&26===a[b+6]&&10===a[b+7]||v("JBIG2 error: invalid header");b+=8;a[b++]&2||(e(a,b),b+=4);a=this.parseChunks([{data:a,start:b,end:c}]);var b=a.currentPageInfo.width,c=a.currentPageInfo.height,d=a.buffer;a=new Uint8Array(b*c);for(var f=0,g=0,h=0;h<c;h++)for(var k=0,l,m=0;m<b;m++)k||(k=128,l=d[g++]),a[f++]=l&k?0:255,k>>=1;this.width=b;this.height=c;this.data=a};a.JpegImage=h;a.JpxImage=n;a.Jbig2Image=p})(c||(c={}));
n.exports={JpegImage:h,JpegDecoder:c.JpegImage,JpxDecoder:c.JpxImage,Jbig2Decoder:c.Jbig2Image}},function(n,h,f){f(29);f(1);f(4);f(48);f(28);f(50);f(55);f(52);f(53);f(54);f(51);f(56);n.exports=f(49)}]);
