-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathxtk_nightly.js
360 lines (360 loc) · 158 KB
/
xtk_nightly.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
/*
*
* 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 j(a){throw a;}var n=void 0,q=!0,r=null,s=!1;function aa(){return function(){}}function ca(a){return function(b){this[a]=b}}function t(a){return function(){return this[a]}}var u,fa=this;function ga(){}
function ha(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ia(a){return a!==n}function ka(a){return"array"==ha(a)}function la(a){var b=ha(a);return"array"==b||"object"==b&&"number"==typeof a.length}function ma(a){return"string"==typeof a}function v(a){return"number"==typeof a}function na(a){return"function"==ha(a)}function oa(a){var b=typeof a;return"object"==b&&a!=r||"function"==b}function pa(a){return a[qa]||(a[qa]=++ra)}var qa="closure_uid_"+(1E9*Math.random()>>>0),ra=0;
function ta(a,b,c){return a.call.apply(a.bind,arguments)}function ua(a,b,c){a||j(Error());if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function va(a,b,c){va=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ta:ua;return va.apply(r,arguments)}
function xa(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 ya=Date.now||function(){return+new Date};function C(a,b){var c=a.split("."),d=fa;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&ia(b)?d[e]=b:d=d[e]?d[e]:d[e]={}}
function D(a,b){function c(){}c.prototype=b.prototype;a.p=b.prototype;a.prototype=new c;a.prototype.constructor=a};function za(a,b,c){this.Ia=this.Ha=this.Ga=0;3==arguments.length?(this.Ga=Number(a),this.Ha=Number(b),this.Ia=Number(c)):a instanceof za?(this.Ga=Number(a.x()),this.Ha=Number(a.y()),this.Ia=Number(a.b())):(this.Ga=Number(a[0]),this.Ha=Number(a[1]),this.Ia=Number(a[2]))}
za.prototype={g:function(){return new za(this.Ga,this.Ha,this.Ia)},Jb:function(a){return this.Ga*a.x()+this.Ha*a.y()+this.Ia*a.b()},Rd:function(a,b){return Aa(this,Ba(Ca(a,this),b))},length:function(){return Math.sqrt(this.Jb(this))},$b:function(a){return new za(this.Ha*a.b()-this.Ia*a.y(),this.Ia*a.x()-this.Ga*a.b(),this.Ga*a.y()-this.Ha*a.x())},x:t("Ga"),y:t("Ha"),b:t("Ia")};function Da(a){var b=a.length();return new za(a.Ga/b,a.Ha/b,a.Ia/b)}
function Ba(a,b){return new za(a.Ga*b,a.Ha*b,a.Ia*b)}function Ca(a,b){return new za(a.Ga-b.x(),a.Ha-b.y(),a.Ia-b.b())}function Aa(a,b){return new za(a.Ga+b.x(),a.Ha+b.y(),a.Ia+b.b())}function Ea(a){return new za(-a.Ga,-a.Ha,-a.Ia)};var H=H||{};H.kj=q;H.wa=function(a){eval("X.DEV === undefined")||window.console.time(a)};H.qa=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.Wg=0;this.gj=function(){return this.Wg++}};function Fa(a,b){for(var c in b){var d=b.__lookupGetter__(c),e=b.__lookupSetter__(c);c in a||(d||e?(d&&a.__defineGetter__(c,d),e&&a.__defineSetter__(c,e)):a[c]=b[c])}}var Ha=window.Og;
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,e.concat(d.call(arguments)))}function c(){}"function"!==typeof this&&j(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var d=Array.prototype.slice,e=d.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
for(var Ja=0,Ka=["ms","moz","webkit","o"],La=0;La<Ka.length&&!window.requestAnimationFrame;++La)window.requestAnimationFrame=window[Ka[La]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[Ka[La]+"CancelAnimationFrame"]||window[Ka[La]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=Date.now(),c=Math.max(0,16-(b-Ja)),d=window.setTimeout(function(){a(b+c)},c);Ja=b+c;return d});
window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});
"slice"in ArrayBuffer.prototype||(ArrayBuffer.prototype.slice=function(a,b){a===n&&j(Error("Not enough arguments."));var c=b||this.byteLength;0>a&&(a=this.byteLength+a);0>c&&(c=this.byteLength+c);c<a&&(c=a=0);0>a&&(a=0);0>c&&(c=0);a>this.byteLength&&(a=this.byteLength);c>this.byteLength&&(c=this.byteLength);for(var d=new ArrayBuffer(c-a),e=new Uint8Array(this),f=new Uint8Array(d),g=a,h=0;g<c;++g,++h)f[h]=e[g];return d});C("$",Ha);C("Function.prototype.bind",Function.prototype.bind);
C("window.requestAnimationFrame",window.requestAnimationFrame);C("window.cancelAnimationFrame",window.cancelAnimationFrame);function Ma(a){if(!Na.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Oa,"&"));-1!=a.indexOf("<")&&(a=a.replace(Pa,"<"));-1!=a.indexOf(">")&&(a=a.replace(Qa,">"));-1!=a.indexOf('"')&&(a=a.replace(Ra,"""));return a}var Oa=/&/g,Pa=/</g,Qa=/>/g,Ra=/\"/g,Na=/[&<>\"]/;var Sa,Ta,Ua,Va,Wa,Xa,Za;function $a(){return fa.navigator?fa.navigator.userAgent:r}function ab(){return fa.navigator}Va=Ua=Ta=Sa=s;var bb;if(bb=$a()){var cb=ab();Sa=0==bb.indexOf("Opera");Ta=!Sa&&-1!=bb.indexOf("MSIE");Ua=!Sa&&-1!=bb.indexOf("WebKit");Va=!Sa&&!Ua&&"Gecko"==cb.product}var db=Sa,eb=Ta,hb=Va,ib=Ua,jb,kb=ab();jb=kb&&kb.platform||"";Wa=-1!=jb.indexOf("Mac");Xa=-1!=jb.indexOf("Win");Za=-1!=jb.indexOf("Linux");var lb=!!ab()&&-1!=(ab().appVersion||"").indexOf("X11");
function mb(){var a=fa.document;return a?a.documentMode:n}var nb;a:{var ob="",pb;if(db&&fa.opera)var qb=fa.opera.version,ob="function"==typeof qb?qb():qb;else if(hb?pb=/rv\:([^\);]+)(\)|;)/:eb?pb=/MSIE\s+([^\);]+)(\)|;)/:ib&&(pb=/WebKit\/(\S+)/),pb)var rb=pb.exec($a()),ob=rb?rb[1]:"";if(eb){var sb=mb();if(sb>parseFloat(ob)){nb=String(sb);break a}}nb=ob}var tb={};
function ub(a){var b;if(!(b=tb[a])){b=0;for(var c=String(nb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",k=RegExp("(\\d*)(\\D*)","g"),l=RegExp("(\\d*)(\\D*)","g");do{var m=k.exec(g)||["","",""],p=l.exec(h)||["","",""];if(0==m[0].length&&0==p[0].length)break;b=((0==m[1].length?0:parseInt(m[1],10))<(0==p[1].length?0:parseInt(p[1],10))?-1:(0==m[1].length?0:parseInt(m[1],
10))>(0==p[1].length?0:parseInt(p[1],10))?1:0)||((0==m[2].length)<(0==p[2].length)?-1:(0==m[2].length)>(0==p[2].length)?1:0)||(m[2]<p[2]?-1:m[2]>p[2]?1:0)}while(0==b)}b=tb[a]=0<=b}return b}var vb=fa.document,wb=!vb||!eb?n:mb()||("CSS1Compat"==vb.compatMode?parseInt(nb,10):5);function yb(){0!=zb&&(this.dk=Error().stack,pa(this))}var zb=0;function Ab(a,b){this.type=a;this.currentTarget=this.target=b}u=Ab.prototype;u.cc=s;u.defaultPrevented=s;u.Wd=q;u.stopPropagation=function(){this.cc=q};u.preventDefault=function(){this.defaultPrevented=q;this.Wd=s};var Bb=0;function Cb(){}u=Cb.prototype;u.key=0;u.dc=s;u.Ed=s;u.ia=function(a,b,c,d,e,f){na(a)?this.mg=q:a&&a.handleEvent&&na(a.handleEvent)?this.mg=s:j(Error("Invalid listener argument"));this.Kb=a;this.Fg=b;this.src=c;this.type=d;this.capture=!!e;this.Qe=f;this.Ed=s;this.key=++Bb;this.dc=s};u.handleEvent=function(a){return this.mg?this.Kb.call(this.Qe||this.src,a):this.Kb.handleEvent.call(this.Kb,a)};function Db(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}var Eb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Fb(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Eb.length;f++)c=Eb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var Gb=!eb||eb&&9<=wb,Hb=eb&&!ub("9");!ib||ub("528");hb&&ub("1.9b")||eb&&ub("8")||db&&ub("9.5")||ib&&ub("528");hb&&!ub("8")||eb&&ub("9");var Ib=Array.prototype,Jb=Ib.indexOf?function(a,b,c){return Ib.indexOf.call(a,b,c)}:function(a,b,c){c=c==r?0:0>c?Math.max(0,a.length+c):c;if(ma(a))return!ma(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Kb=Ib.forEach?function(a,b,c){Ib.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=ma(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Lb=Ib.map?function(a,b,c){return Ib.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=
ma(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Mb=Ib.some?function(a,b,c){return Ib.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=ma(a)?a.split(""):a,f=0;f<d;f++)if(f in e&&b.call(c,e[f],f,a))return q;return s};function Nb(a,b){var c=Jb(a,b);0<=c&&Ib.splice.call(a,c,1)}function Ob(a,b,c){return 2>=arguments.length?Ib.slice.call(a,b):Ib.slice.call(a,b,c)};function Pb(a){Pb[" "](a);return a}Pb[" "]=ga;function Rb(a,b){a&&this.ia(a,b)}D(Rb,Ab);u=Rb.prototype;u.target=r;u.relatedTarget=r;u.offsetX=0;u.offsetY=0;u.clientX=0;u.clientY=0;u.screenX=0;u.screenY=0;u.button=0;u.keyCode=0;u.charCode=0;u.ctrlKey=s;u.altKey=s;u.shiftKey=s;u.metaKey=s;u.Ei=s;u.Ra=r;
u.ia=function(a,b){var c=this.type=a.type;Ab.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(hb){var e;a:{try{Pb(d.nodeName);e=q;break a}catch(f){}e=s}e||(d=r)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=ib||a.offsetX!==n?a.offsetX:a.layerX;this.offsetY=ib||a.offsetY!==n?a.offsetY:a.layerY;this.clientX=a.clientX!==n?a.clientX:a.pageX;this.clientY=a.clientY!==n?a.clientY:a.pageY;this.screenX=
a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.Ei=Wa?a.metaKey:a.ctrlKey;this.state=a.state;this.Ra=a;a.defaultPrevented&&this.preventDefault();delete this.cc};u.stopPropagation=function(){Rb.p.stopPropagation.call(this);this.Ra.stopPropagation?this.Ra.stopPropagation():this.Ra.cancelBubble=q};
u.preventDefault=function(){Rb.p.preventDefault.call(this);var a=this.Ra;if(a.preventDefault)a.preventDefault();else if(a.returnValue=s,Hb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};u.Bh=t("Ra");var Sb={},Tb={},Ub={},Vb={};function L(a,b,c,d,e){if(ka(b)){for(var f=0;f<b.length;f++)L(a,b[f],c,d,e);return r}a=Wb(a,b,c,s,d,e);b=a.key;Sb[b]=a;return b}
function Wb(a,b,c,d,e,f){b||j(Error("Invalid event type"));e=!!e;var g=Tb;b in g||(g[b]={Z:0,va:0});g=g[b];e in g||(g[e]={Z:0,va:0},g.Z++);var g=g[e],h=pa(a),k;g.va++;if(g[h]){k=g[h];for(var l=0;l<k.length;l++)if(g=k[l],g.Kb==c&&g.Qe==f){if(g.dc)break;d||(k[l].Ed=s);return k[l]}}else k=g[h]=[],g.Z++;var m=Xb,p=Gb?function(a){return m.call(p.src,p.Kb,a)}:function(a){a=m.call(p.src,p.Kb,a);if(!a)return a},l=p,g=new Cb;g.ia(c,l,a,b,e,f);g.Ed=d;l.src=a;l.Kb=g;k.push(g);Ub[h]||(Ub[h]=[]);Ub[h].push(g);
a.addEventListener?(a==fa||!a.Zf)&&a.addEventListener(b,l,e):a.attachEvent(b in Vb?Vb[b]:Vb[b]="on"+b,l);return g}function Yb(a,b,c,d,e){if(ka(b))for(var f=0;f<b.length;f++)Yb(a,b[f],c,d,e);else a=Wb(a,b,c,q,d,e),Sb[a.key]=a}function Zb(a,b,c,d,e){if(ka(b))for(var f=0;f<b.length;f++)Zb(a,b[f],c,d,e);else{d=!!d;a:{f=Tb;if(b in f&&(f=f[b],d in f&&(f=f[d],a=pa(a),f[a]))){a=f[a];break a}a=r}if(a)for(f=0;f<a.length;f++)if(a[f].Kb==c&&a[f].capture==d&&a[f].Qe==e){$b(a[f].key);break}}}
function $b(a){var b=Sb[a];if(!b||b.dc)return s;var c=b.src,d=b.type,e=b.Fg,f=b.capture;c.removeEventListener?(c==fa||!c.Zf)&&c.removeEventListener(d,e,f):c.detachEvent&&c.detachEvent(d in Vb?Vb[d]:Vb[d]="on"+d,e);c=pa(c);Ub[c]&&(e=Ub[c],Nb(e,b),0==e.length&&delete Ub[c]);b.dc=q;if(b=Tb[d][f][c])b.ug=q,ac(d,f,c,b);delete Sb[a];return q}
function ac(a,b,c,d){if(!d.Td&&d.ug){for(var e=0,f=0;e<d.length;e++)d[e].dc?d[e].Fg.src=r:(e!=f&&(d[f]=d[e]),f++);d.length=f;d.ug=s;0==f&&(delete Tb[a][b][c],Tb[a][b].Z--,0==Tb[a][b].Z&&(delete Tb[a][b],Tb[a].Z--),0==Tb[a].Z&&delete Tb[a])}}function bc(a,b,c,d,e){var f=1;b=pa(b);if(a[b]){var g=--a.va,h=a[b];h.Td?h.Td++:h.Td=1;try{for(var k=h.length,l=0;l<k;l++){var m=h[l];m&&!m.dc&&(f&=cc(m,e)!==s)}}finally{a.va=Math.max(g,a.va),h.Td--,ac(c,d,b,h)}}return Boolean(f)}
function cc(a,b){a.Ed&&$b(a.key);return a.handleEvent(b)}
function Xb(a,b){if(a.dc)return q;var c=a.type,d=Tb;if(!(c in d))return q;var d=d[c],e,f;if(!Gb){var g;if(!(g=b))a:{g=["window","event"];for(var h=fa;e=g.shift();)if(h[e]!=r)h=h[e];else{g=r;break a}g=h}e=g;g=q in d;h=s in d;if(g){if(0>e.keyCode||e.returnValue!=n)return q;a:{var k=s;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(l){k=q}if(k||e.returnValue==n)e.returnValue=q}}k=new Rb;k.ia(e,this);e=q;try{if(g){for(var m=[],p=k.currentTarget;p;p=p.parentNode)m.push(p);f=d[q];f.va=f.Z;for(var x=m.length-
1;!k.cc&&0<=x&&f.va;x--)k.currentTarget=m[x],e&=bc(f,m[x],c,q,k);if(h){f=d[s];f.va=f.Z;for(x=0;!k.cc&&x<m.length&&f.va;x++)k.currentTarget=m[x],e&=bc(f,m[x],c,s,k)}}else e=cc(a,k)}finally{m&&(m.length=0)}return e}c=new Rb(b,this);return e=cc(a,c)}var dc=0;function ec(a){return a+"_"+dc++};function fc(){yb.call(this)}D(fc,yb);u=fc.prototype;u.Zf=q;u.df=r;u.hf=ca("df");u.addEventListener=function(a,b,c,d){L(this,a,b,c,d)};u.removeEventListener=function(a,b,c,d){Zb(this,a,b,c,d)};
u.dispatchEvent=function(a){var b=a.type||a,c=Tb;if(b in c){if(ma(a))a=new Ab(a,this);else if(a instanceof Ab)a.target=a.target||this;else{var d=a;a=new Ab(b,this);Fb(a,d)}var d=1,e,c=c[b],b=q in c,f;if(b){e=[];for(f=this;f;f=f.df)e.push(f);f=c[q];f.va=f.Z;for(var g=e.length-1;!a.cc&&0<=g&&f.va;g--)a.currentTarget=e[g],d&=bc(f,e[g],a.type,q,a)&&a.Wd!=s}if(s in c)if(f=c[s],f.va=f.Z,b)for(g=0;!a.cc&&g<e.length&&f.va;g++)a.currentTarget=e[g],d&=bc(f,e[g],a.type,s,a)&&a.Wd!=s;else for(e=this;!a.cc&&e&&
f.va;e=e.df)a.currentTarget=e,d&=bc(f,e,a.type,s,a)&&a.Wd!=s;a=Boolean(d)}else a=q;return a};function M(){yb.call(this);this.c="base";this.fa=window["X.counter"].gj();this.e=s}D(M,fc);M.prototype.__defineGetter__("classname",t("c"));M.prototype.__defineGetter__("id",t("fa"));C("X.base",M);function gc(a,b){this.Fa=new za(a);this.da=new za(b)}gc.prototype={g:function(){return new gc(this.Fa.g(),this.da.g())},bc:function(){this.da=Ea(this.da)}};function hc(a,b){this.da=a;this.kd=b}hc.prototype={g:function(){return new hc(this.da.g(),this.kd)},bc:function(){this.da=Ea(this.da);this.kd=-this.kd}};function ic(a,b){this.ob=a;this.ce=b;var c=a[0].Fa,d=a[2].Fa,d=Da(Ca(a[1].Fa,c).$b(Ca(d,c)));this.Ea=new hc(d,d.Jb(c))}ic.prototype={g:function(){var a=this.ob.map(function(a){return a.g()});return new ic(a,this.ce)},bc:function(){this.ob.reverse().map(function(a){a.bc()});this.Ea.bc()}};
function jc(a,b,c,d,e,f){for(var g=0,h=[],k=0;k<a.ob.length;k++){var l=b.da.Jb(a.ob[k].Fa)-b.kd,l=-1E-5>l?2:1E-5<l?1:0,g=g|l;h.push(l)}switch(g){case 0:(0<b.da.Jb(a.Ea.da)?c:d).push(a);break;case 1:e.push(a);break;case 2:f.push(a);break;case 3:c=[];d=[];for(k=0;k<a.ob.length;k++){var m=(k+1)%a.ob.length,l=h[k],p=h[m],g=a.ob[k],m=a.ob[m];2!=l&&c.push(g);1!=l&&d.push(2!=l?g.g():g);3==(l|p)&&(l=(b.kd-b.da.Jb(g.Fa))/b.da.Jb(Ca(m.Fa,g.Fa)),l=new gc(g.Fa.Rd(m.Fa,l),g.da.Rd(m.da,l)),c.push(l),d.push(l.g()))}3<=
c.length&&e.push(new ic(c,a.ce));3<=d.length&&f.push(new ic(d,a.ce))}};function kc(a){this.ga=this.ha=this.Ea=r;this.F=[];a&&mc(this,a)}kc.prototype={g:function(){var a=new kc,b=this.Ea&&this.Ea.g();a.Ea=b;b=this.ha&&this.ha.g();a.ha=b;b=this.ga&&this.ga.g();a.ga=b;a.ae(this.F.map(function(a){return a.g()}));return a},K:function(){for(var a=0;a<this.F.length;a++)this.F[a].bc();this.Ea.bc();this.ha&&this.ha.K();this.ga&&this.ga.K();a=this.ha;this.ha=this.ga;this.ga=a},ae:ca("F")};
function mc(a,b){if(b.length){a.Ea||(a.Ea=b[0].Ea.g());for(var c=[],d=[],e=0;e<b.length;e++)jc(b[e],a.Ea,a.F,a.F,c,d);c.length&&(a.ha||(a.ha=new kc),mc(a.ha,c));d.length&&(a.ga||(a.ga=new kc),mc(a.ga,d))}}function nc(a){var b=a.F.slice();a.ha&&(b=b.concat(nc(a.ha)));a.ga&&(b=b.concat(nc(a.ga)));return b}function oc(a,b){a.F=pc(b,a.F);a.ha&&oc(a.ha,b);a.ga&&oc(a.ga,b)}
function pc(a,b){if(!a.Ea)return b.slice();for(var c=[],d=[],e=0;e<b.length;e++)jc(b[e],a.Ea,c,d,c,d);a.ha&&(c=pc(a.ha,c));d=a.ga?pc(a.ga,d):[];return c.concat(d)};function qc(){this.F=[]}function rc(a){var b=new qc;b.ae(a);return b}
qc.prototype={g:function(){var a=new qc;a.ae(this.F.map(function(a){return a.g()}));return a},pf:function(a){var b=new kc(this.g().F);a=new kc(a.g().F);oc(b,a);oc(a,b);a.K();oc(a,b);a.K();mc(b,nc(a));return rc(nc(b))},pa:function(a){var b=new kc(this.g().F);a=new kc(a.g().F);b.K();oc(b,a);oc(a,b);a.K();oc(a,b);a.K();mc(b,nc(a));b.K();return rc(nc(b))},Se:function(a){var b=new kc(this.g().F);a=new kc(a.g().F);b.K();oc(a,b);a.K();oc(b,a);oc(a,b);mc(b,nc(a));b.K();return rc(nc(b))},inverse:function(){var a=
this.g();a.F.map(function(a){a.bc()});return a},ae:ca("F")};function sc(){M.call(this);this.c="indexer";this.Ce=[];this.Zj=[];this.xb={}}D(sc,M);sc.prototype.add=function(a){a==r&&j(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.xb||(this.xb[b]=this.Ce.length,this.Ce.push(a));return this.xb[b]};sc.prototype.unique=t("Ce");function tc(a){M.call(this);this.c="file";this.ud=a;this.e=q}D(tc,M);function uc(){this.Va=this.m=r}uc.prototype.__defineSetter__("file",function(a){if(a==r||ka(a)&&0==a.length)this.m=r;else{if(ka(a)){if(1==a.length){this.m=new tc(a[0]);return}this.m=Lb(a,function(a){var c=new Q;c.m=new tc(a);return c})}else this.m=new tc(a);this.Va=r}});uc.prototype.__defineGetter__("file",function(){return!this.m?"":ka(this.m)?this.m.map(function(a){return a.m.ud}):this.m.ud});
uc.prototype.__defineGetter__("filedata",function(){return ka(this.m)?this.m.map(function(a){return a.Va}):this.Va});uc.prototype.__defineSetter__("filedata",function(a){if(a==r||ka(a)&&0==a.length)this.Va=r;if(ka(a))if(1==a.length)this.Va=a[0];else{var b=this.m.length,c;for(c=0;c<b;c++)this.m[c].Va=a[c]}else this.Va=a});function vc(a){if("function"==typeof a.bd)return a.bd();if(ma(a))return a.split("");if(la(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Db(a)};function wc(a,b){this.z={};this.C=[];var c=arguments.length;if(1<c){c%2&&j(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.Ee(a)}u=wc.prototype;u.Z=0;u.rf=0;u.Kd=t("Z");u.bd=function(){xc(this);for(var a=[],b=0;b<this.C.length;b++)a.push(this.z[this.C[b]]);return a};function yc(a){for(var b=0;b<a.C.length;b++){var c=a.C[b];if(zc(a.z,c)&&a.z[c]==s)return q}return s}u.clear=function(){this.z={};this.rf=this.Z=this.C.length=0};
u.remove=function(a){return zc(this.z,a)?(delete this.z[a],this.Z--,this.rf++,this.C.length>2*this.Z&&xc(this),q):s};function xc(a){if(a.Z!=a.C.length){for(var b=0,c=0;b<a.C.length;){var d=a.C[b];zc(a.z,d)&&(a.C[c++]=d);b++}a.C.length=c}if(a.Z!=a.C.length){for(var e={},c=b=0;b<a.C.length;)d=a.C[b],zc(e,d)||(a.C[c++]=d,e[d]=1),b++;a.C.length=c}}u.get=function(a,b){return zc(this.z,a)?this.z[a]:b};u.set=function(a,b){zc(this.z,a)||(this.Z++,this.C.push(a),this.rf++);this.z[a]=b};
u.Ee=function(a){var b;if(a instanceof wc)xc(a),b=a.C.concat(),a=a.bd();else{b=[];var c=0,d;for(d in a)b[c++]=d;a=Db(a)}for(c=0;c<b.length;c++)this.set(b[c],a[c])};u.g=function(){return new wc(this)};u.Ig=function(){for(var a=new wc,b=0;b<this.C.length;b++){var c=this.C[b];a.set(this.z[c],c)}return a};function zc(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Ac(){M.call(this);this.c="colortable";this.xb=new wc;Fa(this,new uc)}D(Ac,M);Ac.prototype.add=function(a,b,c,d,e,f){(!v(a)||!v(c)||!v(d)||!v(e)||!v(f))&&j(Error("Invalid color table entry."));this.xb.set(a,[b,c,d,e,f]);this.e=q};Ac.prototype.get=function(a){return this.xb.get(a)};C("X.colortable.prototype.get",Ac.prototype.get);function Bc(a,b,c){this.x=ia(a)?a:0;this.y=ia(b)?b:0;this.b=ia(c)?c:0}Bc.prototype.g=function(){return new Bc(this.x,this.y,this.b)};function R(a,b,c){this.x=a;this.y=b;this.b=c}D(R,Bc);u=R.prototype;u.g=function(){return new R(this.x,this.y,this.b)};u.kb=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.b*this.b)};u.scale=function(a){this.x*=a;this.y*=a;this.b*=a;return this};u.K=function(){this.x=-this.x;this.y=-this.y;this.b=-this.b;return this};u.normalize=function(){return this.scale(1/this.kb())};u.add=function(a){this.x+=a.x;this.y+=a.y;this.b+=a.b;return this};
u.pa=function(a){this.x-=a.x;this.y-=a.y;this.b-=a.b;return this};function Cc(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.b-b.b;return c*c+d*d+e*e}function Dc(a,b){return new R(a.x+b.x,a.y+b.y,a.b+b.b)}function Ec(a,b){return new R(a.y*b.b-a.b*b.y,a.b*b.x-a.x*b.b,a.x*b.y-a.y*b.x)};H.f=R;u=H.f.prototype;u.g=R.prototype.g;u.kb=R.prototype.kb;u.scale=R.prototype.scale;u.K=R.prototype.K;u.add=R.prototype.add;u.pa=R.prototype.pa;u.normalize=function(){var a=this.kb();return 0==a?this.scale(0):this.scale(1/a)};H.f.Jb=function(a,b){return a.x*b.x+a.y*b.y+a.b*b.b};H.f.$b=Ec;H.f.Hb=function(a,b){var c=a.x-b.x,d=a.y-b.y,e=a.b-b.b;return Math.sqrt(c*c+d*d+e*e)};H.f.Rd=function(a,b,c){return new R(a.x+c*(b.x-a.x),a.y+c*(b.y-a.y),a.b+c*(b.b-a.b))};H.f.prototype.__defineGetter__("xx",t("x"));
H.f.prototype.__defineGetter__("yy",t("y"));H.f.prototype.__defineGetter__("zz",t("b"));C("X.vector",H.f);C("X.vector.prototype.clone",H.f.prototype.g);C("X.vector.prototype.magnitude",H.f.prototype.kb);C("X.vector.prototype.scale",H.f.prototype.scale);C("X.vector.prototype.invert",H.f.prototype.K);C("X.vector.prototype.normalize",H.f.prototype.normalize);C("X.vector.prototype.add",H.f.prototype.add);C("X.vector.prototype.subtract",H.f.prototype.pa);C("X.vector.dot",H.f.Jb);C("X.vector.cross",H.f.$b);
C("X.vector.distance",H.f.Hb);C("X.vector.lerp",H.f.Rd);function Fc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Fc.prototype.BYTES_PER_ELEMENT=8;Fc.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]};Fc.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{Fc.BYTES_PER_ELEMENT=8}catch(Gc){}Fc.prototype.BYTES_PER_ELEMENT=Fc.prototype.BYTES_PER_ELEMENT;Fc.prototype.set=Fc.prototype.set;Fc.prototype.toString=Fc.prototype.toString;C("Float64Array",Fc)};function Hc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Hc.prototype.BYTES_PER_ELEMENT=4;Hc.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]};Hc.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(Hc.BYTES_PER_ELEMENT=4,Hc.prototype.BYTES_PER_ELEMENT=Hc.prototype.BYTES_PER_ELEMENT,Hc.prototype.set=Hc.prototype.set,Hc.prototype.toString=Hc.prototype.toString,C("Float32Array",Hc));function Ic(a,b,c,d,e,f,g,h,k,l,m,p,x,w,y,z,E){a[0]=b;a[1]=c;a[2]=d;a[3]=e;a[4]=f;a[5]=g;a[6]=h;a[7]=k;a[8]=l;a[9]=m;a[10]=p;a[11]=x;a[12]=w;a[13]=y;a[14]=z;a[15]=E;return a}function Jc(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 Kc(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 Lc(a,b,c,d,e){a[b]=c;a[b+4]=d;a[b+8]=e;a[b+12]=0}function Mc(a,b,c){a[b]=c[0];a[b+4]=c[1];a[b+8]=c[2];a[b+12]=c[3]}
function Nc(a,b,c){c[0]=a[b];c[1]=a[b+4];c[2]=a[b+8];c[3]=a[b+12]}function Oc(a,b,c,d){var e=a[1]*b+a[5]*c+a[9]*d+a[13],f=a[2]*b+a[6]*c+a[10]*d+a[14],g=a[3]*b+a[7]*c+a[11]*d+a[15];a[12]=a[0]*b+a[4]*c+a[8]*d+a[12];a[13]=e;a[14]=f;a[15]=g;return a}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);H.d={};H.d.qg=function(a,b,c,d){c=c.pa(b);c.normalize();d=H.f.$b(c,d);d.normalize();var e=H.f.$b(d,c);e.normalize();c.K();Lc(a,0,d.x,d.y,d.b);Lc(a,1,e.x,e.y,e.b);Lc(a,2,c.x,c.y,c.b);Oc(a,-b.x,-b.y,-b.b);return a};H.d.Sa=function(a,b,c,d){var e=1/(b*a[3]+c*a[7]+d*a[11]+a[15]);return new H.f((b*a[0]+c*a[4]+d*a[8]+a[12])*e,(b*a[1]+c*a[5]+d*a[9]+a[13])*e,(b*a[2]+c*a[6]+d*a[10]+a[14])*e)};H.d.bj=function(a,b,c){var d=new Float32Array(4),e=new Float32Array(4);Nc(a,b,d);Nc(a,c,e);Mc(a,b,e);Mc(a,c,d);return a};
H.d.aj=function(a,b,c){var d=new Float32Array(4),e=new Float32Array(4);Kc(a,b,d);Kc(a,c,e);Jc(a,b,e);Jc(a,c,d);return a};H.d.cd=function(){var a=new Float32Array(16);a[0]=a[5]=a[10]=a[15]=1;return a};H.d.g=function(a){var b=new Float32Array(16);b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};
H.d.Ig=function(a,b){if(b==a){var c=a[1],d=a[2],e=a[3],f=a[6],g=a[7],h=a[11];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=c;b[6]=a[9];b[7]=a[13];b[8]=d;b[9]=f;b[11]=a[14];b[12]=e;b[13]=g;b[14]=h}else b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15];return b};
H.d.qh=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],k=a[7],l=a[8],m=a[9],p=a[10],x=a[11],w=a[12],y=a[13],z=a[14];a=a[15];return(b*g-c*f)*(p*a-x*z)-(b*h-d*f)*(m*a-x*y)+(b*k-e*f)*(m*z-p*y)+(c*h-d*g)*(l*a-x*w)-(c*k-e*g)*(l*z-p*w)+(d*k-e*h)*(l*y-m*w)};
H.d.K=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],k=a[6],l=a[7],m=a[8],p=a[9],x=a[10],w=a[11],y=a[12],z=a[13],E=a[14],G=a[15],B=c*h-d*g,F=c*k-e*g,I=c*l-f*g,J=d*k-e*h,T=d*l-f*h,K=e*l-f*k,S=m*z-p*y,P=m*E-x*y,N=m*G-w*y,O=p*E-x*z,ba=p*G-w*z,ea=x*G-w*E,A=B*ea-F*ba+I*O+J*N-T*P+K*S;if(0==A)return s;A=1/A;b[0]=(h*ea-k*ba+l*O)*A;b[1]=(-d*ea+e*ba-f*O)*A;b[2]=(z*K-E*T+G*J)*A;b[3]=(-p*K+x*T-w*J)*A;b[4]=(-g*ea+k*N-l*P)*A;b[5]=(c*ea-e*N+f*P)*A;b[6]=(-y*K+E*I-G*F)*A;b[7]=(m*K-x*I+w*F)*A;b[8]=(g*
ba-h*N+l*S)*A;b[9]=(-c*ba+d*N-f*S)*A;b[10]=(y*T-z*I+G*B)*A;b[11]=(-m*T+p*I-w*B)*A;b[12]=(-g*O+h*P-k*S)*A;b[13]=(c*O-d*P+e*S)*A;b[14]=(-y*J+z*F-E*B)*A;b[15]=(m*J-p*F+x*B)*A;return q};H.d.Ue=function(a,b,c,d,e){var f=b/2;b=e-d;var g=Math.sin(f);if(0==b||0==g||0==c)return a;f=Math.cos(f)/g;return Ic(a,f/c,0,0,0,0,f,0,0,0,0,-(e+d)/b,-1,0,0,-(2*d*e)/b,0)};H.d.Wh=function(a,b,c,d,e,f,g){return Ic(a,2*f/(c-b),0,0,0,0,2*f/(e-d),0,0,(c+b)/(c-b),(e+d)/(e-d),-(g+f)/(g-f),-1,0,0,-(2*g*f)/(g-f),0)};
H.d.Xh=function(a,b,c,d,e,f,g){return Ic(a,2/(c-b),0,0,0,0,2/(e-d),0,0,0,0,-2/(g-f),0,-(c+b)/(c-b),-(e+d)/(e-d),-(g+f)/(g-f),1)};
H.d.multiply=function(a,b,c){var d=a[0],e=a[1],f=a[2],g=a[3],h=a[4],k=a[5],l=a[6],m=a[7],p=a[8],x=a[9],w=a[10],y=a[11],z=a[12],E=a[13],G=a[14];a=a[15];var B=b[0],F=b[1],I=b[2],J=b[3],T=b[4],K=b[5],S=b[6],P=b[7],N=b[8],O=b[9],ba=b[10],ea=b[11],A=b[12],Y=b[13],Z=b[14];b=b[15];c[0]=d*B+h*F+p*I+z*J;c[1]=e*B+k*F+x*I+E*J;c[2]=f*B+l*F+w*I+G*J;c[3]=g*B+m*F+y*I+a*J;c[4]=d*T+h*K+p*S+z*P;c[5]=e*T+k*K+x*S+E*P;c[6]=f*T+l*K+w*S+G*P;c[7]=g*T+m*K+y*S+a*P;c[8]=d*N+h*O+p*ba+z*ea;c[9]=e*N+k*O+x*ba+E*ea;c[10]=f*N+l*
O+w*ba+G*ea;c[11]=g*N+m*O+y*ba+a*ea;c[12]=d*A+h*Y+p*Z+z*b;c[13]=e*A+k*Y+x*Z+E*b;c[14]=f*A+l*Y+w*Z+G*b;c[15]=g*A+m*Y+y*Z+a*b;return c};H.d.translate=Oc;H.d.scale=function(a,b,c,d){return Ic(a,a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*c,a[5]*c,a[6]*c,a[7]*c,a[8]*d,a[9]*d,a[10]*d,a[11]*d,a[12],a[13],a[14],a[15])};
H.d.rotate=function(a,b,c,d,e){var f=a[0],g=a[1],h=a[2],k=a[3],l=a[4],m=a[5],p=a[6],x=a[7],w=a[8],y=a[9],z=a[10],E=a[11],G=Math.cos(b),B=Math.sin(b),F=1-G;b=c*c*F+G;var I=c*d*F+e*B,J=c*e*F-d*B,T=c*d*F-e*B,K=d*d*F+G,S=d*e*F+c*B,P=c*e*F+d*B;c=d*e*F-c*B;e=e*e*F+G;return Ic(a,f*b+l*I+w*J,g*b+m*I+y*J,h*b+p*I+z*J,k*b+x*I+E*J,f*T+l*K+w*S,g*T+m*K+y*S,h*T+p*K+z*S,k*T+x*K+E*S,f*P+l*c+w*e,g*P+m*c+y*e,h*P+p*c+z*e,k*P+x*c+E*e,a[12],a[13],a[14],a[15])};
H.d.Xd=function(a,b){var c=a[4],d=a[5],e=a[6],f=a[7],g=a[8],h=a[9],k=a[10],l=a[11],m=Math.cos(b),p=Math.sin(b);a[4]=c*m+g*p;a[5]=d*m+h*p;a[6]=e*m+k*p;a[7]=f*m+l*p;a[8]=c*-p+g*m;a[9]=d*-p+h*m;a[10]=e*-p+k*m;a[11]=f*-p+l*m;return a};H.d.Yd=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[8],h=a[9],k=a[10],l=a[11],m=Math.cos(b),p=Math.sin(b);a[0]=c*m+g*-p;a[1]=d*m+h*-p;a[2]=e*m+k*-p;a[3]=f*m+l*-p;a[8]=c*p+g*m;a[9]=d*p+h*m;a[10]=e*p+k*m;a[11]=f*p+l*m;return a};
H.d.Zd=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],k=a[6],l=a[7],m=Math.cos(b),p=Math.sin(b);a[0]=c*m+g*p;a[1]=d*m+h*p;a[2]=e*m+k*p;a[3]=f*m+l*p;a[4]=c*-p+g*m;a[5]=d*-p+h*m;a[6]=e*-p+k*m;a[7]=f*-p+l*m;return a};C("X.matrix.identity",H.d.cd);C("X.matrix.clone",H.d.g);C("X.matrix.transpose",H.d.Ig);C("X.matrix.determinant",H.d.qh);C("X.matrix.invert",H.d.K);C("X.matrix.multiply",H.d.multiply);C("X.matrix.multiplyByVector",H.d.Sa);C("X.matrix.makePerspective",H.d.Ue);
C("X.matrix.makeFrustum",H.d.Wh);C("X.matrix.makeOrtho",H.d.Xh);C("X.matrix.makeLookAt",H.d.qg);C("X.matrix.translate",H.d.translate);C("X.matrix.scale",H.d.scale);C("X.matrix.rotate",H.d.rotate);C("X.matrix.rotateX",H.d.Xd);C("X.matrix.rotateY",H.d.Yd);C("X.matrix.rotateZ",H.d.Zd);C("X.matrix.swapRows",H.d.bj);C("X.matrix.swapCols",H.d.aj);function Pc(){M.call(this);this.c="transform";this.ma=H.d.cd()}D(Pc,M);Pc.prototype.__defineGetter__("matrix",t("ma"));Pc.prototype.__defineSetter__("matrix",function(a){(a==r||!(a instanceof Float32Array))&&j(Error("Invalid matrix."));this.ma=a;this.l()});u=Pc.prototype;u.Xd=function(a){(!v(a)||-360>a||360<a)&&j(Error("Invalid angle."));H.d.Xd(this.ma,a*Math.PI/180);this.l()};u.Yd=function(a){(!v(a)||-360>a||360<a)&&j(Error("Invalid angle."));H.d.Yd(this.ma,a*Math.PI/180);this.l()};
u.Zd=function(a){(!v(a)||-360>a||360<a)&&j(Error("Invalid angle."));H.d.Zd(this.ma,a*Math.PI/180);this.l()};u.dj=function(a){v(a)||j(Error("Invalid distance."));H.d.translate(this.ma,a,0,0);this.l()};u.ej=function(a){v(a)||j(Error("Invalid distance."));H.d.translate(this.ma,0,a,0);this.l()};u.fj=function(a){v(a)||j(Error("Invalid distance."));H.d.translate(this.ma,0,0,a);this.l()};function Qc(a,b,c){a.ma[b+4*c]*=-1;a.l()}u.xh=function(){Qc(this,0,0)};u.yh=function(){Qc(this,1,1)};
u.zh=function(){Qc(this,2,2)};u.l=function(){this.e=q};C("X.transform",Pc);C("X.transform.prototype.rotateX",Pc.prototype.Xd);C("X.transform.prototype.rotateY",Pc.prototype.Yd);C("X.transform.prototype.rotateZ",Pc.prototype.Zd);C("X.transform.prototype.translateX",Pc.prototype.dj);C("X.transform.prototype.translateY",Pc.prototype.ej);C("X.transform.prototype.translateZ",Pc.prototype.fj);C("X.transform.prototype.flipX",Pc.prototype.xh);C("X.transform.prototype.flipY",Pc.prototype.yh);
C("X.transform.prototype.flipZ",Pc.prototype.zh);C("X.transform.prototype.modified",Pc.prototype.l);function Rc(){M.call(this);this.c="texture";this.Xb=this.rb=this.m=r;this.Jf=this.Kf=0;Fa(this,new uc)}D(Rc,M);C("X.texture",Rc);function U(a,b){M.call(this);this.c="triplets";this.Sb=Infinity;this.Pb=-Infinity;this.Tb=Infinity;this.Qb=-Infinity;this.Ub=Infinity;this.Rb=-Infinity;this.ld=[0,0,0];this.yf=q;this.H=0;this.P=new Float32Array(a);b!=r&&(this.P=b.P.subarray(0,b.P.length),this.H=this.P.length,this.Sb=b.Sb,this.Pb=b.Pb,this.Tb=b.Tb,this.Qb=b.Qb,this.Ub=b.Ub,this.Rb=b.Rb,this.ld=b.ld.slice(),this.yf=s)}D(U,M);u=U.prototype;
u.add=function(a,b,c){this.Sb=Math.min(this.Sb,a);this.Pb=Math.max(this.Pb,a);this.Tb=Math.min(this.Tb,b);this.Qb=Math.max(this.Qb,b);this.Ub=Math.min(this.Ub,c);this.Rb=Math.max(this.Rb,c);this.ld=[(this.Sb+this.Pb)/2,(this.Tb+this.Qb)/2,(this.Ub+this.Rb)/2];this.yf=s;this.e=q;this.P[this.H++]=a;this.P[this.H++]=b;this.P[this.H++]=c;return this.H/3};u.mb=function(){if(this.H!=this.P.length){var a=new Float32Array(this.H);a.set(this.P.subarray(0,this.H));this.P=a}};
u.get=function(a){a*=3;return[this.P[a],this.P[a+1],this.P[a+2]]};u.remove=function(){j(Error("Not implemented."))};u.clear=function(){this.P=new Float32Array(this.P.length);this.e=q};U.prototype.__defineGetter__("count",function(){this.mb();return this.P.length/3});U.prototype.__defineGetter__("length",function(){this.mb();return this.P.length});C("X.triplets",U);C("X.triplets.prototype.add",U.prototype.add);C("X.triplets.prototype.resize",U.prototype.mb);C("X.triplets.prototype.get",U.prototype.get);
C("X.triplets.prototype.remove",U.prototype.remove);C("X.triplets.prototype.clear",U.prototype.clear);function Sc(){this.na=Tc;this.Yb=new Pc;this.Mb=[1,1,1];this.wc=this.Aa=this.$=this.k=this.j=r;this.pc=[];this.ta=q;this.nc=this.Sc=1;this.hc=r;this.Kc=s;this.ca=1;this.N=0;this.Rc=q}var Tc="TRIANGLES";Sc.prototype.__defineSetter__("type",function(a){return this.na=a});Sc.prototype.__defineGetter__("type",t("na"));Sc.prototype.__defineGetter__("texture",function(){this.Aa||(this.Aa=new Rc);return this.Aa});Sc.prototype.__defineGetter__("transform",t("Yb"));Sc.prototype.__defineGetter__("points",t("j"));
Sc.prototype.__defineSetter__("points",ca("j"));Sc.prototype.__defineGetter__("normals",t("k"));Sc.prototype.__defineSetter__("normals",ca("k"));Sc.prototype.__defineGetter__("colors",t("$"));Sc.prototype.__defineSetter__("colors",ca("$"));Sc.prototype.__defineGetter__("color",t("Mb"));Sc.prototype.__defineSetter__("color",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid color."));for(var b=this.h,c=b.length,d=0,d=0;d<c;d++)b[d].color=a;this.Mb=a;this.e=q});
Sc.prototype.__defineGetter__("opacity",t("ca"));Sc.prototype.__defineSetter__("opacity",function(a){(!v(a)||1<a||0>a)&&j(Error("Invalid opacity."));for(var b=this.h,c=b.length,d=0,d=0;d<c;d++)b[d].opacity=a;this.ca=a;this.e=q});Sc.prototype.__defineGetter__("caption",t("hc"));Sc.prototype.__defineSetter__("caption",function(a){this.hc=a;this.e=q});Sc.prototype.__defineGetter__("visible",t("ta"));
Sc.prototype.__defineSetter__("visible",function(a){for(var b=this.h,c=b.length,d=0,d=0;d<c;d++)b[d].visible=a;this.ta=a;this.e=q});Sc.prototype.__defineGetter__("pointsize",t("Sc"));Sc.prototype.__defineSetter__("pointsize",function(a){v(a)||j(Error("Invalid point size."));this.Sc=a;this.e=q});Sc.prototype.__defineGetter__("magicmode",t("Kc"));Sc.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&j(Error("Invalid magic mode setting."));this.Kc=a;this.e=q});
Sc.prototype.__defineGetter__("linewidth",t("nc"));Sc.prototype.__defineSetter__("linewidth",function(a){v(a)||j(Error("Invalid line width."));this.nc=a;this.e=q});Sc.prototype.__defineGetter__("pickable",t("Rc"));Sc.prototype.__defineSetter__("pickable",function(a){"boolean"!=typeof a&&j(Error("Invalid pickable setting."));this.Rc=a;this.e=q});Sc.prototype.__defineGetter__("textureCoordinateMap",t("wc"));Sc.prototype.__defineSetter__("textureCoordinateMap",ca("bk"));function Uc(){this.Oa=Infinity;this.V=this.aa=-Infinity;this.W=Infinity;this.Ab=[0,0,0];this.yb=[1,1,1]}Uc.prototype.__defineGetter__("lowerThreshold",t("V"));Uc.prototype.__defineSetter__("lowerThreshold",ca("V"));Uc.prototype.__defineGetter__("upperThreshold",t("W"));Uc.prototype.__defineSetter__("upperThreshold",ca("W"));Uc.prototype.__defineGetter__("min",t("Oa"));Uc.prototype.__defineGetter__("max",t("aa"));Uc.prototype.__defineGetter__("minColor",t("Ab"));
Uc.prototype.__defineSetter__("minColor",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid min. color."));this.Ab=a});Uc.prototype.__defineGetter__("maxColor",t("yb"));Uc.prototype.__defineSetter__("maxColor",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid max. color."));this.yb=a});function Vc(){M.call(this);this.c="scalars";this.Fc=this.u=r;this.Mf=q;this.le=0;Fa(this,new uc);Fa(this,new Uc);this.Ab=[0,1,0];this.yb=[1,0,0]}D(Vc,M);Vc.prototype.__defineGetter__("array",t("u"));Vc.prototype.__defineSetter__("array",function(a){this.Fc=this.u=a;this.e=q});Vc.prototype.__defineGetter__("interpolation",t("le"));Vc.prototype.__defineSetter__("interpolation",ca("le"));C("X.scalars",Vc);function V(a){M.call(this);this.c="object";this.h=[];this.w=this.fb=r;Fa(this,new Sc);a!=r&&this.Zb(a)}D(V,M);
V.prototype.Zb=function(a){this.na=a.na;this.Yb=new Pc;this.Yb.ma=new Float32Array(a.Yb.ma);this.Mb=a.Mb.slice();a.j&&(this.j=new U(a.j.length,a.j));a.k&&(this.k=new U(a.k.length,a.k));a.$&&(this.$=new U(a.$.length,a.$));this.Aa=a.Aa;this.wc=a.wc;a.m&&(this.m=new tc((new String(a.m.ud)).toString()));this.ca=a.ca;this.h.length=0;var b=a.h;if(b)for(var c=b.length,d=0,d=0;d<c;d++)this.h.push(new H[b[d].c](b[d]));this.ta=a.ta;this.Sc=a.Sc;this.nc=a.nc;a.hc&&(this.hc=(new String(a.hc)).toString());this.Kc=
a.Kc;this.Rc=a.Rc;this.pc=a.pc.slice();this.e=q};V.prototype.__defineGetter__("colortable",function(){this.fb||(this.fb=new Ac);return this.fb});V.prototype.__defineGetter__("scalars",function(){this.w||(this.w=new Vc);return this.w});V.prototype.__defineGetter__("children",t("h"));V.prototype.l=function(){var a=new Wc;a.ba=this;this.dispatchEvent(a)};
function Xc(a,b){(a==r||b==r||!(a instanceof V)||!(b instanceof V))&&j(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.ca?-1:1==b.ca?1:a.N!=r&&b.N!=r&&a.N>b.N?-1:1}C("X.object",V);C("X.object.prototype.modified",V.prototype.l);function Yc(){}function Zc(a){for(var b=a.j.count,c=[],d=0,d=0;d<b;d+=3){var e=a.j.get(d),f=a.j.get(d+1),g=a.j.get(d+2),h=a.k.get(d),k=a.k.get(d+1),l=a.k.get(d+2),m=a.Mb;a.$&&0<a.$.length&&(m=a.$.get(d));var p=[];p.push(new gc(e,h));p.push(new gc(f,k));p.push(new gc(g,l));c.push(new ic(p,m))}return rc(c)}
function $c(a,b){(b==r||!(b instanceof qc))&&j(Error("Invalid CSG object."));var c=new sc,d=[];Lb(b.F,function(a){var b=[],g=a.ce,b=Lb(a.ob,function(a){a.color=g;return c.add(a)});for(a=a=2;a<b.length;a++)d.push([b[0],b[a-1],b[a]])}.bind(a));a.Vg=Lb(c.unique(),function(a){return[a.Fa.x(),a.Fa.y(),a.Fa.b()]});a.Ug=Lb(c.unique(),function(a){return[a.da.x(),a.da.y(),a.da.b()]});a.Tg=Lb(c.unique(),function(a){return!a.color?r:[a.color[0],a.color[1],a.color[2]]});a.j=new U(9*d.length);a.k=new U(9*d.length);
a.$=new U(9*d.length);Lb(d,function(a){var b=a[0],c=a[1];a=a[2];var d=this.Vg,k=this.Ug,l=this.Tg;this.j.add(d[b][0],d[b][1],d[b][2]);this.j.add(d[c][0],d[c][1],d[c][2]);this.j.add(d[a][0],d[a][1],d[a][2]);this.k.add(k[b][0],k[b][1],k[b][2]);this.k.add(k[c][0],k[c][1],k[c][2]);this.k.add(k[a][0],k[a][1],k[a][2]);l[b]&&this.$.add(l[b][0],l[b][1],l[b][2]);l[c]&&this.$.add(l[c][0],l[c][1],l[c][2]);l[a]&&this.$.add(l[a][0],l[a][1],l[a][2])}.bind(a));0==a.$.H&&(a.$=r);a.na=Tc}
Yc.prototype.pf=function(a){(a==r||!(a instanceof qc)&&!(a instanceof V))&&j(Error("Invalid object."));var b=a;a instanceof V&&(b=Zc(b));a=new V;Fa(a,new Yc);$c(a,Zc(this).pf(b));return a};Yc.prototype.pa=function(a){(a==r||!(a instanceof qc)&&!(a instanceof V))&&j(Error("Invalid object."));var b=a;a instanceof V&&(b=Zc(b));a=new V;Fa(a,new Yc);$c(a,Zc(this).pa(b));return a};
Yc.prototype.Se=function(a){(a==r||!(a instanceof qc)&&!(a instanceof V))&&j(Error("Invalid object."));var b=a;a instanceof V&&(b=Zc(b));a=new V;Fa(a,new Yc);$c(a,Zc(this).Se(b));return a};Yc.prototype.inverse=function(){var a=new V;Fa(a,new Yc);$c(a,Zc(this).inverse());return a};C("X.constructable",Yc);C("X.constructable.prototype.intersect",Yc.prototype.Se);C("X.constructable.prototype.inverse",Yc.prototype.inverse);C("X.constructable.prototype.subtract",Yc.prototype.pa);
C("X.constructable.prototype.union",Yc.prototype.pf);function ad(a){Ab.call(this,a);this.c="event"}D(ad,Ab);var bd=ec("pan"),cd=ec("rotate"),dd=ec("zoom"),ed=ec("scroll");ec("render");var fd=ec("resetview"),gd=ec("windowlevel"),hd=ec("modified"),id=ec("progress"),jd=ec("hover"),kd=ec("hover_end");function ld(){ad.call(this,gd);this.re=this.De=0}D(ld,ad);function md(){ad.call(this,bd);this.N=new H.f(0,0,0)}D(md,ad);function nd(){ad.call(this,cd);this.N=new H.f(0,0,0)}D(nd,ad);function od(){ad.call(this,dd);this.Na=this.Wa=s}D(od,ad);
function pd(){ad.call(this,ed);this.L=s}D(pd,ad);function qd(){ad.call(this,jd);this.Dd=this.Cd=0}D(qd,ad);function rd(){ad.call(this,kd)}D(rd,ad);function sd(){ad.call(this,fd)}D(sd,ad);function Wc(){ad.call(this,hd);this.v=this.ba=r}D(Wc,ad);function td(){ad.call(this,id);this.Qf=0}D(td,ad);function ud(){M.call(this);this.c="parser";this.A=r;this.H=0;this.Yg=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.pd=q;this.ak=-Infinity;this.$j=Infinity}D(ud,M);ud.prototype.parse=function(){j(Error("The function parse() should be overloaded."))};function vd(a){for(var b=Infinity,c=-Infinity,d=a.length,e=0,e=0;e<d;e++)var f=a[e],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function wd(a,b,c){b===n&&(b=0);c===n&&(c=a.length);for(var d="",e=0,e=b;e<c;++e)d+=String.fromCharCode(a[e]);return d}
function W(a,b,c){c!=r||(c=1);var d=1,e=Uint8Array;switch(b){case "schar":e=Int8Array;break;case "ushort":e=Uint16Array;d=2;break;case "sshort":e=Int16Array;d=2;break;case "uint":e=Uint32Array;d=4;break;case "sint":e=Int32Array;d=4;break;case "float":e=Float32Array,d=4}b=new e(a.A.slice(a.H,a.H+=c*d));if(a.Yg!=a.pd){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(e=0;e<a.byteLength;e+=d)for(var f=e+d-1,g=e;f>g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function xd(a,b){"right"!=a[0]&&(b[0]=-b[0],b[3]=-b[3],b[6]=-b[6]);"anterior"!=a[1]&&(b[1]=-b[1],b[4]=-b[4],b[7]=-b[7]);"superior"!=a[2]&&(b[2]=-b[2],b[5]=-b[5],b[8]=-b[8]);return b}
function yd(a,b){H.wa(a.c+".orientnormalize");var c=b.slice(0,3),d=c.map(function(a){return Math.abs(a)}),e=d.indexOf(Math.max.apply(Math,d)),d=[0,0,0];d[e]=0>c[e]?-1:1;var f=b.slice(3,6),c=f.map(function(a){return Math.abs(a)}),g=c.indexOf(Math.max.apply(Math,c)),c=[0,0,0];c[g]=0>f[g]?-1:1;var f=b.slice(6,9),h=f.map(function(a){return Math.abs(a)}),k=h.indexOf(Math.max.apply(Math,h)),h=[0,0,0];h[k]=0>f[k]?-1:1;e=[d[e],c[g],h[k]];d=[d,c,h];H.qa(a.c+".orientnormalize");return[e,d]}
function zd(a,b){H.wa(a.c+".reslice");var c=b.O!=r,d=r;b.fb&&(d=b.fb.xb);for(var e=b.ra,f=b.Eb,g=b.A,h=Array(e[0]),k=Array(e[0]),l=0,m=0,p=0,l=0;l<e[0];l++){h[l]=Array(e[1]);k[l]=Array(e[1]);for(m=0;m<e[1];m++)h[l][m]=new b.A.constructor(e[2]),k[l][m]=new b.A.constructor(e[2])}for(var x=b.s,w=e[0]*e[1],y=0,z=0,p=0;p<e[2];p++)for(var E=g.subarray(p*w,(p+1)*w),m=z=0;m<e[1];m++)for(l=0;l<e[0];l++)y=E[z],h[l][m][p]=255*(y/b.aa),k[l][m][p]=y,z++;for(g=g=0;3>g;g++){var G=g,p=(G+1)%3,h=(G+2)%3,w=4*e[G]*
e[p],y=e[G],z=e[p],E=e[h],B=(E-1)/2,F=B,I=x[G],J=x[p],T=x[h],K=[1,1,1],K=0!=x[h][2]?[1,0,0]:0!=x[h][1]?[0,1,0]:[1,1,0],G=y*f[G],S=z*f[p];0!=x[2][1]&&(p=G,G=S,S=p);for(p=0;p<E;p++){var P=0,l=-B*f[h]+p*f[h],N=[b.q[0],b.q[1],b.q[2]];N[0]+=x[h][0]*l;N[1]+=x[h][1]*l;N[2]+=x[h][2]*l;var l=new Ad,O=q;b.ib!=r&&!c&&(O=s);var m=l,ba=T,ea=J,A=I,Y=G,Z=S,sa=O,O=K;(N==r||!ka(N)||3!=N.length)&&j(Error("Invalid center."));(ba==r||!ka(ba)||3!=ba.length)&&j(Error("Invalid front direction."));(ea==r||!ka(ea)||3!=ea.length)&&
j(Error("Invalid up direction."));v(Y)||j(Error("Invalid width."));v(Z)||j(Error("Invalid height."));var Ga=s;sa!=r&&(Ga=sa);sa=[1,1,1];O!=r&&(sa=O);m.q=N;m.lc=ba;m.L=ea;m.wd=A;m.J=Y;m.D=Z;m.eb=Ga;m.gc=sa;m.Ac();l.ib=b;l.visible=0<b.Ja[h]?p==Math.floor(F):p==Math.ceil(F);N=l;ba=new Uint8Array(w);for(m=0;m<z;m++)for(l=0;l<y;l++)O=0,O=0==g?k[l][m][p]:1==g?k[p][l][m]:k[m][p][l],Z=Y=A=ea=0,d?((Z=d.get(Math.floor(O)))||(Z=[0,1,0.1,0.2,1]),ea=255*Z[1],A=255*Z[2],Y=255*Z[3],Z=255*Z[4]):(ea=A=Y=255*(O/b.aa),
Z=255),O=4*P,ba[O]=ea,ba[++O]=A,ba[++O]=Y,ba[++O]=Z,P++;P=new Rc;P.Xb=ba;P.Kf=y;P.Jf=z;N.Aa=P;0<b.Ja[h]?b.h[g].h.push(N):b.h[g].h.unshift(N);c&&(N.O=b.O.h[g].h[p].Aa)}0==g?(b.S=B,b.Gc=B):1==g?(b.T=B,b.Hc=B):2==g&&(b.U=B,b.Ic=B);if(!b.we)break}H.qa(a.c+".reslice");return k};function Bd(){ud.call(this);this.c="parserLBL"}D(Bd,ud);
Bd.prototype.parse=function(a,b,c){H.wa(this.c+".parse");var d=b.pc,e=d.length;0==e&&j(Error("No _pointIndices defined on the X.object."));this.A=c;var f=[],g=W(this,"uchar",c.byteLength),h=g.length,k=s,l=0;for(c=1;c<h;c++)10==g[c-1]?(l=c,k=q):k&&32==g[c]&&(f.push(parseInt(wd(g,l,c),10)),k=s);g=b.w.u?b.w.u:new Float32Array(e);h=f.length;for(c=0;c<h;c++)g[f[c]]=1;f=new Float32Array(3*e);for(c=h=0;c<e;c++)k=d[c],k>e&&j(Error("Could not find scalar for vertex.")),k=g[k],f[h++]=k,f[h++]=k,f[h++]=k;b.w.u=
g;b.w.Fc=f;b.w.e=q;H.qa(this.c+".parse");d=new Wc;d.ba=b;d.v=a;this.dispatchEvent(d)};C("X.parserLBL",Bd);C("X.parserLBL.prototype.parse",Bd.prototype.parse);function Cd(a,b){this.x=ia(a)?a:0;this.y=ia(b)?b:0}u=Cd.prototype;u.g=function(){return new Cd(this.x,this.y)};function Dd(a,b){return new Cd(a.x-b.x,a.y-b.y)}u.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};u.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};u.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};
u.translate=function(a,b){a instanceof Cd?(this.x+=a.x,this.y+=a.y):(this.x+=a,v(b)&&(this.y+=b));return this};u.scale=function(a,b){var c=v(b)?b:a;this.x*=a;this.y*=c;return this};function Ed(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}u=Ed.prototype;u.g=function(){return new Ed(this.top,this.right,this.bottom,this.left)};u.contains=function(a){return!this||!a?s:a instanceof Ed?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};
u.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};u.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};u.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};
u.translate=function(a,b){a instanceof Cd?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,v(b)&&(this.top+=b,this.bottom+=b));return this};u.scale=function(a,b){var c=v(b)?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};function Fd(a,b){this.width=a;this.height=b}u=Fd.prototype;u.g=function(){return new Fd(this.width,this.height)};u.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};u.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};u.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};u.scale=function(a,b){var c=v(b)?b:a;this.width*=a;this.height*=c;return this};function Gd(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}u=Gd.prototype;u.g=function(){return new Gd(this.left,this.top,this.width,this.height)};u.lg=function(a){var b=Math.max(this.left,a.left),c=Math.min(this.left+this.width,a.left+a.width);if(b<=c){var d=Math.max(this.top,a.top);a=Math.min(this.top+this.height,a.top+a.height);if(d<=a)return this.left=b,this.top=d,this.width=c-b,this.height=a-d,q}return s};
u.contains=function(a){return a instanceof Gd?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};u.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};
u.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};u.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};u.translate=function(a,b){a instanceof Cd?(this.left+=a.x,this.top+=a.y):(this.left+=a,v(b)&&(this.top+=b));return this};
u.scale=function(a,b){var c=v(b)?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};var Hd;function Id(a,b){var c;c=a.className;c=ma(c)&&c.match(/\S+/g)||[];for(var d=Ob(arguments,1),e=c.length+d.length,f=c,g=0;g<d.length;g++)0<=Jb(f,d[g])||f.push(d[g]);a.className=c.join(" ");return c.length==e};var Jd=!eb||eb&&9<=wb;!hb&&!eb||eb&&eb&&9<=wb||hb&&ub("1.9.1");eb&&ub("9");function Kd(a){return a?new Ld(Md(a)):Hd||(Hd=new Ld)}function Od(a){return ma(a)?document.getElementById(a):a}var Pd={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 Qd(a,b,c){return Rd(document,arguments)}
function Rd(a,b){var c=b[0],d=b[1];if(!Jd&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',Ma(d.name),'"');if(d.type){c.push(' type="',Ma(d.type),'"');var e={};Fb(e,d);delete e.type;d=e}c.push(">");c=c.join("")}var f=a.createElement(c);if(d)if(ma(d))f.className=d;else if(ka(d))Id.apply(r,[f].concat(d));else{var c=function(a,b){"style"==b?f.style.cssText=a:"class"==b?f.className=a:"for"==b?f.htmlFor=a:b in Pd?f.setAttribute(Pd[b],a):0==b.lastIndexOf("aria-",0)||0==b.lastIndexOf("data-",0)?
f.setAttribute(b,a):f[b]=a},g;for(g in d)c.call(n,d[g],g)}if(2<b.length){g=function(b){b&&f.appendChild(ma(b)?a.createTextNode(b):b)};for(d=2;d<b.length;d++)if(e=b[d],la(e)&&!(oa(e)&&0<e.nodeType)){var c=Kb,h;a:{if((h=e)&&"number"==typeof h.length){if(oa(h)){h="function"==typeof h.item||"string"==typeof h.item;break a}if(na(h)){h="function"==typeof h.item;break a}}h=s}if(h)if(h=e.length,0<h){for(var k=Array(h),l=0;l<h;l++)k[l]=e[l];e=k}else e=[];c(e,g)}else g(e)}return f}
function Sd(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function Td(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}function Ud(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 Md(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function Ld(a){this.Q=a||fa.document||document}u=Ld.prototype;u.Ld=Kd;
u.n=function(a){return ma(a)?this.Q.getElementById(a):a};u.Og=Ld.prototype.n;u.zc=function(a,b,c){return Rd(this.Q,arguments)};u.createElement=function(a){return this.Q.createElement(a)};u.createTextNode=function(a){return this.Q.createTextNode(String(a))};function Vd(a){return"CSS1Compat"==a.Q.compatMode}function Wd(a){var b=a.Q;a=!ib&&"CSS1Compat"==b.compatMode?b.documentElement:b.body;b=b.parentWindow||b.defaultView;return new Cd(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}
u.appendChild=function(a,b){a.appendChild(b)};u.contains=Ud;function Xd(a,b){var c=Md(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,r))?c[b]||c.getPropertyValue(b)||"":""}function Yd(a,b){return Xd(a,b)||(a.currentStyle?a.currentStyle[b]:r)||a.style&&a.style[b]}function Zd(a){a=a?Md(a):document;return eb&&!(eb&&9<=wb)&&!Vd(Kd(a))?a.body:a.documentElement}
function $d(a){var b=a.getBoundingClientRect();eb&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function ae(a){if(eb&&!(eb&&8<=wb))return a.offsetParent;var b=Md(a),c=Yd(a,"position"),d="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=Yd(a,"position"),d=d&&"static"==c&&a!=b.documentElement&&a!=b.body,!d&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return r}
function be(a){for(var b=new Ed(0,Infinity,Infinity,0),c=Kd(a),d=c.Q.body,e=c.Q.documentElement,f=!ib&&"CSS1Compat"==c.Q.compatMode?c.Q.documentElement:c.Q.body;a=ae(a);)if((!eb||0!=a.clientWidth)&&(!ib||0!=a.clientHeight||a!=d)&&a!=d&&a!=e&&"visible"!=Yd(a,"overflow")){var g=ce(a),h;h=a;if(hb&&!ub("1.9")){var k=parseFloat(Xd(h,"borderLeftWidth"));if(de(h))var l=h.offsetWidth-h.clientWidth-k-parseFloat(Xd(h,"borderRightWidth")),k=k+l;h=new Cd(k,parseFloat(Xd(h,"borderTopWidth")))}else h=new Cd(h.clientLeft,
h.clientTop);g.x+=h.x;g.y+=h.y;b.top=Math.max(b.top,g.y);b.right=Math.min(b.right,g.x+a.clientWidth);b.bottom=Math.min(b.bottom,g.y+a.clientHeight);b.left=Math.max(b.left,g.x)}d=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,f);c=(c.Q.parentWindow||c.Q.defaultView||window).document;c="CSS1Compat"==c.compatMode?c.documentElement:c.body;c=new Fd(c.clientWidth,c.clientHeight);b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&
b.bottom>b.top&&b.right>b.left?b:r}
function ce(a){var b,c=Md(a),d=Yd(a,"position"),e=hb&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new Cd(0,0),g=Zd(c);if(a==g)return f;if(a.getBoundingClientRect)b=$d(a),a=Wd(Kd(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!e)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(g),f.x=b.screenX-a.screenX,f.y=b.screenY-a.screenY;else{b=a;do{f.x+=b.offsetLeft;f.y+=b.offsetTop;b!=a&&(f.x+=b.clientLeft||0,f.y+=b.clientTop||0);
if(ib&&"fixed"==Yd(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(db||ib&&"absolute"==d)f.y-=c.body.offsetTop;for(b=a;(b=ae(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,!db||"TR"!=b.tagName)f.y-=b.scrollTop}return f}
function ee(a){var b=new Cd;if(1==a.nodeType){if(a.getBoundingClientRect){var c=$d(a);b.x=c.left;b.y=c.top}else{var c=Wd(Kd(a)),d=ce(a);b.x=d.x-c.x;b.y=d.y-c.y}if(hb&&!ub(12)){var e;eb?e="-ms-transform":ib?e="-webkit-transform":db?e="-o-transform":hb&&(e="-moz-transform");var f;e&&(f=Yd(a,e));f||(f=Yd(a,"transform"));f?(a=f.match(fe),a=!a?new Cd(0,0):new Cd(parseFloat(a[1]),parseFloat(a[2]))):a=new Cd(0,0);b=new Cd(b.x+a.x,b.y+a.y)}}else e=na(a.Bh),f=a,a.targetTouches?f=a.targetTouches[0]:e&&a.Ra.targetTouches&&
(f=a.Ra.targetTouches[0]),b.x=f.clientX,b.y=f.clientY;return b}function ge(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}function he(a){if("none"!=Yd(a,"display"))return ie(a);var b=a.style,c=b.display,d=b.visibility,e=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=ie(a);b.display=c;b.position=e;b.visibility=d;return a}
function ie(a){var b=a.offsetWidth,c=a.offsetHeight,d=ib&&!b&&!c;return(!ia(b)||d)&&a.getBoundingClientRect?(a=$d(a),new Fd(a.right-a.left,a.bottom-a.top)):new Fd(b,c)}function je(a,b){a.style.display=b?"":"none"}function de(a){return"rtl"==Yd(a,"direction")}function ke(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,d=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var e=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return e}
function le(a,b){var c=a.currentStyle?a.currentStyle[b]:r;return c?ke(a,c):0}var me={thin:2,medium:4,thick:6};function ne(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:r))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:r;return c in me?me[c]:ke(a,c)}var fe=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function oe(a,b){yb.call(this);this.t=a;var c=oa(this.t)&&1==this.t.nodeType?this.t:this.t?this.t.body:r;this.Uh=!!c&&de(c);this.hk=L(this.t,hb?"DOMMouseScroll":"mousewheel",this,b)}D(oe,fc);
oe.prototype.handleEvent=function(a){var b=0,c=0,d=0;a=a.Ra;if("mousewheel"==a.type){c=1;if(eb||ib&&(Xa||ub("532.0")))c=40;d=pe(-a.wheelDelta,c);ia(a.wheelDeltaX)?(b=pe(-a.wheelDeltaX,c),c=pe(-a.wheelDeltaY,c)):c=d}else d=a.detail,100<d?d=3:-100>d&&(d=-3),ia(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=d:c=d;v(this.rg)&&(b=Math.min(Math.max(b,-this.rg),this.rg));v(this.sg)&&(c=Math.min(Math.max(c,-this.sg),this.sg));this.Uh&&(b=-b);b=new qe(d,a,b,c);this.dispatchEvent(b)};
function pe(a,b){return ib&&(Wa||Za)&&0!=a%b?a:a/b}function qe(a,b,c,d){b&&this.ia(b,n);this.type="mousewheel";this.detail=a;this.ek=c;this.Bc=d}D(qe,Rb);eb||ib&&ub("525");function re(a){(a==r||!(a instanceof Element))&&j(Error("Could not add interactor to the given element."));M.call(this);this.c="interactor";this.xa=a;this.se=this.Df=this.Cf=this.Ef=this.Bf=this.Ff=r;this.sd=q;this.Db=this.zb=this.Xa=s;this.gb=[0,0];this.ne=new H.f(0,0,0);this.Jc=new H.f(0,0,0);this.ng=0;this.Pf=this.od=r;this.Nf=s;this.G={MOUSEWHEEL_ENABLED:q,MOUSECLICKS_ENABLED:q,KEYBOARD_ENABLED:q,HOVERING_ENABLED:q,CONTEXTMENU_ENABLED:s,TOUCH_ENABLED:q,TOUCH_BOUNCING_ENABLED:s}}D(re,M);
re.prototype.__defineGetter__("config",t("G"));re.prototype.__defineGetter__("leftButtonDown",t("Xa"));re.prototype.__defineGetter__("middleButtonDown",t("zb"));re.prototype.__defineGetter__("rightButtonDown",t("Db"));
re.prototype.ia=function(){this.G.MOUSEWHEEL_ENABLED?(this.se=new oe(this.xa),this.Ff=L(this.se,"mousewheel",this.ed.bind(this))):($b(this.Ff),this.se=r);this.G.MOUSECLICKS_ENABLED?(this.Bf=L(this.xa,"mousedown",this.gi.bind(this)),this.Ef=L(this.xa,"mouseup",this.li.bind(this))):($b(this.Bf),$b(this.Ef));this.xa.oncontextmenu=this.G.CONTEXTMENU_ENABLED?r:function(){return s};window.onkeydown=this.G.KEYBOARD_ENABLED?this.xg.bind(this):r;this.G.TOUCH_ENABLED?(this.G.TOUCH_BOUNCING_ENABLED||document.body.addEventListener("touchmove",
function(a){a.preventDefault()},s),this.bh=L(this.xa,"touchstart",this.yi.bind(this)),this.ah=L(this.xa,"touchmove",this.wi.bind(this)),this.$g=L(this.xa,"touchend",this.si.bind(this))):($b(this.bh),$b(this.ah),$b(this.$g));$b(this.Cf);$b(this.Df);this.Cf=L(this.xa,"mousemove",this.ii.bind(this));this.Df=L(this.xa,"mouseout",this.ji.bind(this))};
re.prototype.gi=function(a){0==a.button?this.Xa=q:1==a.button?this.zb=q:2==a.button&&(this.Db=q);eval("this.onMouseDown("+this.Xa+","+this.zb+","+this.Db+")");se(this);a.preventDefault()};re.prototype.fi=aa();re.prototype.li=function(a){0==a.button?this.Xa=s:1==a.button?this.zb=s:2==a.button&&(this.Db=s);eval("this.onMouseUp("+this.Xa+","+this.zb+","+this.Db+")");se(this);a.preventDefault()};re.prototype.__defineGetter__("mousePosition",t("gb"));u=re.prototype;u.ki=aa();
u.ji=function(a){this.sd=s;this.G.KEYBOARD_ENABLED&&(window.onkeydown=r);this.Db=this.zb=this.Xa=s;se(this);this.ne=new H.f(0,0,0);a.preventDefault()};u.hi=aa();u.yi=function(a){a.preventDefault();a.ia(a.Ra.targetTouches[0],a.currentTarget);eval("this.onTouchStart("+a.clientX+","+a.clientY+")");this.Jc=new H.f(a.clientX,a.clientY,0);this.Pf=setTimeout(this.ui.bind(this,a),500)};u.xi=aa();
u.ui=function(a){eval("this.onTouchHover("+a.clientX+","+a.clientY+")");a=new od;a.Wa=q;a.Na=this instanceof te;this.dispatchEvent(a);this.zd=q};u.ti=aa();function ue(a){clearTimeout(a.Pf);if(a.zd){var b=new od;b.Wa=s;b.Na=a instanceof te;a.dispatchEvent(b)}a.zd=s}u.si=function(a){a.preventDefault();eval("this.onTouchEnd()");ue(this)};u.ri=aa();
u.wi=function(a){a.preventDefault();this.zd||ue(this);this.touchmoveEvent=a=a.Ra;eval("this.onTouchMove(this['touchmoveEvent'])");var b=a.targetTouches;if(1==b.length){a=b[0];var c=[a.clientX,a.clientY];a=new H.f(c[0],c[1],0);var b=c[0]>3*this.xa.clientWidth/4,d=c[0]<this.xa.clientWidth/4,e=c[1]<this.xa.clientHeight/4,c=c[1]>3*this.xa.clientHeight/4,c=!b&&!d&&!e&&!c,e=this.Jc.pa(a);this.Jc=a.g();if(this.zd)a=new md,5<e.x?e.x=1:-5>e.x&&(e.x=-1),5<e.y?e.y=1:-5>e.y&&(e.y=-1),a.N=e,this.dispatchEvent(a);
else if(this instanceof ve&&(b||d))a=new pd,a.L=0>e.y,this.dispatchEvent(a);else if(this instanceof te||c)e.scale(3),a=new nd,a.N=e,this.dispatchEvent(a)}else 2==b.length&&(a=b[0],b=b[1],a=[a.clientX,a.clientY],b=[b.clientX,b.clientY],a=new H.f(a[0],a[1],0),b=new H.f(b[0],b[1],0),e=Cc(a,b),b=e-this.ng,this.ng=e,this.Jc.pa(a),this.Jc=a.g(),10<Math.abs(b)&&(a=new od,a.Wa=0<b,a.Na=this instanceof te,this.dispatchEvent(a)))};u.vi=aa();
u.ii=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.sd=q;this.G.KEYBOARD_ENABLED&&window.onkeydown==r&&(window.onkeydown=this.xg.bind(this));a.preventDefault();var b=a.shiftKey;this.Nf=b;this.gb=[a.offsetX,a.offsetY];var c=new H.f(this.gb[0],this.gb[1],0);a=this.ne.pa(c);this.ne=c.g();this.G.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.zb||this.Xa||this.Db)&&se(this),this.od=setTimeout(function(){se(this);var a=new qd;a.Cd=c.x;a.Dd=c.y;this.dispatchEvent(a);
this.od=r}.bind(this),300));2>Math.abs(a.x)&&(a.x=0);2>Math.abs(a.y)&&(a.y=0);0!=a.kb()&&(this.Xa&&!b?(b=new nd,a.scale(3),b.N=a,this.dispatchEvent(b)):this.zb||this.Xa&&b?(b=new md,5<a.x?a.x=5:-5>a.x&&(a.x=-5),5<a.y?a.y=5:-5>a.y&&(a.y=-5),b.N=a,this.dispatchEvent(b)):this.Db&&(b=new od,b.Wa=0<a.y,b.Na=s,this.dispatchEvent(b)))};function se(a){a.od&&clearTimeout(a.od);a.dispatchEvent(new rd)}u.mi=aa();
u.ed=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");se(this);a.preventDefault()};u.di=aa();
u.xg=function(a){if(this.sd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");se(this);var b=a.altKey,c=a.ctrlKey,d=a.metaKey,e=a.shiftKey,f=a.keyCode;82==f&&!b&&!c&&!d&&!e?(a.preventDefault(),a=new sd,this.dispatchEvent(a)):37<=f&&40>=f&&(a.preventDefault(),e?a=new md:b?a=new od:(a=new nd,this instanceof ve&&(a=new pd)),a&&(c=new H.f(0,0,0),37==f?(c.x=5,a.L=s,b&&(a.L=q,a.Wa=q,a.Na=s)):39==f?(c.x=-5,a.L=q,b&&(a.Wa=s,a.Na=s)):38==f?(c.y=5,a.L=q,b&&(a.Wa=q,a.Na=q)):40==f&&(c.y=-5,a.L=s,b&&(a.Wa=
s,a.Na=q)),a.N=c,this.dispatchEvent(a)))}};C("X.interactor",re);C("X.interactor.prototype.init",re.prototype.ia);C("X.interactor.prototype.onMouseDown",re.prototype.fi);C("X.interactor.prototype.onMouseUp",re.prototype.ki);C("X.interactor.prototype.onMouseMove",re.prototype.hi);C("X.interactor.prototype.onMouseWheel",re.prototype.mi);C("X.interactor.prototype.onKey",re.prototype.di);C("X.interactor.prototype.onTouchStart",re.prototype.xi);C("X.interactor.prototype.onTouchMove",re.prototype.vi);
C("X.interactor.prototype.onTouchEnd",re.prototype.ri);C("X.interactor.prototype.onTouchHover",re.prototype.ti);function ve(a){re.call(this,a);this.c="interactor2D"}D(ve,re);ve.prototype.ed=function(a){ve.p.ed.call(this,a);var b=new pd;a.Bc==r&&(a.Bc=0);b.L=0>a.Bc;this.dispatchEvent(b)};function Ad(a){V.call(this);this.c="slice";this.q=[0,0,0];this.lc=[0,0,1];this.L=[0,1,0];this.wd=[1,0,0];this.D=this.J=10;this.wc=[0,1,0,0,1,1,1,1,1,0,0,0];this.O=this.ib=r;this.eb=q;this.gc=[1,1,1];a!=r&&this.Zb(a)}D(Ad,V);Ad.prototype.Zb=function(a){this.q=a.q.slice();this.lc=a.lc.slice();this.L=a.L.slice();this.J=a.J;this.D=a.D;this.ib=a.ib;this.O=a.O;this.eb=a.eb;this.gc=a.gc;this.Xg=a.Xg;Ad.p.Zb.call(this,a)};
Ad.prototype.Ac=function(){var a=new R(this.lc[0],this.lc[1],this.lc[2]),b=new R(this.L[0],this.L[1],this.L[2]),c=new R(this.wd[0],this.wd[1],this.wd[2]),d=new R(this.q[0],this.q[1],this.q[2]),e=new R(1,1,1);if(1==a.x||-1==a.x)e=new R(this.q[0],this.J/2,this.D/2);else if(1==a.y||-1==a.y)e=new R(this.D/2,this.q[1],this.J/2);else if(1==a.b||-1==a.b)e=new R(this.J/2,this.D/2,this.q[2]);var f=Dc(c.g().K(),b.g().K()),f=new R(f.x*e.x,f.y*e.y,f.b*e.b);f.add(d);var g=Dc(c.g().K(),b),g=new R(g.x*e.x,g.y*e.y,
g.b*e.b);g.add(d);var h=Dc(c,b.g().K()),h=new R(h.x*e.x,h.y*e.y,h.b*e.b);h.add(d);var k=h,b=Dc(c,b),b=new R(b.x*e.x,b.y*e.y,b.b*e.b);b.add(d);d=g;this.j=new U(18);this.k=new U(18);this.j.add(f.x,f.y,f.b);this.j.add(g.x,g.y,g.b);this.j.add(h.x,h.y,h.b);this.j.add(k.x,k.y,k.b);this.j.add(b.x,b.y,b.b);this.j.add(d.x,d.y,d.b);this.k.add(a.x,a.y,a.b);this.k.add(a.x,a.y,a.b);this.k.add(a.x,a.y,a.b);this.k.add(a.x,a.y,a.b);this.k.add(a.x,a.y,a.b);this.k.add(a.x,a.y,a.b);this.eb&&(a=new V,a.j=new U(24),a.k=
new U(24),a.j.add(f.x,f.y,f.b),a.j.add(g.x,g.y,g.b),a.j.add(g.x,g.y,g.b),a.j.add(b.x,b.y,b.b),a.j.add(b.x,b.y,b.b),a.j.add(h.x,h.y,h.b),a.j.add(h.x,h.y,h.b),a.j.add(f.x,f.y,f.b),a.k.add(0,0,0),a.k.add(0,0,0),a.k.add(0,0,0),a.k.add(0,0,0),a.k.add(0,0,0),a.k.add(0,0,0),a.k.add(0,0,0),a.k.add(0,0,0),a.Mb=[this.gc[0],this.gc[1],this.gc[2]],a.na="LINES",a.nc=2,this.h.push(a))};C("X.slice",Ad);function Q(a){V.call(this);this.c="volume";this.q=[0,0,0];this.ra=[10,10,10];this.Eb=[1,1,1];this.rb=[];this.sb=this.ub=this.tb=this.Ic=this.U=this.Hc=this.T=this.Gc=this.S=0;this.jc=[10,10,10];this.tc=new V;this.uc=new V;this.vc=new V;this.Bd=this.Pa=s;this.Gb=0;this.O=r;this.eb=q;this.Y=Infinity;this.X=-Infinity;this.we=q;this.Of=["left","posterior","superior"];this.Ae=[1,0,0,0,1,0,0,0,1];this.ve=[-1,0,0,0,-1,0,0,0,1];this.Ja=[-1,-1,1];this.s=[[-1,0,0],[0,-1,0],[0,0,1]];this.aa=0;this.A=r;Fa(this,
new uc);Fa(this,new Uc);a!=r&&this.Zb(a)}D(Q,V);Q.prototype.Zb=function(a){this.q=a.q.slice();this.ra=a.ra.slice();this.Eb=a.Eb.slice();this.S=a.S;this.Gc=a.Gc;this.T=a.T;this.Hc=a.Hc;this.U=a.U;this.Ic=a.Ic;this.tb=a.tb;this.ub=a.ub;this.sb=a.sb;this.jc=a.jc.slice();this.tc=new V(a.tc);this.uc=new V(a.uc);this.vc=new V(a.vc);this.Of=a.ka;this.Ae=a.Ae;this.ve=a.ve;this.Ja=a.Ja;this.s=a.s;this.aa=a.aa;this.A=a.A;this.Pa=a.Pa;this.Bd=a.Bd;this.Gb=a.Gb;this.O=a.O;this.eb=a.eb;Q.p.Zb.call(this,a)};
Q.prototype.Ac=function(a){this.h.length=0;this.tc.h.length=0;this.uc.h.length=0;this.vc.h.length=0;this.h.push(this.tc);this.h.push(this.uc);this.h.push(this.vc);this.Of=a.ka;this.Ae=a.i;this.ve=a.Ma;this.Ja=a.orientation;this.s=a.lb;this.aa=a.max;this.A=a.data;this.e=q};
Q.prototype.z=function(){var a=this.s[2],b=this.ra;0!=a[0]?(this.tb=this.S,this.ub=this.T,this.sb=this.U,this.jc=[b[2],b[0],b[1]]):0!=a[1]?(this.tb=this.U,this.ub=this.S,this.sb=this.T,this.jc=[b[1],b[2],b[0]]):(this.tb=this.T,this.ub=this.U,this.sb=this.S,this.jc=b)};
Q.prototype.l=function(a){a="undefined"!==typeof a?a:q;if(0<this.h.length){this.Pa!=this.Bd&&(this.Pa?(this.h[0].h[parseInt(this.S,10)].visible=s,this.h[1].h[parseInt(this.T,10)].visible=s,this.h[2].h[parseInt(this.U,10)].visible=s):this.h[this.Gb].visible=s,this.e=q,this.Bd=this.Pa);if(!this.ta)return;if(this.Pa)we(this,this.Gb);else for(var b=0,b=0;3>b;b++){var c=this.h[b],d=0,e=0;0==b?(d=this.S,e=this.Gc,this.Gc=this.S):1==b?(d=this.T,e=this.Hc,this.Hc=this.T):2==b&&(d=this.U,e=this.Ic,this.Ic=
this.U);c.h[parseInt(e,10)].visible=s;c=c.h[parseInt(d,10)];c.visible=q;c.ca=1}}a&&Q.p.l.call(this)};Q.prototype.__defineGetter__("dimensions",t("ra"));Q.prototype.__defineGetter__("dimensionsRAS",t("jc"));Q.prototype.__defineGetter__("volumeRendering",t("Pa"));Q.prototype.__defineSetter__("volumeRendering",function(a){this.Pa=a;this.l(s)});Q.prototype.__defineGetter__("visible",t("ta"));
Q.prototype.__defineSetter__("visible",function(a){if(a)this.ta=a,this.l(s);else{for(var b=this.h,c=b.length,d=0,d=0;d<c;d++)b[d].visible=a;this.ta=a;this.e=q}});Q.prototype.__defineGetter__("center",t("q"));Q.prototype.__defineSetter__("center",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid center."));this.q=a});Q.prototype.__defineGetter__("image",t("rb"));Q.prototype.__defineGetter__("labelmap",function(){this.O||(this.O=new xe(this));return this.O});
Q.prototype.__defineGetter__("indexIS",function(){return this.sb=0!=this.s[2][0]?this.U:0!=this.s[2][1]?this.T:this.S});Q.prototype.__defineSetter__("indexIS",function(a){v(a)&&(0!=this.s[2][0]?this.U=a:0!=this.s[2][1]?this.T=a:this.S=a,this.sb=a,this.l(s))});Q.prototype.__defineGetter__("indexLR",function(){return this.tb=0!=this.s[2][0]?this.S:0!=this.s[2][1]?this.U:this.T});
Q.prototype.__defineSetter__("indexLR",function(a){v(a)&&(0!=this.s[2][0]?this.S=a:0!=this.s[2][1]?this.U=a:this.T=a,this.tb=a,this.l(s))});Q.prototype.__defineGetter__("indexPA",function(){return this.ub=0!=this.s[2][0]?this.T:0!=this.s[2][1]?this.S:this.U});Q.prototype.__defineSetter__("indexPA",function(a){v(a)&&(0!=this.s[2][0]?this.T=a:0!=this.s[2][1]?this.S=a:this.U=a,this.ub=a,this.l(s))});Q.prototype.__defineGetter__("indexX",t("S"));
Q.prototype.__defineSetter__("indexX",function(a){v(a)&&(0<=a&&a<this.tc.h.length)&&(this.S=a,this.l(s))});Q.prototype.__defineGetter__("indexY",t("T"));Q.prototype.__defineSetter__("indexY",function(a){v(a)&&(0<=a&&a<this.uc.h.length)&&(this.T=a,this.l(s))});Q.prototype.__defineGetter__("indexZ",t("U"));Q.prototype.__defineSetter__("indexZ",function(a){v(a)&&(0<=a&&a<this.vc.h.length)&&(this.U=a,this.l(s))});Q.prototype.__defineGetter__("windowLow",t("Y"));
Q.prototype.__defineSetter__("windowLow",ca("Y"));Q.prototype.__defineGetter__("windowHigh",t("X"));Q.prototype.__defineSetter__("windowHigh",ca("X"));Q.prototype.__defineGetter__("borders",t("eb"));Q.prototype.__defineSetter__("borders",ca("eb"));Q.prototype.__defineGetter__("reslicing",t("we"));Q.prototype.__defineSetter__("reslicing",ca("we"));
function we(a,b){var c=(b+2)%3,c=0!=a.s[0][c]?2:0!=a.s[1][c]?0:1;0!=a.s[2][1]&&(c=(c+1)%3);if(a.Pa&&(a.e||c!=a.Gb)){var d=a.h[a.Gb];d.visible=s;var d=a.h[c],e=d.h.length,f;for(f=0;f<e;f++)d.h[f].ta=q;a.Gb=c;a.e=s}}C("X.volume",Q);C("X.volume.prototype.modified",Q.prototype.l);function Ae(){ud.call(this);this.c="parserSTL"}D(Ae,ud);
Ae.prototype.parse=function(a,b,c){H.wa(this.c+".parse");this.A=c;var d=b.j,e=b.k;if("solid"==wd(W(this,"uchar",5))){b.j=d=new U(c.byteLength);b.k=e=new U(c.byteLength);var f=d,d=e,e=W(this,"uchar",c.byteLength-5);c=e.length;var g=s,h=s,k=0,l;for(l=0;l<c;l++)if(10==e[l]){if(g||h){var m=wd(e,k,l).split(" "),h=parseFloat(m[0]),p=parseFloat(m[1]),m=parseFloat(m[2]);g?(d.add(h,p,m),d.add(h,p,m),d.add(h,p,m)):f.add(h,p,m);h=g=s}}else 32==e[l-1]&&(102==e[l]?(k=l+=13,g=q):118==e[l]&&(k=l+=7,h=q))}else{this.H=
80;f=W(this,"uint");b.j=d=new U(9*f);b.k=e=new U(9*f);for(c=c=0;c<f;c++)g=W(this,"float",12),k=g[0],l=g[1],h=g[2],e.add(k,l,h),e.add(k,l,h),e.add(k,l,h),d.add(g[3],g[4],g[5]),d.add(g[6],g[7],g[8]),d.add(g[9],g[10],g[11]),this.H+=2}H.qa(this.c+".parse");f=new Wc;f.ba=b;f.v=a;this.dispatchEvent(f)};C("X.parserSTL",Ae);C("X.parserSTL.prototype.parse",Ae.prototype.parse);function Be(){ud.call(this);this.c="parserDCM"}D(Be,ud);
Be.prototype.parse=function(a,b,c){c=this.gd(c,b);if(c.Sd==c.Za){var d=c.lf.length,e,f=0;for(e=0;e<d;e++){var g=c.lf[e];g!==n&&(g*=c.cb,c.data.set(c.$c.subarray(g,g+c.cb),f*c.cb),f++)}b.ra=[c.Ca[0],c.Ca[1],c.Ca[2]];Infinity==c.oa[2]&&(c.oa[2]=1);b.Eb=[c.oa[0],c.oa[1],c.oa[2]];e=vd(c.data);d=e[0];e=e[1];c.min=b.Oa=b.Y=d;c.max=b.aa=b.X=e;-Infinity==b.V&&(b.V=d);Infinity==b.W&&(b.W=e);c.ka=["left","posterior","superior"];d=Ec(new R(c.i[0],c.i[1],c.i[2]),new R(c.i[3],c.i[4],c.i[5]));c.i.push(d.x,d.y,
d.b);c.Ma=xd(c.ka,c.i);d=yd(this,c.Ma);c.orientation=d[0];c.lb=d[1];b.Ac(c);b.rb=zd(this,b);b.z()}c=new Wc;c.ba=b;c.v=a;this.dispatchEvent(c)};
Be.prototype.gd=function(a,b){this.A=a;var c=0;if(b.fc!=r){g=b.fc;h=W(this,"ushort",this.A.byteLength-2*g.cb);k=0;for(l=2;0<l;)if(d=h[k++],32==d)if(f=h[k++],19==f){k++;d=h[k++];for(f=0;f<d/2;f++)m=h[k++],p=m&255,m=(m&65280)>>8,c+=String.fromCharCode(p),c+=String.fromCharCode(m),c=parseInt(c,10);l--}else if(4161==f){k++;for(var d=h[k++],e="",f=0;f<d/2;f++)m=h[k++],p=m&255,m=(m&65280)>>8,e+=String.fromCharCode(p),e+=String.fromCharCode(m);g.oa=[g.oa[0],g.oa[1],Math.min(Math.abs(g.pg-e),g.oa[2])];g.pg=
e;l--}g.Ca[2]++}else{var g={rows:0,cols:0,oa:r,Fe:0,hh:0,Za:1,bi:1,pg:r,Sd:0,cb:0,$c:r,ef:0,lf:[],data:r,min:Infinity,max:-Infinity,origin:r,ka:r,i:r,Ma:r,orientation:r,lb:r};g.Za=b.m.length;g.Za==r&&(g.Za=1);for(var h=W(this,"ushort",this.A.byteLength),k=66,d=r,f=r,d=r,l=9;0<l;)if(d=h[k++],40==d)switch(f=h[k++],k++,d=h[k++],f){case 16:g.rows=h[k++];l--;break;case 17:g.cols=h[k++];l--;break;case 256:g.Fe=h[k++];l--;break;case 257:g.hh=h[k++];l--;break;case 2:g.bi=h[k++];l--;break;case 48:e="";for(f=
f=0;f<d/2;f++)var m=h[k++],p=m&255,m=(m&65280)>>8,e=e+String.fromCharCode(p),e=e+String.fromCharCode(m);e=e.split("\\");g.oa=[+e[0],+e[1],Infinity];l--}else if(32==d)switch(f=h[k++],k++,d=h[k++],f){case 19:for(f=0;f<d/2;f++)m=h[k++],p=m&255,m=(m&65280)>>8,c+=String.fromCharCode(p),c+=String.fromCharCode(m),c=parseInt(c,10);l--;break;case 50:e="";for(f=0;f<d/2;f++)m=h[k++],p=m&255,m=(m&65280)>>8,e+=String.fromCharCode(p),e+=String.fromCharCode(m);e=e.split("\\");g.origin=[+e[0],+e[1],+e[2]];l--;break;
case 55:e="";for(f=0;f<d/2;f++)m=h[k++],p=m&255,m=(m&65280)>>8,e+=String.fromCharCode(p),e+=String.fromCharCode(m);e=e.split("\\");g.i=[+e[0],+e[1],+e[2],+e[3],+e[4],+e[5]];l--}else if(16==d)switch(f=h[k++],k++,d=h[k++],f){case 8720:for(f=0;f<d/2;f++)k++}b.fc=g;g.Ca=[g.cols,g.rows,1];g.cb=g.rows*g.cols;switch(g.Fe){case 8:g.$c=new Uint8Array(g.cols*g.rows*g.Za);g.data=new Uint8Array(g.cols*g.rows*g.Za);break;case 16:g.$c=new Uint16Array(g.cols*g.rows*g.Za);g.data=new Uint16Array(g.cols*g.rows*g.Za);
break;case 32:g.$c=new Uint32Array(g.cols*g.rows*g.Za),g.data=new Uint32Array(g.cols*g.rows*g.Za)}}this.H=this.A.byteLength-2*g.cb;h=r;switch(g.Fe){case 8:h=W(this,"uchar",g.cb);break;case 16:h=W(this,"ushort",g.cb);break;case 32:h=W(this,"uint",g.cb)}g.lf[c]=g.ef;g.$c.set(h,g.ef*g.cb);g.ef++;++g.Sd;return g};C("X.parserDCM",Be);C("X.parserDCM.prototype.parse",Be.prototype.parse);function Ce(){ud.call(this);this.c="parserVTK"}D(Ce,ud);
Ce.prototype.parse=function(a,b,c){H.wa(this.c+".parse");var d=b.j,e=b.k,f=new Uint8Array(c),g="";b.j=d=new U(c.byteLength);b.k=e=new U(c.byteLength);c=0;for(var h=f.length;c<h;c+=32768)g+=wd(f,c,Math.min(c+32768,h));f=g.split("\n");g=f.length;this.Wc=this.Xc=r;this.Ob=[];this.ya=Tc;this.te=this.Bb=this.qb=this.Cb=s;c=0;for(h=g%8;h--;)De(this,f[c]),c++;for(h=0.125*g^0;h--;)De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,De(this,f[c]),c++,
De(this,f[c]),c++;c=this.Xc;var f=this.Wc,g=f.length,k=h=this.Ob.length;do{var l=this.Ob[h-k],m=l.length,p;for(p=0;p<m&&!("LINES"==this.ya&&p+1>=m);p++){var x=parseInt(l[p],10),w=c.get(x);d.add(w[0],w[1],w[2]);var y=x,z=w;"LINES"==this.ya?(y=parseInt(l[p+1],10),z=c.get(y),d.add(z[0],z[1],z[2])):"TRIANGLE_STRIPS"==this.ya&&(0==p||p==m-1)&&d.add(w[0],w[1],w[2]);x<g?(z=f.get(x),e.add(z[0],z[1],z[2]),"LINES"==this.ya?(y=f.get(y),e.add(y[0],y[1],y[2])):"TRIANGLE_STRIPS"==this.ya&&(0==p||p==m-1)&&e.add(z[0],
z[1],z[2])):(y=new R(w[0],w[1],w[2]),y.normalize(),e.add(y.x,y.y,y.b),"LINES"==this.ya?(y=new R(z[0],z[1],z[2]),y.normalize(),e.add(y.x,y.y,y.b)):"TRIANGLE_STRIPS"==this.ya&&(0==p||p==m-1)&&e.add(y.x,y.y,y.b))}k--}while(0<k);b.na=this.ya;H.qa(this.c+".parse");d=new Wc;d.ba=b;d.v=a;this.dispatchEvent(d)};
function De(a,b){b=b.replace(/^\s+|\s+$/g,"");var c=b.split(" "),d=c.length,e=c[0];switch(e){case "POINTS":a.Cb=q;a.qb=s;a.Bb=s;c=parseInt(c[1],10);a.Xc=new U(3*c);a.Wc=new U(3*c);return;case "VERTICES":a.qb=q;a.Cb=s;a.Bb=s;c=parseInt(c[1],10);3<=c?a.ya=Tc:1==c?a.ya="POINTS":j(Error("This VTK file is not supported!"));a.Ob=[];return;case "TRIANGLE_STRIPS":a.qb=q;a.Cb=s;a.Bb=s;a.ya="TRIANGLE_STRIPS";a.Ob=[];return;case "LINES":a.qb=q;a.Cb=s;a.Bb=s;a.ya="LINES";a.Ob=[];return;case "POLYGONS":a.qb=q;
a.Cb=s;a.Bb=s;a.ya="POLYGONS";a.Ob=[];return;case "POINT_DATA":a.Bb=q;a.Cb=s;a.qb=s;return}if(a.Cb)if(1==d||isNaN(parseFloat(e)))a.Cb=s;else{if(3<=d){var e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);a.Xc.add(e,f,g)}6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.Xc.add(e,f,g));9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.Xc.add(d,e,c))}else a.qb?1==d||isNaN(parseFloat(e))?a.qb=s:(c=c.slice(1),a.Ob.push(c)):a.Bb&&("NORMALS"==e?a.te=q:1==d||isNaN(parseFloat(e))?
(a.Bb=s,a.te=s):a.te&&(3<=d&&(e=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),a.Wc.add(e,f,g)),6<=d&&(e=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.Wc.add(e,f,g)),9<=d&&(d=parseFloat(c[6]),e=parseFloat(c[7]),c=parseFloat(c[8]),a.Wc.add(d,e,c))))}C("X.parserVTK",Ce);C("X.parserVTK.prototype.parse",Ce.prototype.parse);function Ee(){ud.call(this);this.c="parserFSM";this.pd=s}D(Ee,ud);
Ee.prototype.parse=function(a,b,c){H.wa(this.c+".parse");this.A=c;var d=b.j,e=b.k;b.pc=[];var f=b.pc;c=0;var g;do g=W(this,"uchar"),c++;while(200>c&&10!=g);W(this,"uchar");e=W(this,"uint");c=W(this,"uint");var h=W(this,"float",3*e);g=W(this,"uint",3*c);var k=new Uint32Array(e),l=new Float32Array(9*c);b.j=d=new U(9*c);b.k=e=new U(9*c);var m;for(m=0;m<c;m++){var p=3*m,x=g[p],w=g[p+1],y=g[p+2];f.push(x);f.push(w);f.push(y);k[x]+=1;k[w]+=1;k[y]+=1;var p=3*x,z=3*w,E=3*y,G=h[p],B=h[p+1],F=h[p+2],w=h[z],
y=h[z+1],x=h[z+2],I=h[E],J=h[E+1],T=h[E+2];d.add(G,B,F);d.add(w,y,x);d.add(I,J,T);G=new R(G,B,F);I=new R(I,J,T);w=(new R(w,y,x)).g().pa(G);y=I.g().pa(G);w=Ec(w,y).normalize();l[p]+=w.x;l[p+1]+=w.y;l[p+2]+=w.b;l[z]+=w.x;l[z+1]+=w.y;l[z+2]+=w.b;l[E]+=w.x;l[E+1]+=w.y;l[E+2]+=w.b}for(m=0;m<c;m++)p=3*m,x=g[p],w=g[p+1],y=g[p+2],p=3*x,z=3*w,E=3*y,f=new R(l[z],l[z+1],l[z+2]),h=new R(l[E],l[E+1],l[E+2]),p=(new R(l[p],l[p+1],l[p+2])).scale(1/k[x]).normalize(),f=f.scale(1/k[w]).normalize(),h=h.scale(1/k[y]).normalize(),
e.add(p.x,p.y,p.b),e.add(f.x,f.y,f.b),e.add(h.x,h.y,h.b);b.na=Tc;H.qa(this.c+".parse");c=new Wc;c.ba=b;c.v=a;this.dispatchEvent(c)};C("X.parserFSM",Ee);C("X.parserFSM.prototype.parse",Ee.prototype.parse);var Fe={Je:function(a,b,c){return Fe.update(a,0,b,c)},update:function(a,b,c,d){var e=Fe.Pg,f="number"===typeof c?c:c=0;d="number"===typeof d?d:a.length;b^=4294967295;for(f=d&7;f--;++c)b=b>>>8^e[(b^a[c])&255];for(f=d>>3;f--;c+=8)b=b>>>8^e[(b^a[c])&255],b=b>>>8^e[(b^a[c+1])&255],b=b>>>8^e[(b^a[c+2])&255],b=b>>>8^e[(b^a[c+3])&255],b=b>>>8^e[(b^a[c+4])&255],b=b>>>8^e[(b^a[c+5])&255],b=b>>>8^e[(b^a[c+6])&255],b=b>>>8^e[(b^a[c+7])&255];return(b^4294967295)>>>0}};
Fe.Pg=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 Ge(a){var b=a.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,h,k,l,m,p,x;for(p=0;p<b;++p)a[p]>c&&(c=a[p]),a[p]<d&&(d=a[p]);e=1<<c;f=new Uint32Array(e);g=1;h=0;for(k=2;g<=c;){for(p=0;p<b;++p)if(a[p]===g){l=0;m=h;for(x=0;x<g;++x)l=l<<1|m&1,m>>=1;for(x=l;x<e;x+=k)f[x]=g<<16|p;++h}++g;h<<=1;k<<=1}return[f,c,d]};function He(a,b){this.Ge=[];this.He=32768;this.Qa=this.Yc=this.ja=this.of=0;this.input=new Uint8Array(a);this.Sf=s;this.Ie=Ie;this.mb=s;if(b||!(b={}))b.index&&(this.ja=b.index),b.bufferSize&&(this.He=b.bufferSize),b.bufferType&&(this.Ie=b.bufferType),b.resize&&(this.mb=b.resize);switch(this.Ie){case Je:this.R=32768;this.Da=new Uint8Array(32768+this.He+258);break;case Ie:this.R=0;this.Da=new Uint8Array(this.He);this.ac=this.uh;this.Vf=this.kh;this.Pe=this.oh;break;default:j(Error("invalid inflate mode"))}}
var Je=0,Ie=1;
He.prototype.ad=function(){for(;!this.Sf;){var a=Ke(this,3);a&1&&(this.Sf=q);a>>>=1;switch(a){case 0:var a=this.input,b=this.ja,c=this.Da,d=this.R,e=n,f=n,g=n,h=c.length,e=n;this.Qa=this.Yc=0;e=a[b++];e===n&&j(Error("invalid uncompressed block header: LEN (first byte)"));f=e;e=a[b++];e===n&&j(Error("invalid uncompressed block header: LEN (second byte)"));f|=e<<8;e=a[b++];e===n&&j(Error("invalid uncompressed block header: NLEN (first byte)"));g=e;e=a[b++];e===n&&j(Error("invalid uncompressed block header: NLEN (second byte)"));g|=
e<<8;f===~g&&j(Error("invalid uncompressed block header: length verify"));b+f>a.length&&j(Error("input buffer is broken"));switch(this.Ie){case Je:for(;d+f>c.length;)e=h-d,f-=e,c.set(a.subarray(b,b+e),d),d+=e,b+=e,this.R=d,c=this.ac(),d=this.R;break;case Ie:for(;d+f>c.length;)c=this.ac({bg:2});break;default:j(Error("invalid inflate mode"))}c.set(a.subarray(b,b+f),d);d+=f;this.ja=b+=f;this.R=d;this.Da=c;break;case 1:this.Pe(Le,Me);break;case 2:Ne(this);break;default:j(Error("unknown BTYPE: "+a))}}return this.Vf()};
var Oe=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pe=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]),Qe=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]),Re=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]),Se=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]),Te=new Uint8Array(288),
Ue,Ve;Ue=0;for(Ve=Te.length;Ue<Ve;++Ue)Te[Ue]=143>=Ue?8:255>=Ue?9:279>=Ue?7:8;var Le=Ge(Te),We=new Uint8Array(30),Xe,Ye;Xe=0;for(Ye=We.length;Xe<Ye;++Xe)We[Xe]=5;var Me=Ge(We);function Ke(a,b){for(var c=a.Yc,d=a.Qa,e=a.input,f=a.ja,g;d<b;)g=e[f++],g===n&&j(Error("input buffer is broken")),c|=g<<d,d+=8;g=c&(1<<b)-1;a.Yc=c>>>b;a.Qa=d-b;a.ja=f;return g}
function Ze(a,b){for(var c=a.Yc,d=a.Qa,e=a.input,f=a.ja,g=b[0],h=b[1],k;d<h;)k=e[f++],k===n&&j(Error("input buffer is broken")),c|=k<<d,d+=8;e=g[c&(1<<h)-1];g=e>>>16;a.Yc=c>>g;a.Qa=d-g;a.ja=f;return e&65535}
function Ne(a){function b(a,b,c){var d,e,f;for(f=0;f<a;)switch(d=Ze(this,b),d){case 16:for(d=3+Ke(this,2);d--;)c[f++]=e;break;case 17:for(d=3+Ke(this,3);d--;)c[f++]=0;e=0;break;case 18:for(d=11+Ke(this,7);d--;)c[f++]=0;e=0;break;default:e=c[f++]=d}return c}var c=Ke(a,5)+257,d=Ke(a,5)+1,e=Ke(a,4)+4,f=new Uint8Array(Oe.length),g;for(g=0;g<e;++g)f[Oe[g]]=Ke(a,3);e=Ge(f);f=new Uint8Array(c);g=new Uint8Array(d);a.Pe(Ge(b.call(a,c,e,f)),Ge(b.call(a,d,e,g)))}u=He.prototype;
u.Pe=function(a,b){var c=this.Da,d=this.R;this.Yf=a;for(var e=c.length-258,f,g,h;256!==(f=Ze(this,a));)if(256>f)d>=e&&(this.R=d,c=this.ac(),d=this.R),c[d++]=f;else{f-=257;h=Pe[f];0<Qe[f]&&(h+=Ke(this,Qe[f]));f=Ze(this,b);g=Re[f];0<Se[f]&&(g+=Ke(this,Se[f]));d>=e&&(this.R=d,c=this.ac(),d=this.R);for(;h--;)c[d]=c[d++-g]}for(;8<=this.Qa;)this.Qa-=8,this.ja--;this.R=d};
u.oh=function(a,b){var c=this.Da,d=this.R;this.Yf=a;for(var e=c.length,f,g,h;256!==(f=Ze(this,a));)if(256>f)d>=e&&(c=this.ac(),e=c.length),c[d++]=f;else{f-=257;h=Pe[f];0<Qe[f]&&(h+=Ke(this,Qe[f]));f=Ze(this,b);g=Re[f];0<Se[f]&&(g+=Ke(this,Se[f]));d+h>e&&(c=this.ac(),e=c.length);for(;h--;)c[d]=c[d++-g]}for(;8<=this.Qa;)this.Qa-=8,this.ja--;this.R=d};
u.ac=function(){var a=new Uint8Array(this.R-32768),b=this.R-32768,c=this.Da;a.set(c.subarray(32768,a.length));this.Ge.push(a);this.of+=a.length;c.set(c.subarray(b,b+32768));this.R=32768;return c};u.uh=function(a){var b=this.input.length/this.ja+1|0,c=this.input,d=this.Da;a&&("number"===typeof a.bg&&(b=a.bg),"number"===typeof a.dh&&(b+=a.dh));2>b?(a=(c.length-this.ja)/this.Yf[2],a=258*(a/2)|0,a=a<d.length?d.length+a:d.length<<1):a=d.length*b;a=new Uint8Array(a);a.set(d);return this.Da=a};
u.Vf=function(){var a=0,b=this.Da,c=this.Ge,d,e=new Uint8Array(this.of+(this.R-32768)),f,g,h,k;if(0===c.length)return this.Da.subarray(32768,this.R);f=0;for(g=c.length;f<g;++f){d=c[f];h=0;for(k=d.length;h<k;++h)e[a++]=d[h]}f=32768;for(g=this.R;f<g;++f)e[a++]=b[f];this.Ge=[];return this.buffer=e};u.kh=function(){var a,b=this.R;this.mb?(a=new Uint8Array(b),a.set(this.Da.subarray(0,b))):a=this.Da.subarray(0,b);return this.buffer=a};new Uint8Array(256);var $e;for($e=0;256>$e;++$e)for(var af=$e,bf=7,af=af>>>1;af;af>>>=1)--bf;var cf=[],df;for(df=0;288>df;df++)switch(q){case 143>=df:cf.push([df+48,8]);break;case 255>=df:cf.push([df-144+400,9]);break;case 279>=df:cf.push([df-256+0,7]);break;case 287>=df:cf.push([df-280+192,8]);break;default:j("invalid literal: "+df)}
function ef(){var a=ff;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:j("invalid length: "+a)}}var gf=[],ff,hf;
for(ff=3;258>=ff;ff++)hf=ef(),gf[ff]=hf[2]<<24|hf[1]<<16|hf[0];new Uint32Array(gf);function jf(){};function kf(a){this.input=a;this.ja=0;this.member=[]}
kf.prototype.ad=function(){for(var a=this.input.length;this.ja<a;){var b=new jf,c=n,d=n,e=n,f=c=e=n,g=n,c=c=n,h=this.input,d=this.ja;b.hg=h[d++];b.ig=h[d++];(31!==b.hg||139!==b.ig)&&j(Error("invalid file signature:",b.hg,b.ig));b.Uf=h[d++];switch(b.Uf){case 8:break;default:j(Error("unknown compression method: "+b.Uf))}b.Jd=h[d++];c=h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24;b.jk=new Date(1E3*c);b.nk=h[d++];b.kk=h[d++];0<(b.Jd&4)&&(b.hj=h[d++]|h[d++]<<8,d+=b.hj);if(0<(b.Jd&8)){g=[];for(f=0;0<(c=h[d++]);)g[f++]=
String.fromCharCode(c);b.name=g.join("")}if(0<(b.Jd&16)){g=[];for(f=0;0<(c=h[d++]);)g[f++]=String.fromCharCode(c);b.comment=g.join("")}0<(b.Jd&2)&&(b.lh=Fe.Je(h,0,d)&65535,b.lh!==(h[d++]|h[d++]<<8)&&j(Error("invalid header crc16")));c=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24;h.length-d-4-4<512*c&&(e=c);d=new He(h,{index:d,bufferSize:e});b.data=e=d.ad();d=d.ja;b.ck=c=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0;Fe.Je(e)!==c&&j(Error("invalid CRC-32 checksum: 0x"+Fe.Je(e).toString(16)+
" / 0x"+c.toString(16)));b.gk=c=(h[d++]|h[d++]<<8|h[d++]<<16|h[d++]<<24)>>>0;(e.length&4294967295)!==c&&j(Error("invalid input size: "+(e.length&4294967295)+" / "+c));this.member.push(b);this.ja=d}a=this.member;b=e=d=0;for(h=a.length;b<h;++b)e+=a[b].data.length;e=new Uint8Array(e);for(b=0;b<h;++b)e.set(a[b].data,d),d+=a[b].data.length;return e};function lf(){ud.call(this);this.c="parserMGZ";this.pd=s}D(lf,ud);
lf.prototype.parse=function(a,b,c,d){H.wa(this.c+".parse");d&&(c=(new kf(new Uint8Array(c))).ad(),c=c.buffer);d=this.gd(c);b.ra=[d.We,d.Xe,d.Ye];b.Eb=d.Jg;c=d.min;var e=d.max;b.Oa=b.Y=c;b.aa=b.X=e;-Infinity==b.V&&(b.V=c);Infinity==b.W&&(b.W=e);d.ka=["right","anterior","superior"];d.i=[];d.i.push(d.Ua[0][0]);d.i.push(d.Ua[0][1]);d.i.push(d.Ua[0][2]);d.i.push(d.Ua[1][0]);d.i.push(d.Ua[1][1]);d.i.push(d.Ua[1][2]);d.i.push(d.Ua[2][0]);d.i.push(d.Ua[2][1]);d.i.push(d.Ua[2][2]);d.Ma=xd(d.ka,d.i);c=yd(this,
d.Ma);d.orientation=c[0];d.lb=c[1];b.Ac(d);H.qa(this.c+".parse");b.rb=zd(this,b);b.z();d=new Wc;d.ba=b;d.v=a;this.dispatchEvent(d)};
lf.prototype.gd=function(a){this.A=a;a={version:0,Sg:0,Qg:0,Ah:0,Rg:0,We:0,Xe:0,Ye:0,ai:0,type:0,sh:0,Gg:0,nj:r,Ua:r,Jg:r,data:r,min:Infinity,max:-Infinity,ka:r,i:r,Ma:r,orientation:r,lb:r};a.version=W(this,"uint");a.We=W(this,"uint");a.Xe=W(this,"uint");a.Ye=W(this,"uint");a.ai=W(this,"uint");a.type=W(this,"uint");a.sh=W(this,"uint");a.Gg=W(this,"ushort");if(0<a.Gg){a.Jg=W(this,"float",3);var b=[];b.push(W(this,"float",3));b.push(W(this,"float",3));b.push(W(this,"float",3));b.push(W(this,"float",
3));a.Ua=b}this.H=284;b=a.We*a.Xe*a.Ye;switch(a.type){case 0:a.data=W(this,"uchar",b);break;case 1:a.data=W(this,"uint",b);break;case 3:a.data=W(this,"float",b);break;case 4:a.data=W(this,"ushort",b);break;default:j(Error("Unsupported MGH/MGZ data type: "+a.type))}b=vd(a.data);a.min=b[0];a.max=b[1];this.H+16<this.A.byteLength&&(a.Sg=W(this,"float"),a.Ah=W(this,"float"),a.Qg=W(this,"float"),a.Rg=W(this,"float"));return a};C("X.parserMGZ",lf);C("X.parserMGZ.prototype.parse",lf.prototype.parse);function mf(){ud.call(this);this.c="parserCRV";this.pd=s}D(mf,ud);
mf.prototype.parse=function(a,b,c){H.wa(this.c+".parse");var d=b.pc;0==d.length&&j(Error("No _pointIndices defined on the X.object."));this.A=c;this.H=3;var e=W(this,"uint");W(this,"uint");W(this,"uint");var f=0,g=0,h=0,k=0,l=0,m=0,p=0,x=0,w=0,y=0,z=0;c=Array(2);var E=Array(2),G=W(this,"float",e),B;for(B=0;B<e;B++){var F=G[B];0==B&&(c[0]=E[0]=F);0<=F?(f++,k+=F):(g++,h+=F);w+=F;z++;E[0]=Math.max(F,E[0]);c[0]=Math.min(F,c[0]);G[B]=F}0!=f&&(l=k/f);0!=g&&(m=h/g);0!=z&&(y=w/z);for(z=w=h=k=0;z<e;z++)F=
G[z],B=0,0<=F?(B=Math.pow(F-l,2),k+=B):(B=Math.pow(F-m,2),h+=B),B=Math.pow(F-y,2),w+=B;1<f&&(p=Math.sqrt(k/(f-1)));1<g&&(x=Math.sqrt(h/(g-1)));c[1]=m-2.5*x;E[1]=l+2.5*p;e=d.length;f=new Float32Array(3*e);for(z=0;z<e;z++)g=G[d[z]],h=3*z,f[h]=g,f[h+1]=g,f[h+2]=g;b.w.Oa=c[1];b.w.aa=E[1];-Infinity==b.w.V&&(b.w.V=c[1]);Infinity==b.w.W&&(b.w.W=E[1]);b.w.u=G;b.w.Fc=f;b.w.e=q;H.qa(this.c+".parse");d=new Wc;d.ba=b;d.v=a;this.dispatchEvent(d)};C("X.parserCRV",mf);C("X.parserCRV.prototype.parse",mf.prototype.parse);function nf(){ud.call(this);this.c="parserTRK"}D(nf,ud);
nf.prototype.parse=function(a,b,c){H.wa(this.c+".parse");var d=b.j,e=b.k,f=b.$;this.A=c;W(this,"uchar",6);W(this,"ushort",3);var g=W(this,"float",3);W(this,"float",3);var h=W(this,"ushort");W(this,"uchar",200);W(this,"ushort");W(this,"uchar",200);W(this,"float",16);W(this,"uchar",444);W(this,"uchar",4);W(this,"uchar",4);W(this,"float",6);W(this,"uchar",2);W(this,"uchar");W(this,"uchar");W(this,"uchar");W(this,"uchar");W(this,"uchar");W(this,"uchar");var k=W(this,"uint");W(this,"uint");var l=W(this,
"uint"),m=[],p=[];c=Infinity;var x=-Infinity,w=r,y=r,z=r,E=r,e=d=r,G=W(this,"uint",(this.A.byteLength-1E3)/4);this.H=l;for(var B=W(this,"float",(this.A.byteLength-1E3)/4),F=0,l=f=0;l<k;l++){for(var I=G[F],J=new U(3*I),T=0,K=0;K<I;K++){var S=B[F+3*K+K*h+1],P=B[F+3*K+K*h+2],N=B[F+3*K+K*h+3],S=S/g[0],P=P/g[1],N=N/g[2];J.add(S,P,N);if(0<K)var O=J.get(K-1),T=T+Math.sqrt(Math.pow(S-O[0],2)+Math.pow(P-O[1],2)+Math.pow(N-O[2],2));K<I-1&&(f+=6)}F+=3*I+I*h+1;K=J.Sb;I=J.Pb;S=J.Tb;P=J.Qb;N=J.Ub;O=J.Rb;if(!w||
K<w)w=K;if(!y||I>y)y=I;if(!z||S<z)z=S;if(!E||P>E)E=P;if(!d||N<d)d=N;if(!e||O>e)e=O;m.push(J);p.push(T)}g=(w+y)/2;z=(z+E)/2;h=(d+e)/2;E=new Float32Array(f);b.j=d=new U(f);b.k=e=new U(f);b.$=f=new U(f);for(l=w=0;l<k;l++){y=m[l];G=y.count;T=p[l];c=Math.min(c,T);x=Math.max(x,T);for(K=0;K<G-1;K++){F=y.get(K);B=y.get(K+1);d.add(F[0],F[1],F[2]);d.add(B[0],B[1],B[2]);var J=F[0]-g,I=F[1]-z,S=F[2]-h,P=Math.sqrt(J*J+I*I+S*S),N=B[0]-g,O=B[1]-z,ba=B[2]-h,ea=Math.sqrt(N*N+O*O+ba*ba);e.add(J/P,I/P,S/P);e.add(N/
ea,O/ea,ba/ea);B=[Math.abs(B[0]-F[0]),Math.abs(B[1]-F[1]),Math.abs(B[2]-F[2])];F=Math.sqrt(B[0]*B[0]+B[1]*B[1]+B[2]*B[2]);B[0]/=F;B[1]/=F;B[2]/=F;f.add(B[0],B[1],B[2]);f.add(B[0],B[1],B[2]);E[w++]=T;E[w++]=T;E[w++]=T;E[w++]=T;E[w++]=T;E[w++]=T}}b.na="LINES";k=new Vc;k.Oa=c;k.aa=x;k.V=c;k.W=x;k.Fc=E;k.Mf=s;k.e=q;b.w=k;H.qa(this.c+".parse");c=new Wc;c.ba=b;c.v=a;this.dispatchEvent(c)};C("X.parserTRK",nf);C("X.parserTRK.prototype.parse",nf.prototype.parse);function of(){ud.call(this);this.c="parserIMAGE"}D(of,ud);of.prototype.parse=function(a,b,c,d){c instanceof ArrayBuffer||j(Error());for(var e=new Uint8Array(c),f=e.length,g=Array(f);f--;)g[f]=String.fromCharCode(e[f]);e=window.btoa(g.join(""));f=new Image;Yb(f,"load",this.Di.bind(this,f,a,b,c,d));f.src="data:image/"+d+";base64,"+e};of.prototype.Di=function(a,b,c){b.rb=a;b.Xb=r;a=new Wc;a.ba=c;a.v=b;this.dispatchEvent(a)};C("X.parserIMAGE",of);C("X.parserIMAGE.prototype.parse",of.prototype.parse);function pf(){ud.call(this);this.c="parserLUT"}D(pf,ud);
pf.prototype.parse=function(a,b,c){H.wa(this.c+".parse");this.A=c;c=W(this,"uchar",c.byteLength);var d=c.length,e=0,f;for(f=0;f<d;f++)if(10==c[f]){var g=wd(c,e,f),e=f+1,g=g.replace(/^\s+|\s+$/g,"");"#"!=g[0]&&(g=g.split(" "),g=g.filter(function(a){return""!=a}),6==g.length&&(g[2]=parseInt(g[2],10)/255,g[3]=parseInt(g[3],10)/255,g[4]=parseInt(g[4],10)/255,g[5]=parseInt(g[5],10)/255,a.add(parseInt(g[0],10),g[1],g[2],g[3],g[4],g[5],10)))}H.qa(this.c+".parse");c=new Wc;c.ba=b;c.v=a;this.dispatchEvent(c)};
C("X.parserLUT",pf);C("X.parserLUT.prototype.parse",pf.prototype.parse);function qf(){ud.call(this);this.c="parserNRRD"}D(qf,ud);
qf.prototype.parse=function(a,b,c){H.wa(this.c+".parse");this.A=c;c=W(this,"uchar",c.byteLength);var d=c.length,e=r,f=0,g;for(g=1;g<d;g++)if(10==c[g-1]&&10==c[g]){e=wd(c,0,g-2);f=g+1;break}var h,k,l,m,d=e.split(/\r?\n/),e=0;for(g=d.length;e<g;e++)if(h=d[e],h.match(/NRRD\d+/))this.Th=q;else if(!h.match(/^#/)&&(m=h.match(/(.*):(.*)/)))k=m[1].trim(),h=m[2].trim(),(l=this.wh[k])?l.call(this,h):this[k]=h;this.Th||j(Error("Not an NRRD file"));"raw"!==this.encoding&&("gzip"!==this.encoding&&"gz"!==this.encoding)&&
j(Error("Only raw or gz/gzip encoding is allowed"));if(!this.M&&(this.M=[new R(1,0,0),new R(0,1,0),new R(0,0,1)],this.mf)){d=[];for(m=0;2>=m;m++)d.push(!isNaN(this.mf[m])?this.M[m].scale(this.mf[m]):n)}f=c.subarray(f);if("gzip"==this.encoding||"gz"==this.encoding)f=(new kf(new Uint8Array(f))).ad();f=f.buffer;c={data:r,min:Infinity,max:-Infinity,ka:r,i:r,Ma:r,orientation:r,lb:r};c.data=new this.pb(f);m=vd(c.data);f=c.min=m[0];m=c.max=m[1];b.Oa=b.Y=f;b.aa=b.X=m;b.ra=[this.jf[0],this.jf[1],this.jf[2]];
d=(new R(this.M[0][0],this.M[0][1],this.M[0][2])).kb();e=(new R(this.M[1][0],this.M[1][1],this.M[1][2])).kb();g=(new R(this.M[2][0],this.M[2][1],this.M[2][2])).kb();b.Eb=[d,e,g];-Infinity==b.V&&(b.V=f);Infinity==b.W&&(b.W=m);c.ka=c.ka=this.ka;c.i=[];c.i.push(this.M[0][0]);c.i.push(this.M[0][1]);c.i.push(this.M[0][2]);c.i.push(this.M[1][0]);c.i.push(this.M[1][1]);c.i.push(this.M[1][2]);c.i.push(this.M[2][0]);c.i.push(this.M[2][1]);c.i.push(this.M[2][2]);c.i=c.i;c.Ma=xd(c.ka,c.i);f=yd(this,c.Ma);c.orientation=
c.orientation=f[0];c.lb=c.lb=f[1];b.Ac(c);H.qa(this.c+".parse");b.rb=zd(this,b);b.z();c=new Wc;c.ba=b;c.v=a;this.dispatchEvent(c)};
qf.prototype.wh={type:function(a){switch(a){case "uchar":case "unsigned char":case "uint8":case "uint8_t":this.pb=Uint8Array;break;case "signed char":case "int8":case "int8_t":this.pb=Int8Array;break;case "short":case "short int":case "signed short":case "signed short int":case "int16":case "int16_t":this.pb=Int16Array;break;case "ushort":case "unsigned short":case "unsigned short int":case "uint16":case "uint16_t":this.pb=Uint16Array;break;case "int":case "signed int":case "int32":case "int32_t":this.pb=
Int32Array;break;case "uint":case "unsigned int":case "uint32":case "uint32_t":this.pb=Uint32Array;break;case "float":this.pb=Float32Array;break;case "double":this.pb=Float64Array;break;default:j(Error("Unsupported NRRD data type: "+a))}return this.type=a},endian:function(a){return this.fk=a},encoding:function(a){return this.encoding=a},dimension:function(a){return this.Ca=parseInt(a,10)},sizes:function(a){var b,c,d,e;d=a.split(/\s+/);e=[];b=0;for(c=d.length;b<c;b++)a=d[b],e.push(parseInt(a,10));
return this.jf=e},space:function(a){return this.ka=a.split("-")},"space directions":function(a){var b,c;a=a.match(/\(.*?\)/g);var d,e,f;f=[];d=0;for(e=a.length;d<e;d++)c=a[d],f.push(function(){var a,d,e,f;e=c.slice(1,-1).split(/,/);f=[];a=0;for(d=e.length;a<d;a++)b=e[a],f.push(parseFloat(b));return f}());return this.M=f},spacings:function(a){var b;b=a.split(/\s+/);var c,d,e;e=[];c=0;for(d=b.length;c<d;c++)a=b[c],e.push(parseFloat(a));return this.mf=e}};C("X.parserNRRD",qf);
C("X.parserNRRD.prototype.parse",qf.prototype.parse);function rf(){ud.call(this);this.c="parserNII"}D(rf,ud);
rf.prototype.parse=function(a,b,c){H.wa(this.c+".parse");var d=c,e=-1,e="undefined"==typeof DataView?(new Int32Array(c,0,1))[0]:(new DataView(c,0)).getInt32(0,q);348!=e&&(d=(new kf(new Uint8Array(d))).ad(),d=d.buffer);c=this.gd(d);b.ra=[c.Ca[1],c.Ca[2],c.Ca[3]];b.Eb=[c.oa[1],c.oa[2],c.oa[3]];d=c.min;e=c.max;b.Oa=b.Y=d;b.aa=b.X=e;-Infinity==b.V&&(b.V=d);Infinity==b.W&&(b.W=e);c.ka=["right","anterior","superior"];c.i=[];c.i.push(c.ee[0]);c.i.push(c.ee[1]);c.i.push(c.ee[2]);c.i.push(c.fe[0]);c.i.push(c.fe[1]);
c.i.push(c.fe[2]);c.i.push(c.ge[0]);c.i.push(c.ge[1]);c.i.push(c.ge[2]);c.Ma=xd(c.ka,c.i);d=yd(this,c.Ma);c.orientation=d[0];c.lb=d[1];b.Ac(c);H.qa(this.c+".parse");b.rb=zd(this,b);b.z();c=new Wc;c.ba=b;c.v=a;this.dispatchEvent(c)};
rf.prototype.gd=function(a){this.A=a;a={Vi:0,mh:r,nh:r,vh:0,Si:0,Ni:0,rh:r,Ca:r,Ph:0,Qh:0,Rh:0,Nh:0,Oe:0,gh:0,Zi:0,oa:r,Kg:0,Ri:0,Qi:0,Yi:0,Wi:r,ij:r,ih:0,jh:0,Xi:0,cj:0,Ch:0,Dh:0,ph:r,fh:r,Gi:0,Ti:0,Ki:0,Li:0,Mi:0,Hi:0,Ii:0,Ji:0,ee:r,fe:r,ge:r,Oh:r,Vh:r,data:r,min:Infinity,max:-Infinity,ka:r,i:r,Ma:r,orientation:r,lb:r};a.Vi=W(this,"uint");a.mh=W(this,"uchar",10);a.nh=W(this,"uchar",18);a.vh=W(this,"uint");a.Si=W(this,"ushort");a.Ni=W(this,"uchar");a.rh=W(this,"uchar");a.Ca=W(this,"ushort",8);a.Ph=
W(this,"float");a.Qh=W(this,"float");a.Rh=W(this,"float");a.Nh=W(this,"ushort");a.Oe=W(this,"ushort");a.gh=W(this,"ushort");a.Zi=W(this,"ushort");a.oa=W(this,"float",8);a.Kg=W(this,"float");a.Ri=W(this,"float");a.Qi=W(this,"float");a.Yi=W(this,"ushort");a.Wi=W(this,"uchar");a.ij=W(this,"uchar");a.ih=W(this,"float");a.jh=W(this,"float");a.Xi=W(this,"float");a.cj=W(this,"float");a.Ch=W(this,"uint",1);a.Dh=W(this,"uint",1);a.ph=W(this,"uchar",80);a.fh=W(this,"uchar",24);a.Gi=W(this,"ushort");a.Ti=W(this,
"ushort");a.Ki=W(this,"float");a.Li=W(this,"float");a.Mi=W(this,"float");a.Hi=W(this,"float");a.Ii=W(this,"float");a.Ji=W(this,"float");a.ee=W(this,"float",4);a.fe=W(this,"float",4);a.ge=W(this,"float",4);a.Oh=W(this,"uchar",16);a.Vh=W(this,"uchar",4);this.H=parseInt(a.Kg,10);var b=a.Ca[1]*a.Ca[2]*a.Ca[3];switch(a.Oe){case 2:a.data=W(this,"uchar",b);break;case 4:a.data=W(this,"sshort",b);break;case 8:a.data=W(this,"sint",b);break;case 16:a.data=W(this,"float",b);break;case 256:a.data=W(this,"schar",
b);break;case 512:a.data=W(this,"ushort",b);break;case 768:a.data=W(this,"uint",b);break;default:j(Error("Unsupported NII data type: "+a.Oe))}b=vd(a.data);a.min=b[0];a.max=b[1];return a};C("X.parserNII",rf);C("X.parserNII.prototype.parse",rf.prototype.parse);function sf(){ud.call(this);this.c="parserOBJ"}D(sf,ud);
sf.prototype.parse=function(a,b,c){H.wa(this.c+".parse");this.A=c;c=c.byteLength;var d=W(this,"uchar",c),e=[];b.j=new U(c);b.k=new U(c);var f=b.j,g=b.k,h=0,k;for(k=0;k<c;++k)if(10==d[k]){var l=wd(d,h,k).replace(/\s{2,}/g," ").split(" ");if("v"==l[0])e.push([parseFloat(l[1]),parseFloat(l[2]),parseFloat(l[3])]);else if("f"==l[0]){var m=e[parseInt(l[1],10)-1],h=e[parseInt(l[2],10)-1],l=e[parseInt(l[3],10)-1];f.add(m[0],m[1],m[2]);f.add(h[0],h[1],h[2]);f.add(l[0],l[1],l[2]);m=new R(m[0],m[1],m[2]);l=
new R(l[0],l[1],l[2]);h=Ec((new R(h[0],h[1],h[2])).pa(m),l.pa(m));h.normalize();g.add(h.x,h.y,h.b);g.add(h.x,h.y,h.b);g.add(h.x,h.y,h.b)}h=k+1}H.qa(this.c+".parse");c=new Wc;c.ba=b;c.v=a;this.dispatchEvent(c)};C("X.parserOBJ",sf);C("X.parserOBJ.prototype.parse",sf.prototype.parse);function tf(){M.call(this);this.c="loader";this.mc=new wc;this.Tc=0}D(tf,M);function uf(a,b){a.Tc+=b/a.mc.Kd()/3;a.Tc=Math.min(1,a.Tc);var c=new td;c.Qf=a.Tc;a.dispatchEvent(c)}function vf(a){a=a.m.ud;var b=a.split(".").pop().toUpperCase();b==a.toUpperCase()&&(b="");b in wf||j(Error("The "+b+" file format is not supported."));return[a,b,wf[b][0],wf[b][1],wf[b][2]]}
tf.prototype.load=function(a,b){(!a||!b)&&j(Error("No container or object to load."));if(!zc(this.mc.z,a.fa)||this.mc.get(a.fa)){this.mc.set(a.fa,s);var c=vf(a)[0];if(a.Va!=r)this.parse(r,a,b);else{var d=new XMLHttpRequest;L(d,"abort",this.ag.bind(this,d,a,b));L(d,"error",this.ag.bind(this,d,a,b));L(d,"load",this.parse.bind(this,d,a,b));d.open("GET",c,q);d.responseType="arraybuffer";d.send(r)}}};
tf.prototype.parse=function(a,b,c){uf(this,1);setTimeout(function(){var d=vf(b),e=d[3],d=new d[2];Yb(d,hd,this.complete.bind(this));var f=b.Va;f==r&&(f=a.response,b.Va=f);d.parse(b,c,f,e)}.bind(this),100)};tf.prototype.complete=function(a){uf(this,1);setTimeout(function(){var b=a.v,c=a.ba;b.m.e=s;b.e=q;c.l();this.mc.set(b.fa,q)}.bind(this),100)};tf.prototype.ag=function(a,b,c){j(Error("Loading failed: ",b,c))};
var wf={OBJ:[sf,r],STL:[Ae,r],VTK:[Ce,r],TRK:[nf,r],FSM:[Ee,r],INFLATED:[Ee,r],SMOOTHWM:[Ee,r],SPHERE:[Ee,r],PIAL:[Ee,r],ORIG:[Ee,r],NRRD:[qf,r],NII:[rf,r],GZ:[rf,r],DCM:[Be,r],DICOM:[Be,r],"":[Be,r],CRV:[mf,r],LABEL:[Bd,r],MGH:[lf,s],MGZ:[lf,q],TXT:[pf,r],LUT:[pf,r],PNG:[of,"png"],JPG:[of,"jpeg"],JPEG:[of,"jpeg"],GIF:[of,"gif"]};function xf(a,b){(!v(a)||!v(b))&&j(Error("A camera needs valid width and height values."));M.call(this);this.c="camera";this.za=new H.f(0,100,0);this.kc=new H.f(0,0,0);this.L=new H.f(0,0,1);this.o=this.Ud(this.za,this.kc)}D(xf,M);xf.prototype.observe=function(a){(a==r||!(a instanceof re))&&j(Error("Could not observe the interactor."));L(a,cd,this.pi.bind(this));L(a,bd,this.ni.bind(this));L(a,dd,this.Bi.bind(this))};
xf.prototype.pi=function(a){a instanceof nd||j(Error("Received no valid rotate event."));this.rotate(a.N)};xf.prototype.Bi=function(a){a instanceof od||j(Error("Received no valid zoom event."));a.Wa?this.Mg(a.Na):this.Ng(a.Na)};xf.prototype.ni=function(a){a instanceof md||j(Error("Received no valid pan event."));this.Cg(a.N)};xf.prototype.__defineGetter__("view",t("o"));xf.prototype.__defineSetter__("view",function(a){(a==r||!(a instanceof Float32Array))&&j(Error("Invalid view matrix."));this.o=a});
xf.prototype.__defineGetter__("position",function(){return[this.za.x,this.za.y,this.za.b]});xf.prototype.__defineSetter__("position",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid position."));this.za=new H.f(a[0],a[1],a[2]);this.reset()});xf.prototype.__defineGetter__("focus",function(){return[this.kc.x,this.kc.y,this.kc.b]});xf.prototype.__defineSetter__("focus",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid focus"));this.kc=new H.f(a[0],a[1],a[2]);this.reset()});
xf.prototype.__defineGetter__("up",function(){return[this.L.x,this.L.y,this.L.b]});xf.prototype.__defineSetter__("up",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid up vector."));this.L=new H.f(a[0],a[1],a[2]);this.reset()});u=xf.prototype;u.reset=function(){this.o=this.Ud(this.za,this.kc)};u.rotate=function(a){ka(a)&&2==a.length?a=new H.f(a[0],a[1],0):a instanceof H.f||j(Error("Invalid distance vector for rotate operation."));return a};
u.Cg=function(a){ka(a)&&2==a.length?a=new H.f(a[0],a[1],0):a instanceof H.f||j(Error("Invalid distance vector for pan operation."));this.o[12]-=a.x;this.o[13]+=a.y};u.Mg=function(a){var b=20;a!=r&&!a&&(b=1);this.o[14]+=b};u.Ng=function(a){var b=30;a!=r&&!a&&(b=1);this.o[14]-=b};u.Ud=function(a,b){(!(a instanceof H.f)||!(b instanceof H.f))&&j(Error("3D vectors required for calculating the view."));return H.d.cd()};C("X.camera",xf);C("X.camera.prototype.pan",xf.prototype.Cg);
C("X.camera.prototype.rotate",xf.prototype.rotate);C("X.camera.prototype.zoomIn",xf.prototype.Mg);C("X.camera.prototype.zoomOut",xf.prototype.Ng);function yf(a){function b(a,b,d){b=2*b*Math.PI;b=Aa(Ba(k,Math.cos(b)),Ba(l,Math.sin(b)));a=Aa(Aa(c,Ba(e,a)),Ba(b,f));d=Aa(Ba(b,1-Math.abs(d)),Ba(g,d));return new gc(a,d)}this.F=[];a=a||{};var c=new za(a.start||[0,-1,0]),d=new za(a.end||[0,1,0]),e=Ca(d,c),f=a.$a||1;a=a.kf||16;for(var g=Da(e),h=0.5<Math.abs(g.y()),k=Da((new za(h,!h,0)).$b(g)),l=Da(k.$b(g)),h=new gc(c,Ea(g)),d=new gc(d,Da(g)),m=[],p=0;p<a;p++){var x=p/a,w=(p+1)/a;m.push(new ic([h,b(0,x,-1),b(0,w,-1)]));m.push(new ic([b(0,w,0),b(0,x,
0),b(1,x,0),b(1,w,0)]));m.push(new ic([d,b(1,w,1),b(1,x,1)]))}return rc(m)}D(yf,qc);function zf(){V.call(this);this.c="cylinder";this.Be=[-10,-10,-10];this.je=[10,10,10];this.Wb=10;this.Uc=32;Fa(this,new Yc)}D(zf,V);zf.prototype.__defineGetter__("start",t("Be"));zf.prototype.__defineSetter__("start",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid start"));this.Be=a});zf.prototype.__defineGetter__("end",t("je"));zf.prototype.__defineSetter__("end",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid end"));this.je=a});zf.prototype.__defineGetter__("radius",t("Wb"));
zf.prototype.__defineSetter__("radius",function(a){v(a)||j(Error("Invalid radius."));this.Wb=a});zf.prototype.l=function(){$c(this,new yf({start:this.Be,end:this.je,$a:this.Wb,kf:this.Uc}));zf.p.l.call(this)};C("X.cylinder",zf);C("X.cylinder.prototype.modified",zf.prototype.l);function Af(a){function b(a,b){a*=2*Math.PI;b*=Math.PI;var e=new za(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new gc(Aa(c,Ba(e,d)),e))}this.F=[];a=a||{};var c=new za(a.Ke||[0,0,0]),d=a.$a||1,e=a.kf||16;a=a.$i||8;for(var f=[],g=[],h=0;h<e;h++)for(var k=0;k<a;k++)g=[],b(h/e,k/a),0<k&&b((h+1)/e,k/a),k<a-1&&b((h+1)/e,(k+1)/a),b(h/e,(k+1)/a),f.push(new ic(g));return rc(f)}D(Af,qc);function Bf(){V.call(this);this.c="sphere";this.q=[0,0,0];this.Wb=5;this.Uc=32;this.Zg=16;Fa(this,new Yc)}D(Bf,V);Bf.prototype.__defineGetter__("center",t("q"));Bf.prototype.__defineSetter__("center",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid center"));this.q=a});Bf.prototype.__defineGetter__("radius",t("Wb"));Bf.prototype.__defineSetter__("radius",function(a){v(a)||j(Error("Invalid radius."));this.Wb=a});
Bf.prototype.l=function(){$c(this,new Af({Ke:this.q,$a:this.Wb,kf:this.Uc,$i:this.Zg}));Bf.p.l.call(this)};C("X.sphere",Bf);C("X.sphere.prototype.modified",Bf.prototype.l);function xe(a){Q.call(this);this.c="labelmap";this.ib=a;this.ze=new Float32Array([-255,-255,-255,-255])}D(xe,Q);xe.prototype.l=function(){var a=new Wc;a.ba=this;this.dispatchEvent(a);this.ib.l()};xe.prototype.__defineSetter__("showOnly",function(a){var b=[-1,-1,-1,-1];a!=r&&(ka(a)&&4==a.length?b=a:(this.fb||j(Error("No colortable assigned.")),b=this.fb.xb.get(a).slice(1,5)));this.ze=new Float32Array([Math.floor(255*b[0]),Math.floor(255*b[1]),Math.floor(255*b[2]),Math.floor(255*b[3])])});
C("X.labelmap",xe);function Cf(a){this.F=[];a=a||{};var b=new za(a.Ke||[0,0,0]),c=!a.$a?[1,1,1]:a.$a.length?a.$a:[a.$a,a.$a,a.$a];return rc([[[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 ic(a[0].map(function(e){e=new za(b.x()+c[0]*(2*!!(e&1)-1),b.y()+c[1]*(2*!!(e&2)-1),b.b()+c[2]*(2*!!(e&4)-1));return new gc(e,new za(a[1]))}))}))}D(Cf,qc);function Df(){V.call(this);this.c="cube";this.q=[0,0,0];this.qe=this.pe=this.oe=20;this.wc=[0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0];Fa(this,new Yc)}D(Df,V);Df.prototype.__defineGetter__("center",t("q"));Df.prototype.__defineSetter__("center",function(a){(a==r||!ka(a)||3!=a.length)&&j(Error("Invalid center"));this.q=a});Df.prototype.__defineGetter__("lengthX",t("oe"));
Df.prototype.__defineSetter__("lengthX",function(a){v(a)||j(Error("Invalid lengthX."));this.oe=a});Df.prototype.__defineGetter__("lengthY",t("pe"));Df.prototype.__defineSetter__("lengthY",function(a){v(a)||j(Error("Invalid lengthY."));this.pe=a});Df.prototype.__defineGetter__("lengthZ",t("qe"));Df.prototype.__defineSetter__("lengthZ",function(a){v(a)||j(Error("Invalid lengthZ."));this.qe=a});Df.prototype.l=function(){$c(this,new Cf({Ke:this.q,$a:[this.oe/2,this.pe/2,this.qe/2]}));Df.p.l.call(this)};
C("X.cube",Df);C("X.cube.prototype.modified",Df.prototype.l);function te(a){re.call(this,a);this.c="interactor3D";this.Yj=s}D(te,re);te.prototype.ed=function(a){te.p.ed.call(this,a);var b=new od;a.Bc==r&&(a.Bc=0);b.Wa=0>a.Bc;b.Na=q;this.dispatchEvent(b)};function Ef(a){M.call(this);this.c="array";this.u=[];this.uf=a}D(Ef,M);function Ff(a,b,c){for(var d=0;4>d;d++)if(a[d+0]!==b[d+c])return s;return q}Ef.prototype.add=function(a){this.u.push(a);return q};Ef.prototype.remove=function(a){a=this.u.indexOf(a);-1<a&&this.u.splice(a,1);return q};Ef.prototype.clear=function(){this.u.length=0};
function Gf(a,b,c){var d=c-b;if(!(2>d)){d=b+Math.floor(d/2);Gf(a,b,d);for(Gf(a,d,c);b<d;++b)if(0<a.uf(a.u[b],a.u[d])){var e=a.u[b];a.u[b]=a.u[d];for(var f=a,g=d,h=c;g+1<h&&0>f.uf(f.u[g+1],e);){var k=f,l=g+1,m=k.u[g];k.u[g]=k.u[l];k.u[l]=m;++g}f.u[g]=e}}}Ef.prototype.sort=function(){Gf(this,0,this.u.length)};function Hf(a,b){xf.call(this,a,b);this.c="camera2D"}D(Hf,xf);Hf.prototype.rotate=function(a){a=Hf.p.rotate.call(this,a);var b=new ld;0<a.x?b.De--:0>a.x&&b.De++;0<a.y?b.re++:0>a.y&&b.re--;this.dispatchEvent(b)};function If(a,b){xf.call(this,a,b);this.c="camera3D";this.wf=45;this.Hf=H.d.Ue(H.d.cd(),this.wf,a/b,1,1E4)}D(If,xf);If.prototype.rotate=function(a){a=If.p.rotate.call(this,a);var b=-a.x/5*Math.PI/180;a=-a.y/5*Math.PI/180;var c=new H.f(this.o[1],this.o[5],this.o[9]),d=new H.f(this.o[0],this.o[4],this.o[8]);c.normalize();d.normalize();H.d.rotate(this.o,b,c.x,c.y,c.b);H.d.rotate(this.o,a,d.x,d.y,d.b)};If.prototype.Ud=function(a,b){var c=If.p.Ud.call(this,a,b);H.d.qg(c,a,b,this.L);return c};
C("X.camera3D",If);function Jf(a){yb.call(this);this.jb=a;this.C=[]}D(Jf,yb);var Kf=[];function Lf(a,b,c,d,e){ka(c)||(Kf[0]=c,c=Kf);for(var f=0;f<c.length;f++){var g=L(b,c[f],d||a,e||s,a.jb||a);a.C.push(g)}}Jf.prototype.ff=function(){Kb(this.C,$b);this.C.length=0};Jf.prototype.handleEvent=function(){j(Error("EventHandler.handleEvent not implemented"))};function Mf(){}Mf.cg=function(){return Mf.kg?Mf.kg:Mf.kg=new Mf};Mf.prototype.$h=0;Mf.cg();function Nf(a){yb.call(this);this.Ib=a||Kd();this.Pi=Of}D(Nf,fc);Nf.prototype.Lh=Mf.cg();var Of=r;u=Nf.prototype;u.jg=r;u.Dc=s;u.t=r;u.Pi=r;u.fd=r;u.Zc=r;u.Le=r;u.n=t("t");u.hf=function(a){this.fd&&this.fd!=a&&j(Error("Method not supported"));Nf.p.hf.call(this,a)};u.Ld=t("Ib");u.zc=function(){this.t=this.Ib.createElement("div")};u.ec=function(a){this.Lb(a)};
u.Lb=function(a,b){this.Dc&&j(Error("Component already rendered"));this.t||this.zc();a?a.insertBefore(this.t,b||r):this.Ib.Q.body.appendChild(this.t);(!this.fd||this.fd.Dc)&&this.Hd()};u.Hd=function(){function a(a){!a.Dc&&a.n()&&a.Hd()}this.Dc=q;this.Zc&&Kb(this.Zc,a,n)};u.Id=function(){function a(a){a.Dc&&a.Id()}this.Zc&&Kb(this.Zc,a,n);this.Eh&&this.Eh.ff();this.Dc=s};
u.removeChild=function(a,b){if(a){var c=ma(a)?a:a.jg||(a.jg=":"+(a.Lh.$h++).toString(36)),d;this.Le&&c?(d=this.Le,d=(c in d?d[c]:n)||r):d=r;a=d;c&&a&&(d=this.Le,c in d&&delete d[c],Nb(this.Zc,a),b&&(a.Id(),a.t&&Sd(a.t)),c=a,c==r&&j(Error("Unable to set parent component")),c.fd=r,Nf.p.hf.call(c,r))}a||j(Error("Child is not in parent component"));return a};function Pf(){yb.call(this)}D(Pf,fc);u=Pf.prototype;u.qf=0;u.dd=0;u.Ve=100;u.$f=0;u.nf=1;u.Sh=s;u.Zh=s;u.be=function(a){a=Qf(this,a);this.qf!=a&&(this.qf=a+this.$f>this.Ve?this.Ve-this.$f:a<this.dd?this.dd:a,!this.Sh&&!this.Zh&&this.dispatchEvent("change"))};u.Od=function(){return Qf(this,this.qf)};u.Nd=function(){return Qf(this,this.dd)};u.Md=function(){return Qf(this,this.Ve)};function Qf(a,b){return a.nf==r?b:a.dd+Math.round((b-a.dd)/a.nf)*a.nf};function Rf(a){Nf.call(this,a);this.hd=new Pf;L(this.hd,"change",this.Fh,s,this)}D(Rf,Nf);var Sf={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};u=Rf.prototype;u.zc=function(){this.ab=this.Ld().zc("div","progress-bar-thumb");var a=Sf[this.Bg];this.t=this.Ld().zc("div",a,this.ab);Tf(this);a=this.Nd();this.n().setAttribute("aria-valuemin",a);a=this.Md();this.n().setAttribute("aria-valuemax",a)};
u.Hd=function(){Rf.p.Hd.call(this);eb&&7>nb&&L(this.n(),"resize",this.he,s,this);this.he();var a=this.n();a.setAttribute("role","progressbar");a.setAttribute("aria-live","polite")};u.Id=function(){Rf.p.Id.call(this);eb&&7>nb&&Zb(this.n(),"resize",this.he,s,this)};u.Od=function(){return this.hd.Od()};u.be=function(a){this.hd.be(a);this.n()&&Tf(this)};function Tf(a){var b=a.Od();a.n().setAttribute("aria-valuenow",b)}u.Nd=function(){return this.hd.Nd()};u.Md=function(){return this.hd.Md()};u.Bg="horizontal";
u.Fh=function(){this.he();this.dispatchEvent("change")};u.he=function(){if(this.ab){var a=this.Nd(),b=this.Md(),a=(this.Od()-a)/(b-a),b=Math.round(100*a);"vertical"==this.Bg?eb&&7>nb?(this.ab.style.top=0,this.ab.style.height="100%",b=this.ab.offsetHeight,a=Math.round(a*b),this.ab.style.top=b-a+"px",this.ab.style.height=a+"px"):(this.ab.style.top=100-b+"%",this.ab.style.height=b+"%"):this.ab.style.width=b+"%"}};function Vf(a,b){a==r&&j(Error("No valid parent element."));b==r&&j(Error("Invalid initial value."));Rf.call(this);this.c="progressbar";this.Ka=a;this.Gf="";this.md=this.hb=r;this.Nb=[];var c;c=".progress-bar-horizontal {\n position: relative;\n border: 1px solid #949dad;\n";c+=" background: white;\n";c+=" padding: 1px;\n";c+=" overflow: hidden;\n";c+=" margin: 2px;\n";c+=" width: 100px;\n";c+=" height: 5px;\n";c+="}";var d;d=".progress-bar-thumb {\n position: relative;\n background: #F62217;\n";
d+=" overflow: hidden;\n";d+=" width: 0%;\n";d+=" height: 100%;\n";d+="}";var e;e=".progress-bar-thumb-done {\n background: #57E964;\n}";this.Nb=[c,d,e];this.be(b);this.Re()}D(Vf,Rf);
Vf.prototype.Re=function(){var a=Xd(this.Ka,"position");if("static"==a||""==a)this.Gf=this.Ka.style.position,this.Ka.style.position="relative";var a=document.getElementsByTagName("head")[0],b=Qd("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.Nb[0])),d=document.createTextNode(String(this.Nb[1])),e=document.createTextNode(String(this.Nb[2]));a.appendChild(b);b.appendChild(c);b.appendChild(d);b.appendChild(e);this.hb=b;this.ec(this.Ka);a=this.n();a.style.position=
"absolute";a.style.top=(this.Ka.clientHeight-5)/2+"px";a.style.left=(this.Ka.clientWidth-100)/2+"px";a.classList.add("xtk-progress-bar")};function Wf(a){var b=a.n().style.top,c=a.n().style.left;Sd(a.n());var d=new Vf(a.Ka,100),e=d.n();e.style.position="absolute";e.style.top=b;e.style.left=c;e.classList.add("xtk-progress-bar");(e.firstElementChild!=n?e.firstElementChild:Td(e.firstChild)).classList.add("progress-bar-thumb-done");a.md=d}
Vf.prototype.Qd=function(){this.hb&&Sd(this.hb);this.n()&&Sd(this.n());this.md&&Sd(this.md.n());this.md=this.hb=r;this.Ka.style.position=this.Gf};function Xf(a,b,c){na(a)?c&&(a=va(a,c)):a&&"function"==typeof a.handleEvent?a=va(a.handleEvent,a):j(Error("Invalid listener argument"));return 2147483647<b?-1:fa.setTimeout(a,b||0)};function Yf(){M.call(this);this.c="renderer";this.v=window.document.body;this.J=this.v.clientWidth;this.D=this.v.clientHeight;this.la=this.r=this.ea=r;this.Ya=new Ef(Xc);this.La=[];this.I=r;this.ue=this.qd=this.rd=s;this.a=this.sa=r;this.G={PROGRESSBAR_ENABLED:q,INTERMEDIATE_RENDERING:s,SLICENAVIGATORS:q};this.sf=-1;window.console.log("XTK release 10 -- 2013-05-16 04:07:26 -- http://www.goXTK.com -- @goXTK")}D(Yf,M);u=Yf.prototype;u.oi=function(a){this.sa&&this.sa.be(100*a.Qf)};
u.ei=function(a){a!=r&&a instanceof Wc&&a.ba&&this.bb(a.ba)};u.af=function(a){(a==r||!(a instanceof qd))&&j(Error("Invalid hover event."))};u.bf=function(){var a=Od(this.v);this.J=a.clientWidth;this.D=a.clientHeight;a=Od(this.ea);a.width=this.J;a.height=this.D;"renderer3D"==this.c&&(this.a.viewport(0,0,this.J,this.D),this.r.Hf=H.d.Ue(H.d.cd(),this.r.wf,this.ea.width/this.ea.height,1,1E4))};u.cf=function(a){(a==r||!(a instanceof pd))&&j(Error("Invalid scroll event."))};
Yf.prototype.__defineGetter__("config",t("G"));Yf.prototype.__defineGetter__("interactor",t("la"));Yf.prototype.__defineGetter__("camera",t("r"));Yf.prototype.__defineGetter__("loadingCompleted",t("qd"));Yf.prototype.__defineGetter__("container",t("v"));Yf.prototype.__defineSetter__("container",function(a){a==r&&j(Error("An ID to a valid container (<div>..) is required."));var b=a;ma(b)&&(b=Od(a));oa(b)&&1==b.nodeType||j(Error("Could not find the given container."));this.v=b});u=Yf.prototype;
u.jd=function(){this.r.reset()};
u.ia=function(a){var b=Qd("canvas");this.v.appendChild(b);this.J=this.v.clientWidth;this.D=this.v.clientHeight;b.width=this.J;b.height=this.D;try{var c=b.getContext(a);c||j(Error())}catch(d){var e="Sorry, "+a+' context is <strong>not supported</strong> on this machine! See <a href="http://crash.goXTK.com" target="_blank">http://crash.goXTK.com</a> for requirements..';this.v.innerHTML='<h3 style="color:red;font-family:sans-serif;">Oooops..</h3><p style="color:red;font-family:sans-serif;">'+e+"</p>";
j(Error(e))}this.I=new tf;L(this.I,id,this.oi.bind(this));this.ea=b;this.a=c;b=new te(this.ea);"2d"==a&&(b=new ve(this.ea));b.ia();L(b,fd,this.jd.bind(this));L(b,jd,this.af.bind(this));L(b,ed,this.cf.bind(this));this.la=b;b=new If(this.J,this.D);"2d"==a&&(b=new Hf(this.J,this.D));b.observe(this.la);this.r=b;L(window,"resize",this.bf,s,this)};u.add=function(a){(a instanceof Df||a instanceof Bf||a instanceof zf)&&a.l();this.La.push(a);this.bb(a)};
u.remove=function(a){(!this.ea||!this.a)&&j(Error("The renderer was not initialized properly."));a==r&&j(Error("Illegal object."));return s};u.bb=function(a){(!this.ea||!this.a)&&j(Error("The renderer was not initialized properly."));a==r&&(window.console.log(a),j(Error("Illegal object.")));var b;b=pa(a);var c=Ub[b];if(c){var d=ia(hd),e=ia(n);d&&e?(c=Tb[hd],b=!!c&&!!c[n]&&b in c[n]):b=!d&&!e?q:Mb(c,function(a){return d&&a.type==hd||e&&a.capture==n})}else b=s;b||L(a,hd,this.ei.bind(this))};
u.get=function(a){a==r&&j(Error("Invalid object id."));for(var b=this.Ya.u,c=b.length,d=0,d=0;d<c;d++)if(b[d].fa==a)return b[d];return r};
u.ec=function(){(!this.ea||!this.a)&&j(Error("The renderer was not initialized properly."));if(this.Lf==r){if(yc(this.I.mc)){if(this.G.PROGRESSBAR_ENABLED&&!this.sa&&(this.sa=new Vf(this.v,3)),this.ue=this.qd=s,this.Lf=Xf(function(){this.Lf=r;this.ec()}.bind(this),100),!this.G.INTERMEDIATE_RENDERING)return}else if(!this.qd&&!this.ue&&(this.ue=q,eval("this.onShowtime()"),this.qd=q),this.sa){this.G.PROGRESSBAR_ENABLED&&(this.sa&&!this.tf)&&(Wf(this.sa),this.tf=Xf(function(){this.tf=r;this.sa&&(this.sa.Qd(),
this.sa=r);this.ec()}.bind(this),700));return}this.sf=window.requestAnimationFrame(this.ec.bind(this),this.ea);eval("this.onRender()");this.Lb(s,q)}};u.Ag=aa();u.yg=aa();u.Lb=aa();
u.Fd=function(){window.cancelAnimationFrame(this.sf);this.I&&(delete this.I,this.I=r);this.sa&&(this.sa.Qd(),delete this.sa,this.sa=r);this.Ya.clear();delete this.Ya;this.La.length=0;delete this.La;delete this.I;this.I=r;delete this.r;this.r=r;delete this.la;this.la=r;delete this.a;this.a=r;Sd(this.ea);delete this.ea;this.ea=r};function Zf(){M.call(this);this.c="shaders";this.Ad="";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.Ad=a+="}\n";this.nd="";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 / volumeScalarMax);\n";a+=" float _windowHigh = (volumeWindowHigh / volumeScalarMax);\n";a+=" vec3 _minrange = vec3(_windowLow,_windowLow,_windowLow);\n";
a+=" vec3 _maxrange = vec3(_windowHigh,_windowHigh,_windowHigh);\n";a+=" vec3 fac = _maxrange - _minrange;\n";a+=" textureSum = vec4((textureSum.r - _minrange)/fac,1);\n";a+=" textureSum = textureSum.r * vec4(volumeScalarMaxColor,1) + (1.0 - textureSum.r) * vec4(volumeScalarMinColor,1);\n";a+=" }\n";a+=" if (useLabelMapTexture) {\n";a+=" vec4 texture2 = texture2D(textureSampler2,fragmentTexturePos);\n";a+=" if (texture2.a > 0.0) {\n";a+=" if (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 / volumeScalarMax);\n";a+=" float _volumeUpperThreshold = (volumeUpperThreshold / volumeScalarMax);\n";a+=" if (texture1.r < _volumeLowerThreshold ||\n";a+=" texture1.r > _volumeUpperThreshold) {\n";a+=" discard;\n";a+=" };\n";a+=" };\n";a+=" gl_FragColor = textureSum;\n";
a+=" gl_FragColor.a = objectOpacity;\n";a+=" } else {\n";a+=" vec3 nNormal = normalize(fTransformedVertexNormal);\n";a+=" if (fVertexNormal == vec3(0.0,0.0,0.0)) {\n";a+=" gl_FragColor = vec4(fragmentColor,1.0);\n";a+=" return;\n";a+=" }\n";a+=" vec3 light = vec3(0.0, 0.0, 1.0);\n";a+=" vec3 lightDirection = vec3(0,0,-10);\n";a+=" lightDirection = normalize(lightDirection);\n";a+=" vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n";a+=" vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n";
a+=" float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n";a+=" float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n";a+=" float ambient = 0.3;\n";a+=" gl_FragColor = vec4(fragmentColor * ambient +\n";a+=" fragmentColor * diffuse +\n";a+=" vec3(0.2, 0.2, 0.2) * specular,\n";a+=" objectOpacity);\n";a+=" }\n";this.nd=a+="}\n"}D(Zf,M);
var $f={Lj:"vertexPosition",Kj:"vertexNormal",Jj:"vertexColor",Nj:"vertexTexturePos",Mj:"vertexScalar"},ag={Oj:"view",sj:"perspective",jj:"center",rj:"objectTransform",Fj:"useObjectColor",pj:"objectColor",Hj:"useScalars",Bj:"scalarsReplaceMode",yj:"scalarsMin",vj:"scalarsMax",zj:"scalarsMinColor",wj:"scalarsMaxColor",Aj:"scalarsMinThreshold",xj:"scalarsMaxThreshold",uj:"scalarsInterpolation",tj:"pointSize",qj:"objectOpacity",oj:"normal",Gj:"usePicking",Ij:"useTexture",Ej:"useLabelMapTexture",mj:"labelmapOpacity",
lj:"labelmapColor",Cj:"textureSampler",Dj:"textureSampler2",Pj:"volumeLowerThreshold",Vj:"volumeUpperThreshold",Sj:"volumeScalarMin",Qj:"volumeScalarMax",Tj:"volumeScalarMinColor",Rj:"volumeScalarMaxColor",Xj:"volumeWindowLow",Wj:"volumeWindowHigh",Uj:"volumeTexture"};function bg(a,b,c){a==r&&j(Error("Invalid GL Buffer."));b==r&&j(Error("Invalid number of items."));c==r&&j(Error("Invalid item size."));M.call(this);this.c="buffer";this.B=a;this.vb=b;this.wb=c}D(bg,M);function cg(a,b,c,d,e,f,g,h){var k,l;if(k=c.offsetParent){var m="HTML"==k.tagName||"BODY"==k.tagName;if(!m||"static"!=Yd(k,"position"))l=ce(k),m||(m=(m=de(k))&&hb?-k.scrollLeft:m&&(!eb||!ub("8"))&&"visible"!=Yd(k,"overflowX")?k.scrollWidth-k.clientWidth-k.scrollLeft:k.scrollLeft,l=Dd(l,new Cd(m,k.scrollTop)))}k=l||new Cd;l=ce(a);m=he(a);l=new Gd(l.x,l.y,m.width,m.height);(m=be(a))&&l.lg(new Gd(m.left,m.top,m.right-m.left,m.bottom-m.top));var m=Kd(a),p=Kd(c);if(m.Q!=p.Q){var x=m.Q.body,p=p.Q.parentWindow||
p.Q.defaultView,w=new Cd(0,0),y=Md(x)?Md(x).parentWindow||Md(x).defaultView:window,z=x;do{var E=y==p?ce(z):ee(z);w.x+=E.x;w.y+=E.y}while(y&&y!=p&&(z=y.frameElement)&&(y=y.parent));x=Dd(w,ce(x));eb&&!Vd(m)&&(x=Dd(x,Wd(m)));l.left+=x.x;l.top+=x.y}a=(b&4&&de(a)?b^2:b)&-5;b=new Cd(a&2?l.left+l.width:l.left,a&1?l.top+l.height:l.top);b=Dd(b,k);e&&(b.x+=(a&2?-1:1)*e.x,b.y+=(a&1?-1:1)*e.y);var G;if(g&&(G=be(c)))G.top-=k.y,G.right-=k.x,G.bottom-=k.y,G.left-=k.x;return dg(b,c,d,f,G,g,h)}
function dg(a,b,c,d,e,f,g){a=a.g();var h=0,k=(c&4&&de(b)?c^2:c)&-5;c=he(b);g=g?g.g():c.g();if(d||0!=k)k&2?a.x-=g.width+(d?d.right:0):d&&(a.x+=d.left),k&1?a.y-=g.height+(d?d.bottom:0):d&&(a.y+=d.top);if(f){if(e){h=a;d=0;if(65==(f&65)&&(h.x<e.left||h.x>=e.right))f&=-2;if(132==(f&132)&&(h.y<e.top||h.y>=e.bottom))f&=-5;h.x<e.left&&f&1&&(h.x=e.left,d|=1);h.x<e.left&&(h.x+g.width>e.right&&f&16)&&(g.width=Math.max(g.width-(h.x+g.width-e.right),0),d|=4);h.x+g.width>e.right&&f&1&&(h.x=Math.max(e.right-g.width,
e.left),d|=1);f&2&&(d|=(h.x<e.left?16:0)|(h.x+g.width>e.right?32:0));h.y<e.top&&f&4&&(h.y=e.top,d|=2);h.y<=e.top&&(h.y+g.height<e.bottom&&f&32)&&(g.height=Math.max(g.height-(e.top-h.y),0),h.y=0,d|=8);h.y>=e.top&&(h.y+g.height>e.bottom&&f&32)&&(g.height=Math.max(g.height-(h.y+g.height-e.bottom),0),d|=8);h.y+g.height>e.bottom&&f&4&&(h.y=Math.max(e.bottom-g.height,e.top),d|=2);f&8&&(d|=(h.y<e.top?64:0)|(h.y+g.height>e.bottom?128:0));h=d}else h=256;if(h&496)return h}f=a;e=hb&&(Wa||lb)&&ub("1.9");f instanceof
Cd?(a=f.x,f=f.y):(a=f,f=n);b.style.left=ge(a,e);b.style.top=ge(f,e);if(!(c==g||(!c||!g?0:c.width==g.width&&c.height==g.height)))a=Vd(Kd(Md(b))),eb&&(!a||!ub("8"))?(c=b.style,a?(eb?(a=le(b,"paddingLeft"),e=le(b,"paddingRight"),f=le(b,"paddingTop"),d=le(b,"paddingBottom"),a=new Ed(f,e,d,a)):(a=Xd(b,"paddingLeft"),e=Xd(b,"paddingRight"),f=Xd(b,"paddingTop"),d=Xd(b,"paddingBottom"),a=new Ed(parseFloat(f),parseFloat(e),parseFloat(d),parseFloat(a))),eb?(e=ne(b,"borderLeft"),f=ne(b,"borderRight"),d=ne(b,
"borderTop"),b=ne(b,"borderBottom"),b=new Ed(d,f,b,e)):(e=Xd(b,"borderLeftWidth"),f=Xd(b,"borderRightWidth"),d=Xd(b,"borderTopWidth"),b=Xd(b,"borderBottomWidth"),b=new Ed(parseFloat(d),parseFloat(f),parseFloat(b),parseFloat(e))),c.pixelWidth=g.width-b.left-a.left-a.right-b.right,c.pixelHeight=g.height-b.top-a.top-a.bottom-b.bottom):(c.pixelWidth=g.width,c.pixelHeight=g.height)):(b=b.style,hb?b.MozBoxSizing="border-box":ib?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 eg(){}eg.prototype.Ta=aa();function fg(a,b){this.Me=a instanceof Cd?a:new Cd(a,b)}D(fg,eg);fg.prototype.Ta=function(a,b,c,d){cg(Zd(a),0,a,b,this.Me,c,r,d)};function gg(a,b,c){this.element=a;this.Xf=b;this.Ci=c}D(gg,eg);gg.prototype.Ta=function(a,b,c){cg(this.element,this.Xf,a,b,n,c,this.Ci)};function hg(a,b){yb.call(this);this.jb=new Jf(this);this.gf(a||r);b&&(this.Ec=b)}D(hg,fc);u=hg.prototype;u.t=r;u.eh=q;u.Rf=r;u.ua=s;u.Ui=s;u.Te=-1;u.og=-1;u.Kh=s;u.th=q;u.Ec="toggle_display";u.n=t("t");u.gf=function(a){this.ua&&j(Error("Can not change this state of the popup while showing."));this.t=a};
function ig(a,b){a.de&&a.de.stop();a.Pd&&a.Pd.stop();if(b){if(!a.ua&&a.Ze()){a.t||j(Error("Caller must call setElement before trying to show the popup"));a.Ta();var c=Md(a.t);a.Kh&&Lf(a.jb,c,"keydown",a.ci,q);if(a.eh)if(Lf(a.jb,c,"mousedown",a.wg,q),eb){var d;try{d=c.activeElement}catch(e){}for(;d&&"IFRAME"==d.nodeName;){try{var f=d.contentDocument||d.contentWindow.document}catch(g){break}c=f;d=c.activeElement}Lf(a.jb,c,"mousedown",a.wg,q);Lf(a.jb,c,"deactivate",a.vg)}else Lf(a.jb,c,"blur",a.vg);
"toggle_display"==a.Ec?(a.t.style.visibility="visible",je(a.t,q)):"move_offscreen"==a.Ec&&a.Ta();a.ua=q;a.de?(Yb(a.de,"end",a.zg,s,a),a.de.play()):a.zg()}}else jg(a)}u.Ta=ga;function jg(a,b){if(!a.ua||!a.dispatchEvent({type:"beforehide",target:b}))return s;a.jb&&a.jb.ff();a.ua=s;a.og=ya();a.Pd?(Yb(a.Pd,"end",xa(a.Wf,b),s,a),a.Pd.play()):a.Wf(b);return q}u.Wf=function(a){"toggle_display"==this.Ec?this.Ui?Xf(this.gg,0,this):this.gg():"move_offscreen"==this.Ec&&(this.t.style.top="-10000px");this.$e(a)};
u.gg=function(){this.t.style.visibility="hidden";je(this.t,s)};u.Ze=function(){return this.dispatchEvent("beforeshow")};u.zg=function(){this.Te=ya();this.og=-1;this.dispatchEvent("show")};u.$e=function(a){this.dispatchEvent({type:"hide",target:a})};u.wg=function(a){a=a.target;!Ud(this.t,a)&&((!this.Rf||Ud(this.Rf,a))&&!(150>ya()-this.Te))&&jg(this,a)};u.ci=function(a){27==a.keyCode&&jg(this,a.target)&&(a.preventDefault(),a.stopPropagation())};
u.vg=function(a){if(this.th){var b=Md(this.t);if(eb||db){if(a=b.activeElement,!a||Ud(this.t,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>ya()-this.Te||jg(this)}};function kg(a,b){this.Fi=4;this.Vd=b||n;hg.call(this,a)}D(kg,hg);kg.prototype.Ta=function(){if(this.Vd){var a=!this.ua&&"move_offscreen"!=this.Ec,b=this.n();a&&(b.style.visibility="hidden",je(b,q));this.Vd.Ta(b,this.Fi,this.ik);a&&je(b,s)}};function lg(a){this.z=new wc;a&&this.Ee(a)}function mg(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+pa(a):b.substr(0,1)+a}u=lg.prototype;u.Kd=function(){return this.z.Kd()};u.add=function(a){this.z.set(mg(a),a)};u.Ee=function(a){a=vc(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};u.ff=function(a){a=vc(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};u.remove=function(a){return this.z.remove(mg(a))};u.clear=function(){this.z.clear()};
u.contains=function(a){a=mg(a);return zc(this.z.z,a)};u.lg=function(a){var b=new lg;a=vc(a);for(var c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};u.bd=function(){return this.z.bd()};u.g=function(){return new lg(this)};function ng(a,b,c){this.Ib=c||(a?Kd(Od(a)):Kd());kg.call(this,this.Ib.zc("div",{style:"position:absolute;display:none;"}));this.Ne=new Cd(1,1);this.Gd=new lg;a&&og(this,a);if(b!=r)if(a=this.n(),"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(Md(a).createTextNode(String(b)))}}D(ng,kg);var pg=[];u=ng.prototype;u.Ba=r;u.className="goog-tooltip";
u.Hg=500;u.Jh=0;u.Ld=t("Ib");function og(a,b){b=Od(b);a.Gd.add(b);L(b,"mouseover",a.Ih,s,a);L(b,"mouseout",a.dg,s,a);L(b,"mousemove",a.Hh,s,a);L(b,"focus",a.Gh,s,a);L(b,"blur",a.dg,s,a)}u.gf=function(a){var b=this.n();b&&Sd(b);ng.p.gf.call(this,a);a&&(b=this.Ib.Q.body,b.insertBefore(a,b.lastChild))};
u.Ze=function(){if(!hg.prototype.Ze.call(this))return s;if(this.anchor)for(var a,b=0;a=pg[b];b++)Ud(a.n(),this.anchor)||ig(a,s);0<=Jb(pg,this)||pg.push(this);a=this.n();a.className=this.className;qg(this);L(a,"mouseover",this.fg,s,this);L(a,"mouseout",this.eg,s,this);rg(this);return q};
u.$e=function(){Nb(pg,this);for(var a=this.n(),b,c=0;b=pg[c];c++)b.anchor&&Ud(a,b.anchor)&&ig(b,s);this.Dg&&sg(this.Dg);Zb(a,"mouseover",this.fg,s,this);Zb(a,"mouseout",this.eg,s,this);this.anchor=n;if(0==(this.nb?this.ua?4:1:this.Cc?3:this.ua?2:0))this.$d=s;hg.prototype.$e.call(this)};u.tg=function(a,b){this.anchor==a&&this.Gd.contains(this.anchor)&&(this.$d||!this.lk?(ig(this,s),this.ua||(this.anchor=a,this.Vd=b||tg(this,0)||n,this.ua&&this.Ta(),ig(this,q))):this.anchor=n);this.nb=n};
u.Yh=function(a){this.Cc=n;a==this.anchor&&(this.Ba==r||this.Ba!=this.n()&&!this.Gd.contains(this.Ba))&&(!this.Tf||!this.Tf.Ba)&&ig(this,s)};function ug(a,b){var c=Wd(a.Ib);a.Ne.x=b.clientX+c.x;a.Ne.y=b.clientY+c.y}u.Ih=function(a){var b=vg(this,a.target);this.Ba=b;qg(this);b!=this.anchor&&(this.anchor=b,this.nb||(this.nb=Xf(va(this.tg,this,b,n),this.Hg)),wg(this),ug(this,a))};function vg(a,b){try{for(;b&&!a.Gd.contains(b);)b=b.parentNode;return b}catch(c){return r}}
u.Hh=function(a){ug(this,a);this.$d=q};u.Gh=function(a){this.Ba=a=vg(this,a.target);this.$d=q;if(this.anchor!=a){this.anchor=a;var b=tg(this,1);qg(this);this.nb||(this.nb=Xf(va(this.tg,this,a,b),this.Hg));wg(this)}};function tg(a,b){if(0==b){var c=a.Ne.g();return new xg(c)}return new yg(a.Ba)}function wg(a){if(a.anchor)for(var b,c=0;b=pg[c];c++)Ud(b.n(),a.anchor)&&(b.Tf=a,a.Dg=b)}
u.dg=function(a){var b=vg(this,a.target),c=vg(this,a.relatedTarget);b!=c&&(b==this.Ba&&(this.Ba=r),rg(this),this.$d=s,this.ua&&(!a.relatedTarget||!Ud(this.n(),a.relatedTarget))?sg(this):this.anchor=n)};u.fg=function(){var a=this.n();this.Ba!=a&&(qg(this),this.Ba=a)};u.eg=function(a){var b=this.n();if(this.Ba==b&&(!a.relatedTarget||!Ud(b,a.relatedTarget)))this.Ba=r,sg(this)};function rg(a){a.nb&&(fa.clearTimeout(a.nb),a.nb=n)}
function sg(a){if(2==(a.nb?a.ua?4:1:a.Cc?3:a.ua?2:0))a.Cc=Xf(va(a.Yh,a,a.anchor),a.Jh)}function qg(a){a.Cc&&(fa.clearTimeout(a.Cc),a.Cc=n)}function xg(a,b){fg.call(this,a,b)}D(xg,fg);xg.prototype.Ta=function(a,b,c){b=Zd(a);b=be(b);c=c?new Ed(c.top+10,c.right,c.bottom,c.left+10):new Ed(10,0,0,10);dg(this.Me,a,4,c,b,9)&496&&dg(this.Me,a,4,c,b,5)};function yg(a){gg.call(this,a,3)}D(yg,gg);
yg.prototype.Ta=function(a,b,c){var d=new Cd(10,0);cg(this.element,this.Xf,a,b,d,c,9)&496&&cg(this.element,2,a,1,d,c,5)};function zg(a,b,c,d){a==r&&j(Error("No valid parent element."));(!v(b)||!v(c))&&j(Error("Invalid coordinates."));(d==r||!(d instanceof re))&&j(Error("Invalid interactor."));ng.call(this);this.c="caption";this.Ka=a;this.Cd=b;this.Dd=c;this.la=d;this.hb=r;this.Nb=[];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.Nb=[a];Yb(d,kd,this.Qd.bind(this));this.Re()}D(zg,ng);
zg.prototype.Re=function(){var a=Xd(this.Ka,"position");if("static"==a||""==a)this.Ka.style.position="relative";var a=document.getElementsByTagName("head")[0],b=Qd("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.Nb[0]));a.appendChild(b);b.appendChild(c);this.hb=b;this.Vd=new fg(this.Cd,this.Dd)||n;this.ua&&this.Ta();ig(this,q);og(this,this.Ka);this.n().classList.add("x-tooltip")};
zg.prototype.Qd=function(){ig(this,s);this.hb&&Sd(this.hb);this.n()&&Sd(this.n());this.hb=r};function Ag(){Yf.call(this);this.c="renderer3D";this.Nc=this.Qc=this.Mc=this.Pc=this.Lc=this.Oc=this.xe=this.ye=r;this.q=[0,0,0];this.If=r;this.ie=new wc;this.Vc=new wc;this.Fb=new wc;this.td=new wc;this.ic=new wc;this.qc=new wc;this.xc=new wc;this.yc=new wc;this.G={PROGRESSBAR_ENABLED:q,PICKING_ENABLED:q,ORDERING_ENABLED:q,STATISTICS_ENABLED:s,INTERMEDIATE_RENDERING:s}}D(Ag,Yf);Ag.prototype.__defineGetter__("config",t("G"));u=Ag.prototype;
u.Oi=function(){this.Nc=this.Qc=this.Mc=this.Pc=this.Lc=this.Oc=r;this.q=[0,0,0]};u.af=function(a){Ag.p.af.call(this,a);var b=a.Cd;a=a.Dd;var c=this.Eg(b,a);if(c=this.get(c))if(c=c.hc){var d=ee(this.v);(new zg(this.v,d.x+b+10,d.y+a+10,this.la)).n().innerHTML=c}};
u.ia=function(){Ag.p.ia.call(this,"experimental-webgl");try{if(this.a.viewport(0,0,this.J,this.D),this.a.clearColor(0,0,0,0),this.a.enable(this.a.BLEND),this.a.blendEquation(this.a.FUNC_ADD),this.a.blendFunc(this.a.SRC_ALPHA,this.a.ONE_MINUS_SRC_ALPHA),this.a.enable(this.a.DEPTH_TEST),this.a.depthFunc(this.a.LEQUAL),this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT),this.G.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.J,this.D,0,this.a.RGB,this.a.UNSIGNED_BYTE,r);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST);this.a.bindFramebuffer(this.a.FRAMEBUFFER,a);this.a.bindRenderbuffer(this.a.RENDERBUFFER,
b);this.a.renderbufferStorage(this.a.RENDERBUFFER,this.a.DEPTH_COMPONENT16,this.J,this.D);this.a.bindRenderbuffer(this.a.RENDERBUFFER,r);this.a.framebufferTexture2D(this.a.FRAMEBUFFER,this.a.COLOR_ATTACHMENT0,this.a.TEXTURE_2D,c,0);this.a.framebufferRenderbuffer(this.a.FRAMEBUFFER,this.a.DEPTH_ATTACHMENT,this.a.RENDERBUFFER,b);this.a.bindFramebuffer(this.a.FRAMEBUFFER,r);this.If=a}}catch(d){j(Error("Exception while accessing GL Context!\n"+d))}a=new Zf;(this.ea==r||this.a==r||this.r==r)&&j(Error("Renderer was not initialized properly."));
(a==r||!(a instanceof Zf))&&j(Error("Could not add shaders."));b=Object.keys(ag);Object.keys($f).every(function(a){a=$f[a];return-1!=this.Ad.search(a)||-1!=this.nd.search(a)}.bind(a))||j(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=ag[a];return-1!=this.Ad.search(a)||-1!=this.nd.search(a)}.bind(a))||j(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.nd);this.a.shaderSource(c,a.Ad);this.a.compileShader(b);this.a.compileShader(c);this.a.getShaderParameter(b,this.a.COMPILE_STATUS)||j(Error("Fragement Shader compilation failed!\n"+this.a.getShaderInfoLog(b)));this.a.getShaderParameter(c,this.a.COMPILE_STATUS)||j(Error("Vertex Shader compilation failed!\n"+this.a.getShaderInfoLog(c)));var e=this.a.createProgram();this.a.attachShader(e,c);this.a.attachShader(e,b);this.a.linkProgram(e);this.a.getProgramParameter(e,this.a.LINK_STATUS)||j(Error("Could not create shader program!\n"+
this.a.getShaderInfoLog(b)+"\n"+this.a.getShaderInfoLog(c)+"\n"+this.a.getProgramInfoLog(e)));this.a.useProgram(e);this.xe=e;Object.keys($f).forEach(function(a){a=$f[a];this.ie.set(a,this.a.getAttribLocation(this.xe,a));this.a.enableVertexAttribArray(this.ie.get(a))}.bind(this));Object.keys(ag).forEach(function(a){a=ag[a];this.Vc.set(a,this.a.getUniformLocation(this.xe,a))}.bind(this));this.ye=a};
u.bb=function(a){Ag.p.bb.call(this,a);var b=s;this.get(a.fa)&&(b=q);var c=a.fa,d=a.j,e=a.k,f=a.$,g=a.Aa,h=a.m,k=a.Yb,l=a.fb,m=a.O,p=a.w;if(m!=r&&m.m!=r&&m.m.e)this.bb(m);else if(m!=r&&m.e&&this.bb(m),l!=r&&l.m!=r&&l.m.e)this.I.load(l,a);else if(g!=r&&g.m!=r&&g.m.e)this.I.load(g,a);else{if(h!=r&&ka(h))if(a.fc!=r){if(a.fc.Sd!=h.length||!a.e)return}else{b=0;c=h.length;for(b=0;b<c;b++)this.I.load(h[b],a);return}else{if(h!=r&&h.e){this.I.load(a,a);return}if(p!=r&&p.m!=r&&p.m.e){this.I.load(p,a);return}}if(0<
a.h.length){h=a.h;l=h.length;for(m=m=0;m<l;m++)this.bb(h[m])}if(d){for(h=0;this.rd;)h++,window.console.log("Possible thread lock avoided: "+h);this.rd=q;l=a instanceof Ad&&a.ib instanceof xe;b&&(g!=r&&g.e)&&(h=this.xc.get(c),h!=r&&this.a.isBuffer(h.B)&&this.a.deleteBuffer(h.B));h=r;g!=r&&(!b||g.e?(h=a.wc,h==r&&j(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),m=s,g.Xb&&(m=q),this.a.pixelStorei(this.a.UNPACK_FLIP_Y_WEBGL,m),m=this.a.createTexture(),
m.Mh=g.rb,this.yc.set(g.fa,m),this.a.bindTexture(this.a.TEXTURE_2D,m),g.Xb?this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,g.Kf,g.Jf,0,this.a.RGBA,this.a.UNSIGNED_BYTE,g.Xb):this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,this.a.RGBA,this.a.UNSIGNED_BYTE,m.Mh),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE),l?(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST),
this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST)):(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.LINEAR),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.LINEAR)),this.a.bindTexture(this.a.TEXTURE_2D,r),m=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,m),this.a.bufferData(this.a.ARRAY_BUFFER,new Float32Array(h),this.a.STATIC_DRAW),h=new bg(m,h.length,2),g.e=s):h=this.xc.get(c));uf(this.I,0.1);if(l)this.rd=
s,H.qa(this.c+".update"),uf(this.I,0.9);else{if(!b||d.e||k.e){l=k.ma;g=H.d.Sa(l,d.Sb,d.Tb,d.Ub);l=H.d.Sa(l,d.Pb,d.Qb,d.Rb);if(this.Oc===r||g.x<this.Oc)this.Oc=g.x;if(this.Lc===r||l.x>this.Lc)this.Lc=l.x;if(this.Pc===r||g.y<this.Pc)this.Pc=g.y;if(this.Mc===r||l.y>this.Mc)this.Mc=l.y;if(this.Qc===r||g.b<this.Qc)this.Qc=g.b;if(this.Nc===r||l.b>this.Nc)this.Nc=l.b;this.q=[(this.Oc+this.Lc)/2,(this.Pc+this.Mc)/2,(this.Qc+this.Nc)/2];k.e=s}b&&d.e&&(k=this.Fb.get(c),k!=r&&this.a.isBuffer(k.B)&&this.a.deleteBuffer(k.B));
k=r;!b||d.e?(k=this.a.createBuffer(),d.mb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,k),this.a.bufferData(this.a.ARRAY_BUFFER,d.P,this.a.STATIC_DRAW),k=new bg(k,d.count,3),d.e=s):k=this.Fb.get(c);uf(this.I,0.3);b&&e.e&&(g=this.Fb.get(c),g!=r&&this.a.isBuffer(g.B)&&this.a.deleteBuffer(g.B));g=r;!b||e.e?(g=this.a.createBuffer(),e.mb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,g),this.a.bufferData(this.a.ARRAY_BUFFER,e.P,this.a.STATIC_DRAW),g=new bg(g,e.count,3),e.e=s):g=this.td.get(c);uf(this.I,0.3);b&&(f&&
f.e)&&(e=this.ic.get(c),e!=r&&this.a.isBuffer(e.B)&&this.a.deleteBuffer(e.B));e=r;f&&(!b||f.e?(f.length!=d.length&&j(Error("Mismatch between points and point colors.")),e=this.a.createBuffer(),f.mb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,e),this.a.bufferData(this.a.ARRAY_BUFFER,f.P,this.a.STATIC_DRAW),e=new bg(e,f.count,3),f.e=s):e=this.ic.get(c));uf(this.I,0.2);b&&(p&&p.e)&&(f=this.qc.get(c),f!=r&&this.a.isBuffer(f.B)&&this.a.deleteBuffer(f.B));f=r;p&&(f=p.Fc,!b||p.e?(f.length!=d.length&&j(Error("Mismatch between points and scalars.")),
d=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,d),this.a.bufferData(this.a.ARRAY_BUFFER,f,this.a.STATIC_DRAW),f=new bg(d,f.length,3),p.e=s):f=this.qc.get(c));uf(this.I,0.1);b||this.Ya.add(a);this.Fb.set(c,k);this.td.set(c,g);this.ic.set(c,e);this.xc.set(c,h);this.qc.set(c,f);this.rd=a.e=s}}else a.e=s}};function Bg(a,b){var c=b.j.ld,c=H.d.Sa(b.Yb.ma,c[0],c[1],c[2]),c=H.d.Sa(a.r.o,c.x,c.y,c.b),c=H.f.Hb(a.r.za,c);return Math.round(1E3*c)/1E3}
u.Eg=function(a,b){if(this.G.PICKING_ENABLED){this.Lb(q,s);var c=new Uint8Array(4);this.a.readPixels(a,this.D-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);return c[0]+255*c[1]+65025*c[2]}return-1};
u.Lb=function(a,b){Ag.p.Lb.call(this,a,b);this.a.viewport(0,0,this.J,this.D);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var c=this.Ya.u,d=c.length;if(0!=d){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.If):this.a.bindFramebuffer(this.a.FRAMEBUFFER,r);var e=this.r.Hf,f=this.r.o;this.a.uniformMatrix4fv(this.Vc.get("perspective"),s,e);this.a.uniformMatrix4fv(this.Vc.get("view"),s,f);e=this.q;this.a.uniform3f(this.Vc.get("center"),parseFloat(e[0]),parseFloat(e[1]),parseFloat(e[2]));
f=this.La.length;for(e=0;e<f;++e){var g=this.La[e];if(g instanceof Q){var h=H.d.Sa(this.r.o,1,0,0),k=H.f.Hb(this.r.za,h),h=H.d.Sa(this.r.o,-1,0,0),l=H.f.Hb(this.r.za,h),h=H.d.Sa(this.r.o,0,1,0),m=H.f.Hb(this.r.za,h),h=H.d.Sa(this.r.o,0,-1,0),p=H.f.Hb(this.r.za,h),h=H.d.Sa(this.r.o,0,0,1),x=H.f.Hb(this.r.za,h),h=H.d.Sa(this.r.o,0,0,-1),h=H.f.Hb(this.r.za,h),w=Math.max(k,m,x,l,p,h);w==k||w==l?we(g,0):w==m||w==p?we(g,1):(w==x||w==h)&&we(g,2)}}if(this.G.ORDERING_ENABLED){k=s;f=this.La;g=f.length-1;do if(e=
f[g],e instanceof Q&&e.Pa){l=e.Gb;k=e.tc.h;1==l?k=e.uc.h:2==l&&(k=e.vc.h);l=k.length;m=k[0];m.N=Bg(this,m);m.ca=e.ca;p=k[l-1];p.N=Bg(this,p);p.ca=e.ca;p=Math.round(1E3*((p.N-m.N)/l))/1E3;for(x=x=1;x<l-1;x++)h=Math.round(1E3*(m.N+x*p))/1E3,k[x].N=h,k[x].ca=e.ca;k=q}while(g--);f=this.Ya.u;g=f.length-1;do if(e=f[g],e.ta&&!(1==e.ca||e instanceof Ad))e.N=Bg(this,e),k=q;while(g--);k&&this.Ya.sort()}if(f=!a&&b!=r&&b&&this.G.STATISTICS_ENABLED)var y=0,z=0,E=0,G=0;var e=this.ie,g=e.get("vertexPosition"),k=
e.get("vertexNormal"),l=e.get("vertexColor"),m=e.get("vertexTexturePos"),p=e.get("vertexScalar"),e=this.Vc,x=e.get("usePicking"),h=e.get("useObjectColor"),w=e.get("objectColor"),B=e.get("useScalars"),F=e.get("scalarsReplaceMode"),I=e.get("scalarsMin"),J=e.get("scalarsMax"),T=e.get("scalarsMinColor"),K=e.get("scalarsMaxColor"),S=e.get("scalarsInterpolation"),P=e.get("scalarsMinThreshold"),N=e.get("scalarsMaxThreshold"),O=e.get("objectOpacity"),ba=e.get("labelmapOpacity"),ea=e.get("labelmapColor"),
A=e.get("useTexture"),Y=e.get("useLabelMapTexture"),Z=e.get("textureSampler"),sa=e.get("textureSampler2"),Ga=e.get("volumeLowerThreshold"),lc=e.get("volumeUpperThreshold"),Nd=e.get("volumeScalarMin"),fb=e.get("volumeScalarMax"),Qb=e.get("volumeWindowLow"),Gg=e.get("volumeWindowHigh"),Hg=e.get("volumeScalarMinColor"),Ig=e.get("volumeScalarMaxColor"),Uf=e.get("volumeTexture"),Jg=e.get("objectTransform"),Kg=e.get("pointSize"),e=d;do{var da=c[d-e];if(da){var ja=r;da instanceof Ad&&da.ib&&(ja=da.ib);if(da.ta&&
(!ja||ja.ta)&&(!a||da.Rc)){var wa=da.fa,Ya=da.Kc,Ia=this.Fb.get(wa),gb=this.td.get(wa),ye=this.ic.get(wa),xb=this.qc.get(wa),ze=this.xc.get(wa);this.a.bindBuffer(this.a.ARRAY_BUFFER,Ia.B);this.a.vertexAttribPointer(g,Ia.wb,this.a.FLOAT,s,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,gb.B);this.a.vertexAttribPointer(k,gb.wb,this.a.FLOAT,s,0,0);a?this.a.uniform1i(x,q):this.a.uniform1i(x,s);ye&&!a&&!Ya?(this.a.uniform1i(h,s),this.a.bindBuffer(this.a.ARRAY_BUFFER,ye.B),this.a.vertexAttribPointer(l,ye.wb,
this.a.FLOAT,s,0,0)):(gb=1,Ya&&!a&&(gb=0),this.a.uniform1i(h,gb),gb=da.Mb,a&&(gb=[Math.floor(wa%65025%255)/255,Math.floor(wa%65025/255)/255,Math.floor(wa/65025)/255]),this.a.uniform3f(w,parseFloat(gb[0]),parseFloat(gb[1]),parseFloat(gb[2])),this.a.vertexAttribPointer(l,Ia.wb,this.a.FLOAT,s,0,0));xb&&!a&&!Ya?(this.a.uniform1i(B,q),this.a.uniform1i(F,da.w.Mf),wa=da.w.Ab,Ya=da.w.yb,this.a.uniform3f(T,parseFloat(wa[0]),parseFloat(wa[1]),parseFloat(wa[2])),this.a.uniform3f(K,parseFloat(Ya[0]),parseFloat(Ya[1]),
parseFloat(Ya[2])),this.a.uniform1f(P,parseFloat(da.w.V)),this.a.uniform1f(N,parseFloat(da.w.W)),this.a.uniform1f(I,parseFloat(da.w.Oa)),this.a.uniform1f(J,parseFloat(da.w.aa)),this.a.uniform1i(S,parseInt(da.w.le,10)),this.a.bindBuffer(this.a.ARRAY_BUFFER,xb.B),this.a.vertexAttribPointer(p,xb.wb,this.a.FLOAT,s,0,0)):(this.a.uniform1i(B,s),this.a.vertexAttribPointer(p,Ia.wb,this.a.FLOAT,s,0,0));this.a.uniform1f(O,parseFloat(da.ca));da.Aa&&ze&&!a?(this.a.uniform1i(A,q),this.a.activeTexture(this.a.TEXTURE0),
this.a.bindTexture(this.a.TEXTURE_2D,this.yc.get(da.Aa.fa)),this.a.uniform1i(Z,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,ze.B),this.a.vertexAttribPointer(m,ze.wb,this.a.FLOAT,s,0,0),this.a.uniform1i(Uf,s)):(this.a.uniform1i(A,s),this.a.vertexAttribPointer(m,Ia.wb,this.a.FLOAT,s,0,0));ja&&(this.a.uniform1i(Uf,q),this.a.uniform1f(Ga,ja.V),this.a.uniform1f(lc,ja.W),this.a.uniform1f(Nd,ja.Oa),this.a.uniform1f(fb,ja.aa),wa=ja.Ab,Ya=ja.yb,this.a.uniform3f(Hg,parseFloat(wa[0]),parseFloat(wa[1]),parseFloat(wa[2])),
this.a.uniform3f(Ig,parseFloat(Ya[0]),parseFloat(Ya[1]),parseFloat(Ya[2])),this.a.uniform1f(Qb,ja.Y),this.a.uniform1f(Gg,ja.X),xb=ja.O,this.a.uniform1i(Y,s),ja.Pa?this.a.uniform1f(O,parseFloat(ja.ca)):xb&&xb.ta&&(ja=da.O.fa,this.a.uniform1i(Y,q),this.a.activeTexture(this.a.TEXTURE1),this.a.bindTexture(this.a.TEXTURE_2D,this.yc.get(ja)),this.a.uniform1i(sa,1),this.a.uniform1f(ba,xb.ca),this.a.uniform4fv(ea,xb.ze)));this.a.uniformMatrix4fv(Jg,s,da.Yb.ma);ja=1;"POINTS"==da.na&&(ja=da.Sc);this.a.uniform1f(Kg,
ja);ja=-1;da.na==Tc?(ja=this.a.TRIANGLES,f&&(z+=Ia.vb/3)):"LINES"==da.na?(this.a.lineWidth(da.nc),ja=this.a.LINES,f&&(E+=Ia.vb/2)):"POINTS"==da.na?(ja=this.a.POINTS,f&&(G+=Ia.vb)):"TRIANGLE_STRIPS"==da.na?(ja=this.a.TRIANGLE_STRIP,f&&(z+=Ia.vb/3)):"POLYGONS"==da.na&&(ja=0==Ia.vb%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(z+=Ia.vb/3));f&&(y+=Ia.vb);this.a.drawArrays(ja,0,Ia.vb)}}}while(--e);f&&(c="Objects: "+d+" | "+("Vertices: "+y+" | "),c+="Triangles: "+Math.round(z)+" | ",c+="Lines: "+E+" | ",c+=
"Points: "+G+" | ",c+="Textures: "+this.yc.Kd(),window.console.log(c))}};
u.remove=function(a){Ag.p.remove.call(this,a);if(0<a.h.length)for(var b=a.h,c=b.length,d=0,d=0;d<c;d++)this.remove(b[d]);b=a.fa;if(this.get(b)){c=this.xc.get(b);c!=r&&this.a.isBuffer(c.B)&&this.a.deleteBuffer(c.B);if(a.mk&&(c=this.yc.get(a.Aa.fa)))this.a.deleteTexture(c),this.yc.remove(a.Aa.fa);c=this.Fb.get(b);c!=r&&this.a.isBuffer(c.B)&&this.a.deleteBuffer(c.B);c=this.Fb.get(b);c!=r&&this.a.isBuffer(c.B)&&this.a.deleteBuffer(c.B);c=this.ic.get(b);c!=r&&this.a.isBuffer(c.B)&&this.a.deleteBuffer(c.B);
c=this.qc.get(b);c!=r&&this.a.isBuffer(c.B)&&this.a.deleteBuffer(c.B);this.Fb.remove(b);this.td.remove(b);this.ic.remove(b);this.xc.remove(b);this.qc.remove(b);this.Ya.remove(a);return q}return s};u.Fd=function(){this.ye=r;delete this.ye;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);Ag.p.Fd.call(this)};C("X.renderer3D",Ag);C("X.renderer3D.prototype.init",Ag.prototype.ia);C("X.renderer3D.prototype.add",Ag.prototype.add);C("X.renderer3D.prototype.onShowtime",Ag.prototype.Ag);
C("X.renderer3D.prototype.onRender",Ag.prototype.yg);C("X.renderer3D.prototype.get",Ag.prototype.get);C("X.renderer3D.prototype.render",Ag.prototype.ec);C("X.renderer3D.prototype.destroy",Ag.prototype.Fd);C("X.renderer3D.prototype.remove",Ag.prototype.remove);C("X.renderer3D.prototype.resetBoundingBox",Ag.prototype.Oi);C("X.renderer3D.prototype.resetViewAndRender",Ag.prototype.jd);C("X.renderer3D.prototype.pick",Ag.prototype.Eg);function Cg(){Yf.call(this);this.c="renderer2D";this.Ja=r;this.Vb=-1;this.oc=[];this.zf=this.me=this.xf=this.ke=r;this.rc=this.sc=this.xd=this.yd=0;this.X=this.Y=this.W=this.V=this.vf=-1;this.Af=new Float32Array([-255,-255,-255,-255]);this.vd=q}D(Cg,Yf);Cg.prototype.qi=aa();Cg.prototype.zi=aa();Cg.prototype.cf=function(a){Cg.p.cf.call(this,a);var b=this.La[0];if(b){var c=this.Vb,d="",d=0==c?"indexX":1==c?"indexY":"indexZ";b[d]=a.L?b[d]+1:b[d]-1;eval("this.onScroll();")}};
Cg.prototype.Ai=function(a){var b=this.La[0];if(b){var c=b.X-b.Y,d=c/2,e=parseInt(c+c/15*-a.De,10);a=parseInt(d+d/15*a.re,10);c==e&&e++;d==a&&a++;b.Y-=parseInt(d-a,10);b.Y-=parseInt(c-e,10);b.Y=Math.max(b.Y,b.Oa);b.X-=parseInt(d-a,10);b.X+=parseInt(c-e,10);b.X=Math.min(b.X,b.aa);eval("this.onWindowLevel();")}};Cg.prototype.__defineGetter__("orientation",t("Ja"));
Cg.prototype.__defineSetter__("orientation",function(a){a=a.toUpperCase();"AXIAL"==a?a="Z":"SAGITTAL"==a?a="X":"CORONAL"==a&&(a="Y");"X"!=a&&("Y"!=a&&"Z"!=a)&&j(Error("Invalid orientation."));this.Ja=a;if(a=this.La[0])this.Vb=Dg(a.s,this.Ja)});Cg.prototype.__defineGetter__("radiological",t("vd"));Cg.prototype.__defineSetter__("radiological",ca("vd"));u=Cg.prototype;
u.ia=function(){this.Ja||j(Error("No 2D orientation set."));Cg.p.ia.call(this,"2d");this.a.fillStyle="rgba(50,50,50,0)";this.a.fillRect(0,0,this.ea.width,this.ea.height);this.ke=Qd("canvas");this.me=Qd("canvas");L(this.r,gd,this.Ai.bind(this))};u.bf=function(){Cg.p.bf.call(this);Eg(this)};u.jd=function(){Cg.p.jd.call(this);Eg(this);var a=this.La[0];a&&(a.X=a.aa,a.Y=a.Oa)};
function Dg(a,b){if("X"==b){if(0!=a[2][0])return 0;if(0!=a[0][0])return 1}else if("Y"==b){if(0!=a[2][1])return 0;if(0!=a[0][1])return 1}else{if(0!=a[2][2])return 0;if(0!=a[0][2])return 1}return 2}
u.bb=function(a){Cg.p.bb.call(this,a);var b=s;this.get(a.fa)&&(b=q);if(a instanceof Q){var c=a.m,d=a.O,e=a.fb;if(d!=r&&d.m!=r&&d.m.e)this.bb(d);else if(e!=r&&e.m!=r&&e.m.e)this.I.load(e,a);else{if(c!=r&&ka(c))if(a.fc!=r){if(a.fc.Sd!=c.length||b&&!a.e)return}else{b=0;d=c.length;for(b=0;b<d;b++)this.I.load(c[b],a);return}else if(c!=r&&c.e){this.I.load(a,a);return}var c=a.Eb,f=a.s,g=a.ra,d=this.Vb=Dg(f,this.Ja),e=(d+1)%3,h=(d+2)%3;if(0!=f[2][1])var k=d,d=e,e=k;0!=f[h][1]&&(k=d,d=e,e=k);f=g[d];g=g[e];
this.Uc=a.h[this.Vb].h;this.sc=c[d];this.rc=c[e];this.yd=f;this.xd=g;c=this.ke;c.width=f;c.height=g;d=this.me;d.width=f;d.height=g;this.xf=c.getContext("2d");this.zf=d.getContext("2d");b||(this.Ya.add(a),Eg(this))}}};function Eg(a){var b=Math.min(a.J/(a.yd*a.sc),a.D/(a.xd*a.rc));a.r.o[14]=b}
u.Lg=function(a,b){var c=this.La[0],d=this.r.o,e=1*d[12],f=-1*d[13],d=Math.max(d[14],0.6),g=[this.J/2,this.D/2],h=this.yd*this.sc*d,k=this.xd*this.rc*d,l=g[0]-h/2,g=g[1]-k/2,l=l+e*d,m=0,p=0,m=this.Vb,e=(m+1)%3,x=(m+2)%3;0!=c.s[x][2]?(this.oc[0]="yellow",this.oc[1]="green"):(this.oc[0]=0!=c.s[x][1]?"yellow":"green",this.oc[1]="red");var w=c.ra[m],y=c.ra[e];if(0!=c.s[x][1]||0!=c.s[2][1])w=c.ra[e],y=c.ra[m],m=e,e=x,x=m;0!=c.s[2][1]&&(m=e,e=x,x=m);c=[Math.floor(c.S),Math.floor(c.T),Math.floor(c.U)];m=
this.vd?Math.floor(w-(a-l)/h*w):Math.floor((a-l)/h*w);p=Math.floor(y-(b-(g+f*d))/k*y);if(0>m||m>=w||0>p||p>=y)return r;c[e]=m;c[x]=p;return c};
u.Lb=function(a,b){Cg.p.Lb.call(this,a,b);if(0!=this.Ya.u.length){var c=this.J,d=this.D,e=this.r.o;this.a.save();this.a.clearRect(-c,-d,2*c,2*d);this.a.restore();var f=1*e[12],g=-1*e[13],h=Math.max(e[14],0.6);this.a.setTransform(h,0,0,h,0,0);var e=this.La[0],k=r;e.O&&(k=e.O.ze);var l=this.Vb,m=r,m=0==l?e.indexX:1==l?e.indexY:e.indexZ,p=this.Uc[parseInt(m,10)],x=p.Aa.Xb,p=p.O,w=r;p&&(w=p.Xb);var y=this.yd,z=this.xd,E=this.xf,G=this.zf,B=E.getImageData(0,0,y,z),F=G.getImageData(0,0,y,z),I=B.data,J=
F.data,T=I.length,K=e.Ja,S=e.s,P=e.aa,N=e.V,O=e.W,ba=e.Y/P,ea=e.X/P;if(this.vf!=m||this.V!=N||this.W!=O||this.Y!=ba||this.X!=ea||k&&!Ff(k,this.Af,0)){var A=0;do{var Y=[0,0,0,0],Z=[0,0,0,0],sa=x[A]/255*P,Ga=x[A],Ga=(Ga/255-ba)/(ea-ba),Ga=255*Ga;sa>=N&&sa<=O&&(Y=new R(e.Ab[0],e.Ab[1],e.Ab[2]),Y=(new R(e.yb[0],e.yb[1],e.yb[2])).scale(Ga).add(Y.scale(255-Ga)),Y=[Math.floor(Y.x),Math.floor(Y.y),Math.floor(Y.b),255],p&&(-255==k[3]?Z=[w[A],w[A+1],w[A+2],w[A+3]]:Ff(k,w,A)&&(Z=[w[A],w[A+1],w[A+2],w[A+3]])));
var sa=l,lc=(sa+1)%3,Nd=(sa+2)%3,Ga=A,fb=K[sa],Qb=K[lc];0!=S[Nd][0]?0!=S[2][1]?(A=4*(A/4%z*y+Math.floor(A/4/z)),fb=-K[lc],Qb=K[sa]):fb*=-1:(0!=S[Nd][1]?0==S[2][1]&&(A=4*(A/4%z*y+Math.floor(A/4/z)),fb=K[lc],Qb=K[sa]):0!=S[2][1]&&(A=4*(A/4%z*y+Math.floor(A/4/z)),fb=K[lc],Qb=K[sa]),this.vd&&(fb*=-1));1==fb?(1==Qb&&(A=4*y*(z-Math.floor(A/(4*y)))+A%(4*y)),I[A]=Y[0],I[A+1]=Y[1],I[A+2]=Y[2],I[A+3]=Y[3],J[A]=Z[0],J[A+1]=Z[1],J[A+2]=Z[2],J[A+3]=Z[3]):1==Qb?(A=T-1-A,I[A-3]=Y[0],I[A-2]=Y[1],I[A-1]=Y[2],I[A]=
Y[3],J[A-3]=Z[0],J[A-2]=Z[1],J[A-1]=Z[2],J[A]=Z[3]):(A=4*y*Math.floor(A/(4*y))-A%(4*y),I[A]=Y[0],I[A+1]=Y[1],I[A+2]=Y[2],I[A+3]=Y[3],J[A]=Z[0],J[A+1]=Z[1],J[A+2]=Z[2],J[A+3]=Z[3]);A=Ga+4}while(A<T);E.putImageData(B,0,0);G.putImageData(F,0,0);this.vf=m;this.V=N;this.W=O;this.Y=ba;this.X=ea;p&&(this.Af=k)}this.a.globalAlpha=1;this.a.translate(c/2/h,d/2/h);c=-y*this.sc/2+f;g=-z*this.rc/2+g;this.a.drawImage(this.ke,c,g,y*this.sc,z*this.rc);p&&e.O.ta&&(this.a.globalAlpha=e.O.ca,this.a.drawImage(this.me,
c,g,y*this.sc,z*this.rc));if(this.G.SLICENAVIGATORS&&(this.la.sd&&this.la.Nf&&!this.la.Xa)&&(g=this.la.gb,g=this.Lg(g[0],g[1])))e.S=g[0],e.T=g[1],e.U=g[2],e.l(s),this.a.setTransform(1,0,0,1,0,0),this.a.lineWidth=1,this.a.beginPath(),this.a.moveTo(this.la.gb[0]+0.5,0),this.a.lineTo(this.la.gb[0]+0.5,this.D),this.a.strokeStyle=this.oc[0],this.a.stroke(),this.a.closePath(),this.a.beginPath(),this.a.moveTo(0,this.la.gb[1]+0.5),this.a.lineTo(this.J,this.la.gb[1]+0.5),this.a.strokeStyle=this.oc[1],this.a.stroke(),
this.a.closePath()}};C("X.renderer2D",Cg);C("X.renderer2D.prototype.init",Cg.prototype.ia);C("X.renderer2D.prototype.add",Cg.prototype.add);C("X.renderer2D.prototype.onShowtime",Cg.prototype.Ag);C("X.renderer2D.prototype.onRender",Cg.prototype.yg);C("X.renderer2D.prototype.onScroll",Cg.prototype.qi);C("X.renderer2D.prototype.onWindowLevel",Cg.prototype.zi);C("X.renderer2D.prototype.get",Cg.prototype.get);C("X.renderer2D.prototype.resetViewAndRender",Cg.prototype.jd);
C("X.renderer2D.prototype.xy2ijk",Cg.prototype.Lg);C("X.renderer2D.prototype.render",Cg.prototype.ec);C("X.renderer2D.prototype.destroy",Cg.prototype.Fd);function Fg(){V.call(this);this.c="fibers";Fa(this,new uc)}D(Fg,V);C("X.fibers",Fg);function Lg(){V.call(this);this.c="mesh";Fa(this,new uc)}D(Lg,V);C("X.mesh",Lg);