-
Notifications
You must be signed in to change notification settings - Fork 48
/
xtk.js
340 lines (340 loc) · 151 KB
/
xtk.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
/*
*
* xxxxxxx xxxxxxx
* x:::::x x:::::x
* x:::::x x:::::x
* x:::::xx:::::x
* x::::::::::x
* x::::::::x
* x::::::::x
* x::::::::::x
* x:::::xx:::::x
* x:::::x x:::::x
* x:::::x x:::::x
* THE xxxxxxx xxxxxxx TOOLKIT
*
* http://www.goXTK.com
*
* Copyright (c) 2012 The X Toolkit Developers <dev@goXTK.com>
*
* The X Toolkit (XTK) is licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* "Free software" is a matter of liberty, not price.
* "Free" as in "free speech", not as in "free beer".
* - Richard M. Stallman
*
* FUELED BY:
* - the wonderful Constructive Solid Geometry library by Evan Wallace (http://madebyevan.com)
* LICENSE: https://raw.github.com/xtk/X/master/lib/csg/LICENSE
*
* - parts of the Google Closure Library (http://code.google.com/closure/library)
* LICENSE: https://raw.github.com/xtk/google-closure-library/master/LICENSE
*
* - zlib.js, the ultimate gzip/zlib javascript implementation (https://github.com/imaya/zlib.js)
* LICENSE: https://raw.github.com/imaya/zlib.js/master/LICENSE
*
* MORE CREDITS: https://raw.github.com/xtk/X/master/LICENSE
*
*/
function m(a){throw a;}var n=void 0,q=!0,r=null,s=!1;function ca(){return function(){}}function da(a){return function(b){this[a]=b}}function u(a){return function(){return this[a]}}var w,fa=this;function ga(){}
function ha(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ja(a){return a!==n}function z(a){return"array"==ha(a)}function la(a){var b=ha(a);return"array"==b||"object"==b&&"number"==typeof a.length}function ma(a){return"string"==typeof a}function D(a){return"number"==typeof a}function na(a){return"function"==ha(a)}function oa(a){var b=typeof a;return"object"==b&&a!=r||"function"==b}function pa(a){return a[qa]||(a[qa]=++ra)}var qa="closure_uid_"+(1E9*Math.random()>>>0),ra=0;
function sa(a,b,c){return a.call.apply(a.bind,arguments)}function ta(a,b,c){a||m(Error());if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function va(a,b,c){va=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?sa:ta;return va.apply(r,arguments)}
function wa(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}var xa=Date.now||function(){return+new Date};function F(a,b){var c=a.split("."),d=fa;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&ja(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}
function H(a,b){function c(){}c.prototype=b.prototype;a.t=b.prototype;a.prototype=new c;a.prototype.constructor=a};function ya(a,b,c){this.Da=this.Ca=this.Ba=0;3==arguments.length?(this.Ba=Number(a),this.Ca=Number(b),this.Da=Number(c)):a instanceof ya?(this.Ba=Number(a.x()),this.Ca=Number(a.y()),this.Da=Number(a.b())):(this.Ba=Number(a[0]),this.Ca=Number(a[1]),this.Da=Number(a[2]))}
ya.prototype={h:function(){return new ya(this.Ba,this.Ca,this.Da)},Cb:function(a){return this.Ba*a.x()+this.Ca*a.y()+this.Da*a.b()},Ad:function(a,b){return za(this,Aa(Ba(a,this),b))},length:function(){return Math.sqrt(this.Cb(this))},Yb:function(a){return new ya(this.Ca*a.b()-this.Da*a.y(),this.Da*a.x()-this.Ba*a.b(),this.Ba*a.y()-this.Ca*a.x())},x:u("Ba"),y:u("Ca"),b:u("Da")};function Ca(a){var b=a.length();return new ya(a.Ba/b,a.Ca/b,a.Da/b)}
function Aa(a,b){return new ya(a.Ba*b,a.Ca*b,a.Da*b)}function Ba(a,b){return new ya(a.Ba-b.x(),a.Ca-b.y(),a.Da-b.b())}function za(a,b){return new ya(a.Ba+b.x(),a.Ca+b.y(),a.Da+b.b())}function Da(a){return new ya(-a.Ba,-a.Ca,-a.Da)};var L=L||{};L.Ri=q;L.Ea=function(a){eval("X.DEV === undefined")||window.console.time(a)};L.qa=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.xg=0;this.Ni=function(){return this.xg++}};function Fa(a,b){for(var c in b){var d=b.__lookupGetter__(c),e=b.__lookupSetter__(c);d||e?(d&&a.__defineGetter__(c,d),e&&a.__defineSetter__(c,e)):a[c]=b[c]}}var Ga=window.og;
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,e.concat(d.call(arguments)))}function c(){}"function"!==typeof this&&m(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var d=Array.prototype.slice,e=d.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
for(var Ha=0,Ia=["ms","moz","webkit","o"],Ja=0;Ja<Ia.length&&!window.requestAnimationFrame;++Ja)window.requestAnimationFrame=window[Ia[Ja]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[Ia[Ja]+"CancelAnimationFrame"]||window[Ia[Ja]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=Date.now(),c=Math.max(0,16-(b-Ha)),d=window.setTimeout(function(){a(b+c)},c);Ha=b+c;return d});
window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});
"slice"in ArrayBuffer.prototype||(ArrayBuffer.prototype.slice=function(a,b){a===n&&m(Error("Not enough arguments."));var c=b||this.byteLength;0>a&&(a=this.byteLength+a);0>c&&(c=this.byteLength+c);c<a&&(c=a=0);0>a&&(a=0);0>c&&(c=0);a>this.byteLength&&(a=this.byteLength);c>this.byteLength&&(c=this.byteLength);for(var d=new ArrayBuffer(c-a),e=new Uint8Array(this),f=new Uint8Array(d),g=a,h=0;g<c;++g,++h)f[h]=e[g];return d});F("$",Ga);F("Function.prototype.bind",Function.prototype.bind);
F("window.requestAnimationFrame",window.requestAnimationFrame);F("window.cancelAnimationFrame",window.cancelAnimationFrame);function Ka(a){if(!La.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Ma,"&"));-1!=a.indexOf("<")&&(a=a.replace(Na,"<"));-1!=a.indexOf(">")&&(a=a.replace(Oa,">"));-1!=a.indexOf('"')&&(a=a.replace(Pa,"""));return a}var Ma=/&/g,Na=/</g,Oa=/>/g,Pa=/\"/g,La=/[&<>\"]/;var Qa,Ra,Sa,Ta,Ua,Wa,Xa;function Ya(){return fa.navigator?fa.navigator.userAgent:r}function Za(){return fa.navigator}Ta=Sa=Ra=Qa=s;var $a;if($a=Ya()){var ab=Za();Qa=0==$a.indexOf("Opera");Ra=!Qa&&-1!=$a.indexOf("MSIE");Sa=!Qa&&-1!=$a.indexOf("WebKit");Ta=!Qa&&!Sa&&"Gecko"==ab.product}var bb=Qa,N=Ra,cb=Ta,eb=Sa,fb,gb=Za();fb=gb&&gb.platform||"";Ua=-1!=fb.indexOf("Mac");Wa=-1!=fb.indexOf("Win");Xa=-1!=fb.indexOf("Linux");var hb=!!Za()&&-1!=(Za().appVersion||"").indexOf("X11");
function ib(){var a=fa.document;return a?a.documentMode:n}var jb;a:{var kb="",lb;if(bb&&fa.opera)var mb=fa.opera.version,kb="function"==typeof mb?mb():mb;else if(cb?lb=/rv\:([^\);]+)(\)|;)/:N?lb=/MSIE\s+([^\);]+)(\)|;)/:eb&&(lb=/WebKit\/(\S+)/),lb)var nb=lb.exec(Ya()),kb=nb?nb[1]:"";if(N){var ob=ib();if(ob>parseFloat(kb)){jb=String(ob);break a}}jb=kb}var pb={};
function qb(a){var b;if(!(b=pb[a])){b=0;for(var c=String(jb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",j=RegExp("(\\d*)(\\D*)","g"),l=RegExp("(\\d*)(\\D*)","g");do{var k=j.exec(g)||["","",""],p=l.exec(h)||["","",""];if(0==k[0].length&&0==p[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==p[1].length?0:parseInt(p[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==p[1].length?0:parseInt(p[1],10))?1:0)||((0==k[2].length)<(0==p[2].length)?-1:(0==k[2].length)>(0==p[2].length)?1:0)||(k[2]<p[2]?-1:k[2]>p[2]?1:0)}while(0==b)}b=pb[a]=0<=b}return b}var rb=fa.document,sb=!rb||!N?n:ib()||("CSS1Compat"==rb.compatMode?parseInt(jb,10):5);function tb(){0!=ub&&(this.Ij=Error().stack,pa(this))}var ub=0;function vb(a,b){this.type=a;this.currentTarget=this.target=b}w=vb.prototype;w.ac=s;w.defaultPrevented=s;w.Fd=q;w.stopPropagation=function(){this.ac=q};w.preventDefault=function(){this.defaultPrevented=q;this.Fd=s};var wb=0;function xb(){}w=xb.prototype;w.key=0;w.bc=s;w.nd=s;w.ea=function(a,b,c,d,e,f){na(a)?this.Of=q:a&&a.handleEvent&&na(a.handleEvent)?this.Of=s:m(Error("Invalid listener argument"));this.Db=a;this.gg=b;this.src=c;this.type=d;this.capture=!!e;this.xe=f;this.nd=s;this.key=++wb;this.bc=s};w.handleEvent=function(a){return this.Of?this.Db.call(this.xe||this.src,a):this.Db.handleEvent.call(this.Db,a)};function yb(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}var zb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ab(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<zb.length;f++)c=zb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var Bb=!N||N&&9<=sb,Cb=N&&!qb("9");!eb||qb("528");cb&&qb("1.9b")||N&&qb("8")||bb&&qb("9.5")||eb&&qb("528");cb&&!qb("8")||N&&qb("9");var Db=Array.prototype,Eb=Db.indexOf?function(a,b,c){return Db.indexOf.call(a,b,c)}:function(a,b,c){c=c==r?0:0>c?Math.max(0,a.length+c):c;if(ma(a))return!ma(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Fb=Db.forEach?function(a,b,c){Db.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=ma(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Gb=Db.map?function(a,b,c){return Db.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=
ma(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Hb=Db.some?function(a,b,c){return Db.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=ma(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return q;return s};function Ib(a,b){var c=Eb(a,b);0<=c&&Db.splice.call(a,c,1)}function Jb(a,b,c){return 2>=arguments.length?Db.slice.call(a,b):Db.slice.call(a,b,c)};function Kb(a){Kb[" "](a);return a}Kb[" "]=ga;function Lb(a,b){a&&this.ea(a,b)}H(Lb,vb);w=Lb.prototype;w.target=r;w.relatedTarget=r;w.offsetX=0;w.offsetY=0;w.clientX=0;w.clientY=0;w.screenX=0;w.screenY=0;w.button=0;w.keyCode=0;w.charCode=0;w.ctrlKey=s;w.altKey=s;w.shiftKey=s;w.metaKey=s;w.gi=s;w.Ma=r;
w.ea=function(a,b){var c=this.type=a.type;vb.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(cb){var e;a:{try{Kb(d.nodeName);e=q;break a}catch(f){}e=s}e||(d=r)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=eb||a.offsetX!==n?a.offsetX:a.layerX;this.offsetY=eb||a.offsetY!==n?a.offsetY:a.layerY;this.clientX=a.clientX!==n?a.clientX:a.pageX;this.clientY=a.clientY!==n?a.clientY:a.pageY;this.screenX=
a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.gi=Ua?a.metaKey:a.ctrlKey;this.state=a.state;this.Ma=a;a.defaultPrevented&&this.preventDefault();delete this.ac};w.stopPropagation=function(){Lb.t.stopPropagation.call(this);this.Ma.stopPropagation?this.Ma.stopPropagation():this.Ma.cancelBubble=q};
w.preventDefault=function(){Lb.t.preventDefault.call(this);var a=this.Ma;if(a.preventDefault)a.preventDefault();else if(a.returnValue=s,Cb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.bh=u("Ma");var Mb={},Ob={},Pb={},Qb={};function P(a,b,c,d,e){if(z(b)){for(var f=0;f<b.length;f++)P(a,b[f],c,d,e);return r}a=Rb(a,b,c,s,d,e);b=a.key;Mb[b]=a;return b}
function Rb(a,b,c,d,e,f){b||m(Error("Invalid event type"));e=!!e;var g=Ob;b in g||(g[b]={V:0,pa:0});g=g[b];e in g||(g[e]={V:0,pa:0},g.V++);var g=g[e],h=pa(a),j;g.pa++;if(g[h]){j=g[h];for(var l=0;l<j.length;l++)if(g=j[l],g.Db==c&&g.xe==f){if(g.bc)break;d||(j[l].nd=s);return j[l]}}else j=g[h]=[],g.V++;var k=Sb,p=Bb?function(a){return k.call(p.src,p.Db,a)}:function(a){a=k.call(p.src,p.Db,a);if(!a)return a},l=p,g=new xb;g.ea(c,l,a,b,e,f);g.nd=d;l.src=a;l.Db=g;j.push(g);Pb[h]||(Pb[h]=[]);Pb[h].push(g);
a.addEventListener?(a==fa||!a.Af)&&a.addEventListener(b,l,e):a.attachEvent(b in Qb?Qb[b]:Qb[b]="on"+b,l);return g}function Tb(a,b,c,d,e){if(z(b))for(var f=0;f<b.length;f++)Tb(a,b[f],c,d,e);else a=Rb(a,b,c,q,d,e),Mb[a.key]=a}function Vb(a,b,c,d,e){if(z(b))for(var f=0;f<b.length;f++)Vb(a,b[f],c,d,e);else{d=!!d;a:{f=Ob;if(b in f&&(f=f[b],d in f&&(f=f[d],a=pa(a),f[a]))){a=f[a];break a}a=r}if(a)for(f=0;f<a.length;f++)if(a[f].Db==c&&a[f].capture==d&&a[f].xe==e){Wb(a[f].key);break}}}
function Wb(a){var b=Mb[a];if(!b||b.bc)return s;var c=b.src,d=b.type,e=b.gg,f=b.capture;c.removeEventListener?(c==fa||!c.Af)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in Qb?Qb[d]:Qb[d]="on"+d,e);c=pa(c);Pb[c]&&(e=Pb[c],Ib(e,b),0==e.length&&delete Pb[c]);b.bc=q;if(b=Ob[d][f][c])b.Wf=q,Xb(d,f,c,b);delete Mb[a];return q}
function Xb(a,b,c,d){if(!d.Cd&&d.Wf){for(var e=0,f=0;e<d.length;e++)d[e].bc?d[e].gg.src=r:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.Wf=s;0==f&&(delete Ob[a][b][c],Ob[a][b].V--,0==Ob[a][b].V&&(delete Ob[a][b],Ob[a].V--),0==Ob[a].V&&delete Ob[a])}}function Yb(a,b,c,d,e){var f=1;b=pa(b);if(a[b]){var g=--a.pa,h=a[b];h.Cd?h.Cd++:h.Cd=1;try{for(var j=h.length,l=0;l<j;l++){var k=h[l];k&&!k.bc&&(f&=Zb(k,e)!==s)}}finally{a.pa=Math.max(g,a.pa),h.Cd--,Xb(c,d,b,h)}}return Boolean(f)}
function Zb(a,b){a.nd&&Wb(a.key);return a.handleEvent(b)}
function Sb(a,b){if(a.bc)return q;var c=a.type,d=Ob;if(!(c in d))return q;var d=d[c],e,f;if(!Bb){var g;if(!(g=b))a:{g=["window","event"];for(var h=fa;e=g.shift();)if(h[e]!=r)h=h[e];else{g=r;break a}g=h}e=g;g=q in d;h=s in d;if(g){if(0>e.keyCode||e.returnValue!=n)return q;a:{var j=s;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(l){j=q}if(j||e.returnValue==n)e.returnValue=q}}j=new Lb;j.ea(e,this);e=q;try{if(g){for(var k=[],p=j.currentTarget;p;p=p.parentNode)k.push(p);f=d[q];f.pa=f.V;for(var t=k.length-
1;!j.ac&&0<=t&&f.pa;t--)j.currentTarget=k[t],e&=Yb(f,k[t],c,q,j);if(h){f=d[s];f.pa=f.V;for(t=0;!j.ac&&t<k.length&&f.pa;t++)j.currentTarget=k[t],e&=Yb(f,k[t],c,s,j)}}else e=Zb(a,j)}finally{k&&(k.length=0)}return e}c=new Lb(b,this);return e=Zb(a,c)}var $b=0;function ac(a){return a+"_"+$b++};function bc(){tb.call(this)}H(bc,tb);w=bc.prototype;w.Af=q;w.Ke=r;w.Oe=da("Ke");w.addEventListener=function(a,b,c,d){P(this,a,b,c,d)};w.removeEventListener=function(a,b,c,d){Vb(this,a,b,c,d)};
w.dispatchEvent=function(a){var b=a.type||a,c=Ob;if(b in c){if(ma(a))a=new vb(a,this);else if(a instanceof vb)a.target=a.target||this;else{var d=a;a=new vb(b,this);Ab(a,d)}var d=1,e,c=c[b],b=q in c,f;if(b){e=[];for(f=this;f;f=f.Ke)e.push(f);f=c[q];f.pa=f.V;for(var g=e.length-1;!a.ac&&0<=g&&f.pa;g--)a.currentTarget=e[g],d&=Yb(f,e[g],a.type,q,a)&&a.Fd!=s}if(s in c)if(f=c[s],f.pa=f.V,b)for(g=0;!a.ac&&g<e.length&&f.pa;g++)a.currentTarget=e[g],d&=Yb(f,e[g],a.type,s,a)&&a.Fd!=s;else for(e=this;!a.ac&&e&&
f.pa;e=e.Ke)a.currentTarget=e,d&=Yb(f,e,a.type,s,a)&&a.Fd!=s;a=Boolean(d)}else a=q;return a};function Q(){tb.call(this);this.c="base";this.sa=window["X.counter"].Ni();this.g=s}H(Q,bc);Q.prototype.__defineGetter__("classname",u("c"));Q.prototype.__defineGetter__("id",u("sa"));F("X.base",Q);function cc(a,b){this.Aa=new ya(a);this.ba=new ya(b)}cc.prototype={h:function(){return new cc(this.Aa.h(),this.ba.h())},$b:function(){this.ba=Da(this.ba)}};function dc(a,b){this.ba=a;this.Uc=b}dc.prototype={h:function(){return new dc(this.ba.h(),this.Uc)},$b:function(){this.ba=Da(this.ba);this.Uc=-this.Uc}};function ec(a,b){this.hb=a;this.Md=b;var c=a[0].Aa,d=a[2].Aa,d=Ca(Ba(a[1].Aa,c).Yb(Ba(d,c)));this.za=new dc(d,d.Cb(c))}ec.prototype={h:function(){var a=this.hb.map(function(a){return a.h()});return new ec(a,this.Md)},$b:function(){this.hb.reverse().map(function(a){a.$b()});this.za.$b()}};
function fc(a,b,c,d,e,f){for(var g=0,h=[],j=0;j<a.hb.length;j++){var l=b.ba.Cb(a.hb[j].Aa)-b.Uc,l=-1E-5>l?2:1E-5<l?1:0,g=g|l;h.push(l)}switch(g){case 0:(0<b.ba.Cb(a.za.ba)?c:d).push(a);break;case 1:e.push(a);break;case 2:f.push(a);break;case 3:c=[];d=[];for(j=0;j<a.hb.length;j++){var k=(j+1)%a.hb.length,l=h[j],p=h[k],g=a.hb[j],k=a.hb[k];2!=l&&c.push(g);1!=l&&d.push(2!=l?g.h():g);3==(l|p)&&(l=(b.Uc-b.ba.Cb(g.Aa))/b.ba.Cb(Ba(k.Aa,g.Aa)),l=new cc(g.Aa.Ad(k.Aa,l),g.ba.Ad(k.ba,l)),c.push(l),d.push(l.h()))}3<=
c.length&&e.push(new ec(c,a.Md));3<=d.length&&f.push(new ec(d,a.Md))}};function gc(a){this.ca=this.da=this.za=r;this.A=[];a&&hc(this,a)}gc.prototype={h:function(){var a=new gc,b=this.za&&this.za.h();a.za=b;b=this.da&&this.da.h();a.da=b;b=this.ca&&this.ca.h();a.ca=b;a.Kd(this.A.map(function(a){return a.h()}));return a},D:function(){for(var a=0;a<this.A.length;a++)this.A[a].$b();this.za.$b();this.da&&this.da.D();this.ca&&this.ca.D();a=this.da;this.da=this.ca;this.ca=a},Kd:da("A")};
function hc(a,b){if(b.length){a.za||(a.za=b[0].za.h());for(var c=[],d=[],e=0;e<b.length;e++)fc(b[e],a.za,a.A,a.A,c,d);c.length&&(a.da||(a.da=new gc),hc(a.da,c));d.length&&(a.ca||(a.ca=new gc),hc(a.ca,d))}}function ic(a){var b=a.A.slice();a.da&&(b=b.concat(ic(a.da)));a.ca&&(b=b.concat(ic(a.ca)));return b}function jc(a,b){a.A=kc(b,a.A);a.da&&jc(a.da,b);a.ca&&jc(a.ca,b)}
function kc(a,b){if(!a.za)return b.slice();for(var c=[],d=[],e=0;e<b.length;e++)fc(b[e],a.za,c,d,c,d);a.da&&(c=kc(a.da,c));d=a.ca?kc(a.ca,d):[];return c.concat(d)};function lc(){this.A=[]}function mc(a){var b=new lc;b.Kd(a);return b}
lc.prototype={h:function(){var a=new lc;a.Kd(this.A.map(function(a){return a.h()}));return a},Ve:function(a){var b=new gc(this.h().A);a=new gc(a.h().A);jc(b,a);jc(a,b);a.D();jc(a,b);a.D();hc(b,ic(a));return mc(ic(b))},la:function(a){var b=new gc(this.h().A);a=new gc(a.h().A);b.D();jc(b,a);jc(a,b);a.D();jc(a,b);a.D();hc(b,ic(a));b.D();return mc(ic(b))},ze:function(a){var b=new gc(this.h().A);a=new gc(a.h().A);b.D();jc(a,b);a.D();jc(b,a);jc(a,b);hc(b,ic(a));b.D();return mc(ic(b))},inverse:function(){var a=
this.h();a.A.map(function(a){a.$b()});return a},Kd:da("A")};function nc(){Q.call(this);this.c="indexer";this.je=[];this.Ej=[];this.pb={}}H(nc,Q);nc.prototype.add=function(a){a==r&&m(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.pb||(this.pb[b]=this.je.length,this.je.push(a));return this.pb[b]};nc.prototype.unique=u("je");function oc(a){Q.call(this);this.c="file";this.dd=a;this.g=q}H(oc,Q);function pc(){this.Ib=this.p=r}pc.prototype.__defineSetter__("file",function(a){this.p=a==r||z(a)&&0==a.length?r:z(a)?1==a.length?new oc(a[0]):Gb(a,function(a){var c=new R;c.p=new oc(a);return c}):new oc(a)});pc.prototype.__defineGetter__("file",function(){return!this.p?"":z(this.p)?this.p.map(function(a){return a.p.dd}):this.p.dd});pc.prototype.__defineGetter__("filedata",u("Ib"));
pc.prototype.__defineSetter__("filedata",function(a){if(a==r||z(a)&&0==a.length)this.Ib=r;if(z(a))if(1==a.length)this.Ib=a[0];else{var b=this.p.length,c;for(c=0;c<b;c++)this.p[c].Ib=a[c]}else this.Ib=a});function qc(a){if("function"==typeof a.bb)return a.bb();if(ma(a))return a.split("");if(la(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return yb(a)};function rc(a,b){this.J={};this.w=[];var c=arguments.length;if(1<c){c%2&&m(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.le(a)}w=rc.prototype;w.V=0;w.Xe=0;w.td=u("V");w.bb=function(){sc(this);for(var a=[],b=0;b<this.w.length;b++)a.push(this.J[this.w[b]]);return a};function tc(a){for(var b=0;b<a.w.length;b++){var c=a.w[b];if(uc(a.J,c)&&a.J[c]==s)return q}return s}w.clear=function(){this.J={};this.Xe=this.V=this.w.length=0};
w.remove=function(a){return uc(this.J,a)?(delete this.J[a],this.V--,this.Xe++,this.w.length>2*this.V&&sc(this),q):s};function sc(a){if(a.V!=a.w.length){for(var b=0,c=0;b<a.w.length;){var d=a.w[b];uc(a.J,d)&&(a.w[c++]=d);b++}a.w.length=c}if(a.V!=a.w.length){for(var e={},c=b=0;b<a.w.length;)d=a.w[b],uc(e,d)||(a.w[c++]=d,e[d]=1),b++;a.w.length=c}}w.get=function(a,b){return uc(this.J,a)?this.J[a]:b};w.set=function(a,b){uc(this.J,a)||(this.V++,this.w.push(a),this.Xe++);this.J[a]=b};
w.le=function(a){var b;if(a instanceof rc)sc(a),b=a.w.concat(),a=a.bb();else{b=[];var c=0,d;for(d in a)b[c++]=d;a=yb(a)}for(c=0;c<b.length;c++)this.set(b[c],a[c])};w.h=function(){return new rc(this)};w.jg=function(){for(var a=new rc,b=0;b<this.w.length;b++){var c=this.w[b];a.set(this.J[c],c)}return a};function uc(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function vc(){Q.call(this);this.c="colortable";this.pb=new rc;Fa(this,new pc)}H(vc,Q);vc.prototype.add=function(a,b,c,d,e,f){(!D(a)||!D(c)||!D(d)||!D(e)||!D(f))&&m(Error("Invalid color table entry."));this.pb.set(a,[b,c,d,e,f]);this.g=q};function wc(a,b,c){this.x=ja(a)?a:0;this.y=ja(b)?b:0;this.b=ja(c)?c:0}wc.prototype.h=function(){return new wc(this.x,this.y,this.b)};function S(a,b,c){this.x=a;this.y=b;this.b=c}H(S,wc);w=S.prototype;w.h=function(){return new S(this.x,this.y,this.b)};w.eb=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.b*this.b)};w.scale=function(a){this.x*=a;this.y*=a;this.b*=a;return this};w.D=function(){this.x=-this.x;this.y=-this.y;this.b=-this.b;return this};w.normalize=function(){return this.scale(1/this.eb())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.b+=a.b;return this};
w.la=function(a){this.x-=a.x;this.y-=a.y;this.b-=a.b;return this};function xc(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.b-b.b;return c*c+d*d+e*e}function yc(a,b){return new S(a.x+b.x,a.y+b.y,a.b+b.b)}function zc(a,b){return new S(a.y*b.b-a.b*b.y,a.b*b.x-a.x*b.b,a.x*b.y-a.y*b.x)};L.f=S;w=L.f.prototype;w.h=S.prototype.h;w.eb=S.prototype.eb;w.scale=S.prototype.scale;w.D=S.prototype.D;w.add=S.prototype.add;w.la=S.prototype.la;w.normalize=function(){var a=this.eb();return 0==a?this.scale(0):this.scale(1/a)};L.f.Cb=function(a,b){return a.x*b.x+a.y*b.y+a.b*b.b};L.f.Yb=zc;L.f.Ab=function(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.b-b.b;return Math.sqrt(c*c+d*d+e*e)};L.f.Ad=function(a,b,c){return new S(a.x+c*(b.x-a.x),a.y+c*(b.y-a.y),a.b+c*(b.b-a.b))};L.f.prototype.__defineGetter__("xx",u("x"));
L.f.prototype.__defineGetter__("yy",u("y"));L.f.prototype.__defineGetter__("zz",u("b"));F("X.vector",L.f);F("X.vector.prototype.clone",L.f.prototype.h);F("X.vector.prototype.magnitude",L.f.prototype.eb);F("X.vector.prototype.scale",L.f.prototype.scale);F("X.vector.prototype.invert",L.f.prototype.D);F("X.vector.prototype.normalize",L.f.prototype.normalize);F("X.vector.prototype.add",L.f.prototype.add);F("X.vector.prototype.subtract",L.f.prototype.la);F("X.vector.dot",L.f.Cb);F("X.vector.cross",L.f.Yb);
F("X.vector.distance",L.f.Ab);F("X.vector.lerp",L.f.Ad);function Ac(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Ac.prototype.BYTES_PER_ELEMENT=8;Ac.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Ac.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{Ac.BYTES_PER_ELEMENT=8}catch(Bc){}Ac.prototype.BYTES_PER_ELEMENT=Ac.prototype.BYTES_PER_ELEMENT;Ac.prototype.set=Ac.prototype.set;Ac.prototype.toString=Ac.prototype.toString;F("Float64Array",Ac)};function Cc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Cc.prototype.BYTES_PER_ELEMENT=4;Cc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Cc.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(Cc.BYTES_PER_ELEMENT=4,Cc.prototype.BYTES_PER_ELEMENT=Cc.prototype.BYTES_PER_ELEMENT,Cc.prototype.set=Cc.prototype.set,Cc.prototype.toString=Cc.prototype.toString,F("Float32Array",Cc));function Dc(a,b,c,d,e,f,g,h,j,l,k,p,t,v,y,A,C){a[0]=b;a[1]=c;a[2]=d;a[3]=e;a[4]=f;a[5]=g;a[6]=h;a[7]=j;a[8]=l;a[9]=k;a[10]=p;a[11]=t;a[12]=v;a[13]=y;a[14]=A;a[15]=C;return a}function Ec(a,b,c){b*=4;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3]}function Fc(a,b,c){b*=4;c[0]=a[b];c[1]=a[b+1];c[2]=a[b+2];c[3]=a[b+3]}function Gc(a,b,c,d,e){a[b]=c;a[b+4]=d;a[b+8]=e;a[b+12]=0}function Hc(a,b,c){a[b]=c[0];a[b+4]=c[1];a[b+8]=c[2];a[b+12]=c[3]}
function Ic(a,b,c){c[0]=a[b];c[1]=a[b+4];c[2]=a[b+8];c[3]=a[b+12]}function Jc(a,b,c,d){var e=a[1]*b+a[5]*c+a[9]*d+a[13],f=a[2]*b+a[6]*c+a[10]*d+a[14],g=a[3]*b+a[7]*c+a[11]*d+a[15];a[12]=a[0]*b+a[4]*c+a[8]*d+a[12];a[13]=e;a[14]=f;a[15]=g;return a}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);L.d={};L.d.Sf=function(a,b,c,d){c=c.la(b);c.normalize();d=L.f.Yb(c,d);d.normalize();var e=L.f.Yb(d,c);e.normalize();c.D();Gc(a,0,d.x,d.y,d.b);Gc(a,1,e.x,e.y,e.b);Gc(a,2,c.x,c.y,c.b);Jc(a,-b.x,-b.y,-b.b);return a};L.d.Na=function(a,b,c,d){var e=1/(b*a[3]+c*a[7]+d*a[11]+a[15]);return new L.f((b*a[0]+c*a[4]+d*a[8]+a[12])*e,(b*a[1]+c*a[5]+d*a[9]+a[13])*e,(b*a[2]+c*a[6]+d*a[10]+a[14])*e)};L.d.Ii=function(a,b,c){var d=new Float32Array(4),e=new Float32Array(4);Ic(a,b,d);Ic(a,c,e);Hc(a,b,e);Hc(a,c,d);return a};
L.d.Hi=function(a,b,c){var d=new Float32Array(4),e=new Float32Array(4);Fc(a,b,d);Fc(a,c,e);Ec(a,b,e);Ec(a,c,d);return a};L.d.Oc=function(){var a=new Float32Array(16);a[0]=a[5]=a[10]=a[15]=1;return a};L.d.h=function(a){var b=new Float32Array(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};
L.d.jg=function(a,b){if(b==a){var c=a[1],d=a[2],e=a[3],f=a[6],g=a[7],h=a[11];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=c;b[6]=a[9];b[7]=a[13];b[8]=d;b[9]=f;b[11]=a[14];b[12]=e;b[13]=g;b[14]=h}else b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15];return b};
L.d.Rg=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],j=a[7],l=a[8],k=a[9],p=a[10],t=a[11],v=a[12],y=a[13],A=a[14];a=a[15];return(b*g-c*f)*(p*a-t*A)-(b*h-d*f)*(k*a-t*y)+(b*j-e*f)*(k*A-p*y)+(c*h-d*g)*(l*a-t*v)-(c*j-e*g)*(l*A-p*v)+(d*j-e*h)*(l*y-k*v)};
L.d.D=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],j=a[6],l=a[7],k=a[8],p=a[9],t=a[10],v=a[11],y=a[12],A=a[13],C=a[14],E=a[15],x=c*h-d*g,B=c*j-e*g,G=c*l-f*g,I=d*j-e*h,M=d*l-f*h,J=e*l-f*j,K=k*A-p*y,O=k*C-t*y,aa=k*E-v*y,T=p*C-t*A,ba=p*E-v*A,ia=t*E-v*C,W=x*ia-B*ba+G*T+I*aa-M*O+J*K;if(0==W)return s;W=1/W;b[0]=(h*ia-j*ba+l*T)*W;b[1]=(-d*ia+e*ba-f*T)*W;b[2]=(A*J-C*M+E*I)*W;b[3]=(-p*J+t*M-v*I)*W;b[4]=(-g*ia+j*aa-l*O)*W;b[5]=(c*ia-e*aa+f*O)*W;b[6]=(-y*J+C*G-E*B)*W;b[7]=(k*J-t*G+v*B)*W;b[8]=
(g*ba-h*aa+l*K)*W;b[9]=(-c*ba+d*aa-f*K)*W;b[10]=(y*M-A*G+E*x)*W;b[11]=(-k*M+p*G-v*x)*W;b[12]=(-g*T+h*O-j*K)*W;b[13]=(c*T-d*O+e*K)*W;b[14]=(-y*I+A*B-C*x)*W;b[15]=(k*I-p*B+t*x)*W;return q};L.d.Be=function(a,b,c,d,e){var f=b/2;b=e-d;var g=Math.sin(f);if(0==b||0==g||0==c)return a;f=Math.cos(f)/g;return Dc(a,f/c,0,0,0,0,f,0,0,0,0,-(e+d)/b,-1,0,0,-(2*d*e)/b,0)};L.d.xh=function(a,b,c,d,e,f,g){return Dc(a,2*f/(c-b),0,0,0,0,2*f/(e-d),0,0,(c+b)/(c-b),(e+d)/(e-d),-(g+f)/(g-f),-1,0,0,-(2*g*f)/(g-f),0)};
L.d.yh=function(a,b,c,d,e,f,g){return Dc(a,2/(c-b),0,0,0,0,2/(e-d),0,0,0,0,-2/(g-f),0,-(c+b)/(c-b),-(e+d)/(e-d),-(g+f)/(g-f),1)};
L.d.multiply=function(a,b,c){var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],j=a[5],l=a[6],k=a[7],p=a[8],t=a[9],v=a[10],y=a[11],A=a[12],C=a[13],E=a[14];a=a[15];var x=b[0],B=b[1],G=b[2],I=b[3],M=b[4],J=b[5],K=b[6],O=b[7],aa=b[8],T=b[9],ba=b[10],ia=b[11],W=b[12],ka=b[13],Ub=b[14];b=b[15];c[0]=d*x+h*B+p*G+A*I;c[1]=e*x+j*B+t*G+C*I;c[2]=f*x+l*B+v*G+E*I;c[3]=g*x+k*B+y*G+a*I;c[4]=d*M+h*J+p*K+A*O;c[5]=e*M+j*J+t*K+C*O;c[6]=f*M+l*J+v*K+E*O;c[7]=g*M+k*J+y*K+a*O;c[8]=d*aa+h*T+p*ba+A*ia;c[9]=e*aa+j*T+t*ba+C*ia;c[10]=f*
aa+l*T+v*ba+E*ia;c[11]=g*aa+k*T+y*ba+a*ia;c[12]=d*W+h*ka+p*Ub+A*b;c[13]=e*W+j*ka+t*Ub+C*b;c[14]=f*W+l*ka+v*Ub+E*b;c[15]=g*W+k*ka+y*Ub+a*b;return c};L.d.translate=Jc;L.d.scale=function(a,b,c,d){return Dc(a,a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*c,a[5]*c,a[6]*c,a[7]*c,a[8]*d,a[9]*d,a[10]*d,a[11]*d,a[12],a[13],a[14],a[15])};
L.d.rotate=function(a,b,c,d,e){var f=a[0],g=a[1],h=a[2],j=a[3],l=a[4],k=a[5],p=a[6],t=a[7],v=a[8],y=a[9],A=a[10],C=a[11],E=Math.cos(b),x=Math.sin(b),B=1-E;b=c*c*B+E;var G=c*d*B+e*x,I=c*e*B-d*x,M=c*d*B-e*x,J=d*d*B+E,K=d*e*B+c*x,O=c*e*B+d*x;c=d*e*B-c*x;e=e*e*B+E;return Dc(a,f*b+l*G+v*I,g*b+k*G+y*I,h*b+p*G+A*I,j*b+t*G+C*I,f*M+l*J+v*K,g*M+k*J+y*K,h*M+p*J+A*K,j*M+t*J+C*K,f*O+l*c+v*e,g*O+k*c+y*e,h*O+p*c+A*e,j*O+t*c+C*e,a[12],a[13],a[14],a[15])};
L.d.Gd=function(a,b){var c=a[4],d=a[5],e=a[6],f=a[7],g=a[8],h=a[9],j=a[10],l=a[11],k=Math.cos(b),p=Math.sin(b);a[4]=c*k+g*p;a[5]=d*k+h*p;a[6]=e*k+j*p;a[7]=f*k+l*p;a[8]=c*-p+g*k;a[9]=d*-p+h*k;a[10]=e*-p+j*k;a[11]=f*-p+l*k;return a};L.d.Hd=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[8],h=a[9],j=a[10],l=a[11],k=Math.cos(b),p=Math.sin(b);a[0]=c*k+g*-p;a[1]=d*k+h*-p;a[2]=e*k+j*-p;a[3]=f*k+l*-p;a[8]=c*p+g*k;a[9]=d*p+h*k;a[10]=e*p+j*k;a[11]=f*p+l*k;return a};
L.d.Id=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],j=a[6],l=a[7],k=Math.cos(b),p=Math.sin(b);a[0]=c*k+g*p;a[1]=d*k+h*p;a[2]=e*k+j*p;a[3]=f*k+l*p;a[4]=c*-p+g*k;a[5]=d*-p+h*k;a[6]=e*-p+j*k;a[7]=f*-p+l*k;return a};F("X.matrix.identity",L.d.Oc);F("X.matrix.clone",L.d.h);F("X.matrix.transpose",L.d.jg);F("X.matrix.determinant",L.d.Rg);F("X.matrix.invert",L.d.D);F("X.matrix.multiply",L.d.multiply);F("X.matrix.multiplyByVector",L.d.Na);F("X.matrix.makePerspective",L.d.Be);
F("X.matrix.makeFrustum",L.d.xh);F("X.matrix.makeOrtho",L.d.yh);F("X.matrix.makeLookAt",L.d.Sf);F("X.matrix.translate",L.d.translate);F("X.matrix.scale",L.d.scale);F("X.matrix.rotate",L.d.rotate);F("X.matrix.rotateX",L.d.Gd);F("X.matrix.rotateY",L.d.Hd);F("X.matrix.rotateZ",L.d.Id);F("X.matrix.swapRows",L.d.Ii);F("X.matrix.swapCols",L.d.Hi);function Kc(){Q.call(this);this.c="transform";this.ia=L.d.Oc()}H(Kc,Q);Kc.prototype.__defineGetter__("matrix",u("ia"));Kc.prototype.__defineSetter__("matrix",function(a){(a==r||!(a instanceof Float32Array))&&m(Error("Invalid matrix."));this.ia=a;this.o()});w=Kc.prototype;w.Gd=function(a){(!D(a)||-360>a||360<a)&&m(Error("Invalid angle."));L.d.Gd(this.ia,a*Math.PI/180);this.o()};w.Hd=function(a){(!D(a)||-360>a||360<a)&&m(Error("Invalid angle."));L.d.Hd(this.ia,a*Math.PI/180);this.o()};
w.Id=function(a){(!D(a)||-360>a||360<a)&&m(Error("Invalid angle."));L.d.Id(this.ia,a*Math.PI/180);this.o()};w.Ki=function(a){D(a)||m(Error("Invalid distance."));L.d.translate(this.ia,a,0,0);this.o()};w.Li=function(a){D(a)||m(Error("Invalid distance."));L.d.translate(this.ia,0,a,0);this.o()};w.Mi=function(a){D(a)||m(Error("Invalid distance."));L.d.translate(this.ia,0,0,a);this.o()};function Lc(a,b,c){a.ia[b+4*c]*=-1;a.o()}w.Yg=function(){Lc(this,0,0)};w.Zg=function(){Lc(this,1,1)};
w.$g=function(){Lc(this,2,2)};w.o=function(){this.g=q};F("X.transform",Kc);F("X.transform.prototype.rotateX",Kc.prototype.Gd);F("X.transform.prototype.rotateY",Kc.prototype.Hd);F("X.transform.prototype.rotateZ",Kc.prototype.Id);F("X.transform.prototype.translateX",Kc.prototype.Ki);F("X.transform.prototype.translateY",Kc.prototype.Li);F("X.transform.prototype.translateZ",Kc.prototype.Mi);F("X.transform.prototype.flipX",Kc.prototype.Yg);F("X.transform.prototype.flipY",Kc.prototype.Zg);
F("X.transform.prototype.flipZ",Kc.prototype.$g);F("X.transform.prototype.modified",Kc.prototype.o);function Mc(){Q.call(this);this.c="texture";this.va=this.jb=this.p=r;this.wb=this.xb=0;Fa(this,new pc)}H(Mc,Q);F("X.texture",Mc);function U(a,b){Q.call(this);this.c="triplets";this.Ob=Infinity;this.Lb=-Infinity;this.Pb=Infinity;this.Mb=-Infinity;this.Qb=Infinity;this.Nb=-Infinity;this.Vc=[0,0,0];this.df=q;this.B=0;this.L=new Float32Array(a);b!=r&&(this.L=b.L.subarray(0,b.L.length),this.B=this.L.length,this.Ob=b.Ob,this.Lb=b.Lb,this.Pb=b.Pb,this.Mb=b.Mb,this.Qb=b.Qb,this.Nb=b.Nb,this.Vc=b.Vc.slice(),this.df=s)}H(U,Q);w=U.prototype;
w.add=function(a,b,c){this.Ob=Math.min(this.Ob,a);this.Lb=Math.max(this.Lb,a);this.Pb=Math.min(this.Pb,b);this.Mb=Math.max(this.Mb,b);this.Qb=Math.min(this.Qb,c);this.Nb=Math.max(this.Nb,c);this.Vc=[(this.Ob+this.Lb)/2,(this.Pb+this.Mb)/2,(this.Qb+this.Nb)/2];this.df=s;this.g=q;this.L[this.B++]=a;this.L[this.B++]=b;this.L[this.B++]=c;return this.B/3};w.fb=function(){if(this.B!=this.L.length){var a=new Float32Array(this.B);a.set(this.L.subarray(0,this.B));this.L=a}};
w.get=function(a){a*=3;return[this.L[a],this.L[a+1],this.L[a+2]]};w.remove=function(){m(Error("Not implemented."))};w.clear=function(){this.L=new Float32Array(this.L.length);this.g=q};U.prototype.__defineGetter__("count",function(){this.fb();return this.L.length/3});U.prototype.__defineGetter__("length",function(){this.fb();return this.L.length});F("X.triplets",U);F("X.triplets.prototype.add",U.prototype.add);F("X.triplets.prototype.resize",U.prototype.fb);F("X.triplets.prototype.get",U.prototype.get);
F("X.triplets.prototype.remove",U.prototype.remove);F("X.triplets.prototype.clear",U.prototype.clear);function Nc(){this.ja=Oc;this.Wb=new Kc;this.Gb=[1,1,1];this.Vb=this.z=this.W=this.j=this.i=r;this.kc=[];this.Ja=q;this.jc=this.Ec=1;this.fc=r;this.xc=s;this.Z=1;this.K=0}var Oc="TRIANGLES";Nc.prototype.__defineSetter__("type",function(a){return this.ja=a});Nc.prototype.__defineGetter__("type",u("ja"));Nc.prototype.__defineGetter__("texture",function(){this.z||(this.z=new Mc);return this.z});Nc.prototype.__defineGetter__("transform",u("Wb"));Nc.prototype.__defineGetter__("points",u("i"));
Nc.prototype.__defineSetter__("points",da("i"));Nc.prototype.__defineGetter__("normals",u("j"));Nc.prototype.__defineSetter__("normals",da("j"));Nc.prototype.__defineGetter__("colors",u("W"));Nc.prototype.__defineSetter__("colors",da("W"));Nc.prototype.__defineGetter__("color",u("Gb"));Nc.prototype.__defineSetter__("color",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid color."));for(var b=this.e,c=b.length,d=0,d=0;d<c;d++)b[d].color=a;this.Gb=a;this.g=q});
Nc.prototype.__defineGetter__("opacity",u("Z"));Nc.prototype.__defineSetter__("opacity",function(a){(!D(a)||1<a||0>a)&&m(Error("Invalid opacity."));for(var b=this.e,c=b.length,d=0,d=0;d<c;d++)b[d].opacity=a;this.Z=a;this.g=q});Nc.prototype.__defineGetter__("caption",u("fc"));Nc.prototype.__defineSetter__("caption",function(a){this.fc=a;this.g=q});Nc.prototype.__defineGetter__("visible",u("Ja"));
Nc.prototype.__defineSetter__("visible",function(a){for(var b=this.e,c=b.length,d=0,d=0;d<c;d++)b[d].visible=a;this.Ja=a;this.g=q});Nc.prototype.__defineGetter__("pointsize",u("Ec"));Nc.prototype.__defineSetter__("pointsize",function(a){D(a)||m(Error("Invalid point size."));this.Ec=a;this.g=q});Nc.prototype.__defineGetter__("magicmode",u("xc"));Nc.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&m(Error("Invalid magic mode setting."));this.xc=a;this.g=q});
Nc.prototype.__defineGetter__("linewidth",u("jc"));Nc.prototype.__defineSetter__("linewidth",function(a){D(a)||m(Error("Invalid line width."));this.jc=a;this.g=q});function Pc(){this.Ia=Infinity;this.P=this.Fa=-Infinity;this.S=Infinity;this.sb=[0,0,0];this.qb=[1,1,1]}Pc.prototype.__defineGetter__("lowerThreshold",u("P"));Pc.prototype.__defineSetter__("lowerThreshold",da("P"));Pc.prototype.__defineGetter__("upperThreshold",u("S"));Pc.prototype.__defineSetter__("upperThreshold",da("S"));Pc.prototype.__defineGetter__("min",u("Ia"));Pc.prototype.__defineGetter__("max",u("Fa"));Pc.prototype.__defineGetter__("minColor",u("sb"));
Pc.prototype.__defineSetter__("minColor",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid min. color."));this.sb=a});Pc.prototype.__defineGetter__("maxColor",u("qb"));Pc.prototype.__defineSetter__("maxColor",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid max. color."));this.qb=a});function Qc(){Q.call(this);this.c="scalars";this.sc=this.v=r;this.pf=q;this.Sd=0;Fa(this,new pc);Fa(this,new Pc);this.sb=[0,1,0];this.qb=[1,0,0]}H(Qc,Q);Qc.prototype.__defineGetter__("array",u("v"));Qc.prototype.__defineSetter__("array",function(a){this.sc=this.v=a;this.g=q});Qc.prototype.__defineGetter__("interpolation",u("Sd"));Qc.prototype.__defineSetter__("interpolation",da("Sd"));F("X.scalars",Qc);function V(a){Q.call(this);this.c="object";this.e=[];this.u=this.$=r;Fa(this,new Nc);a!=r&&this.Xb(a)}H(V,Q);
V.prototype.Xb=function(a){this.ja=a.ja;this.Wb=new Kc;this.Wb.ia=new Float32Array(a.Wb.ia);this.Gb=a.Gb.slice();a.i&&(this.i=new U(a.i.length,a.i));a.j&&(this.j=new U(a.j.length,a.j));a.W&&(this.W=new U(a.W.length,a.W));this.z=a.z;this.Vb=a.Vb;a.p&&(this.p=new oc((new String(a.p.dd)).toString()));this.Z=a.Z;this.e.length=0;var b=a.e;if(b)for(var c=b.length,d=0,d=0;d<c;d++)this.e.push(new L[b[d].c](b[d]));this.Ja=a.Ja;this.Ec=a.Ec;this.jc=a.jc;a.fc&&(this.fc=(new String(a.fc)).toString());this.xc=
a.xc;this.kc=a.kc.slice();this.g=q};V.prototype.__defineGetter__("colortable",function(){this.$||(this.$=new vc);return this.$});V.prototype.__defineGetter__("scalars",function(){this.u||(this.u=new Qc);return this.u});V.prototype.__defineGetter__("children",u("e"));V.prototype.o=function(){var a=new Rc;a.Y=this;this.dispatchEvent(a)};
function Sc(a,b){(a==r||b==r||!(a instanceof V)||!(b instanceof V))&&m(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.Z?-1:1==b.Z?1:a.K!=r&&b.K!=r&&a.K>b.K?-1:1}F("X.object",V);F("X.object.prototype.modified",V.prototype.o);function Tc(){}function Uc(a){for(var b=a.i.count,c=[],d=0,d=0;d<b;d+=3){var e=a.i.get(d),f=a.i.get(d+1),g=a.i.get(d+2),h=a.j.get(d),j=a.j.get(d+1),l=a.j.get(d+2),k=a.Gb;a.W&&0<a.W.length&&(k=a.W.get(d));var p=[];p.push(new cc(e,h));p.push(new cc(f,j));p.push(new cc(g,l));c.push(new ec(p,k))}return mc(c)}
function Vc(a,b){(b==r||!(b instanceof lc))&&m(Error("Invalid CSG object."));var c=new nc,d=[];Gb(b.A,function(a){var b=[],g=a.Md,b=Gb(a.hb,function(a){a.color=g;return c.add(a)});for(a=a=2;a<b.length;a++)d.push([b[0],b[a-1],b[a]])}.bind(a));a.wg=Gb(c.unique(),function(a){return[a.Aa.x(),a.Aa.y(),a.Aa.b()]});a.vg=Gb(c.unique(),function(a){return[a.ba.x(),a.ba.y(),a.ba.b()]});a.ug=Gb(c.unique(),function(a){return!a.color?r:[a.color[0],a.color[1],a.color[2]]});a.i=new U(9*d.length);a.j=new U(9*d.length);
a.W=new U(9*d.length);Gb(d,function(a){var b=a[0],c=a[1];a=a[2];var d=this.wg,j=this.vg,l=this.ug;this.i.add(d[b][0],d[b][1],d[b][2]);this.i.add(d[c][0],d[c][1],d[c][2]);this.i.add(d[a][0],d[a][1],d[a][2]);this.j.add(j[b][0],j[b][1],j[b][2]);this.j.add(j[c][0],j[c][1],j[c][2]);this.j.add(j[a][0],j[a][1],j[a][2]);l[b]&&this.W.add(l[b][0],l[b][1],l[b][2]);l[c]&&this.W.add(l[c][0],l[c][1],l[c][2]);l[a]&&this.W.add(l[a][0],l[a][1],l[a][2])}.bind(a));0==a.W.B&&(a.W=r);a.ja=Oc}
Tc.prototype.Ve=function(a){(a==r||!(a instanceof lc)&&!(a instanceof V))&&m(Error("Invalid object."));var b=a;a instanceof V&&(b=Uc(b));a=new V;Fa(a,new Tc);Vc(a,Uc(this).Ve(b));return a};Tc.prototype.la=function(a){(a==r||!(a instanceof lc)&&!(a instanceof V))&&m(Error("Invalid object."));var b=a;a instanceof V&&(b=Uc(b));a=new V;Fa(a,new Tc);Vc(a,Uc(this).la(b));return a};
Tc.prototype.ze=function(a){(a==r||!(a instanceof lc)&&!(a instanceof V))&&m(Error("Invalid object."));var b=a;a instanceof V&&(b=Uc(b));a=new V;Fa(a,new Tc);Vc(a,Uc(this).ze(b));return a};Tc.prototype.inverse=function(){var a=new V;Fa(a,new Tc);Vc(a,Uc(this).inverse());return a};F("X.constructable",Tc);F("X.constructable.prototype.intersect",Tc.prototype.ze);F("X.constructable.prototype.inverse",Tc.prototype.inverse);F("X.constructable.prototype.subtract",Tc.prototype.la);
F("X.constructable.prototype.union",Tc.prototype.Ve);function Wc(a){vb.call(this,a);this.c="event"}H(Wc,vb);var Xc=ac("pan"),Yc=ac("rotate"),Zc=ac("zoom"),$c=ac("scroll");ac("render");var ad=ac("resetview"),bd=ac("windowlevel"),cd=ac("modified"),dd=ac("progress"),ed=ac("hover"),fd=ac("hover_end");function gd(){Wc.call(this,bd);this.Yd=this.ke=0}H(gd,Wc);function hd(){Wc.call(this,Xc);this.K=new L.f(0,0,0)}H(hd,Wc);function id(){Wc.call(this,Yc);this.K=new L.f(0,0,0)}H(id,Wc);function jd(){Wc.call(this,Zc);this.Ha=this.Qa=s}H(jd,Wc);
function kd(){Wc.call(this,$c);this.I=s}H(kd,Wc);function ld(){Wc.call(this,ed);this.md=this.ld=0}H(ld,Wc);function md(){Wc.call(this,fd)}H(md,Wc);function nd(){Wc.call(this,ad)}H(nd,Wc);function Rc(){Wc.call(this,cd);this.r=this.Y=r}H(Rc,Wc);function od(){Wc.call(this,dd);this.rf=0}H(od,Wc);function pd(a,b,c){a==r&&m(Error("Invalid GL Buffer."));b==r&&m(Error("Invalid number of items."));c==r&&m(Error("Invalid item size."));Q.call(this);this.c="buffer";this.ha=a;this.nb=b;this.ob=c}H(pd,Q);function qd(a,b){this.x=ja(a)?a:0;this.y=ja(b)?b:0}w=qd.prototype;w.h=function(){return new qd(this.x,this.y)};function rd(a,b){return new qd(a.x-b.x,a.y-b.y)}w.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};w.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};w.translate=function(a,b){a instanceof qd?(this.x+=a.x,this.y+=a.y):(this.x+=a,D(b)&&(this.y+=b));return this};w.scale=function(a,b){var c=D(b)?b:a;this.x*=a;this.y*=c;return this};function sd(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}w=sd.prototype;w.h=function(){return new sd(this.top,this.right,this.bottom,this.left)};w.contains=function(a){return!this||!a?s:a instanceof sd?a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom:a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom};
w.floor=function(){this.top=Math.floor(this.top);this.right=Math.floor(this.right);this.bottom=Math.floor(this.bottom);this.left=Math.floor(this.left);return this};w.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};w.translate=function(a,b){a instanceof qd?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,D(b)&&(this.top+=b,this.bottom+=b));return this};
w.scale=function(a,b){var c=D(b)?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};function td(a,b){this.width=a;this.height=b}td.prototype.h=function(){return new td(this.width,this.height)};td.prototype.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};td.prototype.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};td.prototype.scale=function(a,b){var c=D(b)?b:a;this.width*=a;this.height*=c;return this};function ud(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}w=ud.prototype;w.h=function(){return new ud(this.left,this.top,this.width,this.height)};w.Nf=function(a){var b=Math.max(this.left,a.left),c=Math.min(this.left+this.width,a.left+a.width);if(b<=c){var d=Math.max(this.top,a.top);a=Math.min(this.top+this.height,a.top+a.height);if(d<=a)return this.left=b,this.top=d,this.width=c-b,this.height=a-d,q}return s};
w.contains=function(a){return a instanceof ud?this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height:a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height};w.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};
w.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};w.translate=function(a,b){a instanceof qd?(this.left+=a.x,this.top+=a.y):(this.left+=a,D(b)&&(this.top+=b));return this};w.scale=function(a,b){var c=D(b)?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};var vd;function wd(a,b){var c;c=a.className;c=ma(c)&&c.match(/\S+/g)||[];for(var d=Jb(arguments,1),e=c.length+d.length,f=c,g=0;g<d.length;g++)0<=Eb(f,d[g])||f.push(d[g]);a.className=c.join(" ");return c.length==e};var xd=!N||N&&9<=sb;!cb&&!N||N&&N&&9<=sb||cb&&qb("1.9.1");N&&qb("9");function yd(a){return a?new zd(Ad(a)):vd||(vd=new zd)}function Bd(a){return ma(a)?document.getElementById(a):a}var Cd={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function Dd(a,b,c){return Ed(document,arguments)}
function Ed(a,b){var c=b[0],d=b[1];if(!xd&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',Ka(d.name),'"');if(d.type){c.push(' type="',Ka(d.type),'"');var e={};Ab(e,d);delete e.type;d=e}c.push(">");c=c.join("")}var f=a.createElement(c);if(d)if(ma(d))f.className=d;else if(z(d))wd.apply(r,[f].concat(d));else{var c=function(a,b){"style"==b?f.style.cssText=a:"class"==b?f.className=a:"for"==b?f.htmlFor=a:b in Cd?f.setAttribute(Cd[b],a):0==b.lastIndexOf("aria-",0)||0==b.lastIndexOf("data-",0)?f.setAttribute(b,
a):f[b]=a},g;for(g in d)c.call(n,d[g],g)}if(2<b.length){g=function(b){b&&f.appendChild(ma(b)?a.createTextNode(b):b)};for(d=2;d<b.length;d++)if(e=b[d],la(e)&&!(oa(e)&&0<e.nodeType)){var c=Fb,h;a:{if((h=e)&&"number"==typeof h.length){if(oa(h)){h="function"==typeof h.item||"string"==typeof h.item;break a}if(na(h)){h="function"==typeof h.item;break a}}h=s}if(h)if(h=e.length,0<h){for(var j=Array(h),l=0;l<h;l++)j[l]=e[l];e=j}else e=[];c(e,g)}else g(e)}return f}
function Fd(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function Gd(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}function Hd(a,b){if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}function Ad(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function zd(a){this.N=a||fa.document||document}w=zd.prototype;w.ud=yd;
w.l=function(a){return ma(a)?this.N.getElementById(a):a};w.og=zd.prototype.l;w.lc=function(a,b,c){return Ed(this.N,arguments)};w.createElement=function(a){return this.N.createElement(a)};w.createTextNode=function(a){return this.N.createTextNode(String(a))};function Id(a){return"CSS1Compat"==a.N.compatMode}function Jd(a){var b=a.N;a=!eb&&"CSS1Compat"==b.compatMode?b.documentElement:b.body;b=b.parentWindow||b.defaultView;return new qd(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}
w.appendChild=function(a,b){a.appendChild(b)};w.contains=Hd;function Kd(a,b){var c=Ad(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,r))?c[b]||c.getPropertyValue(b)||"":""}function Ld(a,b){return Kd(a,b)||(a.currentStyle?a.currentStyle[b]:r)||a.style&&a.style[b]}function Md(a){a=a?Ad(a):document;return N&&!(N&&9<=sb)&&!Id(yd(a))?a.body:a.documentElement}
function Nd(a){var b=a.getBoundingClientRect();N&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function Od(a){if(N&&!(N&&8<=sb))return a.offsetParent;var b=Ad(a),c=Ld(a,"position"),d="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=Ld(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return r}
function Pd(a){for(var b=new sd(0,Infinity,Infinity,0),c=yd(a),d=c.N.body,e=c.N.documentElement,f=!eb&&"CSS1Compat"==c.N.compatMode?c.N.documentElement:c.N.body;a=Od(a);)if((!N||0!=a.clientWidth)&&(!eb||0!=a.clientHeight||a!=d)&&a!=d&&a!=e&&"visible"!=Ld(a,"overflow")){var g=Qd(a),h;h=a;if(cb&&!qb("1.9")){var j=parseFloat(Kd(h,"borderLeftWidth"));if(Rd(h))var l=h.offsetWidth-h.clientWidth-j-parseFloat(Kd(h,"borderRightWidth")),j=j+l;h=new qd(j,parseFloat(Kd(h,"borderTopWidth")))}else h=new qd(h.clientLeft,
h.clientTop);g.x+=h.x;g.y+=h.y;b.top=Math.max(b.top,g.y);b.right=Math.min(b.right,g.x+a.clientWidth);b.bottom=Math.min(b.bottom,g.y+a.clientHeight);b.left=Math.max(b.left,g.x)}d=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=(c.N.parentWindow||c.N.defaultView||window).document;c="CSS1Compat"==c.compatMode?c.documentElement:c.body;c=new td(c.clientWidth,c.clientHeight);b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&
b.bottom>b.top&&b.right>b.left?b:r}
function Qd(a){var b,c=Ad(a),d=Ld(a,"position"),e=cb&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new qd(0,0),g=Md(c);if(a==g)return f;if(a.getBoundingClientRect)b=Nd(a),a=Jd(yd(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(g),f.x=b.screenX-a.screenX,f.y=b.screenY-a.screenY;else{b=a;do{f.x+=b.offsetLeft;f.y+=b.offsetTop;b!=a&&(f.x+=b.clientLeft||0,f.y+=b.clientTop||0);
if(eb&&"fixed"==Ld(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(bb||eb&&"absolute"==d)f.y-=c.body.offsetTop;for(b=a;(b=Od(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,!bb||"TR"!=b.tagName)f.y-=b.scrollTop}return f}function Sd(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}
function Td(a){if("none"!=Ld(a,"display"))return Ud(a);var b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=Ud(a);b.display=c;b.position=e;b.visibility=d;return a}function Ud(a){var b=a.offsetWidth,c=a.offsetHeight,d=eb&&!b&&!c;return(!ja(b)||d)&&a.getBoundingClientRect?(a=Nd(a),new td(a.right-a.left,a.bottom-a.top)):new td(b,c)}function Vd(a,b){a.style.display=b?"":"none"}function Rd(a){return"rtl"==Ld(a,"direction")}
function Wd(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var e=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return e}function Xd(a,b){var c=a.currentStyle?a.currentStyle[b]:r;return c?Wd(a,c):0}var Yd={thin:2,medium:4,thick:6};function Zd(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:r))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:r;return c in Yd?Yd[c]:Wd(a,c)}
var $d=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function ae(a,b){tb.call(this);this.s=a;var c=oa(this.s)&&1==this.s.nodeType?this.s:this.s?this.s.body:r;this.vh=!!c&&Rd(c);this.Mj=P(this.s,cb?"DOMMouseScroll":"mousewheel",this,b)}H(ae,bc);
ae.prototype.handleEvent=function(a){var b=0,c=0,d=0;a=a.Ma;if("mousewheel"==a.type){c=1;if(N||eb&&(Wa||qb("532.0")))c=40;d=be(-a.wheelDelta,c);ja(a.wheelDeltaX)?(b=be(-a.wheelDeltaX,c),c=be(-a.wheelDeltaY,c)):c=d}else d=a.detail,100<d?d=3:-100>d&&(d=-3),ja(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=d:c=d;D(this.Tf)&&(b=Math.min(Math.max(b,-this.Tf),this.Tf));D(this.Uf)&&(c=Math.min(Math.max(c,-this.Uf),this.Uf));this.vh&&(b=-b);b=new ce(d,a,b,c);this.dispatchEvent(b)};
function be(a,b){return eb&&(Ua||Xa)&&0!=a%b?a:a/b}function ce(a,b,c,d){b&&this.ea(b,n);this.type="mousewheel";this.detail=a;this.Jj=c;this.nc=d}H(ce,Lb);N||eb&&qb("525");function de(a){(a==r||!(a instanceof Element))&&m(Error("Could not add interactor to the given element."));Q.call(this);this.c="interactor";this.ra=a;this.$d=this.hf=this.gf=this.jf=this.ff=this.kf=r;this.Zd=q;this.yb=this.rb=this.Xa=s;this.cd=[0,0];this.Ud=new L.f(0,0,0);this.wc=new L.f(0,0,0);this.Pf=0;this.qf=this.Zc=r;this.F={MOUSEWHEEL_ENABLED:q,MOUSECLICKS_ENABLED:q,KEYBOARD_ENABLED:q,HOVERING_ENABLED:q,CONTEXTMENU_ENABLED:s,TOUCH_ENABLED:q,TOUCH_BOUNCING_ENABLED:s}}H(de,Q);
de.prototype.__defineGetter__("config",u("F"));de.prototype.__defineGetter__("leftButtonDown",u("Xa"));de.prototype.__defineGetter__("middleButtonDown",u("rb"));de.prototype.__defineGetter__("rightButtonDown",u("yb"));
de.prototype.ea=function(){this.F.MOUSEWHEEL_ENABLED?(this.$d=new ae(this.ra),this.kf=P(this.$d,"mousewheel",this.Qc.bind(this))):(Wb(this.kf),this.$d=r);this.F.MOUSECLICKS_ENABLED?(this.ff=P(this.ra,"mousedown",this.Ih.bind(this)),this.jf=P(this.ra,"mouseup",this.Nh.bind(this))):(Wb(this.ff),Wb(this.jf));this.ra.oncontextmenu=this.F.CONTEXTMENU_ENABLED?r:function(){return s};window.onkeydown=this.F.KEYBOARD_ENABLED?this.Zf.bind(this):r;this.F.TOUCH_ENABLED?(this.F.TOUCH_BOUNCING_ENABLED||document.body.addEventListener("touchmove",
function(a){a.preventDefault()},s),this.Dg=P(this.ra,"touchstart",this.ai.bind(this)),this.Cg=P(this.ra,"touchmove",this.Zh.bind(this)),this.Bg=P(this.ra,"touchend",this.Vh.bind(this))):(Wb(this.Dg),Wb(this.Cg),Wb(this.Bg));Wb(this.gf);Wb(this.hf);this.gf=P(this.ra,"mousemove",this.Kh.bind(this));this.hf=P(this.ra,"mouseout",this.Lh.bind(this))};
de.prototype.Ih=function(a){0==a.button?this.Xa=q:1==a.button?this.rb=q:2==a.button&&(this.yb=q);eval("this.onMouseDown("+this.Xa+","+this.rb+","+this.yb+")");ee(this);a.preventDefault()};de.prototype.Hh=ca();de.prototype.Nh=function(a){0==a.button?this.Xa=s:1==a.button?this.rb=s:2==a.button&&(this.yb=s);eval("this.onMouseUp("+this.Xa+","+this.rb+","+this.yb+")");ee(this);a.preventDefault()};de.prototype.__defineGetter__("mousePosition",u("cd"));w=de.prototype;w.Mh=ca();
w.Lh=function(a){this.Zd=s;this.F.KEYBOARD_ENABLED&&(window.onkeydown=r);this.yb=this.rb=this.Xa=s;ee(this);this.Ud=new L.f(0,0,0);a.preventDefault()};w.Jh=ca();w.ai=function(a){a.preventDefault();a.ea(a.Ma.targetTouches[0],a.currentTarget);eval("this.onTouchStart("+a.clientX+","+a.clientY+")");this.wc=new L.f(a.clientX,a.clientY,0);this.qf=setTimeout(this.Xh.bind(this,a),500)};w.$h=ca();
w.Xh=function(a){eval("this.onTouchHover("+a.clientX+","+a.clientY+")");a=new jd;a.Qa=q;a.Ha=this instanceof fe;this.dispatchEvent(a);this.hd=q};w.Wh=ca();function ge(a){clearTimeout(a.qf);if(a.hd){var b=new jd;b.Qa=s;b.Ha=a instanceof fe;a.dispatchEvent(b)}a.hd=s}w.Vh=function(a){a.preventDefault();eval("this.onTouchEnd()");ge(this)};w.Uh=ca();
w.Zh=function(a){a.preventDefault();this.hd||ge(this);this.touchmoveEvent=a=a.Ma;eval("this.onTouchMove(this['touchmoveEvent'])");var b=a.targetTouches;if(1==b.length){a=b[0];var c=[a.clientX,a.clientY];a=new L.f(c[0],c[1],0);var b=c[0]>3*this.ra.clientWidth/4,d=c[0]<this.ra.clientWidth/4,e=c[1]<this.ra.clientHeight/4,c=c[1]>3*this.ra.clientHeight/4,c=!b&&!d&&!e&&!c,e=this.wc.la(a);this.wc=a.h();if(this.hd)a=new hd,5<e.x?e.x=1:-5>e.x&&(e.x=-1),5<e.y?e.y=1:-5>e.y&&(e.y=-1),a.K=e,this.dispatchEvent(a);
else if(this instanceof he&&(b||d))a=new kd,a.I=0>e.y,this.dispatchEvent(a);else if(this instanceof fe||c)e.scale(3),a=new id,a.K=e,this.dispatchEvent(a)}else 2==b.length&&(a=b[0],b=b[1],a=[a.clientX,a.clientY],b=[b.clientX,b.clientY],a=new L.f(a[0],a[1],0),b=new L.f(b[0],b[1],0),e=xc(a,b),b=e-this.Pf,this.Pf=e,this.wc.la(a),this.wc=a.h(),10<Math.abs(b)&&(a=new jd,a.Qa=0<b,a.Ha=this instanceof fe,this.dispatchEvent(a)))};w.Yh=ca();
w.Kh=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.Zd=q;this.F.KEYBOARD_ENABLED&&window.onkeydown==r&&(window.onkeydown=this.Zf.bind(this));a.preventDefault();var b=a.shiftKey;this.cd=[a.offsetX,a.offsetY];var c=new L.f(this.cd[0],this.cd[1],0);a=this.Ud.la(c);this.Ud=c.h();this.F.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.rb||this.Xa||this.yb)&&ee(this),this.Zc=setTimeout(function(){ee(this);var a=new ld;a.ld=c.x;a.md=c.y;this.dispatchEvent(a);
this.Zc=r}.bind(this),300));2>Math.abs(a.x)&&(a.x=0);2>Math.abs(a.y)&&(a.y=0);0!=a.eb()&&(this.Xa&&!b?(b=new id,a.scale(3),b.K=a,this.dispatchEvent(b)):this.rb||this.Xa&&b?(b=new hd,5<a.x?a.x=5:-5>a.x&&(a.x=-5),5<a.y?a.y=5:-5>a.y&&(a.y=-5),b.K=a,this.dispatchEvent(b)):this.yb&&(b=new jd,b.Qa=0<a.y,b.Ha=s,this.dispatchEvent(b)))};function ee(a){a.Zc&&clearTimeout(a.Zc);a.dispatchEvent(new md)}w.Oh=ca();
w.Qc=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");ee(this);a.preventDefault()};w.Fh=ca();
w.Zf=function(a){if(this.Zd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");ee(this);var b=a.altKey,c=a.ctrlKey,d=a.metaKey,e=a.shiftKey,f=a.keyCode;82==f&&!b&&!c&&!d&&!e?(a.preventDefault(),a=new nd,this.dispatchEvent(a)):37<=f&&40>=f&&(a.preventDefault(),e?a=new hd:b?a=new jd:(a=new id,this instanceof he&&(a=new kd)),a&&(c=new L.f(0,0,0),37==f?(c.x=5,a.I=s,b&&(a.I=q,a.Qa=q,a.Ha=s)):39==f?(c.x=-5,a.I=q,b&&(a.Qa=s,a.Ha=s)):38==f?(c.y=5,a.I=q,b&&(a.Qa=q,a.Ha=q)):40==f&&(c.y=-5,a.I=s,b&&(a.Qa=
s,a.Ha=q)),a.K=c,this.dispatchEvent(a)))}};F("X.interactor",de);F("X.interactor.prototype.init",de.prototype.ea);F("X.interactor.prototype.onMouseDown",de.prototype.Hh);F("X.interactor.prototype.onMouseUp",de.prototype.Mh);F("X.interactor.prototype.onMouseMove",de.prototype.Jh);F("X.interactor.prototype.onMouseWheel",de.prototype.Oh);F("X.interactor.prototype.onKey",de.prototype.Fh);F("X.interactor.prototype.onTouchStart",de.prototype.$h);F("X.interactor.prototype.onTouchMove",de.prototype.Yh);
F("X.interactor.prototype.onTouchEnd",de.prototype.Uh);F("X.interactor.prototype.onTouchHover",de.prototype.Wh);function he(a){de.call(this,a);this.c="interactor2D"}H(he,de);he.prototype.Qc=function(a){he.t.Qc.call(this,a);var b=new kd;a.nc==r&&(a.nc=0);b.I=0>a.nc;this.dispatchEvent(b)};function ie(a,b){(!D(a)||!D(b))&&m(Error("A camera needs valid width and height values."));Q.call(this);this.c="camera";this.ua=new L.f(0,0,100);this.gc=new L.f(0,0,0);this.I=new L.f(0,1,0);this.n=this.Dd(this.ua,this.gc)}H(ie,Q);ie.prototype.observe=function(a){(a==r||!(a instanceof de))&&m(Error("Could not observe the interactor."));P(a,Yc,this.Sh.bind(this));P(a,Xc,this.Ph.bind(this));P(a,Zc,this.di.bind(this))};
ie.prototype.Sh=function(a){a instanceof id||m(Error("Received no valid rotate event."));this.rotate(a.K)};ie.prototype.di=function(a){a instanceof jd||m(Error("Received no valid zoom event."));a.Qa?this.mg(a.Ha):this.ng(a.Ha)};ie.prototype.Ph=function(a){a instanceof hd||m(Error("Received no valid pan event."));this.dg(a.K)};ie.prototype.__defineGetter__("view",u("n"));ie.prototype.__defineSetter__("view",function(a){(a==r||!(a instanceof Float32Array))&&m(Error("Invalid view matrix."));this.n=a});
ie.prototype.__defineGetter__("position",function(){return[this.ua.x,this.ua.y,this.ua.b]});ie.prototype.__defineSetter__("position",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid position."));this.ua=new L.f(a[0],a[1],a[2]);this.reset()});ie.prototype.__defineGetter__("focus",function(){return[this.gc.x,this.gc.y,this.gc.b]});ie.prototype.__defineSetter__("focus",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid focus"));this.gc=new L.f(a[0],a[1],a[2]);this.reset()});
ie.prototype.__defineGetter__("up",function(){return[this.I.x,this.I.y,this.I.b]});ie.prototype.__defineSetter__("up",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid up vector."));this.I=new L.f(a[0],a[1],a[2]);this.reset()});w=ie.prototype;w.reset=function(){this.n=this.Dd(this.ua,this.gc)};w.rotate=function(a){z(a)&&2==a.length?a=new L.f(a[0],a[1],0):a instanceof L.f||m(Error("Invalid distance vector for rotate operation."));return a};
w.dg=function(a){z(a)&&2==a.length?a=new L.f(a[0],a[1],0):a instanceof L.f||m(Error("Invalid distance vector for pan operation."));this.n[12]-=a.x;this.n[13]+=a.y};w.mg=function(a){var b=20;a!=r&&!a&&(b=1);this.n[14]+=b};w.ng=function(a){var b=30;a!=r&&!a&&(b=1);this.n[14]-=b};w.Dd=function(a,b){(!(a instanceof L.f)||!(b instanceof L.f))&&m(Error("3D vectors required for calculating the view."));return L.d.Oc()};F("X.camera",ie);F("X.camera.prototype.pan",ie.prototype.dg);
F("X.camera.prototype.rotate",ie.prototype.rotate);F("X.camera.prototype.zoomIn",ie.prototype.mg);F("X.camera.prototype.zoomOut",ie.prototype.ng);function je(a,b){ie.call(this,a,b);this.c="camera3D";this.bf=45;this.mf=L.d.Be(L.d.Oc(),this.bf,a/b,1,1E4)}H(je,ie);je.prototype.rotate=function(a){a=je.t.rotate.call(this,a);var b=-a.x/5*Math.PI/180;a=-a.y/5*Math.PI/180;var c=new L.f(this.n[1],this.n[5],this.n[9]),d=new L.f(this.n[0],this.n[4],this.n[8]);c.normalize();d.normalize();L.d.rotate(this.n,b,c.x,c.y,c.b);L.d.rotate(this.n,a,d.x,d.y,d.b)};je.prototype.Dd=function(a,b){var c=je.t.Dd.call(this,a,b);L.d.Sf(c,a,b,this.I);return c};
F("X.camera3D",je);function ke(){Q.call(this);this.c="parser";this.X=r;this.B=0;this.zg=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.$c=q;this.Gj=-Infinity;this.Fj=Infinity}H(ke,Q);ke.prototype.parse=function(){m(Error("The function parse() should be overloaded."))};function le(a){for(var b=Infinity,c=-Infinity,d=a.length,e=0,e=0;e<d;e++)var f=a[e],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function me(a,b,c){b===n&&(b=0);c===n&&(c=a.length);for(var d="",e=0,e=b;e<c;++e)d+=String.fromCharCode(a[e]);return d}
function Z(a,b,c){c!=r||(c=1);var d=1,e=Uint8Array;switch(b){case "schar":e=Int8Array;break;case "ushort":e=Uint16Array;d=2;break;case "sshort":e=Int16Array;d=2;break;case "uint":e=Uint32Array;d=4;break;case "sint":e=Int32Array;d=4;break;case "float":e=Float32Array,d=4}b=new e(a.X.slice(a.B,a.B+=c*d));if(a.zg!=a.$c){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(e=0;e<a.byteLength;e+=d)for(var f=e+d-1,g=e;f>g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function ne(a,b,c){L.Ea(a.c+".reslice");var d=b.aa,e=c.max,f=c.data,g=d[2],h=d[1],d=d[0],j=b.m!=r,l=h*d,k=Array(g),p=Array(g),t=0,v=r;b.$&&(v=b.$.pb);for(var y=0,A=0,C=0,E=0,x=4*l,y=0;y<g;y++){k[y]=Array(h);p[y]=Array(h);for(var B=f.subarray(y*l,(y+1)*l),G=new Uint8Array(x),A=E=0;A<h;A++){k[y][A]=new c.data.constructor(d);p[y][A]=new c.data.constructor(d);for(C=0;C<d;C++){var t=B[E],I=0,M=0,J=0,K=0;v?(K=v.get(Math.floor(t)),K||(I=v.bb(),K=I[I.length-1]),I=255*K[1],M=255*K[2],J=255*K[3],K=255*K[4]):
(I=M=J=255*(t/e),K=255);var O=4*E;G[O]=I;G[++O]=M;G[++O]=J;G[++O]=K;k[y][A][C]=255*(t/e);p[y][A][C]=t;E++}}t=new Mc;t.va=G;t.xb=d;t.wb=h;B=b.Za.e[y];B.z=t;j&&(B.m=b.m.Za.e[y].z)}b.de&&(d!=h?j?b.$?(oe(g,d,h,p,b.$,b.R,b.m.R,q),oe(g,h,d,p,b.$,b.Q,b.m.Q,s)):(pe(g,d,h,k,b.R,b.m.R,q),pe(g,h,d,k,b.Q,b.m.Q,s)):b.$?(oe(g,d,h,p,b.$,b.R,r,q),oe(g,h,d,p,b.$,b.Q,r,s)):(pe(g,d,h,k,b.R,r,q),pe(g,h,d,k,b.Q,r,s)):j?b.$?qe(g,d,h,k,b.$,b.Q,b.m.Q,b.R,b.m.R):re(g,d,h,k,b.Q,b.m.Q,b.R,b.m.R):b.$?qe(g,d,h,p,b.$,b.Q,r,b.R,
r):re(g,d,h,k,b.Q,r,b.R,r));L.qa(a.c+".reslice");return p}function pe(a,b,c,d,e,f,g){for(var h=4*a*b,j=0,j=0;j<c;j++){for(var l=new Uint8Array(h),k=0,p=0,k=0;k<a;k++)for(var t=0,v=d[k],t=0;t<b;t++){var y,A=y=g?v[j][t]:v[t][j],C=y,E=4*p;l[E]=y;l[++E]=A;l[++E]=C;l[++E]=255;p++}k=new Mc;k.va=l;k.xb=b;k.wb=a;l=e.e[j];l.z=k;f&&(l.m=f.e[j].z)}}
function oe(a,b,c,d,e,f,g,h){e=e.pb;for(var j=4*a*b,l=0,l=0;l<c;l++){for(var k=new Uint8Array(j),p=0,t=0,p=0;p<a;p++)for(var v=d[p],y=0,y=0;y<b;y++){var A=e.get(Math.floor(h?v[l][y]:v[y][l]));A||(A=e.bb(),A=A[A.length-1]);var C=255*A[2],E=255*A[3],x=255*A[4],B=4*t;k[B]=255*A[1];k[++B]=C;k[++B]=E;k[++B]=x;t++}p=new Mc;p.va=k;p.xb=b;p.wb=a;k=f.e[l];k.z=p;g&&(k.m=g.e[l].z)}}
function re(a,b,c,d,e,f,g,h){for(var j=4*a*b,l=0,l=0;l<c;l++){for(var k=new Uint8Array(j),p=new Uint8Array(j),t=0,v=0,v=0;v<a;v++)for(var y=d[v],A=0,A=0;A<b;A++){var C=y[A][l],E=C,x=C,B=4*t;k[B]=C;k[++B]=E;k[++B]=x;k[++B]=255;x=E=C=B=y[l][A];B=4*t;p[B]=C;p[++B]=E;p[++B]=x;p[++B]=255;t++}t=new Mc;t.va=k;t.xb=b;t.wb=a;k=e.e[l];k.z=t;f&&(k.m=f.e[l].z);k=new Mc;k.va=p;k.xb=b;k.wb=a;p=g.e[l];p.z=k;h&&(p.m=h.e[l].z)}}
function qe(a,b,c,d,e,f,g,h,j){e=e.pb;for(var l=4*a*b,k=0,k=0;k<c;k++){for(var p=new Uint8Array(l),t=new Uint8Array(l),v=0,y=0,y=0;y<a;y++)for(var A=d[y],C=0,C=0;C<b;C++){var E=e.get(Math.floor(A[C][k]));if(!E)var x=e.bb(),E=x[x.length-1];var B=255*E[2],G=255*E[3],I=255*E[4],x=4*v;p[x]=255*E[1];p[++x]=B;p[++x]=G;p[++x]=I;x=e.get(Math.floor(A[k][C]));x||(x=e.bb(),x=x[x.length-1]);E=255*x[1];B=255*x[2];G=255*x[3];I=255*x[4];x=4*v;t[x]=E;t[++x]=B;t[++x]=G;t[++x]=I;v++}v=new Mc;v.va=p;v.xb=b;v.wb=a;p=
f.e[k];p.z=v;g&&(p.m=g.e[k].z);p=new Mc;p.va=t;p.xb=b;p.wb=a;t=h.e[k];t.z=p;j&&(t.m=j.e[k].z)}};function ue(){ke.call(this);this.c="parserIMAGE"}H(ue,ke);ue.prototype.parse=function(a,b,c,d){c instanceof ArrayBuffer||m(Error());for(var e=new Uint8Array(c),f=e.length,g=Array(f);f--;)g[f]=String.fromCharCode(e[f]);e=window.btoa(g.join(""));f=new Image;Tb(f,"load",this.fi.bind(this,f,a,b,c,d));f.src="data:image/"+d+";base64,"+e};ue.prototype.fi=function(a,b,c){b.jb=a;b.va=r;a=new Rc;a.Y=c;a.r=b;this.dispatchEvent(a)};F("X.parserIMAGE",ue);F("X.parserIMAGE.prototype.parse",ue.prototype.parse);function ve(a,b){ie.call(this,a,b);this.c="camera2D"}H(ve,ie);ve.prototype.rotate=function(a){a=ve.t.rotate.call(this,a);var b=new gd;0<a.x?b.ke--:0>a.x&&b.ke++;0<a.y?b.Yd++:0>a.y&&b.Yd--;this.dispatchEvent(b)};function we(){Q.call(this);this.c="shaders";this.jd="";var a;a="precision mediump float;\n\n";a+="attribute vec3 vertexPosition;\n";a+="attribute vec3 vertexNormal;\n";a+="attribute vec3 vertexColor;\n";a+="attribute vec2 vertexTexturePos;\n";a+="attribute float vertexScalar;\n";a+="\n";a+="uniform mat4 view;\n";a+="uniform mat4 perspective;\n";a+="uniform vec3 center;\n";a+="uniform mat4 objectTransform;\n";a+="uniform bool useObjectColor;\n";a+="uniform bool useScalars;\n";a+="uniform bool scalarsReplaceMode;\n";
a+="uniform float scalarsMin;\n";a+="uniform float scalarsMax;\n";a+="uniform vec3 scalarsMinColor;\n";a+="uniform vec3 scalarsMaxColor;\n";a+="uniform float scalarsMinThreshold;\n";a+="uniform float scalarsMaxThreshold;\n";a+="uniform int scalarsInterpolation;\n";a+="uniform vec3 objectColor;\n";a+="uniform float pointSize;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";
a+="varying vec3 fTransformedVertexNormal;\n";a+="\n";a+="void main(void) {\n";a+=" fTransformedVertexNormal = mat3(view[0].xyz,view[1].xyz,view[2].xyz) * ";a+="mat3(objectTransform[0].xyz,objectTransform[1].xyz,objectTransform[2].xyz) * ";a+="vertexNormal;\n";a+=" fVertexNormal = vertexNormal;\n";a+=" fDiscardNow = 0.0;\n";a+=" vec3 vertexPosition2 = vertexPosition - center;\n";a+=" fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n";a+=" fragmentTexturePos = vertexTexturePos;\n";
a+=" if (useScalars) {\n";a+=" float scalarValue = vertexScalar;\n";a+=" if (scalarValue < scalarsMinThreshold || scalarValue > scalarsMaxThreshold) {\n";a+=" if (scalarsReplaceMode) {\n";a+=" fragmentColor = objectColor;\n";a+=" } else {\n";a+=" fDiscardNow = 1.0;\n";a+=" }\n";a+=" } else {\n";a+=" if (scalarsReplaceMode) {\n";a+=" if (scalarsInterpolation == 1) {\n";a+=" vec3 zeroMaxColor;\n";a+=" vec3 zeroMinColor;\n";a+=
" zeroMaxColor[0] = scalarsMaxColor[0]*0.33;\n";a+=" zeroMaxColor[1] = scalarsMaxColor[1]*0.33;\n";a+=" zeroMaxColor[2] = scalarsMaxColor[2]*0.33;\n";a+=" zeroMinColor[0] = scalarsMinColor[0]*0.33;\n";a+=" zeroMinColor[1] = scalarsMinColor[1]*0.33;\n";a+=" zeroMinColor[2] = scalarsMinColor[2]*0.33;\n";a+=" if(scalarValue < 0.0) {fragmentColor = scalarValue/(scalarsMin) * scalarsMinColor + (1.0 - scalarValue/(scalarsMin)) * (zeroMinColor);}\n";
a+=" else {fragmentColor = scalarValue/(scalarsMax) * scalarsMaxColor + (1.0 - scalarValue/(scalarsMax)) * (zeroMaxColor);}\n";a+=" } else {\n";a+=" fragmentColor = scalarValue * scalarsMaxColor + (1.0 - scalarValue) * scalarsMinColor;\n";a+=" }\n";a+=" } else {\n";a+=" fragmentColor = vertexColor;\n";a+=" }\n";a+=" }\n";a+=" } else if (useObjectColor) {\n";a+=" fragmentColor = objectColor;\n";a+=" } else {\n";a+=" fragmentColor = vertexColor;\n";
a+=" }\n";a+=" gl_PointSize = pointSize;\n";a+=" gl_Position = perspective * fVertexPosition;\n";this.jd=a+="}\n";this.Yc="";a="precision mediump float;\n\n";a+="uniform bool usePicking;\n";a+="uniform bool useTexture;\n";a+="uniform bool volumeTexture;\n";a+="uniform bool useLabelMapTexture;\n";a+="uniform sampler2D textureSampler;\n";a+="uniform sampler2D textureSampler2;\n";a+="uniform float objectOpacity;\n";a+="uniform float labelmapOpacity;\n";a+="uniform float volumeLowerThreshold;\n";a+=
"uniform float volumeUpperThreshold;\n";a+="uniform float volumeScalarMin;\n";a+="uniform float volumeScalarMax;\n";a+="uniform vec3 volumeScalarMinColor;\n";a+="uniform vec3 volumeScalarMaxColor;\n";a+="uniform float volumeWindowLow;\n";a+="uniform float volumeWindowHigh;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";a+="varying vec3 fTransformedVertexNormal;\n";
a+="\n";a+="void main(void) {\n";a+=" if (fDiscardNow > 0.0) {\n";a+=" discard;\n";a+=" }\n";a+=" if (usePicking) {\n";a+=" gl_FragColor = vec4(fragmentColor, 1.0);\n";a+=" } else if (useTexture) {\n";a+=" vec4 texture1 = texture2D(textureSampler,fragmentTexturePos);\n";a+=" vec4 textureSum = texture1;\n";a+=" if (volumeTexture) {\n";a+=" float _windowLow = (volumeWindowLow / volumeScalarMax);\n";a+=" float _windowHigh = (volumeWindowHigh / volumeScalarMax);\n";a+=" vec3 _minrange = vec3(_windowLow,_windowLow,_windowLow);\n";
a+=" vec3 _maxrange = vec3(_windowHigh,_windowHigh,_windowHigh);\n";a+=" vec3 fac = _maxrange - _minrange;\n";a+=" textureSum = vec4((textureSum.r - _minrange)/fac,1);\n";a+=" textureSum = textureSum.r * vec4(volumeScalarMaxColor,1) + (1.0 - textureSum.r) * vec4(volumeScalarMinColor,1);\n";a+=" }\n";a+=" if (useLabelMapTexture) {\n";a+=" vec4 texture2 = texture2D(textureSampler2,fragmentTexturePos);\n";a+=" if (texture2.a > 0.0) {\n";a+=" if (labelmapOpacity < 1.0) {\n";
a+=" textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n";a+=" } else {\n";a+=" textureSum = texture2;\n";a+=" }\n";a+=" }\n";a+=" }\n";a+=" if (volumeTexture) {\n";a+=" float _volumeLowerThreshold = (volumeLowerThreshold / volumeScalarMax);\n";a+=" float _volumeUpperThreshold = (volumeUpperThreshold / volumeScalarMax);\n";a+=" if (texture1.r < _volumeLowerThreshold ||\n";a+=" texture1.r > _volumeUpperThreshold) {\n";a+=" discard;\n";
a+=" };\n";a+=" };\n";a+=" gl_FragColor = textureSum;\n";a+=" gl_FragColor.a = objectOpacity;\n";a+=" } else {\n";a+=" vec3 nNormal = normalize(fTransformedVertexNormal);\n";a+=" if (fVertexNormal == vec3(0.0,0.0,0.0)) {\n";a+=" gl_FragColor = vec4(fragmentColor,1.0);\n";a+=" return;\n";a+=" }\n";a+=" vec3 light = vec3(0.0, 0.0, 1.0);\n";a+=" vec3 lightDirection = vec3(0,0,-10);\n";a+=" lightDirection = normalize(lightDirection);\n";a+=" vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n";
a+=" vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n";a+=" float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n";a+=" float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n";a+=" float ambient = 0.3;\n";a+=" gl_FragColor = vec4(fragmentColor * ambient +\n";a+=" fragmentColor * diffuse +\n";a+=" vec3(0.2, 0.2, 0.2) * specular,\n";a+=" objectOpacity);\n";a+=" }\n";this.Yc=a+="}\n"}
H(we,Q);
var xe={qj:"vertexPosition",pj:"vertexNormal",oj:"vertexColor",sj:"vertexTexturePos",rj:"vertexScalar"},ye={tj:"view",Yi:"perspective",Qi:"center",Xi:"objectTransform",kj:"useObjectColor",Vi:"objectColor",mj:"useScalars",gj:"scalarsReplaceMode",dj:"scalarsMin",aj:"scalarsMax",ej:"scalarsMinColor",bj:"scalarsMaxColor",fj:"scalarsMinThreshold",cj:"scalarsMaxThreshold",$i:"scalarsInterpolation",Zi:"pointSize",Wi:"objectOpacity",Ui:"normal",lj:"usePicking",nj:"useTexture",jj:"useLabelMapTexture",Si:"labelmapOpacity",
hj:"textureSampler",ij:"textureSampler2",uj:"volumeLowerThreshold",Aj:"volumeUpperThreshold",xj:"volumeScalarMin",vj:"volumeScalarMax",yj:"volumeScalarMinColor",wj:"volumeScalarMaxColor",Cj:"volumeWindowLow",Bj:"volumeWindowHigh",zj:"volumeTexture"};function ze(a){V.call(this);this.c="slice";this.k=[0,0,0];this.hc=[0,0,1];this.I=[0,1,0];this.G=this.M=10;this.Vb=[0,1,0,0,1,1,1,1,1,0,0,0];this.m=this.ab=r;this.Pa=q;this.ec=[1,1,1];a!=r&&this.Xb(a)}H(ze,V);ze.prototype.Xb=function(a){this.k=a.k.slice();this.hc=a.hc.slice();this.I=a.I.slice();this.M=a.M;this.G=a.G;this.ab=a.ab;this.m=a.m;this.Pa=a.Pa;this.ec=a.ec;this.yg=a.yg;ze.t.Xb.call(this,a)};
ze.prototype.mc=function(){var a=new S(this.hc[0],this.hc[1],this.hc[2]),b=new S(this.I[0],this.I[1],this.I[2]),c=zc(b,a),d=new S(this.k[0],this.k[1],this.k[2]),e=new S(1,1,1);1==a.x?(e=new S(this.k[0],this.G/2,this.M/2),this.Vb=[0,0,1,0,0,1,0,1,1,1,1,0]):1==a.y?(e=new S(this.M/2,this.k[1],this.G/2),this.Vb=[0,0,0,1,1,0,1,0,1,1,0,1]):1==a.b&&(e=new S(this.M/2,this.G/2,this.k[2]));var f=yc(c.h().D(),b.h().D()),f=new S(f.x*e.x,f.y*e.y,f.b*e.b);f.add(d);var g=yc(c.h().D(),b),g=new S(g.x*e.x,g.y*e.y,
g.b*e.b);g.add(d);var h=yc(c,b.h().D()),h=new S(h.x*e.x,h.y*e.y,h.b*e.b);h.add(d);var j=h,b=yc(c,b),b=new S(b.x*e.x,b.y*e.y,b.b*e.b);b.add(d);d=g;this.i=new U(18);this.j=new U(18);this.i.add(f.x,f.y,f.b);this.i.add(g.x,g.y,g.b);this.i.add(h.x,h.y,h.b);this.i.add(j.x,j.y,j.b);this.i.add(b.x,b.y,b.b);this.i.add(d.x,d.y,d.b);this.j.add(a.x,a.y,a.b);this.j.add(a.x,a.y,a.b);this.j.add(a.x,a.y,a.b);this.j.add(a.x,a.y,a.b);this.j.add(a.x,a.y,a.b);this.j.add(a.x,a.y,a.b);this.Pa&&(a=new V,a.i=new U(24),a.j=
new U(24),a.i.add(f.x,f.y,f.b),a.i.add(g.x,g.y,g.b),a.i.add(g.x,g.y,g.b),a.i.add(b.x,b.y,b.b),a.i.add(b.x,b.y,b.b),a.i.add(h.x,h.y,h.b),a.i.add(h.x,h.y,h.b),a.i.add(f.x,f.y,f.b),a.j.add(0,0,0),a.j.add(0,0,0),a.j.add(0,0,0),a.j.add(0,0,0),a.j.add(0,0,0),a.j.add(0,0,0),a.j.add(0,0,0),a.j.add(0,0,0),a.Gb=[this.ec[0],this.ec[1],this.ec[2]],a.ja="LINES",a.jc=2,this.e.push(a))};F("X.slice",ze);function R(a){V.call(this);this.c="volume";this.k=[0,0,0];this.aa=[10,10,10];this.H=[1,1,1];this.jb=[];this.vc=this.mb=this.uc=this.lb=this.tc=this.kb=0;this.Q=new V;this.R=new V;this.Za=new V;this.kd=this.Ka=s;this.zb=0;this.m=r;this.Pa=q;this.U=Infinity;this.T=-Infinity;this.de=q;Fa(this,new pc);Fa(this,new Pc);a!=r&&this.Xb(a)}H(R,V);
R.prototype.Xb=function(a){window.console.log(a);this.k=a.k.slice();this.aa=a.aa.slice();this.H=a.H.slice();this.kb=a.kb;this.tc=a.tc;this.lb=a.lb;this.uc=a.uc;this.mb=a.mb;this.vc=a.vc;this.Q=new V(a.Q);this.R=new V(a.R);this.Za=new V(a.Za);this.Ka=a.Ka;this.kd=a.kd;this.zb=a.zb;this.m=a.m;this.Pa=a.Pa;R.t.Xb.call(this,a)};
R.prototype.mc=function(){this.e.length=0;this.Q.e.length=0;this.R.e.length=0;this.Za.e.length=0;this.e.push(this.Q);this.e.push(this.R);this.e.push(this.Za);for(var a=0,a=0;3>a;a++){for(var b=(this.aa[a]-1)/2,c=b,d=0,d=0;d<this.aa[a];d++){var e=-b*this.H[a]+d*this.H[a],f=[[this.k[0]+e,this.k[1],this.k[2]],[this.k[0],this.k[1]+e,this.k[2]],[this.k[0],this.k[1],this.k[2]+e]],e=this.e[a].e,g=0,h=0,j=[1,1,1],l=this.Pa;0==a?(g=this.aa[2]*this.H[2]-this.H[2],h=this.aa[1]*this.H[1]-this.H[1],j=[1,1,0]):
1==a?(g=this.aa[0]*this.H[0]-this.H[0],h=this.aa[2]*this.H[2]-this.H[2],j=[1,0,0]):2==a&&(g=this.aa[0]*this.H[0]-this.H[0],h=this.aa[1]*this.H[1]-this.H[1],j=[0,1,0]);this.ab!=r&&(l=s);var k=new ze,p=k,f=f[a],t=[[1,0,0],[0,1,0],[0,0,1]][a],v=[[0,1,0],[0,0,-1],[0,1,0]][a];(f==r||!z(f)||3!=f.length)&&m(Error("Invalid center."));(t==r||!z(t)||3!=t.length)&&m(Error("Invalid front direction."));(v==r||!z(v)||3!=v.length)&&m(Error("Invalid up direction."));D(g)||m(Error("Invalid width."));D(h)||m(Error("Invalid height."));
var y=s;l!=r&&(y=l);l=[1,1,1];j!=r&&(l=j);p.k=f;p.hc=t;p.I=v;p.M=g;p.G=h;p.Pa=y;p.ec=l;p.mc();k.ab=this;k.visible=d==Math.floor(c);e.push(k)}0==a?this.tc=this.kb=c:1==a?this.uc=this.lb=c:2==a&&(this.vc=this.mb=c)}this.g=q};
R.prototype.o=function(a){a="undefined"!==typeof a?a:q;if(0<this.e.length)if(this.Ka!=this.kd&&(this.Ka?(this.e[0].e[parseInt(this.kb,10)].visible=s,this.e[1].e[parseInt(this.lb,10)].visible=s,this.e[2].e[parseInt(this.mb,10)].visible=s):this.e[this.zb].visible=s,this.g=q,this.kd=this.Ka),this.Ka)Ae(this,this.zb);else for(var b=0,b=0;3>b;b++){var c=this.e[b],d=0,e=0;0==b?(d=this.kb,e=this.tc,this.tc=this.kb):1==b?(d=this.lb,e=this.uc,this.uc=this.lb):2==b&&(d=this.mb,e=this.vc,this.vc=this.mb);c.e[parseInt(e,
10)].visible=s;c=c.e[parseInt(d,10)];c.visible=q;c.Z=1}a&&R.t.o.call(this)};R.prototype.__defineGetter__("dimensions",u("aa"));R.prototype.__defineGetter__("volumeRendering",u("Ka"));R.prototype.__defineSetter__("volumeRendering",function(a){this.Ka=a;this.o(s)});R.prototype.__defineSetter__("visible",da("Ja"));R.prototype.__defineGetter__("center",u("k"));R.prototype.__defineSetter__("center",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid center."));this.k=a});
R.prototype.__defineGetter__("image",u("jb"));R.prototype.__defineGetter__("labelmap",function(){this.m||(this.m=new Be(this));return this.m});R.prototype.__defineGetter__("indexX",u("kb"));R.prototype.__defineSetter__("indexX",function(a){D(a)&&(0<=a&&a<this.Q.e.length)&&(this.kb=a,this.o(s))});R.prototype.__defineGetter__("indexY",u("lb"));R.prototype.__defineSetter__("indexY",function(a){D(a)&&(0<=a&&a<this.R.e.length)&&(this.lb=a,this.o(s))});R.prototype.__defineGetter__("indexZ",u("mb"));
R.prototype.__defineSetter__("indexZ",function(a){D(a)&&(0<=a&&a<this.Za.e.length)&&(this.mb=a,this.o(s))});R.prototype.__defineGetter__("windowLow",u("U"));R.prototype.__defineSetter__("windowLow",da("U"));R.prototype.__defineGetter__("windowHigh",u("T"));R.prototype.__defineSetter__("windowHigh",da("T"));R.prototype.__defineGetter__("borders",u("Pa"));R.prototype.__defineSetter__("borders",da("Pa"));R.prototype.__defineGetter__("reslicing",u("de"));R.prototype.__defineSetter__("reslicing",da("de"));
function Ae(a,b){if(a.Ka&&(a.g||b!=a.zb)){var c=a.e[a.zb];c.visible=s;var c=a.e[b],d=c.e.length,e;for(e=0;e<d;e++)c.e[e].Ja=q;a.zb=b;a.g=s}}F("X.volume",R);F("X.volume.prototype.modified",R.prototype.o);function Ce(){ke.call(this);this.c="parserSTL"}H(Ce,ke);
Ce.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");this.X=c;var d=b.i,e=b.j;if("solid"==me(Z(this,"uchar",5))){b.i=d=new U(c.byteLength);b.j=e=new U(c.byteLength);var f=d,d=e,e=Z(this,"uchar",c.byteLength-5);c=e.length;var g=s,h=s,j=0,l;for(l=0;l<c;l++)if(10==e[l]){if(g||h){var k=me(e,j,l).split(" "),h=parseFloat(k[0]),p=parseFloat(k[1]),k=parseFloat(k[2]);g?(d.add(h,p,k),d.add(h,p,k),d.add(h,p,k)):f.add(h,p,k);h=g=s}}else 32==e[l-1]&&(102==e[l]?(j=l+=13,g=q):118==e[l]&&(j=l+=7,h=q))}else{this.B=
80;f=Z(this,"uint");b.i=d=new U(9*f);b.j=e=new U(9*f);for(c=c=0;c<f;c++)g=Z(this,"float",12),j=g[0],l=g[1],h=g[2],e.add(j,l,h),e.add(j,l,h),e.add(j,l,h),d.add(g[3],g[4],g[5]),d.add(g[6],g[7],g[8]),d.add(g[9],g[10],g[11]),this.B+=2}L.qa(this.c+".parse");f=new Rc;f.Y=b;f.r=a;this.dispatchEvent(f)};F("X.parserSTL",Ce);F("X.parserSTL.prototype.parse",Ce.prototype.parse);function De(){ke.call(this);this.c="parserDCM"}H(De,ke);De.prototype.parse=function(a,b,c){c=this.Sc(c,b);if(c.Bd==c.Sa){var d=c.Re.length,e,f=0;for(e=0;e<d;e++){var g=c.Re[e];g!==n&&(g*=c.Wa,c.data.set(c.Mc.subarray(g,g+c.Wa),f*c.Wa),f++)}b.aa=[c.xa[0],c.xa[1],c.xa[2]];Infinity==c.ka[2]&&(c.ka[2]=1);b.H=[c.ka[0],c.ka[1],c.ka[2]];e=le(c.data);d=e[0];e=e[1];c.min=b.Ia=b.U=d;c.max=b.Fa=b.T=e;-Infinity==b.P&&(b.P=d);Infinity==b.S&&(b.S=e);b.mc();b.jb=ne(this,b,c)}c=new Rc;c.Y=b;c.r=a;this.dispatchEvent(c)};
De.prototype.Sc=function(a,b){this.X=a;var c=0;if(b.dc!=r){g=b.dc;h=Z(this,"ushort",this.X.byteLength-2*g.Wa);j=0;for(l=2;0<l;)if(d=h[j++],32==d)if(f=h[j++],19==f){j++;d=h[j++];for(f=0;f<d/2;f++)k=h[j++],p=k&255,k=(k&65280)>>8,c+=String.fromCharCode(p),c+=String.fromCharCode(k),c=parseInt(c,10);l--}else if(4161==f){j++;for(var d=h[j++],e="",f=0;f<d/2;f++)k=h[j++],p=k&255,k=(k&65280)>>8,e+=String.fromCharCode(p),e+=String.fromCharCode(k);g.ka=[g.ka[0],g.ka[1],Math.min(Math.abs(g.Rf-e),g.ka[2])];g.Rf=
e;l--}g.xa[2]++}else{var g={rows:0,cols:0,ka:r,me:0,Ig:0,Sa:1,Dh:1,Rf:r,Bd:0,Wa:0,Mc:r,Le:0,Re:[],data:r,min:Infinity,max:-Infinity};g.Sa=b.p.length;g.Sa==r&&(g.Sa=1);for(var h=Z(this,"ushort",this.X.byteLength),j=66,d=r,f=r,d=r,l=7;0<l;)if(d=h[j++],40==d)switch(f=h[j++],j++,d=h[j++],f){case 16:g.rows=h[j++];l--;break;case 17:g.cols=h[j++];l--;break;case 256:g.me=h[j++];l--;break;case 257:g.Ig=h[j++];l--;break;case 2:g.Dh=h[j++];l--;break;case 48:e="";for(f=f=0;f<d/2;f++)var k=h[j++],p=k&255,k=(k&
65280)>>8,e=e+String.fromCharCode(p),e=e+String.fromCharCode(k);e=e.split("\\");g.ka=[+e[0],+e[1],Infinity];l--}else if(32==d&&(f=h[j++],19==f)){j++;d=h[j++];for(f=0;f<d/2;f++)k=h[j++],p=k&255,k=(k&65280)>>8,c+=String.fromCharCode(p),c+=String.fromCharCode(k),c=parseInt(c,10);l--}b.dc=g;g.xa=[g.cols,g.rows,1];g.Wa=g.rows*g.cols;switch(g.me){case 8:g.Mc=new Uint8Array(g.cols*g.rows*g.Sa);g.data=new Uint8Array(g.cols*g.rows*g.Sa);break;case 16:g.Mc=new Uint16Array(g.cols*g.rows*g.Sa);g.data=new Uint16Array(g.cols*
g.rows*g.Sa);break;case 32:g.Mc=new Uint32Array(g.cols*g.rows*g.Sa),g.data=new Uint32Array(g.cols*g.rows*g.Sa)}}this.B=this.X.byteLength-2*g.Wa;h=r;switch(g.me){case 8:h=Z(this,"uchar",g.Wa);break;case 16:h=Z(this,"ushort",g.Wa);break;case 32:h=Z(this,"uint",g.Wa)}g.Re[c]=g.Le;g.Mc.set(h,g.Le*g.Wa);g.Le++;++g.Bd;return g};F("X.parserDCM",De);F("X.parserDCM.prototype.parse",De.prototype.parse);function Ee(){ke.call(this);this.c="parserVTK"}H(Ee,ke);
Ee.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");var d=b.i,e=b.j,f=new Uint8Array(c),g="";b.i=d=new U(c.byteLength);b.j=e=new U(c.byteLength);c=0;for(var h=f.length;c<h;c+=32768)g+=me(f,c,Math.min(c+32768,h));f=g.split("\n");g=f.length;this.Hc=this.Ic=r;this.Jb=[];this.ta=Oc;this.be=this.ub=this.ib=this.vb=s;c=0;for(h=g%8;h--;)Fe(this,f[c]),c++;for(h=0.125*g^0;h--;)Fe(this,f[c]),c++,Fe(this,f[c]),c++,Fe(this,f[c]),c++,Fe(this,f[c]),c++,Fe(this,f[c]),c++,Fe(this,f[c]),c++,Fe(this,f[c]),c++,
Fe(this,f[c]),c++;c=this.Ic;var f=this.Hc,g=f.length,j=h=this.Jb.length;do{var l=this.Jb[h-j],k=l.length,p;for(p=0;p<k&&!("LINES"==this.ta&&p+1>=k);p++){var t=parseInt(l[p],10),v=c.get(t);d.add(v[0],v[1],v[2]);var y=t,A=v;"LINES"==this.ta?(y=parseInt(l[p+1],10),A=c.get(y),d.add(A[0],A[1],A[2])):"TRIANGLE_STRIPS"==this.ta&&(0==p||p==k-1)&&d.add(v[0],v[1],v[2]);t<g?(A=f.get(t),e.add(A[0],A[1],A[2]),"LINES"==this.ta?(y=f.get(y),e.add(y[0],y[1],y[2])):"TRIANGLE_STRIPS"==this.ta&&(0==p||p==k-1)&&e.add(A[0],
A[1],A[2])):(y=new S(v[0],v[1],v[2]),y.normalize(),e.add(y.x,y.y,y.b),"LINES"==this.ta?(y=new S(A[0],A[1],A[2]),y.normalize(),e.add(y.x,y.y,y.b)):"TRIANGLE_STRIPS"==this.ta&&(0==p||p==k-1)&&e.add(y.x,y.y,y.b))}j--}while(0<j);b.ja=this.ta;L.qa(this.c+".parse");d=new Rc;d.Y=b;d.r=a;this.dispatchEvent(d)};
function Fe(a,b){b=b.replace(/^\s+|\s+$/g,"");var c=b.split(" "),d=c.length,e=c[0];switch(e){case "POINTS":a.vb=q;a.ib=s;a.ub=s;c=parseInt(c[1],10);a.Ic=new U(3*c);a.Hc=new U(3*c);return;case "VERTICES":a.ib=q;a.vb=s;a.ub=s;c=parseInt(c[1],10);3<=c?a.ta=Oc:1==c?a.ta="POINTS":m(Error("This VTK file is not supported!"));a.Jb=[];return;case "TRIANGLE_STRIPS":a.ib=q;a.vb=s;a.ub=s;a.ta="TRIANGLE_STRIPS";a.Jb=[];return;case "LINES":a.ib=q;a.vb=s;a.ub=s;a.ta="LINES";a.Jb=[];return;case "POLYGONS":a.ib=q;
a.vb=s;a.ub=s;a.ta="POLYGONS";a.Jb=[];return;case "POINT_DATA":a.ub=q;a.vb=s;a.ib=s;return}if(a.vb)if(1==d||isNaN(parseFloat(e)))a.vb=s;else{if(3<=d){var e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);a.Ic.add(e,f,g)}6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.Ic.add(e,f,g));9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.Ic.add(d,e,c))}else a.ib?1==d||isNaN(parseFloat(e))?a.ib=s:(c=c.slice(1),a.Jb.push(c)):a.ub&&("NORMALS"==e?a.be=q:1==d||isNaN(parseFloat(e))?
(a.ub=s,a.be=s):a.be&&(3<=d&&(e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),a.Hc.add(e,f,g)),6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.Hc.add(e,f,g)),9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.Hc.add(d,e,c))))}F("X.parserVTK",Ee);F("X.parserVTK.prototype.parse",Ee.prototype.parse);function Ge(){ke.call(this);this.c="parserFSM";this.$c=s}H(Ge,ke);
Ge.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");this.X=c;var d=b.i,e=b.j;b.kc=[];var f=b.kc;c=0;var g;do g=Z(this,"uchar"),c++;while(200>c&&10!=g);Z(this,"uchar");e=Z(this,"uint");c=Z(this,"uint");var h=Z(this,"float",3*e);g=Z(this,"uint",3*c);var j=new Uint32Array(e),l=new Float32Array(9*c);b.i=d=new U(9*c);b.j=e=new U(9*c);var k;for(k=0;k<c;k++){var p=3*k,t=g[p],v=g[p+1],y=g[p+2];f.push(t);f.push(v);f.push(y);j[t]+=1;j[v]+=1;j[y]+=1;var p=3*t,A=3*v,C=3*y,E=h[p],x=h[p+1],B=h[p+2],v=h[A],
y=h[A+1],t=h[A+2],G=h[C],I=h[C+1],M=h[C+2];d.add(E,x,B);d.add(v,y,t);d.add(G,I,M);E=new S(E,x,B);G=new S(G,I,M);v=(new S(v,y,t)).h().la(E);y=G.h().la(E);v=zc(v,y).normalize();l[p]+=v.x;l[p+1]+=v.y;l[p+2]+=v.b;l[A]+=v.x;l[A+1]+=v.y;l[A+2]+=v.b;l[C]+=v.x;l[C+1]+=v.y;l[C+2]+=v.b}for(k=0;k<c;k++)p=3*k,t=g[p],v=g[p+1],y=g[p+2],p=3*t,A=3*v,C=3*y,f=new S(l[A],l[A+1],l[A+2]),h=new S(l[C],l[C+1],l[C+2]),p=(new S(l[p],l[p+1],l[p+2])).scale(1/j[t]).normalize(),f=f.scale(1/j[v]).normalize(),h=h.scale(1/j[y]).normalize(),
e.add(p.x,p.y,p.b),e.add(f.x,f.y,f.b),e.add(h.x,h.y,h.b);b.ja=Oc;L.qa(this.c+".parse");c=new Rc;c.Y=b;c.r=a;this.dispatchEvent(c)};F("X.parserFSM",Ge);F("X.parserFSM.prototype.parse",Ge.prototype.parse);var He={qe:function(a,b,c){return He.update(a,0,b,c)},update:function(a,b,c,d){var e=He.qg,f="number"===typeof c?c:c=0;d="number"===typeof d?d:a.length;b^=4294967295;for(f=d&7;f--;++c)b=b>>>8^e[(b^a[c])&255];for(f=d>>3;f--;c+=8)b=b>>>8^e[(b^a[c])&255],b=b>>>8^e[(b^a[c+1])&255],b=b>>>8^e[(b^a[c+2])&255],b=b>>>8^e[(b^a[c+3])&255],b=b>>>8^e[(b^a[c+4])&255],b=b>>>8^e[(b^a[c+5])&255],b=b>>>8^e[(b^a[c+6])&255],b=b>>>8^e[(b^a[c+7])&255];return(b^4294967295)>>>0}};
He.qg=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,
3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,
366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,
3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,
1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,
1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function Ie(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,h,j,l,k,p,t;for(p=0;p<b;++p)a[p]>c&&(c=a[p]),a[p]<d&&(d=a[p]);e=1<<c;f=new Uint32Array(e);g=1;h=0;for(j=2;g<=c;){for(p=0;p<b;++p)if(a[p]===g){l=0;k=h;for(t=0;t<g;++t)l=l<<1|k&1,k>>=1;for(t=l;t<e;t+=j)f[t]=g<<16|p;++h}++g;h<<=1;j<<=1}return[f,c,d]};function Je(a,b){this.ne=[];this.oe=32768;this.La=this.Kc=this.fa=this.Ue=0;this.input=new Uint8Array(a);this.tf=s;this.pe=Ke;this.fb=s;if(b||!(b={}))b.index&&(this.fa=b.index),b.bufferSize&&(this.oe=b.bufferSize),b.bufferType&&(this.pe=b.bufferType),b.resize&&(this.fb=b.resize);switch(this.pe){case Le:this.O=32768;this.ya=new Uint8Array(32768+this.oe+258);break;case Ke:this.O=0;this.ya=new Uint8Array(this.oe);this.Zb=this.Vg;this.wf=this.Lg;this.we=this.Pg;break;default:m(Error("invalid inflate mode"))}}
var Le=0,Ke=1;
Je.prototype.Nc=function(){for(;!this.tf;){var a=Me(this,3);a&1&&(this.tf=q);a>>>=1;switch(a){case 0:var a=this.input,b=this.fa,c=this.ya,d=this.O,e=n,f=n,g=n,h=c.length,e=n;this.La=this.Kc=0;e=a[b++];e===n&&m(Error("invalid uncompressed block header: LEN (first byte)"));f=e;e=a[b++];e===n&&m(Error("invalid uncompressed block header: LEN (second byte)"));f|=e<<8;e=a[b++];e===n&&m(Error("invalid uncompressed block header: NLEN (first byte)"));g=e;e=a[b++];e===n&&m(Error("invalid uncompressed block header: NLEN (second byte)"));g|=
e<<8;f===~g&&m(Error("invalid uncompressed block header: length verify"));b+f>a.length&&m(Error("input buffer is broken"));switch(this.pe){case Le:for(;d+f>c.length;)e=h-d,f-=e,c.set(a.subarray(b,b+e),d),d+=e,b+=e,this.O=d,c=this.Zb(),d=this.O;break;case Ke:for(;d+f>c.length;)c=this.Zb({Df:2});break;default:m(Error("invalid inflate mode"))}c.set(a.subarray(b,b+f),d);d+=f;this.fa=b+=f;this.O=d;this.ya=c;break;case 1:this.we(Ne,Oe);break;case 2:Pe(this);break;default:m(Error("unknown BTYPE: "+a))}}return this.wf()};
var Qe=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Re=new Uint16Array([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,258,258]),Se=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]),Te=new Uint16Array([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]),Ue=new Uint8Array([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]),Ve=new Uint8Array(288),
We,Xe;We=0;for(Xe=Ve.length;We<Xe;++We)Ve[We]=143>=We?8:255>=We?9:279>=We?7:8;var Ne=Ie(Ve),Ye=new Uint8Array(30),Ze,$e;Ze=0;for($e=Ye.length;Ze<$e;++Ze)Ye[Ze]=5;var Oe=Ie(Ye);function Me(a,b){for(var c=a.Kc,d=a.La,e=a.input,f=a.fa,g;d<b;)g=e[f++],g===n&&m(Error("input buffer is broken")),c|=g<<d,d+=8;g=c&(1<<b)-1;a.Kc=c>>>b;a.La=d-b;a.fa=f;return g}
function af(a,b){for(var c=a.Kc,d=a.La,e=a.input,f=a.fa,g=b[0],h=b[1],j;d<h;)j=e[f++],j===n&&m(Error("input buffer is broken")),c|=j<<d,d+=8;e=g[c&(1<<h)-1];g=e>>>16;a.Kc=c>>g;a.La=d-g;a.fa=f;return e&65535}
function Pe(a){function b(a,b,c){var d,e,f;for(f=0;f<a;)switch(d=af(this,b),d){case 16:for(d=3+Me(this,2);d--;)c[f++]=e;break;case 17:for(d=3+Me(this,3);d--;)c[f++]=0;e=0;break;case 18:for(d=11+Me(this,7);d--;)c[f++]=0;e=0;break;default:e=c[f++]=d}return c}var c=Me(a,5)+257,d=Me(a,5)+1,e=Me(a,4)+4,f=new Uint8Array(Qe.length),g;for(g=0;g<e;++g)f[Qe[g]]=Me(a,3);e=Ie(f);f=new Uint8Array(c);g=new Uint8Array(d);a.we(Ie(b.call(a,c,e,f)),Ie(b.call(a,d,e,g)))}w=Je.prototype;
w.we=function(a,b){var c=this.ya,d=this.O;this.zf=a;for(var e=c.length-258,f,g,h;256!==(f=af(this,a));)if(256>f)d>=e&&(this.O=d,c=this.Zb(),d=this.O),c[d++]=f;else{f-=257;h=Re[f];0<Se[f]&&(h+=Me(this,Se[f]));f=af(this,b);g=Te[f];0<Ue[f]&&(g+=Me(this,Ue[f]));d>=e&&(this.O=d,c=this.Zb(),d=this.O);for(;h--;)c[d]=c[d++-g]}for(;8<=this.La;)this.La-=8,this.fa--;this.O=d};
w.Pg=function(a,b){var c=this.ya,d=this.O;this.zf=a;for(var e=c.length,f,g,h;256!==(f=af(this,a));)if(256>f)d>=e&&(c=this.Zb(),e=c.length),c[d++]=f;else{f-=257;h=Re[f];0<Se[f]&&(h+=Me(this,Se[f]));f=af(this,b);g=Te[f];0<Ue[f]&&(g+=Me(this,Ue[f]));d+h>e&&(c=this.Zb(),e=c.length);for(;h--;)c[d]=c[d++-g]}for(;8<=this.La;)this.La-=8,this.fa--;this.O=d};
w.Zb=function(){var a=new Uint8Array(this.O-32768),b=this.O-32768,c=this.ya;a.set(c.subarray(32768,a.length));this.ne.push(a);this.Ue+=a.length;c.set(c.subarray(b,b+32768));this.O=32768;return c};w.Vg=function(a){var b=this.input.length/this.fa+1|0,c=this.input,d=this.ya;a&&("number"===typeof a.Df&&(b=a.Df),"number"===typeof a.Eg&&(b+=a.Eg));2>b?(a=(c.length-this.fa)/this.zf[2],a=258*(a/2)|0,a=a<d.length?d.length+a:d.length<<1):a=d.length*b;a=new Uint8Array(a);a.set(d);return this.ya=a};
w.wf=function(){var a=0,b=this.ya,c=this.ne,d,e=new Uint8Array(this.Ue+(this.O-32768)),f,g,h,j;if(0===c.length)return this.ya.subarray(32768,this.O);f=0;for(g=c.length;f<g;++f){d=c[f];h=0;for(j=d.length;h<j;++h)e[a++]=d[h]}f=32768;for(g=this.O;f<g;++f)e[a++]=b[f];this.ne=[];return this.buffer=e};w.Lg=function(){var a,b=this.O;this.fb?(a=new Uint8Array(b),a.set(this.ya.subarray(0,b))):a=this.ya.subarray(0,b);return this.buffer=a};new Uint8Array(256);var bf;for(bf=0;256>bf;++bf)for(var cf=bf,df=7,cf=cf>>>1;cf;cf>>>=1)--df;var ef=[],ff;for(ff=0;288>ff;ff++)switch(q){case 143>=ff:ef.push([ff+48,8]);break;case 255>=ff:ef.push([ff-144+400,9]);break;case 279>=ff:ef.push([ff-256+0,7]);break;case 287>=ff:ef.push([ff-280+192,8]);break;default:m("invalid literal: "+ff)}
function gf(){var a=hf;switch(q){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,a-
31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:m("invalid length: "+a)}}var jf=[],hf,kf;
for(hf=3;258>=hf;hf++)kf=gf(),jf[hf]=kf[2]<<24|kf[1]<<16|kf[0];new Uint32Array(jf);function lf(){};function mf(a){this.input=a;this.fa=0;this.member=[]}
mf.prototype.Nc=function(){for(var a=this.input.length;this.fa<a;){var b=new lf,c=n,d=n,e=n,f=c=e=n,g=n,c=c=n,h=this.input,d=this.fa;b.Jf=h[d++];b.Kf=h[d++];(31!==b.Jf||139!==b.Kf)&&m(Error("invalid file signature:",b.Jf,b.Kf));b.vf=h[d++];switch(b.vf){case 8:break;default:m(Error("unknown compression method: "+b.vf))}b.sd=h[d++];c=h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24;b.Oj=new Date(1E3*c);b.Rj=h[d++];b.Pj=h[d++];0<(b.sd&4)&&(b.Oi=h[d++]|h[d++]<<8,d+=b.Oi);if(0<(b.sd&8)){g=[];for(f=0;0<(c=h[d++]);)g[f++]=
String.fromCharCode(c);b.name=g.join("")}if(0<(b.sd&16)){g=[];for(f=0;0<(c=h[d++]);)g[f++]=String.fromCharCode(c);b.comment=g.join("")}0<(b.sd&2)&&(b.Mg=He.qe(h,0,d)&65535,b.Mg!==(h[d++]|h[d++]<<8)&&m(Error("invalid header crc16")));c=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24;h.length-d-4-4<512*c&&(e=c);d=new Je(h,{index:d,bufferSize:e});b.data=e=d.Nc();d=d.fa;b.Hj=c=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0;He.qe(e)!==c&&m(Error("invalid CRC-32 checksum: 0x"+He.qe(e).toString(16)+
" / 0x"+c.toString(16)));b.Lj=c=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0;(e.length&4294967295)!==c&&m(Error("invalid input size: "+(e.length&4294967295)+" / "+c));this.member.push(b);this.fa=d}a=this.member;b=e=d=0;for(h=a.length;b<h;++b)e+=a[b].data.length;e=new Uint8Array(e);for(b=0;b<h;++b)e.set(a[b].data,d),d+=a[b].data.length;return e};function nf(){ke.call(this);this.c="parserMGZ";this.$c=s}H(nf,ke);nf.prototype.parse=function(a,b,c,d){L.Ea(this.c+".parse");d&&(c=(new mf(new Uint8Array(c))).Nc(),c=c.buffer);d=this.Sc(c);b.aa=[d.De,d.Ee,d.Fe];b.H=d.kg;c=d.min;var e=d.max;b.Ia=b.U=c;b.Fa=b.T=e;-Infinity==b.P&&(b.P=c);Infinity==b.S&&(b.S=e);b.mc();L.qa(this.c+".parse");b.jb=ne(this,b,d);d=new Rc;d.Y=b;d.r=a;this.dispatchEvent(d)};
nf.prototype.Sc=function(a){this.X=a;a={version:0,tg:0,rg:0,ah:0,sg:0,De:0,Ee:0,Fe:0,Ch:0,type:0,Tg:0,hg:0,Ti:r,pg:r,kg:r,data:r,min:Infinity,max:-Infinity};a.version=Z(this,"uint");a.De=Z(this,"uint");a.Ee=Z(this,"uint");a.Fe=Z(this,"uint");a.Ch=Z(this,"uint");a.type=Z(this,"uint");a.Tg=Z(this,"uint");a.hg=Z(this,"ushort");if(0<a.hg){a.kg=Z(this,"float",3);var b=[];b.push(Z(this,"float",3));b.push(Z(this,"float",3));b.push(Z(this,"float",3));b.push(Z(this,"float",3));a.pg=b}this.B=284;b=a.De*a.Ee*
a.Fe;switch(a.type){case 0:a.data=Z(this,"uchar",b);break;case 1:a.data=Z(this,"uint",b);break;case 3:a.data=Z(this,"float",b);break;case 4:a.data=Z(this,"ushort",b);break;default:m(Error("Unsupported MGH/MGZ data type: "+a.type))}b=le(a.data);a.min=b[0];a.max=b[1];this.B+16<this.X.byteLength&&(a.tg=Z(this,"float"),a.ah=Z(this,"float"),a.rg=Z(this,"float"),a.sg=Z(this,"float"));return a};F("X.parserMGZ",nf);F("X.parserMGZ.prototype.parse",nf.prototype.parse);function of(){ke.call(this);this.c="parserLBL"}H(of,ke);
of.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");var d=b.kc,e=d.length;0==e&&m(Error("No _pointIndices defined on the X.object."));this.X=c;var f=[],g=Z(this,"uchar",c.byteLength),h=g.length,j=s,l=0;for(c=1;c<h;c++)10==g[c-1]?(l=c,j=q):j&&32==g[c]&&(f.push(parseInt(me(g,l,c),10)),j=s);g=b.u.v?b.u.v:new Float32Array(e);h=f.length;for(c=0;c<h;c++)g[f[c]]=1;f=new Float32Array(3*e);for(c=h=0;c<e;c++)j=d[c],j>e&&m(Error("Could not find scalar for vertex.")),j=g[j],f[h++]=j,f[h++]=j,f[h++]=j;b.u.v=
g;b.u.sc=f;b.u.g=q;L.qa(this.c+".parse");d=new Rc;d.Y=b;d.r=a;this.dispatchEvent(d)};F("X.parserLBL",of);F("X.parserLBL.prototype.parse",of.prototype.parse);function pf(){ke.call(this);this.c="parserCRV";this.$c=s}H(pf,ke);
pf.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");var d=b.kc;0==d.length&&m(Error("No _pointIndices defined on the X.object."));this.X=c;this.B=3;var e=Z(this,"uint");Z(this,"uint");Z(this,"uint");var f=0,g=0,h=0,j=0,l=0,k=0,p=0,t=0,v=0,y=0,A=0;c=Array(2);var C=Array(2),E=Z(this,"float",e),x;for(x=0;x<e;x++){var B=E[x];0==x&&(c[0]=C[0]=B);0<=B?(f++,j+=B):(g++,h+=B);v+=B;A++;C[0]=Math.max(B,C[0]);c[0]=Math.min(B,c[0]);E[x]=B}0!=f&&(l=j/f);0!=g&&(k=h/g);0!=A&&(y=v/A);for(A=v=h=j=0;A<e;A++)B=
E[A],x=0,0<=B?(x=Math.pow(B-l,2),j+=x):(x=Math.pow(B-k,2),h+=x),x=Math.pow(B-y,2),v+=x;1<f&&(p=Math.sqrt(j/(f-1)));1<g&&(t=Math.sqrt(h/(g-1)));c[1]=k-2.5*t;C[1]=l+2.5*p;e=d.length;f=new Float32Array(3*e);for(A=0;A<e;A++)g=E[d[A]],h=3*A,f[h]=g,f[h+1]=g,f[h+2]=g;b.u.Ia=c[1];b.u.Fa=C[1];-Infinity==b.u.P&&(b.u.P=c[1]);Infinity==b.u.S&&(b.u.S=C[1]);b.u.v=E;b.u.sc=f;b.u.g=q;L.qa(this.c+".parse");d=new Rc;d.Y=b;d.r=a;this.dispatchEvent(d)};F("X.parserCRV",pf);F("X.parserCRV.prototype.parse",pf.prototype.parse);function qf(){ke.call(this);this.c="parserTRK"}H(qf,ke);
qf.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");var d=b.i,e=b.j,f=b.W;this.X=c;Z(this,"uchar",6);Z(this,"ushort",3);var g=Z(this,"float",3);Z(this,"float",3);var h=Z(this,"ushort");Z(this,"uchar",200);Z(this,"ushort");Z(this,"uchar",200);Z(this,"float",16);Z(this,"uchar",444);Z(this,"uchar",4);Z(this,"uchar",4);Z(this,"float",6);Z(this,"uchar",2);Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");var j=Z(this,"uint");Z(this,"uint");var l=Z(this,
"uint"),k=[],p=[];c=Infinity;var t=-Infinity,v=r,y=r,A=r,C=r,e=d=r,E=Z(this,"uint",(this.X.byteLength-1E3)/4);this.B=l;for(var x=Z(this,"float",(this.X.byteLength-1E3)/4),B=0,l=f=0;l<j;l++){for(var G=E[B],I=new U(3*G),M=0,J=0;J<G;J++){var K=x[B+3*J+J*h+1],O=x[B+3*J+J*h+2],aa=x[B+3*J+J*h+3],K=K/g[0],O=O/g[1],aa=aa/g[2];I.add(K,O,aa);if(0<J)var T=I.get(J-1),M=M+Math.sqrt(Math.pow(K-T[0],2)+Math.pow(O-T[1],2)+Math.pow(aa-T[2],2));J<G-1&&(f+=6)}B+=3*G+G*h+1;J=I.Ob;G=I.Lb;K=I.Pb;O=I.Mb;aa=I.Qb;T=I.Nb;
if(!v||J<v)v=J;if(!y||G>y)y=G;if(!A||K<A)A=K;if(!C||O>C)C=O;if(!d||aa<d)d=aa;if(!e||T>e)e=T;k.push(I);p.push(M)}g=(v+y)/2;A=(A+C)/2;h=(d+e)/2;C=new Float32Array(f);b.i=d=new U(f);b.j=e=new U(f);b.W=f=new U(f);for(l=v=0;l<j;l++){y=k[l];E=y.count;M=p[l];c=Math.min(c,M);t=Math.max(t,M);for(J=0;J<E-1;J++){B=y.get(J);x=y.get(J+1);d.add(B[0],B[1],B[2]);d.add(x[0],x[1],x[2]);var I=B[0]-g,G=B[1]-A,K=B[2]-h,O=Math.sqrt(I*I+G*G+K*K),aa=x[0]-g,T=x[1]-A,ba=x[2]-h,ia=Math.sqrt(aa*aa+T*T+ba*ba);e.add(I/O,G/O,K/
O);e.add(aa/ia,T/ia,ba/ia);x=[Math.abs(x[0]-B[0]),Math.abs(x[1]-B[1]),Math.abs(x[2]-B[2])];B=Math.sqrt(x[0]*x[0]+x[1]*x[1]+x[2]*x[2]);x[0]/=B;x[1]/=B;x[2]/=B;f.add(x[0],x[1],x[2]);f.add(x[0],x[1],x[2]);C[v++]=M;C[v++]=M;C[v++]=M;C[v++]=M;C[v++]=M;C[v++]=M}}b.ja="LINES";j=new Qc;j.Ia=c;j.Fa=t;j.P=c;j.S=t;j.sc=C;j.pf=s;j.g=q;b.u=j;L.qa(this.c+".parse");c=new Rc;c.Y=b;c.r=a;this.dispatchEvent(c)};F("X.parserTRK",qf);F("X.parserTRK.prototype.parse",qf.prototype.parse);function rf(){ke.call(this);this.c="parserLUT"}H(rf,ke);
rf.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");this.X=c;c=Z(this,"uchar",c.byteLength);var d=c.length,e=0,f;for(f=0;f<d;f++)if(10==c[f]){var g=me(c,e,f),e=f+1,g=g.replace(/^\s+|\s+$/g,"");"#"!=g[0]&&(g=g.split(" "),g=g.filter(function(a){return""!=a}),6==g.length&&(g[2]=parseInt(g[2],10)/255,g[3]=parseInt(g[3],10)/255,g[4]=parseInt(g[4],10)/255,g[5]=parseInt(g[5],10)/255,a.add(parseInt(g[0],10),g[1],g[2],g[3],g[4],g[5],10)))}L.qa(this.c+".parse");c=new Rc;c.Y=b;c.r=a;this.dispatchEvent(c)};
F("X.parserLUT",rf);F("X.parserLUT.prototype.parse",rf.prototype.parse);function sf(){ke.call(this);this.c="parserNRRD"}H(sf,ke);
sf.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");this.X=c;c=Z(this,"uchar",c.byteLength);var d=c.length,e=r,f=0,g;for(g=1;g<d;g++)if(10==c[g-1]&&10==c[g]){e=me(c,0,g-2);f=g+1;break}var h,j,l,k,d=e.split(/\r?\n/),e=0;for(g=d.length;e<g;e++)if(h=d[e],h.match(/NRRD\d+/))this.uh=q;else if(!h.match(/^#/)&&(k=h.match(/(.*):(.*)/)))j=k[1].trim(),h=k[2].trim(),(l=this.Xg[j])?l.call(this,h):this[j]=h;this.uh||m(Error("Not an NRRD file"));"raw"!==this.encoding&&("gzip"!==this.encoding&&"gz"!==this.encoding)&&
m(Error("Only raw or gz/gzip encoding is allowed"));if(!this.Ga&&(this.Ga=[new S(1,0,0),new S(0,1,0),new S(0,0,1)],this.Se)){d=[];for(k=0;2>=k;k++)d.push(!isNaN(this.Se[k])?this.Ga[k].scale(this.Se[k]):n)}f=c.subarray(f);if("gzip"==this.encoding||"gz"==this.encoding)f=(new mf(new Uint8Array(f))).Nc();f=f.buffer;c={data:r,min:Infinity,max:-Infinity};c.data=new this.Fb(f);k=le(c.data);f=c.min=k[0];k=c.max=k[1];b.aa=[this.Pe[0],this.Pe[1],this.Pe[2]];d=(new S(this.Ga[0][0],this.Ga[0][1],this.Ga[0][2])).eb();
e=(new S(this.Ga[1][0],this.Ga[1][1],this.Ga[1][2])).eb();g=(new S(this.Ga[2][0],this.Ga[2][1],this.Ga[2][2])).eb();b.H=[d,e,g];b.Ia=b.U=f;b.Fa=b.T=k;-Infinity==b.P&&(b.P=f);Infinity==b.S&&(b.S=k);b.mc();L.qa(this.c+".parse");b.jb=ne(this,b,c);c=new Rc;c.Y=b;c.r=a;this.dispatchEvent(c)};
sf.prototype.Xg={type:function(a){switch(a){case "uchar":case "unsigned char":case "uint8":case "uint8_t":this.Fb=Uint8Array;break;case "signed char":case "int8":case "int8_t":this.Fb=Int8Array;break;case "short":case "short int":case "signed short":case "signed short int":case "int16":case "int16_t":this.Fb=Int16Array;break;case "ushort":case "unsigned short":case "unsigned short int":case "uint16":case "uint16_t":this.Fb=Uint16Array;break;case "int":case "signed int":case "int32":case "int32_t":this.Fb=
Int32Array;break;case "uint":case "unsigned int":case "uint32":case "uint32_t":this.Fb=Uint32Array;break;case "float":this.Fb=Float32Array;break;default:m(Error("Unsupported NRRD data type: "+a))}return this.type=a},endian:function(a){return this.Kj=a},encoding:function(a){return this.encoding=a},dimension:function(a){return this.xa=parseInt(a,10)},sizes:function(a){var b,c,d,e;d=a.split(/\s+/);e=[];b=0;for(c=d.length;b<c;b++)a=d[b],e.push(parseInt(a,10));return this.Pe=e},"space directions":function(a){var b,
c;a=a.match(/\(.*?\)/g);var d,e,f;f=[];d=0;for(e=a.length;d<e;d++)c=a[d],f.push(function(){var a,d,e,f;e=c.slice(1,-1).split(/,/);f=[];a=0;for(d=e.length;a<d;a++)b=e[a],f.push(parseFloat(b));return f}());return this.Ga=f},spacings:function(a){var b;b=a.split(/\s+/);var c,d,e;e=[];c=0;for(d=b.length;c<d;c++)a=b[c],e.push(parseFloat(a));return this.Se=e}};F("X.parserNRRD",sf);F("X.parserNRRD.prototype.parse",sf.prototype.parse);function tf(){ke.call(this);this.c="parserNII"}H(tf,ke);
tf.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");var d=c,e=-1,e="undefined"==typeof DataView?(new Int32Array(c,0,1))[0]:(new DataView(c,0)).getInt32(0,q);348!=e&&(d=(new mf(new Uint8Array(d))).Nc(),d=d.buffer);c=this.Sc(d);b.aa=[c.xa[1],c.xa[2],c.xa[3]];b.H=[c.ka[1],c.ka[2],c.ka[3]];d=c.min;e=c.max;b.Ia=b.U=d;b.Fa=b.T=e;-Infinity==b.P&&(b.P=d);Infinity==b.S&&(b.S=e);b.mc();L.qa(this.c+".parse");b.jb=ne(this,b,c);c=new Rc;c.Y=b;c.r=a;this.dispatchEvent(c)};
tf.prototype.Sc=function(a){this.X=a;a={yi:0,Ng:r,Og:r,Wg:0,vi:0,pi:0,Sg:r,xa:r,qh:0,rh:0,sh:0,oh:0,ve:0,Hg:0,Ci:0,ka:r,lg:0,ui:0,ti:0,Bi:0,zi:r,Pi:r,Jg:0,Kg:0,Ai:0,Ji:0,dh:0,eh:0,Qg:r,Gg:r,ii:0,wi:0,mi:0,ni:0,oi:0,ji:0,ki:0,li:0,Di:r,Ei:r,Fi:r,ph:r,wh:r,data:r,min:Infinity,max:-Infinity};a.yi=Z(this,"uint");a.Ng=Z(this,"uchar",10);a.Og=Z(this,"uchar",18);a.Wg=Z(this,"uint");a.vi=Z(this,"ushort");a.pi=Z(this,"uchar");a.Sg=Z(this,"uchar");a.xa=Z(this,"ushort",8);a.qh=Z(this,"float");a.rh=Z(this,"float");
a.sh=Z(this,"float");a.oh=Z(this,"ushort");a.ve=Z(this,"ushort");a.Hg=Z(this,"ushort");a.Ci=Z(this,"ushort");a.ka=Z(this,"float",8);a.lg=Z(this,"float");a.ui=Z(this,"float");a.ti=Z(this,"float");a.Bi=Z(this,"ushort");a.zi=Z(this,"uchar");a.Pi=Z(this,"uchar");a.Jg=Z(this,"float");a.Kg=Z(this,"float");a.Ai=Z(this,"float");a.Ji=Z(this,"float");a.dh=Z(this,"uint",1);a.eh=Z(this,"uint",1);a.Qg=Z(this,"uchar",80);a.Gg=Z(this,"uchar",24);a.ii=Z(this,"ushort");a.wi=Z(this,"ushort");a.mi=Z(this,"float");a.ni=
Z(this,"float");a.oi=Z(this,"float");a.ji=Z(this,"float");a.ki=Z(this,"float");a.li=Z(this,"float");a.Di=Z(this,"float",4);a.Ei=Z(this,"float",4);a.Fi=Z(this,"float",4);a.ph=Z(this,"uchar",16);a.wh=Z(this,"uchar",4);this.B=parseInt(a.lg,10);var b=a.xa[1]*a.xa[2]*a.xa[3];switch(a.ve){case 2:a.data=Z(this,"uchar",b);break;case 4:a.data=Z(this,"sshort",b);break;case 8:a.data=Z(this,"sint",b);break;case 16:a.data=Z(this,"float",b);break;case 256:a.data=Z(this,"schar",b);break;case 512:a.data=Z(this,"ushort",
b);break;case 768:a.data=Z(this,"uint",b);break;default:m(Error("Unsupported NII data type: "+a.ve))}b=le(a.data);a.min=b[0];a.max=b[1];return a};F("X.parserNII",tf);F("X.parserNII.prototype.parse",tf.prototype.parse);function uf(){ke.call(this);this.c="parserOBJ"}H(uf,ke);
uf.prototype.parse=function(a,b,c){L.Ea(this.c+".parse");this.X=c;c=c.byteLength;var d=Z(this,"uchar",c),e=[];b.i=new U(c);b.j=new U(c);var f=b.i,g=b.j,h=0,j;for(j=0;j<c;++j)if(10==d[j]){var l=me(d,h,j).replace(/\s{2,}/g," ").split(" ");if("v"==l[0])e.push([parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])]);else if("f"==l[0]){var k=e[parseInt(l[1],10)-1],h=e[parseInt(l[2],10)-1],l=e[parseInt(l[3],10)-1];f.add(k[0],k[1],k[2]);f.add(h[0],h[1],h[2]);f.add(l[0],l[1],l[2]);k=new S(k[0],k[1],k[2]);l=
new S(l[0],l[1],l[2]);h=zc((new S(h[0],h[1],h[2])).la(k),l.la(k));h.normalize();g.add(h.x,h.y,h.b);g.add(h.x,h.y,h.b);g.add(h.x,h.y,h.b)}h=j+1}L.qa(this.c+".parse");c=new Rc;c.Y=b;c.r=a;this.dispatchEvent(c)};F("X.parserOBJ",uf);F("X.parserOBJ.prototype.parse",uf.prototype.parse);function vf(){Q.call(this);this.c="loader";this.ic=new rc;this.Fc=0}H(vf,Q);function wf(a,b){a.Fc+=b/a.ic.td()/3;a.Fc=Math.min(1,a.Fc);var c=new od;c.rf=a.Fc;a.dispatchEvent(c)}function xf(a){a=a.p.dd;var b=a.split(".").pop().toUpperCase();b==a.toUpperCase()&&(b="");b in yf||m(Error("The "+b+" file format is not supported."));return[a,b,yf[b][0],yf[b][1],yf[b][2]]}
vf.prototype.load=function(a,b){(!a||!b)&&m(Error("No container or object to load."));if(!uc(this.ic.J,a.sa)||this.ic.get(a.sa)){this.ic.set(a.sa,s);var c=xf(a)[0];if(a.Ib!=r)this.parse(r,a,b);else{var d=new XMLHttpRequest;P(d,"abort",this.Cf.bind(this,d,a,b));P(d,"error",this.Cf.bind(this,d,a,b));P(d,"load",this.parse.bind(this,d,a,b));d.open("GET",c,q);d.responseType="arraybuffer";d.send(r)}}};
vf.prototype.parse=function(a,b,c){wf(this,1);setTimeout(function(){var d=xf(b),e=d[3],d=new d[2];Tb(d,cd,this.complete.bind(this));var f=b.Ib;f==r&&(f=a.response);d.parse(b,c,f,e)}.bind(this),100)};vf.prototype.complete=function(a){wf(this,1);setTimeout(function(){var b=a.r,c=a.Y;b.p.g=s;b.g=q;c.o();this.ic.set(b.sa,q)}.bind(this),100)};vf.prototype.Cf=function(a,b,c){m(Error("Loading failed: ",b,c))};
var yf={OBJ:[uf,r],STL:[Ce,r],VTK:[Ee,r],TRK:[qf,r],FSM:[Ge,r],INFLATED:[Ge,r],SMOOTHWM:[Ge,r],SPHERE:[Ge,r],PIAL:[Ge,r],ORIG:[Ge,r],NRRD:[sf,r],NII:[tf,r],GZ:[tf,r],DCM:[De,r],DICOM:[De,r],"":[De,r],CRV:[pf,r],LABEL:[of,r],MGH:[nf,s],MGZ:[nf,q],TXT:[rf,r],LUT:[rf,r],PNG:[ue,"png"],JPG:[ue,"jpeg"],JPEG:[ue,"jpeg"],GIF:[ue,"gif"]};function zf(a){function b(a,b,d){b=2*b*Math.PI;b=za(Aa(j,Math.cos(b)),Aa(l,Math.sin(b)));a=za(za(c,Aa(e,a)),Aa(b,f));d=za(Aa(b,1-Math.abs(d)),Aa(g,d));return new cc(a,d)}this.A=[];a=a||{};var c=new ya(a.start||[0,-1,0]),d=new ya(a.end||[0,1,0]),e=Ba(d,c),f=a.Ta||1;a=a.Qe||16;for(var g=Ca(e),h=0.5<Math.abs(g.y()),j=Ca((new ya(h,!h,0)).Yb(g)),l=Ca(j.Yb(g)),h=new cc(c,Da(g)),d=new cc(d,Ca(g)),k=[],p=0;p<a;p++){var t=p/a,v=(p+1)/a;k.push(new ec([h,b(0,t,-1),b(0,v,-1)]));k.push(new ec([b(0,v,0),b(0,t,
0),b(1,t,0),b(1,v,0)]));k.push(new ec([d,b(1,v,1),b(1,t,1)]))}return mc(k)}H(zf,lc);function Af(){V.call(this);this.c="cylinder";this.ie=[-10,-10,-10];this.Qd=[10,10,10];this.Rb=10;this.Ub=32;Fa(this,new Tc)}H(Af,V);Af.prototype.__defineGetter__("start",u("ie"));Af.prototype.__defineSetter__("start",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid start"));this.ie=a});Af.prototype.__defineGetter__("end",u("Qd"));Af.prototype.__defineSetter__("end",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid end"));this.Qd=a});Af.prototype.__defineGetter__("radius",u("Rb"));
Af.prototype.__defineSetter__("radius",function(a){D(a)||m(Error("Invalid radius."));this.Rb=a});Af.prototype.o=function(){Vc(this,new zf({start:this.ie,end:this.Qd,Ta:this.Rb,Qe:this.Ub}));Af.t.o.call(this)};F("X.cylinder",Af);F("X.cylinder.prototype.modified",Af.prototype.o);function Bf(a){function b(a,b){a*=2*Math.PI;b*=Math.PI;var e=new ya(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new cc(za(c,Aa(e,d)),e))}this.A=[];a=a||{};var c=new ya(a.re||[0,0,0]),d=a.Ta||1,e=a.Qe||16;a=a.Gi||8;for(var f=[],g=[],h=0;h<e;h++)for(var j=0;j<a;j++)g=[],b(h/e,j/a),0<j&&b((h+1)/e,j/a),j<a-1&&b((h+1)/e,(j+1)/a),b(h/e,(j+1)/a),f.push(new ec(g));return mc(f)}H(Bf,lc);function Cf(){V.call(this);this.c="sphere";this.k=[0,0,0];this.Rb=5;this.Ub=32;this.Ag=16;Fa(this,new Tc)}H(Cf,V);Cf.prototype.__defineGetter__("center",u("k"));Cf.prototype.__defineSetter__("center",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid center"));this.k=a});Cf.prototype.__defineGetter__("radius",u("Rb"));Cf.prototype.__defineSetter__("radius",function(a){D(a)||m(Error("Invalid radius."));this.Rb=a});
Cf.prototype.o=function(){Vc(this,new Bf({re:this.k,Ta:this.Rb,Qe:this.Ub,Gi:this.Ag}));Cf.t.o.call(this)};F("X.sphere",Cf);F("X.sphere.prototype.modified",Cf.prototype.o);function Be(a){R.call(this);this.c="labelmap";this.ab=a}H(Be,R);Be.prototype.o=function(){var a=new Rc;a.Y=this;this.dispatchEvent(a);this.ab.o()};F("X.labelmap",Be);function Df(a){this.A=[];a=a||{};var b=new ya(a.re||[0,0,0]),c=!a.Ta?[1,1,1]:a.Ta.length?a.Ta:[a.Ta,a.Ta,a.Ta];return mc([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(function(a){return new ec(a[0].map(function(e){e=new ya(b.x()+c[0]*(2*!!(e&1)-1),b.y()+c[1]*(2*!!(e&2)-1),b.b()+c[2]*(2*!!(e&4)-1));return new cc(e,new ya(a[1]))}))}))}H(Df,lc);function Ef(){V.call(this);this.c="cube";this.k=[0,0,0];this.Xd=this.Wd=this.Vd=20;this.Vb=[0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0];Fa(this,new Tc)}H(Ef,V);Ef.prototype.__defineGetter__("center",u("k"));Ef.prototype.__defineSetter__("center",function(a){(a==r||!z(a)||3!=a.length)&&m(Error("Invalid center"));this.k=a});Ef.prototype.__defineGetter__("lengthX",u("Vd"));
Ef.prototype.__defineSetter__("lengthX",function(a){D(a)||m(Error("Invalid lengthX."));this.Vd=a});Ef.prototype.__defineGetter__("lengthY",u("Wd"));Ef.prototype.__defineSetter__("lengthY",function(a){D(a)||m(Error("Invalid lengthY."));this.Wd=a});Ef.prototype.__defineGetter__("lengthZ",u("Xd"));Ef.prototype.__defineSetter__("lengthZ",function(a){D(a)||m(Error("Invalid lengthZ."));this.Xd=a});Ef.prototype.o=function(){Vc(this,new Df({re:this.k,Ta:[this.Vd/2,this.Wd/2,this.Xd/2]}));Ef.t.o.call(this)};
F("X.cube",Ef);F("X.cube.prototype.modified",Ef.prototype.o);function fe(a){de.call(this,a);this.c="interactor3D";this.Dj=s}H(fe,de);fe.prototype.Qc=function(a){fe.t.Qc.call(this,a);var b=new jd;a.nc==r&&(a.nc=0);b.Qa=0>a.nc;b.Ha=q;this.dispatchEvent(b)};function Ff(a){Q.call(this);this.c="array";this.v=[];this.$e=a}H(Ff,Q);Ff.prototype.add=function(a){this.v.push(a);return q};Ff.prototype.clear=function(){this.v.length=0};function Gf(a,b,c){var d=c-b;if(!(2>d)){d=b+Math.floor(d/2);Gf(a,b,d);for(Gf(a,d,c);b<d;++b)if(0<a.$e(a.v[b],a.v[d])){var e=a.v[b];a.v[b]=a.v[d];for(var f=a,g=d,h=c;g+1<h&&0>f.$e(f.v[g+1],e);){var j=f,l=g+1,k=j.v[g];j.v[g]=j.v[l];j.v[l]=k;++g}f.v[g]=e}}}Ff.prototype.sort=function(){Gf(this,0,this.v.length)};function Hf(a){tb.call(this);this.cb=a;this.w=[]}H(Hf,tb);var If=[];function Jf(a,b,c,d,e){z(c)||(If[0]=c,c=If);for(var f=0;f<c.length;f++){var g=P(b,c[f],d||a,e||s,a.cb||a);a.w.push(g)}}Hf.prototype.Me=function(){Fb(this.w,Wb);this.w.length=0};Hf.prototype.handleEvent=function(){m(Error("EventHandler.handleEvent not implemented"))};function Kf(){}Kf.Ef=function(){return Kf.Mf?Kf.Mf:Kf.Mf=new Kf};Kf.prototype.Bh=0;Kf.Ef();function Lf(a){tb.call(this);this.Bb=a||yd();this.ri=Mf}H(Lf,bc);Lf.prototype.mh=Kf.Ef();var Mf=r;w=Lf.prototype;w.Lf=r;w.pc=s;w.s=r;w.ri=r;w.Rc=r;w.Lc=r;w.se=r;w.l=u("s");w.Oe=function(a){this.Rc&&this.Rc!=a&&m(Error("Method not supported"));Lf.t.Oe.call(this,a)};w.ud=u("Bb");w.lc=function(){this.s=this.Bb.createElement("div")};w.cc=function(a){this.Eb(a)};
w.Eb=function(a,b){this.pc&&m(Error("Component already rendered"));this.s||this.lc();a?a.insertBefore(this.s,b||r):this.Bb.N.body.appendChild(this.s);(!this.Rc||this.Rc.pc)&&this.qd()};w.qd=function(){function a(a){!a.pc&&a.l()&&a.qd()}this.pc=q;this.Lc&&Fb(this.Lc,a,n)};w.rd=function(){function a(a){a.pc&&a.rd()}this.Lc&&Fb(this.Lc,a,n);this.fh&&this.fh.Me();this.pc=s};
w.removeChild=function(a,b){if(a){var c=ma(a)?a:a.Lf||(a.Lf=":"+(a.mh.Bh++).toString(36)),d;this.se&&c?(d=this.se,d=(c in d?d[c]:n)||r):d=r;a=d;c&&a&&(d=this.se,c in d&&delete d[c],Ib(this.Lc,a),b&&(a.rd(),a.s&&Fd(a.s)),c=a,c==r&&m(Error("Unable to set parent component")),c.Rc=r,Lf.t.Oe.call(c,r))}a||m(Error("Child is not in parent component"));return a};function Of(){tb.call(this)}H(Of,bc);w=Of.prototype;w.We=0;w.Pc=0;w.Ce=100;w.Bf=0;w.Te=1;w.th=s;w.Ah=s;w.Ld=function(a){a=Pf(this,a);this.We!=a&&(this.We=a+this.Bf>this.Ce?this.Ce-this.Bf:a<this.Pc?this.Pc:a,!this.th&&!this.Ah&&this.dispatchEvent("change"))};w.xd=function(){return Pf(this,this.We)};w.wd=function(){return Pf(this,this.Pc)};w.vd=function(){return Pf(this,this.Ce)};function Pf(a,b){return a.Te==r?b:a.Pc+Math.round((b-a.Pc)/a.Te)*a.Te};function Qf(a){Lf.call(this,a);this.Tc=new Of;P(this.Tc,"change",this.gh,s,this)}H(Qf,Lf);var Rf={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};w=Qf.prototype;w.lc=function(){this.Ua=this.ud().lc("div","progress-bar-thumb");var a=Rf[this.cg];this.s=this.ud().lc("div",a,this.Ua);Sf(this);a=this.wd();this.l().setAttribute("aria-valuemin",a);a=this.vd();this.l().setAttribute("aria-valuemax",a)};
w.qd=function(){Qf.t.qd.call(this);N&&7>jb&&P(this.l(),"resize",this.Od,s,this);this.Od();var a=this.l();a.setAttribute("role","progressbar");a.setAttribute("aria-live","polite")};w.rd=function(){Qf.t.rd.call(this);N&&7>jb&&Vb(this.l(),"resize",this.Od,s,this)};w.xd=function(){return this.Tc.xd()};w.Ld=function(a){this.Tc.Ld(a);this.l()&&Sf(this)};function Sf(a){var b=a.xd();a.l().setAttribute("aria-valuenow",b)}w.wd=function(){return this.Tc.wd()};w.vd=function(){return this.Tc.vd()};w.cg="horizontal";
w.gh=function(){this.Od();this.dispatchEvent("change")};w.Od=function(){if(this.Ua){var a=this.wd(),b=this.vd(),a=(this.xd()-a)/(b-a),b=Math.round(100*a);"vertical"==this.cg?N&&7>jb?(this.Ua.style.top=0,this.Ua.style.height="100%",b=this.Ua.offsetHeight,a=Math.round(a*b),this.Ua.style.top=b-a+"px",this.Ua.style.height=a+"px"):(this.Ua.style.top=100-b+"%",this.Ua.style.height=b+"%"):this.Ua.style.width=b+"%"}};function Tf(a,b){a==r&&m(Error("No valid parent element."));b==r&&m(Error("Invalid initial value."));Qf.call(this);this.c="progressbar";this.ma=a;this.lf="";this.Xc=this.$a=r;this.Hb=[];var c;c=".progress-bar-horizontal {\n position: relative;\n border: 1px solid #949dad;\n";c+=" background: white;\n";c+=" padding: 1px;\n";c+=" overflow: hidden;\n";c+=" margin: 2px;\n";c+=" width: 100px;\n";c+=" height: 5px;\n";c+="}";var d;d=".progress-bar-thumb {\n position: relative;\n background: #F62217;\n";
d+=" overflow: hidden;\n";d+=" width: 0%;\n";d+=" height: 100%;\n";d+="}";var e;e=".progress-bar-thumb-done {\n background: #57E964;\n}";this.Hb=[c,d,e];this.Ld(b);this.ye()}H(Tf,Qf);
Tf.prototype.ye=function(){if("static"==this.ma.style.position||""==this.ma.style.position)this.lf=this.ma.style.position,this.ma.style.position="relative";var a=document.getElementsByTagName("head")[0],b=Dd("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.Hb[0])),d=document.createTextNode(String(this.Hb[1])),e=document.createTextNode(String(this.Hb[2]));a.appendChild(b);b.appendChild(c);b.appendChild(d);b.appendChild(e);this.$a=b;this.cc(this.ma);a=this.l();a.style.position=
"absolute";a.style.top=(this.ma.clientHeight-5)/2+"px";a.style.left=(this.ma.clientWidth-100)/2+"px";a.classList.add("xtk-progress-bar")};function Uf(a){var b=a.l().style.top,c=a.l().style.left;Fd(a.l());var d=new Tf(a.ma,100),e=d.l();e.style.position="absolute";e.style.top=b;e.style.left=c;e.classList.add("xtk-progress-bar");(e.firstElementChild!=n?e.firstElementChild:Gd(e.firstChild)).classList.add("progress-bar-thumb-done");a.Xc=d}
Tf.prototype.zd=function(){this.$a&&Fd(this.$a);this.l()&&Fd(this.l());this.Xc&&Fd(this.Xc.l());this.Xc=this.$a=r;this.ma.style.position=this.lf};function Vf(a,b,c){na(a)?c&&(a=va(a,c)):a&&"function"==typeof a.handleEvent?a=va(a.handleEvent,a):m(Error("Invalid listener argument"));return 2147483647<b?-1:fa.setTimeout(a,b||0)};function Wf(){Q.call(this);this.c="renderer";this.r=window.document.body;this.M=this.r.clientWidth;this.G=this.r.clientHeight;this.Kb=this.q=this.ga=r;this.Ya=new Ff(Sc);this.Ra=[];this.C=r;this.ce=this.ad=this.bd=s;this.a=this.na=r;this.F={PROGRESSBAR_ENABLED:q,INTERMEDIATE_RENDERING:s};this.Ye=-1;window.console.log("XTK release 10 -- 2013-02-24 19:33:03 -- http://www.goXTK.com -- @goXTK")}H(Wf,Q);w=Wf.prototype;w.Qh=function(a){this.na&&this.na.Ld(100*a.rf)};
w.Gh=function(a){a!=r&&a instanceof Rc&&a.Y&&this.Va(a.Y)};w.Ie=function(a){(a==r||!(a instanceof ld))&&m(Error("Invalid hover event."))};w.Rh=function(){var a=Bd(this.r);this.M=a.clientWidth;this.G=a.clientHeight;a=Bd(this.ga);a.width=this.M;a.height=this.G;"renderer3D"==this.c&&(this.a.viewport(0,0,this.M,this.G),this.q.mf=L.d.Be(L.d.Oc(),this.q.bf,this.ga.width/this.ga.height,1,1E4));this.qc()};w.Je=function(a){(a==r||!(a instanceof kd))&&m(Error("Invalid scroll event."))};
Wf.prototype.__defineGetter__("config",u("F"));Wf.prototype.__defineGetter__("interactor",u("Kb"));Wf.prototype.__defineGetter__("camera",u("q"));Wf.prototype.__defineGetter__("loadingCompleted",u("ad"));Wf.prototype.__defineGetter__("container",u("r"));Wf.prototype.__defineSetter__("container",function(a){a==r&&m(Error("An ID to a valid container (<div>..) is required."));var b=a;ma(b)&&(b=Bd(a));oa(b)&&1==b.nodeType||m(Error("Could not find the given container."));this.r=b});w=Wf.prototype;
w.qc=function(){this.q.reset()};
w.ea=function(a){var b=Dd("canvas");this.r.appendChild(b);this.M=this.r.clientWidth;this.G=this.r.clientHeight;b.width=this.M;b.height=this.G;try{var c=b.getContext(a);c||m(Error())}catch(d){var e="Sorry, "+a+' context is <strong>not supported</strong> on this machine! See <a href="http://crash.goXTK.com" target="_blank">http://crash.goXTK.com</a> for requirements..';this.r.innerHTML='<h3 style="color:red;font-family:sans-serif;">Oooops..</h3><p style="color:red;font-family:sans-serif;">'+e+"</p>";
m(Error(e))}this.C=new vf;P(this.C,dd,this.Qh.bind(this));this.ga=b;this.a=c;b=new fe(this.ga);"2d"==a&&(b=new he(this.ga));b.ea();P(b,ad,this.qc.bind(this));P(b,ed,this.Ie.bind(this));P(b,$c,this.Je.bind(this));this.Kb=b;b=new je(this.M,this.G);"2d"==a&&(b=new ve(this.M,this.G));b.observe(this.Kb);this.q=b;P(window,"resize",this.Rh,s,this)};w.add=function(a){(a instanceof Ef||a instanceof Cf||a instanceof Af)&&a.o();this.Ra.push(a);this.Va(a)};
w.Va=function(a){(!this.ga||!this.a)&&m(Error("The renderer was not initialized properly."));a==r&&(window.console.log(a),m(Error("Illegal object.")));var b;b=pa(a);var c=Pb[b];if(c){var d=ja(cd),e=ja(n);d&&e?(c=Ob[cd],b=!!c&&!!c[n]&&b in c[n]):b=!d&&!e?q:Hb(c,function(a){return d&&a.type==cd||e&&a.capture==n})}else b=s;b||P(a,cd,this.Gh.bind(this))};w.get=function(a){a==r&&m(Error("Invalid object id."));for(var b=this.Ya.v,c=b.length,d=0,d=0;d<c;d++)if(b[d].sa==a)return b[d];return r};
w.cc=function(){(!this.ga||!this.a)&&m(Error("The renderer was not initialized properly."));if(this.of==r){if(tc(this.C.ic)){if(this.F.PROGRESSBAR_ENABLED&&!this.na&&(this.na=new Tf(this.r,3)),this.ce=this.ad=s,this.of=Vf(function(){this.of=r;this.cc()}.bind(this),100),!this.F.INTERMEDIATE_RENDERING)return}else if(!this.ad&&!this.ce&&(this.ce=q,eval("this.onShowtime()"),this.ad=q),this.na){this.F.PROGRESSBAR_ENABLED&&(this.na&&!this.Ze)&&(Uf(this.na),this.Ze=Vf(function(){this.Ze=r;this.na&&(this.na.zd(),
this.na=r);this.cc()}.bind(this),700));return}this.Ye=window.requestAnimationFrame(this.cc.bind(this),this.ga);eval("this.onRender()");this.Eb(s,q)}};w.bg=ca();w.$f=ca();w.Eb=ca();
w.od=function(){window.cancelAnimationFrame(this.Ye);this.C&&(delete this.C,this.C=r);this.na&&(this.na.zd(),delete this.na,this.na=r);this.Ya.clear();delete this.Ya;this.Ra.length=0;delete this.Ra;delete this.C;this.C=r;delete this.q;this.q=r;delete this.Kb;this.Kb=r;delete this.a;this.a=r;Fd(this.ga);delete this.ga;this.ga=r};function Xf(a,b,c,d,e,f,g,h){var j,l;if(j=c.offsetParent){var k="HTML"==j.tagName||"BODY"==j.tagName;if(!k||"static"!=Ld(j,"position"))l=Qd(j),k||(k=(k=Rd(j))&&cb?-j.scrollLeft:k&&(!N||!qb("8"))&&"visible"!=Ld(j,"overflowX")?j.scrollWidth-j.clientWidth-j.scrollLeft:j.scrollLeft,l=rd(l,new qd(k,j.scrollTop)))}j=l||new qd;l=Qd(a);k=Td(a);l=new ud(l.x,l.y,k.width,k.height);(k=Pd(a))&&l.Nf(new ud(k.left,k.top,k.right-k.left,k.bottom-k.top));var k=yd(a),p=yd(c);if(k.N!=p.N){var t=k.N.body,p=p.N.parentWindow||
p.N.defaultView,v=new qd(0,0),y=Ad(t)?Ad(t).parentWindow||Ad(t).defaultView:window,A=t;do{var C;if(y==p)C=Qd(A);else{C=A;var E=new qd;if(1==C.nodeType){if(C.getBoundingClientRect){var x=Nd(C);E.x=x.left;E.y=x.top}else{var x=Jd(yd(C)),B=Qd(C);E.x=B.x-x.x;E.y=B.y-x.y}cb&&!qb(12)&&(x=n,x=n,N?x="-ms-transform":eb?x="-webkit-transform":bb?x="-o-transform":cb&&(x="-moz-transform"),B=n,x&&(B=Ld(C,x)),B||(B=Ld(C,"transform")),B?(C=B.match($d),x=!C?new qd(0,0):new qd(parseFloat(C[1]),parseFloat(C[2]))):x=
new qd(0,0),E=new qd(E.x+x.x,E.y+x.y))}else x=na(C.bh),B=C,C.targetTouches?B=C.targetTouches[0]:x&&C.Ma.targetTouches&&(B=C.Ma.targetTouches[0]),E.x=B.clientX,E.y=B.clientY;C=E}v.x+=C.x;v.y+=C.y}while(y&&y!=p&&(A=y.frameElement)&&(y=y.parent));t=rd(v,Qd(t));N&&!Id(k)&&(t=rd(t,Jd(k)));l.left+=t.x;l.top+=t.y}a=(b&4&&Rd(a)?b^2:b)&-5;b=new qd(a&2?l.left+l.width:l.left,a&1?l.top+l.height:l.top);b=rd(b,j);e&&(b.x+=(a&2?-1:1)*e.x,b.y+=(a&1?-1:1)*e.y);var G;if(g&&(G=Pd(c)))G.top-=j.y,G.right-=j.x,G.bottom-=
j.y,G.left-=j.x;return Yf(b,c,d,f,G,g,h)}
function Yf(a,b,c,d,e,f,g){a=a.h();var h=0,j=(c&4&&Rd(b)?c^2:c)&-5;c=Td(b);g=g?g.h():c.h();if(d||0!=j)j&2?a.x-=g.width+(d?d.right:0):d&&(a.x+=d.left),j&1?a.y-=g.height+(d?d.bottom:0):d&&(a.y+=d.top);if(f){if(e){h=a;d=0;if(65==(f&65)&&(h.x<e.left||h.x>=e.right))f&=-2;if(132==(f&132)&&(h.y<e.top||h.y>=e.bottom))f&=-5;h.x<e.left&&f&1&&(h.x=e.left,d|=1);h.x<e.left&&(h.x+g.width>e.right&&f&16)&&(g.width=Math.max(g.width-(h.x+g.width-e.right),0),d|=4);h.x+g.width>e.right&&f&1&&(h.x=Math.max(e.right-g.width,
e.left),d|=1);f&2&&(d|=(h.x<e.left?16:0)|(h.x+g.width>e.right?32:0));h.y<e.top&&f&4&&(h.y=e.top,d|=2);h.y<=e.top&&(h.y+g.height<e.bottom&&f&32)&&(g.height=Math.max(g.height-(e.top-h.y),0),h.y=0,d|=8);h.y>=e.top&&(h.y+g.height>e.bottom&&f&32)&&(g.height=Math.max(g.height-(h.y+g.height-e.bottom),0),d|=8);h.y+g.height>e.bottom&&f&4&&(h.y=Math.max(e.bottom-g.height,e.top),d|=2);f&8&&(d|=(h.y<e.top?64:0)|(h.y+g.height>e.bottom?128:0));h=d}else h=256;if(h&496)return h}f=a;e=cb&&(Ua||hb)&&qb("1.9");f instanceof
qd?(a=f.x,f=f.y):(a=f,f=n);b.style.left=Sd(a,e);b.style.top=Sd(f,e);if(!(c==g||(!c||!g?0:c.width==g.width&&c.height==g.height)))a=Id(yd(Ad(b))),N&&(!a||!qb("8"))?(c=b.style,a?(N?(a=Xd(b,"paddingLeft"),e=Xd(b,"paddingRight"),f=Xd(b,"paddingTop"),d=Xd(b,"paddingBottom"),a=new sd(f,e,d,a)):(a=Kd(b,"paddingLeft"),e=Kd(b,"paddingRight"),f=Kd(b,"paddingTop"),d=Kd(b,"paddingBottom"),a=new sd(parseFloat(f),parseFloat(e),parseFloat(d),parseFloat(a))),N?(e=Zd(b,"borderLeft"),f=Zd(b,"borderRight"),d=Zd(b,"borderTop"),
b=Zd(b,"borderBottom"),b=new sd(d,f,b,e)):(e=Kd(b,"borderLeftWidth"),f=Kd(b,"borderRightWidth"),d=Kd(b,"borderTopWidth"),b=Kd(b,"borderBottomWidth"),b=new sd(parseFloat(d),parseFloat(f),parseFloat(b),parseFloat(e))),c.pixelWidth=g.width-b.left-a.left-a.right-b.right,c.pixelHeight=g.height-b.top-a.top-a.bottom-b.bottom):(c.pixelWidth=g.width,c.pixelHeight=g.height)):(b=b.style,cb?b.MozBoxSizing="border-box":eb?b.WebkitBoxSizing="border-box":b.boxSizing="border-box",b.width=Math.max(g.width,0)+"px",
b.height=Math.max(g.height,0)+"px");return h};function Zf(){}Zf.prototype.Oa=ca();function $f(a,b,c){this.element=a;this.yf=b;this.ei=c}H($f,Zf);$f.prototype.Oa=function(a,b,c){Xf(this.element,this.yf,a,b,n,c,this.ei)};function ag(a,b){tb.call(this);this.cb=new Hf(this);this.Ne(a||r);b&&(this.rc=b)}H(ag,bc);w=ag.prototype;w.s=r;w.Fg=q;w.sf=r;w.oa=s;w.xi=s;w.Ae=-1;w.Qf=-1;w.lh=s;w.Ug=q;w.rc="toggle_display";w.l=u("s");w.Ne=function(a){this.oa&&m(Error("Can not change this state of the popup while showing."));this.s=a};
function bg(a,b){a.Nd&&a.Nd.stop();a.yd&&a.yd.stop();if(b){if(!a.oa&&a.Ge()){a.s||m(Error("Caller must call setElement before trying to show the popup"));a.Oa();var c=Ad(a.s);a.lh&&Jf(a.cb,c,"keydown",a.Eh,q);if(a.Fg)if(Jf(a.cb,c,"mousedown",a.Yf,q),N){var d;try{d=c.activeElement}catch(e){}for(;d&&"IFRAME"==d.nodeName;){try{var f=d.contentDocument||d.contentWindow.document}catch(g){break}c=f;d=c.activeElement}Jf(a.cb,c,"mousedown",a.Yf,q);Jf(a.cb,c,"deactivate",a.Xf)}else Jf(a.cb,c,"blur",a.Xf);"toggle_display"==
a.rc?(a.s.style.visibility="visible",Vd(a.s,q)):"move_offscreen"==a.rc&&a.Oa();a.oa=q;a.Nd?(Tb(a.Nd,"end",a.ag,s,a),a.Nd.play()):a.ag()}}else cg(a)}w.Oa=ga;function cg(a,b){if(!a.oa||!a.dispatchEvent({type:"beforehide",target:b}))return s;a.cb&&a.cb.Me();a.oa=s;a.Qf=xa();a.yd?(Tb(a.yd,"end",wa(a.xf,b),s,a),a.yd.play()):a.xf(b);return q}w.xf=function(a){"toggle_display"==this.rc?this.xi?Vf(this.If,0,this):this.If():"move_offscreen"==this.rc&&(this.s.style.top="-10000px");this.He(a)};
w.If=function(){this.s.style.visibility="hidden";Vd(this.s,s)};w.Ge=function(){return this.dispatchEvent("beforeshow")};w.ag=function(){this.Ae=xa();this.Qf=-1;this.dispatchEvent("show")};w.He=function(a){this.dispatchEvent({type:"hide",target:a})};w.Yf=function(a){a=a.target;!Hd(this.s,a)&&((!this.sf||Hd(this.sf,a))&&!(150>xa()-this.Ae))&&cg(this,a)};w.Eh=function(a){27==a.keyCode&&cg(this,a.target)&&(a.preventDefault(),a.stopPropagation())};
w.Xf=function(a){if(this.Ug){var b=Ad(this.s);if(N||bb){if(a=b.activeElement,!a||Hd(this.s,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>xa()-this.Ae||cg(this)}};function dg(a,b){this.te=a instanceof qd?a:new qd(a,b)}H(dg,Zf);dg.prototype.Oa=function(a,b,c,d){Xf(Md(a),0,a,b,this.te,c,r,d)};function eg(a,b){this.hi=4;this.Ed=b||n;ag.call(this,a)}H(eg,ag);eg.prototype.Oa=function(){if(this.Ed){var a=!this.oa&&"move_offscreen"!=this.rc,b=this.l();a&&(b.style.visibility="hidden",Vd(b,q));this.Ed.Oa(b,this.hi,this.Nj);a&&Vd(b,s)}};function fg(a){this.J=new rc;a&&this.le(a)}function gg(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+pa(a):b.substr(0,1)+a}w=fg.prototype;w.td=function(){return this.J.td()};w.add=function(a){this.J.set(gg(a),a)};w.le=function(a){a=qc(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};w.Me=function(a){a=qc(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};w.remove=function(a){return this.J.remove(gg(a))};w.clear=function(){this.J.clear()};
w.contains=function(a){a=gg(a);return uc(this.J.J,a)};w.Nf=function(a){var b=new fg;a=qc(a);for(var c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};w.bb=function(){return this.J.bb()};w.h=function(){return new fg(this)};function hg(a,b,c){this.Bb=c||(a?yd(Bd(a)):yd());eg.call(this,this.Bb.lc("div",{style:"position:absolute;display:none;"}));this.ue=new qd(1,1);this.pd=new fg;a&&ig(this,a);if(b!=r)if(a=this.l(),"textContent"in a)a.textContent=b;else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else{for(;c=a.firstChild;)a.removeChild(c);a.appendChild(Ad(a).createTextNode(String(b)))}}H(hg,eg);var jg=[];w=hg.prototype;w.wa=r;w.className="goog-tooltip";
w.ig=500;w.kh=0;w.ud=u("Bb");function ig(a,b){b=Bd(b);a.pd.add(b);P(b,"mouseover",a.jh,s,a);P(b,"mouseout",a.Ff,s,a);P(b,"mousemove",a.ih,s,a);P(b,"focus",a.hh,s,a);P(b,"blur",a.Ff,s,a)}w.Ne=function(a){var b=this.l();b&&Fd(b);hg.t.Ne.call(this,a);a&&(b=this.Bb.N.body,b.insertBefore(a,b.lastChild))};
w.Ge=function(){if(!ag.prototype.Ge.call(this))return s;if(this.anchor)for(var a,b=0;a=jg[b];b++)Hd(a.l(),this.anchor)||bg(a,s);0<=Eb(jg,this)||jg.push(this);a=this.l();a.className=this.className;kg(this);P(a,"mouseover",this.Hf,s,this);P(a,"mouseout",this.Gf,s,this);lg(this);return q};
w.He=function(){Ib(jg,this);for(var a=this.l(),b,c=0;b=jg[c];c++)b.anchor&&Hd(a,b.anchor)&&bg(b,s);this.eg&&mg(this.eg);Vb(a,"mouseover",this.Hf,s,this);Vb(a,"mouseout",this.Gf,s,this);this.anchor=n;if(0==(this.gb?this.oa?4:1:this.oc?3:this.oa?2:0))this.Jd=s;ag.prototype.He.call(this)};w.Vf=function(a,b){this.anchor==a&&this.pd.contains(this.anchor)&&(this.Jd||!this.Qj?(bg(this,s),this.oa||(this.anchor=a,this.Ed=b||ng(this,0)||n,this.oa&&this.Oa(),bg(this,q))):this.anchor=n);this.gb=n};
w.zh=function(a){this.oc=n;a==this.anchor&&(this.wa==r||this.wa!=this.l()&&!this.pd.contains(this.wa))&&(!this.uf||!this.uf.wa)&&bg(this,s)};function pg(a,b){var c=Jd(a.Bb);a.ue.x=b.clientX+c.x;a.ue.y=b.clientY+c.y}w.jh=function(a){var b=qg(this,a.target);this.wa=b;kg(this);b!=this.anchor&&(this.anchor=b,this.gb||(this.gb=Vf(va(this.Vf,this,b,n),this.ig)),rg(this),pg(this,a))};function qg(a,b){try{for(;b&&!a.pd.contains(b);)b=b.parentNode;return b}catch(c){return r}}
w.ih=function(a){pg(this,a);this.Jd=q};w.hh=function(a){this.wa=a=qg(this,a.target);this.Jd=q;if(this.anchor!=a){this.anchor=a;var b=ng(this,1);kg(this);this.gb||(this.gb=Vf(va(this.Vf,this,a,b),this.ig));rg(this)}};function ng(a,b){if(0==b){var c=a.ue.h();return new sg(c)}return new tg(a.wa)}function rg(a){if(a.anchor)for(var b,c=0;b=jg[c];c++)Hd(b.l(),a.anchor)&&(b.uf=a,a.eg=b)}
w.Ff=function(a){var b=qg(this,a.target),c=qg(this,a.relatedTarget);b!=c&&(b==this.wa&&(this.wa=r),lg(this),this.Jd=s,this.oa&&(!a.relatedTarget||!Hd(this.l(),a.relatedTarget))?mg(this):this.anchor=n)};w.Hf=function(){var a=this.l();this.wa!=a&&(kg(this),this.wa=a)};w.Gf=function(a){var b=this.l();if(this.wa==b&&(!a.relatedTarget||!Hd(b,a.relatedTarget)))this.wa=r,mg(this)};function lg(a){a.gb&&(fa.clearTimeout(a.gb),a.gb=n)}
function mg(a){if(2==(a.gb?a.oa?4:1:a.oc?3:a.oa?2:0))a.oc=Vf(va(a.zh,a,a.anchor),a.kh)}function kg(a){a.oc&&(fa.clearTimeout(a.oc),a.oc=n)}function sg(a,b){dg.call(this,a,b)}H(sg,dg);sg.prototype.Oa=function(a,b,c){b=Md(a);b=Pd(b);c=c?new sd(c.top+10,c.right,c.bottom,c.left+10):new sd(10,0,0,10);Yf(this.te,a,4,c,b,9)&496&&Yf(this.te,a,4,c,b,5)};function tg(a){$f.call(this,a,3)}H(tg,$f);
tg.prototype.Oa=function(a,b,c){var d=new qd(10,0);Xf(this.element,this.yf,a,b,d,c,9)&496&&Xf(this.element,2,a,1,d,c,5)};function ug(a,b,c,d){a==r&&m(Error("No valid parent element."));(!D(b)||!D(c))&&m(Error("Invalid coordinates."));(d==r||!(d instanceof de))&&m(Error("Invalid interactor."));hg.call(this);this.c="caption";this.ma=a;this.ld=b;this.md=c;this.Kb=d;this.$a=r;this.Hb=[];a=".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n";a+=" border: 1px solid infotext;\n";a+=" padding: 1px;\n";a+=" font-family: sans-serif;\n";a+="}";this.Hb=[a];Tb(d,fd,this.zd.bind(this));this.ye()}H(ug,hg);
ug.prototype.ye=function(){if("static"==this.ma.style.position||""==this.ma.style.position)this.ma.style.position="relative";var a=document.getElementsByTagName("head")[0],b=Dd("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.Hb[0]));a.appendChild(b);b.appendChild(c);this.$a=b;this.Ed=new dg(this.ld,this.md)||n;this.oa&&this.Oa();bg(this,q);ig(this,this.ma);this.l().classList.add("x-tooltip")};
ug.prototype.zd=function(){bg(this,s);this.$a&&Fd(this.$a);this.l()&&Fd(this.l());this.$a=r};function vg(){Wf.call(this);this.c="renderer3D";this.Ac=this.Dc=this.zc=this.Cc=this.yc=this.Bc=this.ee=this.fe=r;this.k=[0,0,0];this.nf=r;this.Pd=new rc;this.Gc=new rc;this.Jc=new rc;this.ae=new rc;this.Wc=new rc;this.ed=new rc;this.fd=new rc;this.gd=new rc;this.F={PROGRESSBAR_ENABLED:q,PICKING_ENABLED:q,ORDERING_ENABLED:q,STATISTICS_ENABLED:s,INTERMEDIATE_RENDERING:s}}H(vg,Wf);vg.prototype.__defineGetter__("config",u("F"));w=vg.prototype;
w.qi=function(){this.Ac=this.Dc=this.zc=this.Cc=this.yc=this.Bc=r;this.k=[0,0,0]};w.Ie=function(a){vg.t.Ie.call(this,a);var b=a.ld;a=a.md;var c=this.fg(b,a);if(c=this.get(c))if(c=c.fc)(new ug(this.r,this.r.offsetLeft+b+10,this.r.offsetTop+a+10,this.Kb)).l().innerHTML=c};
w.ea=function(){vg.t.ea.call(this,"experimental-webgl");try{if(this.a.viewport(0,0,this.M,this.G),this.a.clearColor(0,0,0,0),this.a.enable(this.a.BLEND),this.a.blendEquation(this.a.FUNC_ADD),this.a.blendFunc(this.a.SRC_ALPHA,this.a.ONE_MINUS_SRC_ALPHA),this.a.enable(this.a.DEPTH_TEST),this.a.depthFunc(this.a.LEQUAL),this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT),this.F.PICKING_ENABLED){var a=this.a.createFramebuffer(),b=this.a.createRenderbuffer(),c=this.a.createTexture();this.a.bindTexture(this.a.TEXTURE_2D,
c);this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGB,this.M,this.G,0,this.a.RGB,this.a.UNSIGNED_BYTE,r);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST);this.a.bindFramebuffer(this.a.FRAMEBUFFER,a);this.a.bindRenderbuffer(this.a.RENDERBUFFER,
b);this.a.renderbufferStorage(this.a.RENDERBUFFER,this.a.DEPTH_COMPONENT16,this.M,this.G);this.a.bindRenderbuffer(this.a.RENDERBUFFER,r);this.a.framebufferTexture2D(this.a.FRAMEBUFFER,this.a.COLOR_ATTACHMENT0,this.a.TEXTURE_2D,c,0);this.a.framebufferRenderbuffer(this.a.FRAMEBUFFER,this.a.DEPTH_ATTACHMENT,this.a.RENDERBUFFER,b);this.a.bindFramebuffer(this.a.FRAMEBUFFER,r);this.nf=a}}catch(d){m(Error("Exception while accessing GL Context!\n"+d))}a=new we;(this.ga==r||this.a==r||this.q==r)&&m(Error("Renderer was not initialized properly."));
(a==r||!(a instanceof we))&&m(Error("Could not add shaders."));b=Object.keys(ye);Object.keys(xe).every(function(a){a=xe[a];return-1!=this.jd.search(a)||-1!=this.Yc.search(a)}.bind(a))||m(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=ye[a];return-1!=this.jd.search(a)||-1!=this.Yc.search(a)}.bind(a))||m(Error("Could not find all uniforms in the shader sources."));b=this.a.createShader(this.a.FRAGMENT_SHADER);c=this.a.createShader(this.a.VERTEX_SHADER);this.a.shaderSource(b,
a.Yc);this.a.shaderSource(c,a.jd);this.a.compileShader(b);this.a.compileShader(c);this.a.getShaderParameter(b,this.a.COMPILE_STATUS)||m(Error("Fragement Shader compilation failed!\n"+this.a.getShaderInfoLog(b)));this.a.getShaderParameter(c,this.a.COMPILE_STATUS)||m(Error("Vertex Shader compilation failed!\n"+this.a.getShaderInfoLog(c)));var e=this.a.createProgram();this.a.attachShader(e,c);this.a.attachShader(e,b);this.a.linkProgram(e);this.a.getProgramParameter(e,this.a.LINK_STATUS)||m(Error("Could not create shader program!\n"+
this.a.getShaderInfoLog(b)+"\n"+this.a.getShaderInfoLog(c)+"\n"+this.a.getProgramInfoLog(e)));this.a.useProgram(e);this.ee=e;Object.keys(xe).forEach(function(a){a=xe[a];this.Pd.set(a,this.a.getAttribLocation(this.ee,a));this.a.enableVertexAttribArray(this.Pd.get(a))}.bind(this));Object.keys(ye).forEach(function(a){a=ye[a];this.Gc.set(a,this.a.getUniformLocation(this.ee,a))}.bind(this));this.fe=a};
w.Va=function(a){vg.t.Va.call(this,a);var b=s;this.get(a.sa)&&(b=q);var c=a.sa,d=a.i,e=a.j,f=a.W,g=a.z,h=a.p,j=a.Wb,l=a.$,k=a.m,p=a.u;if(k!=r&&k.p!=r&&k.p.g)this.Va(k);else if(k!=r&&k.g&&this.Va(k),l!=r&&l.p!=r&&l.p.g)this.C.load(l,a);else if(g!=r&&g.p!=r&&g.p.g)this.C.load(g,a);else{if(h!=r&&z(h))if(a.dc!=r){if(a.dc.Bd!=h.length||!a.g)return}else{b=0;c=h.length;for(b=0;b<c;b++)this.C.load(h[b],a);return}else{if(h!=r&&h.g){this.C.load(a,a);return}if(p!=r&&p.p!=r&&p.p.g){this.C.load(p,a);return}}if(0<
a.e.length){h=a.e;l=h.length;for(k=k=0;k<l;k++)this.Va(h[k])}if(d){for(h=0;this.bd;)h++,window.console.log("Possible thread lock avoided: "+h);this.bd=q;l=a instanceof ze&&a.ab instanceof Be;b&&(g!=r&&g.g)&&(h=this.fd.get(c),h!=r&&this.a.isBuffer(h.ha)&&this.a.deleteBuffer(h.ha));h=r;g!=r&&(!b||g.g?(h=a.Vb,h==r&&m(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),k=s,g.va&&(k=q),this.a.pixelStorei(this.a.UNPACK_FLIP_Y_WEBGL,k),k=this.a.createTexture(),
k.nh=g.jb,this.gd.set(g.sa,k),this.a.bindTexture(this.a.TEXTURE_2D,k),g.va?this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,g.xb,g.wb,0,this.a.RGBA,this.a.UNSIGNED_BYTE,g.va):this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,this.a.RGBA,this.a.UNSIGNED_BYTE,k.nh),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE),l?(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST),
this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST)):(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.LINEAR),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.LINEAR)),this.a.bindTexture(this.a.TEXTURE_2D,r),k=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,k),this.a.bufferData(this.a.ARRAY_BUFFER,new Float32Array(h),this.a.STATIC_DRAW),h=new pd(k,h.length,2),g.g=s):h=this.fd.get(c));wf(this.C,0.1);if(l)this.bd=
s,L.qa(this.c+".update"),wf(this.C,0.9);else{if(!b||d.g||j.g){l=j.ia;g=L.d.Na(l,d.Ob,d.Pb,d.Qb);l=L.d.Na(l,d.Lb,d.Mb,d.Nb);if(this.Bc===r||g.x<this.Bc)this.Bc=g.x;if(this.yc===r||l.x>this.yc)this.yc=l.x;if(this.Cc===r||g.y<this.Cc)this.Cc=g.y;if(this.zc===r||l.y>this.zc)this.zc=l.y;if(this.Dc===r||g.b<this.Dc)this.Dc=g.b;if(this.Ac===r||l.b>this.Ac)this.Ac=l.b;this.k=[(this.Bc+this.yc)/2,(this.Cc+this.zc)/2,(this.Dc+this.Ac)/2];j.g=s}b&&d.g&&(j=this.Jc.get(c),j!=r&&this.a.isBuffer(j.ha)&&this.a.deleteBuffer(j.ha));
j=r;!b||d.g?(j=this.a.createBuffer(),d.fb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,j),this.a.bufferData(this.a.ARRAY_BUFFER,d.L,this.a.STATIC_DRAW),j=new pd(j,d.count,3),d.g=s):j=this.Jc.get(c);wf(this.C,0.3);b&&e.g&&(g=this.Jc.get(c),g!=r&&this.a.isBuffer(g.ha)&&this.a.deleteBuffer(g.ha));g=r;!b||e.g?(g=this.a.createBuffer(),e.fb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,g),this.a.bufferData(this.a.ARRAY_BUFFER,e.L,this.a.STATIC_DRAW),g=new pd(g,e.count,3),e.g=s):g=this.ae.get(c);wf(this.C,0.3);b&&
(f&&f.g)&&(e=this.Wc.get(c),e!=r&&this.a.isBuffer(e.ha)&&this.a.deleteBuffer(e.ha));e=r;f&&(!b||f.g?(f.length!=d.length&&m(Error("Mismatch between points and point colors.")),e=this.a.createBuffer(),f.fb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,e),this.a.bufferData(this.a.ARRAY_BUFFER,f.L,this.a.STATIC_DRAW),e=new pd(e,f.count,3),f.g=s):e=this.Wc.get(c));wf(this.C,0.2);b&&(p&&p.g)&&(f=this.ed.get(c),f!=r&&this.a.isBuffer(f.ha)&&this.a.deleteBuffer(f.ha));f=r;p&&(f=p.sc,!b||p.g?(f.length!=d.length&&
m(Error("Mismatch between points and scalars.")),d=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,d),this.a.bufferData(this.a.ARRAY_BUFFER,f,this.a.STATIC_DRAW),f=new pd(d,f.length,3),p.g=s):f=this.ed.get(c));wf(this.C,0.1);b||this.Ya.add(a);this.Jc.set(c,j);this.ae.set(c,g);this.Wc.set(c,e);this.fd.set(c,h);this.ed.set(c,f);this.bd=a.g=s}}else a.g=s}};
function wg(a,b){var c=b.i.Vc,c=L.d.Na(b.Wb.ia,c[0],c[1],c[2]),c=L.d.Na(a.q.n,c.x,c.y,c.b),c=L.f.Ab(a.q.ua,c);return Math.round(1E3*c)/1E3}w.fg=function(a,b){if(this.F.PICKING_ENABLED){this.Eb(q,s);var c=new Uint8Array(4);this.a.readPixels(a,this.G-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);return c[0]+255*c[1]+65025*c[2]}return-1};
w.Eb=function(a,b){vg.t.Eb.call(this,a,b);var c=this.Ya.v,d=c.length;if(0!=d){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.nf):this.a.bindFramebuffer(this.a.FRAMEBUFFER,r);this.a.viewport(0,0,this.M,this.G);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var e=this.q.mf,f=this.q.n;this.a.uniformMatrix4fv(this.Gc.get("perspective"),s,e);this.a.uniformMatrix4fv(this.Gc.get("view"),s,f);e=this.k;this.a.uniform3f(this.Gc.get("center"),parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]));
f=this.Ra.length;for(e=0;e<f;++e){var g=this.Ra[e];if(g instanceof R){var h=L.d.Na(this.q.n,1,0,0),j=L.f.Ab(this.q.ua,h),h=L.d.Na(this.q.n,-1,0,0),l=L.f.Ab(this.q.ua,h),h=L.d.Na(this.q.n,0,1,0),k=L.f.Ab(this.q.ua,h),h=L.d.Na(this.q.n,0,-1,0),p=L.f.Ab(this.q.ua,h),h=L.d.Na(this.q.n,0,0,1),t=L.f.Ab(this.q.ua,h),h=L.d.Na(this.q.n,0,0,-1),h=L.f.Ab(this.q.ua,h),v=Math.max(j,k,t,l,p,h);v==j||v==l?Ae(g,0):v==k||v==p?Ae(g,1):(v==t||v==h)&&Ae(g,2)}}if(this.F.ORDERING_ENABLED){j=s;f=this.Ra;g=f.length-1;do if(e=
f[g],e instanceof R&&e.Ka){l=e.zb;j=e.Q.e;1==l?j=e.R.e:2==l&&(j=e.Za.e);l=j.length;k=j[0];k.K=wg(this,k);k.Z=e.Z;p=j[l-1];p.K=wg(this,p);p.Z=e.Z;p=Math.round(1E3*((p.K-k.K)/l))/1E3;for(t=t=1;t<l-1;t++)h=Math.round(1E3*(k.K+t*p))/1E3,j[t].K=h,j[t].Z=e.Z;j=q}while(g--);f=this.Ya.v;g=f.length-1;do if(e=f[g],e.Ja&&!(1==e.Z||e instanceof ze))e.K=wg(this,e),j=q;while(g--);j&&this.Ya.sort()}if(f=!a&&b!=r&&b&&this.F.STATISTICS_ENABLED)var y=0,A=0,C=0,E=0;var e=this.Pd,g=e.get("vertexPosition"),j=e.get("vertexNormal"),
l=e.get("vertexColor"),k=e.get("vertexTexturePos"),p=e.get("vertexScalar"),e=this.Gc,t=e.get("usePicking"),h=e.get("useObjectColor"),v=e.get("objectColor"),x=e.get("useScalars"),B=e.get("scalarsReplaceMode"),G=e.get("scalarsMin"),I=e.get("scalarsMax"),M=e.get("scalarsMinColor"),J=e.get("scalarsMaxColor"),K=e.get("scalarsInterpolation"),O=e.get("scalarsMinThreshold"),aa=e.get("scalarsMaxThreshold"),T=e.get("objectOpacity"),ba=e.get("labelmapOpacity"),ia=e.get("useTexture"),W=e.get("useLabelMapTexture"),
ka=e.get("textureSampler"),Ub=e.get("textureSampler2"),Ag=e.get("volumeLowerThreshold"),Bg=e.get("volumeUpperThreshold"),Cg=e.get("volumeScalarMin"),Dg=e.get("volumeScalarMax"),Eg=e.get("volumeWindowLow"),Fg=e.get("volumeWindowHigh"),Gg=e.get("volumeScalarMinColor"),Hg=e.get("volumeScalarMaxColor"),Nf=e.get("volumeTexture"),Ig=e.get("objectTransform"),Jg=e.get("pointSize"),e=d;do{var Y=c[d-e];if(Y){var ea=r;Y instanceof ze&&Y.ab&&(ea=Y.ab);if(Y.Ja&&(!ea||ea.Ja)){var ua=Y.sa,Va=Y.xc,Ea=this.Jc.get(ua),
db=this.ae.get(ua),se=this.Wc.get(ua),Nb=this.ed.get(ua),te=this.fd.get(ua);this.a.bindBuffer(this.a.ARRAY_BUFFER,Ea.ha);this.a.vertexAttribPointer(g,Ea.ob,this.a.FLOAT,s,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,db.ha);this.a.vertexAttribPointer(j,db.ob,this.a.FLOAT,s,0,0);a?this.a.uniform1i(t,q):this.a.uniform1i(t,s);se&&!a&&!Va?(this.a.uniform1i(h,s),this.a.bindBuffer(this.a.ARRAY_BUFFER,se.ha),this.a.vertexAttribPointer(l,se.ob,this.a.FLOAT,s,0,0)):(db=1,Va&&!a&&(db=0),this.a.uniform1i(h,db),
db=Y.Gb,a&&(db=[Math.floor(ua%65025%255)/255,Math.floor(ua%65025/255)/255,Math.floor(ua/65025)/255]),this.a.uniform3f(v,parseFloat(db[0]),parseFloat(db[1]),parseFloat(db[2])),this.a.vertexAttribPointer(l,Ea.ob,this.a.FLOAT,s,0,0));Nb&&!a&&!Va?(this.a.uniform1i(x,q),this.a.uniform1i(B,Y.u.pf),ua=Y.u.sb,Va=Y.u.qb,this.a.uniform3f(M,parseFloat(ua[0]),parseFloat(ua[1]),parseFloat(ua[2])),this.a.uniform3f(J,parseFloat(Va[0]),parseFloat(Va[1]),parseFloat(Va[2])),this.a.uniform1f(O,parseFloat(Y.u.P)),this.a.uniform1f(aa,
parseFloat(Y.u.S)),this.a.uniform1f(G,parseFloat(Y.u.Ia)),this.a.uniform1f(I,parseFloat(Y.u.Fa)),this.a.uniform1i(K,parseInt(Y.u.Sd,10)),this.a.bindBuffer(this.a.ARRAY_BUFFER,Nb.ha),this.a.vertexAttribPointer(p,Nb.ob,this.a.FLOAT,s,0,0)):(this.a.uniform1i(x,s),this.a.vertexAttribPointer(p,Ea.ob,this.a.FLOAT,s,0,0));this.a.uniform1f(T,parseFloat(Y.Z));Y.z&&te&&!a?(this.a.uniform1i(ia,q),this.a.activeTexture(this.a.TEXTURE0),this.a.bindTexture(this.a.TEXTURE_2D,this.gd.get(Y.z.sa)),this.a.uniform1i(ka,
0),this.a.bindBuffer(this.a.ARRAY_BUFFER,te.ha),this.a.vertexAttribPointer(k,te.ob,this.a.FLOAT,s,0,0),this.a.uniform1i(Nf,s)):(this.a.uniform1i(ia,s),this.a.vertexAttribPointer(k,Ea.ob,this.a.FLOAT,s,0,0));ea&&(this.a.uniform1i(Nf,q),this.a.uniform1f(Ag,ea.P),this.a.uniform1f(Bg,ea.S),this.a.uniform1f(Cg,ea.Ia),this.a.uniform1f(Dg,ea.Fa),ua=ea.sb,Va=ea.qb,this.a.uniform3f(Gg,parseFloat(ua[0]),parseFloat(ua[1]),parseFloat(ua[2])),this.a.uniform3f(Hg,parseFloat(Va[0]),parseFloat(Va[1]),parseFloat(Va[2])),
this.a.uniform1f(Eg,ea.U),this.a.uniform1f(Fg,ea.T),Nb=ea.m,this.a.uniform1i(W,s),ea.Ka?this.a.uniform1f(T,parseFloat(ea.Z)):Nb&&Nb.Ja&&(ea=Y.m.sa,this.a.uniform1i(W,q),this.a.activeTexture(this.a.TEXTURE1),this.a.bindTexture(this.a.TEXTURE_2D,this.gd.get(ea)),this.a.uniform1i(Ub,1),this.a.uniform1f(ba,Nb.Z)));this.a.uniformMatrix4fv(Ig,s,Y.Wb.ia);ea=1;"POINTS"==Y.ja&&(ea=Y.Ec);this.a.uniform1f(Jg,ea);ea=-1;Y.ja==Oc?(ea=this.a.TRIANGLES,f&&(A+=Ea.nb/3)):"LINES"==Y.ja?(this.a.lineWidth(Y.jc),ea=this.a.LINES,
f&&(C+=Ea.nb/2)):"POINTS"==Y.ja?(ea=this.a.POINTS,f&&(E+=Ea.nb)):"TRIANGLE_STRIPS"==Y.ja?(ea=this.a.TRIANGLE_STRIP,f&&(A+=Ea.nb/3)):"POLYGONS"==Y.ja&&(ea=0==Ea.nb%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(A+=Ea.nb/3));f&&(y+=Ea.nb);this.a.drawArrays(ea,0,Ea.nb)}}}while(--e);f&&(c="Objects: "+d+" | "+("Vertices: "+y+" | "),c+="Triangles: "+Math.round(A)+" | ",c+="Lines: "+C+" | ",c+="Points: "+E+" | ",c+="Textures: "+this.gd.td(),window.console.log(c))}};
w.od=function(){this.fe=r;delete this.fe;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);vg.t.od.call(this)};F("X.renderer3D",vg);F("X.renderer3D.prototype.init",vg.prototype.ea);F("X.renderer3D.prototype.add",vg.prototype.add);F("X.renderer3D.prototype.onShowtime",vg.prototype.bg);F("X.renderer3D.prototype.onRender",vg.prototype.$f);F("X.renderer3D.prototype.get",vg.prototype.get);F("X.renderer3D.prototype.render",vg.prototype.cc);F("X.renderer3D.prototype.destroy",vg.prototype.od);
F("X.renderer3D.prototype.resetBoundingBox",vg.prototype.qi);F("X.renderer3D.prototype.resetViewAndRender",vg.prototype.qc);F("X.renderer3D.prototype.pick",vg.prototype.fg);function xg(){V.call(this);this.c="mesh";Fa(this,new pc)}H(xg,V);F("X.mesh",xg);function yg(){V.call(this);this.c="fibers";Fa(this,new pc)}H(yg,V);F("X.fibers",yg);function zg(){Wf.call(this);this.c="renderer2D";this.ef=this.Td=this.cf=this.Rd=this.tb=r;this.Sb=this.Tb=this.ge=this.he=0;this.T=this.U=this.S=this.P=this.af=-1}H(zg,Wf);zg.prototype.Th=ca();zg.prototype.bi=ca();zg.prototype.Je=function(a){zg.t.Je.call(this,a);var b=this.Ra[0];if(b){var c=this.tb;b["index"+c]=a.I?b["index"+c]+1:b["index"+c]-1;eval("this.onScroll();")}};
zg.prototype.ci=function(a){var b=this.Ra[0];if(b){var c=b.T-b.U,d=c/2,e=parseInt(c+c/15*-a.ke,10);a=parseInt(d+d/15*a.Yd,10);c==e&&e++;d==a&&a++;b.U-=parseInt(d-a,10);b.U-=parseInt(c-e,10);b.U=Math.max(b.U,b.Ia);b.T-=parseInt(d-a,10);b.T+=parseInt(c-e,10);b.T=Math.min(b.T,b.Fa);eval("this.onWindowLevel();")}};zg.prototype.__defineGetter__("orientation",u("tb"));
zg.prototype.__defineSetter__("orientation",function(a){a=a.toUpperCase();"X"!=a&&("Y"!=a&&"Z"!=a)&&m(Error("Invalid orientation."));this.tb=a});w=zg.prototype;w.ea=function(){this.tb||m(Error("No 2D orientation set."));zg.t.ea.call(this,"2d");this.a.fillStyle="rgba(0,0,0,0)";this.a.fillRect(0,0,this.ga.width,this.ga.height);this.Rd=Dd("canvas");this.Td=Dd("canvas");P(this.q,bd,this.ci.bind(this))};w.rotate=function(){this.q.n[1]++};w.si=function(){this.q.n[1]--};
w.qc=function(){zg.t.qc.call(this);Kg(this);var a=this.Ra[0];a&&(a.T=a.Fa,a.U=a.Ia)};
w.Va=function(a){zg.t.Va.call(this,a);var b=s;this.get(a.sa)&&(b=q);if(a instanceof R){var c=a.p,d=a.m,e=a.$;if(d!=r&&d.p!=r&&d.p.g)this.Va(d);else if(e!=r&&e.p!=r&&e.p.g)this.C.load(e,a);else{if(c!=r&&z(c))if(a.dc!=r){if(a.dc.Bd!=c.length||b&&!a.g)return}else{b=0;d=c.length;for(b=0;b<d;b++)this.C.load(c[b],a);return}else if(c!=r&&c.g){this.C.load(a,a);return}var d=c=0,e=a.aa,f=a.H;"X"==this.tb?(this.Ub=a.Q.e,c=e[1],d=e[2],this.Tb=f[1],this.Sb=f[2]):"Y"==this.tb?(this.Ub=a.R.e,c=e[0],d=e[2],this.Tb=
f[0],this.Sb=f[2]):"Z"==this.tb&&(this.Ub=a.Za.e,c=e[0],d=e[1],this.Tb=f[0],this.Sb=f[1]);this.he=c;this.ge=d;e=this.Rd;e.width=c;e.height=d;f=this.Td;f.width=c;f.height=d;this.cf=e.getContext("2d");this.ef=f.getContext("2d");b||(this.Ya.add(a),Kg(this))}}};function Kg(a){var b=Math.min(a.M/(a.he*a.Tb),a.G/(a.ge*a.Sb));a.q.n[14]=b}
w.Eb=function(a,b){zg.t.Eb.call(this,a,b);if(0!=this.Ya.v.length){var c=this.M,d=this.G,e=this.q.n;this.a.save();this.a.clearRect(-c,-d,2*c,2*d);this.a.restore();var f=1*e[12],g=-1*e[13],h=Math.max(e[14],0.6);this.a.setTransform(h,0,0,h,f,g);var j=this.Ra[0],l=j["index"+this.tb],k=this.Ub[parseInt(l,10)],p=k.z.va,k=k.m,t=r;k&&(t=k.va);var v=this.he,y=this.ge,A=this.cf,C=this.ef,E=A.getImageData(0,0,v,y),x=C.getImageData(0,0,v,y),B=E.data,G=x.data,I=B.length,M=j.Fa,J=j.P,K=j.S,O=j.U/M,aa=j.T/M;if(this.af!=
l||this.P!=J||this.S!=K||this.U!=O||this.T!=aa){var T=0;do{var ba=[0,0,0,0],ia=[0,0,0,0],W=p[T]/255*M,ka=p[T],ka=(ka/255-O)/(aa-O),ka=255*ka;W>=J&&W<=K&&(ba=new S(j.sb[0],j.sb[1],j.sb[2]),ba=(new S(j.qb[0],j.qb[1],j.qb[2])).scale(ka).add(ba.scale(255-ka)),ba=[Math.floor(ba.x),Math.floor(ba.y),Math.floor(ba.b),255],k&&(ia=[t[T],t[T+1],t[T+2],t[T+3]]));ka=I-1-T;B[ka-3]=ba[0];B[ka-2]=ba[1];B[ka-1]=ba[2];B[ka]=ba[3];G[ka-3]=ia[0];G[ka-2]=ia[1];G[ka-1]=ia[2];G[ka]=ia[3];T+=4}while(T<I);A.putImageData(E,
0,0);C.putImageData(x,0,0);this.af=l;this.P=J;this.S=K;this.U=O;this.T=aa}this.a.globalAlpha=1;this.a.translate(c/2/h,d/2/h);c=e[1];this.a.rotate(0.5*Math.PI*c);switch(c%4){case 1:c=f;f=g;g=-c;break;case 2:f*=-1;g*=-1;break;case 3:c=f,f=-g,g=c}f=-v*this.Tb/2+f;g=-y*this.Sb/2+g;this.a.drawImage(this.Rd,f,g,v*this.Tb,y*this.Sb);k&&j.m.Ja&&(this.a.globalAlpha=j.m.Z,this.a.drawImage(this.Td,f,g,v*this.Tb,y*this.Sb))}};F("X.renderer2D",zg);F("X.renderer2D.prototype.init",zg.prototype.ea);
F("X.renderer2D.prototype.add",zg.prototype.add);F("X.renderer2D.prototype.onShowtime",zg.prototype.bg);F("X.renderer2D.prototype.onRender",zg.prototype.$f);F("X.renderer2D.prototype.onScroll",zg.prototype.Th);F("X.renderer2D.prototype.onWindowLevel",zg.prototype.bi);F("X.renderer2D.prototype.get",zg.prototype.get);F("X.renderer2D.prototype.rotate",zg.prototype.rotate);F("X.renderer2D.prototype.rotateCounter",zg.prototype.si);F("X.renderer2D.prototype.resetViewAndRender",zg.prototype.qc);
F("X.renderer2D.prototype.render",zg.prototype.cc);F("X.renderer2D.prototype.destroy",zg.prototype.od);