-
Notifications
You must be signed in to change notification settings - Fork 8
/
xtk11preview.js
424 lines (424 loc) · 192 KB
/
xtk11preview.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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
/*
*
* 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 <[email protected]>
*
* The X Toolkit (XTK) is licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
*
*
* 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 n(a){throw a;}var p=void 0,q=!0,t=null,u=!1;function aa(){return function(){}}function ca(a){return function(b){this[a]=b}}function v(a){return function(){return this[a]}}var w,ga=this;function ha(){}
function ia(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!==p}function ka(a){return"array"==ia(a)}function ma(a){var b=ia(a);return"array"==b||"object"==b&&"number"==typeof a.length}function na(a){return"string"==typeof a}function x(a){return"number"==typeof a}function oa(a){return"function"==ia(a)}function pa(a){var b=typeof a;return"object"==b&&a!=t||"function"==b}function qa(a){return a[ra]||(a[ra]=++sa)}var ra="closure_uid_"+(1E9*Math.random()>>>0),sa=0;
function ta(a,b,c){return a.call.apply(a.bind,arguments)}function ua(a,b,c){a||n(Error());if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,e);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")?ta:ua;return va.apply(t,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 A(a,b){var c=a.split("."),e=ga;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);for(var d;c.length&&(d=c.shift());)!c.length&&ja(b)?e[d]=b:e=e[d]?e[d]:e[d]={}}
function C(a,b){function c(){}c.prototype=b.prototype;a.z=b.prototype;a.prototype=new c;a.prototype.constructor=a};var D=D||{};D.Ek=q;D.Ja=function(a){eval("X.DEV === undefined")||window.console.time(a)};D.Da=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.Xh=0;this.vk=function(){return this.Xh++}};function ya(a,b){for(var c in b){var e=b.__lookupGetter__(c),d=b.__lookupSetter__(c);c in a||(e||d?(e&&a.__defineGetter__(c,e),d&&a.__defineSetter__(c,d)):a[c]=b[c])}}var za=window.Mh;
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,d.concat(e.call(arguments)))}function c(){}"function"!==typeof this&&n(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var e=Array.prototype.slice,d=e.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
for(var Aa=0,Ca=["ms","moz","webkit","o"],Da=0;Da<Ca.length&&!window.requestAnimationFrame;++Da)window.requestAnimationFrame=window[Ca[Da]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[Ca[Da]+"CancelAnimationFrame"]||window[Ca[Da]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=Date.now(),c=Math.max(0,16-(b-Aa)),e=window.setTimeout(function(){a(b+c)},c);Aa=b+c;return e});
window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});
"slice"in ArrayBuffer.prototype||(ArrayBuffer.prototype.slice=function(a,b){a===p&&n(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 e=new ArrayBuffer(c-a),d=new Uint8Array(this),f=new Uint8Array(e),g=a,h=0;g<c;++g,++h)f[h]=d[g];return e});A("$",za);A("Function.prototype.bind",Function.prototype.bind);
A("window.requestAnimationFrame",window.requestAnimationFrame);A("window.cancelAnimationFrame",window.cancelAnimationFrame);var Ea=0;function Fa(){}w=Fa.prototype;w.key=0;w.yc=u;w.je=u;w.Ca=function(a,b,c,e,d,f){oa(a)?this.Wg=q:a&&a.handleEvent&&oa(a.handleEvent)?this.Wg=u:n(Error("Invalid listener argument"));this.bc=a;this.ph=b;this.src=c;this.type=e;this.capture=!!d;this.uf=f;this.je=u;this.key=++Ea;this.yc=u};w.handleEvent=function(a){return this.Wg?this.bc.call(this.uf||this.src,a):this.bc.handleEvent.call(this.bc,a)};function Ha(a,b){for(var c in a)b.call(p,a[c],c,a)}function Ia(a){var b=[],c=0,e;for(e in a)b[c++]=a[e];return b}var Ja="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Ka(a,b){for(var c,e,d=1;d<arguments.length;d++){e=arguments[d];for(c in e)a[c]=e[c];for(var f=0;f<Ja.length;f++)c=Ja[f],Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c])}};function La(a){if(!Ma.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Na,"&"));-1!=a.indexOf("<")&&(a=a.replace(Oa,"<"));-1!=a.indexOf(">")&&(a=a.replace(Pa,">"));-1!=a.indexOf('"')&&(a=a.replace(Qa,"""));return a}var Na=/&/g,Oa=/</g,Pa=/>/g,Qa=/\"/g,Ma=/[&<>\"]/;var Ra,Sa,Ta,Ua,Va,Wa,Xa;function Ya(){return ga.navigator?ga.navigator.userAgent:t}function Za(){return ga.navigator}Ua=Ta=Sa=Ra=u;var $a;if($a=Ya()){var ab=Za();Ra=0==$a.indexOf("Opera");Sa=!Ra&&-1!=$a.indexOf("MSIE");Ta=!Ra&&-1!=$a.indexOf("WebKit");Ua=!Ra&&!Ta&&"Gecko"==ab.product}var bb=Ra,db=Sa,eb=Ua,fb=Ta,gb,hb=Za();gb=hb&&hb.platform||"";Va=-1!=gb.indexOf("Mac");Wa=-1!=gb.indexOf("Win");Xa=-1!=gb.indexOf("Linux");var ib=!!Za()&&-1!=(Za().appVersion||"").indexOf("X11");
function kb(){var a=ga.document;return a?a.documentMode:p}var lb;a:{var mb="",nb;if(bb&&ga.opera)var qb=ga.opera.version,mb="function"==typeof qb?qb():qb;else if(eb?nb=/rv\:([^\);]+)(\)|;)/:db?nb=/MSIE\s+([^\);]+)(\)|;)/:fb&&(nb=/WebKit\/(\S+)/),nb)var rb=nb.exec(Ya()),mb=rb?rb[1]:"";if(db){var vb=kb();if(vb>parseFloat(mb)){lb=String(vb);break a}}lb=mb}var wb={};
function xb(a){var b;if(!(b=wb[a])){b=0;for(var c=String(lb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=Math.max(c.length,e.length),f=0;0==b&&f<d;f++){var g=c[f]||"",h=e[f]||"",l=RegExp("(\\d*)(\\D*)","g"),j=RegExp("(\\d*)(\\D*)","g");do{var k=l.exec(g)||["","",""],m=j.exec(h)||["","",""];if(0==k[0].length&&0==m[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==m[1].length?0:parseInt(m[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==m[1].length?0:parseInt(m[1],10))?1:0)||((0==k[2].length)<(0==m[2].length)?-1:(0==k[2].length)>(0==m[2].length)?1:0)||(k[2]<m[2]?-1:k[2]>m[2]?1:0)}while(0==b)}b=wb[a]=0<=b}return b}var yb=ga.document,zb=!yb||!db?p:kb()||("CSS1Compat"==yb.compatMode?parseInt(lb,10):5);var Ab=!db||db&&9<=zb,Bb=db&&!xb("9");!fb||xb("528");eb&&xb("1.9b")||db&&xb("8")||bb&&xb("9.5")||fb&&xb("528");eb&&!xb("8")||db&&xb("9");var Cb=Array.prototype,Db=Cb.indexOf?function(a,b,c){return Cb.indexOf.call(a,b,c)}:function(a,b,c){c=c==t?0:0>c?Math.max(0,a.length+c):c;if(na(a))return!na(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},Eb=Cb.forEach?function(a,b,c){Cb.forEach.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)f in d&&b.call(c,d[f],f,a)},Fb=Cb.map?function(a,b,c){return Cb.map.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=Array(e),f=
na(a)?a.split(""):a,g=0;g<e;g++)g in f&&(d[g]=b.call(c,f[g],g,a));return d},Gb=Cb.some?function(a,b,c){return Cb.some.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)if(f in d&&b.call(c,d[f],f,a))return q;return u};function Hb(a,b){var c=Db(a,b);0<=c&&Cb.splice.call(a,c,1)}function Ib(a,b,c){return 2>=arguments.length?Cb.slice.call(a,b):Cb.slice.call(a,b,c)};function Jb(){0!=Kb&&(this.Dl=Error().stack,qa(this))}var Kb=0;function Mb(a,b){this.type=a;this.currentTarget=this.target=b}w=Mb.prototype;w.xc=u;w.defaultPrevented=u;w.ye=q;w.stopPropagation=function(){this.xc=q};w.preventDefault=function(){this.defaultPrevented=q;this.ye=u};function Nb(a){Nb[" "](a);return a}Nb[" "]=ha;function Ob(a,b){a&&this.Ca(a,b)}C(Ob,Mb);w=Ob.prototype;w.target=t;w.relatedTarget=t;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=u;w.altKey=u;w.shiftKey=u;w.metaKey=u;w.Zj=u;w.sb=t;
w.Ca=function(a,b){var c=this.type=a.type;Mb.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;if(e){if(eb){var d;a:{try{Nb(e.nodeName);d=q;break a}catch(f){}d=u}d||(e=t)}}else"mouseover"==c?e=a.fromElement:"mouseout"==c&&(e=a.toElement);this.relatedTarget=e;this.offsetX=fb||a.offsetX!==p?a.offsetX:a.layerX;this.offsetY=fb||a.offsetY!==p?a.offsetY:a.layerY;this.clientX=a.clientX!==p?a.clientX:a.pageX;this.clientY=a.clientY!==p?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.Zj=Va?a.metaKey:a.ctrlKey;this.state=a.state;this.sb=a;a.defaultPrevented&&this.preventDefault();delete this.xc};w.stopPropagation=function(){Ob.z.stopPropagation.call(this);this.sb.stopPropagation?this.sb.stopPropagation():this.sb.cancelBubble=q};
w.preventDefault=function(){Ob.z.preventDefault.call(this);var a=this.sb;if(a.preventDefault)a.preventDefault();else if(a.returnValue=u,Bb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.Ji=v("sb");var Pb={},Qb={},Rb={},Sb={};function K(a,b,c,e,d){if(ka(b)){for(var f=0;f<b.length;f++)K(a,b[f],c,e,d);return t}a=Tb(a,b,c,u,e,d);b=a.key;Pb[b]=a;return b}
function Tb(a,b,c,e,d,f){b||n(Error("Invalid event type"));d=!!d;var g=Qb;b in g||(g[b]={ra:0,Na:0});g=g[b];d in g||(g[d]={ra:0,Na:0},g.ra++);var g=g[d],h=qa(a),l;g.Na++;if(g[h]){l=g[h];for(var j=0;j<l.length;j++)if(g=l[j],g.bc==c&&g.uf==f){if(g.yc)break;e||(l[j].je=u);return l[j]}}else l=g[h]=[],g.ra++;var k=Ub,m=Ab?function(a){return k.call(m.src,m.bc,a)}:function(a){a=k.call(m.src,m.bc,a);if(!a)return a},j=m,g=new Fa;g.Ca(c,j,a,b,d,f);g.je=e;j.src=a;j.bc=g;l.push(g);Rb[h]||(Rb[h]=[]);Rb[h].push(g);
a.addEventListener?(a==ga||!a.customEvent_)&&a.addEventListener(b,j,d):a.attachEvent(b in Sb?Sb[b]:Sb[b]="on"+b,j);return g}function Vb(a,b,c,e,d){if(ka(b))for(var f=0;f<b.length;f++)Vb(a,b[f],c,e,d);else a=Tb(a,b,c,q,e,d),Pb[a.key]=a}function Wb(a,b,c,e,d){if(ka(b))for(var f=0;f<b.length;f++)Wb(a,b[f],c,e,d);else{e=!!e;a:{f=Qb;if(b in f&&(f=f[b],e in f&&(f=f[e],a=qa(a),f[a]))){a=f[a];break a}a=t}if(a)for(f=0;f<a.length;f++)if(a[f].bc==c&&a[f].capture==e&&a[f].uf==d){Xb(a[f].key);break}}}
function Xb(a){var b=Pb[a];if(!b||b.yc)return u;var c=b.src,e=b.type,d=b.ph,f=b.capture;c.removeEventListener?(c==ga||!c.customEvent_)&&c.removeEventListener(e,d,f):c.detachEvent&&c.detachEvent(e in Sb?Sb[e]:Sb[e]="on"+e,d);c=qa(c);Rb[c]&&(d=Rb[c],Hb(d,b),0==d.length&&delete Rb[c]);b.yc=q;if(b=Qb[e][f][c])b.gh=q,Yb(e,f,c,b);delete Pb[a];return q}
function Yb(a,b,c,e){if(!e.ue&&e.gh){for(var d=0,f=0;d<e.length;d++)e[d].yc?e[d].ph.src=t:(d!=f&&(e[f]=e[d]),f++);e.length=f;e.gh=u;0==f&&(delete Qb[a][b][c],Qb[a][b].ra--,0==Qb[a][b].ra&&(delete Qb[a][b],Qb[a].ra--),0==Qb[a].ra&&delete Qb[a])}}function Zb(a){var b=0;if(a!=t){if(a=qa(a),Rb[a]){a=Rb[a];for(var c=a.length-1;0<=c;c--)Xb(a[c].key),b++}}else Ha(Pb,function(a,c){Xb(c);b++})}
function $b(a,b){var c=qa(a),e=Rb[c];if(e){var d=ja(b),f=ja(p);return d&&f?(e=Qb[b],!!e&&!!e[p]&&c in e[p]):!d&&!f?q:Gb(e,function(a){return d&&a.type==b||f&&a.capture==p})}return u}function ac(a,b,c,e,d){var f=1;b=qa(b);if(a[b]){var g=--a.Na,h=a[b];h.ue?h.ue++:h.ue=1;try{for(var l=h.length,j=0;j<l;j++){var k=h[j];k&&!k.yc&&(f&=bc(k,d)!==u)}}finally{a.Na=Math.max(g,a.Na),h.ue--,Yb(c,e,b,h)}}return Boolean(f)}function bc(a,b){a.je&&Xb(a.key);return a.handleEvent(b)}
function Ub(a,b){if(a.yc)return q;var c=a.type,e=Qb;if(!(c in e))return q;var e=e[c],d,f;if(!Ab){var g;if(!(g=b))a:{g=["window","event"];for(var h=ga;d=g.shift();)if(h[d]!=t)h=h[d];else{g=t;break a}g=h}d=g;g=q in e;h=u in e;if(g){if(0>d.keyCode||d.returnValue!=p)return q;a:{var l=u;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(j){l=q}if(l||d.returnValue==p)d.returnValue=q}}l=new Ob;l.Ca(d,this);d=q;try{if(g){for(var k=[],m=l.currentTarget;m;m=m.parentNode)k.push(m);f=e[q];f.Na=f.ra;for(var r=k.length-
1;!l.xc&&0<=r&&f.Na;r--)l.currentTarget=k[r],d&=ac(f,k[r],c,q,l);if(h){f=e[u];f.Na=f.ra;for(r=0;!l.xc&&r<k.length&&f.Na;r++)l.currentTarget=k[r],d&=ac(f,k[r],c,u,l)}}else d=bc(a,l)}finally{k&&(k.length=0)}return d}c=new Ob(b,this);return d=bc(a,c)}var cc=0;function dc(a){return a+"_"+cc++};function ec(){Jb.call(this);this.Hl={};this.Al=this}C(ec,Jb);ec.prototype.customEvent_=q;w=ec.prototype;w.Nf=t;w.Sf=ca("Nf");w.addEventListener=function(a,b,c,e){K(this,a,b,c,e)};w.removeEventListener=function(a,b,c,e){Wb(this,a,b,c,e)};
w.dispatchEvent=function(a){var b=a.type||a,c=Qb;if(b in c){if(na(a))a=new Mb(a,this);else if(a instanceof Mb)a.target=a.target||this;else{var e=a;a=new Mb(b,this);Ka(a,e)}var e=1,d,c=c[b],b=q in c,f;if(b){d=[];for(f=this;f;f=f.Nf)d.push(f);f=c[q];f.Na=f.ra;for(var g=d.length-1;!a.xc&&0<=g&&f.Na;g--)a.currentTarget=d[g],e&=ac(f,d[g],a.type,q,a)&&a.ye!=u}if(u in c)if(f=c[u],f.Na=f.ra,b)for(g=0;!a.xc&&g<d.length&&f.Na;g++)a.currentTarget=d[g],e&=ac(f,d[g],a.type,u,a)&&a.ye!=u;else for(d=this;!a.xc&&
d&&f.Na;d=d.Nf)a.currentTarget=d,e&=ac(f,d,a.type,u,a)&&a.ye!=u;a=Boolean(e)}else a=q;return a};function L(){ec.call(this);this.g="base";this.ka=window["X.counter"].vk();this.j=u}C(L,ec);L.prototype.__defineGetter__("classname",v("g"));L.prototype.__defineGetter__("id",v("ka"));A("X.base",L);function fc(){L.call(this);this.g="indexer";this.cf=[];this.vl=[];this.Ka={}}C(fc,L);fc.prototype.add=function(a){a==t&&n(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.Ka||(this.Ka[b]=this.cf.length,this.cf.push(a));return this.Ka[b]};fc.prototype.unique=v("cf");function gc(a){L.call(this);this.g="file";this.$d=a;this.j=q}C(gc,L);function hc(){this.ab=this.s=t}hc.prototype.__defineSetter__("file",function(a){if(a==t||ka(a)&&0==a.length)this.s=t;else{if(ka(a)){if(1==a.length){this.s=new gc(a[0]);return}this.s=Fb(a,function(a){var c=new M;c.s=new gc(a);return c})}else this.s=new gc(a);this.ab=t}});hc.prototype.__defineGetter__("file",function(){return!this.s?"":ka(this.s)?this.s.map(function(a){return a.s.$d}):this.s.$d});
hc.prototype.__defineGetter__("filedata",function(){return ka(this.s)?this.s.map(function(a){return a.ab}):this.ab});hc.prototype.__defineSetter__("filedata",function(a){if(a==t||ka(a)&&0==a.length)this.ab=t;if(ka(a))if(1==a.length)this.ab=a[0];else{var b=this.s.length,c;for(c=0;c<b;c++)this.s[c].ab=a[c]}else this.ab=a});function ic(a){if("function"==typeof a.Dd)return a.Dd();if(na(a))return a.split("");if(ma(a)){for(var b=[],c=a.length,e=0;e<c;e++)b.push(a[e]);return b}return Ia(a)};function jc(a,b){this.ia={};this.X=[];var c=arguments.length;if(1<c){c%2&&n(Error("Uneven number of arguments"));for(var e=0;e<c;e+=2)this.set(arguments[e],arguments[e+1])}else a&&this.ef(a)}w=jc.prototype;w.ra=0;w.ag=0;w.tf=v("ra");w.Dd=function(){kc(this);for(var a=[],b=0;b<this.X.length;b++)a.push(this.ia[this.X[b]]);return a};function lc(a){for(var b=0;b<a.X.length;b++){var c=a.X[b];if(mc(a.ia,c)&&a.ia[c]==u)return q}return u}w.clear=function(){this.ia={};this.ag=this.ra=this.X.length=0};
w.remove=function(a){return mc(this.ia,a)?(delete this.ia[a],this.ra--,this.ag++,this.X.length>2*this.ra&&kc(this),q):u};function kc(a){if(a.ra!=a.X.length){for(var b=0,c=0;b<a.X.length;){var e=a.X[b];mc(a.ia,e)&&(a.X[c++]=e);b++}a.X.length=c}if(a.ra!=a.X.length){for(var d={},c=b=0;b<a.X.length;)e=a.X[b],mc(d,e)||(a.X[c++]=e,d[e]=1),b++;a.X.length=c}}w.get=function(a,b){return mc(this.ia,a)?this.ia[a]:b};w.set=function(a,b){mc(this.ia,a)||(this.ra++,this.X.push(a),this.ag++);this.ia[a]=b};
w.ef=function(a){var b;if(a instanceof jc)kc(a),b=a.X.concat(),a=a.Dd();else{b=[];var c=0,e;for(e in a)b[c++]=e;a=Ia(a)}for(c=0;c<b.length;c++)this.set(b[c],a[c])};w.l=function(){return new jc(this)};w.Yf=function(){for(var a=new jc,b=0;b<this.X.length;b++){var c=this.X[b];a.set(this.ia[c],c)}return a};function mc(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function nc(){L.call(this);this.g="colortable";this.Ka=new jc;ya(this,new hc)}C(nc,L);nc.prototype.add=function(a,b,c,e,d,f){(!x(a)||!x(c)||!x(e)||!x(d)||!x(f))&&n(Error("Invalid color table entry."));this.Ka.set(a,[b,c,e,d,f]);this.j=q};nc.prototype.get=function(a){return this.Ka.get(a)};A("X.colortable.prototype.get",nc.prototype.get);function oc(a,b,c){this.x=ja(a)?a:0;this.y=ja(b)?b:0;this.d=ja(c)?c:0}oc.prototype.l=function(){return new oc(this.x,this.y,this.d)};function P(a,b,c){this.x=a;this.y=b;this.d=c}C(P,oc);w=P.prototype;w.l=function(){return new P(this.x,this.y,this.d)};w.Jb=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.d*this.d)};w.scale=function(a){this.x*=a;this.y*=a;this.d*=a;return this};w.$=function(){this.x=-this.x;this.y=-this.y;this.d=-this.d;return this};w.normalize=function(){return this.scale(1/this.Jb())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.d+=a.d;return this};
w.ya=function(a){this.x-=a.x;this.y-=a.y;this.d-=a.d;return this};function pc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return Math.sqrt(c*c+e*e+d*d)}function qc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return c*c+e*e+d*d}function rc(a,b){return new P(a.x+b.x,a.y+b.y,a.d+b.d)}function sc(a,b){return new P(a.y*b.d-a.d*b.y,a.d*b.x-a.x*b.d,a.x*b.y-a.y*b.x)};D.m=P;w=D.m.prototype;w.l=P.prototype.l;w.Jb=P.prototype.Jb;w.scale=P.prototype.scale;w.$=P.prototype.$;w.add=P.prototype.add;w.ya=P.prototype.ya;w.normalize=function(){var a=this.Jb();return 0==a?this.scale(0):this.scale(1/a)};D.m.ac=function(a,b){return a.x*b.x+a.y*b.y+a.d*b.d};D.m.tc=sc;D.m.sf=pc;D.m.te=function(a,b,c){return new P(a.x+c*(b.x-a.x),a.y+c*(b.y-a.y),a.d+c*(b.d-a.d))};D.m.prototype.__defineGetter__("xx",v("x"));D.m.prototype.__defineGetter__("yy",v("y"));
D.m.prototype.__defineGetter__("zz",v("d"));A("X.vector",D.m);A("X.vector.prototype.clone",D.m.prototype.l);A("X.vector.prototype.magnitude",D.m.prototype.Jb);A("X.vector.prototype.scale",D.m.prototype.scale);A("X.vector.prototype.invert",D.m.prototype.$);A("X.vector.prototype.normalize",D.m.prototype.normalize);A("X.vector.prototype.add",D.m.prototype.add);A("X.vector.prototype.subtract",D.m.prototype.ya);A("X.vector.dot",D.m.ac);A("X.vector.cross",D.m.tc);A("X.vector.distance",D.m.sf);
A("X.vector.lerp",D.m.te);function tc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}tc.prototype.BYTES_PER_ELEMENT=8;tc.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]};tc.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{tc.BYTES_PER_ELEMENT=8}catch(uc){}tc.prototype.BYTES_PER_ELEMENT=tc.prototype.BYTES_PER_ELEMENT;tc.prototype.set=tc.prototype.set;tc.prototype.toString=tc.prototype.toString;A("Float64Array",tc)};function vc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}vc.prototype.BYTES_PER_ELEMENT=4;vc.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]};vc.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(vc.BYTES_PER_ELEMENT=4,vc.prototype.BYTES_PER_ELEMENT=vc.prototype.BYTES_PER_ELEMENT,vc.prototype.set=vc.prototype.set,vc.prototype.toString=vc.prototype.toString,A("Float32Array",vc));function wc(){return new Float32Array(3)}function xc(a,b,c){var e=wc();e[0]=a;e[1]=b;e[2]=c;return e}function yc(a,b){var c=a[0],e=a[1],d=a[2],c=1/Math.sqrt(c*c+e*e+d*d);b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c};function zc(){return new Float32Array(4)}function Ac(a,b,c,e){var d=zc();d[0]=a;d[1]=b;d[2]=c;d[3]=e;return d};function Bc(){return new Float32Array(16)}function Cc(){var a=Bc();a[0]=a[5]=a[10]=a[15]=1;return a}function Dc(a,b,c,e,d,f,g,h,l,j,k,m,r,s,y,z,G){a[0]=b;a[1]=c;a[2]=e;a[3]=d;a[4]=f;a[5]=g;a[6]=h;a[7]=l;a[8]=j;a[9]=k;a[10]=m;a[11]=r;a[12]=s;a[13]=y;a[14]=z;a[15]=G;return a}function Ec(a,b,c,e,d){a[12]=b;a[13]=c;a[14]=e;a[15]=d;return a}function Fc(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 Gc(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 S(a,b,c,e,d,f){a[b]=c;a[b+4]=e;a[b+8]=d;a[b+12]=f}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){var e=a[0],d=a[1],f=a[2],g=a[3],h=a[4],l=a[5],j=a[6],k=a[7],m=a[8],r=a[9],s=a[10],y=a[11],z=a[12],G=a[13],F=a[14];a=a[15];var H=b[0],B=b[1],E=b[2],J=b[3],N=b[4],Q=b[5],R=b[6],O=b[7],ea=b[8],I=b[9],ba=b[10],da=b[11],U=b[12],V=b[13],Ga=b[14];b=b[15];c[0]=e*H+h*B+m*E+z*J;c[1]=d*H+l*B+r*E+G*J;c[2]=f*H+j*B+s*E+F*J;c[3]=g*H+k*B+y*E+a*J;c[4]=e*N+h*Q+m*R+z*O;c[5]=d*N+l*Q+r*R+G*O;c[6]=f*N+j*Q+s*R+F*O;c[7]=g*N+k*Q+y*R+a*O;c[8]=e*ea+h*I+m*ba+z*da;c[9]=d*ea+l*I+r*ba+G*da;c[10]=f*ea+j*I+s*ba+
F*da;c[11]=g*ea+k*I+y*ba+a*da;c[12]=e*U+h*V+m*Ga+z*b;c[13]=d*U+l*V+r*Ga+G*b;c[14]=f*U+j*V+s*Ga+F*b;c[15]=g*U+k*V+y*Ga+a*b;return c}
function Kc(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=a[8],m=a[9],r=a[10],s=a[11],y=a[12],z=a[13],G=a[14],F=a[15],H=c*h-e*g,B=c*l-d*g,E=c*j-f*g,J=e*l-d*h,N=e*j-f*h,Q=d*j-f*l,R=k*z-m*y,O=k*G-r*y,ea=k*F-s*y,I=m*G-r*z,ba=m*F-s*z,da=r*F-s*G,U=H*da-B*ba+E*I+J*ea-N*O+Q*R;if(0==U)return u;U=1/U;b[0]=(h*da-l*ba+j*I)*U;b[1]=(-e*da+d*ba-f*I)*U;b[2]=(z*Q-G*N+F*J)*U;b[3]=(-m*Q+r*N-s*J)*U;b[4]=(-g*da+l*ea-j*O)*U;b[5]=(c*da-d*ea+f*O)*U;b[6]=(-y*Q+G*E-F*B)*U;b[7]=(k*Q-r*E+s*B)*U;b[8]=(g*
ba-h*ea+j*R)*U;b[9]=(-c*ba+e*ea-f*R)*U;b[10]=(y*N-z*E+F*H)*U;b[11]=(-k*N+m*E-s*H)*U;b[12]=(-g*I+h*O-l*R)*U;b[13]=(c*I-e*O+d*R)*U;b[14]=(-y*J+z*B-G*H)*U;b[15]=(k*J-m*B+r*H)*U;return q}function Lc(a,b,c){var e=b[0],d=b[1];b=b[2];c[0]=e*a[0]+d*a[4]+b*a[8]+a[12];c[1]=e*a[1]+d*a[5]+b*a[9]+a[13];c[2]=e*a[2]+d*a[6]+b*a[10]+a[14]}
function Mc(a,b,c){var e=b[0],d=b[1],f=b[2];b=b[3];c[0]=e*a[0]+d*a[4]+f*a[8]+b*a[12];c[1]=e*a[1]+d*a[5]+f*a[9]+b*a[13];c[2]=e*a[2]+d*a[6]+f*a[10]+b*a[14];c[3]=e*a[3]+d*a[7]+f*a[11]+b*a[15];return c}function Nc(a,b,c,e){return Ec(a,a[0]*b+a[4]*c+a[8]*e+a[12],a[1]*b+a[5]*c+a[9]*e+a[13],a[2]*b+a[6]*c+a[10]*e+a[14],a[3]*b+a[7]*c+a[11]*e+a[15])}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);D.f={};D.f.Zg=function(a,b,c,e){c=c.ya(b);c.normalize();e=D.m.tc(c,e);e.normalize();var d=D.m.tc(e,c);d.normalize();c.$();S(a,0,e.x,e.y,e.d,0);S(a,1,d.x,d.y,d.d,0);S(a,2,c.x,c.y,c.d,0);Nc(a,-b.x,-b.y,-b.d);return a};D.f.ca=function(a,b,c,e){var d=1/(b*a[3]+c*a[7]+e*a[11]+a[15]);return new D.m((b*a[0]+c*a[4]+e*a[8]+a[12])*d,(b*a[1]+c*a[5]+e*a[9]+a[13])*d,(b*a[2]+c*a[6]+e*a[10]+a[14])*d)};
D.f.sk=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Ic(a,b,e);Ic(a,c,d);Hc(a,b,d);Hc(a,c,e);return a};D.f.rk=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Gc(a,b,e);Gc(a,c,d);Fc(a,b,d);Fc(a,c,e);return a};D.f.Ed=Cc;D.f.l=function(a){var b=Bc();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};
D.f.Yf=function(a,b){if(b==a){var c=a[1],e=a[2],d=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]=e;b[9]=f;b[11]=a[14];b[12]=d;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};
D.f.wi=function(a){var b=a[0],c=a[1],e=a[2],d=a[3],f=a[4],g=a[5],h=a[6],l=a[7],j=a[8],k=a[9],m=a[10],r=a[11],s=a[12],y=a[13],z=a[14];a=a[15];return(b*g-c*f)*(m*a-r*z)-(b*h-e*f)*(k*a-r*y)+(b*l-d*f)*(k*z-m*y)+(c*h-e*g)*(j*a-r*s)-(c*l-d*g)*(j*z-m*s)+(e*l-d*h)*(j*y-k*s)};D.f.$=Kc;D.f.zf=function(a,b,c,e,d){var f=b/2;b=d-e;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,-(d+e)/b,-1,0,0,-(2*e*d)/b,0)};
D.f.gj=function(a,b,c,e,d,f,g){return Dc(a,2*f/(c-b),0,0,0,0,2*f/(d-e),0,0,(c+b)/(c-b),(d+e)/(d-e),-(g+f)/(g-f),-1,0,0,-(2*g*f)/(g-f),0)};D.f.hj=function(a,b,c,e,d,f,g){return Dc(a,2/(c-b),0,0,0,0,2/(d-e),0,0,0,0,-2/(g-f),0,-(c+b)/(c-b),-(d+e)/(d-e),-(g+f)/(g-f),1)};D.f.multiply=Jc;D.f.Bf=Mc;D.f.translate=Nc;D.f.scale=function(a,b,c,e){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]*e,a[9]*e,a[10]*e,a[11]*e,a[12],a[13],a[14],a[15])};
D.f.rotate=function(a,b,c,e,d){var f=a[0],g=a[1],h=a[2],l=a[3],j=a[4],k=a[5],m=a[6],r=a[7],s=a[8],y=a[9],z=a[10],G=a[11],F=Math.cos(b),H=Math.sin(b),B=1-F;b=c*c*B+F;var E=c*e*B+d*H,J=c*d*B-e*H,N=c*e*B-d*H,Q=e*e*B+F,R=e*d*B+c*H,O=c*d*B+e*H;c=e*d*B-c*H;d=d*d*B+F;return Dc(a,f*b+j*E+s*J,g*b+k*E+y*J,h*b+m*E+z*J,l*b+r*E+G*J,f*N+j*Q+s*R,g*N+k*Q+y*R,h*N+m*Q+z*R,l*N+r*Q+G*R,f*O+j*c+s*d,g*O+k*c+y*d,h*O+m*c+z*d,l*O+r*c+G*d,a[12],a[13],a[14],a[15])};
D.f.ze=function(a,b){var c=a[4],e=a[5],d=a[6],f=a[7],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),m=Math.sin(b);a[4]=c*k+g*m;a[5]=e*k+h*m;a[6]=d*k+l*m;a[7]=f*k+j*m;a[8]=c*-m+g*k;a[9]=e*-m+h*k;a[10]=d*-m+l*k;a[11]=f*-m+j*k;return a};D.f.Ae=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),m=Math.sin(b);a[0]=c*k+g*-m;a[1]=e*k+h*-m;a[2]=d*k+l*-m;a[3]=f*k+j*-m;a[8]=c*m+g*k;a[9]=e*m+h*k;a[10]=d*m+l*k;a[11]=f*m+j*k;return a};
D.f.Be=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=Math.cos(b),m=Math.sin(b);a[0]=c*k+g*m;a[1]=e*k+h*m;a[2]=d*k+l*m;a[3]=f*k+j*m;a[4]=c*-m+g*k;a[5]=e*-m+h*k;a[6]=d*-m+l*k;a[7]=f*-m+j*k;return a};A("X.matrix.identity",D.f.Ed);A("X.matrix.clone",D.f.l);A("X.matrix.transpose",D.f.Yf);A("X.matrix.determinant",D.f.wi);A("X.matrix.invert",D.f.$);A("X.matrix.multiply",D.f.multiply);A("X.matrix.multiplyByVector",D.f.ca);A("X.matrix.multiplyByVec4",D.f.Bf);
A("X.matrix.makePerspective",D.f.zf);A("X.matrix.makeFrustum",D.f.gj);A("X.matrix.makeOrtho",D.f.hj);A("X.matrix.makeLookAt",D.f.Zg);A("X.matrix.translate",D.f.translate);A("X.matrix.scale",D.f.scale);A("X.matrix.rotate",D.f.rotate);A("X.matrix.rotateX",D.f.ze);A("X.matrix.rotateY",D.f.Ae);A("X.matrix.rotateZ",D.f.Be);A("X.matrix.swapRows",D.f.sk);A("X.matrix.swapCols",D.f.rk);function Oc(){L.call(this);this.g="transform";this.R=D.f.Ed()}C(Oc,L);Oc.prototype.__defineGetter__("matrix",v("R"));Oc.prototype.__defineSetter__("matrix",function(a){(a==t||!(a instanceof Float32Array))&&n(Error("Invalid matrix."));this.R=a;this.p()});w=Oc.prototype;w.ze=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));D.f.ze(this.R,a*Math.PI/180);this.p()};w.Ae=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));D.f.Ae(this.R,a*Math.PI/180);this.p()};
w.Be=function(a){(!x(a)||-360>a||360<a)&&n(Error("Invalid angle."));D.f.Be(this.R,a*Math.PI/180);this.p()};w.Eh=function(a){x(a)||n(Error("Invalid distance."));D.f.translate(this.R,a,0,0);this.p()};w.Fh=function(a){x(a)||n(Error("Invalid distance."));D.f.translate(this.R,0,a,0);this.p()};w.Gh=function(a){x(a)||n(Error("Invalid distance."));D.f.translate(this.R,0,0,a);this.p()};function Pc(a,b,c){a.R[b+4*c]*=-1;a.p()}w.Ei=function(){Pc(this,0,0)};w.Fi=function(){Pc(this,1,1)};
w.Gi=function(){Pc(this,2,2)};w.p=function(){this.j=q};A("X.transform",Oc);A("X.transform.prototype.rotateX",Oc.prototype.ze);A("X.transform.prototype.rotateY",Oc.prototype.Ae);A("X.transform.prototype.rotateZ",Oc.prototype.Be);A("X.transform.prototype.translateX",Oc.prototype.Eh);A("X.transform.prototype.translateY",Oc.prototype.Fh);A("X.transform.prototype.translateZ",Oc.prototype.Gh);A("X.transform.prototype.flipX",Oc.prototype.Ei);A("X.transform.prototype.flipY",Oc.prototype.Fi);
A("X.transform.prototype.flipZ",Oc.prototype.Gi);A("X.transform.prototype.modified",Oc.prototype.p);function Qc(){L.call(this);this.g="texture";this.Wb=this.bb=this.s=t;this.Xe=this.Ye=0;this.jg=u;ya(this,new hc)}C(Qc,L);Qc.prototype.__defineSetter__("rawData",function(a){this.Wb=a;this.j=q});Qc.prototype.__defineSetter__("rawDataHeight",function(a){this.Xe=a;this.j=q});Qc.prototype.__defineSetter__("rawDataWidth",function(a){this.Ye=a;this.j=q});Qc.prototype.__defineSetter__("grayscale",function(a){this.jg=a;this.j=q});A("X.texture",Qc);function T(a,b){L.call(this);this.g="triplets";this.nb=Infinity;this.kb=-Infinity;this.ob=Infinity;this.lb=-Infinity;this.pb=Infinity;this.mb=-Infinity;this.Rd=[0,0,0];this.ig=q;this.D=0;this.fa=new Float32Array(a);b!=t&&(this.fa=b.fa.subarray(0,b.fa.length),this.D=this.fa.length,this.nb=b.nb,this.kb=b.kb,this.ob=b.ob,this.lb=b.lb,this.pb=b.pb,this.mb=b.mb,this.Rd=b.Rd.slice(),this.ig=u)}C(T,L);w=T.prototype;
w.add=function(a,b,c){this.nb=Math.min(this.nb,a);this.kb=Math.max(this.kb,a);this.ob=Math.min(this.ob,b);this.lb=Math.max(this.lb,b);this.pb=Math.min(this.pb,c);this.mb=Math.max(this.mb,c);this.Rd=[(this.nb+this.kb)/2,(this.ob+this.lb)/2,(this.pb+this.mb)/2];this.ig=u;this.j=q;this.fa[this.D++]=a;this.fa[this.D++]=b;this.fa[this.D++]=c;return this.D/3};w.Xa=function(){if(this.D!=this.fa.length){var a=new Float32Array(this.D);a.set(this.fa.subarray(0,this.D));this.fa=a}};
w.get=function(a){a*=3;return[this.fa[a],this.fa[a+1],this.fa[a+2]]};w.remove=function(){n(Error("Not implemented."))};w.clear=function(){this.fa=new Float32Array(this.fa.length);this.j=q};T.prototype.__defineGetter__("count",function(){this.Xa();return this.fa.length/3});T.prototype.__defineGetter__("length",function(){this.Xa();return this.fa.length});A("X.triplets",T);A("X.triplets.prototype.add",T.prototype.add);A("X.triplets.prototype.resize",T.prototype.Xa);A("X.triplets.prototype.get",T.prototype.get);
A("X.triplets.prototype.remove",T.prototype.remove);A("X.triplets.prototype.clear",T.prototype.clear);function Rc(){this.Ia=Sc;this.la=new Oc;this.A=[1,1,1];this.oc=this.M=this.sa=this.o=this.h=t;this.Nc=[];this.P=q;this.Lc=this.sd=1;this.fc=t;this.jd=u;this.wa=1;this.za=0;this.rd=q}var Sc="TRIANGLES";Rc.prototype.__defineSetter__("type",function(a){return this.Ia=a});Rc.prototype.__defineGetter__("type",v("Ia"));Rc.prototype.__defineGetter__("texture",function(){this.M||(this.M=new Qc);return this.M});Rc.prototype.__defineGetter__("transform",v("la"));Rc.prototype.__defineGetter__("points",v("h"));
Rc.prototype.__defineSetter__("points",ca("h"));Rc.prototype.__defineGetter__("normals",v("o"));Rc.prototype.__defineSetter__("normals",ca("o"));Rc.prototype.__defineGetter__("colors",v("sa"));Rc.prototype.__defineSetter__("colors",ca("sa"));Rc.prototype.__defineGetter__("color",v("A"));Rc.prototype.__defineSetter__("color",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid color."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e].color=a;this.A=a;this.j=q});
Rc.prototype.__defineGetter__("opacity",v("wa"));Rc.prototype.__defineSetter__("opacity",function(a){(!x(a)||1<a||0>a)&&n(Error("Invalid opacity."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].opacity=a);this.wa=a;this.j=q});Rc.prototype.__defineGetter__("caption",v("fc"));Rc.prototype.__defineSetter__("caption",function(a){this.fc=a;this.j=q});Rc.prototype.__defineGetter__("visible",v("P"));
Rc.prototype.__defineSetter__("visible",function(a){for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].visible=a);this.P=a;this.j=q});Rc.prototype.__defineGetter__("pointsize",v("sd"));Rc.prototype.__defineSetter__("pointsize",function(a){x(a)||n(Error("Invalid point size."));this.sd=a;this.j=q});Rc.prototype.__defineGetter__("magicmode",v("jd"));Rc.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&n(Error("Invalid magic mode setting."));this.jd=a;this.j=q});
Rc.prototype.__defineGetter__("linewidth",v("Lc"));Rc.prototype.__defineSetter__("linewidth",function(a){x(a)||n(Error("Invalid line width."));this.Lc=a;this.j=q});Rc.prototype.__defineGetter__("pickable",v("rd"));Rc.prototype.__defineSetter__("pickable",function(a){"boolean"!=typeof a&&n(Error("Invalid pickable setting."));this.rd=a;this.j=q});Rc.prototype.__defineGetter__("textureCoordinateMap",v("oc"));Rc.prototype.__defineSetter__("textureCoordinateMap",ca("yl"));function Tc(){this.qa=Infinity;this.V=this.ea=-Infinity;this.W=Infinity;this.Rb=[0,0,0];this.Pb=[1,1,1]}Tc.prototype.__defineGetter__("lowerThreshold",v("V"));Tc.prototype.__defineSetter__("lowerThreshold",ca("V"));Tc.prototype.__defineGetter__("upperThreshold",v("W"));Tc.prototype.__defineSetter__("upperThreshold",ca("W"));Tc.prototype.__defineGetter__("min",v("qa"));Tc.prototype.__defineGetter__("max",v("ea"));Tc.prototype.__defineGetter__("minColor",v("Rb"));
Tc.prototype.__defineSetter__("minColor",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid min. color."));this.Rb=a});Tc.prototype.__defineGetter__("maxColor",v("Pb"));Tc.prototype.__defineSetter__("maxColor",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid max. color."));this.Pb=a});function Uc(){L.call(this);this.g="scalars";this.dd=this.G=t;this.wg=q;this.Ne=0;ya(this,new hc);ya(this,new Tc);this.Rb=[0,1,0];this.Pb=[1,0,0]}C(Uc,L);Uc.prototype.__defineGetter__("array",v("G"));Uc.prototype.__defineSetter__("array",function(a){this.dd=this.G=a;this.j=q});Uc.prototype.__defineGetter__("interpolation",v("Ne"));Uc.prototype.__defineSetter__("interpolation",ca("Ne"));A("X.scalars",Uc);function W(a){L.call(this);this.g="object";this.c=[];this.H=this.pa=t;ya(this,new Rc);a!=t&&this.sc(a)}C(W,L);
W.prototype.sc=function(a){this.Ia=a.Ia;this.la=new Oc;this.la.R=new Float32Array(a.la.R);this.A=a.A.slice();a.h&&(this.h=new T(a.h.length,a.h));a.o&&(this.o=new T(a.o.length,a.o));a.sa&&(this.sa=new T(a.sa.length,a.sa));this.M=a.M;this.oc=a.oc;a.s&&(this.s=new gc((new String(a.s.$d)).toString()));this.wa=a.wa;this.c.length=0;var b=a.c;if(b)for(var c=b.length,e=0,e=0;e<c;e++)this.c.push(new D[b[e].g](b[e]));this.P=a.P;this.sd=a.sd;this.Lc=a.Lc;a.fc&&(this.fc=(new String(a.fc)).toString());this.jd=
a.jd;this.rd=a.rd;this.Nc=a.Nc.slice();this.j=q};W.prototype.__defineGetter__("colortable",function(){this.pa||(this.pa=new nc);return this.pa});W.prototype.__defineGetter__("scalars",function(){this.H||(this.H=new Uc);return this.H});W.prototype.__defineGetter__("children",v("c"));W.prototype.p=function(){var a=new Wc;a.F=this;this.dispatchEvent(a)};W.prototype.remove=function(){var a=new Xc;a.F=this;this.dispatchEvent(a)};
W.prototype.Ta=function(){Zb(this);if(0<this.c.length)for(var a=this.c,b=a.length,c=0,c=0;c<b;c++)"undefined"!=typeof a[c]&&this.c[c].Ta();this.c.length=0;this.H=this.pa=t};function Yc(a,b){(a==t||b==t||!(a instanceof W)||!(b instanceof W))&&n(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.wa?-1:1==b.wa?1:a.za!=t&&b.za!=t&&a.za>b.za?-1:1}A("X.object",W);A("X.object.prototype.modified",W.prototype.p);A("X.object.prototype.remove",W.prototype.remove);
A("X.object.prototype.destroy",W.prototype.Ta);function Zc(a,b,c){this.$a=this.Za=this.Ya=0;3==arguments.length?(this.Ya=Number(a),this.Za=Number(b),this.$a=Number(c)):a instanceof Zc?(this.Ya=Number(a.x()),this.Za=Number(a.y()),this.$a=Number(a.d())):(this.Ya=Number(a[0]),this.Za=Number(a[1]),this.$a=Number(a[2]))}
Zc.prototype={l:function(){return new Zc(this.Ya,this.Za,this.$a)},ac:function(a){return this.Ya*a.x()+this.Za*a.y()+this.$a*a.d()},te:function(a,b){return $c(this,ad(bd(a,this),b))},length:function(){return Math.sqrt(this.ac(this))},tc:function(a){return new Zc(this.Za*a.d()-this.$a*a.y(),this.$a*a.x()-this.Ya*a.d(),this.Ya*a.y()-this.Za*a.x())},x:v("Ya"),y:v("Za"),d:v("$a")};function cd(a){var b=a.length();return new Zc(a.Ya/b,a.Za/b,a.$a/b)}
function ad(a,b){return new Zc(a.Ya*b,a.Za*b,a.$a*b)}function bd(a,b){return new Zc(a.Ya-b.x(),a.Za-b.y(),a.$a-b.d())}function $c(a,b){return new Zc(a.Ya+b.x(),a.Za+b.y(),a.$a+b.d())}function dd(a){return new Zc(-a.Ya,-a.Za,-a.$a)};function ed(a,b){this.Wa=new Zc(a);this.xa=new Zc(b)}ed.prototype={l:function(){return new ed(this.Wa.l(),this.xa.l())},vc:function(){this.xa=dd(this.xa)}};function fd(a,b){this.xa=a;this.Pd=b}fd.prototype={l:function(){return new fd(this.xa.l(),this.Pd)},vc:function(){this.xa=dd(this.xa);this.Pd=-this.Pd}};function gd(a,b){this.Lb=a;this.Ee=b;var c=a[0].Wa,e=a[2].Wa,e=cd(bd(a[1].Wa,c).tc(bd(e,c)));this.Va=new fd(e,e.ac(c))}gd.prototype={l:function(){var a=this.Lb.map(function(a){return a.l()});return new gd(a,this.Ee)},vc:function(){this.Lb.reverse().map(function(a){a.vc()});this.Va.vc()}};
function hd(a,b,c,e,d,f){for(var g=0,h=[],l=0;l<a.Lb.length;l++){var j=b.xa.ac(a.Lb[l].Wa)-b.Pd,j=-1E-5>j?2:1E-5<j?1:0,g=g|j;h.push(j)}switch(g){case 0:(0<b.xa.ac(a.Va.xa)?c:e).push(a);break;case 1:d.push(a);break;case 2:f.push(a);break;case 3:c=[];e=[];for(l=0;l<a.Lb.length;l++){var k=(l+1)%a.Lb.length,j=h[l],m=h[k],g=a.Lb[l],k=a.Lb[k];2!=j&&c.push(g);1!=j&&e.push(2!=j?g.l():g);3==(j|m)&&(j=(b.Pd-b.xa.ac(g.Wa))/b.xa.ac(bd(k.Wa,g.Wa)),j=new ed(g.Wa.te(k.Wa,j),g.xa.te(k.xa,j)),c.push(j),e.push(j.l()))}3<=
c.length&&d.push(new gd(c,a.Ee));3<=e.length&&f.push(new gd(e,a.Ee))}};function id(a){this.Aa=this.Ba=this.Va=t;this.aa=[];a&&jd(this,a)}id.prototype={l:function(){var a=new id,b=this.Va&&this.Va.l();a.Va=b;b=this.Ba&&this.Ba.l();a.Ba=b;b=this.Aa&&this.Aa.l();a.Aa=b;a.De(this.aa.map(function(a){return a.l()}));return a},$:function(){for(var a=0;a<this.aa.length;a++)this.aa[a].vc();this.Va.vc();this.Ba&&this.Ba.$();this.Aa&&this.Aa.$();a=this.Ba;this.Ba=this.Aa;this.Aa=a},De:ca("aa")};
function jd(a,b){if(b.length){a.Va||(a.Va=b[0].Va.l());for(var c=[],e=[],d=0;d<b.length;d++)hd(b[d],a.Va,a.aa,a.aa,c,e);c.length&&(a.Ba||(a.Ba=new id),jd(a.Ba,c));e.length&&(a.Aa||(a.Aa=new id),jd(a.Aa,e))}}function kd(a){var b=a.aa.slice();a.Ba&&(b=b.concat(kd(a.Ba)));a.Aa&&(b=b.concat(kd(a.Aa)));return b}function ld(a,b){a.aa=md(b,a.aa);a.Ba&&ld(a.Ba,b);a.Aa&&ld(a.Aa,b)}
function md(a,b){if(!a.Va)return b.slice();for(var c=[],e=[],d=0;d<b.length;d++)hd(b[d],a.Va,c,e,c,e);a.Ba&&(c=md(a.Ba,c));e=a.Aa?md(a.Aa,e):[];return c.concat(e)};function nd(){this.aa=[]}function od(a){var b=new nd;b.De(a);return b}
nd.prototype={l:function(){var a=new nd;a.De(this.aa.map(function(a){return a.l()}));return a},Zf:function(a){var b=new id(this.l().aa);a=new id(a.l().aa);ld(b,a);ld(a,b);a.$();ld(a,b);a.$();jd(b,kd(a));return od(kd(b))},ya:function(a){var b=new id(this.l().aa);a=new id(a.l().aa);b.$();ld(b,a);ld(a,b);a.$();ld(a,b);a.$();jd(b,kd(a));b.$();return od(kd(b))},wf:function(a){var b=new id(this.l().aa);a=new id(a.l().aa);b.$();ld(a,b);a.$();ld(b,a);ld(a,b);jd(b,kd(a));b.$();return od(kd(b))},inverse:function(){var a=
this.l();a.aa.map(function(a){a.vc()});return a},De:ca("aa")};function pd(){}function qd(a){for(var b=a.h.count,c=[],e=0,e=0;e<b;e+=3){var d=a.h.get(e),f=a.h.get(e+1),g=a.h.get(e+2),h=a.o.get(e),l=a.o.get(e+1),j=a.o.get(e+2),k=a.A;a.sa&&0<a.sa.length&&(k=a.sa.get(e));var m=[];m.push(new ed(d,h));m.push(new ed(f,l));m.push(new ed(g,j));c.push(new gd(m,k))}return od(c)}
function rd(a,b){(b==t||!(b instanceof nd))&&n(Error("Invalid CSG object."));var c=new fc,e=[];Fb(b.aa,function(a){var b=[],g=a.Ee,b=Fb(a.Lb,function(a){a.color=g;return c.add(a)});for(a=a=2;a<b.length;a++)e.push([b[0],b[a-1],b[a]])}.bind(a));a.Wh=Fb(c.unique(),function(a){return[a.Wa.x(),a.Wa.y(),a.Wa.d()]});a.Vh=Fb(c.unique(),function(a){return[a.xa.x(),a.xa.y(),a.xa.d()]});a.Uh=Fb(c.unique(),function(a){return!a.color?t:[a.color[0],a.color[1],a.color[2]]});a.h=new T(9*e.length);a.o=new T(9*e.length);
a.sa=new T(9*e.length);Fb(e,function(a){var b=a[0],c=a[1];a=a[2];var e=this.Wh,l=this.Vh,j=this.Uh;this.h.add(e[b][0],e[b][1],e[b][2]);this.h.add(e[c][0],e[c][1],e[c][2]);this.h.add(e[a][0],e[a][1],e[a][2]);this.o.add(l[b][0],l[b][1],l[b][2]);this.o.add(l[c][0],l[c][1],l[c][2]);this.o.add(l[a][0],l[a][1],l[a][2]);j[b]&&this.sa.add(j[b][0],j[b][1],j[b][2]);j[c]&&this.sa.add(j[c][0],j[c][1],j[c][2]);j[a]&&this.sa.add(j[a][0],j[a][1],j[a][2])}.bind(a));0==a.sa.D&&(a.sa=t);a.Ia=Sc}
pd.prototype.Zf=function(a){(a==t||!(a instanceof nd)&&!(a instanceof W))&&n(Error("Invalid object."));var b=a;a instanceof W&&(b=qd(b));a=new W;ya(a,new pd);rd(a,qd(this).Zf(b));return a};pd.prototype.ya=function(a){(a==t||!(a instanceof nd)&&!(a instanceof W))&&n(Error("Invalid object."));var b=a;a instanceof W&&(b=qd(b));a=new W;ya(a,new pd);rd(a,qd(this).ya(b));return a};
pd.prototype.wf=function(a){(a==t||!(a instanceof nd)&&!(a instanceof W))&&n(Error("Invalid object."));var b=a;a instanceof W&&(b=qd(b));a=new W;ya(a,new pd);rd(a,qd(this).wf(b));return a};pd.prototype.inverse=function(){var a=new W;ya(a,new pd);rd(a,qd(this).inverse());return a};A("X.constructable",pd);A("X.constructable.prototype.intersect",pd.prototype.wf);A("X.constructable.prototype.inverse",pd.prototype.inverse);A("X.constructable.prototype.subtract",pd.prototype.ya);
A("X.constructable.prototype.union",pd.prototype.Zf);function sd(a){Mb.call(this,a);this.g="event"}C(sd,Mb);var td=dc("pan"),ud=dc("rotate"),vd=dc("zoom"),wd=dc("scroll");dc("render");var xd=dc("resetview"),yd=dc("windowlevel"),zd=dc("modified"),Ad=dc("remove"),Bd=dc("progress"),Cd=dc("hover"),Dd=dc("hover_end"),Ed=dc("computing"),Fd=dc("computing_end"),Gd=dc("computing_progress");function Hd(){sd.call(this,yd);this.Se=this.df=0}C(Hd,sd);function Id(){sd.call(this,td);this.za=new D.m(0,0,0)}C(Id,sd);
function Jd(){sd.call(this,ud);this.za=new D.m(0,0,0)}C(Jd,sd);function Kd(){sd.call(this,vd);this.vb=u;this.yb=1}C(Kd,sd);function Ld(){sd.call(this,wd);this.Y=u}C(Ld,sd);function Md(){sd.call(this,Cd);this.he=this.ge=0}C(Md,sd);function Nd(){sd.call(this,Dd)}C(Nd,sd);function Od(){sd.call(this,xd)}C(Od,sd);function Wc(){sd.call(this,zd);this.w=this.F=t}C(Wc,sd);function Xc(){sd.call(this,Ad);this.w=this.F=t}C(Xc,sd);function Pd(){sd.call(this,Bd);this.Ad=0}C(Pd,sd);
function Qd(){sd.call(this,Ed);this.F=t}C(Qd,sd);function Rd(){sd.call(this,Gd);this.Ad=0}C(Rd,sd);function Sd(){sd.call(this,Fd);this.F=t}C(Sd,sd);A("X.event.events.PAN",td);A("X.event.events.ROTATE",ud);A("X.event.events.ZOOM",vd);A("X.event.events.SCROLL",wd);function Y(){L.call(this);this.g="parser";this.L=t;this.D=0;this.ai=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.Mc=q;this.xl=-Infinity;this.wl=Infinity}C(Y,L);Y.prototype.parse=function(){n(Error("The function parse() should be overloaded."))};function Td(a){for(var b=Infinity,c=-Infinity,e=a.length,d=0,d=0;d<e;d++)if(!isNaN(a[d]))var f=a[d],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function Ud(a,b,c){b===p&&(b=0);c===p&&(c=a.length);for(var e="",d=0,d=b;d<c;++d)e+=String.fromCharCode(a[d]);return e}
function Z(a,b,c){c!=t||(c=1);var e=1,d=Uint8Array;switch(b){case "schar":d=Int8Array;break;case "ushort":d=Uint16Array;e=2;break;case "sshort":d=Int16Array;e=2;break;case "uint":d=Uint32Array;e=4;break;case "sint":d=Int32Array;e=4;break;case "float":d=Float32Array;e=4;break;case "complex":d=Float64Array;e=8;break;case "double":d=Float64Array,e=8}b=new d(a.L.slice(a.D,a.D+=c*e));if(a.ai!=a.Mc){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(d=0;d<a.byteLength;d+=e)for(var f=d+e-1,g=d;f>
g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function Vd(a,b){var c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],e=Ac(0,0,0,1),d=zc();Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Ac(0,0,b[2]-1,1);Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Ac(0,b[1]-
1,0,1);Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Ac(b[0]-1,0,0,1);Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Ac(b[0]-1,b[1]-1,0,1);Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];
c[5]=d[2]>c[5]?d[2]:c[5];e=Ac(b[0]-1,0,b[2]-1,1);Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Ac(0,b[1]-1,b[2]-1,1);Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Ac(b[0]-1,b[1]-1,b[2]-1,1);Mc(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:
c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];return c}
function Wd(a,b){var c=Cc();if(!(a.length==b.length&&a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2])){var e=Math.acos(a[2]),d=wc(),f=a[0],g=a[1],h=a[2],l=b[0],j=b[1],k=b[2];d[0]=g*k-h*j;d[1]=h*l-f*k;d[2]=f*j-g*l;yc(d,d);f=Math.cos(e/2);g=Math.sin(e/2)*d[0];h=Math.sin(e/2)*d[1];e=Math.sin(e/2)*d[2];S(c,0,f*f+g*g-h*h-e*e,2*(g*h-f*e),2*(g*e+f*h),0);S(c,1,2*(g*h+f*e),f*f+h*h-g*g-e*e,2*(h*e-f*g),0);S(c,2,2*(g*e-f*h),2*(h*e+f*g),f*f+e*e-h*h-g*g,0)}e=Bc();Kc(c,e);return[c,e]}
function Xd(a,b,c,e,d,f,g,h,l){var j=new Yd;yc(c,c);for(var k=[],m=[],r=0;6>r;r++)for(var s=Math.floor(r/2),y=(s+1)%3,z=(s+2)%3,G=(4+2*s)%6,F=0;2>F;F++){var H=(2+F+2*s)%6,B=-(c[s]*(d[r]-a[s])+c[y]*(d[H]-a[y]))/c[z]+a[z];if(B>=d[G]&&B<=d[G+1]||B<=d[G]&&B>=d[G+1]){var E=[];E[s]=d[r];E[y]=d[H];E[z]=B;k.push(E)}else E=[],E[s]=d[r],E[y]=d[H],E[z]=B,m.push(E)}a=xc(0,0,1);a=Wd(c,a);d=a[0];a=a[1];s=[];for(m=0;m<k.length;++m)r=Ac(k[m][0],k[m][1],k[m][2],1),y=zc(),Mc(d,r,y),s.push([y[0],y[1],y[2]]);d=xc(1,
0,0);k=wc();Lc(a,d,k);m=xc(0,1,0);d=wc();Lc(a,m,d);r=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];for(m=m=0;m<s.length;++m)s[m][0]<r[0]&&(r[0]=s[m][0]),s[m][0]>r[1]&&(r[1]=s[m][0]),s[m][1]<r[2]&&(r[2]=s[m][1]),s[m][1]>r[3]&&(r[3]=s[m][1]),s[m][2]<r[4]&&(r[4]=s[m][2]),s[m][2]>r[5]&&(r[5]=s[m][2]);m=Ac(r[0]+(r[1]-r[0])/2,r[2]+(r[3]-r[2])/2,r[4]+(r[5]-r[4])/2,0);s=zc();Jc(a,m,s);y=Math.floor(r[0]);z=Math.ceil(r[1]);y==z&&z++;G=z-y;F=Math.floor(r[2]);
H=Math.ceil(r[3]);F==H&&H++;B=H-F;E=b[0];b=b[1];var m=Math.ceil(G/E),J=Math.ceil(B/b),N=new Uint8Array(4*m*J),Q=new Qc;Q.Ye=m;Q.Xe=J;var J=zc(),R=Ac(0,0,r[4],1),O=Bc();Jc(g.Rh,a,O);for(var ea=H-1E-7,I=z-1E-7,ba=0,da=0,U=0,V=F,V=F;V<=ea;V+=b){U++;da=0;R[1]=V;for(m=y;m<=I;m+=E){da++;R[0]=m;Mc(O,R,J);var Ga=4*ba,sb=Math.floor(J[2]),tb=Math.floor(J[1]),ub=Math.floor(J[0]);if(0<=ub&&ub<g.r[0]&&0<=tb&&tb<g.r[1]&&0<=sb&&sb<g.r[2]){var jb=f[sb][tb][ub],Vc=ub=tb=sb=0;l?((jb=l.get(jb))||(jb=[0,0.61,0,0,1]),
sb=255*jb[1],tb=255*jb[2],ub=255*jb[3],Vc=255*jb[4]):(sb=tb=ub=255*((jb-g.qa)/(g.ea-g.qa)),Vc=255);N[Ga]=sb;N[++Ga]=tb;N[++Ga]=ub;N[++Ga]=Vc}else N[Ga]=0,N[++Ga]=0,N[++Ga]=0,N[++Ga]=0;ba++}}Q.Wb=N;j.M=Q;j.gi=r;j.Th=a;j.Sh=O;j.Zh=F;j.ul=H;j.fi=y;j.zl=z;j.lg=da;j.kg=U;j.Vc=E;j.N=G;j.Gc=b;j.B=B;j.v=[s[0],s[1],s[2]];j.hc=[c[0],c[1],c[2]];j.Oc=[k[0],k[1],k[2]];j.Y=[d[0],d[1],d[2]];j.P=u;j.zb=g;j.Db=g.zb!=t&&!h?u:q;j.ec=e;j.Ab();j.P=u;return j}
function Zd(a,b,c,e){var d;d=e.oa;for(var f=[],g=[],h=0;6>h;h++){var l=Math.floor(h/2),j=(l+1)%3,k=(l+2)%3,m=(2+2*l)%6,r=(4+2*l)%6,s=(d[h]-b[l])*(1/c[l]);if(Infinity!=s&&-Infinity!=s){var y=b[j]+c[j]*s,s=b[k]+c[k]*s;y>=d[m]&&y<=d[m+1]&&s>=d[r]&&s<=d[r+1]?(m=[],m[l]=d[h],m[j]=y,m[k]=s,f.push(m)):(m=[],m[l]=d[h],m[j]=y,m[k]=s,g.push(m))}}d=[f,g];b=d[0];e.b[a].k=d;d=pc(new P(b[0][0],b[0][1],b[0][2]),new P(b[1][0],b[1][1],b[1][2]));e.b[a].sl=d;f=xc(0,0,1);g=Wd(c,f)[0];h=Ac(e.ad[0],e.ad[1],e.ad[2],0);
f=zc();Mc(g,h,f);g=zc();h=f[2];g[0]=c[0]*h;g[1]=c[1]*h;g[2]=c[2]*h;g[3]=c[3]*h;0.1>Math.abs(f[0])&&(f[0]=0.1);0.1>Math.abs(f[1])&&(f[1]=0.1);f[0]/=e.be;f[1]/=e.be;e.b[a].Ga=[Math.abs(f[0]),Math.abs(f[1])];e.b[a].Sc=f[2];e.b[a].C=g;d=Math.floor(Math.abs(d/f[2]));e.ud[a]=d+1;e.b[a].q=d+1;e.b[a].k[0][0][0]>e.b[a].k[0][1][0]?0<g[0]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][0]<e.b[a].k[0][1][0]?0>g[0]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=
d):e.b[a].k[0][0][1]>e.b[a].k[0][1][1]?0<g[1]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][1]<e.b[a].k[0][1][1]?0>g[1]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][2]>e.b[a].k[0][1][2]?0<g[2]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][2]<e.b[a].k[0][1][2]&&0>g[2]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d);e.b[a].Ve=-(c[0]*b[0][0]+c[1]*b[0][1]+c[2]*b[0][2])}
function $d(a,b){var c;c=b.L;for(var e=b.r,d=b.ea,f=b.qa,g=Array(e[2]),h=Array(e[2]),l=e[1]*e[0],j=0,k=0,m=0,r=0,s=0,r=0;r<e[2];r++){var y=c.subarray(r*l,(r+1)*l),s=0;h[r]=Array(e[1]);g[r]=Array(e[1]);for(m=0;m<e[1];m++){h[r][m]=new c.constructor(e[0]);g[r][m]=new c.constructor(e[0]);for(k=0;k<e[0];k++)j=y[s],h[r][m][k]=255*((j-f)/(d-f)),g[r][m][k]=j,s++}}c=[g,h];b.S=c[0];b.dg=c[1];D.Ja(a.g+".reslice");b.J=b.e!=t;b.pa&&(b.cd=b.pa.Ka);b.Yl=[0,0,0];b.t=[b.Ea[0]+(b.jb[0]-1)/2,b.Ea[1]+(b.jb[1]-1)/2,b.Ea[2]+
(b.jb[2]-1)/2];b.oa=[Math.min(b.Ea[0],b.Ea[0]+b.jb[0]-1),Math.max(b.Ea[0],b.Ea[0]+b.jb[0]-1),Math.min(b.Ea[1],b.Ea[1]+b.jb[1]-1),Math.max(b.Ea[1],b.Ea[1]+b.jb[1]-1),Math.min(b.Ea[2],b.Ea[2]+b.jb[2]-1),Math.max(b.Ea[2],b.Ea[2]+b.jb[2]-1)];b.b=[{},{},{}];c=xc(b.t[0],b.t[1],b.t[2]);b.b[0].vd=c;e=xc(1,0,0);yc(e,e);b.b[0].i=e;d=[1,0,0];b.b[0].A=d;Zd(0,c,e,b);b.c[0].c=Array(b.b[0].q);c[0]=b.b[0].k[0][0][0]+b.b[0].C[0]*Math.floor(b.b[0].q/2);c[1]=b.b[0].k[0][0][1]+b.b[0].C[1]*Math.floor(b.b[0].q/2);c[2]=
b.b[0].k[0][0][2]+b.b[0].C[2]*Math.floor(b.b[0].q/2);c=Xd(c,b.b[0].Ga,b.b[0].i,b.b[0].A,b.oa,b.S,b,b.J,b.cd);b.J&&(c.e=b.e.c[0].c[Math.floor(b.b[0].q/2)].M);b.c[0].c[Math.floor(b.b[0].q/2)]=c;b.Eb=Math.floor(b.b[0].q/2);b.Hc=Math.floor(b.b[0].q/2);c=xc(b.t[0],b.t[1],b.t[2]);b.b[1].vd=c;e=xc(0,1,0);yc(e,e);b.b[1].i=e;d=[0,1,0];b.b[1].A=d;Zd(1,c,e,b);b.c[1].c=Array(b.b[1].q);c[0]=b.b[1].k[0][0][0]+b.b[1].C[0]*Math.floor(b.b[1].q/2);c[1]=b.b[1].k[0][0][1]+b.b[1].C[1]*Math.floor(b.b[1].q/2);c[2]=b.b[1].k[0][0][2]+
b.b[1].C[2]*Math.floor(b.b[1].q/2);c=Xd(c,b.b[1].Ga,b.b[1].i,b.b[1].A,b.oa,b.S,b,b.J,b.cd);b.J&&(c.e=b.e.c[1].c[Math.floor(b.b[1].q/2)].M);b.c[1].c[Math.floor(b.b[1].q/2)]=c;b.Fb=Math.floor(b.b[1].q/2);b.Ic=Math.floor(b.b[1].q/2);c=xc(b.t[0],b.t[1],b.t[2]);b.b[2].vd=c;e=xc(0,0,1);yc(e,e);b.b[2].i=e;d=[0,0.392,0.804];b.b[2].A=d;Zd(2,c,e,b);b.c[2].c=Array(b.b[2].q);c[0]=b.b[2].k[0][0][0]+b.b[2].C[0]*Math.floor(b.b[2].q/2);c[1]=b.b[2].k[0][0][1]+b.b[2].C[1]*Math.floor(b.b[2].q/2);c[2]=b.b[2].k[0][0][2]+
b.b[2].C[2]*Math.floor(b.b[2].q/2);c=Xd(c,b.b[2].Ga,b.b[2].i,b.b[2].A,b.oa,b.S,b,b.J,b.cd);b.J&&(c.e=b.e.c[2].c[Math.floor(b.b[2].q/2)].M);b.c[2].c[Math.floor(b.b[2].q/2)]=c;b.Gb=Math.floor(b.b[2].q/2);b.Jc=Math.floor(b.b[2].q/2);D.Da(a.g+".reslice");return b.S};function ae(){Y.call(this);this.g="parserLBL"}C(ae,Y);
ae.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.Nc,d=e.length;0==d&&n(Error("No _pointIndices defined on the X.object."));this.L=c;var f=[],g=Z(this,"uchar",c.byteLength),h=g.length,l=u,j=0;for(c=1;c<h;c++)10==g[c-1]?(j=c,l=q):l&&32==g[c]&&(f.push(parseInt(Ud(g,j,c),10)),l=u);g=b.H.G?b.H.G:new Float32Array(d);h=f.length;for(c=0;c<h;c++)g[f[c]]=1;f=new Float32Array(3*d);for(c=h=0;c<d;c++)l=e[c],l>d&&n(Error("Could not find scalar for vertex.")),l=g[l],f[h++]=l,f[h++]=l,f[h++]=l;b.H.G=
g;b.H.dd=f;b.H.j=q;D.Da(this.g+".parse");e=new Wc;e.F=b;e.w=a;this.dispatchEvent(e)};A("X.parserLBL",ae);A("X.parserLBL.prototype.parse",ae.prototype.parse);var be;function ce(a,b){var c;c=a.className;c=na(c)&&c.match(/\S+/g)||[];for(var e=Ib(arguments,1),d=c.length+e.length,f=c,g=0;g<e.length;g++)0<=Db(f,e[g])||f.push(e[g]);a.className=c.join(" ");return c.length==d};function de(a,b){this.width=a;this.height=b}w=de.prototype;w.l=function(){return new de(this.width,this.height)};w.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};w.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};w.scale=function(a,b){var c=x(b)?b:a;this.width*=a;this.height*=c;return this};var ee=!db||db&&9<=zb;!eb&&!db||db&&db&&9<=zb||eb&&xb("1.9.1");db&&xb("9");function fe(a,b){this.x=ja(a)?a:0;this.y=ja(b)?b:0}w=fe.prototype;w.l=function(){return new fe(this.x,this.y)};function ge(a,b){return new fe(a.x-b.x,a.y-b.y)}w.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};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 fe?(this.x+=a.x,this.y+=a.y):(this.x+=a,x(b)&&(this.y+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.x*=a;this.y*=c;return this};function he(a){return a?new ie(je(a)):be||(be=new ie)}function ke(a){return na(a)?document.getElementById(a):a}var le={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 me(a,b,c){return ne(document,arguments)}
function ne(a,b){var c=b[0],e=b[1];if(!ee&&e&&(e.name||e.type)){c=["<",c];e.name&&c.push(' name="',La(e.name),'"');if(e.type){c.push(' type="',La(e.type),'"');var d={};Ka(d,e);delete d.type;e=d}c.push(">");c=c.join("")}var f=a.createElement(c);e&&(na(e)?f.className=e:ka(e)?ce.apply(t,[f].concat(e)):Ha(e,function(a,b){"style"==b?f.style.cssText=a:"class"==b?f.className=a:"for"==b?f.htmlFor=a:b in le?f.setAttribute(le[b],a):0==b.lastIndexOf("aria-",0)||0==b.lastIndexOf("data-",0)?f.setAttribute(b,a):
f[b]=a}));if(2<b.length){e=function(b){b&&f.appendChild(na(b)?a.createTextNode(b):b)};for(c=2;c<b.length;c++){var g=b[c];if(ma(g)&&!(pa(g)&&0<g.nodeType)){var d=Eb,h;a:{if((h=g)&&"number"==typeof h.length){if(pa(h)){h="function"==typeof h.item||"string"==typeof h.item;break a}if(oa(h)){h="function"==typeof h.item;break a}}h=u}if(h)if(h=g.length,0<h){for(var l=Array(h),j=0;j<h;j++)l[j]=g[j];g=l}else g=[];d(g,e)}else e(g)}}return f}function oe(a){return"CSS1Compat"==a.compatMode}
function pe(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function qe(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}function re(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 je(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function ie(a){this.ma=a||ga.document||document}w=ie.prototype;w.oe=he;
w.u=function(a){return na(a)?this.ma.getElementById(a):a};w.Mh=ie.prototype.u;w.Wc=function(a,b,c){return ne(this.ma,arguments)};w.createElement=function(a){return this.ma.createElement(a)};w.createTextNode=function(a){return this.ma.createTextNode(String(a))};function se(a){return oe(a.ma)}
function te(a){var b=a.ma;a=!fb&&oe(b)?b.documentElement:b.body;b=b.parentWindow||b.defaultView;return db&&xb("10")&&b.pageYOffset!=a.scrollTop?new fe(a.scrollLeft,a.scrollTop):new fe(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}w.appendChild=function(a,b){a.appendChild(b)};w.contains=re;function ue(a,b,c,e){this.top=a;this.right=b;this.bottom=c;this.left=e}w=ue.prototype;w.l=function(){return new ue(this.top,this.right,this.bottom,this.left)};w.contains=function(a){return!this||!a?u:a instanceof ue?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.ceil=function(){this.top=Math.ceil(this.top);this.right=Math.ceil(this.right);this.bottom=Math.ceil(this.bottom);this.left=Math.ceil(this.left);return this};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 fe?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,x(b)&&(this.top+=b,this.bottom+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};function ve(a,b,c,e){this.left=a;this.top=b;this.width=c;this.height=e}w=ve.prototype;w.l=function(){return new ve(this.left,this.top,this.width,this.height)};w.Vg=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 e=Math.max(this.top,a.top);a=Math.min(this.top+this.height,a.top+a.height);if(e<=a)return this.left=b,this.top=e,this.width=c-b,this.height=a-e,q}return u};
w.contains=function(a){return a instanceof ve?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};function we(a,b){var c=b.x<a.left?a.left-b.x:Math.max(b.x-(a.left+a.width),0),e=b.y<a.top?a.top-b.y:Math.max(b.y-(a.top+a.height),0);return c*c+e*e}w.sf=function(a){return Math.sqrt(we(this,a))};
w.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};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 fe?(this.left+=a.x,this.top+=a.y):(this.left+=a,x(b)&&(this.top+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};function xe(a,b){var c=je(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,t))?c[b]||c.getPropertyValue(b)||"":""}function ye(a,b){return xe(a,b)||(a.currentStyle?a.currentStyle[b]:t)||a.style&&a.style[b]}function ze(a){a=a?je(a):document;return db&&!(db&&9<=zb)&&!se(he(a))?a.body:a.documentElement}
function Ae(a){var b=a.getBoundingClientRect();db&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function Be(a){if(db&&!(db&&8<=zb))return a.offsetParent;var b=je(a),c=ye(a,"position"),e="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=ye(a,"position"),e=e&&"static"==c&&a!=b.documentElement&&a!=b.body,!e&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return t}
function Ce(a){for(var b=new ue(0,Infinity,Infinity,0),c=he(a),e=c.ma.body,d=c.ma.documentElement,f=!fb&&oe(c.ma)?c.ma.documentElement:c.ma.body;a=Be(a);)if((!db||0!=a.clientWidth)&&(!fb||0!=a.clientHeight||a!=e)&&a!=e&&a!=d&&"visible"!=ye(a,"overflow")){var g=De(a),h;h=a;if(eb&&!xb("1.9")){var l=parseFloat(xe(h,"borderLeftWidth"));if(Ee(h))var j=h.offsetWidth-h.clientWidth-l-parseFloat(xe(h,"borderRightWidth")),l=l+j;h=new fe(l,parseFloat(xe(h,"borderTopWidth")))}else h=new fe(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)}e=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,e);b.top=Math.max(b.top,f);c=(c.ma.parentWindow||c.ma.defaultView||window).document;c=oe(c)?c.documentElement:c.body;c=new de(c.clientWidth,c.clientHeight);b.right=Math.min(b.right,e+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:t}
function De(a){var b,c=je(a),e=ye(a,"position"),d=eb&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==e&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new fe(0,0),g=ze(c);if(a==g)return f;if(a.getBoundingClientRect)b=Ae(a),a=te(he(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!d)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(fb&&"fixed"==ye(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(bb||fb&&"absolute"==e)f.y-=c.body.offsetTop;for(b=a;(b=Be(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,!bb||"TR"!=b.tagName)f.y-=b.scrollTop}return f}
function Fe(a){var b=new fe;if(1==a.nodeType){if(a.getBoundingClientRect){var c=Ae(a);b.x=c.left;b.y=c.top}else{var c=te(he(a)),e=De(a);b.x=e.x-c.x;b.y=e.y-c.y}if(eb&&!xb(12)){var d;db?d="-ms-transform":fb?d="-webkit-transform":bb?d="-o-transform":eb&&(d="-moz-transform");var f;d&&(f=ye(a,d));f||(f=ye(a,"transform"));f?(a=f.match(Ge),a=!a?new fe(0,0):new fe(parseFloat(a[1]),parseFloat(a[2]))):a=new fe(0,0);b=new fe(b.x+a.x,b.y+a.y)}}else d=oa(a.Ji),f=a,a.targetTouches?f=a.targetTouches[0]:d&&a.sb.targetTouches&&
(f=a.sb.targetTouches[0]),b.x=f.clientX,b.y=f.clientY;return b}function He(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}function Ie(a){if("none"!=ye(a,"display"))return Je(a);var b=a.style,c=b.display,e=b.visibility,d=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=Je(a);b.display=c;b.position=d;b.visibility=e;return a}
function Je(a){var b=a.offsetWidth,c=a.offsetHeight,e=fb&&!b&&!c;return(!ja(b)||e)&&a.getBoundingClientRect?(a=Ae(a),new de(a.right-a.left,a.bottom-a.top)):new de(b,c)}function Ke(a,b){a.style.display=b?"":"none"}function Ee(a){return"rtl"==ye(a,"direction")}function Le(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var d=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=e;return d}
function Me(a,b){var c=a.currentStyle?a.currentStyle[b]:t;return c?Le(a,c):0}var Ne={thin:2,medium:4,thick:6};function Oe(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:t))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:t;return c in Ne?Ne[c]:Le(a,c)}var Ge=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function Pe(a,b){ec.call(this);this.I=a;var c=pa(this.I)&&1==this.I.nodeType?this.I:this.I?this.I.body:t;this.dj=!!c&&Ee(c);this.Pl=K(this.I,eb?"DOMMouseScroll":"mousewheel",this,b)}C(Pe,ec);
Pe.prototype.handleEvent=function(a){var b=0,c=0,e=0;a=a.sb;if("mousewheel"==a.type){c=1;if(db||fb&&(Wa||xb("532.0")))c=40;e=Qe(-a.wheelDelta,c);ja(a.wheelDeltaX)?(b=Qe(-a.wheelDeltaX,c),c=Qe(-a.wheelDeltaY,c)):c=e}else e=a.detail,100<e?e=3:-100>e&&(e=-3),ja(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=e:c=e;x(this.$g)&&(b=Math.min(Math.max(b,-this.$g),this.$g));x(this.ah)&&(c=Math.min(Math.max(c,-this.ah),this.ah));this.dj&&(b=-b);b=new Re(e,a,b,c);this.dispatchEvent(b)};
function Qe(a,b){return fb&&(Va||Xa)&&0!=a%b?a:a/b}function Re(a,b,c,e){b&&this.Ca(b,p);this.type="mousewheel";this.detail=a;this.El=c;this.Xc=e}C(Re,Ob);db||fb&&xb("525");function Se(a){L.call(this);this.g="interactor";this.Oa=a;this.Te=this.qg=this.pg=this.rg=this.og=this.sg=t;this.Yd=q;this.Xb=this.Qb=this.wb=u;this.va=[0,0];this.Oe=new D.m(0,0,0);this.gd=new D.m(0,0,0);this.Xg=0;this.yg=this.Wd=t;this.xg=u;this.T={MOUSEWHEEL_ENABLED:q,MOUSECLICKS_ENABLED:q,KEYBOARD_ENABLED:q,HOVERING_ENABLED:q,CONTEXTMENU_ENABLED:u,TOUCH_ENABLED:q,TOUCH_BOUNCING_ENABLED:u}}C(Se,L);Se.prototype.__defineGetter__("config",v("T"));Se.prototype.__defineGetter__("leftButtonDown",v("wb"));
Se.prototype.__defineGetter__("middleButtonDown",v("Qb"));Se.prototype.__defineGetter__("rightButtonDown",v("Xb"));
Se.prototype.Ca=function(){this.T.MOUSEWHEEL_ENABLED?(this.Te=new Pe(this.Oa),this.sg=K(this.Te,"mousewheel",this.Kd.bind(this))):(Xb(this.sg),this.Te=t);this.T.MOUSECLICKS_ENABLED?(this.og=K(this.Oa,"mousedown",this.yj.bind(this)),this.rg=K(this.Oa,"mouseup",this.Dj.bind(this))):(Xb(this.og),Xb(this.rg));this.Oa.oncontextmenu=this.T.CONTEXTMENU_ENABLED?t:function(){return u};window.onkeydown=this.T.KEYBOARD_ENABLED?this.jh.bind(this):t;this.T.TOUCH_ENABLED?(this.T.TOUCH_BOUNCING_ENABLED||document.body.addEventListener("touchmove",
function(a){a.preventDefault()},u),this.ei=K(this.Oa,"touchstart",this.Sj.bind(this)),this.di=K(this.Oa,"touchmove",this.Qj.bind(this)),this.ci=K(this.Oa,"touchend",this.Mj.bind(this))):(Xb(this.ei),Xb(this.di),Xb(this.ci));Xb(this.pg);Xb(this.qg);this.pg=K(this.Oa,"mousemove",this.Aj.bind(this));this.qg=K(this.Oa,"mouseout",this.Bj.bind(this))};
Se.prototype.yj=function(a){0==a.button?this.wb=q:1==a.button?this.Qb=q:2==a.button&&(this.Xb=q);eval("this.onMouseDown("+this.wb+","+this.Qb+","+this.Xb+")");Te(this);a.preventDefault()};Se.prototype.xj=aa();Se.prototype.Dj=function(a){0==a.button?this.wb=u:1==a.button?this.Qb=u:2==a.button&&(this.Xb=u);eval("this.onMouseUp("+this.wb+","+this.Qb+","+this.Xb+")");Te(this);a.preventDefault()};Se.prototype.__defineGetter__("mousePosition",v("va"));w=Se.prototype;w.Cj=aa();
w.Bj=function(a){this.Yd=u;this.T.KEYBOARD_ENABLED&&(window.onkeydown=t);this.Xb=this.Qb=this.wb=u;Te(this);this.Oe=new D.m(0,0,0);a.preventDefault()};w.zj=aa();w.Sj=function(a){a.preventDefault();a.Ca(a.sb.targetTouches[0],a.currentTarget);eval("this.onTouchStart("+a.clientX+","+a.clientY+")");this.gd=new D.m(a.clientX,a.clientY,0);this.yg=setTimeout(this.Oj.bind(this,a),500)};w.Rj=aa();
w.Oj=function(a){eval("this.onTouchHover("+a.clientX+","+a.clientY+")");a=new Kd;a.vb=q;var b=1;this instanceof Ue&&(b=20);a.yb=b;this.dispatchEvent(a);this.ce=q};w.Nj=aa();function Ve(a){clearTimeout(a.yg);if(a.ce){var b=new Kd;b.vb=u;var c=1;a instanceof Ue&&(c=20);b.yb=c;a.dispatchEvent(b)}a.ce=u}w.Mj=function(a){a.preventDefault();eval("this.onTouchEnd()");Ve(this)};w.Lj=aa();
w.Qj=function(a){a.preventDefault();this.ce||Ve(this);this.touchmoveEvent=a=a.sb;eval("this.onTouchMove(this['touchmoveEvent'])");var b=a.targetTouches;if(1==b.length){a=b[0];var c=[a.clientX,a.clientY];a=new D.m(c[0],c[1],0);var b=c[0]>3*this.Oa.clientWidth/4,e=c[0]<this.Oa.clientWidth/4,d=c[1]<this.Oa.clientHeight/4,c=c[1]>3*this.Oa.clientHeight/4,c=!b&&!e&&!d&&!c,d=this.gd.ya(a);this.gd=a.l();if(this.ce)a=new Id,5<d.x?d.x=1:-5>d.x&&(d.x=-1),5<d.y?d.y=1:-5>d.y&&(d.y=-1),a.za=d,this.dispatchEvent(a);
else if(this instanceof We&&(b||e))a=new Ld,a.Y=0>d.y,this.dispatchEvent(a);else if(this instanceof Ue||c)d.scale(3),a=new Jd,a.za=d,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 D.m(a[0],a[1],0),b=new D.m(b[0],b[1],0),d=qc(a,b),b=d-this.Xg,this.Xg=d,this.gd.ya(a),this.gd=a.l(),10<Math.abs(b)&&(a=new Kd,a.vb=0<b,b=1,this instanceof Ue&&(b=20),a.yb=b,this.dispatchEvent(a)))};w.Pj=aa();
w.Aj=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");if(!a.cancel){this.Yd=q;this.T.KEYBOARD_ENABLED&&window.onkeydown==t&&(window.onkeydown=this.jh.bind(this));a.preventDefault();var b=a.shiftKey;this.xg=b;this.va=[a.offsetX,a.offsetY];var c=new D.m(this.va[0],this.va[1],0);a=this.Oe.ya(c);this.Oe=c.l();this.T.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.Qb||this.wb||this.Xb)&&Te(this),this.Wd=setTimeout(function(){Te(this);var a=new Md;a.ge=c.x;a.he=
c.y;this.dispatchEvent(a);this.Wd=t}.bind(this),300));0!=a.Jb()&&(this.wb&&!b?(b=new Jd,a.scale(3),b.za=a,this.dispatchEvent(b)):this.Qb||this.wb&&b?(b=new Id,b.za=a,this.dispatchEvent(b)):this.Xb&&(b=new Kd,b.vb=0<a.y,b.yb=1,this.dispatchEvent(b)))}};function Te(a){a.Wd&&clearTimeout(a.Wd);a.dispatchEvent(new Nd)}w.Ej=aa();w.Kd=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");Te(this);a.preventDefault()};w.vj=aa();
w.jh=function(a){if(this.Yd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");Te(this);var b=a.altKey,c=a.ctrlKey,e=a.metaKey,d=a.shiftKey,f=a.keyCode;82==f&&!b&&!c&&!e&&!d?(a.preventDefault(),a=new Od,this.dispatchEvent(a)):37<=f&&40>=f&&(a.preventDefault(),d?a=new Id:b?a=new Kd:(a=new Jd,this instanceof We&&(a=new Ld)),a&&(c=new D.m(0,0,0),37==f?(c.x=5,a.Y=u,b&&(a.Y=q,a.vb=q,a.yb=1)):39==f?(c.x=-5,a.Y=q,b&&(a.vb=u,a.yb=1)):38==f?(c.y=5,a.Y=q,b&&(a.vb=q,a.yb=20)):40==f&&(c.y=-5,a.Y=u,b&&(a.vb=
u,a.yb=20)),a.za=c,this.dispatchEvent(a)))}};A("X.interactor",Se);A("X.interactor.prototype.init",Se.prototype.Ca);A("X.interactor.prototype.onMouseDown",Se.prototype.xj);A("X.interactor.prototype.onMouseUp",Se.prototype.Cj);A("X.interactor.prototype.onMouseMove",Se.prototype.zj);A("X.interactor.prototype.onMouseWheel",Se.prototype.Ej);A("X.interactor.prototype.onKey",Se.prototype.vj);A("X.interactor.prototype.onTouchStart",Se.prototype.Rj);A("X.interactor.prototype.onTouchMove",Se.prototype.Pj);
A("X.interactor.prototype.onTouchEnd",Se.prototype.Lj);A("X.interactor.prototype.onTouchHover",Se.prototype.Nj);function We(a){Se.call(this,a);this.g="interactor2D"}C(We,Se);We.prototype.Kd=function(a){We.z.Kd.call(this,a);var b=new Ld;a.Xc==t&&(a.Xc=0);b.Y=0>a.Xc;this.dispatchEvent(b)};function Yd(a){W.call(this);this.g="slice";this.v=[0,0,0];this.hc=[0,0,1];this.Y=[0,1,0];this.Oc=[1,0,0];this.B=this.N=10;this.oc=[0,1,0,0,1,1,1,1,1,0,0,0];this.e=this.zb=t;this.Db=q;this.ec=[1,1,1];a!=t&&this.sc(a)}C(Yd,W);Yd.prototype.sc=function(a){this.v=a.v.slice();this.hc=a.hc.slice();this.Y=a.Y.slice();this.N=a.N;this.B=a.B;this.zb=a.zb;this.e=a.e;this.Db=a.Db;this.ec=a.ec;this.Yh=a.Yh;Yd.z.sc.call(this,a)};Yd.prototype.__defineSetter__("height",ca("B"));
Yd.prototype.__defineSetter__("width",ca("N"));Yd.prototype.__defineGetter__("up",v("Y"));Yd.prototype.__defineGetter__("right",v("Oc"));Yd.prototype.create=function(){this.Ab()};Yd.prototype.Ta=function(){Yd.z.Ta.call(this);this.v.length=0;this.hc.length=0;this.Y.length=0;this.Oc.length=0;this.oc.length=0;this.e=this.zb=t;this.ec.length=0};
Yd.prototype.Ab=function(){var a=(new P(this.hc[0],this.hc[1],this.hc[2])).normalize(),b=new P(this.Y[0],this.Y[1],this.Y[2]),c=new P(this.Oc[0],this.Oc[1],this.Oc[2]),e=new P(this.v[0],this.v[1],this.v[2]),d=rc(c.l().$().scale(this.N/2),b.l().$().scale(this.B/2)),f=new P(d.x+e.x,d.y+e.y,d.d+e.d),d=rc(c.l().$().scale(this.N/2),b.l().scale(this.B/2)),g=new P(d.x+e.x,d.y+e.y,d.d+e.d),d=rc(c.l().scale(this.N/2),b.l().$().scale(this.B/2)),h=new P(d.x+e.x,d.y+e.y,d.d+e.d),d=rc(c.l().scale(this.N/2),b.l().scale(this.B/
2)),b=new P(d.x+e.x,d.y+e.y,d.d+e.d);this.h=new T(18);this.o=new T(18);this.h.add(f.x,f.y,f.d);this.h.add(g.x,g.y,g.d);this.h.add(h.x,h.y,h.d);this.h.add(h.x,h.y,h.d);this.h.add(b.x,b.y,b.d);this.h.add(g.x,g.y,g.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.o.add(a.x,a.y,a.d);this.Db&&(a=new W,a.h=new T(24),a.o=new T(24),a.h.add(f.x,f.y,f.d),a.h.add(g.x,g.y,g.d),a.h.add(g.x,g.y,g.d),a.h.add(b.x,b.y,b.d),a.h.add(b.x,
b.y,b.d),a.h.add(h.x,h.y,h.d),a.h.add(h.x,h.y,h.d),a.h.add(f.x,f.y,f.d),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.o.add(0,0,0),a.A=[this.ec[0],this.ec[1],this.ec[2]],a.Ia="LINES",a.Lc=2,this.c.push(a))};A("X.slice",Yd);A("X.slice.prototype.create",Yd.prototype.create);A("X.slice.prototype.destroy",Yd.prototype.Ta);function M(a){W.call(this);this.g="volume";this.v=[0,0,0];this.r=[10,10,10];this.oa=[1,1,1];this.ud=[10,10,10];this.qb=[1,1,1];this.bb=[];this.Jc=this.Gb=this.Ic=this.Fb=this.Hc=this.Eb=0;this.lc=new W;this.mc=new W;this.nc=new W;this.fe=this.Ra=u;this.Z=-1;this.ee=[];this.e=t;this.Db=q;this.ha=Infinity;this.ga=-Infinity;this.be=1;this.ea=0;this.L=t;this.b=[];this.t=[0,0,0];this.jb=[0,0,0];this.ad=[0,0,0];this.S=[];this.dg=[];this.ab=t;this.Me=u;ya(this,new hc);ya(this,new Tc);a!=t&&this.sc(a)}
C(M,W);w=M.prototype;w.sc=function(a){this.v=a.v.slice();this.r=a.r.slice();this.qb=a.qb.slice();this.Eb=a.Eb;this.Hc=a.Hc;this.Fb=a.Fb;this.Ic=a.Ic;this.Gb=a.Gb;this.Jc=a.Jc;this.fg=a.fg.slice();this.lc=new W(a.lc);this.mc=new W(a.mc);this.nc=new W(a.nc);this.ea=a.ea;this.L=a.L;this.Ra=a.Ra;this.fe=a.fe;this.Z=a.Z;this.e=a.e;this.Db=a.Db;M.z.sc.call(this,a)};
w.Ab=function(a){this.c.length=0;this.lc.c.length=0;this.mc.c.length=0;this.nc.c.length=0;this.c.push(this.lc);this.c.push(this.mc);this.c.push(this.nc);this.Ea=a.Bc;this.ad=a.Cc;this.jb=a.Ac;this.Dc=a.gb;this.Rh=a.ib;this.ea=a.max;this.L=a.data;this.$h=a;this.j=q};
w.Ta=function(){M.z.Ta.call(this);this.bb.length=0;this.c.length=0;this.lc.c.length=0;this.lc.length=0;this.mc.c.length=0;this.mc.length=0;this.nc.c.length=0;this.nc.length=0;this.L=t;this.oa.length=0;this.b.length=0;this.t.length=0;this.jb.length=0;this.ad.length=0;this.S.length=0;this.dg.length=0;this.ab=t};
w.p=function(a){a="undefined"!==typeof a?a:q;if(0<this.c.length){this.Ra!=this.fe&&(!this.Ra&&-1!=this.Z&&(this.c[this.Z].visible=u),this.j=q,this.fe=this.Ra);if(!this.P)return;Xe(this,0,u);Xe(this,1,u);Xe(this,2,u);this.Ra&&-1!=this.Z&&Ye(this,this.Z)}a&&M.z.p.call(this)};
function Xe(a,b,c){var e=a.c[b],d=0,f=0;0==b?(d=a.Eb,f=a.Hc,a.Hc=a.Eb):1==b?(d=a.Fb,f=a.Ic,a.Ic=a.Fb):2==b&&(d=a.Gb,f=a.Jc,a.Jc=a.Gb);if(e.c[parseInt(d,10)]==t||c){c=wc();c[0]=a.b[b].k[0][0][0]+a.b[b].C[0]*parseInt(d,10);c[1]=a.b[b].k[0][0][1]+a.b[b].C[1]*parseInt(d,10);c[2]=a.b[b].k[0][0][2]+a.b[b].C[2]*parseInt(d,10);if(a.J){var g=Xd(c,a.b[b].Ga,a.b[b].i,a.b[b].A,a.oa,a.e.S,a.e,a.e.J,a.e.pa.Ka);a.e.c[b].c[parseInt(d,10)]=g;a.e.c[b].p(q)}c=Xd(c,a.b[b].Ga,a.b[b].i,a.b[b].A,a.oa,a.S,a,q,t);a.J&&(c.e=
a.e.c[b].c[parseInt(d,10)].M);e.c[parseInt(d,10)]=c;a.c[b].p(q)}f=e.c[parseInt(f,10)];a.Ra||(f.visible=u);e=e.c[parseInt(d,10)];e.visible=q;e.wa=1;a.Ra&&(e.c[0].P=u,b!=a.Z&&(e.visible=u,e.wa=0))}w.refresh=function(){Xe(this,0,q);Xe(this,1,q);Xe(this,2,q);this.Me=q};M.prototype.__defineGetter__("dimensions",v("r"));M.prototype.__defineSetter__("dimensions",ca("r"));M.prototype.__defineGetter__("spacing",v("qb"));M.prototype.__defineSetter__("spacing",ca("qb"));M.prototype.__defineGetter__("bbox",v("oa"));
M.prototype.__defineGetter__("range",v("ud"));M.prototype.__defineGetter__("dimensionsRAS",v("fg"));M.prototype.__defineGetter__("volumeRendering",v("Ra"));M.prototype.__defineSetter__("volumeRendering",function(a){this.Ra=a;this.p(u)});M.prototype.__defineGetter__("visible",v("P"));M.prototype.__defineSetter__("visible",function(a){if(a)this.P=a,this.p(u);else{for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e].visible=a;this.P=a;this.j=q}});M.prototype.__defineGetter__("center",v("v"));
M.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center."));this.v=a});M.prototype.__defineGetter__("volumeRenderingCache",v("ee"));M.prototype.__defineSetter__("volumeRenderingCache",function(a){(a==t||!ka(a)||!(3>=a.length))&&n(Error("Invalid volumeRederingCache."));this.ee=a});M.prototype.__defineGetter__("image",v("bb"));M.prototype.__defineGetter__("labelmap",function(){this.e||(this.e=new Ze(this));return this.e});
M.prototype.__defineGetter__("indexX",v("Eb"));M.prototype.__defineSetter__("indexX",function(a){x(a)&&(0<=a&&a<this.lc.c.length)&&(this.Eb=a,this.p(u))});M.prototype.__defineGetter__("indexY",v("Fb"));M.prototype.__defineSetter__("indexY",function(a){x(a)&&(0<=a&&a<this.mc.c.length)&&(this.Fb=a,this.p(u))});M.prototype.__defineGetter__("indexZ",v("Gb"));M.prototype.__defineSetter__("indexZ",function(a){x(a)&&(0<=a&&a<this.nc.c.length)&&(this.Gb=a,this.p(u))});
M.prototype.__defineGetter__("windowLow",v("ha"));M.prototype.__defineSetter__("windowLow",ca("ha"));M.prototype.__defineGetter__("windowHigh",v("ga"));M.prototype.__defineSetter__("windowHigh",ca("ga"));M.prototype.__defineGetter__("borders",v("Db"));M.prototype.__defineSetter__("borders",ca("Db"));M.prototype.__defineGetter__("resolutionFactor",v("be"));M.prototype.__defineSetter__("resolutionFactor",ca("be"));M.prototype.__defineSetter__("xNormX",function(a){this.b[0].i[0]=a});
M.prototype.__defineGetter__("xNormX",function(){return this.b[0].i[0]});M.prototype.__defineSetter__("xNormY",function(a){this.b[0].i[1]=a});M.prototype.__defineGetter__("xNormY",function(){return this.b[0].i[1]});M.prototype.__defineSetter__("xNormZ",function(a){this.b[0].i[2]=a});M.prototype.__defineGetter__("xNormZ",function(){return this.b[0].i[2]});M.prototype.__defineSetter__("xColor",function(a){this.b[0].A=a});M.prototype.__defineGetter__("xColor",function(){return this.b[0].A});
M.prototype.__defineSetter__("yNormX",function(a){this.b[1].i[0]=a});M.prototype.__defineGetter__("yNormX",function(){return this.b[1].i[0]});M.prototype.__defineSetter__("yNormY",function(a){this.b[1].i[1]=a});M.prototype.__defineGetter__("yNormY",function(){return this.b[1].i[1]});M.prototype.__defineSetter__("yNormZ",function(a){this.b[1].i[2]=a});M.prototype.__defineGetter__("yNormZ",function(){return this.b[1].i[2]});M.prototype.__defineSetter__("yColor",function(a){this.b[1].A=a});
M.prototype.__defineGetter__("yColor",function(){return this.b[1].A});M.prototype.__defineSetter__("zNormX",function(a){this.b[2].i[0]=a});M.prototype.__defineGetter__("zNormX",function(){return this.b[2].i[0]});M.prototype.__defineSetter__("zNormY",function(a){this.b[2].i[1]=a});M.prototype.__defineGetter__("zNormY",function(){return this.b[2].i[1]});M.prototype.__defineSetter__("zNormZ",function(a){this.b[2].i[2]=a});M.prototype.__defineGetter__("zNormZ",function(){return this.b[2].i[2]});
M.prototype.__defineSetter__("zColor",function(a){this.b[2].A=a});M.prototype.__defineGetter__("zColor",function(){return this.b[2].A});w=M.prototype;
w.lk=function(a){this.c[a].visible=u;for(var b=0;b<this.c[a].c.length;b++)"undefined"!=typeof this.c[a].c[b]&&(this.J&&(this.e.c[a].c[b].remove(),this.e.c[a].c[b]=t),this.c[a].c[b].remove(),this.c[a].c[b]=t);yc(this.b[a].i,this.b[a].i);Zd(a,this.b[a].vd,this.b[a].i,this);this.c[a].c=[];this.c[a].c=Array(this.b[a].q);this.J&&(b=Xd(this.b[a].vd,this.b[a].Ga,this.b[a].i,this.b[a].A,this.oa,this.e.S,this.e,this.e.J,this.e.pa.Ka),this.e.c[a].c=[],this.e.c[a].c=Array(this.b[a].q),this.e.c[a].c[Math.floor(this.b[a].q/
2)]=b,this.e.c[a].p());b=Xd(this.b[a].vd,this.b[a].Ga,this.b[a].i,this.b[a].A,this.oa,this.S,this,q,t);window.console.log("modified!");this.J&&(b.e=b.M,b.e=this.e.c[a].c[Math.floor(this.b[a].q/2)].M);this.c[a].c[Math.floor(this.b[a].q/2)]=b;0==a?(this.Eb=Math.floor(this.b[a].q/2),this.Hc=Math.floor(this.b[a].q/2)):1==a?(this.Fb=Math.floor(this.b[a].q/2),this.Ic=Math.floor(this.b[a].q/2)):(this.Gb=Math.floor(this.b[a].q/2),this.Jc=Math.floor(this.b[a].q/2));this.c[a].p();this.c[a].c[Math.floor(this.b[a].q/
2)].P=q};
function Ye(a,b){if(!a.Sd)if(!a.Ra||!a.j&&b==a.Z)a.Z=b;else if(-1==a.ee.indexOf(b)){a.ee.push(b);a.Sd=q;var c=new Qd;c.F=a;a.dispatchEvent(c);a.onComputing(b);setTimeout(function(){var a=t;0<=this.Z&&(a=this.c[this.Z],a.visible=u);var a=this.c[b],c=a.c.length,d=Math.floor(c/4),e;for(e=0;e<1*d;e++){if(a.c[e]==t){var j=wc();j[0]=this.b[b].k[0][0][0]+this.b[b].C[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].C[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].C[2]*e;if(this.J){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,
this.oa,this.e.S,this.e,this.e.J,this.e.pa.Ka);this.e.c[b].c[e]=k;this.e.c[b].p(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,this.oa,this.S,this,q,t);j.c[0].P=u;this.J&&(j.e=j.M,j.e=this.e.c[b].c[e].M);a.c[e]=j}a.c[e].P=q}bf(this,0.25);setTimeout(function(){for(;e<2*d;e++){if(a.c[e]==t){var j=wc();j[0]=this.b[b].k[0][0][0]+this.b[b].C[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].C[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].C[2]*e;if(this.J){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,this.oa,this.e.S,
this.e,this.e.J,this.e.pa.Ka);this.e.c[b].c[e]=k;this.e.c[b].p(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,this.oa,this.S,this,q,t);j.c[0].P=u;this.J&&(j.e=j.M,j.e=this.e.c[b].c[e].M);a.c[e]=j}a.c[e].P=q}bf(this,0.5);setTimeout(function(){for(;e<3*d;e++){if(a.c[e]==t){var j=wc();j[0]=this.b[b].k[0][0][0]+this.b[b].C[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].C[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].C[2]*e;if(this.J){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,this.oa,this.e.S,this.e,this.e.J,
this.e.pa.Ka);this.e.c[b].c[e]=k;this.e.c[b].p(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,this.oa,this.S,this,q,t);j.c[0].P=u;this.J&&(j.e=j.M,j.e=this.e.c[b].c[e].M);a.c[e]=j}a.c[e].P=q}bf(this,0.75);setTimeout(function(){for(e=3*d;e<c;e++){if(a.c[e]==t){var j=wc();j[0]=this.b[b].k[0][0][0]+this.b[b].C[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].C[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].C[2]*e;if(this.J){var k=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,this.oa,this.e.S,this.e,this.e.J,this.e.pa.Ka);
this.e.c[b].c[e]=k;this.e.c[b].p(q)}j=Xd(j,this.b[b].Ga,this.b[b].i,this.b[b].A,this.oa,this.S,this,q,t);j.c[0].P=u;this.J&&(j.e=j.M,j.e=this.e.c[b].c[e].M);a.c[e]=j}a.c[e].P=q}bf(this,1);setTimeout(function(){this.Sd&&this.c[b].p(q);this.Z=b;this.j=u;if(this.Sd){var a=new Sd;a.F=this;this.dispatchEvent(a);this.onComputingEnd(b)}this.Sd=u}.bind(this),10)}.bind(this),10)}.bind(this),10)}.bind(this),10)}.bind(a),10)}else{c=a.c[a.Z];c.visible=u;var c=a.c[b],e=c.c.length,d;for(d=0;d<e;d++)c.c[d].P=q;
a.Z=b;a.j=u}}
w.qi=function(){var a=this.r[0],b=this.r[1],c=this.r[2],e=this.$h,d=new Int16Array(e.data.length);e.data=d;this.e||(this.e=new Ze(this));this.e.r=[a,b,c];this.e.V=0;this.e.W=255;this.e.qa=0;this.e.ea=255;this.e.Ab(e);this.e.pa||(this.e.pa=new nc);a=this.e.pa;a.add(0,"background",0,0,0,0);a.add(1,"tissue",0.5019607843137255,0.6823529411764706,0.5019607843137255,1);a.add(2,"bone",0.9450980392156862,0.8392156862745098,0.5686274509803921,1);a.add(3,"skin",0.6941176470588235,0.47843137254901963,0.396078431372549,
1);a.add(4,"connective_tissue",0.43529411764705883,0.7215686274509804,0.8235294117647058,1);a.add(5,"blood",0.8470588235294118,0.396078431372549,0.30980392156862746,1);a.add(6,"organ",0.8666666666666667,0.5098039215686274,0.396078431372549,1);a.add(7,"mass",0.5647058823529412,0.9333333333333333,0.5647058823529412,1);a.add(8,"muscle",0.7529411764705882,0.40784313725490196,0.34509803921568627,1);a.add(9,"foreign_object",0.8627450980392157,0.9607843137254902,0.0784313725490196,1);a.add(10,"waste",0.3058823529411765,
0.24705882352941178,0,1);a.add(11,"teeth",1,0.9803921568627451,0.8627450980392157,1);a.add(12,"fat",1,0.8,0.2,1);a.add(13,"gray_matter",0.7843137254901961,0.7843137254901961,0.9215686274509803,1);a.add(14,"white_matter",0.9803921568627451,0.9803921568627451,0.8235294117647058,1);a.add(15,"nerve",0.9568627450980393,0.8392156862745098,0.19215686274509805,1);a.add(16,"vein",0,0.592156862745098,0.807843137254902,1);a.add(17,"artery",0.8470588235294118,0.396078431372549,0.30980392156862746,1);a.add(18,
"capillary",0.7176470588235294,0.611764705882353,0.8627450980392157,1);a.add(19,"ligament",0.7176470588235294,0.8392156862745098,0.8274509803921568,1);a.add(20,"tendon",0.596078431372549,0.7411764705882353,0.8117647058823529,1);a=new Y;this.e.bb=$d(a,this.e);this.J=q;this.e.j=q;this.p()};
w.Mg=function(a,b,c){(0>a||a>=this.r[0])&&n(Error("Out of bounds for i in range 0.."+this.r[0]));(0>b||b>=this.r[1])&&n(Error("Out of bounds for j in range 0.."+this.r[1]));(0>c||c>=this.r[2])&&n(Error("Out of bounds for k in range 0.."+this.r[2]));return this.S[c][b][a]};function bf(a,b){var c=new Rd;c.Ad=b;a.dispatchEvent(c);a.onComputingProgress(100*b)}w.Gf=aa();w.If=aa();w.Hf=aa();A("X.volume",M);A("X.volume.prototype.modified",M.prototype.p);A("X.volume.prototype.destroy",M.prototype.Ta);
A("X.volume.prototype.sliceInfoChanged",M.prototype.lk);A("X.volume.prototype.createEmptyLabelMap",M.prototype.qi);A("X.volume.prototype.refresh",M.prototype.refresh);A("X.volume.prototype.getPixel",M.prototype.Mg);A("X.volume.prototype.onComputing",M.prototype.Gf);A("X.volume.prototype.onComputingProgress",M.prototype.If);A("X.volume.prototype.onComputingEnd",M.prototype.Hf);function cf(){Y.call(this);this.g="parserOFF"}C(cf,Y);
cf.prototype.parse=function(a,b,c){function e(){l===d&&n(Error("End of file reached unexpectedly."));for(var a=l;a<d;++a)if(10===f[a]){var b=Ud(f,l,a);l=a+1;return b}l=d;return Ud(f,l,d-1)}D.Ja(this.g+".parse");this.L=c;var d=c.byteLength,f=Z(this,"uchar",d);c=[];b.h=new T(d);b.o=new T(d);for(var g=b.h,h=b.o,l=0,j=e(),j=("OFF"===j?e():j).split(" "),k=j[0],j=j[1];k--;){var m=e(),m=m.split(" ");c.push([parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])])}for(;j--;){var m=e(),m=m.split(" "),r=c[parseInt(m[1],
10)],k=c[parseInt(m[2],10)],m=c[parseInt(m[3],10)];g.add(r[0],r[1],r[2]);g.add(k[0],k[1],k[2]);g.add(m[0],m[1],m[2]);r=new P(r[0],r[1],r[2]);m=new P(m[0],m[1],m[2]);k=sc((new P(k[0],k[1],k[2])).ya(r),m.ya(r));k.normalize();h.add(k.x,k.y,k.d);h.add(k.x,k.y,k.d);h.add(k.x,k.y,k.d)}D.Da(this.g+".parse");c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};A("X.parserOFF",cf);A("X.parserOFF.prototype.parse",cf.prototype.parse);function df(){Y.call(this);this.g="parserDCM"}C(df,Y);
df.prototype.parse=function(a,b,c){b.zc={};b.zc.yf=0;this.wc(c,b);if(b.s.length==t||b.ua.length==b.s.length){b.zc.yf=b.s.length;var e={};c={};for(var d=0;d<b.ua.length;d++)e.hasOwnProperty(b.ua[d].series_instance_uid)||(e[b.ua[d].series_instance_uid]=[],c[b.ua[d].series_instance_uid]={}),c[b.ua[d].series_instance_uid].hasOwnProperty(b.ua[d].sop_instance_uid)||(c[b.ua[d].series_instance_uid][b.ua[d].sop_instance_uid]=q,e[b.ua[d].series_instance_uid].push(b.ua[d]));var f=Object.keys(e)[0],d=e[f],g=
d.length;c={};var h="image_position_patient";1==g?(h="image_position_patient",e[f][0].dist=0):d[0].image_position_patient[0]!=d[1].image_position_patient[0]||d[0].image_position_patient[1]!=d[1].image_position_patient[1]||d[0].image_position_patient[2]!=d[1].image_position_patient[2]?(h="image_position_patient",e=new P(d[0].image_orientation_patient[0],d[0].image_orientation_patient[1],d[0].image_orientation_patient[2]),f=new P(d[0].image_orientation_patient[3],d[0].image_orientation_patient[4],d[0].image_orientation_patient[5]),
e=sc(e,f),d.map(function(a,b){b.dist=b.image_position_patient[0]*a.x+b.image_position_patient[1]*a.y+b.image_position_patient[2]*a.d;return b}.bind(t,e)),d.sort(function(a,b){return a.dist-b.dist})):d[0].instance_number!=d[1].instance_number?(h="instance_number",d.sort(function(a,b){return a.instance_number-b.instance_number})):window.console.log("Could not resolve the ordering mode");isNaN(d[0].pixel_spacing[0])&&(d[0].pixel_spacing[0]=1);isNaN(d[0].pixel_spacing[1])&&(d[0].pixel_spacing[1]=1);if(1<
g)switch(h){case "image_position_patient":var l=d[0].image_position_patient,e=d[1].image_position_patient,f=e[0]-l[0],j=e[1]-l[1],k=e[2]-l[2];d[0].pixel_spacing[2]=Math.sqrt(f*f+j*j+k*k);break;case "instance_number":d[0].pixel_spacing[2]=1;break;default:window.console.log("Unkown ordering mode - returning: "+h)}else d[0].pixel_spacing[2]=1;e=1;switch(h){case "image_position_patient":var l=d[0].image_position_patient,m=d[g-1].image_position_patient,f=m[0]-l[0],j=m[1]-l[1],k=m[2]-l[2],f=Math.sqrt(f*
f+j*j+k*k),e=e+Math.round(f/d[0].pixel_spacing[2]);break;case "instance_number":e+=Math.abs(d[g-1].instance_number-d[0].instance_number);break;default:window.console.log("Unkown ordering mode - returning: "+h)}l=d[0].columns*d[0].rows;f=l*e;m=t;switch(d[0].gf){case 8:m=new Uint8Array(f);break;case 16:m=new Uint16Array(f);break;case 32:m=new Uint32Array(f);default:window.console.log("Unknown number of bits allocated - using default: 32 bits")}b.qb=d[0].pixel_spacing;for(var r=0;r<g;r++){var s=d[r].data,
f=0;switch(h){case "image_position_patient":f=d[r].image_position_patient[0]-d[0].image_position_patient[0];j=d[r].image_position_patient[1]-d[0].image_position_patient[1];k=d[r].image_position_patient[2]-d[0].image_position_patient[2];f=Math.round(Math.sqrt(f*f+j*j+k*k)/d[0].pixel_spacing[2]);break;case "instance_number":f=d[r].instance_number-d[0].instance_number;break;default:window.console.log("Unkown ordering mode - returning: "+h)}m.set(s,f*l)}c.data=m;b.L=m;b.r=[d[0].columns,d[0].rows,e];c.Fl=
b.r;e=Td(m);g=e[0];e=e[1];c.min=b.qa=b.ha=g;c.max=b.ea=b.ga=e;-Infinity==b.V&&(b.V=g);Infinity==b.W&&(b.W=e);j=d[0].image_position_patient;g=Bc();if("false"==b.reslicing||b.reslicing==u)S(g,0,d[0].pixel_spacing[0],0,0,0),S(g,1,0,d[0].pixel_spacing[1],0,0),S(g,2,0,0,d[0].pixel_spacing[2],0),S(g,3,0,0,0,1);else switch(h){case "image_position_patient":e=new P(d[0].image_orientation_patient[0],d[0].image_orientation_patient[1],d[0].image_orientation_patient[2]);f=new P(d[0].image_orientation_patient[3],
d[0].image_orientation_patient[4],d[0].image_orientation_patient[5]);e=sc(e,f);S(g,0,-d[0].image_orientation_patient[0]*d[0].pixel_spacing[0],-d[0].image_orientation_patient[3]*d[0].pixel_spacing[1],-e.x*d[0].pixel_spacing[2],-j[0]);S(g,1,-d[0].image_orientation_patient[1]*d[0].pixel_spacing[0],-d[0].image_orientation_patient[4]*d[0].pixel_spacing[1],-e.y*d[0].pixel_spacing[2],-j[1]);S(g,2,d[0].image_orientation_patient[2]*d[0].pixel_spacing[0],d[0].image_orientation_patient[5]*d[0].pixel_spacing[1],
e.d*d[0].pixel_spacing[2],j[2]);S(g,3,0,0,0,1);break;case "instance_number":S(g,0,-1,0,0,-j[0]);S(g,1,-0,-1,-0,-j[1]);S(g,2,0,0,1,j[2]);S(g,3,0,0,0,1);break;default:window.console.log("Unkown ordering mode - returning: "+h)}c.gb=g;c.ib=Bc();Kc(c.gb,c.ib);h=Ac(0,0,0,1);d=zc();Mc(g,h,d);h=Ac(1,1,1,1);e=zc();Mc(g,h,e);c.Cc=[e[0]-d[0],e[1]-d[1],e[2]-d[2]];d=Vd(g,[b.r[0],b.r[1],b.r[2]]);c.Ac=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];c.Bc=[d[0],d[2],d[4]];b.Ab(c);b.bb=$d(this,b)}c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};
function ef(a,b,c,e){switch(c){case 16975:case 20819:case 20053:case 22351:c=function(a){for(var b="",c=128;1<=c;c/=2)b+=a&c?"1":"0";return b};e=a[b++];a=a[b++];e=parseInt(c((a&65280)>>8)+c(a&255)+(c((e&65280)>>8)+c(e&255)),2);4294967295==e&&(e=0);b+=e/2;break;default:b+=e/2}return b}
df.prototype.wc=function(a,b){this.L=a;if("undefined"==typeof b.ua||b.ua==t)b.ua=[];for(var c={pixel_spacing:[0.1,0.1,Infinity],image_orientation_patient:[1,0,0,0,1,0],image_position_patient:[0,0,0],transfer_syntax_uid:"no_transfer_syntax_uid"},e=Z(this,"ushort",this.L.byteLength),d=66,f=t,g=t,h=t,l=t;d<e.length;)switch(f=e[d++],g=e[d++],h=e[d++],l=e[d++],"1.2.840.10008.1.2"==c.transfer_syntax_uid&&0==l&&(l=h),f){case 2:switch(g){case 16:for(var j="",f=f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>
8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);c.transfer_syntax_uid=j.replace(/\0/g,"");break;default:d=ef(e,d,h,l)}break;case 40:switch(g){case 16:c.rows=e[d];d+=l/2;break;case 17:c.columns=e[d];d+=l/2;break;case 256:c.gf=e[d];d+=l/2;break;case 257:c.bits_stored=e[d];d+=l/2;break;case 2:c.number_of_images=e[d];d+=l/2;break;case 48:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);j=j.split("\\");c.pixel_spacing=[parseFloat(j[0]),parseFloat(j[1]),
Infinity];break;default:d=ef(e,d,h,l)}break;case 32:switch(g){case 14:c.series_instance_uid="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,c.series_instance_uid+=String.fromCharCode(g),c.series_instance_uid+=String.fromCharCode(h);break;case 19:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);c.instance_number=parseInt(j,10);break;case 50:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);
j=j.split("\\");c.image_position_patient=[parseFloat(j[0]),parseFloat(j[1]),parseFloat(j[2])];break;case 55:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);j=j.split("\\");c.image_orientation_patient=[parseFloat(j[0]),parseFloat(j[1]),parseFloat(j[2]),parseFloat(j[3]),parseFloat(j[4]),parseFloat(j[5])];break;default:d=ef(e,d,h,l)}break;case 65534:switch(g){default:l=0,d+=l/2}break;case 8:switch(g){case 24:c.sop_instance_uid="";for(f=0;f<l/
2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,c.sop_instance_uid+=String.fromCharCode(g),c.sop_instance_uid+=String.fromCharCode(h);break;default:d=ef(e,d,h,l)}break;case 16:switch(g){case 8720:for(f=0;f<l/2;f++)d++;break;default:d=ef(e,d,h,l)}break;default:d=ef(e,d,h,l)}switch(c.gf){case 8:c.data=new Uint8Array(c.columns*c.rows);break;case 16:c.data=new Uint16Array(c.columns*c.rows);break;case 32:c.data=new Uint32Array(c.columns*c.rows)}this.D=this.L.byteLength-2*c.columns*c.rows;e=t;switch(c.gf){case 8:e=
Z(this,"uchar",c.columns*c.rows);break;case 16:e=Z(this,"ushort",c.columns*c.rows);break;case 32:e=Z(this,"uint",c.columns*c.rows)}c.data=e;b.ua.push(c);return b};A("X.parserDCM",df);A("X.parserDCM.prototype.parse",df.prototype.parse);function ff(){Y.call(this);this.g="parserVTK"}C(ff,Y);
ff.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.h,d=b.o,f=new Uint8Array(c),g="";b.h=e=new T(c.byteLength);b.o=d=new T(c.byteLength);c=0;for(var h=f.length;c<h;c+=32768)g+=Ud(f,c,Math.min(c+32768,h));f=g.split("\n");g=f.length;this.yd=this.zd=t;this.ic=[];this.Pa=Sc;this.Ue=this.Tb=this.Nb=this.Ub=u;c=0;for(h=g%8;h--;)gf(this,f[c]),c++;for(h=0.125*g^0;h--;)gf(this,f[c]),c++,gf(this,f[c]),c++,gf(this,f[c]),c++,gf(this,f[c]),c++,gf(this,f[c]),c++,gf(this,f[c]),c++,gf(this,f[c]),c++,
gf(this,f[c]),c++;c=this.zd;var f=this.yd,g=f.length,l=h=this.ic.length;do{var j=this.ic[h-l],k=j.length,m;for(m=0;m<k&&!("LINES"==this.Pa&&m+1>=k);m++){var r=parseInt(j[m],10),s=c.get(r);e.add(s[0],s[1],s[2]);var y=r,z=s;"LINES"==this.Pa?(y=parseInt(j[m+1],10),z=c.get(y),e.add(z[0],z[1],z[2])):"TRIANGLE_STRIPS"==this.Pa&&(0==m||m==k-1)&&e.add(s[0],s[1],s[2]);r<g?(z=f.get(r),d.add(z[0],z[1],z[2]),"LINES"==this.Pa?(y=f.get(y),d.add(y[0],y[1],y[2])):"TRIANGLE_STRIPS"==this.Pa&&(0==m||m==k-1)&&d.add(z[0],
z[1],z[2])):(y=new P(s[0],s[1],s[2]),y.normalize(),d.add(y.x,y.y,y.d),"LINES"==this.Pa?(y=new P(z[0],z[1],z[2]),y.normalize(),d.add(y.x,y.y,y.d)):"TRIANGLE_STRIPS"==this.Pa&&(0==m||m==k-1)&&d.add(y.x,y.y,y.d))}l--}while(0<l);b.Ia=this.Pa;D.Da(this.g+".parse");e=new Wc;e.F=b;e.w=a;this.dispatchEvent(e)};
function gf(a,b){b=b.replace(/^\s+|\s+$/g,"");var c=b.split(" "),e=c.length,d=c[0];switch(d){case "POINTS":a.Ub=q;a.Nb=u;a.Tb=u;c=parseInt(c[1],10);a.zd=new T(3*c);a.yd=new T(3*c);return;case "VERTICES":a.Nb=q;a.Ub=u;a.Tb=u;c=parseInt(c[1],10);3<=c?a.Pa=Sc:1==c?a.Pa="POINTS":n(Error("This VTK file is not supported!"));a.ic=[];return;case "TRIANGLE_STRIPS":a.Nb=q;a.Ub=u;a.Tb=u;a.Pa="TRIANGLE_STRIPS";a.ic=[];return;case "LINES":a.Nb=q;a.Ub=u;a.Tb=u;a.Pa="LINES";a.ic=[];return;case "POLYGONS":a.Nb=q;
a.Ub=u;a.Tb=u;a.Pa="POLYGONS";a.ic=[];return;case "POINT_DATA":a.Tb=q;a.Ub=u;a.Nb=u;return}if(a.Ub)if(1==e||isNaN(parseFloat(d)))a.Ub=u;else{if(3<=e){var d=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);a.zd.add(d,f,g)}6<=e&&(d=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.zd.add(d,f,g));9<=e&&(e=parseFloat(c[6]),d=parseFloat(c[7]),c=parseFloat(c[8]),a.zd.add(e,d,c))}else a.Nb?1==e||isNaN(parseFloat(d))?a.Nb=u:(c=c.slice(1),a.ic.push(c)):a.Tb&&("NORMALS"==d?a.Ue=q:1==e||isNaN(parseFloat(d))?
(a.Tb=u,a.Ue=u):a.Ue&&(3<=e&&(d=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),a.yd.add(d,f,g)),6<=e&&(d=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.yd.add(d,f,g)),9<=e&&(e=parseFloat(c[6]),d=parseFloat(c[7]),c=parseFloat(c[8]),a.yd.add(e,d,c))))}A("X.parserVTK",ff);A("X.parserVTK.prototype.parse",ff.prototype.parse);function hf(){Y.call(this);this.g="parserFSM";this.Mc=u}C(hf,Y);
hf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.L=c;var e=b.h,d=b.o;b.Nc=[];var f=b.Nc;c=0;var g;do g=Z(this,"uchar"),c++;while(200>c&&10!=g);Z(this,"uchar");d=Z(this,"uint");c=Z(this,"uint");var h=Z(this,"float",3*d);g=Z(this,"uint",3*c);var l=new Uint32Array(d),j=new Float32Array(9*c);b.h=e=new T(9*c);b.o=d=new T(9*c);var k;for(k=0;k<c;k++){var m=3*k,r=g[m],s=g[m+1],y=g[m+2];f.push(r);f.push(s);f.push(y);l[r]+=1;l[s]+=1;l[y]+=1;var m=3*r,z=3*s,G=3*y,F=h[m],H=h[m+1],B=h[m+2],s=h[z],
y=h[z+1],r=h[z+2],E=h[G],J=h[G+1],N=h[G+2];e.add(F,H,B);e.add(s,y,r);e.add(E,J,N);F=new P(F,H,B);E=new P(E,J,N);s=(new P(s,y,r)).l().ya(F);y=E.l().ya(F);s=sc(s,y).normalize();j[m]+=s.x;j[m+1]+=s.y;j[m+2]+=s.d;j[z]+=s.x;j[z+1]+=s.y;j[z+2]+=s.d;j[G]+=s.x;j[G+1]+=s.y;j[G+2]+=s.d}for(k=0;k<c;k++)m=3*k,r=g[m],s=g[m+1],y=g[m+2],m=3*r,z=3*s,G=3*y,f=new P(j[z],j[z+1],j[z+2]),h=new P(j[G],j[G+1],j[G+2]),m=(new P(j[m],j[m+1],j[m+2])).scale(1/l[r]).normalize(),f=f.scale(1/l[s]).normalize(),h=h.scale(1/l[y]).normalize(),
d.add(m.x,m.y,m.d),d.add(f.x,f.y,f.d),d.add(h.x,h.y,h.d);c=Z(this,"uchar",this.L.byteLength-this.D);g=t;for(m=0;m<c.length;m++)if(99==c[m]&&114==c[m+1]&&97==c[m+2]&&115==c[m+3]){for(d=g=m+9;10!=c[m]&&m<c.length;)d++,m++;g=Ud(c.subarray(g,d)).split(" ");break}g&&(b.la.Eh(parseFloat(g[0])),b.la.Fh(parseFloat(g[1])),b.la.Gh(parseFloat(g[2])));b.Ia=Sc;D.Da(this.g+".parse");c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};A("X.parserFSM",hf);A("X.parserFSM.prototype.parse",hf.prototype.parse);var jf={lf:function(a,b,c){return jf.update(a,0,b,c)},update:function(a,b,c,e){var d=jf.Nh,f="number"===typeof c?c:c=0;e="number"===typeof e?e:a.length;b^=4294967295;for(f=e&7;f--;++c)b=b>>>8^d[(b^a[c])&255];for(f=e>>3;f--;c+=8)b=b>>>8^d[(b^a[c])&255],b=b>>>8^d[(b^a[c+1])&255],b=b>>>8^d[(b^a[c+2])&255],b=b>>>8^d[(b^a[c+3])&255],b=b>>>8^d[(b^a[c+4])&255],b=b>>>8^d[(b^a[c+5])&255],b=b>>>8^d[(b^a[c+6])&255],b=b>>>8^d[(b^a[c+7])&255];return(b^4294967295)>>>0}};
jf.Nh=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 kf(a){var b=a.length,c=0,e=Number.POSITIVE_INFINITY,d,f,g,h,l,j,k,m,r;for(m=0;m<b;++m)a[m]>c&&(c=a[m]),a[m]<e&&(e=a[m]);d=1<<c;f=new Uint32Array(d);g=1;h=0;for(l=2;g<=c;){for(m=0;m<b;++m)if(a[m]===g){j=0;k=h;for(r=0;r<g;++r)j=j<<1|k&1,k>>=1;for(r=j;r<d;r+=l)f[r]=g<<16|m;++h}++g;h<<=1;l<<=1}return[f,c,e]};function lf(a,b){this.hf=[];this.jf=32768;this.rb=this.Bd=this.O=this.Xf=0;this.input=new Uint8Array(a);this.Bg=u;this.kf=mf;this.Xa=u;if(b||!(b={}))b.index&&(this.O=b.index),b.bufferSize&&(this.jf=b.bufferSize),b.bufferType&&(this.kf=b.bufferType),b.resize&&(this.Xa=b.resize);switch(this.kf){case nf:this.na=32768;this.Ua=new Uint8Array(32768+this.jf+258);break;case mf:this.na=0;this.Ua=new Uint8Array(this.jf);this.uc=this.Ai;this.Eg=this.oi;this.rf=this.ui;break;default:n(Error("invalid inflate mode"))}}
var nf=0,mf=1;
lf.prototype.Yb=function(){for(;!this.Bg;){var a=of(this,3);a&1&&(this.Bg=q);a>>>=1;switch(a){case 0:var a=this.input,b=this.O,c=this.Ua,e=this.na,d=p,f=p,g=p,h=c.length,d=p;this.rb=this.Bd=0;d=a[b++];d===p&&n(Error("invalid uncompressed block header: LEN (first byte)"));f=d;d=a[b++];d===p&&n(Error("invalid uncompressed block header: LEN (second byte)"));f|=d<<8;d=a[b++];d===p&&n(Error("invalid uncompressed block header: NLEN (first byte)"));g=d;d=a[b++];d===p&&n(Error("invalid uncompressed block header: NLEN (second byte)"));g|=
d<<8;f===~g&&n(Error("invalid uncompressed block header: length verify"));b+f>a.length&&n(Error("input buffer is broken"));switch(this.kf){case nf:for(;e+f>c.length;)d=h-e,f-=d,c.set(a.subarray(b,b+d),e),e+=d,b+=d,this.na=e,c=this.uc(),e=this.na;break;case mf:for(;e+f>c.length;)c=this.uc({Kg:2});break;default:n(Error("invalid inflate mode"))}c.set(a.subarray(b,b+f),e);e+=f;this.O=b+=f;this.na=e;this.Ua=c;break;case 1:this.rf(pf,qf);break;case 2:rf(this);break;default:n(Error("unknown BTYPE: "+a))}}return this.Eg()};
var sf=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tf=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]),uf=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]),vf=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]),wf=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]),xf=new Uint8Array(288),
yf,zf;yf=0;for(zf=xf.length;yf<zf;++yf)xf[yf]=143>=yf?8:255>=yf?9:279>=yf?7:8;var pf=kf(xf),Af=new Uint8Array(30),Bf,Cf;Bf=0;for(Cf=Af.length;Bf<Cf;++Bf)Af[Bf]=5;var qf=kf(Af);function of(a,b){for(var c=a.Bd,e=a.rb,d=a.input,f=a.O,g;e<b;)g=d[f++],g===p&&n(Error("input buffer is broken")),c|=g<<e,e+=8;g=c&(1<<b)-1;a.Bd=c>>>b;a.rb=e-b;a.O=f;return g}
function Df(a,b){for(var c=a.Bd,e=a.rb,d=a.input,f=a.O,g=b[0],h=b[1],l;e<h;)l=d[f++],l===p&&n(Error("input buffer is broken")),c|=l<<e,e+=8;d=g[c&(1<<h)-1];g=d>>>16;a.Bd=c>>g;a.rb=e-g;a.O=f;return d&65535}
function rf(a){function b(a,b,c){var d,e,f;for(f=0;f<a;)switch(d=Df(this,b),d){case 16:for(d=3+of(this,2);d--;)c[f++]=e;break;case 17:for(d=3+of(this,3);d--;)c[f++]=0;e=0;break;case 18:for(d=11+of(this,7);d--;)c[f++]=0;e=0;break;default:e=c[f++]=d}return c}var c=of(a,5)+257,e=of(a,5)+1,d=of(a,4)+4,f=new Uint8Array(sf.length),g;for(g=0;g<d;++g)f[sf[g]]=of(a,3);d=kf(f);f=new Uint8Array(c);g=new Uint8Array(e);a.rf(kf(b.call(a,c,d,f)),kf(b.call(a,e,d,g)))}w=lf.prototype;
w.rf=function(a,b){var c=this.Ua,e=this.na;this.Hg=a;for(var d=c.length-258,f,g,h;256!==(f=Df(this,a));)if(256>f)e>=d&&(this.na=e,c=this.uc(),e=this.na),c[e++]=f;else{f-=257;h=tf[f];0<uf[f]&&(h+=of(this,uf[f]));f=Df(this,b);g=vf[f];0<wf[f]&&(g+=of(this,wf[f]));e>=d&&(this.na=e,c=this.uc(),e=this.na);for(;h--;)c[e]=c[e++-g]}for(;8<=this.rb;)this.rb-=8,this.O--;this.na=e};
w.ui=function(a,b){var c=this.Ua,e=this.na;this.Hg=a;for(var d=c.length,f,g,h;256!==(f=Df(this,a));)if(256>f)e>=d&&(c=this.uc(),d=c.length),c[e++]=f;else{f-=257;h=tf[f];0<uf[f]&&(h+=of(this,uf[f]));f=Df(this,b);g=vf[f];0<wf[f]&&(g+=of(this,wf[f]));e+h>d&&(c=this.uc(),d=c.length);for(;h--;)c[e]=c[e++-g]}for(;8<=this.rb;)this.rb-=8,this.O--;this.na=e};
w.uc=function(){var a=new Uint8Array(this.na-32768),b=this.na-32768,c=this.Ua;a.set(c.subarray(32768,a.length));this.hf.push(a);this.Xf+=a.length;c.set(c.subarray(b,b+32768));this.na=32768;return c};w.Ai=function(a){var b=this.input.length/this.O+1|0,c=this.input,e=this.Ua;a&&("number"===typeof a.Kg&&(b=a.Kg),"number"===typeof a.hi&&(b+=a.hi));2>b?(a=(c.length-this.O)/this.Hg[2],a=258*(a/2)|0,a=a<e.length?e.length+a:e.length<<1):a=e.length*b;a=new Uint8Array(a);a.set(e);return this.Ua=a};
w.Eg=function(){var a=0,b=this.Ua,c=this.hf,e,d=new Uint8Array(this.Xf+(this.na-32768)),f,g,h,l;if(0===c.length)return this.Ua.subarray(32768,this.na);f=0;for(g=c.length;f<g;++f){e=c[f];h=0;for(l=e.length;h<l;++h)d[a++]=e[h]}f=32768;for(g=this.na;f<g;++f)d[a++]=b[f];this.hf=[];return this.buffer=d};w.oi=function(){var a,b=this.na;this.Xa?(a=new Uint8Array(b),a.set(this.Ua.subarray(0,b))):a=this.Ua.subarray(0,b);return this.buffer=a};new Uint8Array(256);var Ef;for(Ef=0;256>Ef;++Ef)for(var Ff=Ef,Gf=7,Ff=Ff>>>1;Ff;Ff>>>=1)--Gf;var Hf=[],If;for(If=0;288>If;If++)switch(q){case 143>=If:Hf.push([If+48,8]);break;case 255>=If:Hf.push([If-144+400,9]);break;case 279>=If:Hf.push([If-256+0,7]);break;case 287>=If:Hf.push([If-280+192,8]);break;default:n("invalid literal: "+If)}
function Jf(){var a=Kf;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:n("invalid length: "+a)}}var Lf=[],Kf,Mf;
for(Kf=3;258>=Kf;Kf++)Mf=Jf(),Lf[Kf]=Mf[2]<<24|Mf[1]<<16|Mf[0];new Uint32Array(Lf);function Nf(){};function Of(a){this.input=a;this.O=0;this.member=[]}
Of.prototype.Yb=function(){for(var a=this.input.length;this.O<a;){var b=new Nf,c=p,e=p,d=p,f=c=d=p,g=p,c=c=p,h=this.input,e=this.O;b.Rg=h[e++];b.Sg=h[e++];(31!==b.Rg||139!==b.Sg)&&n(Error("invalid file signature:",b.Rg,b.Sg));b.Dg=h[e++];switch(b.Dg){case 8:break;default:n(Error("unknown compression method: "+b.Dg))}b.ne=h[e++];c=h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24;b.Sl=new Date(1E3*c);b.cm=h[e++];b.Xl=h[e++];0<(b.ne&4)&&(b.He=h[e++]|h[e++]<<8,e+=b.He);if(0<(b.ne&8)){g=[];for(f=0;0<(c=h[e++]);)g[f++]=
String.fromCharCode(c);b.name=g.join("")}if(0<(b.ne&16)){g=[];for(f=0;0<(c=h[e++]);)g[f++]=String.fromCharCode(c);b.comment=g.join("")}0<(b.ne&2)&&(b.pi=jf.lf(h,0,e)&65535,b.pi!==(h[e++]|h[e++]<<8)&&n(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-e-4-4<512*c&&(d=c);e=new lf(h,{index:e,bufferSize:d});b.data=d=e.Yb();e=e.O;b.Cl=c=(h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24)>>>0;jf.lf(d)!==c&&n(Error("invalid CRC-32 checksum: 0x"+jf.lf(d).toString(16)+
" / 0x"+c.toString(16)));b.Ll=c=(h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24)>>>0;(d.length&4294967295)!==c&&n(Error("invalid input size: "+(d.length&4294967295)+" / "+c));this.member.push(b);this.O=e}a=this.member;b=d=e=0;for(h=a.length;b<h;++b)d+=a[b].data.length;d=new Uint8Array(d);for(b=0;b<h;++b)d.set(a[b].data,e),e+=a[b].data.length;return d};function Pf(){Y.call(this);this.g="parserMGZ";this.Mc=u}C(Pf,Y);
Pf.prototype.parse=function(a,b,c,e){D.Ja(this.g+".parse");window.console.log(b);e&&(c=(new Of(new Uint8Array(c))).Yb(),c=c.buffer);e=this.wc(c);var d=[e.Cf,e.Df,e.Ef];b.r=d;var f=e.Hh;b.qb=f;c=e.min;var g=e.max;b.qa=b.ha=c;b.ea=b.ga=g;-Infinity==b.V&&(b.V=c);Infinity==b.W&&(b.W=g);c=Bc();if("false"==b.reslicing||b.reslicing==u)S(c,0,b.qb[0],0,0,0),S(c,1,0,b.qb[1],0,0),S(c,2,0,0,b.qb[2],0),S(c,3,0,0,0,1),Ec(c,0,0,0,1);else{S(c,0,e.hb[0][0],e.hb[1][0],e.hb[2][0],0);S(c,1,e.hb[0][1],e.hb[1][1],e.hb[2][1],
0);S(c,2,e.hb[0][2],e.hb[1][2],e.hb[2][2],0);S(c,3,0,0,0,1);for(var g=d[0]/2,h=d[1]/2,d=d[2]/2,l=[0,0,0],j=0;3>j;++j)l[j]=e.hb[3][j]-(c[j+0]*f[0]*g+c[j+4]*f[1]*h+c[j+8]*f[2]*d);Ec(c,l[0],l[1],l[2],1)}e.gb=c;e.ib=Bc();Kc(e.gb,e.ib);g=Ac(0,0,0,1);f=zc();Mc(c,g,f);h=Ac(1,1,1,1);g=zc();Mc(c,h,g);c=Vd(c,b.r);e.Cc=[g[0]-f[0],g[1]-f[1],g[2]-f[2]];e.Ac=[c[1]-c[0]+1,c[3]-c[2]+1,c[5]-c[4]+1];e.Bc=[c[0],c[2],c[4]];b.Ab(e);D.Da(this.g+".parse");b.bb=$d(this,b);e=new Wc;e.F=b;e.w=a;this.dispatchEvent(e)};
Pf.prototype.wc=function(a){this.L=a;a={version:0,Qh:0,Oh:0,Hi:0,Ph:0,Cf:0,Df:0,Ef:0,qj:0,type:0,yi:0,wh:0,Hk:t,hb:t,Hh:t,data:t,min:Infinity,max:-Infinity};a.version=Z(this,"uint");a.Cf=Z(this,"uint");a.Df=Z(this,"uint");a.Ef=Z(this,"uint");a.qj=Z(this,"uint");a.type=Z(this,"uint");a.yi=Z(this,"uint");a.wh=Z(this,"ushort");if(0<a.wh){a.Hh=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.hb=b}this.D=284;b=a.Cf*a.Df*
a.Ef;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:n(Error("Unsupported MGH/MGZ data type: "+a.type))}b=Td(a.data);a.min=b[0];a.max=b[1];this.D+16<this.L.byteLength&&(a.Qh=Z(this,"float"),a.Hi=Z(this,"float"),a.Oh=Z(this,"float"),a.Ph=Z(this,"float"));return a};A("X.parserMGZ",Pf);A("X.parserMGZ.prototype.parse",Pf.prototype.parse);function Qf(){Y.call(this);this.g="parserCRV";this.Mc=u}C(Qf,Y);
Qf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.Nc;0==e.length&&n(Error("No _pointIndices defined on the X.object."));this.L=c;this.D=3;var d=Z(this,"uint");Z(this,"uint");Z(this,"uint");var f=0,g=0,h=0,l=0,j=0,k=0,m=0,r=0,s=0,y=0,z=0;c=Array(2);var G=Array(2),F=Z(this,"float",d),H;for(H=0;H<d;H++){var B=F[H];0==H&&(c[0]=G[0]=B);0<=B?(f++,l+=B):(g++,h+=B);s+=B;z++;G[0]=Math.max(B,G[0]);c[0]=Math.min(B,c[0]);F[H]=B}0!=f&&(j=l/f);0!=g&&(k=h/g);0!=z&&(y=s/z);for(z=s=h=l=0;z<d;z++)B=
F[z],H=0,0<=B?(H=Math.pow(B-j,2),l+=H):(H=Math.pow(B-k,2),h+=H),H=Math.pow(B-y,2),s+=H;1<f&&(m=Math.sqrt(l/(f-1)));1<g&&(r=Math.sqrt(h/(g-1)));c[1]=k-2.5*r;G[1]=j+2.5*m;d=e.length;f=new Float32Array(3*d);for(z=0;z<d;z++)g=F[e[z]],h=3*z,f[h]=g,f[h+1]=g,f[h+2]=g;b.H.qa=c[1];b.H.ea=G[1];-Infinity==b.H.V&&(b.H.V=c[1]);Infinity==b.H.W&&(b.H.W=G[1]);b.H.G=F;b.H.dd=f;b.H.j=q;D.Da(this.g+".parse");e=new Wc;e.F=b;e.w=a;this.dispatchEvent(e)};A("X.parserCRV",Qf);A("X.parserCRV.prototype.parse",Qf.prototype.parse);function Rf(a,b){var c,e;this.input=a;this.O=0;if(b||!(b={}))b.index&&(this.O=b.index),b.verify&&(this.yk=b.verify);c=a[this.O++];e=a[this.O++];switch(c&15){case 8:this.method=8;break;default:n(Error("unsupported compression method"))}0!==((c<<8)+e)%31&&n(Error("invalid fcheck flag:"+((c<<8)+e)%31));e&32&&n(Error("fdict flag is not supported"));this.xh=new lf(a,{index:this.O,bufferSize:b.bufferSize,bufferType:b.bufferType,resize:b.resize})}
Rf.prototype.Yb=function(){var a=this.input,b;b=this.xh.Yb();this.O=this.xh.O;if(this.yk){var a=(a[this.O++]<<24|a[this.O++]<<16|a[this.O++]<<8|a[this.O++])>>>0,c=b;if("string"===typeof c){var c=c.split(""),e,d;e=0;for(d=c.length;e<d;e++)c[e]=(c[e].charCodeAt(0)&255)>>>0}e=1;d=0;for(var f=c.length,g,h=0;0<f;){g=1024<f?1024:f;f-=g;do e+=c[h++],d+=e;while(--g);e%=65521;d%=65521}a!==(d<<16|e)>>>0&&n(Error("invalid adler-32 checksum"))}return b};function Sf(){Y.call(this);this.g="parserRAW"}C(Sf,Y);
Sf.prototype.parse=function(a,b,c,e){D.Ja(this.g+".parse");e&&(c=(new Rf(new Uint8Array(c))).Yb(),c=c.buffer);e={};e.data=new Uint8Array(c);var d=Td(e.data);c=d[0];d=d[1];e.min=b.qa=b.ha=c;e.max=b.ea=b.ga=d;-Infinity==b.V&&(b.V=c);Infinity==b.W&&(b.W=d);d=Cc();e.gb=d;e.ib=Cc();var f=Ac(0,0,0,1);c=zc();Mc(d,f,c);var g=Ac(1,1,1,1),f=zc();Mc(d,g,f);d=Vd(d,b.r);e.Cc=[f[0]-c[0],f[1]-c[1],f[2]-c[2]];e.Ac=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];e.Bc=[d[0],d[2],d[4]];b.Ab(e);D.Da(this.g+".parse");b.bb=$d(this,
b);e=new Wc;e.F=b;e.w=a;this.dispatchEvent(e)};A("X.parserRAW",Sf);A("X.parserRAW.prototype.parse",Sf.prototype.parse);function Tf(){Y.call(this);this.g="parserIMAGE"}C(Tf,Y);Tf.prototype.parse=function(a,b,c,e){c instanceof ArrayBuffer||n(Error());for(var d=new Uint8Array(c),f=d.length,g=Array(f);f--;)g[f]=String.fromCharCode(d[f]);d=window.btoa(g.join(""));f=new Image;Vb(f,"load",this.Xj.bind(this,f,a,b,c,e));f.src="data:image/"+e+";base64,"+d};Tf.prototype.Xj=function(a,b,c){b.bb=a;b.Wb=t;a=new Wc;a.F=c;a.w=b;this.dispatchEvent(a)};A("X.parserIMAGE",Tf);A("X.parserIMAGE.prototype.parse",Tf.prototype.parse);function Uf(){Y.call(this);this.g="parserLUT"}C(Uf,Y);
Uf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.L=c;c=Z(this,"uchar",c.byteLength);var e=c.length,d=0,f;for(f=0;f<e;f++)if(10==c[f]){var g=Ud(c,d,f),d=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)))}D.Da(this.g+".parse");c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};
A("X.parserLUT",Uf);A("X.parserLUT.prototype.parse",Uf.prototype.parse);function Vf(){Y.call(this);this.g="parserMRC"}C(Vf,Y);
Vf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");c=this.wc(c);var e=c.min,d=c.max;b.r=[c.Hd,c.Id,c.Jd];b.qb=[c.He/c.dh,c.Kh/c.eh,c.Lh/c.fh];b.qa=b.ha=e;b.ea=b.ga=d;-Infinity==b.V&&(b.V=e);Infinity==b.W&&(b.W=d);d=Bc();S(d,3,0,0,0,1);S(d,0,-1,0,0,c.Hd);S(d,1,0,0,-1,c.Id);S(d,2,0,-1,0,c.Jd);c.gb=d;c.ib=Bc();Kc(c.gb,c.ib);var f=Ac(0,0,0,1),e=zc();Mc(d,f,e);var g=Ac(1,1,1,1),f=zc();Mc(d,g,f);g=[c.Hd,c.Id,c.Jd];d=Vd(d,g);c.Cc=[f[0]-e[0],f[1]-e[1],f[2]-e[2]];c.Ac=[d[1]+d[0]+1,d[3]-d[2]+1,d[5]-d[4]+
1];c.Bc=[d[0],d[2],d[4]];b.r=g;b.Ab(c);b.bb=$d(this,b);D.Da(this.g+".parse");c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};
Vf.prototype.wc=function(a){this.L=a;a={Hd:0,Id:0,Jd:0,mode:0,Ul:0,Vl:0,Wl:0,dh:0,eh:0,fh:0,He:0,Kh:0,Lh:0,alpha:0,ki:0,Ii:0,ij:0,jj:0,kj:0,ff:0,ie:0,rc:0,Nl:0,next:0,ri:0,Ci:t,rj:0,tj:0,Ci:t,Wi:0,Kl:0,Ui:0,ej:0,nj:0,oj:0,wk:0,xk:0,tk:t,zk:0,Bk:0,Ck:0,Bl:0,bm:0,dk:0,sj:0,data:t,min:Infinity,max:-Infinity,Rl:0,Ah:t,am:t,Zl:t,orientation:t,Tl:t};this.D=0;a.Hd=Z(this,"sint");a.Id=Z(this,"sint");a.Jd=Z(this,"sint");a.mode=Z(this,"sint");var b=a.Hd*a.Id*a.Jd;this.D=1024;switch(a.mode){case 0:a.data=Z(this,
"schar",b);break;case 1:a.data=Z(this,"sshort",b);break;case 2:a.data=Z(this,"float",b);break;case 3:a.data=Z(this,"uint",b);break;case 4:a.data=Z(this,"double",b);break;case 6:a.data=Z(this,"ushort",b);break;case 16:a.data=Z(this,"uchar",b);break;default:n(Error("Unsupported MRC data type: "+a.mode))}this.D=28;a.dh=Z(this,"sint");a.eh=Z(this,"sint");a.fh=Z(this,"sint");a.He=Z(this,"float");a.Kh=Z(this,"float");a.Lh=Z(this,"float");a.alpha=Z(this,"float");a.ki=Z(this,"float");a.Ii=Z(this,"float");
a.ij=Z(this,"sint");a.jj=Z(this,"sint");a.kj=Z(this,"sint");a.ff=Z(this,"float");a.ie=Z(this,"float");a.rc=Z(this,"float");a.Ml=Z(this,"sint");a.next=Z(this,"sint");a.ri=Z(this,"short");a.rj=Z(this,"short");a.tj=Z(this,"short");a.Wi=Z(this,"sint");a.Jl=Z(this,"sint");a.Ui=Z(this,"short");a.ej=Z(this,"short");a.nj=Z(this,"short");a.oj=Z(this,"short");a.wk=Z(this,"short");a.xk=Z(this,"short");a.tk=Z(this,"float",6);this.D=196;a.zk=Z(this,"float");a.Bk=Z(this,"float");a.Ck=Z(this,"float");this.D=216;
a.dk=Z(this,"float");a.sj=Z(this,"sint");a.Ol=Z(this,"schar",10);if(0!=a.next)switch(this.D=parseInt(a.next+1024,10),a.mode){case 0:a.data=Z(this,"schar",b);break;case 1:a.data=Z(this,"sshort",b);break;case 2:a.data=Z(this,"float",b);break;case 3:a.data=Z(this,"uint",b);break;case 4:a.data=Z(this,"double",b);break;case 6:a.data=Z(this,"ushort",b);break;case 16:a.data=Z(this,"uchar",b);break;default:n(Error("Unsupported MRC data type: "+a.mode))}0>a.rc-(a.ie-a.rc)?(a.min=a.ff,a.max=a.rc+(a.rc-a.ff)):
(a.min=a.rc-(a.ie-a.rc),a.max=a.ie);return a};A("X.parserMRC",Vf);A("X.parserMRC.prototype.parse",Vf.prototype.parse);function Wf(){Y.call(this);this.g="parserNRRD"}C(Wf,Y);
Wf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.L=c;c=Z(this,"uchar",c.byteLength);var e=c.length,d=t,f=0,g;for(g=1;g<e;g++)if(10==c[g-1]&&10==c[g]){d=Ud(c,0,g-2);f=g+1;break}var h,l,j,k,e=d.split(/\r?\n/),d=0;for(g=e.length;d<g;d++)if(h=e[d],h.match(/NRRD\d+/))this.cj=q;else if(!h.match(/^#/)&&(k=h.match(/(.*):(.*)/)))l=k[1].trim(),h=k[2].trim(),(j=this.Di[l])?j.call(this,h):this[l]=h;this.cj||n(Error("Not an NRRD file"));"raw"!==this.encoding&&("gzip"!==this.encoding&&"gz"!==this.encoding)&&
n(Error("Only raw or gz/gzip encoding is allowed"));if(!this.ja&&(this.ja=[new P(1,0,0),new P(0,1,0),new P(0,0,1)],this.Vf)){e=[];for(k=0;2>=k;k++)e.push(!isNaN(this.Vf[k])?this.ja[k].scale(this.Vf[k]):p)}f=c.subarray(f);if("gzip"==this.encoding||"gz"==this.encoding)f=(new Of(new Uint8Array(f))).Yb();f=f.buffer;c={data:t,min:Infinity,max:-Infinity};c.data=new this.Mb(f);k=Td(c.data);f=c.min=k[0];k=c.max=k[1];b.qa=b.ha=f;b.ea=b.ga=k;b.r=[this.Tf[0],this.Tf[1],this.Tf[2]];e=(new P(this.ja[0][0],this.ja[0][1],
this.ja[0][2])).Jb();d=(new P(this.ja[1][0],this.ja[1][1],this.ja[1][2])).Jb();g=(new P(this.ja[2][0],this.ja[2][1],this.ja[2][2])).Jb();b.qb=[e,d,g];-Infinity==b.V&&(b.V=f);Infinity==b.W&&(b.W=k);e=k=1;"left-posterior-superior"==this.Ah&&(e=k=-1);f=Cc();"false"==b.reslicing||b.reslicing==u?(S(f,0,k,0,0,0),S(f,1,0,e,0,0),S(f,2,0,0,1,0)):(S(f,0,k*this.ja[0][0],k*this.ja[1][0],k*this.ja[2][0],k*this.Uf[0]),S(f,1,e*this.ja[0][1],e*this.ja[1][1],e*this.ja[2][1],e*this.Uf[1]),S(f,2,1*this.ja[0][2],1*this.ja[1][2],
1*this.ja[2][2],1*this.Uf[2]));S(f,3,0,0,0,1);c.gb=f;c.ib=Bc();Kc(c.gb,c.ib);e=Ac(0,0,0,1);k=zc();Mc(f,e,k);d=Ac(1,1,1,1);e=zc();Mc(f,d,e);f=Vd(f,b.r);c.Cc=[e[0]-k[0],e[1]-k[1],e[2]-k[2]];c.Ac=[f[1]-f[0]+1,f[3]-f[2]+1,f[5]-f[4]+1];c.Bc=[f[0],f[2],f[4]];b.Ab(c);D.Da(this.g+".parse");b.bb=$d(this,b);c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};
Wf.prototype.Di={type:function(a){switch(a){case "uchar":case "unsigned char":case "uint8":case "uint8_t":this.Mb=Uint8Array;break;case "signed char":case "int8":case "int8_t":this.Mb=Int8Array;break;case "short":case "short int":case "signed short":case "signed short int":case "int16":case "int16_t":this.Mb=Int16Array;break;case "ushort":case "unsigned short":case "unsigned short int":case "uint16":case "uint16_t":this.Mb=Uint16Array;break;case "int":case "signed int":case "int32":case "int32_t":this.Mb=
Int32Array;break;case "uint":case "unsigned int":case "uint32":case "uint32_t":this.Mb=Uint32Array;break;case "float":this.Mb=Float32Array;break;case "double":this.Mb=Float64Array;break;default:n(Error("Unsupported NRRD data type: "+a))}return this.type=a},endian:function(a){return this.Gl=a},encoding:function(a){return this.encoding=a},dimension:function(a){return this.Zb=parseInt(a,10)},sizes:function(a){var b,c,e,d;e=a.split(/\s+/);d=[];b=0;for(c=e.length;b<c;b++)a=e[b],d.push(parseInt(a,10));
return this.Tf=d},space:function(a){return this.Ah=a},"space origin":function(a){return this.Uf=a.split("(")[1].split(")")[0].split(",")},"space directions":function(a){var b,c;a=a.match(/\(.*?\)/g);var e,d,f;f=[];e=0;for(d=a.length;e<d;e++)c=a[e],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.ja=f},spacings:function(a){var b;b=a.split(/\s+/);var c,e,d;d=[];c=0;for(e=b.length;c<e;c++)a=b[c],d.push(parseFloat(a));
return this.Vf=d}};A("X.parserNRRD",Wf);A("X.parserNRRD.prototype.parse",Wf.prototype.parse);function Xf(){Y.call(this);this.g="parserSTL"}C(Xf,Y);
Xf.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.L=c;var e=b.h,d=b.o;if("solid"==Ud(Z(this,"uchar",5))){b.h=e=new T(c.byteLength);b.o=d=new T(c.byteLength);var f=e,e=d,d=Z(this,"uchar",c.byteLength-5);c=d.length;var g=u,h=u,l=0,j;for(j=0;j<c;j++)if(10==d[j]){if(g||h){var k=Ud(d,l,j).split(" "),h=parseFloat(k[0]),m=parseFloat(k[1]),k=parseFloat(k[2]);g?(e.add(h,m,k),e.add(h,m,k),e.add(h,m,k)):f.add(h,m,k);h=g=u}}else 32==d[j-1]&&(102==d[j]?(l=j+=13,g=q):118==d[j]&&(l=j+=7,h=q))}else{this.D=
80;f=Z(this,"uint");b.h=e=new T(9*f);b.o=d=new T(9*f);for(c=c=0;c<f;c++)g=Z(this,"float",12),l=g[0],j=g[1],h=g[2],d.add(l,j,h),d.add(l,j,h),d.add(l,j,h),e.add(g[3],g[4],g[5]),e.add(g[6],g[7],g[8]),e.add(g[9],g[10],g[11]),this.D+=2}D.Da(this.g+".parse");f=new Wc;f.F=b;f.w=a;this.dispatchEvent(f)};A("X.parserSTL",Xf);A("X.parserSTL.prototype.parse",Xf.prototype.parse);function Yf(){Y.call(this);this.g="parserNII"}C(Yf,Y);
Yf.prototype.parse=function(a,b,c){if(!Zf(c))try{c=(new Of(new Uint8Array(c))).Yb().buffer,Zf(c)||(this.Mc=u)}catch(e){this.Mc=u}c=this.wc(c);var d=c.min,f=c.max;b.qa=b.ha=d;b.ea=b.ga=f;-Infinity==b.V&&(b.V=d);Infinity==b.W&&(b.W=f);d=Bc();S(d,3,0,0,0,1);if("false"==b.reslicing||b.reslicing==u){var g=f=1,h=1;0<c.ta[1]&&(f=c.ta[1]);0<c.ta[2]&&(g=c.ta[2]);0<c.ta[2]&&(h=c.ta[3]);0>c.ta[0]&&(h=-h);S(d,0,f,0,0,0);S(d,1,0,g,0,0);S(d,2,0,0,h,0)}else if(0<c.Pf){var l=0,j=c.th,k=c.uh,m=c.vh,h=g=f=1,r=c.qh,
s=c.rh,y=c.sh,l=1-(j*j+k*k+m*m);1E-7>l?(l=1/Math.sqrt(j*j+k*k+m*m),j*=l,k*=l,m*=l,l=0):l=Math.sqrt(l);0<c.ta[1]&&(f=c.ta[1]);0<c.ta[2]&&(g=c.ta[2]);0<c.ta[2]&&(h=c.ta[3]);0>c.ta[0]&&(h=-h);S(d,0,(l*l+j*j-k*k-m*m)*f,2*(j*k-l*m)*g,2*(j*m+l*k)*h,r);S(d,1,2*(j*k+l*m)*f,(l*l+k*k-j*j-m*m)*g,2*(k*m-l*j)*h,s);S(d,2,2*(j*m-l*k)*f,2*(k*m+l*j)*g,(l*l+m*m-k*k-j*j)*h,y)}else 0<c.yh?(f=c.Bh,g=c.Ch,h=c.Dh,S(d,0,f[0],f[1],f[2],f[3]),S(d,1,g[0],g[1],g[2],g[3]),S(d,2,h[0],h[1],h[2],h[3])):0==c.Pf?(S(d,0,c.ta[1],0,
0,0),S(d,1,0,c.ta[2],0,0),S(d,2,0,0,c.ta[3],0)):window.console.log("UNKNOWN METHOD IN PARSER NII");c.gb=d;c.ib=Bc();Kc(c.gb,c.ib);g=Ac(0,0,0,1);f=zc();Mc(d,g,f);h=Ac(1,1,1,1);g=zc();Mc(d,h,g);h=[c.Zb[1],c.Zb[2],c.Zb[3]];d=Vd(d,h);c.Cc=[g[0]-f[0],g[1]-f[1],g[2]-f[2]];c.Ac=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];c.Bc=[d[0],d[2],d[4]];b.r=h;b.Ab(c);b.bb=$d(this,b);c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};
Yf.prototype.wc=function(a){this.L=a;a={kk:0,si:t,ti:t,Bi:0,gk:0,ak:0,xi:t,Zb:t,Zi:0,$i:0,aj:0,Xi:0,qf:0,li:0,pk:0,ta:t,Ih:0,fk:0,ek:0,ok:0,mk:t,Ak:t,mi:0,ni:0,nk:0,uk:0,Ki:0,Li:0,vi:t,ji:t,Pf:0,yh:0,th:0,uh:0,vh:0,qh:0,rh:0,sh:0,Bh:t,Ch:t,Dh:t,Yi:t,fj:t,data:t,min:Infinity,max:-Infinity};a.kk=Z(this,"uint");a.si=Z(this,"uchar",10);a.ti=Z(this,"uchar",18);a.Bi=Z(this,"uint");a.gk=Z(this,"ushort");a.ak=Z(this,"uchar");a.xi=Z(this,"uchar");a.Zb=Z(this,"ushort",8);a.Zi=Z(this,"float");a.$i=Z(this,"float");
a.aj=Z(this,"float");a.Xi=Z(this,"ushort");a.qf=Z(this,"ushort");a.li=Z(this,"ushort");a.pk=Z(this,"ushort");a.ta=Z(this,"float",8);a.Ih=Z(this,"float");a.fk=Z(this,"float");a.ek=Z(this,"float");a.ok=Z(this,"ushort");a.mk=Z(this,"uchar");a.Ak=Z(this,"uchar");a.mi=Z(this,"float");a.ni=Z(this,"float");a.nk=Z(this,"float");a.uk=Z(this,"float");a.Ki=Z(this,"uint",1);a.Li=Z(this,"uint",1);a.vi=Z(this,"uchar",80);a.ji=Z(this,"uchar",24);a.Pf=Z(this,"ushort");a.yh=Z(this,"ushort");a.th=Z(this,"float");a.uh=
Z(this,"float");a.vh=Z(this,"float");a.qh=Z(this,"float");a.rh=Z(this,"float");a.sh=Z(this,"float");a.Bh=Z(this,"float",4);a.Ch=Z(this,"float",4);a.Dh=Z(this,"float",4);a.Yi=Z(this,"uchar",16);a.fj=Z(this,"uchar",4);this.D=parseInt(a.Ih,10);var b=a.Zb[1]*a.Zb[2]*a.Zb[3];switch(a.qf){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 32:a.data=Z(this,"complex",b);break;case 64:a.data=Z(this,"double",
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:n(Error("Unsupported NII data type: "+a.qf))}b=Td(a.data);a.min=b[0];a.max=b[1];return a};function Zf(a){var b=-1,b="undefined"==typeof DataView?(new Int32Array(a,0,1))[0]:(new DataView(a,0)).getInt32(0,q);return 348==b?q:u}A("X.parserNII",Yf);A("X.parserNII.prototype.parse",Yf.prototype.parse);function $f(){Y.call(this);this.g="parserTRK"}C($f,Y);
$f.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");var e=b.h,d=b.o,f=b.sa;this.L=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);var l=Z(this,"ushort");Z(this,"uchar",200);c=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 k=
Z(this,"uint"),m=0===j?Infinity:j,r=[],s=[],j=Infinity,y=-Infinity,z=t,G=t,F=t,H=t,d=e=t,B=Z(this,"uint",(this.L.byteLength-1E3)/4);this.D=k;for(var E=Z(this,"float",(this.L.byteLength-1E3)/4),J=0,k=f=0;k<m;k++){if("undefined"===typeof B[J]){m=k;break}for(var N=B[J],Q=new T(3*N),R=0,O=0;O<N;O++){var ea=E[J+3*O+O*h+1],I=E[J+3*O+O*h+2],ba=E[J+3*O+O*h+3],ea=ea/g[0],I=I/g[1],ba=ba/g[2];Q.add(ea,I,ba);if(0<O)var da=Q.get(O-1),R=R+Math.sqrt(Math.pow(ea-da[0],2)+Math.pow(I-da[1],2)+Math.pow(ba-da[2],2));
O<N-1&&(f+=6)}J+=3*N+N*h+l+1;Z(this,"float",l);O=Q.nb;N=Q.kb;ea=Q.ob;I=Q.lb;ba=Q.pb;da=Q.mb;if(!z||O<z)z=O;if(!G||N>G)G=N;if(!F||ea<F)F=ea;if(!H||I>H)H=I;if(!e||ba<e)e=ba;if(!d||da>d)d=da;r.push(Q);s.push(R)}g=(z+G)/2;h=(F+H)/2;F=(e+d)/2;l=new Float32Array(f);b.h=e=new T(f);b.o=d=new T(f);b.sa=f=new T(f);for(k=H=0;k<m;k++){z=r[k];G=z.count;R=s[k];j=Math.min(j,R);y=Math.max(y,R);for(O=0;O<G-1;O++){E=z.get(O);B=z.get(O+1);e.add(E[0],E[1],E[2]);e.add(B[0],B[1],B[2]);var J=E[0]-g,Q=E[1]-h,N=E[2]-F,ea=
Math.sqrt(J*J+Q*Q+N*N),I=B[0]-g,ba=B[1]-h,da=B[2]-F,U=Math.sqrt(I*I+ba*ba+da*da);d.add(J/ea,Q/ea,N/ea);d.add(I/U,ba/U,da/U);B=[Math.abs(B[0]-E[0]),Math.abs(B[1]-E[1]),Math.abs(B[2]-E[2])];E=Math.sqrt(B[0]*B[0]+B[1]*B[1]+B[2]*B[2]);B[0]/=E;B[1]/=E;B[2]/=E;f.add(B[0],B[1],B[2]);f.add(B[0],B[1],B[2]);l[H++]=R;l[H++]=R;l[H++]=R;l[H++]=R;l[H++]=R;l[H++]=R}}b.Ia="LINES";m=new Uc;m.qa=j;m.ea=y;m.V=j;m.W=y;m.dd=l;m.wg=u;m.j=q;b.H=m;j=u;for(k=0;16>k;k++)if(0!=c[k]){j=q;break}j==u&&(c[0]=c[5]=c[10]=c[15]=1);
D.Da(this.g+".parse");D.f.Yf(c,b.la.R);c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};A("X.parserTRK",$f);A("X.parserTRK.prototype.parse",$f.prototype.parse);function ag(){Y.call(this);this.g="parserOBJ"}C(ag,Y);
ag.prototype.parse=function(a,b,c){D.Ja(this.g+".parse");this.L=c;c=c.byteLength;var e=Z(this,"uchar",c),d=[];b.h=new T(c);b.o=new T(c);var f=b.h,g=b.o,h=0,l;for(l=0;l<c;++l)if(10==e[l]){var j=Ud(e,h,l).replace(/\s{2,}/g," ").split(" ");if("v"==j[0])d.push([parseFloat(j[1]),parseFloat(j[2]),parseFloat(j[3])]);else if("f"==j[0]){var k=d[parseInt(j[1],10)-1],h=d[parseInt(j[2],10)-1],j=d[parseInt(j[3],10)-1];f.add(k[0],k[1],k[2]);f.add(h[0],h[1],h[2]);f.add(j[0],j[1],j[2]);k=new P(k[0],k[1],k[2]);j=
new P(j[0],j[1],j[2]);h=sc((new P(h[0],h[1],h[2])).ya(k),j.ya(k));h.normalize();g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d)}h=l+1}D.Da(this.g+".parse");c=new Wc;c.F=b;c.w=a;this.dispatchEvent(c)};A("X.parserOBJ",ag);A("X.parserOBJ.prototype.parse",ag.prototype.parse);function bg(){L.call(this);this.g="loader";this.Kc=new jc;this.td=0}C(bg,L);function cg(a,b){a.td+=b/a.Kc.tf()/3;a.td=Math.min(1,a.td);var c=new Pd;c.Ad=a.td;a.dispatchEvent(c)}function dg(a){a=a.s.$d;var b=a.split(".").pop().toUpperCase();b==a.toUpperCase()&&(b="");b in eg||n(Error("The "+b+" file format is not supported."));return[a,b,eg[b][0],eg[b][1],eg[b][2]]}
bg.prototype.load=function(a,b){(!a||!b)&&n(Error("No container or object to load."));if(!mc(this.Kc.ia,a.ka)||this.Kc.get(a.ka)){this.Kc.set(a.ka,u);var c=dg(a)[0];if(a.ab!=t)this.parse(t,a,b);else{var e=new XMLHttpRequest;K(e,"abort",this.Jg.bind(this,e,a,b));K(e,"error",this.Jg.bind(this,e,a,b));K(e,"load",this.parse.bind(this,e,a,b));e.open("GET",c,q);e.responseType="arraybuffer";e.send(t)}}};
bg.prototype.parse=function(a,b,c){cg(this,1);setTimeout(function(){var e=dg(b),d=e[3],e=new e[2];Vb(e,zd,this.complete.bind(this));var f=b.ab;f==t&&(f=a.response,b.ab=f);e.parse(b,c,f,d)}.bind(this),100)};bg.prototype.complete=function(a){cg(this,1);setTimeout(function(){var b=a.w,c=a.F;b.s.j=u;b.j=q;c.p();this.Kc.set(b.ka,q)}.bind(this),100)};bg.prototype.Jg=function(a,b,c){n(Error("Loading failed: ",b,c))};
var eg={OBJ:[ag,t],OFF:[cf,t],STL:[Xf,t],VTK:[ff,t],TRK:[$f,t],MRC:[Vf,t],ST:[Vf,t],FSM:[hf,t],INFLATED:[hf,t],SMOOTHWM:[hf,t],SPHERE:[hf,t],PIAL:[hf,t],ORIG:[hf,t],NRRD:[Wf,t],NII:[Yf,t],GZ:[Yf,t],DCM:[df,t],DICOM:[df,t],"":[df,t],CRV:[Qf,t],LABEL:[ae,t],MGH:[Pf,u],MGZ:[Pf,q],RAW:[Sf,u],RZ:[Sf,q],TXT:[Uf,t],LUT:[Uf,t],PNG:[Tf,"png"],JPG:[Tf,"jpeg"],JPEG:[Tf,"jpeg"],GIF:[Tf,"gif"]};function fg(a,b){(!x(a)||!x(b))&&n(Error("A camera needs valid width and height values."));L.call(this);this.g="camera";this.jc=new D.m(0,100,0);this.Fc=new D.m(0,0,0);this.Y=new D.m(0,0,1);this.N=a;this.B=b;this.n=this.ve(this.jc,this.Fc)}C(fg,L);fg.prototype.observe=function(a){(a==t||!(a instanceof Se))&&n(Error("Could not observe the interactor."));K(a,ud,this.Ij.bind(this));K(a,td,this.Fj.bind(this));K(a,vd,this.Vj.bind(this))};
fg.prototype.Ij=function(a){a instanceof Jd||n(Error("Received no valid rotate event."));this.rotate(a.za)};fg.prototype.Vj=function(a){a instanceof Kd||n(Error("Received no valid zoom event."));a.vb?this.bg(a.yb):this.cg(a.yb)};fg.prototype.Fj=function(a){a instanceof Id||n(Error("Received no valid pan event."));this.Mf(a.za)};fg.prototype.__defineGetter__("view",v("n"));
fg.prototype.__defineSetter__("view",function(a){(a==t||!(a instanceof Float32Array))&&n(Error("Invalid view matrix."));this.n=a});fg.prototype.__defineGetter__("position",function(){return[this.jc.x,this.jc.y,this.jc.d]});fg.prototype.__defineSetter__("position",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid position."));this.jc=new D.m(a[0],a[1],a[2]);this.reset()});fg.prototype.__defineGetter__("focus",function(){return[this.Fc.x,this.Fc.y,this.Fc.d]});
fg.prototype.__defineSetter__("focus",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid focus"));this.Fc=new D.m(a[0],a[1],a[2]);this.reset()});fg.prototype.__defineGetter__("up",function(){return[this.Y.x,this.Y.y,this.Y.d]});fg.prototype.__defineSetter__("up",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid up vector."));this.Y=new D.m(a[0],a[1],a[2]);this.reset()});w=fg.prototype;w.reset=function(){this.n=this.ve(this.jc,this.Fc)};
w.rotate=function(a){ka(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||n(Error("Invalid distance vector for rotate operation."));return a};w.Mf=function(a){ka(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||n(Error("Invalid distance vector for pan operation."));this.n[12]-=a.x;this.n[13]+=a.y};w.bg=function(a){this.n[14]+=a};w.cg=function(a){this.n[14]-=a};w.ve=function(a,b){(!(a instanceof D.m)||!(b instanceof D.m))&&n(Error("3D vectors required for calculating the view."));return D.f.Ed()};
A("X.camera",fg);A("X.camera.prototype.pan",fg.prototype.Mf);A("X.camera.prototype.rotate",fg.prototype.rotate);A("X.camera.prototype.zoomIn",fg.prototype.bg);A("X.camera.prototype.zoomOut",fg.prototype.cg);function gg(a){function b(a,b,e){b=2*b*Math.PI;b=$c(ad(l,Math.cos(b)),ad(j,Math.sin(b)));a=$c($c(c,ad(d,a)),ad(b,f));e=$c(ad(b,1-Math.abs(e)),ad(g,e));return new ed(a,e)}this.aa=[];a=a||{};var c=new Zc(a.start||[0,-1,0]),e=new Zc(a.end||[0,1,0]),d=bd(e,c),f=a.Bb||1;a=a.ua||16;for(var g=cd(d),h=0.5<Math.abs(g.y()),l=cd((new Zc(h,!h,0)).tc(g)),j=cd(l.tc(g)),h=new ed(c,dd(g)),e=new ed(e,cd(g)),k=[],m=0;m<a;m++){var r=m/a,s=(m+1)/a;k.push(new gd([h,b(0,r,-1),b(0,s,-1)]));k.push(new gd([b(0,s,0),b(0,r,
0),b(1,r,0),b(1,s,0)]));k.push(new gd([e,b(1,s,1),b(1,r,1)]))}return od(k)}C(gg,nd);function hg(){W.call(this);this.g="cylinder";this.bf=[-10,-10,-10];this.Le=[10,10,10];this.kc=10;this.fb=32;ya(this,new pd)}C(hg,W);hg.prototype.__defineGetter__("start",v("bf"));hg.prototype.__defineSetter__("start",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid start"));this.bf=a});hg.prototype.__defineGetter__("end",v("Le"));hg.prototype.__defineSetter__("end",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid end"));this.Le=a});hg.prototype.__defineGetter__("radius",v("kc"));
hg.prototype.__defineSetter__("radius",function(a){x(a)||n(Error("Invalid radius."));this.kc=a});hg.prototype.p=function(){rd(this,new gg({start:this.bf,end:this.Le,Bb:this.kc,ua:this.fb}));hg.z.p.call(this)};A("X.cylinder",hg);A("X.cylinder.prototype.modified",hg.prototype.p);function ig(a){function b(a,b){a*=2*Math.PI;b*=Math.PI;var d=new Zc(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new ed($c(c,ad(d,e)),d))}this.aa=[];a=a||{};var c=new Zc(a.mf||[0,0,0]),e=a.Bb||1,d=a.ua||16;a=a.qk||8;for(var f=[],g=[],h=0;h<d;h++)for(var l=0;l<a;l++)g=[],b(h/d,l/a),0<l&&b((h+1)/d,l/a),l<a-1&&b((h+1)/d,(l+1)/a),b(h/d,(l+1)/a),f.push(new gd(g));return od(f)}C(ig,nd);function jg(){W.call(this);this.g="sphere";this.v=[0,0,0];this.kc=5;this.fb=32;this.bi=16;ya(this,new pd)}C(jg,W);jg.prototype.__defineGetter__("center",v("v"));jg.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center"));this.v=a});jg.prototype.__defineGetter__("radius",v("kc"));jg.prototype.__defineSetter__("radius",function(a){x(a)||n(Error("Invalid radius."));this.kc=a});
jg.prototype.p=function(){rd(this,new ig({mf:this.v,Bb:this.kc,ua:this.fb,qk:this.bi}));jg.z.p.call(this)};A("X.sphere",jg);A("X.sphere.prototype.modified",jg.prototype.p);function Ze(a){M.call(this);this.g="labelmap";this.zb=a;this.af=new Float32Array([-255,-255,-255,-255])}C(Ze,M);Ze.prototype.p=function(){var a=new Wc;a.F=this;this.dispatchEvent(a);this.zb.p()};Ze.prototype.hk=function(a,b,c,e){(0>a||a>=this.r[0])&&n(Error("Out of bounds for i="+a+" in range 0.."+this.r[0]));(0>b||b>=this.r[1])&&n(Error("Out of bounds for j="+b+" in range 0.."+this.r[1]));(0>c||c>=this.r[2])&&n(Error("Out of bounds for k="+c+" in range 0.."+this.r[2]));this.S[c][b][a]=e};
Ze.prototype.__defineSetter__("showOnly",function(a){var b=[-1,-1,-1,-1];a!=t&&(ka(a)&&4==a.length?b=a:(this.pa||n(Error("No colortable assigned.")),b=this.pa.Ka.get(a).slice(1,5)));this.af=new Float32Array([Math.floor(255*b[0]),Math.floor(255*b[1]),Math.floor(255*b[2]),Math.floor(255*b[3])])});A("X.labelmap",Ze);A("X.labelmap.prototype.getPixel",Ze.prototype.Mg);A("X.labelmap.prototype.setPixel",Ze.prototype.hk);function kg(a){this.aa=[];a=a||{};var b=new Zc(a.mf||[0,0,0]),c=!a.Bb?[1,1,1]:a.Bb.length?a.Bb:[a.Bb,a.Bb,a.Bb];return od([[[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 gd(a[0].map(function(d){d=new Zc(b.x()+c[0]*(2*!!(d&1)-1),b.y()+c[1]*(2*!!(d&2)-1),b.d()+c[2]*(2*!!(d&4)-1));return new ed(d,new Zc(a[1]))}))}))}C(kg,nd);function lg(){W.call(this);this.g="cube";this.v=[0,0,0];this.Re=this.Qe=this.Pe=20;this.oc=[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];ya(this,new pd)}C(lg,W);lg.prototype.__defineGetter__("center",v("v"));lg.prototype.__defineSetter__("center",function(a){(a==t||!ka(a)||3!=a.length)&&n(Error("Invalid center"));this.v=a});lg.prototype.__defineGetter__("lengthX",v("Pe"));
lg.prototype.__defineSetter__("lengthX",function(a){x(a)||n(Error("Invalid lengthX."));this.Pe=a});lg.prototype.__defineGetter__("lengthY",v("Qe"));lg.prototype.__defineSetter__("lengthY",function(a){x(a)||n(Error("Invalid lengthY."));this.Qe=a});lg.prototype.__defineGetter__("lengthZ",v("Re"));lg.prototype.__defineSetter__("lengthZ",function(a){x(a)||n(Error("Invalid lengthZ."));this.Re=a});lg.prototype.p=function(){rd(this,new kg({mf:this.v,Bb:[this.Pe/2,this.Qe/2,this.Re/2]}));lg.z.p.call(this)};
A("X.cube",lg);A("X.cube.prototype.modified",lg.prototype.p);function Ue(a){Se.call(this,a);this.g="interactor3D";this.rl=u}C(Ue,Se);Ue.prototype.Kd=function(a){Ue.z.Kd.call(this,a);var b=new Kd;a.Xc==t&&(a.Xc=0);b.vb=0>a.Xc;b.tl=q;this.dispatchEvent(b)};function mg(a){L.call(this);this.g="array";this.G=[];this.eg=a}C(mg,L);function ng(a,b,c){for(var e=0;4>e;e++)if(a[e+0]!==b[e+c])return u;return q}mg.prototype.add=function(a){this.G.push(a);return q};mg.prototype.remove=function(a){a=this.G.indexOf(a);-1<a&&this.G.splice(a,1);return q};mg.prototype.clear=function(){this.G.length=0};
function og(a,b,c){var e=c-b;if(!(2>e)){e=b+Math.floor(e/2);og(a,b,e);for(og(a,e,c);b<e;++b)if(0<a.eg(a.G[b],a.G[e])){var d=a.G[b];a.G[b]=a.G[e];for(var f=a,g=e,h=c;g+1<h&&0>f.eg(f.G[g+1],d);){var l=f,j=g+1,k=l.G[g];l.G[g]=l.G[j];l.G[j]=k;++g}f.G[g]=d}}}mg.prototype.sort=function(){og(this,0,this.G.length)};function pg(a,b){fg.call(this,a,b);this.g="camera2D"}C(pg,fg);pg.prototype.rotate=function(a){a=pg.z.rotate.call(this,a);var b=new Hd;0<a.x?b.df--:0>a.x&&b.df++;0<a.y?b.Se++:0>a.y&&b.Se--;this.dispatchEvent(b)};pg.prototype.bg=function(a){this.n[14]+=a};pg.prototype.cg=function(a){this.n[14]-=a};pg.prototype.Mf=function(a){ka(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||n(Error("Invalid distance vector for pan operation."));this.n[12]-=a.x/this.n[14];this.n[13]+=a.y/this.n[14]};function qg(a,b){fg.call(this,a,b);this.g="camera3D";this.gg=45;this.ae=D.f.zf(D.f.Ed(),this.gg,a/b,1,1E4)}C(qg,fg);qg.prototype.rotate=function(a){a=qg.z.rotate.call(this,a);var b=-a.x/5*Math.PI/180;a=-a.y/5*Math.PI/180;var c=new D.m(this.n[1],this.n[5],this.n[9]),e=new D.m(this.n[0],this.n[4],this.n[8]);c.normalize();e.normalize();D.f.rotate(this.n,b,c.x,c.y,c.d);D.f.rotate(this.n,a,e.x,e.y,e.d)};qg.prototype.ve=function(a,b){var c=qg.z.ve.call(this,a,b);D.f.Zg(c,a,b,this.Y);return c};
function rg(a,b,c,e){var d=new Float32Array(4),f=new Float32Array(4),g=new Float32Array(16),h=new Float32Array(16);new Float32Array(16);D.f.multiply(a.ae,a.n,h);D.f.$(h,g);d[0]=b;d[1]=c;d[2]=2*e-1;d[3]=1;D.f.Bf(g,d,f);f[3]=1/f[3];f[0]*=f[3];f[1]*=f[3];f[2]*=f[3];return f}A("X.camera3D",qg);function sg(a){Jb.call(this);this.Ib=a;this.X=[]}C(sg,Jb);var tg=[];function ug(a,b,c,e,d){ka(c)||(tg[0]=c,c=tg);for(var f=0;f<c.length;f++){var g=K(b,c[f],e||a,d||u,a.Ib||a);a.X.push(g)}}sg.prototype.Qf=function(){Eb(this.X,Xb);this.X.length=0};sg.prototype.handleEvent=function(){n(Error("EventHandler.handleEvent not implemented"))};function vg(){}vg.Lg=function(){return vg.Ug?vg.Ug:vg.Ug=new vg};vg.prototype.pj=0;vg.Lg();function wg(a){ec.call(this);this.$b=a||he();this.ck=xg}C(wg,ec);wg.prototype.Ti=vg.Lg();var xg=t;w=wg.prototype;w.Tg=t;w.Zc=u;w.I=t;w.ck=t;w.Ld=t;w.Cd=t;w.nf=t;w.u=v("I");w.Sf=function(a){this.Ld&&this.Ld!=a&&n(Error("Method not supported"));wg.z.Sf.call(this,a)};w.oe=v("$b");w.Wc=function(){this.I=this.$b.createElement("div")};w.cc=function(a){this.dc(a)};
w.dc=function(a,b){this.Zc&&n(Error("Component already rendered"));this.I||this.Wc();a?a.insertBefore(this.I,b||t):this.$b.ma.body.appendChild(this.I);(!this.Ld||this.Ld.Zc)&&this.le()};w.le=function(){function a(a){!a.Zc&&a.u()&&a.le()}this.Zc=q;this.Cd&&Eb(this.Cd,a,p)};w.me=function(){function a(a){a.Zc&&a.me()}this.Cd&&Eb(this.Cd,a,p);this.Mi&&this.Mi.Qf();this.Zc=u};
w.removeChild=function(a,b){if(a){var c=na(a)?a:a.Tg||(a.Tg=":"+(a.Ti.pj++).toString(36)),e;this.nf&&c?(e=this.nf,e=(c in e?e[c]:p)||t):e=t;a=e;c&&a&&(e=this.nf,c in e&&delete e[c],Hb(this.Cd,a),b&&(a.me(),a.I&&pe(a.I)),c=a,c==t&&n(Error("Unable to set parent component")),c.Ld=t,wg.z.Sf.call(c,t))}a||n(Error("Child is not in parent component"));return a};function yg(){ec.call(this)}C(yg,ec);w=yg.prototype;w.$f=0;w.Gd=0;w.Af=100;w.Ig=0;w.Wf=1;w.bj=u;w.mj=u;w.Od=function(a){a=zg(this,a);this.$f!=a&&(this.$f=a+this.Ig>this.Af?this.Af-this.Ig:a<this.Gd?this.Gd:a,!this.bj&&!this.mj&&this.dispatchEvent("change"))};w.re=function(){return zg(this,this.$f)};w.qe=function(){return zg(this,this.Gd)};w.pe=function(){return zg(this,this.Af)};function zg(a,b){return a.Wf==t?b:a.Gd+Math.round((b-a.Gd)/a.Wf)*a.Wf};function Ag(a){wg.call(this,a);this.Md=new yg;K(this.Md,"change",this.Ni,u,this)}C(Ag,wg);var Bg={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};w=Ag.prototype;w.Wc=function(){this.Cb=this.oe().Wc("div","progress-bar-thumb");var a=Bg[this.nh];this.I=this.oe().Wc("div",a,this.Cb);Dg(this);a=this.qe();this.u().setAttribute("aria-valuemin",a);a=this.pe();this.u().setAttribute("aria-valuemax",a)};
w.le=function(){Ag.z.le.call(this);db&&7>lb&&K(this.u(),"resize",this.Ge,u,this);this.Ge();var a=this.u();a.setAttribute("role","progressbar");a.setAttribute("aria-live","polite")};w.me=function(){Ag.z.me.call(this);db&&7>lb&&Wb(this.u(),"resize",this.Ge,u,this)};w.re=function(){return this.Md.re()};w.Od=function(a){this.Md.Od(a);this.u()&&Dg(this)};function Dg(a){var b=a.re();a.u().setAttribute("aria-valuenow",b)}w.qe=function(){return this.Md.qe()};w.pe=function(){return this.Md.pe()};w.nh="horizontal";
w.Ni=function(){this.Ge();this.dispatchEvent("change")};w.Ge=function(){if(this.Cb){var a=this.qe(),b=this.pe(),a=(this.re()-a)/(b-a),b=Math.round(100*a);"vertical"==this.nh?db&&7>lb?(this.Cb.style.top=0,this.Cb.style.height="100%",b=this.Cb.offsetHeight,a=Math.round(a*b),this.Cb.style.top=b-a+"px",this.Cb.style.height=a+"px"):(this.Cb.style.top=100-b+"%",this.Cb.style.height=b+"%"):this.Cb.style.width=b+"%"}};function Eg(a,b){a==t&&n(Error("No valid parent element."));b==t&&n(Error("Invalid initial value."));Ag.call(this);this.g="progressbar";this.eb=a;this.We="";this.Td=this.Hb=t;this.gc=[];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 e;e=".progress-bar-thumb {\n position: relative;\n background: #F62217;\n";
e+=" overflow: hidden;\n";e+=" width: 0%;\n";e+=" height: 100%;\n";e+="}";var d;d=".progress-bar-thumb-done {\n background: #57E964;\n}";this.gc=[c,e,d];this.Od(b);this.vf()}C(Eg,Ag);
Eg.prototype.vf=function(){var a=xe(this.eb,"position");if("static"==a||""==a)this.We=this.eb.style.position,this.eb.style.position="relative";var a=document.getElementsByTagName("head")[0],b=me("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.gc[0])),e=document.createTextNode(String(this.gc[1])),d=document.createTextNode(String(this.gc[2]));a.appendChild(b);b.appendChild(c);b.appendChild(e);b.appendChild(d);this.Hb=b;this.cc(this.eb);a=this.u();a.style.position=
"absolute";a.style.top=(this.eb.clientHeight-5)/2+"px";a.style.left=(this.eb.clientWidth-100)/2+"px";a.classList.add("xtk-progress-bar")};function Fg(a){var b=a.u().style.top,c=a.u().style.left;pe(a.u());var e=new Eg(a.eb,100),d=e.u();d.style.position="absolute";d.style.top=b;d.style.left=c;d.classList.add("xtk-progress-bar");(d.firstElementChild!=p?d.firstElementChild:qe(d.firstChild)).classList.add("progress-bar-thumb-done");a.Td=e}
Eg.prototype.Fd=function(){this.Hb&&pe(this.Hb);this.u()&&pe(this.u());this.Td&&pe(this.Td.u());this.Td=this.Hb=t;this.We&&(this.eb.style.position=this.We)};function Gg(a,b,c){oa(a)?c&&(a=va(a,c)):a&&"function"==typeof a.handleEvent?a=va(a.handleEvent,a):n(Error("Invalid listener argument"));return 2147483647<b?-1:ga.setTimeout(a,b||0)};function Hg(){L.call(this);this.g="renderer";this.w=window.document.body;this.N=this.w.clientWidth;this.B=this.w.clientHeight;this.U=this.K=this.da=t;this.cb=new mg(Yc);this.Ha=[];this.ba=t;this.Zd=this.hd=this.Xd=u;this.a=this.Vb=this.La=t;this.T={PROGRESSBAR_ENABLED:q,INTERMEDIATE_RENDERING:u,SLICENAVIGATORS:q};this.Ie=-1;window.console.log("XTK release 11 -- 2022-10-24 15:05:39 -- http://www.goXTK.com -- @goXTK")}C(Hg,L);w=Hg.prototype;
w.Gf=function(){window.cancelAnimationFrame(this.Ie);this.T.PROGRESSBAR_ENABLED&&(this.Vb=new Eg(this.w,3))};w.Hf=function(){this.T.PROGRESSBAR_ENABLED&&this.Vb&&(Fg(this.Vb),this.Qd=Gg(function(){this.Qd=t;this.Vb&&(this.Vb.Fd(),this.Vb=t);this.hd=this.Zd=q;this.cc()}.bind(this),700))};w.If=function(a){this.Vb&&this.Vb.Od(100*a.Ad)};w.Gj=function(a){this.La&&this.La.Od(100*a.Ad)};w.wj=function(a){a!=t&&a instanceof Wc&&a.F&&this.ub(a.F)};w.Hj=function(a){a!=t&&a instanceof Xc&&a.F&&this.remove(a.F)};
w.Kf=function(a){(a==t||!(a instanceof Md))&&n(Error("Invalid hover event."))};w.we=function(){this.Xa()};w.Xa=function(){var a=ke(this.w);this.N=a.clientWidth;this.B=a.clientHeight;a=ke(this.da);a.width=this.N;a.height=this.B;"renderer3D"==this.g&&(this.a.viewport(0,0,this.N,this.B),this.K.ae=D.f.zf(D.f.Ed(),this.K.gg,this.da.width/this.da.height,1,1E4))};w.Lf=function(a){(a==t||!(a instanceof Ld))&&n(Error("Invalid scroll event."))};Hg.prototype.__defineGetter__("config",v("T"));
Hg.prototype.__defineGetter__("interactor",v("U"));Hg.prototype.__defineGetter__("camera",v("K"));Hg.prototype.__defineGetter__("loadingCompleted",v("hd"));Hg.prototype.__defineGetter__("container",v("w"));Hg.prototype.__defineSetter__("container",function(a){a==t&&n(Error("An ID to a valid container (<div>..) is required."));var b=a;na(b)&&(b=ke(a));pa(b)&&1==b.nodeType||n(Error("Could not find the given container."));this.w=b});w=Hg.prototype;w.Nd=function(){this.K.reset()};
w.Ca=function(a){var b=me("canvas");this.w.appendChild(b);this.N=this.w.clientWidth;this.B=this.w.clientHeight;b.width=this.N;b.height=this.B;try{var c=b.getContext(a);c||n(Error())}catch(e){var d="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.w.innerHTML='<h3 style="color:red;font-family:sans-serif;">Oooops..</h3><p style="color:red;font-family:sans-serif;">'+d+"</p>";
n(Error(d))}this.ba=new bg;K(this.ba,Bd,this.Gj.bind(this));this.da=b;this.a=c;b=new Ue(this.da);"2d"==a&&(b=new We(this.da));b.Ca();K(b,xd,this.Nd.bind(this));K(b,Cd,this.Kf.bind(this));K(b,wd,this.Lf.bind(this));this.U=b;b=new qg(this.N,this.B);"2d"==a&&(b=new pg(this.N,this.B));b.observe(this.U);this.K=b;K(window,"resize",this.we,u,this)};w.add=function(a){(a instanceof lg||a instanceof jg||a instanceof hg)&&a.p();this.Ha.push(a);this.ub(a)};
w.remove=function(a){(!this.da||!this.a)&&n(Error("The renderer was not initialized properly."));if(a!=t){Zb(a);var b=this.Ha.length,c;for(c=0;c<b;c++)if(this.Ha[c].ka==a.ka)return this.Ha[c]=t,this.Ha.splice(c,1),q}return u};w.ub=function(a){(!this.da||!this.a)&&n(Error("The renderer was not initialized properly."));a!=t&&($b(a,zd)||K(a,zd,this.wj.bind(this)),$b(a,Ad)||K(a,Ad,this.Hj.bind(this)),$b(a,Ed)||K(a,Ed,this.Gf.bind(this)),$b(a,Gd)||K(a,Gd,this.If.bind(this)),$b(a,Fd)||K(a,Fd,this.Hf.bind(this)))};
w.get=function(a){a==t&&n(Error("Invalid object id."));for(var b=this.cb.G,c=b.length,e=0,e=0;e<c;e++)if(b[e].ka==a)return b[e];return t};
w.cc=function(){(!this.da||!this.a)&&n(Error("The renderer was not initialized properly."));if(this.vg==t){if(lc(this.ba.Kc)){if(this.T.PROGRESSBAR_ENABLED&&!this.La&&(this.La=new Eg(this.w,3)),this.Zd=this.hd=u,this.vg=Gg(function(){this.vg=t;this.cc()}.bind(this),100),!this.T.INTERMEDIATE_RENDERING)return}else if(!this.hd&&!this.Zd&&(this.Zd=q,eval("this.onShowtime()"),this.hd=q),this.La){this.T.PROGRESSBAR_ENABLED&&(this.La&&!this.Qd)&&(Fg(this.La),this.Qd=Gg(function(){this.Qd=t;this.La&&(this.La.Fd(),
this.La=t);this.cc()}.bind(this),700));return}this.Ie=window.requestAnimationFrame(this.cc.bind(this));eval("this.onRender()");this.dc(u,q);eval("this.afterRender()")}};w.mh=aa();w.kh=aa();w.zg=aa();w.dc=aa();
w.Ta=function(){Zb(this);Wb(window,"resize",this.we,u,this);window.cancelAnimationFrame(this.Ie);this.ba&&(delete this.ba,this.ba=t);this.La&&(this.La.Fd(),delete this.La,this.La=t);this.cb.clear();delete this.cb;this.Ha.length=0;delete this.Ha;delete this.ba;this.ba=t;delete this.K;this.K=t;delete this.U;this.U=t;delete this.a;this.a=t;pe(this.da);delete this.da;this.da=t};function Ig(a,b,c,e,d,f,g,h){var l,j;if(l=c.offsetParent){var k="HTML"==l.tagName||"BODY"==l.tagName;if(!k||"static"!=ye(l,"position"))j=De(l),k||(k=(k=Ee(l))&&eb?-l.scrollLeft:k&&(!db||!xb("8"))&&"visible"!=ye(l,"overflowX")?l.scrollWidth-l.clientWidth-l.scrollLeft:l.scrollLeft,j=ge(j,new fe(k,l.scrollTop)))}l=j||new fe;j=De(a);k=Ie(a);j=new ve(j.x,j.y,k.width,k.height);(k=Ce(a))&&j.Vg(new ve(k.left,k.top,k.right-k.left,k.bottom-k.top));var k=he(a),m=he(c);if(k.ma!=m.ma){var r=k.ma.body,m=m.ma.parentWindow||
m.ma.defaultView,s=new fe(0,0),y=je(r)?je(r).parentWindow||je(r).defaultView:window,z=r;do{var G=y==m?De(z):Fe(z);s.x+=G.x;s.y+=G.y}while(y&&y!=m&&(z=y.frameElement)&&(y=y.parent));r=ge(s,De(r));db&&!se(k)&&(r=ge(r,te(k)));j.left+=r.x;j.top+=r.y}a=(b&4&&Ee(a)?b^2:b)&-5;b=new fe(a&2?j.left+j.width:j.left,a&1?j.top+j.height:j.top);b=ge(b,l);d&&(b.x+=(a&2?-1:1)*d.x,b.y+=(a&1?-1:1)*d.y);var F;if(g&&(F=Ce(c)))F.top-=l.y,F.right-=l.x,F.bottom-=l.y,F.left-=l.x;return Jg(b,c,e,f,F,g,h)}
function Jg(a,b,c,e,d,f,g){a=a.l();var h=0,l=(c&4&&Ee(b)?c^2:c)&-5;c=Ie(b);g=g?g.l():c.l();if(e||0!=l)l&2?a.x-=g.width+(e?e.right:0):e&&(a.x+=e.left),l&1?a.y-=g.height+(e?e.bottom:0):e&&(a.y+=e.top);if(f){if(d){h=a;e=0;if(65==(f&65)&&(h.x<d.left||h.x>=d.right))f&=-2;if(132==(f&132)&&(h.y<d.top||h.y>=d.bottom))f&=-5;h.x<d.left&&f&1&&(h.x=d.left,e|=1);h.x<d.left&&(h.x+g.width>d.right&&f&16)&&(g.width=Math.max(g.width-(h.x+g.width-d.right),0),e|=4);h.x+g.width>d.right&&f&1&&(h.x=Math.max(d.right-g.width,
d.left),e|=1);f&2&&(e|=(h.x<d.left?16:0)|(h.x+g.width>d.right?32:0));h.y<d.top&&f&4&&(h.y=d.top,e|=2);h.y<=d.top&&(h.y+g.height<d.bottom&&f&32)&&(g.height=Math.max(g.height-(d.top-h.y),0),h.y=0,e|=8);h.y>=d.top&&(h.y+g.height>d.bottom&&f&32)&&(g.height=Math.max(g.height-(h.y+g.height-d.bottom),0),e|=8);h.y+g.height>d.bottom&&f&4&&(h.y=Math.max(d.bottom-g.height,d.top),e|=2);f&8&&(e|=(h.y<d.top?64:0)|(h.y+g.height>d.bottom?128:0));h=e}else h=256;if(h&496)return h}f=a;d=eb&&(Va||ib)&&xb("1.9");f instanceof
fe?(a=f.x,f=f.y):(a=f,f=p);b.style.left=He(a,d);b.style.top=He(f,d);if(!(c==g||(!c||!g?0:c.width==g.width&&c.height==g.height)))a=se(he(je(b))),db&&(!a||!xb("8"))?(c=b.style,a?(db?(a=Me(b,"paddingLeft"),d=Me(b,"paddingRight"),f=Me(b,"paddingTop"),e=Me(b,"paddingBottom"),a=new ue(f,d,e,a)):(a=xe(b,"paddingLeft"),d=xe(b,"paddingRight"),f=xe(b,"paddingTop"),e=xe(b,"paddingBottom"),a=new ue(parseFloat(f),parseFloat(d),parseFloat(e),parseFloat(a))),db?(d=Oe(b,"borderLeft"),f=Oe(b,"borderRight"),e=Oe(b,
"borderTop"),b=Oe(b,"borderBottom"),b=new ue(e,f,b,d)):(d=xe(b,"borderLeftWidth"),f=xe(b,"borderRightWidth"),e=xe(b,"borderTopWidth"),b=xe(b,"borderBottomWidth"),b=new ue(parseFloat(e),parseFloat(f),parseFloat(b),parseFloat(d))),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,eb?b.MozBoxSizing="border-box":fb?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 Kg(){}Kg.prototype.tb=aa();function Lg(a,b){this.of=a instanceof fe?a:new fe(a,b)}C(Lg,Kg);Lg.prototype.tb=function(a,b,c,e){Ig(ze(a),0,a,b,this.of,c,t,e)};function Mg(a,b,c){this.element=a;this.Gg=b;this.Wj=c}C(Mg,Kg);Mg.prototype.tb=function(a,b,c){Ig(this.element,this.Gg,a,b,p,c,this.Wj)};function Ng(a,b){ec.call(this);this.Ib=new sg(this);this.Rf(a||t);b&&(this.$c=b)}C(Ng,ec);w=Ng.prototype;w.I=t;w.ii=q;w.Ag=t;w.Ma=u;w.ik=u;w.xf=-1;w.Yg=-1;w.Si=u;w.zi=q;w.$c="toggle_display";w.u=v("I");w.Rf=function(a){this.Ma&&n(Error("Can not change this state of the popup while showing."));this.I=a};
function Og(a,b){a.Fe&&a.Fe.stop();a.se&&a.se.stop();if(b){if(!a.Ma&&a.Ff()){a.I||n(Error("Caller must call setElement before trying to show the popup"));a.tb();var c=je(a.I);a.Si&&ug(a.Ib,c,"keydown",a.uj,q);if(a.ii)if(ug(a.Ib,c,"mousedown",a.ih,q),db){var e;try{e=c.activeElement}catch(d){}for(;e&&"IFRAME"==e.nodeName;){try{var f=e.contentDocument||e.contentWindow.document}catch(g){break}c=f;e=c.activeElement}ug(a.Ib,c,"mousedown",a.ih,q);ug(a.Ib,c,"deactivate",a.hh)}else ug(a.Ib,c,"blur",a.hh);
"toggle_display"==a.$c?(a.I.style.visibility="visible",Ke(a.I,q)):"move_offscreen"==a.$c&&a.tb();a.Ma=q;a.Fe?(Vb(a.Fe,"end",a.lh,u,a),a.Fe.play()):a.lh()}}else Pg(a)}w.tb=ha;function Pg(a,b){if(!a.Ma||!a.dispatchEvent({type:"beforehide",target:b}))return u;a.Ib&&a.Ib.Qf();a.Ma=u;a.Yg=xa();a.se?(Vb(a.se,"end",wa(a.Fg,b),u,a),a.se.play()):a.Fg(b);return q}w.Fg=function(a){"toggle_display"==this.$c?this.ik?Gg(this.Qg,0,this):this.Qg():"move_offscreen"==this.$c&&(this.I.style.top="-10000px");this.Jf(a)};
w.Qg=function(){this.I.style.visibility="hidden";Ke(this.I,u)};w.Ff=function(){return this.dispatchEvent("beforeshow")};w.lh=function(){this.xf=xa();this.Yg=-1;this.dispatchEvent("show")};w.Jf=function(a){this.dispatchEvent({type:"hide",target:a})};w.ih=function(a){a=a.target;!re(this.I,a)&&((!this.Ag||re(this.Ag,a))&&!(150>xa()-this.xf))&&Pg(this,a)};w.uj=function(a){27==a.keyCode&&Pg(this,a.target)&&(a.preventDefault(),a.stopPropagation())};
w.hh=function(a){if(this.zi){var b=je(this.I);if(db||bb){if(a=b.activeElement,!a||re(this.I,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>xa()-this.xf||Pg(this)}};function Qg(a,b){this.$j=4;this.xe=b||p;Ng.call(this,a)}C(Qg,Ng);Qg.prototype.tb=function(){if(this.xe){var a=!this.Ma&&"move_offscreen"!=this.$c,b=this.u();a&&(b.style.visibility="hidden",Ke(b,q));this.xe.tb(b,this.$j,this.Ql);a&&Ke(b,u)}};function Rg(a){this.ia=new jc;a&&this.ef(a)}function Sg(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+qa(a):b.substr(0,1)+a}w=Rg.prototype;w.tf=function(){return this.ia.tf()};w.add=function(a){this.ia.set(Sg(a),a)};w.ef=function(a){a=ic(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};w.Qf=function(a){a=ic(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};w.remove=function(a){return this.ia.remove(Sg(a))};w.clear=function(){this.ia.clear()};
w.contains=function(a){a=Sg(a);return mc(this.ia.ia,a)};w.Vg=function(a){var b=new Rg;a=ic(a);for(var c=0;c<a.length;c++){var e=a[c];this.contains(e)&&b.add(e)}return b};w.Dd=function(){return this.ia.Dd()};w.l=function(){return new Rg(this)};function Tg(a,b,c){this.$b=c||(a?he(ke(a)):he());Qg.call(this,this.$b.Wc("div",{style:"position:absolute;display:none;"}));this.pf=new fe(1,1);this.ke=new Rg;a&&Ug(this,a);if(b!=t)if(a=this.u(),"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(je(a).createTextNode(String(b)))}}C(Tg,Qg);var Vg=[];w=Tg.prototype;w.Sa=t;w.className="goog-tooltip";
w.zh=500;w.Ri=0;w.oe=v("$b");function Ug(a,b){b=ke(b);a.ke.add(b);K(b,"mouseover",a.Qi,u,a);K(b,"mouseout",a.Ng,u,a);K(b,"mousemove",a.Pi,u,a);K(b,"focus",a.Oi,u,a);K(b,"blur",a.Ng,u,a)}w.Rf=function(a){var b=this.u();b&&pe(b);Tg.z.Rf.call(this,a);a&&(b=this.$b.ma.body,b.insertBefore(a,b.lastChild))};
w.Ff=function(){if(!Ng.prototype.Ff.call(this))return u;if(this.anchor)for(var a,b=0;a=Vg[b];b++)re(a.u(),this.anchor)||Og(a,u);0<=Db(Vg,this)||Vg.push(this);a=this.u();a.className=this.className;Wg(this);K(a,"mouseover",this.Pg,u,this);K(a,"mouseout",this.Og,u,this);Xg(this);return q};
w.Jf=function(){Hb(Vg,this);for(var a=this.u(),b,c=0;b=Vg[c];c++)b.anchor&&re(a,b.anchor)&&Og(b,u);this.oh&&Yg(this.oh);Wb(a,"mouseover",this.Pg,u,this);Wb(a,"mouseout",this.Og,u,this);this.anchor=p;if(0==(this.Kb?this.Ma?4:1:this.Yc?3:this.Ma?2:0))this.Ce=u;Ng.prototype.Jf.call(this)};w.bh=function(a,b){this.anchor==a&&this.ke.contains(this.anchor)&&(this.Ce||!this.$l?(Og(this,u),this.Ma||(this.anchor=a,this.xe=b||Zg(this,0)||p,this.Ma&&this.tb(),Og(this,q))):this.anchor=p);this.Kb=p};
w.lj=function(a){this.Yc=p;a==this.anchor&&(this.Sa==t||this.Sa!=this.u()&&!this.ke.contains(this.Sa))&&(!this.Cg||!this.Cg.Sa)&&Og(this,u)};function $g(a,b){var c=te(a.$b);a.pf.x=b.clientX+c.x;a.pf.y=b.clientY+c.y}w.Qi=function(a){var b=ah(this,a.target);this.Sa=b;Wg(this);b!=this.anchor&&(this.anchor=b,this.Kb||(this.Kb=Gg(va(this.bh,this,b,p),this.zh)),bh(this),$g(this,a))};function ah(a,b){try{for(;b&&!a.ke.contains(b);)b=b.parentNode;return b}catch(c){return t}}
w.Pi=function(a){$g(this,a);this.Ce=q};w.Oi=function(a){this.Sa=a=ah(this,a.target);this.Ce=q;if(this.anchor!=a){this.anchor=a;var b=Zg(this,1);Wg(this);this.Kb||(this.Kb=Gg(va(this.bh,this,a,b),this.zh));bh(this)}};function Zg(a,b){if(0==b){var c=a.pf.l();return new ch(c)}return new dh(a.Sa)}function bh(a){if(a.anchor)for(var b,c=0;b=Vg[c];c++)re(b.u(),a.anchor)&&(b.Cg=a,a.oh=b)}
w.Ng=function(a){var b=ah(this,a.target),c=ah(this,a.relatedTarget);b!=c&&(b==this.Sa&&(this.Sa=t),Xg(this),this.Ce=u,this.Ma&&(!a.relatedTarget||!re(this.u(),a.relatedTarget))?Yg(this):this.anchor=p)};w.Pg=function(){var a=this.u();this.Sa!=a&&(Wg(this),this.Sa=a)};w.Og=function(a){var b=this.u();if(this.Sa==b&&(!a.relatedTarget||!re(b,a.relatedTarget)))this.Sa=t,Yg(this)};function Xg(a){a.Kb&&(ga.clearTimeout(a.Kb),a.Kb=p)}
function Yg(a){if(2==(a.Kb?a.Ma?4:1:a.Yc?3:a.Ma?2:0))a.Yc=Gg(va(a.lj,a,a.anchor),a.Ri)}function Wg(a){a.Yc&&(ga.clearTimeout(a.Yc),a.Yc=p)}function ch(a,b){Lg.call(this,a,b)}C(ch,Lg);ch.prototype.tb=function(a,b,c){b=ze(a);b=Ce(b);c=c?new ue(c.top+10,c.right,c.bottom,c.left+10):new ue(10,0,0,10);Jg(this.of,a,4,c,b,9)&496&&Jg(this.of,a,4,c,b,5)};function dh(a){Mg.call(this,a,3)}C(dh,Mg);
dh.prototype.tb=function(a,b,c){var e=new fe(10,0);Ig(this.element,this.Gg,a,b,e,c,9)&496&&Ig(this.element,2,a,1,e,c,5)};function eh(a,b,c,e){a==t&&n(Error("No valid parent element."));(!x(b)||!x(c))&&n(Error("Invalid coordinates."));(e==t||!(e instanceof Se))&&n(Error("Invalid interactor."));Tg.call(this);this.g="caption";this.eb=a;this.ge=b;this.he=c;this.U=e;this.Hb=t;this.gc=[];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.gc=[a];Vb(e,Dd,this.Fd.bind(this));this.vf()}C(eh,Tg);
eh.prototype.vf=function(){var a=xe(this.eb,"position");if("static"==a||""==a)this.eb.style.position="relative";var a=document.getElementsByTagName("head")[0],b=me("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.gc[0]));a.appendChild(b);b.appendChild(c);this.Hb=b;this.xe=new Lg(this.ge,this.he)||p;this.Ma&&this.tb();Og(this,q);Ug(this,this.eb);this.u().classList.add("x-tooltip")};
eh.prototype.Fd=function(){Og(this,u);this.Hb&&pe(this.Hb);this.u()&&pe(this.u());this.Hb=t};function fh(){L.call(this);this.g="shaders";this.de="";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.de=a+="}\n";this.Ud="";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 vec4 labelmapColor;\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 - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin));\n";a+=" float _windowHigh = ((volumeWindowHigh - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin));\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 (labelmapColor.a != -255.0) {\n";a+=" if (all(equal(floor(texture2 * vec4(255)), labelmapColor))) {\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+=" } else {\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+=" }\n";a+=" if (volumeTexture) {\n";a+=" float _volumeLowerThreshold = (volumeLowerThreshold - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin);\n";a+=" float _volumeUpperThreshold = (volumeUpperThreshold - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin);\n";a+=" if (texture1.r < _volumeLowerThreshold ||\n";a+=" texture1.r > _volumeUpperThreshold ||\n";
a+=" texture1.a == 0.0 ) {\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.Ud=a+="}\n"}C(fh,L);
var gh={el:"vertexPosition",dl:"vertexNormal",cl:"vertexColor",gl:"vertexTexturePos",fl:"vertexScalar"},hh={hl:"view",Mk:"perspective",Dk:"center",Lk:"objectTransform",Zk:"useObjectColor",Jk:"objectColor",al:"useScalars",Vk:"scalarsReplaceMode",Sk:"scalarsMin",Pk:"scalarsMax",Tk:"scalarsMinColor",Qk:"scalarsMaxColor",Uk:"scalarsMinThreshold",Rk:"scalarsMaxThreshold",Ok:"scalarsInterpolation",Nk:"pointSize",Kk:"objectOpacity",Ik:"normal",$k:"usePicking",bl:"useTexture",Yk:"useLabelMapTexture",Gk:"labelmapOpacity",
Fk:"labelmapColor",Wk:"textureSampler",Xk:"textureSampler2",il:"volumeLowerThreshold",ol:"volumeUpperThreshold",ll:"volumeScalarMin",jl:"volumeScalarMax",ml:"volumeScalarMinColor",kl:"volumeScalarMaxColor",ql:"volumeWindowLow",pl:"volumeWindowHigh",nl:"volumeTexture"};function ih(a,b,c){a==t&&n(Error("Invalid GL Buffer."));b==t&&n(Error("Invalid number of items."));c==t&&n(Error("Invalid item size."));L.call(this);this.g="buffer";this.Q=a;this.ed=b;this.Ob=c}C(ih,L);function jh(){Hg.call(this);this.g="renderer3D";this.md=this.pd=this.ld=this.od=this.kd=this.nd=this.Ze=this.$e=t;this.v=[0,0,0];this.bd=[0,0,0];this.tg=t;this.Je=new jc;this.xd=new jc;this.qc=new jc;this.qd=new jc;this.Ec=new jc;this.Pc=new jc;this.pc=new jc;this.wd=new jc;this.T={PROGRESSBAR_ENABLED:q,PICKING_ENABLED:q,ORDERING_ENABLED:q,STATISTICS_ENABLED:u,INTERMEDIATE_RENDERING:u}}C(jh,Hg);jh.prototype.__defineGetter__("config",v("T"));w=jh.prototype;
w.bk=function(){this.md=this.pd=this.ld=this.od=this.kd=this.nd=t;this.v=[0,0,0]};w.Kf=function(a){jh.z.Kf.call(this,a);var b=a.ge;a=a.he;var c=this.Of(b,a);if(c=this.get(c))if(c=c.fc){var e=Fe(this.w);(new eh(this.w,e.x+b+10,e.y+a+10,this.U)).u().innerHTML=c}};
w.Ca=function(){jh.z.Ca.call(this,"experimental-webgl");try{if(this.a.viewport(0,0,this.N,this.B),this.a.clearColor(this.bd[0],this.bd[1],this.bd[2],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.T.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.N,this.B,0,this.a.RGB,this.a.UNSIGNED_BYTE,t);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.N,this.B);this.a.bindRenderbuffer(this.a.RENDERBUFFER,t);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,t);this.tg=a}}catch(e){n(Error("Exception while accessing GL Context!\n"+e))}a=new fh;
(this.da==t||this.a==t||this.K==t)&&n(Error("Renderer was not initialized properly."));(a==t||!(a instanceof fh))&&n(Error("Could not add shaders."));b=Object.keys(hh);Object.keys(gh).every(function(a){a=gh[a];return-1!=this.de.search(a)||-1!=this.Ud.search(a)}.bind(a))||n(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=hh[a];return-1!=this.de.search(a)||-1!=this.Ud.search(a)}.bind(a))||n(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.Ud);this.a.shaderSource(c,a.de);this.a.compileShader(b);this.a.compileShader(c);this.a.getShaderParameter(b,this.a.COMPILE_STATUS)||n(Error("Fragement Shader compilation failed!\n"+this.a.getShaderInfoLog(b)));this.a.getShaderParameter(c,this.a.COMPILE_STATUS)||n(Error("Vertex Shader compilation failed!\n"+this.a.getShaderInfoLog(c)));var d=this.a.createProgram();this.a.attachShader(d,c);this.a.attachShader(d,b);this.a.linkProgram(d);
this.a.getProgramParameter(d,this.a.LINK_STATUS)||n(Error("Could not create shader program!\n"+this.a.getShaderInfoLog(b)+"\n"+this.a.getShaderInfoLog(c)+"\n"+this.a.getProgramInfoLog(d)));this.a.useProgram(d);this.Ze=d;Object.keys(gh).forEach(function(a){a=gh[a];this.Je.set(a,this.a.getAttribLocation(this.Ze,a));this.a.enableVertexAttribArray(this.Je.get(a))}.bind(this));Object.keys(hh).forEach(function(a){a=hh[a];this.xd.set(a,this.a.getUniformLocation(this.Ze,a))}.bind(this));this.$e=a};
w.ub=function(a){jh.z.ub.call(this,a);var b=u;if(a!=t){this.get(a.ka)&&(b=q);var c=a.ka,e=a.h,d=a.o,f=a.sa,g=a.M,h=a.s,l=a.la,j=a.pa,k=a.e,m=a.H;if(k!=t&&k.s!=t&&k.s.j)this.ub(k);else if(k!=t&&k.j&&this.ub(k),j!=t&&j.s!=t&&j.s.j)this.ba.load(j,a);else if(g!=t&&g.s!=t&&g.s.j)this.ba.load(g,a);else{if(h!=t&&ka(h))if(a.zc!=t){if(a.zc.yf!=h.length||!a.j)return}else{b=0;c=h.length;for(b=0;b<c;b++)this.ba.load(h[b],a);return}else{if(h!=t&&h.j){this.ba.load(a,a);return}if(m!=t&&m.s!=t&&m.s.j){this.ba.load(m,
a);return}}if(0<a.c.length){h=a.c;j=h.length;for(k=k=0;k<j;k++)this.ub(h[k])}if(e){for(h=0;this.Xd;)h++,window.console.log("Possible thread lock avoided: "+h);this.Xd=q;j=a instanceof Yd&&a.zb instanceof Ze;b&&(g!=t&&g.j)&&(h=this.pc.get(c),h!=t&&this.a.isBuffer(h.Q)&&this.a.deleteBuffer(h.Q));h=t;g!=t&&(!b||g.j?(h=a.oc,h==t&&n(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),k=u,g.Wb&&(k=q),this.a.pixelStorei(this.a.UNPACK_FLIP_Y_WEBGL,k),
k=this.a.createTexture(),k.Vi=g.bb,this.wd.set(g.ka,k),this.a.bindTexture(this.a.TEXTURE_2D,k),g.Wb?(k=this.a.RGBA,g.jg&&(k=this.a.LUMINANCE,this.a.pixelStorei(this.a.UNPACK_ALIGNMENT,1)),this.a.texImage2D(this.a.TEXTURE_2D,0,k,g.Ye,g.Xe,0,k,this.a.UNSIGNED_BYTE,g.Wb)):this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,this.a.RGBA,this.a.UNSIGNED_BYTE,k.Vi),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),j?(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,t),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 ih(k,h.length,2),this.pc.set(c,h),g.j=u):h=this.pc.get(c));cg(this.ba,0.1);if(j)this.Xd=u,D.Da(this.g+".update"),cg(this.ba,0.9);else{if(!b||e.j||l.j){j=l.R;g=D.f.ca(j,e.nb,e.ob,e.pb);j=D.f.ca(j,e.kb,e.lb,e.mb);if(this.nd===t||g.x<this.nd)this.nd=g.x;if(this.kd===t||j.x>this.kd)this.kd=j.x;if(this.od===t||g.y<this.od)this.od=g.y;if(this.ld===t||j.y>this.ld)this.ld=j.y;if(this.pd===t||g.d<this.pd)this.pd=g.d;if(this.md===t||j.d>this.md)this.md=j.d;this.v=[(this.nd+this.kd)/
2,(this.od+this.ld)/2,(this.pd+this.md)/2];l.j=u}b&&e.j&&(l=this.qc.get(c),l!=t&&this.a.isBuffer(l.Q)&&this.a.deleteBuffer(l.Q));l=t;!b||e.j?(l=this.a.createBuffer(),e.Xa(),this.a.bindBuffer(this.a.ARRAY_BUFFER,l),this.a.bufferData(this.a.ARRAY_BUFFER,e.fa,this.a.STATIC_DRAW),l=new ih(l,e.count,3),e.j=u):l=this.qc.get(c);cg(this.ba,0.3);b&&d.j&&(g=this.qc.get(c),g!=t&&this.a.isBuffer(g.Q)&&this.a.deleteBuffer(g.Q));g=t;!b||d.j?(g=this.a.createBuffer(),d.Xa(),this.a.bindBuffer(this.a.ARRAY_BUFFER,
g),this.a.bufferData(this.a.ARRAY_BUFFER,d.fa,this.a.STATIC_DRAW),g=new ih(g,d.count,3),d.j=u):g=this.qd.get(c);cg(this.ba,0.3);b&&(f&&f.j)&&(d=this.Ec.get(c),d!=t&&this.a.isBuffer(d.Q)&&this.a.deleteBuffer(d.Q));d=t;f&&(!b||f.j?(f.length!=e.length&&n(Error("Mismatch between points and point colors.")),d=this.a.createBuffer(),f.Xa(),this.a.bindBuffer(this.a.ARRAY_BUFFER,d),this.a.bufferData(this.a.ARRAY_BUFFER,f.fa,this.a.STATIC_DRAW),d=new ih(d,f.count,3),f.j=u):d=this.Ec.get(c));cg(this.ba,0.2);
b&&(m&&m.j)&&(f=this.Pc.get(c),f!=t&&this.a.isBuffer(f.Q)&&this.a.deleteBuffer(f.Q));f=t;m&&(f=m.dd,!b||m.j?(f.length!=e.length&&n(Error("Mismatch between points and scalars.")),e=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,e),this.a.bufferData(this.a.ARRAY_BUFFER,f,this.a.STATIC_DRAW),f=new ih(e,f.length,3),m.j=u):f=this.Pc.get(c));cg(this.ba,0.1);b||this.cb.add(a);this.qc.set(c,l);this.qd.set(c,g);this.Ec.set(c,d);this.pc.set(c,h);this.Pc.set(c,f);this.Xd=a.j=u}}else a.j=u}}};
w.jk=function(a){for(var b=this.cb.G,c=0;c<b.length;++c){var e=this.get(b[c].ka);if(e&&0<=Db(a,e.ka)){var d,f=this.K,g=e.v[0],h=e.v[1],l=e.v[2];d=[this.da.clientWidth,this.da.clientHeight];var j=new Float32Array(4),k=new Float32Array(4),m=new Float32Array(16);j[0]=g;j[1]=h;j[2]=l;j[3]=1;D.f.multiply(f.ae,f.n,m);D.f.Bf(m,j,k);f=k[3];0!==f&&(k[0]/=f,k[1]/=f,k[2]/=f);g=d[0];d=d[1];k[0]=g/2*k[0]+g/2;k[1]=-d/2*k[1]+d/2;k[2]=4999.5*k[2]+5000.5;k[3]=0===f?0:1/f;d=k;k=d[0];d=d[1];if(e=e.fc)(new eh(this.w,
k,d,this.U)).u().innerHTML=e}}};w.Of=function(a,b){if(this.T.PICKING_ENABLED){this.a.bindTexture(this.a.TEXTURE_2D,t);this.dc(q,u);var c=new Uint8Array(4);this.a.readPixels(a,this.B-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);return c[0]+255*c[1]+65025*c[2]}return-1};
w.dc=function(a,b){jh.z.dc.call(this,a,b);this.a.viewport(0,0,this.N,this.B);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var c=this.cb.G,e=c.length;if(0!=e){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.tg):this.a.bindFramebuffer(this.a.FRAMEBUFFER,t);var d=this.K.ae,f=this.K.n;this.a.uniformMatrix4fv(this.xd.get("perspective"),u,d);this.a.uniformMatrix4fv(this.xd.get("view"),u,f);d=this.v;this.a.uniform3f(this.xd.get("center"),parseFloat(d[0]),parseFloat(d[1]),parseFloat(d[2]));
f=this.Ha.length;for(d=0;d<f;++d){var g=this.Ha[d];if(g instanceof M){var h=D.f.ca(this.K.n,g.t[0]+g.b[0].i[0],g.t[1]+g.b[0].i[1],g.t[2]+g.b[0].i[2]),l=D.f.ca(this.K.n,g.t[0]-g.b[0].i[0],g.t[1]-g.b[0].i[1],g.t[2]-g.b[0].i[2]),j=Math.abs(h.d-l.d),h=D.f.ca(this.K.n,g.t[0]+g.b[1].i[0],g.t[1]+g.b[1].i[1],g.t[2]+g.b[1].i[2]),l=D.f.ca(this.K.n,g.t[0]-g.b[1].i[0],g.t[1]-g.b[1].i[1],g.t[2]+-g.b[1].i[2]),k=Math.abs(h.d-l.d),h=D.f.ca(this.K.n,g.t[0]+g.b[2].i[0],g.t[1]+g.b[2].i[1],g.t[2]+g.b[2].i[2]),l=D.f.ca(this.K.n,
g.t[0]-g.b[2].i[0],g.t[1]-g.b[2].i[1],g.t[2]-g.b[2].i[2]),h=Math.max(j,k,Math.abs(h.d-l.d));h==j?Ye(g,0):h==k?Ye(g,1):Ye(g,2)}}if(this.T.ORDERING_ENABLED){j=u;f=this.Ha;g=f.length-1;do if(d=f[g],d instanceof M&&d.Ra&&-1!=d.Z){var j=d.c[d.Z].c,k=d.Z,h=D.f.ca(this.K.n,d.t[0]+d.b[k].C[0],d.t[1]+d.b[k].C[1],d.t[2]+d.b[k].C[2]),l=D.f.ca(this.K.n,d.t[0]-d.b[k].C[0],d.t[1]-d.b[k].C[1],d.t[2]-d.b[k].C[2]),h=h.d-l.d,l=Math.max(d.Dc[d.Z],Math.max(d.Dc[d.Z+4],d.Dc[d.Z+8])),m=Math.min(d.Dc[d.Z],Math.min(d.Dc[d.Z+
4],d.Dc[d.Z+8]));if(0>h*(l+m))for(h=h=0;h<d.ud[k]-1;h++)j[h]&&(j[h].wa=d.wa,j[h].za=d.b[k].Sc*h);else for(h=d.ud[k]-1;0<=h;h--)j[h]&&(j[h].wa=d.wa,j[h].za=(d.ud[k]-1)*d.b[k].Sc-d.b[k].Sc*h);j=q}while(g--);f=this.cb.G;g=f.length-1;do if(d=f[g],d.P&&!(1==d.wa||d instanceof Yd))j=d,k=d.h.Rd,d=D.f.ca(d.la.R,k[0],k[1],k[2]),d=D.f.ca(this.K.n,d.x,d.y,d.d),d=D.m.sf(this.K.jc,d),d=Math.round(1E3*d)/1E3,j.za=d,j=q;while(g--);j&&this.cb.sort()}if(f=!a&&b!=t&&b&&this.T.STATISTICS_ENABLED)var r=0;var d=this.Je,
g=d.get("vertexPosition"),j=d.get("vertexNormal"),k=d.get("vertexColor"),h=d.get("vertexTexturePos"),l=d.get("vertexScalar"),d=this.xd,m=d.get("usePicking"),s=d.get("useObjectColor"),y=d.get("objectColor"),z=d.get("useScalars"),G=d.get("scalarsReplaceMode"),F=d.get("scalarsMin"),H=d.get("scalarsMax"),B=d.get("scalarsMinColor"),E=d.get("scalarsMaxColor"),J=d.get("scalarsInterpolation"),N=d.get("scalarsMinThreshold"),Q=d.get("scalarsMaxThreshold"),R=d.get("objectOpacity"),O=d.get("labelmapOpacity"),
ea=d.get("labelmapColor"),I=d.get("useTexture"),ba=d.get("useLabelMapTexture"),da=d.get("textureSampler"),U=d.get("textureSampler2"),V=d.get("volumeLowerThreshold"),Ga=d.get("volumeUpperThreshold"),sb=d.get("volumeScalarMin"),tb=d.get("volumeScalarMax"),ub=d.get("volumeWindowLow"),jb=d.get("volumeWindowHigh"),Vc=d.get("volumeScalarMinColor"),nh=d.get("volumeScalarMaxColor"),Cg=d.get("volumeTexture"),oh=d.get("objectTransform"),ph=d.get("pointSize"),d=e;do{var fa=c[e-d];if(fa){var la=t;fa instanceof
Yd&&fa.zb&&(la=fa.zb);if(fa.P&&(!la||la.P)&&(!a||fa.rd)){var Ba=fa.ka,cb=fa.jd,ob=this.qc.get(Ba),pb=this.qd.get(Ba),$e=this.Ec.get(Ba),Lb=this.Pc.get(Ba),af=this.pc.get(Ba);this.a.bindBuffer(this.a.ARRAY_BUFFER,ob.Q);this.a.vertexAttribPointer(g,ob.Ob,this.a.FLOAT,u,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,pb.Q);this.a.vertexAttribPointer(j,pb.Ob,this.a.FLOAT,u,0,0);a?this.a.uniform1i(m,q):this.a.uniform1i(m,u);$e&&!a&&!cb?(this.a.uniform1i(s,u),this.a.bindBuffer(this.a.ARRAY_BUFFER,$e.Q),this.a.vertexAttribPointer(k,
$e.Ob,this.a.FLOAT,u,0,0)):(pb=1,cb&&!a&&(pb=0),this.a.uniform1i(s,pb),pb=fa.A,a&&(pb=[Math.floor(Ba%65025%255)/255,Math.floor(Ba%65025/255)/255,Math.floor(Ba/65025)/255]),this.a.uniform3f(y,parseFloat(pb[0]),parseFloat(pb[1]),parseFloat(pb[2])),this.a.vertexAttribPointer(k,ob.Ob,this.a.FLOAT,u,0,0));Lb&&!a&&!cb?(this.a.uniform1i(z,q),this.a.uniform1i(G,fa.H.wg),Ba=fa.H.Rb,cb=fa.H.Pb,this.a.uniform3f(B,parseFloat(Ba[0]),parseFloat(Ba[1]),parseFloat(Ba[2])),this.a.uniform3f(E,parseFloat(cb[0]),parseFloat(cb[1]),
parseFloat(cb[2])),this.a.uniform1f(N,parseFloat(fa.H.V)),this.a.uniform1f(Q,parseFloat(fa.H.W)),this.a.uniform1f(F,parseFloat(fa.H.qa)),this.a.uniform1f(H,parseFloat(fa.H.ea)),this.a.uniform1i(J,parseInt(fa.H.Ne,10)),this.a.bindBuffer(this.a.ARRAY_BUFFER,Lb.Q),this.a.vertexAttribPointer(l,Lb.Ob,this.a.FLOAT,u,0,0)):(this.a.uniform1i(z,u),this.a.vertexAttribPointer(l,ob.Ob,this.a.FLOAT,u,0,0));this.a.uniform1f(R,parseFloat(fa.wa));fa.M&&af&&!a?(this.a.uniform1i(I,q),this.a.activeTexture(this.a.TEXTURE0),
this.a.bindTexture(this.a.TEXTURE_2D,this.wd.get(fa.M.ka)),this.a.uniform1i(da,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,af.Q),this.a.vertexAttribPointer(h,af.Ob,this.a.FLOAT,u,0,0),this.a.uniform1i(Cg,u)):(this.a.uniform1i(I,u),this.a.vertexAttribPointer(h,ob.Ob,this.a.FLOAT,u,0,0));la&&(this.a.uniform1i(Cg,q),this.a.uniform1f(V,la.V),this.a.uniform1f(Ga,la.W),this.a.uniform1f(sb,la.qa),this.a.uniform1f(tb,la.ea),Ba=la.Rb,cb=la.Pb,this.a.uniform3f(Vc,parseFloat(Ba[0]),parseFloat(Ba[1]),parseFloat(Ba[2])),
this.a.uniform3f(nh,parseFloat(cb[0]),parseFloat(cb[1]),parseFloat(cb[2])),this.a.uniform1f(ub,la.ha),this.a.uniform1f(jb,la.ga),Lb=la.e,this.a.uniform1i(ba,u),la.Ra?this.a.uniform1f(R,parseFloat(la.wa)):Lb&&Lb.P&&(la=fa.e.ka,this.a.uniform1i(ba,q),this.a.activeTexture(this.a.TEXTURE1),this.a.bindTexture(this.a.TEXTURE_2D,this.wd.get(la)),this.a.uniform1i(U,1),this.a.uniform1f(O,Lb.wa),this.a.uniform4fv(ea,Lb.af)));this.a.uniformMatrix4fv(oh,u,fa.la.R);la=1;"POINTS"==fa.Ia&&(la=fa.sd);this.a.uniform1f(ph,
la);la=-1;fa.Ia==Sc?(la=this.a.TRIANGLES,f&&(r+=ob.ed/3)):"LINES"==fa.Ia?(this.a.lineWidth(fa.Lc),la=this.a.LINES):"POINTS"==fa.Ia?la=this.a.POINTS:"TRIANGLE_STRIPS"==fa.Ia?(la=this.a.TRIANGLE_STRIP,f&&(r+=ob.ed/3)):"POLYGONS"==fa.Ia&&(la=0==ob.ed%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(r+=ob.ed/3));this.a.drawArrays(la,0,ob.ed)}}}while(--d);f&&Math.round(r)}};
w.remove=function(a){jh.z.remove.call(this,a);if(0<a.c.length)for(var b=a.c,c=b.length,e=0,e=0;e<c;e++)"undefined"!=typeof b[e]&&this.remove(b[e]);b=a.ka;c=this.pc.get(b);c!=t&&this.a.isBuffer(c.Q)&&this.a.deleteBuffer(c.Q);if(a.M&&(c=this.wd.get(a.M.ka)))this.a.deleteTexture(c),this.wd.remove(a.M.ka);c=this.qc.get(b);c!=t&&this.a.isBuffer(c.Q)&&this.a.deleteBuffer(c.Q);c=this.qd.get(b);c!=t&&this.a.isBuffer(c.Q)&&this.a.deleteBuffer(c.Q);c=this.Ec.get(b);c!=t&&this.a.isBuffer(c.Q)&&this.a.deleteBuffer(c.Q);
c=this.Pc.get(b);c!=t&&this.a.isBuffer(c.Q)&&this.a.deleteBuffer(c.Q);this.qc.remove(b);this.qd.remove(b);this.Ec.remove(b);this.pc.remove(b);this.Pc.remove(b);this.cb.remove(a);return q};w.Ta=function(){this.$e=t;delete this.$e;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);jh.z.Ta.call(this)};jh.prototype.__defineGetter__("bgColor",v("bd"));jh.prototype.__defineSetter__("bgColor",ca("bd"));
jh.prototype.Yj=function(a,b,c,e,d){c!=t||(c=4);e!=t||(e=2);if(d==t){d=this.Of(a,b);if(-1==d)return t;d=this.get(d);if(!d)return t}var f=rg(this.K,2*(a/this.N)-1,2*((this.B-b)/this.B)-1,0);a=rg(this.K,2*(a/this.N)-1,2*((this.B-b)/this.B)-1,1);f[0]+=this.v[0];f[1]+=this.v[1];f[2]+=this.v[2];a[0]+=this.v[0];a[1]+=this.v[1];a[2]+=this.v[2];b=[d.h.nb,d.h.ob,d.h.pb];var g=[d.h.kb,d.h.ob,d.h.pb],h=[d.h.kb,d.h.lb,d.h.pb],l=[d.h.nb,d.h.lb,d.h.pb],j=[d.h.nb,d.h.lb,d.h.mb],k=[d.h.nb,d.h.ob,d.h.mb],m=[d.h.kb,
d.h.lb,d.h.mb],r=[d.h.kb,d.h.ob,d.h.mb];b=[D.f.ca(d.la.R,b[0],b[1],b[2]),D.f.ca(d.la.R,g[0],g[1],g[2]),D.f.ca(d.la.R,h[0],h[1],h[2]),D.f.ca(d.la.R,l[0],l[1],l[2]),D.f.ca(d.la.R,j[0],j[1],j[2]),D.f.ca(d.la.R,k[0],k[1],k[2]),D.f.ca(d.la.R,m[0],m[1],m[2]),D.f.ca(d.la.R,r[0],r[1],r[2])];var g=[Infinity,-Infinity,Infinity,-Infinity,Infinity,-Infinity],s;for(s in b)s=b[s],g=[Math.min(g[0],s.x),Math.max(g[1],s.x),Math.min(g[2],s.y),Math.max(g[3],s.y),Math.min(g[4],s.d),Math.max(g[5],s.d)];s=g;b=[];g=[];
for(h=0;6>h;h++){var l=Math.floor(h/2),j=(l+1)%3,k=(l+2)%3,r=(2+2*l)%6,y=(4+2*l)%6,z=(s[h]-f[l])*(1/a[l]);Infinity!=z&&-Infinity!=z&&(m=f[j]+a[j]*z,z=f[k]+a[k]*z,m>=s[r]&&m<=s[r+1]&&z>=s[y]&&z<=s[y+1]?(r=[],r[l]=s[h],r[j]=m,r[k]=z,b.push(r)):(r=[],r[l]=s[h],r[j]=m,r[k]=z,g.push(r)))}a=[b,g];a=a[0];if(0==a.length)return t;g=Array(2);for(s=0;2>s;s++)b=a[s],g[s]=Math.sqrt((b[0]-f[0])*(b[0]-f[0])+(b[1]-f[1])*(b[1]-f[1])+(b[2]-f[2])*(b[2]-f[2]));f=b=s=t;g[0]<g[1]?(s=a[0],b=a[1]):(s=a[1],b=a[0]);f=Math.sqrt((s[0]-
b[0])*(s[0]-b[0])+(s[1]-b[1])*(s[1]-b[1])+(s[2]-b[2])*(s[2]-b[2]));f/=c;a=s;s=[b[0]-s[0],b[1]-s[1],b[2]-s[2]];b=Math.sqrt(s[0]*s[0]+s[1]*s[1]+s[2]*s[2]);g=[s[0]/b,s[1]/b,s[2]/b];h=d.h.fa;l=h.length;for(s=0;s<f;s+=c){a=[a[0]+c*g[0],a[1]+c*g[1],a[2]+c*g[2]];for(b=0;b<l;b+=3)if(j=h[b],k=h[b+1],m=h[b+2],r=new D.m(j,k,m),r=D.f.ca(d.la.R,j,k,m),Math.sqrt((a[0]-r.x)*(a[0]-r.x)+(a[1]-r.y)*(a[1]-r.y)+(a[2]-r.d)*(a[2]-r.d))<=e)return[r.x,r.y,r.d]}return t};A("X.renderer3D",jh);
A("X.renderer3D.prototype.init",jh.prototype.Ca);A("X.renderer3D.prototype.add",jh.prototype.add);A("X.renderer3D.prototype.onShowtime",jh.prototype.mh);A("X.renderer3D.prototype.onRender",jh.prototype.kh);A("X.renderer3D.prototype.get",jh.prototype.get);A("X.renderer3D.prototype.render",jh.prototype.cc);A("X.renderer3D.prototype.destroy",jh.prototype.Ta);A("X.renderer3D.prototype.remove",jh.prototype.remove);A("X.renderer3D.prototype.resetBoundingBox",jh.prototype.bk);
A("X.renderer3D.prototype.resetViewAndRender",jh.prototype.Nd);A("X.renderer3D.prototype.pick",jh.prototype.Of);A("X.renderer3D.prototype.pick3d",jh.prototype.Yj);A("X.renderer3D.prototype.afterRender",jh.prototype.zg);A("X.renderer3D.prototype.resize",jh.prototype.Xa);A("X.renderer3D.prototype.showAllCaptions",jh.prototype.jk);function kh(){W.call(this);this.g="mesh";ya(this,new hc)}C(kh,W);A("X.mesh",kh);function lh(){W.call(this);this.g="fibers";ya(this,new hc)}C(lh,W);A("X.fibers",lh);function mh(){Hg.call(this);this.g="renderer2D";this.Qa=t;this.Fa=-1;this.Sb=[];this.mg=this.fd=this.hg=this.Vd=t;this.Rc=this.Uc=this.Qc=this.Tc=0;this.ga=this.ha=this.W=this.V=this.Ke=-1;this.ng=new Float32Array([-255,-255,-255,-255]);this.ug=q;this.xb=1}C(mh,Hg);w=mh.prototype;w.remove=function(a){mh.z.remove.call(this,a);this.cb.remove(a);return q};w.Jj=aa();w.Tj=aa();
w.Lf=function(a){mh.z.Lf.call(this,a);var b=this.Ha[0];if(b){var c="",c=0==this.Fa?"indexX":1==this.Fa?"indexY":"indexZ";b[c]=a.Y?b[c]+1:b[c]-1;eval("this.onScroll();")}};w.Uj=function(a){var b=this.Ha[0];if(b){var c=b.ga-b.ha,e=c/2,d=parseInt(c+c/15*-a.df,10);a=parseInt(e+e/15*a.Se,10);c==d&&d++;e==a&&a++;b.ha-=parseInt(e-a,10);b.ha-=parseInt(c-d,10);b.ha=Math.max(b.ha,b.qa);b.ga-=parseInt(e-a,10);b.ga+=parseInt(c-d,10);b.ga=Math.min(b.ga,b.ea);eval("this.onWindowLevel();")}};
mh.prototype.__defineGetter__("orientation",v("Qa"));mh.prototype.__defineSetter__("orientation",function(a){a=a.toUpperCase();"AXIAL"==a?(a="Z",this.Fa=2):"SAGITTAL"==a?(a="X",this.Fa=0):"CORONAL"==a&&(a="Y",this.Fa=1);"X"!=a&&("Y"!=a&&"Z"!=a)&&n(Error("Invalid orientation."));this.Qa=a});mh.prototype.__defineGetter__("radiological",v("ug"));mh.prototype.__defineGetter__("normalizedScale",v("xb"));mh.prototype.__defineGetter__("canvasWidth",function(){return this.da.width});
mh.prototype.__defineGetter__("canvasHeight",function(){return this.da.height});mh.prototype.__defineGetter__("sliceWidth",v("Tc"));mh.prototype.__defineGetter__("sliceHeight",v("Qc"));mh.prototype.__defineSetter__("radiological",ca("ug"));w=mh.prototype;
w.Ca=function(){this.Qa||n(Error("No 2D orientation set."));mh.z.Ca.call(this,"2d");this.a.fillStyle="rgba(50,50,50,0)";this.a.fillRect(0,0,this.da.width,this.da.height);this.Vd=me("canvas");this.fd=me("canvas");this.fd.style.Il="pixelated";K(this.K,yd,this.Uj.bind(this))};w.we=function(){mh.z.we.call(this);qh(this)};w.Nd=function(){mh.z.Nd.call(this);qh(this);var a=this.Ha[0];a&&(a.ga=a.ea,a.ha=a.qa)};w.update=function(a){this.ub(a);this.Ke=-1};
w.ub=function(a){mh.z.ub.call(this,a);var b=u;this.get(a.ka)&&(b=q);if(a instanceof M){var c=a.s,e=a.e,d=a.pa;if(e!=t&&e.s!=t&&e.s.j)this.ub(e);else if(d!=t&&d.s!=t&&d.s.j)this.ba.load(d,a);else{if(c!=t&&ka(c))if(a.zc!=t){if(a.zc.yf!=c.length)return}else{b=0;e=c.length;for(b=0;b<e;b++)this.ba.load(c[b],a);return}else if(c!=t&&c.j){this.ba.load(a,a);return}this.Fa="X"==this.Qa?0:"Y"==this.Qa?1:2;this.fb=a.c[this.Fa].c;d=t;d=0==this.Fa?a.indexX:1==this.Fa?a.indexY:a.indexZ;c=a.c[this.Fa].c[d].lg;e=
a.c[this.Fa].c[d].kg;this.Uc=a.c[this.Fa].c[d].Vc;this.Rc=a.c[this.Fa].c[d].Gc;this.Tc=c;this.Qc=e;d=this.Vd;d.width=c;d.height=e;var f=this.fd;f.width=c;f.height=e;this.hg=d.getContext("2d",{willReadFrequently:q});this.mg=f.getContext("2d",{willReadFrequently:q});b||(this.cb.add(a),qh(this))}}};function qh(a){var b=Math.min(a.N/(a.Tc*a.Uc),a.B/(a.Qc*a.Rc));a.K.n[14]=b}w.Kj=aa();
w.Jh=function(a,b){var c=this.Ha[0],e=this.K.n,d=t,f=this.Tc,g=this.Qc,h=t,l=t;if("Y"==this.Qa)d=this.fb[parseInt(c.indexY,10)],h=d.Vc,l=d.Gc,this.Sb[0]="rgba(255,0,0,.8)",this.Sb[1]="rgba(0,0,255,.8)";else if("Z"==this.Qa)d=this.fb[parseInt(c.indexZ,10)],h=d.Vc,l=d.Gc,this.Sb[0]="rgba(255,0,0,.8)",this.Sb[1]="rgba(0,255,0,.8)";else{d=this.fb[parseInt(c.indexX,10)];h=d.Gc;l=d.Vc;this.Sb[0]="rgba(0,255,0,.8)";this.Sb[1]="rgba(0,0,255,.8)";var j=f,f=g,g=j}var k=1*e[12],e=-1*e[13],j=[this.N/2,this.B/
2],h=f*h*this.xb,l=g*l*this.xb,m=j[0]-h/2,j=j[1]-l/2,m=m+k*this.xb,j=j+e*this.xb;return a>m&&a<m+h&&b>j&&b<j+l?(k=(a-m)/h*f,e=(b-j)/l*g,l=d.gi[4],"X"==this.Qa?(j=f-k,k=e,e=j):"Y"==this.Qa?k=f-k:"Z"==this.Qa&&(k=f-k,e=g-e),k=d.fi+k*d.Vc,e=d.Zh+e*d.Gc,k=Ac(k,e,l,1),f=Bc(),Mc(d.Sh,k,f),f=[Math.floor(f[0]),Math.floor(f[1]),Math.floor(f[2])],g=Bc(),Mc(d.Th,k,g),d=Math.round((c.b[0].i[0]*g[0]+c.b[0].i[1]*g[1]+c.b[0].i[2]*g[2]+c.b[0].Ve)/c.b[0].Sc),d>=c.b[0].q?d=c.b[0].q-1:0>d&&(d=0),k=Math.round((c.b[1].i[0]*
g[0]+c.b[1].i[1]*g[1]+c.b[1].i[2]*g[2]+c.b[1].Ve)/c.b[1].Sc),k>=c.b[1].q?k=c.b[1].q-1:0>k&&(k=0),e=Math.round((c.b[2].i[0]*g[0]+c.b[2].i[1]*g[1]+c.b[2].i[2]*g[2]+c.b[2].Ve)/c.b[2].Sc),e>=c.b[2].q?e=c.b[2].q-1:0>e&&(e=0),[[d,k,e],[f[0],f[1],f[2]],[g[0],g[1],g[2]]]):t};
w.dc=function(a,b){mh.z.dc.call(this,a,b);if(0!=this.cb.G.length){var c=this.Ha[0],e=t,e=0==this.Fa?c.indexX:1==this.Fa?c.indexY:c.indexZ,d=this.fb[parseInt(e,10)].lg,f=this.fb[parseInt(e,10)].kg;this.Uc=this.fb[parseInt(e,10)].Vc;this.Rc=this.fb[parseInt(e,10)].Gc;this.Tc=d;this.Qc=f;var g=this.N,h=this.B,l=this.K.n;this.a.save();this.a.clearRect(-g,-h,2*g,2*h);this.a.restore();this.xb=Math.max(l[14],1E-4);this.a.setTransform(this.xb,0,0,this.xb,0,0);var j=1*l[12],l=-1*l[13],k=t;c.e&&(k=c.e.af);
var m=this.fb[parseInt(e,10)],r=m.M.Wb,m=m.e,s=t;m&&(s=m.Wb);var y=this.Tc,z=this.Qc,G=this.hg,F=this.mg,H=G.getImageData(0,0,y,z),B=F.getImageData(0,0,y,z),E=H.data,J=B.data,N=E.length,Q=c.V,R=c.W,O=c.ha,ea=c.ga,I=c.Me;if(this.Ke!=e||this.V!=Q||this.W!=R||I||this.ha!=O||this.ga!=ea||k&&!ng(k,this.ng,0)){c.Me=u;I=this.Vd;I.width=d;I.height=f;I=this.fd;I.width=d;I.height=f;d=0;do{var I=[0,0,0,0],f=[0,0,0,0],ba=r[d]/255*(c.ea-c.qa)+c.qa,da=ea-O,U=da/2+O,V=0,V=ba<U-da/2?0:ba>U+da/2?255:255*(ba-(U-da/
2))/da;ba>=Q&&ba<=R&&(I=new P(c.Rb[0],c.Rb[1],c.Rb[2]),I=(new P(c.Pb[0],c.Pb[1],c.Pb[2])).scale(V).add(I.scale(255-V)),I=[Math.floor(I.x),Math.floor(I.y),Math.floor(I.d),255],m&&(-255==k[3]?f=[s[d],s[d+1],s[d+2],s[d+3]]:ng(k,s,d)&&(f=[s[d],s[d+1],s[d+2],s[d+3]])));"X"==this.Qa?(E[d]=I[0],E[d+1]=I[1],E[d+2]=I[2],E[d+3]=I[3],J[d]=f[0],J[d+1]=f[1],J[d+2]=f[2],J[d+3]=f[3]):"Y"==this.Qa?(V=Math.floor(d/(4*y)),V=4*V*y+(4*(y-1)-(d-4*V*y)),E[V]=I[0],E[V+1]=I[1],E[V+2]=I[2],E[V+3]=I[3],J[V]=f[0],J[V+1]=f[1],
J[V+2]=f[2],J[V+3]=f[3]):(V=N-1-d,E[V-3]=I[0],E[V-2]=I[1],E[V-1]=I[2],E[V]=I[3],J[V-3]=f[0],J[V-2]=f[1],J[V-1]=f[2],J[V]=f[3]);d+=4}while(d<N);G.putImageData(H,0,0);F.putImageData(B,0,0);this.Ke=e;this.V=Q;this.W=R;this.ha=O;this.ga=ea;m&&(this.ng=k)}this.a.globalAlpha=1;this.a.translate(g/2/this.xb,h/2/this.xb);"X"==this.Qa&&(this.a.rotate(0.5*Math.PI),e=j,j=l,l=-e);j=-y*this.Uc/2+j;l=-z*this.Rc/2+l;this.a.mozImageSmoothingEnabled=q;this.a.webkitImageSmoothingEnabled=q;this.a.msImageSmoothingEnabled=
q;this.a.imageSmoothingEnabled=q;this.a.drawImage(this.Vd,j,l,y*this.Uc,z*this.Rc);m&&c.e.P&&(this.a.globalAlpha=c.e.wa,this.a.mozImageSmoothingEnabled=u,this.a.webkitImageSmoothingEnabled=u,this.a.msImageSmoothingEnabled=u,this.a.imageSmoothingEnabled=u,this.a.drawImage(this.fd,j,l,y*this.Uc,z*this.Rc));if(this.T.SLICENAVIGATORS)if(this.da.style.cursor="none",this.U.Yd&&this.U.xg&&!this.U.wb){if(j=this.U.va,j=this.Jh(j[0],j[1]))c.Eb=j[0][0],c.Fb=j[0][1],c.Gb=j[0][2],c.p(u),this.onSliceNavigation(),
this.a.setTransform(1,0,0,1,0,0),this.a.beginPath(),this.a.moveTo(this.U.va[0],0),this.a.lineTo(this.U.va[0],this.U.va[1]-1),this.a.moveTo(this.U.va[0],this.U.va[1]+1),this.a.lineTo(this.U.va[0],this.B),this.a.strokeStyle=this.Sb[0],this.a.stroke(),this.a.closePath(),this.a.beginPath(),this.a.moveTo(0,this.U.va[1]),this.a.lineTo(this.U.va[0]-1,this.U.va[1]),this.a.moveTo(this.U.va[0]+1,this.U.va[1]),this.a.lineTo(this.N,this.U.va[1]),this.a.strokeStyle=this.Sb[1],this.a.stroke(),this.a.closePath(),
this.a.font="10pt Arial",this.a.textAlign="left",this.a.textBaseline="top",this.a.fillStyle="white",this.a.fillText("RAS: "+j[2][0].toFixed(2)+", "+j[2][1].toFixed(2)+", "+j[2][2].toFixed(2),0,0),y=m=l="undefined","undefined"!=typeof c.S[j[1][2].toFixed(0)]&&"undefined"!=typeof c.S[j[1][2].toFixed(0)][j[1][1].toFixed(0)]&&(l=c.S[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.J&&(m=c.e.S[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.e.cd&&(y=c.e.cd.get(m),"undefined"!=
typeof y&&(y=y[0])))),this.a.fillText("Background: "+l+" ("+j[1][0].toFixed(0)+", "+j[1][1].toFixed(0)+", "+j[1][2].toFixed(0)+")",0,15),c.J&&this.a.fillText("Labelmap: "+y+" ("+m+")",0,30)}else this.da.style.cursor="default"}};A("X.renderer2D",mh);A("X.renderer2D.prototype.init",mh.prototype.Ca);A("X.renderer2D.prototype.add",mh.prototype.add);A("X.renderer2D.prototype.onShowtime",mh.prototype.mh);A("X.renderer2D.prototype.onRender",mh.prototype.kh);A("X.renderer2D.prototype.onScroll",mh.prototype.Jj);
A("X.renderer2D.prototype.onWindowLevel",mh.prototype.Tj);A("X.renderer2D.prototype.get",mh.prototype.get);A("X.renderer2D.prototype.resetViewAndRender",mh.prototype.Nd);A("X.renderer2D.prototype.xy2ijk",mh.prototype.Jh);A("X.renderer2D.prototype.render",mh.prototype.cc);A("X.renderer2D.prototype.destroy",mh.prototype.Ta);A("X.renderer2D.prototype.onSliceNavigation",mh.prototype.Kj);A("X.renderer2D.prototype.afterRender",mh.prototype.zg);A("X.renderer2D.prototype.resize",mh.prototype.Xa);