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