-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathxtk_release_3b.js
269 lines (269 loc) · 121 KB
/
xtk_release_3b.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
/*
*
* 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/X/master/lib/closure-library/LICENSE
*
* - the JSXCompressor library (http://jsxgraph.uni-bayreuth.de/wp/jsxcompressor/)
* LICENSE: https://raw.github.com/xtk/X/master/lib/JXG/LICENSE
*
* MORE CREDITS: https://raw.github.com/xtk/X/master/LICENSE
*
*/
function g(a){throw a;}var n=void 0,o=!0,q=null,r=!1;function ba(){return function(){}}function ca(a){return function(b){this[a]=b}}function t(a){return function(){return this[a]}}var w,da=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 x(a){return a!=q}function ja(a){return"array"==ha(a)}function ka(a){var b=ha(a);return"array"==b||"object"==b&&"number"==typeof a.length}function y(a){return"string"==typeof a}function z(a){return"number"==typeof a}function ma(a){return"function"==ha(a)}function na(a){a=ha(a);return"object"==a||"array"==a||"function"==a}function pa(a){return a[sa]||(a[sa]=++ta)}
var sa="closure_uid_"+Math.floor(2147483648*Math.random()).toString(36),ta=0;function ua(a,b,c){return a.call.apply(a.bind,arguments)}function va(a,b,c){a||g(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 wa(a,b,c){wa=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ua:va;return wa.apply(q,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 A(a,b){var c=a.split("."),d=da;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var f;c.length&&(f=c.shift());)!c.length&&ia(b)?d[f]=b:d=d[f]?d[f]:d[f]={}}function C(a,b){function c(){}c.prototype=b.prototype;a.C=b.prototype;a.prototype=new c};window["X.Counter"]=function(){var a=0;return{ze:function(){a+=1},Bh:function(){a+=-1},value:function(){return a}}}();
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return e.apply(this instanceof c?this:a||window,f.concat(d.call(arguments)))}function c(){}"function"!==typeof this&&g(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var d=Array.prototype.slice,f=d.call(arguments,1),e=this;c.prototype=this.prototype;b.prototype=new c;return b});A("Function.prototype.bind",Function.prototype.bind);function za(a){if(!Aa.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Ca,"&"));-1!=a.indexOf("<")&&(a=a.replace(Da,"<"));-1!=a.indexOf(">")&&(a=a.replace(Ea,">"));-1!=a.indexOf('"')&&(a=a.replace(Fa,"""));return a}var Ca=/&/g,Da=/</g,Ea=/>/g,Fa=/\"/g,Aa=/[&<>\"]/;var Ga,Ha,Ia,Ja,Ka,La,Ma;function Na(){return da.navigator?da.navigator.userAgent:q}function Oa(){return da.navigator}Ka=Ja=Ia=Ha=Ga=r;var Pa;if(Pa=Na()){var Qa=Oa();Ga=0==Pa.indexOf("Opera");Ha=!Ga&&-1!=Pa.indexOf("MSIE");Ja=(Ia=!Ga&&-1!=Pa.indexOf("WebKit"))&&-1!=Pa.indexOf("Mobile");Ka=!Ga&&!Ia&&"Gecko"==Qa.product}var Ra=Ga,E=Ha,Sa=Ka,F=Ia,Ta=Ja,Ua,Va=Oa();Ua=Va&&Va.platform||"";La=-1!=Ua.indexOf("Mac");Ma=-1!=Ua.indexOf("Win");var Wa=!!Oa()&&-1!=(Oa().appVersion||"").indexOf("X11"),Xa;
a:{var Za="",$a;if(Ra&&da.opera)var ab=da.opera.version,Za="function"==typeof ab?ab():ab;else if(Sa?$a=/rv\:([^\);]+)(\)|;)/:E?$a=/MSIE\s+([^\);]+)(\)|;)/:F&&($a=/WebKit\/(\S+)/),$a)var bb=$a.exec(Na()),Za=bb?bb[1]:"";if(E){var cb,db=da.document;cb=db?db.documentMode:n;if(cb>parseFloat(Za)){Xa=""+cb;break a}}Xa=Za}var eb={};
function fb(a){var b;if(!(b=eb[a])){b=0;for(var c=(""+Xa).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=(""+a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),f=Math.max(c.length,d.length),e=0;0==b&&e<f;e++){var h=c[e]||"",i=d[e]||"",j=RegExp("(\\d*)(\\D*)","g"),p=RegExp("(\\d*)(\\D*)","g");do{var k=j.exec(h)||["","",""],m=p.exec(i)||["","",""];if(0==k[0].length&&0==m[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==m[1].length?0:parseInt(m[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==m[1].length?0:parseInt(m[1],10))?1:0)||((0==k[2].length)<(0==m[2].length)?-1:(0==k[2].length)>(0==m[2].length)?1:0)||(k[2]<m[2]?-1:k[2]>m[2]?1:0)}while(0==b)}b=eb[a]=0<=b}return b}var gb={};function hb(a){return gb[a]||(gb[a]=E&&document.documentMode&&document.documentMode>=a)};function jb(a,b){for(var c in a)b.call(n,a[c],c,a)}function kb(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function lb(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b}var mb="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");function nb(a,b){for(var c,d,f=1;f<arguments.length;f++){d=arguments[f];for(c in d)a[c]=d[c];for(var e=0;e<mb.length;e++)c=mb[e],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var ob=Array.prototype,pb=ob.indexOf?function(a,b,c){return ob.indexOf.call(a,b,c)}:function(a,b,c){c=c==q?0:0>c?Math.max(0,a.length+c):c;if(y(a))return!y(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},qb=ob.forEach?function(a,b,c){ob.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=y(a)?a.split(""):a,e=0;e<d;e++)e in f&&b.call(c,f[e],e,a)},rb=ob.map?function(a,b,c){return ob.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=Array(d),e=y(a)?
a.split(""):a,h=0;h<d;h++)h in e&&(f[h]=b.call(c,e[h],h,a));return f},sb=ob.some?function(a,b,c){return ob.some.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=y(a)?a.split(""):a,e=0;e<d;e++)if(e in f&&b.call(c,f[e],e,a))return o;return r},tb=ob.every?function(a,b,c){return ob.every.call(a,b,c)}:function(a,b,c){for(var d=a.length,f=y(a)?a.split(""):a,e=0;e<d;e++)if(e in f&&!b.call(c,f[e],e,a))return r;return o};function ub(a,b){var c=pb(a,b);0<=c&&ob.splice.call(a,c,1)}
function vb(a){return ob.concat.apply(ob,arguments)}function wb(a){if(ja(a))return vb(a);for(var b=[],c=0,d=a.length;c<d;c++)b[c]=a[c];return b}function xb(a,b,c){return 2>=arguments.length?ob.slice.call(a,b):ob.slice.call(a,b,c)};function yb(a){if("function"==typeof a.$)a=a.$();else if(ka(a)||y(a))a=a.length;else{var b=0,c;for(c in a)b++;a=b}return a}function zb(a){if("function"==typeof a.aa)return a.aa();if(y(a))return a.split("");if(ka(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return kb(a)}
function Ab(a,b){if("function"==typeof a.every)return a.every(b,n);if(ka(a)||y(a))return tb(a,b,n);var c;if("function"==typeof a.Tb)c=a.Tb();else if("function"!=typeof a.aa)if(ka(a)||y(a)){c=[];for(var d=a.length,f=0;f<d;f++)c.push(f)}else c=lb(a);else c=n;for(var d=zb(a),f=d.length,e=0;e<f;e++)if(!b.call(n,d[e],c&&c[e],a))return r;return o};var Fb="StopIteration"in da?da.StopIteration:Error("StopIteration");function Gb(){}Gb.prototype.next=function(){g(Fb)};Gb.prototype.vb=function(){return this};function Hb(a){if(a instanceof Gb)return a;if("function"==typeof a.vb)return a.vb(r);if(ka(a)){var b=0,c=new Gb;c.next=function(){for(;;){b>=a.length&&g(Fb);if(b in a)return a[b++];b++}};return c}g(Error("Not implemented"))}
function Ib(a,b){if(ka(a))try{qb(a,b,n)}catch(c){c!==Fb&&g(c)}else{a=Hb(a);try{for(;;)b.call(n,a.next(),n,a)}catch(d){d!==Fb&&g(d)}}};function Jb(a,b){this.r={};this.n=[];var c=arguments.length;if(1<c){c%2&&g(Error("Uneven number of arguments"));for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&this.md(a)}w=Jb.prototype;w.g=0;w.ic=0;w.$=t("g");w.aa=function(){Kb(this);for(var a=[],b=0;b<this.n.length;b++)a.push(this.r[this.n[b]]);return a};w.Tb=function(){Kb(this);return this.n.concat()};w.qd=function(a){for(var b=0;b<this.n.length;b++){var c=this.n[b];if(Lb(this.r,c)&&this.r[c]==a)return o}return r};
w.Pb=function(a,b){if(this===a)return o;if(this.g!=a.$())return r;var c=b||Mb;Kb(this);for(var d,f=0;d=this.n[f];f++)if(!c(this.get(d),a.get(d)))return r;return o};function Mb(a,b){return a===b}w.clear=function(){this.r={};this.ic=this.g=this.n.length=0};w.remove=function(a){return Lb(this.r,a)?(delete this.r[a],this.g--,this.ic++,this.n.length>2*this.g&&Kb(this),o):r};
function Kb(a){if(a.g!=a.n.length){for(var b=0,c=0;b<a.n.length;){var d=a.n[b];Lb(a.r,d)&&(a.n[c++]=d);b++}a.n.length=c}if(a.g!=a.n.length){for(var f={},c=b=0;b<a.n.length;)d=a.n[b],Lb(f,d)||(a.n[c++]=d,f[d]=1),b++;a.n.length=c}}w.get=function(a,b){return Lb(this.r,a)?this.r[a]:b};w.set=function(a,b){Lb(this.r,a)||(this.g++,this.n.push(a),this.ic++);this.r[a]=b};w.md=function(a){var b;a instanceof Jb?(b=a.Tb(),a=a.aa()):(b=lb(a),a=kb(a));for(var c=0;c<b.length;c++)this.set(b[c],a[c])};w.d=function(){return new Jb(this)};
w.vb=function(a){Kb(this);var b=0,c=this.n,d=this.r,f=this.ic,e=this,h=new Gb;h.next=function(){for(;;){f!=e.ic&&g(Error("The map has changed since the iterator was created"));b>=c.length&&g(Fb);var h=c[b++];return a?h:d[h]}};return h};function Lb(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Nb(a){this.r=new Jb;a&&this.md(a)}function Ob(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+pa(a):b.substr(0,1)+a}w=Nb.prototype;w.$=function(){return this.r.$()};w.add=function(a){this.r.set(Ob(a),a)};w.md=function(a){for(var a=zb(a),b=a.length,c=0;c<b;c++)this.add(a[c])};w.Lc=function(a){for(var a=zb(a),b=a.length,c=0;c<b;c++)this.remove(a[c])};w.remove=function(a){return this.r.remove(Ob(a))};w.clear=function(){this.r.clear()};
w.contains=function(a){a=Ob(a);return Lb(this.r.r,a)};w.Be=function(a){for(var b=new Nb,a=zb(a),c=0;c<a.length;c++){var d=a[c];this.contains(d)&&b.add(d)}return b};w.aa=function(){return this.r.aa()};w.d=function(){return new Nb(this)};w.Pb=function(a){return this.$()==yb(a)&&Pb(this,a)};
function Pb(a,b){var c=yb(b);if(a.$()>c)return r;!(b instanceof Nb)&&5<c&&(b=new Nb(b));return Ab(a,function(a){if("function"==typeof b.contains)a=b.contains(a);else if("function"==typeof b.qd)a=b.qd(a);else if(ka(b)||y(b))a=0<=pb(b,a);else a:{for(var c in b)if(b[c]==a){a=o;break a}a=r}return a})}w.vb=function(){return this.r.vb(r)};function Qb(){}Qb.prototype.ne=r;Qb.prototype.Z=function(){this.ne||(this.ne=o,this.t())};Qb.prototype.t=function(){this.Ff&&Rb.apply(q,this.Ff)};function Sb(a){a&&"function"==typeof a.Z&&a.Z()}function Rb(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];ka(d)?Rb.apply(q,d):Sb(d)}};function Tb(a,b){this.He=b;this.Sb=[];a>this.He&&g(Error("[goog.structs.SimplePool] Initial cannot be greater than max"));for(var c=0;c<a;c++)this.Sb.push(this.vc())}C(Tb,Qb);w=Tb.prototype;w.ke=q;w.me=q;function Ub(a,b){a.Sb.length<a.He?a.Sb.push(b):a.ud(b)}w.vc=function(){return this.ke?this.ke():{}};w.ud=function(a){if(this.me)this.me(a);else if(na(a))if(ma(a.Z))a.Z();else for(var b in a)delete a[b]};w.t=function(){Tb.C.t.call(this);for(var a=this.Sb;a.length;)this.ud(a.pop());delete this.Sb};function Vb(){this.Qb=[];this.Jd=new Jb;this.hf=this.jf=this.kf=this.cf=0;this.hc=new Jb;this.he=this.gf=0;this.Fd=1;this.vd=new Tb(0,4E3);this.vd.vc=function(){return new Wb};this.df=new Tb(0,50);this.df.vc=function(){return new Xb};var a=this;this.yd=new Tb(0,2E3);this.yd.vc=function(){return""+a.Fd++};this.yd.ud=ba()}function Xb(){this.Rd=this.time=this.count=0}
Xb.prototype.toString=function(){var a=[];a.push(this.type," ",this.count," (",Math.round(10*this.time)/10," ms)");this.Rd&&a.push(" [VarAlloc = ",this.Rd,"]");return a.join("")};function Wb(){}function Yb(a,b,c,d){var f=[];-1==c?f.push(" "):f.push(Zb(a.pe-c));f.push(" ",$b(a.pe-b));0==a.wd?f.push(" Start "):1==a.wd?(f.push(" Done "),f.push(Zb(a.Fh-a.startTime)," ms ")):f.push(" Comment ");f.push(d,a);0<a.Wg&&f.push("[VarAlloc ",a.Wg,"] ");return f.join("")}
Wb.prototype.toString=function(){return this.type==q?this.Df:"["+this.type+"] "+this.Df};Vb.prototype.reset=function(){for(var a=0;a<this.Qb.length;a++){var b=this.vd.id;b&&Ub(this.yd,b);Ub(this.vd,this.Qb[a])}this.Qb.length=0;this.Jd.clear();this.cf=ya();this.he=this.gf=this.hf=this.jf=this.kf=0;b=this.hc.Tb();for(a=0;a<b.length;a++){var c=this.hc.get(b[a]);c.count=0;c.time=0;c.Rd=0;Ub(this.df,c)}this.hc.clear()};
Vb.prototype.toString=function(){for(var a=[],b=-1,c=[],d=0;d<this.Qb.length;d++){var f=this.Qb[d];1==f.wd&&c.pop();a.push(" ",Yb(f,this.cf,b,c.join("")));b=f.pe;a.push("\n");0==f.wd&&c.push("| ")}if(0!=this.Jd.$()){var e=ya();a.push(" Unstopped timers:\n");Ib(this.Jd,function(b){a.push(" ",b," (",e-b.startTime," ms, started at ",$b(b.startTime),")\n")})}b=this.hc.Tb();for(d=0;d<b.length;d++)c=this.hc.get(b[d]),1<c.count&&a.push(" TOTAL ",c,"\n");a.push("Total tracers created ",this.gf,"\n","Total comments created ",
this.he,"\n","Overhead start: ",this.kf," ms\n","Overhead end: ",this.jf," ms\n","Overhead comment: ",this.hf," ms\n");return a.join("")};function Zb(a){var a=Math.round(a),b="";1E3>a&&(b=" ");100>a&&(b=" ");10>a&&(b=" ");return b+a}function $b(a){a=Math.round(a);return(""+(100+a/1E3%60)).substring(1,3)+"."+(""+(1E3+a%1E3)).substring(1,4)}new Vb;function ac(){}var bc=0;w=ac.prototype;w.key=0;w.pb=r;w.nd=r;w.ra=function(a,b,c,d,f,e){ma(a)?this.Ce=o:a&&a.handleEvent&&ma(a.handleEvent)?this.Ce=r:g(Error("Invalid listener argument"));this.Yb=a;this.We=b;this.src=c;this.type=d;this.capture=!!f;this.xd=e;this.nd=r;this.key=++bc;this.pb=r};w.handleEvent=function(a){return this.Ce?this.Yb.call(this.xd||this.src,a):this.Yb.handleEvent.call(this.Yb,a)};!E||hb(9);var cc=!E||hb(9),dc=E&&!fb("8");!F||fb("528");Sa&&fb("1.9b")||E&&fb("8")||Ra&&fb("9.5")||F&&fb("528");!Sa||fb("8");function ec(a,b){this.type=a;this.currentTarget=this.target=b}C(ec,Qb);w=ec.prototype;w.t=function(){delete this.type;delete this.target;delete this.currentTarget};w.$a=r;w.dc=o;w.stopPropagation=function(){this.$a=o};w.preventDefault=function(){this.dc=r};function fc(a){fc[" "](a);return a}fc[" "]=ga;function hc(a,b){a&&this.ra(a,b)}C(hc,ec);w=hc.prototype;w.target=q;w.relatedTarget=q;w.offsetX=0;w.offsetY=0;w.clientX=0;w.clientY=0;w.screenX=0;w.screenY=0;w.button=0;w.keyCode=0;w.charCode=0;w.ctrlKey=r;w.altKey=r;w.shiftKey=r;w.metaKey=r;w.ha=q;
w.ra=function(a,b){var c=this.type=a.type;ec.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var d=a.relatedTarget;if(d){if(Sa){var f;a:{try{fc(d.nodeName);f=o;break a}catch(e){}f=r}f||(d=q)}}else"mouseover"==c?d=a.fromElement:"mouseout"==c&&(d=a.toElement);this.relatedTarget=d;this.offsetX=F||a.offsetX!==n?a.offsetX:a.layerX;this.offsetY=F||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.state=a.state;this.ha=a;delete this.dc;delete this.$a};w.stopPropagation=function(){hc.C.stopPropagation.call(this);this.ha.stopPropagation?this.ha.stopPropagation():this.ha.cancelBubble=o};
w.preventDefault=function(){hc.C.preventDefault.call(this);var a=this.ha;if(a.preventDefault)a.preventDefault();else if(a.returnValue=r,dc)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.Of=t("ha");w.t=function(){hc.C.t.call(this);this.relatedTarget=this.currentTarget=this.target=this.ha=q};var ic={},jc={},kc={},lc={};
function G(a,b,c,d,f){if(b){if(ja(b)){for(var e=0;e<b.length;e++)G(a,b[e],c,d,f);return q}var d=!!d,h=jc;b in h||(h[b]={g:0,U:0});h=h[b];d in h||(h[d]={g:0,U:0},h.g++);var h=h[d],i=pa(a),j;h.U++;if(h[i]){j=h[i];for(e=0;e<j.length;e++)if(h=j[e],h.Yb==c&&h.xd==f){if(h.pb)break;return j[e].key}}else j=h[i]=[],h.g++;e=mc();e.src=a;h=new ac;h.ra(c,e,a,b,d,f);c=h.key;e.key=c;j.push(h);ic[c]=h;kc[i]||(kc[i]=[]);kc[i].push(h);a.addEventListener?(a==da||!a.le)&&a.addEventListener(b,e,d):a.attachEvent(b in
lc?lc[b]:lc[b]="on"+b,e);return c}g(Error("Invalid event type"))}function mc(){var a=nc,b=cc?function(c){return a.call(b.src,b.key,c)}:function(c){c=a.call(b.src,b.key,c);if(!c)return c};return b}function oc(a,b,c,d,f){if(ja(b))for(var e=0;e<b.length;e++)oc(a,b[e],c,d,f);else a=G(a,b,c,d,f),ic[a].nd=o}
function pc(a,b,c,d,f){if(ja(b))for(var e=0;e<b.length;e++)pc(a,b[e],c,d,f);else{d=!!d;a:{e=jc;if(b in e&&(e=e[b],d in e&&(e=e[d],a=pa(a),e[a]))){a=e[a];break a}a=q}if(a)for(e=0;e<a.length;e++)if(a[e].Yb==c&&a[e].capture==d&&a[e].xd==f){qc(a[e].key);break}}}
function qc(a){if(!ic[a])return r;var b=ic[a];if(b.pb)return r;var c=b.src,d=b.type,f=b.We,e=b.capture;c.removeEventListener?(c==da||!c.le)&&c.removeEventListener(d,f,e):c.detachEvent&&c.detachEvent(d in lc?lc[d]:lc[d]="on"+d,f);c=pa(c);f=jc[d][e][c];if(kc[c]){var h=kc[c];ub(h,b);0==h.length&&delete kc[c]}b.pb=o;f.Le=o;rc(d,e,c,f);delete ic[a];return o}
function rc(a,b,c,d){if(!d.Fc&&d.Le){for(var f=0,e=0;f<d.length;f++)d[f].pb?d[f].We.src=q:(f!=e&&(d[e]=d[f]),e++);d.length=e;d.Le=r;0==e&&(delete jc[a][b][c],jc[a][b].g--,0==jc[a][b].g&&(delete jc[a][b],jc[a].g--),0==jc[a].g&&delete jc[a])}}function sc(a){var b,c=0,d=b==q;b=!!b;if(a==q)jb(kc,function(a){for(var f=a.length-1;0<=f;f--){var e=a[f];if(d||b==e.capture)qc(e.key),c++}});else if(a=pa(a),kc[a])for(var a=kc[a],f=a.length-1;0<=f;f--){var e=a[f];if(d||b==e.capture)qc(e.key),c++}}
function tc(a){var b=uc,a=pa(a),c=kc[a];if(c){var d=ia(b),f=ia(n);return d&&f?(c=jc[b],!!c&&!!c[n]&&a in c[n]):!d&&!f?o:sb(c,function(a){return d&&a.type==b||f&&a.capture==n})}return r}function vc(a,b,c,d,f){var e=1,b=pa(b);if(a[b]){a.U--;a=a[b];a.Fc?a.Fc++:a.Fc=1;try{for(var h=a.length,i=0;i<h;i++){var j=a[i];j&&!j.pb&&(e&=wc(j,f)!==r)}}finally{a.Fc--,rc(c,d,b,a)}}return Boolean(e)}function wc(a,b){var c=a.handleEvent(b);a.nd&&qc(a.key);return c}
function nc(a,b){if(!ic[a])return o;var c=ic[a],d=c.type,f=jc;if(!(d in f))return o;var f=f[d],e,h;if(!cc){var i;if(!(i=b))a:{i=["window","event"];for(var j=da;e=i.shift();)if(x(j[e]))j=j[e];else{i=q;break a}i=j}e=i;i=o in f;j=r in f;if(i){if(0>e.keyCode||e.returnValue!=n)return o;a:{var p=r;if(0==e.keyCode)try{e.keyCode=-1;break a}catch(k){p=o}if(p||e.returnValue==n)e.returnValue=o}}p=new hc;p.ra(e,this);e=o;try{if(i){for(var m=[],l=p.currentTarget;l;l=l.parentNode)m.push(l);h=f[o];h.U=h.g;for(var s=
m.length-1;!p.$a&&0<=s&&h.U;s--)p.currentTarget=m[s],e&=vc(h,m[s],d,o,p);if(j){h=f[r];h.U=h.g;for(s=0;!p.$a&&s<m.length&&h.U;s++)p.currentTarget=m[s],e&=vc(h,m[s],d,r,p)}}else e=wc(c,p)}finally{m&&(m.length=0),p.Z()}return e}d=new hc(b,this);try{e=wc(c,d)}finally{d.Z()}return e}var xc=0;function yc(a){return a+"_"+xc++};function H(a){ec.call(this,a);this._className="event"}C(H,ec);var zc=yc("pan"),Ac=yc("rotate"),Bc=yc("zoom"),Cc=yc("render"),Dc=yc("resetview"),uc=yc("modified"),Ec=yc("progress"),Gc=yc("hover"),Hc=yc("hover_end");function Ic(){H.call(this,zc);this.cb=new Jc(0,0)}C(Ic,H);function Kc(){H.call(this,Ac);this.cb=new Jc(0,0)}C(Kc,H);function Lc(){H.call(this,Bc);this.xa=this.Ra=r}C(Lc,H);function Mc(){H.call(this,Cc)}C(Mc,H);function Nc(){H.call(this,Gc);this.uc=this.tc=0}C(Nc,H);
function Oc(){H.call(this,Hc)}C(Oc,H);function Pc(){H.call(this,Dc)}C(Pc,H);function Qc(){H.call(this,uc);this.Ga=new I}C(Qc,H);function Rc(){H.call(this,Ec);this.de=0}C(Rc,H);function Sc(a,b,c){this.x=ia(a)?a:0;this.y=ia(b)?b:0;this.b=ia(c)?c:0}Sc.prototype.d=function(){return new Sc(this.x,this.y,this.b)};Sc.prototype.toString=function(){return"("+this.x+", "+this.y+", "+this.b+")"};Sc.prototype.ff=function(){return[this.x,this.y,this.b]};function M(a,b,c){this.x=a;this.y=b;this.b=c}C(M,Sc);w=M.prototype;w.d=function(){return new M(this.x,this.y,this.b)};w.Ya=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.b*this.b)};w.scale=function(a){this.x*=a;this.y*=a;this.b*=a;return this};w.B=function(){this.x=-this.x;this.y=-this.y;this.b=-this.b;return this};w.normalize=function(){return this.scale(1/this.Ya())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.b+=a.b;return this};
w.ka=function(a){this.x-=a.x;this.y-=a.y;this.b-=a.b;return this};w.Pb=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y&&this.b==a.b};function Tc(a,b){var c=a.x-b.x,d=a.y-b.y,f=a.b-b.b;return Math.sqrt(c*c+d*d+f*f)}function Uc(a,b){return new M(a.x+b.x,a.y+b.y,a.b+b.b)}function Vc(a,b){return new M(a.y*b.b-a.b*b.y,a.b*b.x-a.x*b.b,a.x*b.y-a.y*b.x)};function Wc(){}C(Wc,Qb);w=Wc.prototype;w.le=o;w.Hc=q;w.Md=ca("Hc");w.addEventListener=function(a,b,c,d){G(this,a,b,c,d)};w.removeEventListener=function(a,b,c,d){pc(this,a,b,c,d)};
w.dispatchEvent=function(a){var b=a.type||a,c=jc;if(b in c){if(y(a))a=new ec(a,this);else if(a instanceof ec)a.target=a.target||this;else{var d=a,a=new ec(b,this);nb(a,d)}var d=1,f,c=c[b],b=o in c,e;if(b){f=[];for(e=this;e;e=e.Hc)f.push(e);e=c[o];e.U=e.g;for(var h=f.length-1;!a.$a&&0<=h&&e.U;h--)a.currentTarget=f[h],d&=vc(e,f[h],a.type,o,a)&&a.dc!=r}if(r in c)if(e=c[r],e.U=e.g,b)for(h=0;!a.$a&&h<f.length&&e.U;h++)a.currentTarget=f[h],d&=vc(e,f[h],a.type,r,a)&&a.dc!=r;else for(f=this;!a.$a&&f&&e.U;f=
f.Hc)a.currentTarget=f,d&=vc(e,f,a.type,r,a)&&a.dc!=r;a=Boolean(d)}else a=o;return a};w.t=function(){Wc.C.t.call(this);sc(this);this.Hc=q};function Q(){this._className="base";this.c=r}C(Q,Wc);Q.prototype.className=t("_className");Q.prototype.print=function(){var a=Object.keys(this),b="",c="<unknown>",d=0;for(d in a){var f="this."+a[d],e=eval(f);"this._className"==f?c=e:b+=f+": "+e+"\n"}return"== X."+c+" ==\n"+b};Q.prototype.If=t("c");function Xc(a){a.c=r}A("X.base",Q);A("X.base.prototype.className",Q.prototype.className);A("X.base.prototype.print",Q.prototype.print);A("X.base.prototype.dirty",Q.prototype.If);function R(a){Q.call(this);this._className="triplets";this.Ca=this.Fa=this.Ba=this.Ea=this.Aa=this.Da=q;this.jc=[0,0,0];this.T=[];x(a)&&a instanceof R&&(this.T=a.all().slice(),this.Da=a.Da,this.Aa=a.Aa,this.Ea=a.Ea,this.Ba=a.Ba,this.Fa=a.Fa,this.Ca=a.Ca,this.jc=a.jc.slice())}C(R,Q);w=R.prototype;
w.add=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("Invalid triplet."));if(!this.Da||a<this.Da)this.Da=a;if(!this.Aa||a>this.Aa)this.Aa=a;if(!this.Ea||b<this.Ea)this.Ea=b;if(!this.Ba||b>this.Ba)this.Ba=b;if(!this.Fa||c<this.Fa)this.Fa=c;if(!this.Ca||c>this.Ca)this.Ca=c;this.jc=[(this.Da+this.Aa)/2,(this.Ea+this.Ba)/2,(this.Fa+this.Ca)/2];this.c=o;return this.T.push(a,b,c)/3};w.get=function(a){(!z(a)||3*a>this.T.length)&&g(Error("Invalid id."));a*=3;return[this.T[a],this.T[a+1],this.T[a+2]]};
w.remove=function(a){(!z(a)||3*a>this.T.length)&&g(Error("Invalid id."));this.T.splice(a,3);this.c=o};w.all=t("T");w.clear=function(){this.T=[];this.c=o};w.count=function(){return this.T.length/3};w.length=function(){return this.T.length};A("X.triplets",R);A("X.triplets.prototype.add",R.prototype.add);A("X.triplets.prototype.get",R.prototype.get);A("X.triplets.prototype.remove",R.prototype.remove);A("X.triplets.prototype.all",R.prototype.all);A("X.triplets.prototype.clear",R.prototype.clear);
A("X.triplets.prototype.count",R.prototype.count);A("X.triplets.prototype.length",R.prototype.length);function Yc(){Q.call(this);this._className="parser"}C(Yc,Q);w=Yc.prototype;w.parse=function(){g(Error("The function parse() should be overloaded."))};w.bc=function(a,b){var c=this.s(a,b+2),d=this.s(a,b+3),f=(d<<1&255|c>>7)-127,c=(c&127)<<16|this.s(a,b+1)<<8|this.s(a,b);return 0==c&&-127==f?0:(1-2*(d>>7))*(1+c*Math.pow(2,-23))*Math.pow(2,f)};
function Zc(a,b,c){var d=a.s(b,c),f=a.s(b,c+1),e=(d<<1&255|f>>7)-127,a=(f&127)<<16|a.s(b,c+2)<<8|a.s(b,c+3);return 0==a&&-127==e?0:(1-2*(d>>7))*(1+a*Math.pow(2,-23))*Math.pow(2,e)}function $c(a,b,c,d){var f=[],e=0,h=Infinity,i;for(i=0;i<d;i++){var j=a.bc(b,c+4*i);f[i]=j;e=Math.max(e,j);h=Math.min(h,j)}return[f,e,h]}function ad(a,b,c){return(a.s(b,c+3)<<24)+(a.s(b,c+2)<<16)+(a.s(b,c+1)<<8)+a.s(b,c)}function bd(a,b,c){return(a.s(b,c)<<24)+(a.s(b,c+1)<<16)+(a.s(b,c+2)<<8)+a.s(b,c+3)}
w.Kc=function(a,b){return(this.s(a,b+1)<<8)+this.s(a,b)};w.ug=function(a,b){var c=this.s(a,b);return 127<c?c-256:c};w.s=function(a,b){return a.charCodeAt(b)&255};function cd(){Yc.call(this);this._className="parserTRK"}C(cd,Yc);
cd.prototype.parse=function(a,b){var c=a.k,d=a.o,f=a.W,e=0,h=e+6,i=0,j=Infinity,p;for(p=0;3>p;p++)var k=this.Kc(b,h+2*p),i=Math.max(i,k),j=Math.min(j,k);var m=$c(this,b,e+12,3)[0];$c(this,b,e+24,3);var l=this.Kc(b,e+36),s=this.Kc(b,e+238);$c(this,b,e+440,16);$c(this,b,e+956,6);for(var h=ad(this,b,e+988),e=ad(this,b,e+996),i=[],v=q,u=q,B=q,D=q,L=k=q,j=0;j<h;j++){var K=ad(this,b,e),J=new R,e=e+4;for(p=0;p<K;p++){var ea=this.bc(b,e),e=e+4,aa=this.bc(b,e),e=e+4,fa=this.bc(b,e),e=e+4;0<l&&($c(this,b,e,
l),e+=4*l);ea/=m[0];aa/=m[1];fa/=m[2];J.add(ea,aa,fa)}0<s&&(e+=4*s);p=J.Da;var K=J.Aa,ea=J.Ea,aa=J.Ba,fa=J.Fa,ib=J.Ca;if(!v||p<v)v=p;if(!u||K>u)u=K;if(!B||ea<B)B=ea;if(!D||aa>D)D=aa;if(!k||fa<k)k=fa;if(!L||ib>L)L=ib;i.push(J)}e=(v+u)/2;B=(B+D)/2;k=(k+L)/2;for(j=0;j<h;j++){L=i[j];D=L.count();for(p=0;p<D-1;p++)l=L.get(p),m=L.get(p+1),c.add(l[0],l[1],l[2]),c.add(m[0],m[1],m[2]),s=l[0]-e,v=l[1]-B,u=l[2]-k,J=Math.sqrt(s*s+v*v+u*u),K=m[0]-e,ea=m[1]-B,aa=m[2]-k,fa=Math.sqrt(K*K+ea*ea+aa*aa),d.add(s/J,v/
J,u/J),d.add(K/fa,ea/fa,aa/fa),m=[Math.abs(m[0]-l[0]),Math.abs(m[1]-l[1]),Math.abs(m[2]-l[2])],l=Math.sqrt(m[0]*m[0]+m[1]*m[1]+m[2]*m[2]),m[0]/=l,m[1]/=l,m[2]/=l,f.add(m[0],m[1],m[2]),f.add(m[0],m[1],m[2])}a.rb(dd);c=new Qc;c.Ga=a;this.dispatchEvent(c)};A("X.parserTRK",cd);A("X.parserTRK.prototype.parse",cd.prototype.parse);function ed(){Yc.call(this);this._className="parserSTL"}C(ed,Yc);ed.prototype.parse=function(a,b){for(var c=b.split("\n"),d=c.length,f=a.k,e=a.o,h=0,i=d%8;i--;)this.z(f,e,c[h]),h++;for(i=0.125*d^0;i--;)this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++,this.z(f,e,c[h]),h++;c=new Qc;c.Ga=a;this.dispatchEvent(c)};
ed.prototype.z=function(a,b,c){var c=c.replace(/^\s+|\s+$/g,""),d=c.split(" ");if("vertex"==d[0]){var c=parseFloat(d[1]),f=parseFloat(d[2]),d=parseFloat(d[3]);a.add(c,f,d)}else"facet"==d[0]&&(c=parseFloat(d[2]),f=parseFloat(d[3]),d=parseFloat(d[4]),b.add(c,f,d),b.add(c,f,d),b.add(c,f,d))};A("X.parserSTL",ed);A("X.parserSTL.prototype.parse",ed.prototype.parse);function S(a,b,c){this.Q=this.P=this.O=0;3==arguments.length?(this.O=Number(a),this.P=Number(b),this.Q=Number(c)):"x"in a&&"y"in a&&"z"in a?(this.O=Number(a.x()),this.P=Number(a.y()),this.Q=Number(a.b())):(this.O=Number(a[0]),this.P=Number(a[1]),this.Q=Number(a[2]))}
S.prototype={d:function(){return new S(this.O,this.P,this.Q)},Gc:function(){return new S(-this.O,-this.P,-this.Q)},Za:function(a){return new S(this.O+a.x(),this.P+a.y(),this.Q+a.b())},mb:function(a){return new S(this.O-a.x(),this.P-a.y(),this.Q-a.b())},va:function(a){return new S(this.O*a,this.P*a,this.Q*a)},oe:function(a){return new S(this.O/a,this.P/a,this.Q/a)},Va:function(a){return this.O*a.x()+this.P*a.y()+this.Q*a.b()},Dd:function(a,b){return this.Za(a.mb(this).va(b))},length:function(){return Math.sqrt(this.Va(this))},
tb:function(){return this.oe(this.length())},wc:function(a){return new S(this.P*a.b()-this.Q*a.y(),this.Q*a.x()-this.O*a.b(),this.O*a.y()-this.P*a.x())},x:t("O"),y:t("P"),b:t("Q")};A("csgVector",S);A("csgVector.prototype.clone",S.prototype.d);A("csgVector.prototype.plus",S.prototype.Za);A("csgVector.prototype.minus",S.prototype.mb);A("csgVector.prototype.dividedBy",S.prototype.oe);A("csgVector.prototype.times",S.prototype.va);A("csgVector.prototype.dot",S.prototype.Va);
A("csgVector.prototype.lerp",S.prototype.Dd);A("csgVector.prototype.length",S.prototype.length);A("csgVector.prototype.unit",S.prototype.tb);A("csgVector.prototype.cross",S.prototype.wc);A("csgVector.prototype.negated",S.prototype.Gc);A("csgVector.prototype.x",S.prototype.x);A("csgVector.prototype.y",S.prototype.y);A("csgVector.prototype.z",S.prototype.b);function fd(){this.Mc=n}
function gd(a,b,c){switch(typeof b){case "string":hd(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==q){c.push("null");break}if(ja(b)){var d=b.length;c.push("[");for(var f="",e=0;e<d;e++)c.push(f),f=b[e],gd(a,a.Mc?a.Mc.call(b,""+e,f):f,c),f=",";c.push("]");break}c.push("{");d="";for(e in b)Object.prototype.hasOwnProperty.call(b,e)&&(f=b[e],"function"!=typeof f&&(c.push(d),hd(e,c),c.push(":"),
gd(a,a.Mc?a.Mc.call(b,e,f):f,c),d=","));c.push("}");break;case "function":break;default:g(Error("Unknown type: "+typeof b))}}var id={'"':'\\"',"\\":"\\\\","/":"\\/","\u0008":"\\b","\u000c":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},jd=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function hd(a,b){b.push('"',a.replace(jd,function(a){if(a in id)return id[a];var b=a.charCodeAt(0),f="\\u";16>b?f+="000":256>b?f+="00":4096>b&&(f+="0");return id[a]=f+b.toString(16)}),'"')};function kd(){Q.call(this);this._className="indexer";this.ld=[];this.ad={}}C(kd,Q);kd.prototype.add=function(a){x(a)||g(Error("Invalid object."));var b;b=[];gd(new fd,a,b);b=b.join("");b in this.ad||(this.ad[b]=this.ld.length,this.ld.push(a));return this.ad[b]};kd.prototype.unique=t("ld");function T(a,b){this.J=new S(a);this.w=new S(b)}T.prototype={d:function(){return new T(this.J.d(),this.w.d())},qa:function(){this.w=this.w.Gc()},Ae:function(a,b){return new T(this.J.Dd(a.J,b),this.w.Dd(a.w,b))},xg:t("J"),Gd:t("w")};A("csgVertex",T);A("csgVertex.prototype.clone",T.prototype.d);A("csgVertex.prototype.flip",T.prototype.qa);A("csgVertex.prototype.interpolate",T.prototype.Ae);A("csgVertex.prototype.pos",T.prototype.xg);A("csgVertex.prototype.normal",T.prototype.Gd);function ld(a,b){this.w=a;this.ub=b}ld.prototype={d:function(){return new ld(this.w.d(),this.ub)},qa:function(){this.w=this.w.Gc();this.ub=-this.ub},dh:t("ub"),Gd:t("w")};A("csgPlane.prototype.w",ld.prototype.dh);A("csgPlane.prototype.normal",ld.prototype.Gd);function md(a,b){this.la=a;this.fc=b;var c=a[0].J,d=a[2].J,d=a[1].J.mb(c).wc(d.mb(c)).tb();this.M=new ld(d,d.Va(c))}
md.prototype={d:function(){var a=this.la.map(function(a){return a.d()});return new md(a,this.fc)},qa:function(){this.la.reverse().map(function(a){a.qa()});this.M.qa()},bh:t("la"),Pg:t("fc"),bf:function(a,b,c,d,f){for(var e=0,h=[],i=0;i<this.la.length;i++){var j=a.w.Va(this.la[i].J)-a.ub,j=-1.0E-5>j?2:1.0E-5<j?1:0,e=e|j;h.push(j)}switch(e){case 0:(0<a.w.Va(this.M.w)?b:c).push(this);break;case 1:d.push(this);break;case 2:f.push(this);break;case 3:b=[];c=[];for(i=0;i<this.la.length;i++){var p=(i+1)%
this.la.length,j=h[i],k=h[p],e=this.la[i],p=this.la[p];2!=j&&b.push(e);1!=j&&c.push(2!=j?e.d():e);3==(j|k)&&(j=(a.ub-a.w.Va(e.J))/a.w.Va(p.J.mb(e.J)),j=e.Ae(p,j),b.push(j),c.push(j.d()))}3<=b.length&&d.push(new md(b,this.fc));3<=c.length&&f.push(new md(c,this.fc))}}};A("csgPolygon",md);A("csgPolygon.prototype.clone",md.prototype.d);A("csgPolygon.prototype.flip",md.prototype.qa);A("csgPolygon.prototype.vertices",md.prototype.bh);A("csgPolygon.prototype.shared",md.prototype.Pg);function nd(a){this.D=this.F=this.M=q;this.i=[];a&&this.ib(a)}
nd.prototype={d:function(){var a=new nd;a.Kg(this.M&&this.M.d());a.Hg(this.F&&this.F.d());a.Dg(this.D&&this.D.d());a.ec(this.i.map(function(a){return a.d()}));return a},B:function(){for(var a=0;a<this.i.length;a++)this.i[a].qa();this.M.qa();this.F&&this.F.B();this.D&&this.D.B();a=this.F;this.F=this.D;this.D=a},pd:function(a){if(!this.M)return a.slice();for(var b=[],c=[],d=0;d<a.length;d++)a[d].bf(this.M,b,c,b,c);this.F&&(b=this.F.pd(b));c=this.D?this.D.pd(c):[];return b.concat(c)},Y:function(a){this.i=
a.pd(this.i);this.F&&this.F.Y(a);this.D&&this.D.Y(a)},La:function(){var a=this.i.slice();this.F&&(a=a.concat(this.F.La()));this.D&&(a=a.concat(this.D.La()));return a},ib:function(a){if(a.length){this.M||(this.M=a[0].M.d());for(var b=[],c=[],d=0;d<a.length;d++)a[d].bf(this.M,this.i,this.i,b,c);b.length&&(this.F||(this.F=new nd),this.F.ib(b));c.length&&(this.D||(this.D=new nd),this.D.ib(c))}},Kg:ca("M"),Hg:ca("F"),Dg:ca("D"),Ve:t("i"),ec:ca("i")};function U(){this.i=[]}function od(a){var b=new U;b.ec(a);return b}
U.prototype={d:function(){var a=new U;a.ec(this.i.map(function(a){return a.d()}));return a},Vg:t("i"),Rc:function(a){var b=new nd(this.d().i),a=new nd(a.d().i);b.Y(a);a.Y(b);a.B();a.Y(b);a.B();b.ib(a.La());return od(b.La())},ka:function(a){var b=new nd(this.d().i),a=new nd(a.d().i);b.B();b.Y(a);a.Y(b);a.B();a.Y(b);a.B();b.ib(a.La());b.B();return od(b.La())},Dc:function(a){var b=new nd(this.d().i),a=new nd(a.d().i);b.B();a.Y(b);a.B();b.Y(a);a.Y(b);b.ib(a.La());b.B();return od(b.La())},inverse:function(){var a=
this.d();a.i.map(function(a){a.qa()});return a},Ve:t("i"),ec:ca("i")};A("CSG",U);A("CSG.fromPolygons",od);A("CSG.prototype.toPolygons",U.prototype.Vg);A("CSG.prototype.union",U.prototype.Rc);A("CSG.prototype.subtract",U.prototype.ka);A("CSG.prototype.intersect",U.prototype.Dc);A("CSG.prototype.inverse",U.prototype.inverse);A("CSG.prototype.polygons",U.prototype.Ve);A("CSG.prototype.setPolygons",U.prototype.ec);function V(a,b){this.x=ia(a)?a:0;this.y=ia(b)?b:0}V.prototype.d=function(){return new V(this.x,this.y)};V.prototype.toString=function(){return"("+this.x+", "+this.y+")"};function pd(a,b){return new V(a.x-b.x,a.y-b.y)};function Jc(a,b){this.x=a;this.y=b}C(Jc,V);w=Jc.prototype;w.d=function(){return new Jc(this.x,this.y)};w.Ya=function(){return Math.sqrt(this.x*this.x+this.y*this.y)};w.scale=function(a){this.x*=a;this.y*=a;return this};w.B=function(){this.x=-this.x;this.y=-this.y;return this};w.normalize=function(){return this.scale(1/this.Ya())};w.add=function(a){this.x+=a.x;this.y+=a.y;return this};w.ka=function(a){this.x-=a.x;this.y-=a.y;return this};
w.rotate=function(a){var b=Math.cos(a),a=Math.sin(a),c=this.y*b+this.x*a;this.x=this.x*b-this.y*a;this.y=c;return this};w.Pb=function(a){return this==a||!!a&&this.x==a.x&&this.y==a.y};function qd(a,b){this.width=a;this.height=b}function rd(a,b){return a==b?o:!a||!b?r:a.width==b.width&&a.height==b.height}w=qd.prototype;w.d=function(){return new qd(this.width,this.height)};w.toString=function(){return"("+this.width+" x "+this.height+")"};w.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
w.scale=function(a){this.width*=a;this.height*=a;return this};function sd(a,b){if(a instanceof sd)this.v=a.ff();else{var c;if(c=ka(a))a:{for(var d=c=0;d<a.length;d++){if(!ka(a[d])||0<c&&a[d].length!=c){c=r;break a}for(var f=0;f<a[d].length;f++)if(!z(a[d][f])){c=r;break a}0==c&&(c=a[d].length)}c=0!=c}c?this.v=wb(a):a instanceof qd?this.v=td(a.height,a.width):z(a)&&z(b)&&0<a&&0<b?this.v=td(a,b):g(Error("Invalid argument(s) for Matrix contructor"))}this.q=new qd(this.v[0].length,this.v.length)}
function ud(a){for(var b=[],c=0;c<a;c++){b[c]=[];for(var d=0;d<a;d++)b[c][d]=c==d?1:0}return new sd(b)}function vd(a,b,c){for(var d=0;d<a.K().height;d++)for(var f=0;f<a.K().width;f++)b.call(c,a.v[d][f],d,f,a)}function wd(a,b){var c=new sd(a.K());vd(a,function(d,f,e){c.v[f][e]=b.call(n,d,f,e,a)});return c}function td(a,b){for(var c=[],d=0;d<a;d++){c[d]=[];for(var f=0;f<b;f++)c[d][f]=0}return c}w=sd.prototype;
w.add=function(a){rd(this.q,a.K())||g(Error("Matrix summation is only supported on arrays of equal size"));return wd(this,function(b,c,d){return b+a.v[c][d]})};w.Pb=function(a,b){if(this.q.width!=a.q.width||this.q.height!=a.q.height)return r;for(var c=b||0,d=0;d<this.q.height;d++)for(var f=0;f<this.q.width;f++)if(!(Math.abs(this.v[d][f]-a.v[d][f])<=(c||1.0E-6)))return r;return o};w.K=t("q");function xd(a,b,c){return!(0<=b&&b<a.q.height&&0<=c&&c<a.q.width)?q:a.v[b][c]}
function W(a,b,c,d){0<=b&&b<a.q.height&&0<=c&&c<a.q.width||g(Error("Index out of bounds when setting matrix value, ("+b+","+c+") in size ("+a.q.height+","+a.q.width+")"));a.v[b][c]=d}w.multiply=function(a){if(a instanceof sd)return this.q.width!=a.K().height&&g(Error("Invalid matrices for multiplication. Second matrix should have the same number of rows as the first has columns.")),yd(this,a);if(z(a))return zd(this,a);g(Error("A matrix can only be multiplied by a number or another matrix."))};
w.ka=function(a){rd(this.q,a.K())||g(Error("Matrix subtraction is only supported on arrays of equal size."));return wd(this,function(b,c,d){return b-a.v[c][d]})};w.ff=t("v");w.toString=function(){var a=0;vd(this,function(b){b=(""+b).length;b>a&&(a=b)});var b=[];qb(this.v,function(c){b.push("[ ");qb(c,function(c){c=""+c;b.push(Array(a-c.length+1).join(" ")+c+" ")});b.push("]\n")});return b.join("")};
function yd(a,b){var c=new sd(a.q.height,b.K().width);vd(c,function(a,f,e){for(var h=a=0;h<this.q.width;h++)a+=xd(this,f,h)*xd(b,h,e);W(c,f,e,a)},a);return c}function zd(a,b){return wd(a,function(a){return a*b})};function Z(a,b){sd.call(this,a,b);this._className="matrix"}C(Z,sd);function Ad(a){for(var b=[],c=0;c<a;c++){b[c]=[];for(var d=0;d<a;d++)b[c][d]=c==d?1:0}return new Z(b)}w=Z.prototype;w.A=function(){var a=[],b=this.K();if(0==b.height||0==b.width)return[];var c,d;for(d=0;d<b.height;d++)for(c=0;c<b.width;c++)a.push(xd(this,c,d));return a};
w.translate=function(a){this.q.width!=this.q.height&&g(Error("Can not translate non-square matrix."));var b=this.K(),c=ud(b.height);a instanceof Jc&&3==b.height?(W(c,0,2,a.x),W(c,1,2,a.y)):a instanceof M&&4==b.height?(W(c,0,3,a.x),W(c,1,3,a.y),W(c,2,3,a.b)):g(Error("Translation failed."));return new Z(this.multiply(c))};
w.rotate=function(a,b){(4!=this.K().height||this.q.width!=this.q.height)&&g(Error("Only 4x4 matrices can be rotated."));(!x(b)||!(b instanceof M))&&g(Error("Invalid axis vector."));z(a)||g(Error("Invalid angle."));var c=b.normalize(),d=Math.cos(a),f=Math.sin(a),e=ud(4);W(e,0,0,d+c.x*c.x*(1-d));W(e,0,1,c.x*c.y*(1-d)-c.b*f);W(e,0,2,c.x*c.b*(1-d)+c.y*f);W(e,1,0,c.y*c.x*(1-d)+c.b*f);W(e,1,1,d+c.y*c.y*(1-d));W(e,1,2,c.y*c.b*(1-d)-c.x*f);W(e,2,0,c.b*c.x*(1-d)-c.y*f);W(e,2,1,c.b*c.y*(1-d)+c.x*f);W(e,2,2,
d+c.b*c.b*(1-d));return new Z(this.multiply(e))};w.ca=function(a){var b=this.K(),c=Array(b.width),d;for(d=0;d<c.length;d++)c[d]=Array(1),c[d][0]=1;a instanceof M&&3<=b.width?(c[0][0]=a.x,c[1][0]=a.y,c[2][0]=a.b):g(Error("Multiplication by vector failed."));a=this.multiply(new sd(c));return new M(parseFloat(xd(a,0,0)),parseFloat(xd(a,1,0)),parseFloat(xd(a,2,0)))};w.Tg=function(a,b){var c=this.v[a];this.v[a]=this.v[b];this.v[b]=c};
w.Sg=function(a,b){for(var c=this.K(),d=0,d=0;d<c.height;d++){var f=xd(this,d,a);f||(f=0);var e=xd(this,d,b);e||(e=0);W(this,d,a,e);W(this,d,b,f)}};A("X.matrix",Z);A("X.matrix.createIdentityMatrix",Ad);A("X.matrix.prototype.flatten",Z.prototype.A);A("X.matrix.prototype.translate",Z.prototype.translate);A("X.matrix.prototype.rotate",Z.prototype.rotate);A("X.matrix.prototype.multiplyByVector",Z.prototype.ca);A("X.matrix.prototype.swapRows",Z.prototype.Tg);A("X.matrix.prototype.swapCols",Z.prototype.Sg);function Bd(){Q.call(this);this._className="transform";this.f=Ad(4);this.na=new Float32Array(this.f.A())}C(Bd,Q);w=Bd.prototype;w.zg=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new M(0,1,0));this.na=new Float32Array(this.f.A());this.c=o};w.Ag=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new M(1,0,0));this.na=new Float32Array(this.f.A());this.c=o};
w.Bg=function(a){(!z(a)||-360>a||360<a)&&g(Error("Invalid angle."));this.f=this.f.rotate(a*Math.PI/180,new M(0,0,1));this.na=new Float32Array(this.f.A());this.c=o};w.Xg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new M(a,0,0));this.na=new Float32Array(this.f.A());this.c=o};w.Yg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new M(0,a,0));this.na=new Float32Array(this.f.A());this.c=o};
w.Zg=function(a){z(a)||g(Error("Invalid distance."));this.f=this.f.translate(new M(0,0,a));this.na=new Float32Array(this.f.A());this.c=o};w.Zf=t("f");w.Ze=function(a){var b=Ad(4);x(a)&&a instanceof Z&&(b=a);this.f=b;this.na=new Float32Array(this.f.A());this.c=o};function Cd(a,b,c){var d=xd(a.f,b,c);d||(d=0);W(a.f,b,c,-1*d);a.na=new Float32Array(a.f.A());a.c=o}w.Lf=function(){Cd(this,0,0)};w.Mf=function(){Cd(this,1,1)};w.Nf=function(){Cd(this,2,2)};A("X.transform",Bd);
A("X.transform.prototype.rotateX",Bd.prototype.zg);A("X.transform.prototype.rotateY",Bd.prototype.Ag);A("X.transform.prototype.rotateZ",Bd.prototype.Bg);A("X.transform.prototype.translateX",Bd.prototype.Xg);A("X.transform.prototype.translateY",Bd.prototype.Yg);A("X.transform.prototype.translateZ",Bd.prototype.Zg);A("X.transform.prototype.matrix",Bd.prototype.Zf);A("X.transform.prototype.setMatrix",Bd.prototype.Ze);A("X.transform.prototype.flipX",Bd.prototype.Lf);A("X.transform.prototype.flipY",Bd.prototype.Mf);
A("X.transform.prototype.flipZ",Bd.prototype.Nf);function Dd(a){Q.call(this);this._className="file";this.tf=a;this.c=o}C(Dd,Q);Dd.prototype.path=t("tf");function Ed(){Q.call(this);this._className="texture";var a=window["X.Counter"];a.ze();this._id=a.value();this.Gb=this.Sd=this.Pa=q;this.oc=this.pc=0;this.c=o}C(Ed,Q);Ed.prototype.id=t("_id");Ed.prototype.file=t("Pa");Ed.prototype.zd=t("Sd");function I(a){Q.call(this);this._className="object";var b=window["X.Counter"];b.ze();this._id=b.value();this._type=Fd;this.rc=new Bd;this._color=[1,1,1];this.k=new R;this.o=new R;this.W=new R;this.Pa=this.Sa=this.S=q;this._opacity=1;this.bb=q;this._visible=o;this._lineWidth=this._pointSize=1;this._caption=q;this._magicMode=r;x(a)&&(this._type=a.type(),this.rc.Ze(new Z(a.transform().f)),this._color=Array(a.color()),this.k=new R(a.k),this.o=new R(a.o),this.W=new R(a.W),this.S=a.S,this.Sa=a.Sa,a.file()&&
(this.Pa=new Dd((new String(a.file().path())).toString())),this._opacity=a.opacity(),this.bb=a.children(),this._visible=a.lf(),this._pointSize=a.Ue(),this._lineWidth=a.lineWidth(),a.caption()&&(this._caption=(new String(a.caption())).toString()),this._magicMode=a.Ge(),this.c=o);this.c=o}C(I,Q);var Fd="TRIANGLES",dd="LINES";w=I.prototype;w.id=t("_id");
function Gd(a){for(var b=a.k.count(),c=[],d=0,d=0;d<b;d+=3){var f=a.k.get(d),e=a.k.get(d+1),h=a.k.get(d+2),i=a.o.get(d),j=a.o.get(d+1),p=a.o.get(d+2),k=a._color;0<a.W.length()&&(k=a.W.get(d));var m=[];m.push(new T(f,i));m.push(new T(e,j));m.push(new T(h,p));c.push(new md(m,k))}return od(c)}
function Hd(a,b){(!x(b)||!(b instanceof U))&&g(Error("Invalid CSG object."));a.k.clear();a.o.clear();a.W.clear();var c=new kd,d=[];rb(b.i,function(a){for(var b=[],h=a.fc,b=rb(a.la,function(a){a.color=h;return c.add(a)}),a=a=2;a<b.length;a++)d.push([b[0],b[a-1],b[a]])}.bind(a));a.qf=rb(c.unique(),function(a){return[a.J.x(),a.J.y(),a.J.b()]});a.pf=rb(c.unique(),function(a){return[a.w.x(),a.w.y(),a.w.b()]});a.of=rb(c.unique(),function(a){return!a.color?q:[a.color[0],a.color[1],a.color[2]]});rb(d,function(a){var b=
a[0],c=a[1],a=a[2],d=this.qf,j=this.pf,p=this.of;this.k.add(d[b][0],d[b][1],d[b][2]);this.k.add(d[c][0],d[c][1],d[c][2]);this.k.add(d[a][0],d[a][1],d[a][2]);this.o.add(j[b][0],j[b][1],j[b][2]);this.o.add(j[c][0],j[c][1],j[c][2]);this.o.add(j[a][0],j[a][1],j[a][2]);p[b]&&this.W.add(p[b][0],p[b][1],p[b][2]);p[c]&&this.W.add(p[c][0],p[c][1],p[c][2]);p[a]&&this.W.add(p[a][0],p[a][1],p[a][2])}.bind(a));a.rb(Fd)}w.type=t("_type");w.rb=ca("_type");w.transform=t("rc");w.vg=t("k");w.bg=t("o");w.Cf=t("W");
w.color=t("_color");w.Ug=t("S");w.Pc=function(a){if(x(a)){if(y(a)){var b=a,c=a=new Ed;x(b)?(y(b)&&(b=new Dd(b)),c.Pa=b):c.Pa=q}a instanceof Ed||g(Error("Invalid texture."));this.S=a}else this.S=q};w.Ye=function(a,b,c){(!z(a)&&0>a&&1<a||!z(b)&&0>b&&1<b||!z(c)&&0>c&&1<c)&&g(Error("Invalid color."));if(this.Wb())for(var d=this.children(),f=d.length,e=0,e=0;e<f;e++)d[e].Ye(a,b,c);this._color[0]=a;this._color[1]=b;this._color[2]=c;this.c=o};
w.Rc=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Gd(b));a=new I;Hd(a,Gd(this).Rc(b));return a};w.ka=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Gd(b));a=new I;Hd(a,Gd(this).ka(b));return a};w.Dc=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Gd(b));a=new I;Hd(a,Gd(this).Dc(b));return a};
w.inverse=function(a){(!x(a)||!(a instanceof U)&&!(a instanceof I))&&g(Error("Invalid object."));var b=a;a instanceof I&&(b=Gd(b));a=new I;Hd(a,Gd(this).inverse(b));return a};w.opacity=t("_opacity");w.caption=t("_caption");w.Eg=function(a){this._caption=a;this.c=o};w.p=function(a){if(this.Wb())for(var b=this.children(),c=b.length,d=0,d=0;d<c;d++)b[d].p(a);this._visible=a;this.c=o};w.lf=t("_visible");
w.$e=function(a){(!z(a)||1<a||0>a)&&g(Error("Invalid opacity."));if(this.Wb())for(var b=this.children(),c=b.length,d=0,d=0;d<c;d++)b[d].$e(a);this._opacity=a;this.c=o};w.load=function(a){this.Pa=x(a)?new Dd(a):q};w.file=t("Pa");w.$b=function(){var a=new Qc;a.Ga=this;this.dispatchEvent(a)};w.children=function(){this.bb||(this.bb=[]);return this.bb};w.Wb=function(){return!this.bb?r:0<this.bb.length};w.Ig=function(a){z(a)||g(Error("Invalid line width."));this._lineWidth=a;this.c=o};w.lineWidth=t("_lineWidth");
w.Lg=function(a){z(a)||g(Error("Invalid point size."));this._pointSize=a;this.c=o};w.Ue=t("_pointSize");w.Ge=t("_magicMode");w.Jg=function(a){"boolean"!=typeof a&&g(Error("Invalid magicMode setting."));this._magicMode=a};function Id(a,b){(!x(a)||!x(b)||!(a instanceof I)||!(b instanceof I))&&g(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.opacity()?-1:1==b.opacity()?1:x(a.xc)&&x(b.xc)&&a.xc>b.xc?-1:1}A("X.object",I);A("X.object.prototype.id",I.prototype.id);
A("X.object.prototype.type",I.prototype.type);A("X.object.prototype.transform",I.prototype.transform);A("X.object.prototype.points",I.prototype.vg);A("X.object.prototype.normals",I.prototype.bg);A("X.object.prototype.texture",I.prototype.Ug);A("X.object.prototype.setTexture",I.prototype.Pc);A("X.object.prototype.colors",I.prototype.Cf);A("X.object.prototype.color",I.prototype.color);A("X.object.prototype.setColor",I.prototype.Ye);A("X.object.prototype.opacity",I.prototype.opacity);
A("X.object.prototype.setOpacity",I.prototype.$e);A("X.object.prototype.lineWidth",I.prototype.lineWidth);A("X.object.prototype.setLineWidth",I.prototype.Ig);A("X.object.prototype.pointSize",I.prototype.Ue);A("X.object.prototype.setPointSize",I.prototype.Lg);A("X.object.prototype.load",I.prototype.load);A("X.object.prototype.file",I.prototype.file);A("X.object.prototype.caption",I.prototype.caption);A("X.object.prototype.visible",I.prototype.lf);A("X.object.prototype.setCaption",I.prototype.Eg);
A("X.object.prototype.setVisible",I.prototype.p);A("X.object.prototype.magicMode",I.prototype.Ge);A("X.object.prototype.setMagicMode",I.prototype.Jg);A("X.object.prototype.intersect",I.prototype.Dc);A("X.object.prototype.inverse",I.prototype.inverse);A("X.object.prototype.subtract",I.prototype.ka);A("X.object.prototype.union",I.prototype.Rc);A("X.object.prototype.children",I.prototype.children);function Jd(){Yc.call(this);this._className="parserVTK"}C(Jd,Yc);
Jd.prototype.parse=function(a,b){var c=a.k,d=a.o,f=b.split("\n"),e=f.length,h=new R,i=new R;this.G=[];this.X=Fd;this.ed=this.Ja=this.ya=this.Ka=r;for(var j=0,p=e%8;p--;)this.z(h,i,f[j]),j++;for(p=0.125*e^0;p--;)this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++,this.z(h,i,f[j]),j++;if(this.X==Fd){f=i.length();j=e=this.G.length;do{var p=this.G[e-j],k=p.length,m;for(m=0;m<k;m++){var l=parseInt(p[m],10),s=
h.get(l);c.add(s[0],s[1],s[2]);l<f?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new M(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b))}j--}while(0<j)}else if("TRIANGLE_STRIPS"==this.X){f=i.length();j=e=this.G.length;do{p=this.G[e-j];k=p.length;for(m=0;m<k;m++)l=parseInt(p[m],10),s=h.get(l),c.add(s[0],s[1],s[2]),(0==m||m==k-1)&&c.add(s[0],s[1],s[2]),l<f?(l=i.get(l),d.add(l[0],l[1],l[2]),(0==m||m==k-1)&&d.add(l[0],l[1],l[2])):(l=new M(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b),(0==m||m==k-1)&&d.add(l.x,
l.y,l.b));j--}while(0<j)}else if(this.X==dd){f=i.length();j=e=this.G.length;do{p=this.G[e-j];k=p.length;for(m=0;m<k-1;m++){var v=parseInt(p[m],10),l=parseInt(p[m+1],10),u=h.get(v),s=h.get(l);c.add(u[0],u[1],u[2]);c.add(s[0],s[1],s[2]);v<f-1?(s=i.get(v),l=i.get(l),d.add(s[0],s[1],s[2]),d.add(l[0],l[1],l[2])):(l=new M(u[0],u[1],u[2]),l.normalize(),d.add(l.x,l.y,l.b),l=new M(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b))}j--}while(0<j)}else if("POINTS"==this.X){f=i.length();j=e=this.G.length;do{p=
this.G[e-j];k=p.length;for(m=0;m<k;m++)l=parseInt(p[m],10),s=h.get(l),c.add(s[0],s[1],s[2]),l<f?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new M(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b));j--}while(0<j)}else if("POLYGONS"==this.X){f=i.length();j=e=this.G.length;do{p=this.G[e-j];k=p.length;for(m=0;m<k;m++)l=parseInt(p[m],10),s=h.get(l),c.add(s[0],s[1],s[2]),l<f?(l=i.get(l),d.add(l[0],l[1],l[2])):(l=new M(s[0],s[1],s[2]),l.normalize(),d.add(l.x,l.y,l.b));j--}while(0<j)}a.rb(this.X);c=new Qc;c.Ga=
a;this.dispatchEvent(c)};
Jd.prototype.z=function(a,b,c){var c=c.replace(/^\s+|\s+$/g,""),c=c.split(" "),d=c.length,f=c[0];if("POINTS"==f)this.Ka=o,this.Ja=this.ya=r;else if("VERTICES"==f)this.ya=o,this.Ja=this.Ka=r,a=parseInt(c[1],10),3<=a?this.X=Fd:1==a?this.X="POINTS":g(Error("VTK file not supported!")),this.G=[];else if("TRIANGLE_STRIPS"==f)this.ya=o,this.Ja=this.Ka=r,this.X="TRIANGLE_STRIPS",this.G=[];else if("LINES"==f)this.ya=o,this.Ja=this.Ka=r,this.X=dd,this.G=[];else if("POLYGONS"==f)this.ya=o,this.Ja=this.Ka=r,
this.X="POLYGONS",this.G=[];else if("POINT_DATA"==f)this.Ja=o,this.ya=this.Ka=r;else if(this.Ka)if(1==d||isNaN(parseFloat(f)))this.Ka=r;else{if(3<=d){var f=parseFloat(c[0]),e=parseFloat(c[1]),h=parseFloat(c[2]);a.add(f,e,h)}6<=d&&(f=parseFloat(c[3]),e=parseFloat(c[4]),h=parseFloat(c[5]),a.add(f,e,h));9<=d&&(d=parseFloat(c[6]),f=parseFloat(c[7]),c=parseFloat(c[8]),a.add(d,f,c))}else this.ya?1==d||isNaN(parseFloat(f))?this.ya=r:this.G.push(c.slice(1)):this.Ja&&("NORMALS"==f?this.ed=o:1==d||isNaN(parseFloat(f))?
this.ed=this.Ja=r:this.ed&&(3<=d&&(f=parseFloat(c[0]),e=parseFloat(c[1]),h=parseFloat(c[2]),b.add(f,e,h)),6<=d&&(f=parseFloat(c[3]),e=parseFloat(c[4]),h=parseFloat(c[5]),b.add(f,e,h)),9<=d&&(d=parseFloat(c[6]),f=parseFloat(c[7]),c=parseFloat(c[8]),b.add(d,f,c))))};A("X.parserVTK",Jd);A("X.parserVTK.prototype.parse",Jd.prototype.parse);function Kd(){Yc.call(this);this._className="parserFSM"}C(Kd,Yc);
Kd.prototype.parse=function(a,b){var c=a.k,d=a.o,f=new R,e;e=3;var h=0,i;do i=this.s(b,e++),h++;while(200>h&&10!=i);e++;var j=bd(this,b,e);e+=4;h=bd(this,b,e);e+=4;i=[];for(var p=0,p=0;p<j;p++){var k=Zc(this,b,e);e+=4;var m=Zc(this,b,e);e+=4;var l=Zc(this,b,e);e+=4;i[p]=0;f.add(k,m,l)}j=[];p=[];for(k=0;k<h;k++){var s=bd(this,b,e);e+=4;l=bd(this,b,e);e+=4;m=bd(this,b,e);e+=4;i[s]+=1;i[l]+=1;i[m]+=1;j.push([s,l,m]);p.push(new M(0,0,0))}for(k=0;k<h;k++){var s=j[k][0],l=j[k][1],m=j[k][2],v=f.get(s);e=
f.get(l);var u=f.get(m),v=new M(v[0],v[1],v[2]),u=new M(u[0],u[1],u[2]);e=(new M(e[0],e[1],e[2])).d().ka(v);v=u.d().ka(v);e=Vc(e,v).normalize();p[s]=p[s].add(e);p[l]=p[l].add(e);p[m]=p[m].add(e)}for(k=0;k<h;k++)s=j[k][0],l=j[k][1],m=j[k][2],v=f.get(s),e=f.get(l),u=f.get(m),c.add(v[0],v[1],v[2]),c.add(e[0],e[1],e[2]),c.add(u[0],u[1],u[2]),s=p[s].scale(1/i[s]).normalize(),l=p[l].scale(1/i[l]).normalize(),m=p[m].scale(1/i[m]).normalize(),d.add(s.x,s.y,s.b),d.add(l.x,l.y,l.b),d.add(m.x,m.y,m.b);a.rb(Fd);
c=new Qc;c.Ga=a;this.dispatchEvent(c)};A("X.parserFSM",Kd);A("X.parserFSM.prototype.parse",Kd.prototype.parse);function Ld(a){function b(){Y+=8;return la<N.length?N.charCodeAt(la++)&255:-1}function c(){var a;Y++;a=O&1;O>>=1;0==O&&(O=b(),a=O&1,O=O>>1|128);return a}function d(a){for(var b=0,d=a;d--;)b=b<<1|c();a&&(b=aa[b]>>8-a);return b}function f(a){ea++;L[K++]=a;s.push(String.fromCharCode(a));32768==K&&(K=0)}function e(){this.Na=this.Ma=0;this.Ec=q;this.De=-1}function h(){for(;;){if(Bb[oa]>=Ee)return-1;if(Fe[Bb[oa]]==oa)return Bb[oa]++;Bb[oa]++}}function i(){var a=Cb[Db],b;v&&document.write("<br>len:"+oa+
" treepos:"+Db);if(17==oa)return-1;Db++;oa++;b=h();v&&document.write("<br>IsPat "+b);if(0<=b)a.Ma=b,v&&document.write("<br>b0 "+a.Ma);else if(a.Ma=32768,v&&document.write("<br>b0 "+a.Ma),i())return-1;b=h();if(0<=b)a.Na=b,v&&document.write("<br>b1 "+a.Na),a.Ec=q;else if(a.Na=32768,v&&document.write("<br>b1 "+a.Na),a.Ec=Cb[Db],a.De=Db,i())return-1;oa--;return 0}function j(a,b,c){v&&document.write("currentTree "+a+" numval "+b+" lengths "+c+" show 0");Cb=a;Db=0;Fe=c;Ee=b;for(a=0;17>a;a++)Bb[a]=0;oa=
0;if(i())return v&&window.console.log("invalid huffman tree\n"),-1;if(v){document.write("<br>Tree: "+Cb.length);for(a=0;32>a;a++)document.write("Places["+a+"].b0="+Cb[a].Ma+"<br>"),document.write("Places["+a+"].b1="+Cb[a].Na+"<br>")}return 0}function p(a){for(var b,d,f=0,e=a[f];;)if(b=c(),v&&document.write("b="+b),b){if(!(e.Na&32768))return v&&document.write("ret1"),e.Na;e=e.Ec;b=a.length;for(d=0;d<b;d++)if(a[d]===e){f=d;break}}else{if(!(e.Ma&32768))return v&&document.write("ret2"),e.Ma;f++;e=a[f]}}
function k(){var a,h,i,l;do{a=c();h=d(2);switch(h){case 0:v&&window.console.log("Stored\n");break;case 1:v&&window.console.log("Fixed Huffman codes\n");break;case 2:v&&window.console.log("Dynamic Huffman codes\n");break;case 3:v&&window.console.log("Reserved block type!!\n");break;default:v&&window.console.log("Unexpected value %d!\n",h)}if(0==h){var m;O=1;m=b();m|=b()<<8;h=b();h|=b()<<8;for((m^~h)&65535&&document.write("BlockLen checksum mismatch\n");m--;)h=b(),f(h)}else if(1==h)for(var k;;)if(k=
aa[d(7)]>>1,23<k?(k=k<<1|c(),199<k?(k-=128,k=k<<1|c()):(k-=48,143<k&&(k+=136))):k+=256,256>k)f(k);else if(256==k)break;else{k-=257;l=d(ib[k])+fa[k];k=aa[d(5)]>>3;8<Ya[k]?(m=d(8),m|=d(Ya[k]-8)<<8):m=d(Ya[k]);m+=Fc[k];for(k=0;k<l;k++)h=L[K-m&32767],f(h)}else if(2==h){var s=Array(320);h=257+d(5);m=1+d(5);i=4+d(4);for(k=0;19>k;k++)s[k]=0;for(k=0;k<i;k++)s[P[k]]=d(3);l=qa.length;for(i=0;i<l;i++)qa[i]=new e;if(j(qa,19,s)){K=0;return}if(v){document.write("<br>distanceTree");for(k=0;k<qa.length;k++)document.write("<br>"+
qa[k].Ma+" "+qa[k].Na+" "+qa[k].Ec+" "+qa[k].De)}l=h+m;i=0;var u=-1;for(v&&document.write("<br>n="+l+" bits: "+Y+"<br>");i<l;)if(u++,k=p(qa),v&&document.write("<br>"+u+" i:"+i+" decode: "+k+" bits "+Y+"<br>"),16>k)s[i++]=k;else if(16==k){var B;k=3+d(2);if(i+k>l){K=0;return}for(B=i?s[i-1]:0;k--;)s[i++]=B}else{k=17==k?3+d(3):11+d(7);if(i+k>l){K=0;return}for(;k--;)s[i++]=0}l=gc.length;for(i=0;i<l;i++)gc[i]=new e;if(j(gc,h,s)){K=0;return}l=gc.length;for(i=0;i<l;i++)qa[i]=new e;k=[];l=s.length;for(i=
h;i<l;i++)k[i-h]=s[i];if(j(qa,m,k)){K=0;return}for(v&&document.write("<br>literalTree");;)if(k=p(gc),256<=k){k-=256;if(0==k)break;k--;l=d(ib[k])+fa[k];k=p(qa);8<Ya[k]?(m=d(8),m|=d(Ya[k]-8)<<8):m=d(Ya[k]);for(m+=Fc[k];l--;)h=L[K-m&32767],f(h)}else f(k)}}while(!a);K=0;O=1}function m(){v&&window.console.log("NEXTFILE");s=[];var a=[];J=r;a[0]=b();a[1]=b();v&&window.console.log("type: "+a[0]+" "+a[1]);120==a[0]&&218==a[1]&&(v&&window.console.log("GEONExT-GZIP"),k(),v&&window.console.log(s.join("")),D[B]=
Array(2),D[B][0]=s.join(""),D[B][1]="geonext.gxt",B++);31==a[0]&&139==a[1]&&(v&&window.console.log("GZIP"),l(),v&&window.console.log(s.join("")),D[B]=Array(2),D[B][0]=s.join(""),D[B][1]="file",B++);if(80==a[0]&&75==a[1]&&(J=o,a[2]=b(),a[3]=b(),3==a[2]&&4==a[3])){a[0]=b();a[1]=b();v&&window.console.log("ZIP-Version: "+a[1]+" "+a[0]/10+"."+a[0]%10);u=b();u|=b()<<8;v&&window.console.log("gpflags: "+u);a=b();a|=b()<<8;v&&window.console.log("method: "+a);b();b();b();b();var c=b(),c=c|b()<<8,c=c|b()<<16,
c=c|b()<<24,d=b(),d=d|b()<<8,d=d|b()<<16,d=d|b()<<24,e=b(),e=e|b()<<8,e=e|b()<<16,e=e|b()<<24;v&&window.console.log("local CRC: "+c+"\nlocal Size: "+e+"\nlocal CompSize: "+d);c=b();c|=b()<<8;d=b();d|=b()<<8;v&&window.console.log("filelen "+c);e=0;for(ra=[];c--;){var f=b();"/"==f|":"==f?e=0:e<Ba-1&&(ra[e++]=String.fromCharCode(f))}v&&window.console.log("nameBuf: "+ra);Eb||(Eb=ra);for(e=0;e<d;)b(),e++;ea=0;8==a&&(k(),v&&window.console.log(s.join("")),D[B]=Array(2),D[B][0]=s.join(""),D[B][1]=ra.join(""),
B++);l()}}function l(){var a=[],c;u&8&&(a[0]=b(),a[1]=b(),a[2]=b(),a[3]=b(),80==a[0]&&75==a[1]&&7==a[2]&&8==a[3]&&(b(),b(),b(),b()),b(),b(),b(),b(),b(),b(),b(),b(),v&&window.console.log("CRC:"));J&&m();a[0]=b();if(8!=a[0])v&&window.console.log("Unknown compression method!");else{u=b();v&&u&-32&&window.console.log("Unknown flags set!");b();b();b();b();b();b();if(u&4){a[0]=b();a[2]=b();oa=a[0]+256*a[1];v&&window.console.log("Extra field size: "+oa);for(a=0;a<oa;a++)b()}if(u&8){a=0;for(ra=[];c=b();){if("7"==
c||":"==c)a=0;a<Ba-1&&(ra[a++]=c)}v&&window.console.log("original file name: "+ra)}if(u&16)for(;b(););u&2&&(b(),b());k();b();b();b();b();b();b();b();b();J&&m()}}var s=[],v=r,u,B=0,D=[],L=Array(32768),K=0,J=r,ea,aa=[0,128,64,192,32,160,96,224,16,144,80,208,48,176,112,240,8,136,72,200,40,168,104,232,24,152,88,216,56,184,120,248,4,132,68,196,36,164,100,228,20,148,84,212,52,180,116,244,12,140,76,204,44,172,108,236,28,156,92,220,60,188,124,252,2,130,66,194,34,162,98,226,18,146,82,210,50,178,114,242,10,
138,74,202,42,170,106,234,26,154,90,218,58,186,122,250,6,134,70,198,38,166,102,230,22,150,86,214,54,182,118,246,14,142,78,206,46,174,110,238,30,158,94,222,62,190,126,254,1,129,65,193,33,161,97,225,17,145,81,209,49,177,113,241,9,137,73,201,41,169,105,233,25,153,89,217,57,185,121,249,5,133,69,197,37,165,101,229,21,149,85,213,53,181,117,245,13,141,77,205,45,173,109,237,29,157,93,221,61,189,125,253,3,131,67,195,35,163,99,227,19,147,83,211,51,179,115,243,11,139,75,203,43,171,107,235,27,155,91,219,59,187,
123,251,7,135,71,199,39,167,103,231,23,151,87,215,55,183,119,247,15,143,79,207,47,175,111,239,31,159,95,223,63,191,127,255],fa=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],ib=[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,99,99],Fc=[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],Ya=[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],P=[16,17,18,0,8,7,9,6,10,
5,11,4,12,3,13,2,14,1,15],N=a,la=0,O=1,Y=0,Ba=256,ra=[],Eb,gc=Array(288),qa=Array(32),Db=0,Cb=q,oa=0,Bb=Array(17);Bb[0]=0;var Fe,Ee;Ld.prototype.$g=function(){v&&window.console.log(N);m();return D}};function Md(){Yc.call(this);this._className="parserNRRD"}C(Md,Yc);
Md.prototype.parse=function(a,b){var c=0,d=b.match(/^([\s\S]*?)\r?\n\r?\n/),c=d[0].length,f,e,h,i,j,p,d=d[1].split(/\r?\n/);for(j=0,p=d.length;j<p;j++)if(f=d[j],f.match(/NRRD\d+/))this.Wf=o;else if(!f.match(/^#/)&&(i=f.match(/(.*):(.*)/)))e=i[1].trim(),f=i[2].trim(),(h=this.Kf[e])?h.call(this,f):this[e]=f;this.Wf||g(Error("Not an NRRD file"));"raw"!==this.encoding&&"gzip"!==this.encoding&&"gz"!==this.encoding&&g(Error("Only raw or gz/gzip encoding is allowed"));if(!this.V&&(this.V=[new M(1,0,0),new M(0,
1,0),new M(0,0,1)],this.Od)){d=[];for(i=0;2>=i;i++)d.push(!isNaN(this.Od[i])?this.V[i].scale(this.Od[i]):n)}i=0;i="gzip"==this.encoding||"gz"==this.encoding?(new Ld(b.substr(c))).$g()[0][0]:b.substr(c);j=this.ab[0]*this.ab[1]*this.ab[2];c=Array(j);d=-Infinity;p=Infinity;for(f=0;f<j;f++)e=this.Jc(i,0+f*this.Ic),c[f]=e,d=Math.max(d,e),p=Math.min(p,e);a.ea=[this.ab[0],this.ab[1],this.ab[2]];a.H=[(new M(this.V[0][0],this.V[0][1],this.V[0][2])).Ya(),(new M(this.V[1][0],this.V[1][1],this.V[1][2])).Ya(),
(new M(this.V[2][0],this.V[2][1],this.V[2][2])).Ya()];a.Hb=[p,d];a.ef(p,d);a.pa();j=this.ab;f=d;i=j[2];d=j[1];j=j[0];e=d*j;p=Array(i);for(h=0;h<i;h++){p[h]=Array(d);for(var k=0;k<d;k++)p[h][k]=new Uint8Array(j)}for(k=k=0;k<i;k++){h=c.slice(k*e,(k+1)*e);for(var m=new Uint8Array(4*e),l=0,s=0,v=0,l=0;l<d;l++)for(s=0;s<j;s++){var u=h[v],u=255*(u/f),B=4*v;m[B]=u;m[++B]=u;m[++B]=u;m[++B]=255;p[k][l][s]=u;v++}l=h=new Ed;l.Gb=m;l.c=o;m=h;m.pc=j;m.c=o;m=h;m.oc=d;m.c=o;a.ce.children()[k].Pc(h)}for(l=0;l<d;l++){m=
new Uint8Array(4*i*j);for(k=v=0;k<i;k++)for(s=0;s<j;s++)u=p[k][l][s],B=4*v,m[B]=u,m[++B]=u,m[++B]=u,m[++B]=255,v++;c=h=new Ed;c.Gb=m;c.c=o;c=h;c.pc=j;c.c=o;c=h;c.oc=i;c.c=o;a.be.children()[l].Pc(h)}for(s=0;s<j;s++){m=new Uint8Array(4*i*d);for(k=v=0;k<i;k++)for(l=0;l<d;l++)u=p[k][l][s],B=4*v,m[B]=u,m[++B]=u,m[++B]=u,m[++B]=255,v++;c=h=new Ed;c.Gb=m;c.c=o;c=h;c.pc=d;c.c=o;c=h;c.oc=i;c.c=o;a.ae.children()[s].Pc(h)}c=new Qc;c.Ga=a;this.dispatchEvent(c)};
Md.prototype.Kf={type:function(a){switch(a){case "unsigned char":case "uint8":this.Jc=this.s;this.Ic=1;break;case "signed char":case "int8":this.Jc=this.ug;this.Ic=1;break;case "short":case "signed short":case "unsigned short":case "short int":case "int16":this.Jc=this.Kc;this.Ic=2;break;case "int":case "int32":break;case "float":this.Jc=this.bc;this.Ic=4;break;default:g(Error("Only short/int/int8/float data is allowed. Found "+a))}return this.type=a},endian:function(a){return a},encoding:function(a){return this.encoding=
a},dimension:function(a){return parseInt(a,10)},sizes:function(a){var b,c,d,f;d=a.split(/\s+/);f=[];for(b=0,c=d.length;b<c;b++)a=d[b],f.push(parseInt(a,10));return this.ab=f},"space directions":function(a){var b,c,d;c=a.match(/\(.*?\)/g);return this.V=function(){var a,e,h;h=[];for(a=0,e=c.length;a<e;a++)d=c[a],h.push(function(){var a,c,e,f;e=d.slice(1,-1).split(/,/);f=[];for(a=0,c=e.length;a<c;a++)b=e[a],f.push(parseFloat(b));return f}());return h}()},spacings:function(a){var b;b=a.split(/\s+/);var c,
d,f;f=[];for(c=0,d=b.length;c<d;c++)a=b[c],f.push(parseFloat(a));return this.Od=f}};A("X.parserNRRD",Md);A("X.parserNRRD.prototype.parse",Md.prototype.parse);function Nd(){Q.call(this);this._className="loader";this.xb=q;this.Fb=0}C(Nd,Q);function Od(a){x(a.xb)||(a.xb=new Jb);return a.xb}function Pd(a){return!x(a.xb)?o:!a.xb.qd(r)}Nd.prototype.Yf=function(a){Qd(this,1.7);setTimeout(function(){Xc(a.S.file());a.$b();Od(this).set(a.id(),o)}.bind(this),100)};function Qd(a,b){a.Fb+=b/Od(a).$()/3;1<a.Fb&&(a.Fb=1);var c=new Rc;c.de=a.Fb;a.dispatchEvent(c)}Nd.prototype.Fe=function(){g(Error("Could not get the file."))};
Nd.prototype.Xf=function(a,b){Qd(this,1);setTimeout(function(){var c=b.file().path().split(".").pop().toLowerCase();"stl"==c?(c=new ed,oc(c,uc,this.ac.bind(this)),c.parse(b,a.response)):"vtk"==c?(c=new Jd,oc(c,uc,this.ac.bind(this)),c.parse(b,a.response)):"trk"==c?(c=new cd,oc(c,uc,this.ac.bind(this)),c.parse(b,a.response)):"fsm"==c?(c=new Kd,oc(c,uc,this.ac.bind(this)),c.parse(b,a.response)):"nrrd"==c&&(c=new Md,oc(c,uc,this.ac.bind(this)),c.parse(b,a.response))}.bind(this),100)};
Nd.prototype.ac=function(a){Qd(this,1);setTimeout(function(){var b=a.Ga;Xc(b.file());b.$b();Od(this).set(b.id(),o)}.bind(this),100)};function Rd(a,b,c,d){this.top=a;this.right=b;this.bottom=c;this.left=d}Rd.prototype.d=function(){return new Rd(this.top,this.right,this.bottom,this.left)};Rd.prototype.toString=function(){return"("+this.top+"t, "+this.right+"r, "+this.bottom+"b, "+this.left+"l)"};Rd.prototype.contains=function(a){return!this||!a?r:a instanceof Rd?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};function Sd(a,b,c,d){this.left=a;this.top=b;this.width=c;this.height=d}w=Sd.prototype;w.d=function(){return new Sd(this.left,this.top,this.width,this.height)};w.toString=function(){return"("+this.left+", "+this.top+" - "+this.width+"w x "+this.height+"h)"};
w.Be=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,o}return r};w.contains=function(a){return a instanceof Sd?this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height:a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height};
w.K=function(){return new qd(this.width,this.height)};var Td;function Ud(a,b){var c;c=(c=a.className)&&"function"==typeof c.split?c.split(/\s+/):[];var d=xb(arguments,1),f;f=c;for(var e=0,h=0;h<d.length;h++)0<=pb(f,d[h])||(f.push(d[h]),e++);f=e==d.length;a.className=c.join(" ");return f};var Vd=!E||hb(9);!Sa&&!E||E&&hb(9)||Sa&&fb("1.9.1");E&&fb("9");function Wd(a){return a?new Xd(Yd(a)):Td||(Td=new Xd)}function Zd(a){return y(a)?document.getElementById(a):a}function $d(a,b){jb(b,function(b,d){"style"==d?a.style.cssText=b:"class"==d?a.className=b:"for"==d?a.htmlFor=b:d in ae?a.setAttribute(ae[d],b):0==d.lastIndexOf("aria-",0)?a.setAttribute(d,b):a[d]=b})}
var ae={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",height:"height",width:"width",usemap:"useMap",frameborder:"frameBorder",maxlength:"maxLength",type:"type"};function be(a,b,c){return ce(document,arguments)}
function ce(a,b){var c=b[0],d=b[1];if(!Vd&&d&&(d.name||d.type)){c=["<",c];d.name&&c.push(' name="',za(d.name),'"');if(d.type){c.push(' type="',za(d.type),'"');var f={};nb(f,d);d=f;delete d.type}c.push(">");c=c.join("")}c=a.createElement(c);d&&(y(d)?c.className=d:ja(d)?Ud.apply(q,[c].concat(d)):$d(c,d));2<b.length&&de(a,c,b);return c}
function de(a,b,c){function d(c){c&&b.appendChild(y(c)?a.createTextNode(c):c)}for(var f=2;f<c.length;f++){var e=c[f];ka(e)&&!(na(e)&&0<e.nodeType)?qb(ee(e)?wb(e):e,d):d(e)}}function fe(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function ge(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}
function he(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 Yd(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function ee(a){if(a&&"number"==typeof a.length){if(na(a))return"function"==typeof a.item||"string"==typeof a.item;if(ma(a))return"function"==typeof a.item}return r}function Xd(a){this.u=a||da.document||document}w=Xd.prototype;
w.zc=Wd;w.e=function(a){return y(a)?this.u.getElementById(a):a};w.kb=function(a,b,c){return ce(this.u,arguments)};w.createElement=function(a){return this.u.createElement(a)};w.createTextNode=function(a){return this.u.createTextNode(a)};function ie(a){return"CSS1Compat"==a.u.compatMode}function je(a){var b=a.u,a=!F&&"CSS1Compat"==b.compatMode?b.documentElement:b.body,b=b.parentWindow||b.defaultView;return new V(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}w.appendChild=function(a,b){a.appendChild(b)};
w.contains=he;function ke(a,b){var c=Yd(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,q))?c[b]||c.getPropertyValue(b):""}function le(a,b){return a.currentStyle?a.currentStyle[b]:q}function me(a,b){return ke(a,b)||le(a,b)||a.style&&a.style[b]}function ne(a){a=a?9==a.nodeType?a:Yd(a):document;return E&&!hb(9)&&!ie(Wd(a))?a.body:a.documentElement}
function oe(a){var b=a.getBoundingClientRect();E&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function pe(a){if(E&&!hb(8))return a.offsetParent;for(var b=Yd(a),c=me(a,"position"),d="fixed"==c||"absolute"==c,a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=me(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 q}
function qe(a){for(var b=new Rd(0,Infinity,Infinity,0),c=Wd(a),d=c.u.body,f=c.u.documentElement,e=!F&&"CSS1Compat"==c.u.compatMode?c.u.documentElement:c.u.body;a=pe(a);)if((!E||0!=a.clientWidth)&&(!F||0!=a.clientHeight||a!=d)&&a!=d&&a!=f&&"visible"!=me(a,"overflow")){var h=re(a),i;i=a;if(Sa&&!fb("1.9")){var j=parseFloat(ke(i,"borderLeftWidth"));if(se(i))var p=i.offsetWidth-i.clientWidth-j-parseFloat(ke(i,"borderRightWidth")),j=j+p;i=new V(j,parseFloat(ke(i,"borderTopWidth")))}else i=new V(i.clientLeft,
i.clientTop);h.x+=i.x;h.y+=i.y;b.top=Math.max(b.top,h.y);b.right=Math.min(b.right,h.x+a.clientWidth);b.bottom=Math.min(b.bottom,h.y+a.clientHeight);b.left=Math.max(b.left,h.x)}d=e.scrollLeft;e=e.scrollTop;b.left=Math.max(b.left,d);b.top=Math.max(b.top,e);c=c.u.parentWindow||c.u.defaultView||window;f=c.document;F&&!fb("500")&&!Ta?("undefined"==typeof c.innerHeight&&(c=window),f=c.innerHeight,a=c.document.documentElement.scrollHeight,c==c.top&&a<f&&(f-=15),c=new qd(c.innerWidth,f)):(c="CSS1Compat"==
f.compatMode?f.documentElement:f.body,c=new qd(c.clientWidth,c.clientHeight));b.right=Math.min(b.right,d+c.width);b.bottom=Math.min(b.bottom,e+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?b:q}
function re(a){var b,c=Yd(a),d=me(a,"position"),f=Sa&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==d&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),e=new V(0,0),h=ne(c);if(a==h)return e;if(a.getBoundingClientRect)b=oe(a),a=je(Wd(c)),e.x=b.left+a.x,e.y=b.top+a.y;else if(c.getBoxObjectFor&&!f)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(h),e.x=b.screenX-a.screenX,e.y=b.screenY-a.screenY;else{b=a;do{e.x+=b.offsetLeft;e.y+=b.offsetTop;b!=a&&(e.x+=b.clientLeft||0,e.y+=b.clientTop||0);
if(F&&"fixed"==me(b,"position")){e.x+=c.body.scrollLeft;e.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(Ra||F&&"absolute"==d)e.y-=c.body.offsetTop;for(b=a;(b=pe(b))&&b!=c.body&&b!=h;)if(e.x-=b.scrollLeft,!Ra||"TR"!=b.tagName)e.y-=b.scrollTop}return e}function te(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}
function ue(a){if("none"!=me(a,"display"))return ve(a);var b=a.style,c=b.display,d=b.visibility,f=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=ve(a);b.display=c;b.position=f;b.visibility=d;return a}function ve(a){var b=a.offsetWidth,c=a.offsetHeight,d=F&&!b&&!c;return(!ia(b)||d)&&a.getBoundingClientRect?(a=oe(a),new qd(a.right-a.left,a.bottom-a.top)):new qd(b,c)}function we(a,b){a.style.display=b?"":"none"}function se(a){return"rtl"==me(a,"direction")}
function xe(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 f=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=d;return f}var ye={thin:2,medium:4,thick:6};function ze(a,b){if("none"==le(a,b+"Style"))return 0;var c=le(a,b+"Width");return c in ye?ye[c]:xe(a,c)};function Ae(a){this.ba=a;this.n=[]}C(Ae,Qb);var Be=[];function Ce(a,b,c,d,f){ja(c)||(Be[0]=c,c=Be);for(var e=0;e<c.length;e++)a.n.push(G(b,c[e],d||a,f||r,a.ba||a))}Ae.prototype.Lc=function(){qb(this.n,qc);this.n.length=0};Ae.prototype.t=function(){Ae.C.t.call(this);this.Lc()};Ae.prototype.handleEvent=function(){g(Error("EventHandler.handleEvent not implemented"))};function De(){}(function(a){a.re=function(){return a.Tf||(a.Tf=new a)}})(De);De.prototype.Fd=0;De.re();function Ge(a){this.ga=a||Wd()}C(Ge,Wc);w=Ge.prototype;w.Sf=De.re();w.ye=q;w.Xa=r;w.h=q;w.nb=q;w.jb=q;w.Ob=q;w.eh=r;w.e=t("h");w.Md=function(a){this.nb&&this.nb!=a&&g(Error("Method not supported"));Ge.C.Md.call(this,a)};w.zc=t("ga");w.kb=function(){this.h=this.ga.createElement("div")};w.cc=function(a){this.qb(a)};w.qb=function(a,b){this.Xa&&g(Error("Component already rendered"));this.h||this.kb();a?a.insertBefore(this.h,b||q):this.ga.u.body.appendChild(this.h);(!this.nb||this.nb.Xa)&&this.yc()};
w.yc=function(){this.Xa=o;He(this,function(a){!a.Xa&&a.e()&&a.yc()})};w.Rb=function(){He(this,function(a){a.Xa&&a.Rb()});this.Bc&&this.Bc.Lc();this.Xa=r};w.t=function(){Ge.C.t.call(this);this.Xa&&this.Rb();this.Bc&&(this.Bc.Z(),delete this.Bc);He(this,function(a){a.Z()});!this.eh&&this.h&&fe(this.h);this.nb=this.h=this.Ob=this.jb=q};w.Wb=function(){return!!this.jb&&0!=this.jb.length};function He(a,b){a.jb&&qb(a.jb,b,n)}
w.removeChild=function(a,b){if(a){var c=y(a)?a:a.ye||(a.ye=":"+(a.Sf.Fd++).toString(36)),a=this.Ob&&c?(c in this.Ob?this.Ob[c]:n)||q:q;if(c&&a){var d=this.Ob;c in d&&delete d[c];ub(this.jb,a);b&&(a.Rb(),a.h&&fe(a.h));c=a;c==q&&g(Error("Unable to set parent component"));c.nb=q;Ge.C.Md.call(c,q)}}a||g(Error("Child is not in parent component"));return a};function Ie(){}C(Ie,Wc);w=Ie.prototype;w.Qd=0;w.Zb=0;w.Ed=100;w.qe=0;w.Pd=1;w.Vf=r;w.ag=r;w.Qc=function(a){a=Je(this,a);this.Qd!=a&&(this.Qd=a+this.qe>this.Ed?this.Ed-this.qe:a<this.Zb?this.Zb:a,!this.Vf&&!this.ag&&this.dispatchEvent("change"))};w.Ac=function(){return Je(this,this.Qd)};w.Vb=function(){return Je(this,this.Zb)};w.Ub=function(){return Je(this,this.Ed)};function Je(a,b){return a.Pd==q?b:a.Zb+Math.round((b-a.Zb)/a.Pd)*a.Pd};function Ke(a){this.ga=a||Wd();this.ob=new Ie;G(this.ob,"change",this.Pf,r,this)}C(Ke,Ge);var Le={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};w=Ke.prototype;w.kb=function(){this.da=this.zc().kb("div","progress-bar-thumb");var a=Le[this.Qe];this.h=this.zc().kb("div",a,this.da);Me(this);this.e().setAttribute("aria-valuemin",this.Vb());this.e().setAttribute("aria-valuemax",this.Ub())};
w.yc=function(){Ke.C.yc.call(this);E&&7>Xa&&G(this.e(),"resize",this.Sc,r,this);this.Sc();var a=this.e();a.setAttribute("role","progressbar");a.Eh="progressbar";this.e().setAttribute("aria-live","polite")};w.Rb=function(){Ke.C.Rb.call(this);Ne(this)};function Ne(a){E&&7>Xa&&pc(a.e(),"resize",a.Sc,r,a)}w.Ac=function(){return this.ob.Ac()};w.Qc=function(a){this.ob.Qc(a);this.e()&&Me(this)};function Me(a){var b=a.Ac();a.e().setAttribute("aria-valuenow",b)}w.Vb=function(){return this.ob.Vb()};w.Ub=function(){return this.ob.Ub()};
w.Qe="horizontal";w.Pf=function(){this.Sc();this.dispatchEvent("change")};w.Sc=function(){if(this.da){var a=this.Vb(),b=this.Ub(),a=(this.Ac()-a)/(b-a),b=Math.round(100*a);"vertical"==this.Qe?E&&7>Xa?(this.da.style.top=0,this.da.style.height="100%",b=this.da.offsetHeight,a=Math.round(a*b),this.da.style.top=b-a+"px",this.da.style.height=a+"px"):(this.da.style.top=100-b+"%",this.da.style.height=b+"%"):this.da.style.width=b+"%"}};w.t=function(){Ne(this);Ke.C.t.call(this);this.da=q;this.ob.Z()};function Oe(a,b){x(a)||g(Error("No valid parent element."));x(b)||g(Error("Invalid initial value."));Ke.call(this);this._className="progressbar";this.Ia=a;this.lc=this.oa=q;this.Oa=[];this.Oa=[".progress-bar-horizontal {\n position: relative;\n border: 1px solid #949dad;\n background: white;\n padding: 1px;\n overflow: hidden;\n margin: 2px;\n width: 100px;\n height: 5px;\n}",".progress-bar-thumb {\n position: relative;\n background: #F62217;\n overflow: hidden;\n width: 0%;\n height: 100%;\n}",
".progress-bar-thumb-done {\n background: #57E964;\n}"];this.Qc(b);this.Ad()}C(Oe,Ke);
Oe.prototype.Ad=function(){this.Ia.style.position="relative";var a=document.getElementsByTagName("head")[0],b=be("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Oa[0]),d=document.createTextNode(this.Oa[1]),f=document.createTextNode(this.Oa[2]);a.appendChild(b);b.appendChild(c);b.appendChild(d);b.appendChild(f);this.oa=b;this.cc(this.Ia);a=this.e();a.style.position="absolute";a.style.top=(this.Ia.clientHeight-5)/2;a.style.left=(this.Ia.clientWidth-100)/2};
function Pe(a){var b=a.e().style.top,c=a.e().style.left;fe(a.e());var d=new Oe(a.Ia,100),f=d.e();f.style.position="absolute";f.style.top=b;f.style.left=c;(f.firstElementChild!=n?f.firstElementChild:ge(f.firstChild)).classList.add("progress-bar-thumb-done");a.lc=d}Oe.prototype.Bd=function(){this.oa&&fe(this.oa);this.e()&&fe(this.e());this.lc&&fe(this.lc.e());this.lc=this.oa=q};function Qe(a,b,c,d,f){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));(!x(b)||!(b instanceof Array)||3!=b.length)&&g(Error("Invalid front direction."));(!x(c)||!(c instanceof Array)||3!=c.length)&&g(Error("Invalid up direction."));z(d)||g(Error("Invalid width."));z(f)||g(Error("Invalid height."));I.call(this);this._className="slice";this.j=a;this.Uc=b;this.Ta=c;this.Nb=d;this.fb=f;this.Sa=[0,1,0,0,1,1,1,1,1,0,0,0];this.Lb=q;this.pa()}C(Qe,I);
Qe.prototype.pa=function(){this.k.clear();var a=new M(this.Uc[0],this.Uc[1],this.Uc[2]),b=new M(this.Ta[0],this.Ta[1],this.Ta[2]),c=Vc(b,a),d=new M(this.j[0],this.j[1],this.j[2]),f=new M(1,1,1);1==a.x?(f=new M(this.j[0],this.fb/2,this.Nb/2),this.Sa=[0,0,1,0,0,1,0,1,1,1,1,0]):1==a.y?(f=new M(this.Nb/2,this.j[1],this.fb/2),this.Sa=[0,0,0,1,1,0,1,0,1,1,0,1]):1==a.b&&(f=new M(this.Nb/2,this.fb/2,this.j[2]));var e=Uc(c.d().B(),b.d().B()),e=new M(e.x*f.x,e.y*f.y,e.b*f.b);e.add(d);var h=Uc(c.d().B(),b),
h=new M(h.x*f.x,h.y*f.y,h.b*f.b);h.add(d);var i=Uc(c,b.d().B()),i=new M(i.x*f.x,i.y*f.y,i.b*f.b);i.add(d);var j=i,b=Uc(c,b),b=new M(b.x*f.x,b.y*f.y,b.b*f.b);b.add(d);d=h;this.k.add(e.x,e.y,e.b);this.k.add(h.x,h.y,h.b);this.k.add(i.x,i.y,i.b);this.k.add(j.x,j.y,j.b);this.k.add(b.x,b.y,b.b);this.k.add(d.x,d.y,d.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b);this.o.add(a.x,a.y,a.b)};A("X.slice",Qe);function Re(){Q.call(this);this._className="shader";this.sc="";this.sc="precision mediump float;\n\nattribute vec3 vertexPosition;\nattribute vec3 vertexNormal;\nattribute vec3 vertexColor;\nattribute vec2 vertexTexturePos;\n\nuniform mat4 view;\nuniform mat4 perspective;\nuniform vec3 center;\nuniform mat4 objectTransform;\nuniform bool useObjectColor;\nuniform vec3 objectColor;\nuniform float pointSize;\n\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fTransformedVertexNormal;\n\nvoid main(void) {\n fTransformedVertexNormal = mat3(view[0].xyz,view[1].xyz,view[2].xyz) * mat3(objectTransform[0].xyz,objectTransform[1].xyz,objectTransform[2].xyz) * vertexNormal;\n vec3 vertexPosition2 = vertexPosition - center;\n fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n fragmentTexturePos = vertexTexturePos;\n if (useObjectColor) {\n fragmentColor = objectColor;\n } else {\n fragmentColor = vertexColor;\n }\n gl_PointSize = pointSize;\n gl_Position = perspective * fVertexPosition;\n}\n";
this.mc="";this.mc="precision mediump float;\n\nuniform bool usePicking;\nuniform bool useTexture;\nuniform bool useTextureThreshold;\nuniform sampler2D textureSampler;\nuniform float objectOpacity;\nuniform float volumeLowerThreshold;\nuniform float volumeUpperThreshold;\nuniform float volumeScalarMin;\nuniform float volumeScalarMax;\n\nvarying vec4 fVertexPosition;\nvarying vec3 fragmentColor;\nvarying vec2 fragmentTexturePos;\nvarying vec3 fTransformedVertexNormal;\n\nvoid main(void) {\n if (usePicking) {\n gl_FragColor = vec4(fragmentColor, 1.0);\n } else if (useTexture) {\n gl_FragColor = texture2D(textureSampler, vec2(fragmentTexturePos.s,fragmentTexturePos.t));\n if (useTextureThreshold) {\n float _volumeLowerThreshold = (volumeLowerThreshold / volumeScalarMax);\n float _volumeUpperThreshold = (volumeUpperThreshold / volumeScalarMax);\n if (gl_FragColor.r < _volumeLowerThreshold ||\n gl_FragColor.r > _volumeUpperThreshold) {\n discard;\n };\n };\n gl_FragColor.a = objectOpacity;\n } else {\n vec3 nNormal = normalize(fTransformedVertexNormal);\n vec3 light = vec3(0.0, 0.0, 1.0);\n vec3 lightDirection = vec3(0,0,-10);\n lightDirection = normalize(lightDirection);\n vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n float ambient = 0.3;\n gl_FragColor = vec4(fragmentColor * ambient +\n fragmentColor * diffuse +\n vec3(0.2, 0.2, 0.2) * specular,\n objectOpacity);\n }\n}\n"}
C(Re,Q);var Se={th:"vertexPosition",sh:"vertexNormal",rh:"vertexColor",uh:"vertexTexturePos"},Te={vh:"view",kh:"perspective",fh:"center",jh:"objectTransform",nh:"useObjectColor",hh:"objectColor",lh:"pointSize",ih:"objectOpacity",gh:"normal",oh:"usePicking",ph:"useTexture",qh:"useTextureThreshold",mh:"textureSampler",wh:"volumeLowerThreshold",zh:"volumeUpperThreshold",yh:"volumeScalarMin",xh:"volumeScalarMax"};
function Ue(a){var b=Object.keys(Te);Object.keys(Se).every(function(a){a=eval("X.shaders.attributes."+a);return-1!=this.sc.search(a)||-1!=this.mc.search(a)}.bind(a))||g(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=eval("X.shaders.uniforms."+a);return-1!=this.sc.search(a)||-1!=this.mc.search(a)}.bind(a))||g(Error("Could not find all uniforms in the shader sources."))}A("X.shaders.attributes",Se);A("X.shaders.uniforms",Te);function Ve(){I.call(this);this._className="volume";this.j=[0,0,0];this.ea=[10,10,10];this.H=[1,1,1];this.Yc=this._indexZ=this.Xc=this._indexY=this.Wc=this._indexX=0;this.ae=new I;this.be=new I;this.ce=new I;this._lowerThreshold=0;this._upperThreshold=1E3;this.Hb=[0,1E3];this.ee=this._volumeRendering=r;this.Mb=0}C(Ve,I);w=Ve.prototype;
w.pa=function(){this.children().length=0;this.children().push(this.ae);this.children().push(this.be);this.children().push(this.ce);for(var a=0,a=0;3>a;a++){for(var b=(this.ea[a]-1)/2,c=b,d=0,d=0;d<this.ea[a];d++){var f=-b*this.H[a]+d*this.H[a],e=[[this.j[0]+f,this.j[1],this.j[2]],[this.j[0],this.j[1]+f,this.j[2]],[this.j[0],this.j[1],this.j[2]+f]],f=this.children()[a].children(),h=0,i=0;0==a?(h=this.ea[2]*this.H[2]-this.H[2],i=this.ea[1]*this.H[1]-this.H[1]):1==a?(h=this.ea[0]*this.H[0]-this.H[0],
i=this.ea[2]*this.H[2]-this.H[2]):2==a&&(h=this.ea[0]*this.H[0]-this.H[0],i=this.ea[1]*this.H[1]-this.H[1]);e=new Qe(e[a],[[1,0,0],[0,1,0],[0,0,1]][a],[[0,1,0],[0,0,-1],[0,1,0]][a],h,i);e.Lb=this;e.p(d==c);f.push(e)}0==a?this.Wc=this._indexX=c:1==a?this.Xc=this._indexY=c:2==a&&(this.Yc=this._indexZ=c)}this.c=o};
w.$b=function(){this._volumeRendering!=this.ee&&(this.c=o,this.ee=this._volumeRendering);if(this._volumeRendering)We(this,this.Mb);else{if(this.c){var a=this.children()[this.Mb];a.p(r)}for(var b=0,b=0;3>b;b++){var a=this.children()[b],c=0,d=0;0==b?(c=this._indexX,d=this.Wc,this.Wc=this._indexX):1==b?(c=this._indexY,d=this.Xc,this.Xc=this._indexY):2==b&&(c=this._indexZ,d=this.Yc,this.Yc=this._indexZ);a.children()[parseInt(d,10)].p(r);a.children()[parseInt(c,10)].p(o)}}Ve.C.$b.call(this)};w.Hf=t("ea");
w.Cg=t("Hb");w.ef=function(a,b){(!x(a)||!z(a)||!x(b)||!z(b)||a>b||a<this.Hb[0]||b>this.Hb[1])&&g(Error("Invalid threshold range."));this._lowerThreshold=a;this._upperThreshold=b};w.Og=ba();w.p=ca("_visible");w.Fg=function(a){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));this.j=a};
function We(a,b){if(!(!a.c&&!a._volumeRendering||!a.c&&b==a.Mb)){a.children()[0].children()[parseInt(a._indexX,10)].p(r);a.children()[1].children()[parseInt(a._indexY,10)].p(r);a.children()[2].children()[parseInt(a._indexZ,10)].p(r);var c=a.children()[a.Mb];c.p(r);c=a.children()[b];c.p(o);a.Mb=b}}A("X.volume",Ve);A("X.volume.prototype.dimensions",Ve.prototype.Hf);A("X.volume.prototype.scalarRange",Ve.prototype.Cg);A("X.volume.prototype.setVisible",Ve.prototype.p);
A("X.volume.prototype.setCenter",Ve.prototype.Fg);A("X.volume.prototype.setVolumeRendering",Ve.prototype.Og);A("X.volume.prototype.threshold",Ve.prototype.ef);A("X.volume.prototype.modified",Ve.prototype.$b);function Xe(a){this.Ua=a||Ye}function Ye(a,b){return""+a<""+b?-1:""+a>""+b?1:0}w=Xe.prototype;w.N=q;w.Ua=q;w.ta=q;w.sa=q;w.g=0;
w.add=function(a){if(this.N==q)return this.sa=this.ta=this.N=new Ze(a),this.g=1,o;var b=r;$e(this,function(c){var d=q;if(0<this.Ua(c.value,a)){if(d=c.left,c.left==q){var f=new Ze(a,c);c.left=f;c==this.ta&&(this.ta=f);b=o;af(this,c)}}else 0>this.Ua(c.value,a)&&(d=c.right,c.right==q&&(f=new Ze(a,c),c.right=f,c==this.sa&&(this.sa=f),b=o,af(this,c)));return d});b&&(this.g+=1);return b};
w.remove=function(a){var b=q;$e(this,function(c){var d=q;if(0<this.Ua(c.value,a))d=c.left;else if(0>this.Ua(c.value,a))d=c.right;else if(b=c.value,c.left!=q||c.right!=q){var f=q,e;if(c.left!=q){e=bf(this,c.left);if(e!=c.left){if(e.parent.right=e.left)e.left.parent=e.parent;e.left=c.left;e.left.parent=e;f=e.parent}e.parent=c.parent;e.right=c.right;e.right&&(e.right.parent=e);c==this.sa&&(this.sa=e)}else{e=cf(this,c.right);if(e!=c.right){if(e.parent.left=e.right)e.right.parent=e.parent;e.right=c.right;
e.right.parent=e;f=e.parent}e.parent=c.parent;e.left=c.left;e.left&&(e.left.parent=e);c==this.ta&&(this.ta=e)}df(c)?c.parent.left=e:ef(c)?c.parent.right=e:this.N=e;af(this,f?f:e)}else df(c)?(c.parent.left=q,c==this.ta&&(this.ta=c.parent),af(this,c.parent)):ef(c)?(c.parent.right=q,c==this.sa&&(this.sa=c.parent),af(this,c.parent)):this.clear();return d});b&&(this.g=this.N?this.g-1:0);return b};w.clear=function(){this.sa=this.ta=this.N=q;this.g=0};
w.contains=function(a){var b=r;$e(this,function(c){var d=q;0<this.Ua(c.value,a)?d=c.left:0>this.Ua(c.value,a)?d=c.right:b=o;return d});return b};w.$=t("g");w.Vb=function(){return cf(this).value};w.Ub=function(){return bf(this).value};w.aa=function(){var a=[];ff(this,function(b){a.push(b)});return a};
function ff(a,b){if(a.N){var c,d=c=cf(a);for(c=c.left?c.left:c;d!=q;)if(d.left!=q&&d.left!=c&&d.right!=c)d=d.left;else{if(d.right!=c&&b(d.value))break;var f=d,d=d.right!=q&&d.right!=c?d.right:d.parent;c=f}}}function $e(a,b,c){for(c=c?c:a.N;c&&c!=q;)c=b.call(a,c)}
function af(a,b){$e(a,function(a){var b=a.left?a.left.height:0,f=a.right?a.right.height:0;1<b-f?(a.left.right&&(!a.left.left||a.left.left.height<a.left.right.height)&&gf(this,a.left),hf(this,a)):1<f-b&&(a.right.left&&(!a.right.right||a.right.right.height<a.right.left.height)&&hf(this,a.right),gf(this,a));b=a.left?a.left.height:0;f=a.right?a.right.height:0;a.height=Math.max(b,f)+1;return a.parent},b)}
function gf(a,b){df(b)?(b.parent.left=b.right,b.right.parent=b.parent):ef(b)?(b.parent.right=b.right,b.right.parent=b.parent):(a.N=b.right,a.N.parent=q);var c=b.right;b.right=b.right.left;b.right!=q&&(b.right.parent=b);c.left=b;b.parent=c}function hf(a,b){df(b)?(b.parent.left=b.left,b.left.parent=b.parent):ef(b)?(b.parent.right=b.left,b.left.parent=b.parent):(a.N=b.left,a.N.parent=q);var c=b.left;b.left=b.left.right;b.left!=q&&(b.left.parent=b);c.right=b;b.parent=c}
function cf(a,b){if(!b)return a.ta;var c=b;$e(a,function(a){var b=q;a.left&&(b=c=a.left);return b},b);return c}function bf(a,b){if(!b)return a.sa;var c=b;$e(a,function(a){var b=q;a.right&&(b=c=a.right);return b},b);return c}function Ze(a,b){this.value=a;this.parent=b?b:q}Ze.prototype.left=q;Ze.prototype.right=q;Ze.prototype.height=1;function ef(a){return!!a.parent&&a.parent.right==a}function df(a){return!!a.parent&&a.parent.left==a};function jf(a,b,c){x(a)||g(Error("Invalid GL Buffer."));x(b)||g(Error("Invalid number of items."));x(c)||g(Error("Invalid item size."));Q.call(this);this._className="buffer";this.R=a;this.za=b;this.hb=c}C(jf,Q);var kf=da.window;function lf(a,b,c){ma(a)?c&&(a=wa(a,c)):a&&"function"==typeof a.handleEvent?a=wa(a.handleEvent,a):g(Error("Invalid listener argument"));return 2147483647<b?-1:kf.setTimeout(a,b||0)};function mf(a,b,c,d,f,e,h,i){var j,p=c.offsetParent;if(p){var k="HTML"==p.tagName||"BODY"==p.tagName;if(!k||"static"!=me(p,"position"))j=re(p),k||(j=pd(j,new V(p.scrollLeft,p.scrollTop)))}p=re(a);k=ue(a);p=new Sd(p.x,p.y,k.width,k.height);(k=qe(a))&&p.Be(new Sd(k.left,k.top,k.right-k.left,k.bottom-k.top));var k=Wd(a),m=Wd(c);if(k.u!=m.u){var l=k.u.body,m=m.u.parentWindow||m.u.defaultView,s=new V(0,0),v=Yd(l)?Yd(l).parentWindow||Yd(l).defaultView:window,u=l;do{var B;if(v==m)B=re(u);else{var D=u;B=
new V;if(1==D.nodeType)if(D.getBoundingClientRect)D=oe(D),B.x=D.left,B.y=D.top;else{var L=je(Wd(D)),D=re(D);B.x=D.x-L.x;B.y=D.y-L.y}else{var L=ma(D.Of),K=D;D.targetTouches?K=D.targetTouches[0]:L&&D.ha.targetTouches&&(K=D.ha.targetTouches[0]);B.x=K.clientX;B.y=K.clientY}}s.x+=B.x;s.y+=B.y}while(v&&v!=m&&(u=v.frameElement)&&(v=v.parent));l=pd(s,re(l));E&&!ie(k)&&(l=pd(l,je(k)));p.left+=l.x;p.top+=l.y}a=(b&4&&se(a)?b^2:b)&-5;b=new V(a&2?p.left+p.width:p.left,a&1?p.top+p.height:p.top);j&&(b=pd(b,j));
f&&(b.x+=(a&2?-1:1)*f.x,b.y+=(a&1?-1:1)*f.y);var J;if(h&&(J=qe(c))&&j)J.top-=j.y,J.right-=j.x,J.bottom-=j.y,J.left-=j.x;return nf(b,c,d,e,J,h,i)}
function nf(a,b,c,d,f,e,h){var a=a.d(),i=0,j=(c&4&&se(b)?c^2:c)&-5,c=ue(b),h=h?h.d():c.d();if(d||0!=j)j&2?a.x-=h.width+(d?d.right:0):d&&(a.x+=d.left),j&1?a.y-=h.height+(d?d.bottom:0):d&&(a.y+=d.top);if(e){if(f){i=a;d=0;if(65==(e&65)&&(i.x<f.left||i.x>=f.right))e&=-2;if(132==(e&132)&&(i.y<f.top||i.y>=f.bottom))e&=-5;i.x<f.left&&e&1&&(i.x=f.left,d|=1);i.x<f.left&&i.x+h.width>f.right&&e&16&&(h.width=Math.max(h.width-(i.x+h.width-f.right),0),d|=4);i.x+h.width>f.right&&e&1&&(i.x=Math.max(f.right-h.width,
f.left),d|=1);e&2&&(d|=(i.x<f.left?16:0)|(i.x+h.width>f.right?32:0));i.y<f.top&&e&4&&(i.y=f.top,d|=2);i.y>=f.top&&i.y+h.height>f.bottom&&e&32&&(h.height=Math.max(h.height-(i.y+h.height-f.bottom),0),d|=8);i.y+h.height>f.bottom&&e&4&&(i.y=Math.max(f.bottom-h.height,f.top),d|=2);e&8&&(d|=(i.y<f.top?64:0)|(i.y+h.height>f.bottom?128:0));i=d}else i=256;if(i&496)return i}e=a;f=Sa&&(La||Wa)&&fb("1.9");e instanceof V?(a=e.x,e=e.y):(a=e,e=n);b.style.left=te(a,f);b.style.top=te(e,f);rd(c,h)||(a=ie(Wd(Yd(b))),
E&&(!a||!fb("8"))?(c=b.style,a?(E?(a=xe(b,le(b,"paddingLeft")),f=xe(b,le(b,"paddingRight")),e=xe(b,le(b,"paddingTop")),d=xe(b,le(b,"paddingBottom")),a=new Rd(e,f,d,a)):(a=ke(b,"paddingLeft"),f=ke(b,"paddingRight"),e=ke(b,"paddingTop"),d=ke(b,"paddingBottom"),a=new Rd(parseFloat(e),parseFloat(f),parseFloat(d),parseFloat(a))),E?(f=ze(b,"borderLeft"),e=ze(b,"borderRight"),d=ze(b,"borderTop"),b=ze(b,"borderBottom"),b=new Rd(d,e,b,f)):(f=ke(b,"borderLeftWidth"),e=ke(b,"borderRightWidth"),d=ke(b,"borderTopWidth"),
b=ke(b,"borderBottomWidth"),b=new Rd(parseFloat(d),parseFloat(e),parseFloat(b),parseFloat(f))),c.pixelWidth=h.width-b.left-a.left-a.right-b.right,c.pixelHeight=h.height-b.top-a.top-a.bottom-b.bottom):(c.pixelWidth=h.width,c.pixelHeight=h.height)):(b=b.style,Sa?b.MozBoxSizing="border-box":F?b.WebkitBoxSizing="border-box":b.boxSizing="border-box",b.width=Math.max(h.width,0)+"px",b.height=Math.max(h.height,0)+"px"));return i};function of(){}of.prototype.ja=ba();function pf(a,b){this.element=a;this.je=b}C(pf,of);pf.prototype.ja=function(a,b,c){mf(this.element,this.je,a,b,n,c)};function qf(a,b){this.ba=new Ae(this);this.Ld(a||q);b&&this.rb(b)}C(qf,Wc);w=qf.prototype;w.h=q;w.Af=o;w.fe=q;w.L=r;w.Qg=r;w.Cd=-1;w.Rf=r;w.Jf=o;w.sb="toggle_display";w.rb=ca("sb");w.e=t("h");w.Ld=function(a){this.L&&g(Error("Can not change this state of the popup while showing."));this.h=a};
w.p=function(a){this.gc&&this.gc.stop();this.Xb&&this.Xb.stop();if(a){if(!this.L&&this.Hd()){this.h||g(Error("Caller must call setElement before trying to show the popup"));this.ja();a=Yd(this.h);this.Rf&&Ce(this.ba,a,"keydown",this.cg,o);if(this.Af)if(Ce(this.ba,a,"mousedown",this.Ne,o),E){var b;try{b=a.activeElement}catch(c){}for(;b&&"IFRAME"==b.nodeName;){try{var d=b.contentDocument||b.contentWindow.document}catch(f){break}a=d;b=a.activeElement}Ce(this.ba,a,"mousedown",this.Ne,o);Ce(this.ba,a,
"deactivate",this.Me)}else Ce(this.ba,a,"blur",this.Me);"toggle_display"==this.sb?(this.h.style.visibility="visible",we(this.h,o)):"move_offscreen"==this.sb&&this.ja();this.L=o;this.gc?(oc(this.gc,"end",this.Pe,r,this),this.gc.play()):this.Pe()}}else rf(this)};w.ja=ga;function rf(a,b){if(!a.L||!a.dispatchEvent({type:"beforehide",target:b}))return r;a.ba&&a.ba.Lc();a.Xb?(oc(a.Xb,"end",xa(a.ie,b),r,a),a.Xb.play()):a.ie(b);return o}
w.ie=function(a){"toggle_display"==this.sb?this.Qg?lf(this.xe,0,this):this.xe():"move_offscreen"==this.sb&&(this.h.style.left="-200px",this.h.style.top="-200px");this.L=r;this.Id(a)};w.xe=function(){this.h.style.visibility="hidden";we(this.h,r)};w.Hd=function(){return this.dispatchEvent("beforeshow")};w.Pe=function(){this.Cd=ya();this.dispatchEvent("show")};w.Id=function(a){ya();this.dispatchEvent({type:"hide",target:a})};
w.Ne=function(a){a=a.target;!he(this.h,a)&&(!this.fe||he(this.fe,a))&&!(150>ya()-this.Cd)&&rf(this,a)};w.cg=function(a){27==a.keyCode&&rf(this,a.target)&&(a.preventDefault(),a.stopPropagation())};w.Me=function(a){if(this.Jf){var b=Yd(this.h);if(E||Ra){if(a=b.activeElement,!a||he(this.h,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>ya()-this.Cd||rf(this)}};w.t=function(){qf.C.t.call(this);this.ba.Z();Sb(this.gc);Sb(this.Xb);delete this.h;delete this.ba};function sf(a,b){this.rd=a instanceof V?a:new V(a,b)}C(sf,of);sf.prototype.ja=function(a,b,c,d){mf(ne(a),0,a,b,this.rd,c,q,d)};function tf(a,b){this.wg=4;this.Kd=b||n;qf.call(this,a)}C(tf,qf);tf.prototype.Oc=function(a){this.Kd=a||n;this.L&&this.ja()};tf.prototype.ja=function(){if(this.Kd){var a=!this.L&&"move_offscreen"!=this.sb,b=this.e();a&&(b.style.visibility="hidden",we(b,o));this.Kd.ja(b,this.wg,this.Ch);a&&we(b,r)}};function uf(a,b,c){this.ga=c||(a?Wd(Zd(a)):Wd());tf.call(this,this.ga.kb("div",{style:"position:absolute;display:none;"}));this.sd=new V(1,1);this.Wa=new Nb;a&&vf(this,a);if(b!=q)if(a=this.e(),"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(Yd(a).createTextNode(b))}}C(uf,tf);var wf=[];w=uf.prototype;w.I=q;w.className="goog-tooltip";
w.af=500;w.Qf=0;w.zc=t("ga");function vf(a,b){b=Zd(b);a.Wa.add(b);G(b,"mouseover",a.ue,r,a);G(b,"mouseout",a.Cc,r,a);G(b,"mousemove",a.te,r,a);G(b,"focus",a.se,r,a);G(b,"blur",a.Cc,r,a)}w.detach=function(a){if(a)a=Zd(a),xf(this,a),this.Wa.remove(a);else{for(var b=this.Wa.aa(),c=0;a=b[c];c++)xf(this,a);this.Wa.clear()}};function xf(a,b){pc(b,"mouseover",a.ue,r,a);pc(b,"mouseout",a.Cc,r,a);pc(b,"mousemove",a.te,r,a);pc(b,"focus",a.se,r,a);pc(b,"blur",a.Cc,r,a)}
w.Ld=function(a){var b=this.e();b&&fe(b);uf.C.Ld.call(this,a);a&&(b=this.ga.u.body,b.insertBefore(a,b.lastChild))};w.Hd=function(){if(!qf.prototype.Hd.call(this))return r;if(this.anchor)for(var a,b=0;a=wf[b];b++)he(a.e(),this.anchor)||a.p(r);0<=pb(wf,this)||wf.push(this);a=this.e();a.className=this.className;yf(this);G(a,"mouseover",this.we,r,this);G(a,"mouseout",this.ve,r,this);zf(this);return o};
w.Id=function(){ub(wf,this);for(var a=this.e(),b,c=0;b=wf[c];c++)b.anchor&&he(a,b.anchor)&&b.p(r);this.Se&&Af(this.Se);pc(a,"mouseover",this.we,r,this);pc(a,"mouseout",this.ve,r,this);this.anchor=n;if(0==(this.ua?this.L?4:1:this.lb?3:this.L?2:0))this.Nc=r;qf.prototype.Id.call(this)};w.Ke=function(a,b){this.anchor==a&&this.Wa.contains(this.anchor)&&(this.Nc||!this.Dh?(this.p(r),this.L||(this.anchor=a,this.Oc(b||Bf(this,0)),this.p(o))):this.anchor=n);this.ua=n};
w.$f=function(a){this.lb=n;a==this.anchor&&(this.I==q||this.I!=this.e()&&!this.Wa.contains(this.I))&&(!this.ge||!this.ge.I)&&this.p(r)};function Cf(a,b){var c=je(a.ga);a.sd.x=b.clientX+c.x;a.sd.y=b.clientY+c.y}w.ue=function(a){var b=Df(this,a.target);this.I=b;yf(this);b!=this.anchor&&(this.anchor=b,this.ua||(this.ua=lf(wa(this.Ke,this,b,n),this.af)),Ef(this),Cf(this,a))};function Df(a,b){try{for(;b&&!a.Wa.contains(b);)b=b.parentNode;return b}catch(c){return q}}
w.te=function(a){Cf(this,a);this.Nc=o};w.se=function(a){this.I=a=Df(this,a.target);this.Nc=o;if(this.anchor!=a){this.anchor=a;var b=Bf(this,1);yf(this);this.ua||(this.ua=lf(wa(this.Ke,this,a,b),this.af));Ef(this)}};function Bf(a,b){if(0==b){var c=a.sd.d();return new Ff(c)}return new Gf(a.I)}function Ef(a){if(a.anchor)for(var b,c=0;b=wf[c];c++)he(b.e(),a.anchor)&&(b.ge=a,a.Se=b)}
w.Cc=function(a){var b=Df(this,a.target),c=Df(this,a.relatedTarget);b!=c&&(b==this.I&&(this.I=q),zf(this),this.Nc=r,this.L&&(!a.relatedTarget||!he(this.e(),a.relatedTarget))?Af(this):this.anchor=n)};w.we=function(){var a=this.e();this.I!=a&&(yf(this),this.I=a)};w.ve=function(a){var b=this.e();if(this.I==b&&(!a.relatedTarget||!he(b,a.relatedTarget)))this.I=q,Af(this)};function zf(a){a.ua&&(kf.clearTimeout(a.ua),a.ua=n)}
function Af(a){if(2==(a.ua?a.L?4:1:a.lb?3:a.L?2:0))a.lb=lf(wa(a.$f,a,a.anchor),a.Qf)}function yf(a){a.lb&&(kf.clearTimeout(a.lb),a.lb=n)}w.t=function(){this.p(r);zf(this);this.detach();this.e()&&fe(this.e());this.I=q;delete this.ga;uf.C.t.call(this)};function Ff(a,b){sf.call(this,a,b)}C(Ff,sf);Ff.prototype.ja=function(a,b,c){b=ne(a);b=qe(b);c=c?new Rd(c.top+10,c.right,c.bottom,c.left+10):new Rd(10,0,0,10);nf(this.rd,a,4,c,b,9)&496&&nf(this.rd,a,4,c,b,5)};function Gf(a){pf.call(this,a,3)}C(Gf,pf);
Gf.prototype.ja=function(a,b,c){var d=new V(10,0);mf(this.element,this.je,a,b,d,c,9)&496&&mf(this.element,2,a,1,d,c,5)};function Hf(a){this.h=a;this.Ee=G(this.h,Sa?"DOMMouseScroll":"mousewheel",this)}C(Hf,Wc);
Hf.prototype.handleEvent=function(a){var b=0,c=0,d=0,a=a.ha;if("mousewheel"==a.type){c=1;if(E||F&&(Ma||fb("532.0")))c=40;d=F&&La&&0!=-a.wheelDelta%c?-a.wheelDelta:-a.wheelDelta/c;ia(a.wheelDeltaX)?(b=F&&La&&0!=-a.wheelDeltaX%c?-a.wheelDeltaX:-a.wheelDeltaX/c,c=F&&La&&0!=-a.wheelDeltaY%c?-a.wheelDeltaY:-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;z(this.Ie)&&Math.min(Math.max(b,-this.Ie),this.Ie);z(this.Je)&&(c=Math.min(Math.max(c,-this.Je),
this.Je));b=new If(d,a,0,c);try{this.dispatchEvent(b)}finally{b.Z()}};Hf.prototype.t=function(){Hf.C.t.call(this);qc(this.Ee);delete this.Ee};function If(a,b,c,d){b&&this.ra(b,n);this.type="mousewheel";this.detail=a;this.td=d}C(If,hc);E||F&&fb("525");function Jf(a){(!x(a)||!(a instanceof Element))&&g(Error("Could not add interactor to the given element."));Q.call(this);this._className="interactor";this.eb=a;this.cd=this.Vd=this.Ud=this.Wd=this.Td=this.Xd=q;this.bd=o;this.rightButtonDown=this.middleButtonDown=this.leftButtonDown=r;this.Zc=new Jc(0,0);this.config={MOUSEWHEEL_ENABLED:o,MOUSECLICKS_ENABLED:o,KEYBOARD_ENABLED:o,HOVERING_ENABLED:o,CONTEXTMENU_ENABLED:r}}C(Jf,Q);w=Jf.prototype;
w.ra=function(){this.config.MOUSEWHEEL_ENABLED?(this.cd=new Hf(this.eb),this.Xd=G(this.cd,"mousewheel",this.og.bind(this))):(qc(this.Xd),this.cd=q);this.config.MOUSEWHEEL_ENABLED?(this.Td=G(this.eb,"mousedown",this.hg.bind(this)),this.Wd=G(this.eb,"mouseup",this.mg.bind(this))):(qc(this.Td),qc(this.Wd));this.eb.oncontextmenu=this.config.CONTEXTMENU_ENABLED?q:function(){return r};window.onkeydown=this.config.KEYBOARD_ENABLED?this.Oe.bind(this):q;qc(this.Ud);qc(this.Vd);this.Ud=G(this.eb,"mousemove",
this.jg.bind(this));this.Vd=G(this.eb,"mouseout",this.kg.bind(this))};w.hg=function(a){0==a.button?this.leftButtonDown=o:1==a.button?this.middleButtonDown=o:2==a.button&&(this.rightButtonDown=o);eval("this.onMouseDown(this['leftButtonDown'],this['middleButtonDown'],this['rightButtonDown'])");Kf(this);a.preventDefault()};w.gg=ba();
w.mg=function(a){0==a.button?this.leftButtonDown=r:1==a.button?this.middleButtonDown=r:2==a.button&&(this.rightButtonDown=r);eval("this.onMouseUp(this['leftButtonDown'],this['middleButtonDown'],this['rightButtonDown'])");Kf(this);a.preventDefault()};w.lg=ba();w.kg=function(a){this.bd=r;this.config.KEYBOARD_ENABLED&&(window.onkeydown=q);this.rightButtonDown=this.middleButtonDown=this.leftButtonDown=r;Kf(this);this.Zc=new Jc(0,0);a.preventDefault()};w.ig=ba();
w.jg=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.bd=o;this.config.KEYBOARD_ENABLED&&window.onkeydown==q&&(window.onkeydown=this.Oe.bind(this));a.preventDefault();var b=a.shiftKey,c=new Jc(a.offsetX,a.offsetY),a=this.Zc.ka(c);this.Zc=c.d();this.config.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.middleButtonDown||this.leftButtonDown||this.rightButtonDown)&&Kf(this),this.Vc=setTimeout(function(){Kf(this);var a=new Nc;a.tc=c.x;a.uc=c.y;this.dispatchEvent(a);
this.Vc=q}.bind(this),300));2>Math.abs(a.x)&&(a.x=0);2>Math.abs(a.y)&&(a.y=0);0!=a.Ya()&&(this.leftButtonDown&&!b?(b=new Kc,b.cb=a,b.Ah=0,this.dispatchEvent(b)):this.middleButtonDown||this.leftButtonDown&&b?(b=new Ic,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.cb=a,this.dispatchEvent(b)):this.rightButtonDown&&(b=new Lc,b.Ra=0<a.y,b.xa=r,this.dispatchEvent(b)))};function Kf(a){a.Vc&&clearTimeout(a.Vc);a.dispatchEvent(new Oc)}w.ng=ba();
w.og=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");Kf(this);a.preventDefault();var b=new Lc;x(a.td)||(a.td=0);b.Ra=0>a.td;b.xa=o;this.dispatchEvent(b)};w.eg=ba();
w.Oe=function(a){if(this.bd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");Kf(this);var b=a.altKey,c=a.ctrlKey,d=a.metaKey,f=a.shiftKey,e=a.keyCode;if(82==e&&!b&&!c&&!d&&!f)a.preventDefault(),a=new Pc,this.dispatchEvent(a);else if(37<=e&&40>=e&&(a.preventDefault(),a=f?new Ic:b?new Lc:new Kc))c=new Jc(0,0),37==e?(c.x=5,b&&(a.Ra=o,a.xa=r)):39==e?(c.x=-5,b&&(a.Ra=r,a.xa=r)):38==e?(c.y=5,b&&(a.Ra=o,a.xa=o)):40==e&&(c.y=-5,b&&(a.Ra=r,a.xa=o)),a.cb=c,this.dispatchEvent(a)}};A("X.interactor",Jf);
A("X.interactor.prototype.onMouseDown",Jf.prototype.gg);A("X.interactor.prototype.onMouseUp",Jf.prototype.lg);A("X.interactor.prototype.onMouseMove",Jf.prototype.ig);A("X.interactor.prototype.onMouseWheel",Jf.prototype.ng);A("X.interactor.prototype.onKey",Jf.prototype.eg);function Lf(a,b,c,d){x(a)||g(Error("No valid parent element."));(!z(b)||!z(c))&&g(Error("Invalid coordinates."));(!x(d)||!(d instanceof Jf))&&g(Error("Invalid interactor."));uf.call(this);this._className="caption";this.Ia=a;this.tc=b;this.uc=c;this.gb=d;this.oa=q;this.Oa=[];this.Oa=[".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n border: 1px solid infotext;\n padding: 1px;\n font-family: sans-serif;\n}"];oc(d,Hc,this.Bd.bind(this));this.Ad()}C(Lf,uf);
Lf.prototype.Ad=function(){this.Ia.style.position="relative";var a=document.getElementsByTagName("head")[0],b=be("style");b.type="text/css";b.media="screen";var c=document.createTextNode(this.Oa[0]);a.appendChild(b);b.appendChild(c);this.oa=b;this.Oc(new sf(this.tc,this.uc));this.p(o);vf(this,this.Ia);this.e().classList.add("x-tooltip")};Lf.prototype.Bd=function(){this.p(r);this.oa&&fe(this.oa);this.e()&&fe(this.e());this.oa=q};function Mf(a,b){(!z(a)||!z(b))&&g(Error("A camera needs valid width and height values."));Q.call(this);this._className="camera";this.sf=45;this.nc=new M(0,0,100);this.wb=new M(0,0,0);this.Ta=new M(0,1,0);var c=Float32Array,d;d=a/b;var f=1*Math.tan(this.sf*Math.PI/360),e=-f;d=new Z([[2/(f*d-e*d),0,(f*d+e*d)/(f*d-e*d),0],[0,2/(f-e),(f+e)/(f-e),0],[0,0,-10001/9999,-2.000200020002],[0,0,-1,0]]);this.uf=new c(d.A());this.l=Nf(this,this.nc,this.wb);this.Qa=new Float32Array(this.l.A())}C(Mf,Q);w=Mf.prototype;
w.tg=function(a){a instanceof Lc||g(Error("Received no valid zoom event."));a.Ra?this.mf(a.xa):this.nf(a.xa)};w.pg=function(a){a instanceof Ic||g(Error("Received no valid pan event."));this.Re(a.cb)};w.rg=function(a){a instanceof Kc||g(Error("Received no valid rotate event."));this.rotate(a.cb)};w.view=t("l");w.Ng=function(a){(!x(a)||!(a instanceof Z))&&g(Error("Invalid view matrix."));this.l=a;this.Qa=new Float32Array(this.l.A())};w.position=t("nc");
w.Oc=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The position was invalid."));this.nc=new M(a,b,c);this.reset()};w.reset=function(){this.l=Nf(this,this.nc,this.wb);this.Qa=new Float32Array(this.l.A())};w.focus=t("wb");w.Gg=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The focus was invalid."));this.wb=new M(a,b,c);this.reset()};w.ah=t("Ta");w.Mg=function(a,b,c){(!z(a)||!z(b)||!z(c))&&g(Error("The up-vector was invalid."));this.Ta=new M(a,b,c);this.reset()};
w.Re=function(a){a instanceof Jc||g(Error("Invalid distance vector for pan operation."));a=new M(-a.x,a.y,0);a=Ad(4).translate(a);this.l=new Z(a.multiply(this.l));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Mc)};
w.rotate=function(a){a instanceof Array&&2==a.length?a=new Jc(a[0],a[1]):a instanceof Jc||g(Error("Invalid distance vector for rotate operation."));var b=-a.x/5*Math.PI/180,a=-a.y/5*Math.PI/180,c=Ad(4),d=new M(parseFloat(xd(this.l,0,0)),parseFloat(xd(this.l,0,1)),parseFloat(xd(this.l,0,2))),b=c.rotate(b,new M(parseFloat(xd(this.l,1,0)),parseFloat(xd(this.l,1,1)),parseFloat(xd(this.l,1,2)))),a=c.rotate(a,d);this.l=new Z(this.l.multiply(a.multiply(b)));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Mc)};
w.mf=function(a){var b=20;x(a)&&!a&&(b=1);a=new M(0,0,b);a=Ad(4).translate(a);this.l=new Z(a.multiply(this.l));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Mc)};w.nf=function(a){var b=30;x(a)&&!a&&(b=1);a=new M(0,0,-b);a=Ad(4).translate(a);this.l=new Z(a.multiply(this.l));this.Qa=new Float32Array(this.l.A());this.dispatchEvent(new Mc)};
function Nf(a,b,c){(!(b instanceof M)||!(c instanceof M))&&g(Error("3D vectors required for calculating the view."));var d=Ad(4),c=new M(b.x-c.x,b.y-c.y,b.b-c.b),c=c.normalize(),a=a.Ta.d();a.Pb(c)&&(a.b+=1.0E-6);var f=Vc(a,c),a=Vc(c,f),f=f.normalize(),a=a.normalize();W(d,0,0,f.x);W(d,0,1,f.y);W(d,0,2,f.b);W(d,0,3,0);W(d,1,0,a.x);W(d,1,1,a.y);W(d,1,2,a.b);W(d,1,3,0);W(d,2,0,c.x);W(d,2,1,c.y);W(d,2,2,c.b);W(d,2,3,0);W(d,3,0,0);W(d,3,1,0);W(d,3,2,0);W(d,3,3,1);b=b.d();return d.translate(b.B())}
A("X.camera",Mf);A("X.camera.prototype.view",Mf.prototype.view);A("X.camera.prototype.setView",Mf.prototype.Ng);A("X.camera.prototype.position",Mf.prototype.position);A("X.camera.prototype.setPosition",Mf.prototype.Oc);A("X.camera.prototype.focus",Mf.prototype.focus);A("X.camera.prototype.setFocus",Mf.prototype.Gg);A("X.camera.prototype.up",Mf.prototype.ah);A("X.camera.prototype.setUp",Mf.prototype.Mg);A("X.camera.prototype.pan",Mf.prototype.Re);A("X.camera.prototype.rotate",Mf.prototype.rotate);
A("X.camera.prototype.zoomIn",Mf.prototype.mf);A("X.camera.prototype.zoomOut",Mf.prototype.nf);function $(a){x(a)||g(Error("An ID to a valid container (<div>..) is required."));a=Zd(a);(!(na(a)&&1==a.nodeType)||0==a.clientWidth||0==a.clientHeight)&&g(Error("Could not find the given container or it has an undefined size."));Q.call(this);this._className="renderer";this.wa=a;this.Nb=this.wa.clientWidth;this.fb=this.wa.clientHeight;this.gb=this.m=this.gd=this.hd=this.a=this.ma=q;this.Ha=new Xe(Id);this.Ib=[];this.Bb=this.Eb=this.Ab=this.Db=this.zb=this.Cb=q;this.j=[0,0,0];this.Yd=q;this.Tc=new Jb;
this.Jb=new Jb;this.Kb=new Jb;this.dd=new Jb;this.kc=new Jb;this.qc=new Jb;this.kd=new Jb;this.fa=this.yb=q;this.$c=r;this.config={PROGRESSBAR_ENABLED:o,PICKING_ENABLED:o,ORDERING_ENABLED:o,STATISTICS_ENABLED:r};window.console.log("XTK Release 3b -- 03/31/12 -- http://www.goXTK.com")}C($,Q);w=$.prototype;w.width=t("Nb");w.height=t("fb");w.canvas=function(){x(this.ma)||(this.ma=be("canvas"));return this.ma};w.Ef=t("wa");w.Bf=t("m");w.Uf=t("gb");
function Of(a){x(a.yb)||(a.yb=new Nd,G(Of(a),Ec,a.qg.bind(a)));return a.yb}w.qg=function(a){this.fa&&this.fa.Qc(100*a.de)};w.fg=function(a){x(a)&&a instanceof Qc&&Pf(this,a.Ga)};w.dg=function(a){if(x(a)&&a instanceof Nc){var b=a.tc,a=a.uc,c=this.get(this.Te(b,a));if(c&&(c=c.caption()))(new Lf(this.wa,this.wa.offsetLeft+b+10,this.wa.offsetTop+a+10,this.gb)).e().innerHTML=c}};w.yg=function(){this.Bb=this.Eb=this.Ab=this.Db=this.zb=this.Cb=q;this.j=[0,0,0]};
function Qf(a){a.config.PROGRESSBAR_ENABLED&&a.fa&&!a.$d&&(Pe(a.fa),a.$d=lf(function(){this.$d=q;this.fa&&(this.fa.Bd(),this.fa=q);this.cc()}.bind(a),700))}w.Xe=function(){this.m.reset();this.qb(r,r)};
w.ra=function(){var a=this.canvas();a.width=this.width();a.height=this.height();this.wa.appendChild(a);try{var b=a.getContext("experimental-webgl");b||g(Error())}catch(c){alert("WebGL not supported! See http://wiki.goXTK.com/index.php/X:Browsers for instructions.."),g(Error("WebGL not supported! See http://wiki.goXTK.com/index.php/X:Browsers for instructions.."))}try{if(b.viewport(0,0,this.width(),this.height()),b.clearColor(0,0,0,0),b.enable(b.BLEND),b.blendEquation(b.FUNC_ADD),b.blendFunc(b.SRC_ALPHA,
b.ONE_MINUS_SRC_ALPHA),b.enable(b.DEPTH_TEST),b.depthFunc(b.LEQUAL),b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT),this.config.PICKING_ENABLED){var d=b.createFramebuffer(),f=b.createRenderbuffer(),e=b.createTexture();b.bindTexture(b.TEXTURE_2D,e);b.texImage2D(b.TEXTURE_2D,0,b.RGB,this.width(),this.height(),0,b.RGB,b.UNSIGNED_BYTE,q);b.bindFramebuffer(b.FRAMEBUFFER,d);b.bindRenderbuffer(b.RENDERBUFFER,f);b.renderbufferStorage(b.RENDERBUFFER,b.DEPTH_COMPONENT16,this.width(),this.height());b.bindRenderbuffer(b.RENDERBUFFER,
q);b.framebufferTexture2D(b.FRAMEBUFFER,b.COLOR_ATTACHMENT0,b.TEXTURE_2D,e,0);b.framebufferRenderbuffer(b.FRAMEBUFFER,b.DEPTH_ATTACHMENT,b.RENDERBUFFER,f);b.bindFramebuffer(b.FRAMEBUFFER,q);this.Yd=d}}catch(h){g(Error("Exception while accessing GL Context!\n"+h))}d=new Jf(a);d.ra();G(d,Dc,this.Xe.bind(this));G(d,Gc,this.dg.bind(this));f=new Mf(this.width(),this.height());(!x(d)||!(d instanceof Jf))&&g(Error("Could not observe the interactor."));G(d,zc,f.pg.bind(f));G(d,Ac,f.rg.bind(f));G(d,Bc,f.tg.bind(f));
G(f,Cc,this.qb.bind(this,r,r));this.ma=a;this.a=b;this.m=f;this.gb=d;Rf(this)};
function Rf(a){var b=new Re;(!x(a.ma)||!x(a.a)||!x(a.m))&&g(Error("Renderer was not initialized properly."));(!x(b)||!(b instanceof Re))&&g(Error("Could not add shaders."));Ue(b);var c=a.a.createShader(a.a.FRAGMENT_SHADER),d=a.a.createShader(a.a.VERTEX_SHADER);a.a.shaderSource(c,b.mc);a.a.shaderSource(d,b.sc);a.a.compileShader(c);a.a.compileShader(d);a.a.getShaderParameter(c,a.a.COMPILE_STATUS)||g(Error("Fragement Shader compilation failed!\n"+a.a.getShaderInfoLog(c)));a.a.getShaderParameter(d,a.a.COMPILE_STATUS)||
g(Error("Vertex Shader compilation failed!\n"+a.a.getShaderInfoLog(d)));var f=a.a.createProgram();a.a.attachShader(f,d);a.a.attachShader(f,c);a.a.linkProgram(f);a.a.getProgramParameter(f,a.a.LINK_STATUS)||g(Error("Could not create shader program!\n"+a.a.getShaderInfoLog(c)+"\n"+a.a.getShaderInfoLog(d)+"\n"+a.a.getProgramInfoLog(f)));a.a.useProgram(f);a.gd=f;Object.keys(Se).forEach(function(a){a=eval("X.shaders.attributes."+a);this.Tc.set(a,this.a.getAttribLocation(this.gd,a));this.a.enableVertexAttribArray(this.Tc.get(a))}.bind(a));
Object.keys(Te).forEach(function(a){a=eval("X.shaders.uniforms."+a);this.Jb.set(a,this.a.getUniformLocation(this.gd,a))}.bind(a));a.hd=b}w.add=function(a){this.Ib.push(a);Pf(this,a)};
function Pf(a,b){(!x(a.ma)||!x(a.a)||!x(a.m))&&g(Error("Renderer was not initialized properly."));(!x(b)||!(b instanceof I))&&g(Error("Illegal object."));var c=r;a.get(b.id())&&(c=o);tc(b)||G(b,uc,a.fg.bind(a));var d=b.id(),f=b.k,e=b.o,h=b.W,i=b.S,j=b.file(),p=b.transform();if(x(i)&&x(i.file())&&i.file().c)c=Of(a),x(b.S)||g(Error("Internal error during texture loading.")),d=new Image,i=b.S.file().path(),d.src=i,b.S.Sd=d,oc(d,"load",c.Yf.bind(c,b)),Od(c).set(b.id(),r),Qd(c,0.3);else if(x(j)&&j.c)c=
Of(a),x(b.file())||g(Error("Internal error during file loading.")),b.k.clear(),b.o.clear(),d=b.file().path(),i=d.split(".").pop(),i=i.toUpperCase(),"TRK"==i||"STL"==i||"FSM"==i||"VTK"==i||"NRRD"==i||g(Error("The "+i+" file format is not supported.")),i=new XMLHttpRequest,G(i,"abort",c.Fe.bind(c,i,b)),G(i,"error",c.Fe.bind(c,i,b)),G(i,"load",c.Xf.bind(c,i,b)),i.open("GET",d,o),i.overrideMimeType("text/plain; charset=x-user-defined"),i.setRequestHeader("Content-Type","text/plain"),i.send(q),Od(c).set(b.id(),
r);else{if(b.c&&b.Wb())for(var j=b.children(),k=j.length,m=0,m=0;m<k;m++)Pf(a,j[m]);if(0==f.count())Xc(b);else{for(j=0;a.$c;)j++;a.$c=o;if(f.c||p.c){k=p.f;j=k.ca(new M(f.Da,f.Ea,f.Fa));k=k.ca(new M(f.Aa,f.Ba,f.Ca));if(a.Cb===q||j.x<a.Cb)a.Cb=j.x;if(a.zb===q||k.x>a.zb)a.zb=k.x;if(a.Db===q||j.y<a.Db)a.Db=j.y;if(a.Ab===q||k.y>a.Ab)a.Ab=k.y;if(a.Eb===q||j.b<a.Eb)a.Eb=j.b;if(a.Bb===q||k.b>a.Bb)a.Bb=k.b;a.j=[(a.Cb+a.zb)/2,(a.Db+a.Ab)/2,(a.Eb+a.Bb)/2];Xc(p)}c&&f.c&&(p=a.Kb.get(d),x(p)&&a.a.isBuffer(p.R)&&
a.a.deleteBuffer(p.R));p=q;!c||f.c?(p=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,p),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(f.all()),a.a.STATIC_DRAW),p=new jf(p,f.count(),3),Xc(f)):p=a.Kb.get(d);Qd(Of(a),0.3);c&&e.c&&(j=a.Kb.get(d),x(j)&&a.a.isBuffer(j.R)&&a.a.deleteBuffer(j.R));j=q;!c||e.c?(j=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,j),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(e.all()),a.a.STATIC_DRAW),j=new jf(j,e.count(),3),Xc(e)):j=a.dd.get(d);Qd(Of(a),0.3);c&&
h.c&&(e=a.kc.get(d),x(e)&&a.a.isBuffer(e.R)&&a.a.deleteBuffer(e.R));e=q;0<h.length()&&(!c||h.c?(h.length()!=f.length()&&g(Error("Mismatch between points and point colors.")),f=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,f),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(h.all()),a.a.STATIC_DRAW),e=new jf(f,h.count(),3),Xc(h)):e=a.kc.get(d));Qd(Of(a),0.3);c&&x(i)&&i.c&&(h=a.qc.get(d),x(h)&&a.a.isBuffer(h.R)&&a.a.deleteBuffer(h.R));h=q;x(i)&&(!c||i.c?(h=b.Sa,x(h)||g(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),
f=a.a.createTexture(),f.zd=i.zd(),a.kd.set(i.id(),f),a.a.bindTexture(a.a.TEXTURE_2D,f),i.Gb?(a.a.texImage2D(a.a.TEXTURE_2D,0,a.a.RGBA,i.pc,i.oc,0,a.a.RGBA,a.a.UNSIGNED_BYTE,i.Gb),a.a.texParameteri(a.a.TEXTURE_2D,a.a.TEXTURE_WRAP_S,a.a.CLAMP_TO_EDGE),a.a.texParameteri(a.a.TEXTURE_2D,a.a.TEXTURE_WRAP_T,a.a.CLAMP_TO_EDGE),a.a.pixelStorei(a.a.UNPACK_FLIP_Y_WEBGL,o)):(a.a.texImage2D(a.a.TEXTURE_2D,0,a.a.RGBA,a.a.RGBA,a.a.UNSIGNED_BYTE,f.zd),a.a.pixelStorei(a.a.UNPACK_FLIP_Y_WEBGL,r)),a.a.texParameteri(a.a.TEXTURE_2D,
a.a.TEXTURE_MAG_FILTER,a.a.LINEAR),a.a.texParameteri(a.a.TEXTURE_2D,a.a.TEXTURE_MIN_FILTER,a.a.LINEAR),a.a.bindTexture(a.a.TEXTURE_2D,q),f=a.a.createBuffer(),a.a.bindBuffer(a.a.ARRAY_BUFFER,f),a.a.bufferData(a.a.ARRAY_BUFFER,new Float32Array(h),a.a.STATIC_DRAW),h=new jf(f,h.length,2),Xc(i)):h=a.qc.get(d));Qd(Of(a),0.1);!c&&!a.Ha.add(b)&&g(Error("Could not add object to this renderer."));a.Kb.set(d,p);a.dd.set(d,j);a.kc.set(d,e);a.qc.set(d,h);Xc(b);a.$c=r}}}
w.cc=function(){(!this.ma||!this.a||!this.m)&&g(Error("The renderer was not initialized properly."));x(this.Zd)||(Pd(Of(this))?this.fa?(Qf(this),eval("this.onShowtime()")):this.qb(r,o):(this.config.PROGRESSBAR_ENABLED&&!this.fa&&(this.fa=new Oe(this.wa,3)),this.Zd=lf(function(){this.Zd=q;this.cc()}.bind(this),100)))};w.sg=ba();w.get=function(a){x(a)||g(Error("Invalid object id."));for(var b=this.Ha.aa(),c=0,d=b.length,c=0;c<d;c++)if(b[c].id()==a)return b[c];return q};
w.Te=function(a,b){if(this.config.PICKING_ENABLED){this.qb(o,r);var c=new Uint8Array(4);this.a.readPixels(a,this.fb-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);var d=Math.round(10*(c[0]/255)),f=Math.round(10*(c[1]/255)),c=Math.round(10*(c[2]/255));return 100*d+10*f+c}return-1};
w.qb=function(a,b){var c=this.Ha.aa(),d=c.length;if(0!=d){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.Yd):this.a.bindFramebuffer(this.a.FRAMEBUFFER,q);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var f=this.m.uf,e=this.m.Qa;this.a.uniformMatrix4fv(this.Jb.get("perspective"),r,f);this.a.uniformMatrix4fv(this.Jb.get("view"),r,e);f=this.j;this.a.uniform3f(this.Jb.get("center"),parseFloat(f[0]),parseFloat(f[1]),parseFloat(f[2]));if(this.config.ORDERING_ENABLED)a:{var h=r,f=this.Ha.aa(),
e=f.length,i;i=e-1;do{var j=f[i];if(!j)break a;var p=j._opacity,k=j.Lb;j instanceof Qe&&(p=k&&k._volumeRendering?j._opacity=j.Lb._opacity:j._opacity=1);1!=p&&(h=j.k.jc,j=this.m.l.ca(j.rc.f.ca(new M(h[0],h[1],h[2]))),j=Tc(this.m.wb,j),f[i].xc=j,h=o)}while(i--);if(h){this.Ha.clear();i=e-1;do this.Ha.add(f[i]);while(i--)}}if(f=!a&&x(b)&&b&&this.config.STATISTICS_ENABLED)var m=0,l=0,s=0,v=0;i=this.Ib.length;for(e=0;e<i;++e)if(j=this.Ib[e],j instanceof Ve){var u=new M(1,0,0),u=this.m.view().ca(u),h=Tc(this.m.focus(),
u),u=new M(-1,0,0),u=this.m.view().ca(u),p=Tc(this.m.focus(),u),u=new M(0,1,0),u=this.m.view().ca(u),k=Tc(this.m.focus(),u),u=new M(0,-1,0),u=this.m.view().ca(u),B=Tc(this.m.focus(),u),u=new M(0,0,1),u=this.m.view().ca(u),D=Tc(this.m.focus(),u),u=new M(0,0,-1),u=this.m.view().ca(u),u=Tc(this.m.focus(),u),L=Math.max(h,k,D,p,B,u);L==h||L==p?We(j,0):L==k||L==B?We(j,1):(L==D||L==u)&&We(j,2)}e=this.Tc;i=e.get("vertexPosition");var j=e.get("vertexNormal"),h=e.get("vertexColor"),p=e.get("vertexTexturePos"),
e=this.Jb,k=e.get("usePicking"),B=e.get("useObjectColor"),D=e.get("objectColor"),u=e.get("objectOpacity"),L=e.get("useTexture"),K=e.get("useTextureThreshold"),J=e.get("textureSampler"),ea=e.get("volumeLowerThreshold"),aa=e.get("volumeUpperThreshold"),fa=e.get("volumeScalarMin"),ib=e.get("volumeScalarMax"),Fc=e.get("objectTransform"),Ya=e.get("pointSize"),e=d;do{var P=c[d-e];if(P){var N=q;P instanceof Qe&&P.Lb&&(N=P.Lb);if(P._visible&&(!N||N._visible)){var la=P._id,O=P._magicMode,Y=this.Kb.get(la),
Ba=this.dd.get(la),ra=this.kc.get(la),Eb=this.qc.get(la);this.a.bindBuffer(this.a.ARRAY_BUFFER,Y.R);this.a.vertexAttribPointer(i,Y.hb,this.a.FLOAT,r,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,Ba.R);this.a.vertexAttribPointer(j,Ba.hb,this.a.FLOAT,r,0,0);a?this.a.uniform1i(k,o):this.a.uniform1i(k,r);ra&&!a&&!O?(this.a.uniform1i(B,r),this.a.bindBuffer(this.a.ARRAY_BUFFER,ra.R),this.a.vertexAttribPointer(h,ra.hb,this.a.FLOAT,r,0,0)):(Ba=1,O&&!a&&(Ba=0),this.a.uniform1i(B,Ba),O=P._color,a&&(999<la&&g(Error("Id out of bounds.")),
O=Math.floor(0.01*la),Ba=Math.floor(0.1*la)-10*O,O=[O/10,Ba/10,(la-100*O-10*Ba)/10]),this.a.uniform3f(D,parseFloat(O[0]),parseFloat(O[1]),parseFloat(O[2])),this.a.vertexAttribPointer(h,Y.hb,this.a.FLOAT,r,0,0));this.a.uniform1f(u,parseFloat(P._opacity));P.S&&Eb&&!a?(this.a.uniform1i(L,o),this.a.activeTexture(this.a.TEXTURE0),this.a.bindTexture(this.a.TEXTURE_2D,this.kd.get(P.S._id)),this.a.uniform1i(J,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,Eb.R),this.a.vertexAttribPointer(p,Eb.hb,this.a.FLOAT,r,
0,0),this.a.uniform1i(K,r)):(this.a.uniform1i(L,r),this.a.vertexAttribPointer(p,Y.hb,this.a.FLOAT,r,0,0));N&&(this.a.uniform1i(K,o),this.a.uniform1f(ea,N._lowerThreshold),this.a.uniform1f(aa,N._upperThreshold),la=N.Hb,this.a.uniform1f(fa,la[0]),this.a.uniform1f(ib,la[1]),N._volumeRendering&&this.a.uniform1f(u,parseFloat(N._opacity)));this.a.uniformMatrix4fv(Fc,r,P.rc.na);N=1;"POINTS"==P._type&&(N=P._pointSize);this.a.uniform1f(Ya,N);N=-1;P.type()==Fd?(N=this.a.TRIANGLES,f&&(l+=Y.za/3)):P.type()==
dd?(this.a.lineWidth(P.lineWidth()),N=this.a.LINES,f&&(s+=Y.za/2)):"POINTS"==P.type()?(N=this.a.POINTS,f&&(v+=Y.za)):"TRIANGLE_STRIPS"==P.type()?(N=this.a.TRIANGLE_STRIP,f&&(l+=Y.za/3)):"POLYGONS"==P.type()&&(N=0==Y.za%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(l+=Y.za/3));f&&(m+=Y.za);this.a.drawArrays(N,0,Y.za)}}}while(--e);f&&(c="Objects: "+d+" | "+("Vertices: "+m+" | ")+("Triangles: "+Math.round(l)+" | "),c=c+("Lines: "+s+" | ")+("Points: "+v+" | ")+("Textures: "+this.kd.$()),window.console.log(c))}};
w.Gf=function(){this.Ha.clear();delete this.Ha;this.Ib.length=0;delete this.Ib;this.hd=q;delete this.hd;this.yb=q;delete this.yb;this.m=q;delete this.m;this.gb=q;delete this.gb;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);this.a=q;delete this.a;fe(this.ma);delete this.ma};A("X.renderer",$);A("X.renderer.prototype.width",$.prototype.width);A("X.renderer.prototype.height",$.prototype.height);A("X.renderer.prototype.canvas",$.prototype.canvas);A("X.renderer.prototype.container",$.prototype.Ef);
A("X.renderer.prototype.camera",$.prototype.Bf);A("X.renderer.prototype.interactor",$.prototype.Uf);A("X.renderer.prototype.resetBoundingBox",$.prototype.yg);A("X.renderer.prototype.resetViewAndRender",$.prototype.Xe);A("X.renderer.prototype.init",$.prototype.ra);A("X.renderer.prototype.add",$.prototype.add);A("X.renderer.prototype.onShowtime",$.prototype.sg);A("X.renderer.prototype.get",$.prototype.get);A("X.renderer.prototype.pick",$.prototype.Te);A("X.renderer.prototype.render",$.prototype.cc);
A("X.renderer.prototype.destroy",$.prototype.Gf);function Sf(a){function b(a,b){var a=a*2*Math.PI,b=b*Math.PI,e=new S(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));h.push(new T(c.Za(e.va(d)),e))}this.i=[];for(var a=a||{},c=new S(a.od||[0,0,0]),d=a.ia||1,f=a.Nd||16,a=a.Rg||8,e=[],h,i=0;i<f;i++)for(var j=0;j<a;j++)h=[],b(i/f,j/a),0<j&&b((i+1)/f,j/a),j<a-1&&b((i+1)/f,(j+1)/a),b(i/f,(j+1)/a),e.push(new md(h));return od(e)}C(Sf,U);A("CSG.sphere",Sf);function Tf(a,b){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));z(b)||g(Error("Invalid radius."));I.call(this);this._className="Sphere";this.j=a;this.fd=b;this.jd=32;this.yf=16;this.pa()}C(Tf,I);Tf.prototype.pa=function(){Hd(this,new Sf({od:this.j,ia:this.fd,Nd:this.jd,Rg:this.yf}))};A("X.sphere",Tf);function Uf(a){function b(a,b,d){b=2*b*Math.PI;b=j.va(Math.cos(b)).Za(p.va(Math.sin(b)));a=c.Za(f.va(a)).Za(b.va(e));d=b.va(1-Math.abs(d)).Za(h.va(d));return new T(a,d)}this.i=[];for(var a=a||{},c=new S(a.start||[0,-1,0]),d=new S(a.end||[0,1,0]),f=d.mb(c),e=a.ia||1,a=a.Nd||16,h=f.tb(),i=0.5<Math.abs(h.y()),j=(new S(i,!i,0)).wc(h).tb(),p=j.wc(h).tb(),i=new T(c,h.Gc()),d=new T(d,h.tb()),k=[],m=0;m<a;m++){var l=m/a,s=(m+1)/a;k.push(new md([i,b(0,l,-1),b(0,s,-1)]));k.push(new md([b(0,s,0),b(0,l,0),b(1,
l,0),b(1,s,0)]));k.push(new md([d,b(1,s,1),b(1,l,1)]))}return od(k)}C(Uf,U);A("CSG.cylinder",Uf);function Vf(a,b,c){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid start position."));(!x(b)||!(b instanceof Array)||3!=b.length)&&g(Error("Invalid end position."));z(c)||g(Error("Invalid radius."));I.call(this);this._className="cylinder";this.zf=a;this.rf=b;this.fd=c;this.jd=32;this.pa()}C(Vf,I);Vf.prototype.pa=function(){Hd(this,new Uf({start:this.zf,end:this.rf,ia:this.fd,Nd:this.jd}))};A("X.cylinder",Vf);function Wf(a){this.i=[];var a=a||{},b=new S(a.od||[0,0,0]),c=!a.ia?[1,1,1]:a.ia.length?a.ia:[a.ia,a.ia,a.ia];return od([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(function(a){return new md(a[0].map(function(f){f=new S(b.x()+c[0]*(2*!!(f&1)-1),b.y()+c[1]*(2*!!(f&2)-1),b.b()+c[2]*(2*!!(f&4)-1));return new T(f,new S(a[1]))}))}))}C(Wf,U);A("CSG.cube",Wf);function Xf(a,b,c,d){(!x(a)||!(a instanceof Array)||3!=a.length)&&g(Error("Invalid center."));(!z(b)||!z(c)||!z(d))&&g(Error("Invalid radii."));I.call(this);this._className="cube";this.j=a;this.vf=b;this.wf=c;this.xf=d;this.Sa=[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];this.pa()}C(Xf,I);Xf.prototype.pa=function(){Hd(this,new Wf({od:this.j,ia:[this.vf,this.wf,this.xf]}))};A("X.cube",Xf);