xtk
Version:
The X Toolkit: WebGL™ for Scientific Visualization
130 lines • 194 kB
JavaScript
/*
*
* xxxxxxx xxxxxxx
* x:::::x x:::::x
* x:::::x x:::::x
* x:::::xx:::::x
* x::::::::::x
* x::::::::x
* x::::::::x
* x::::::::::x
* x:::::xx:::::x
* x:::::x x:::::x
* x:::::x x:::::x
* THE xxxxxxx xxxxxxx TOOLKIT
*
* http://www.goXTK.com
*
* Copyright (c) 2012 The X Toolkit Developers <dev@goXTK.com>
*
* The X Toolkit (XTK) is licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* "Free software" is a matter of liberty, not price.
* "Free" as in "free speech", not as in "free beer".
* - Richard M. Stallman
*
* FUELED BY:
* - the wonderful Constructive Solid Geometry library by Evan Wallace (http://madebyevan.com)
* LICENSE: https://raw.github.com/xtk/X/master/lib/csg/LICENSE
*
* - parts of the Google Closure Library (http://code.google.com/closure/library)
* LICENSE: https://raw.github.com/xtk/google-closure-library/master/LICENSE
*
* - zlib.js, the ultimate gzip/zlib javascript implementation (https://github.com/imaya/zlib.js)
* LICENSE: https://raw.github.com/imaya/zlib.js/master/LICENSE
*
* MORE CREDITS: https://raw.github.com/xtk/X/master/LICENSE
*
*/
function m(a){throw a;}var p=void 0,q=!0,t=null,u=!1;function aa(){return function(){}}function ba(a){return function(b){this[a]=b}}function v(a){return function(){return this[a]}}var w,fa=this;function ga(){}
function ha(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ia(a){return a!==p}function ja(a){return"array"==ha(a)}function ma(a){var b=ha(a);return"array"==b||"object"==b&&"number"==typeof a.length}function na(a){return"string"==typeof a}function x(a){return"number"==typeof a}function oa(a){return"function"==ha(a)}function pa(a){var b=typeof a;return"object"==b&&a!=t||"function"==b}function qa(a){return a[ra]||(a[ra]=++sa)}var ra="closure_uid_"+(1E9*Math.random()>>>0),sa=0;
function ta(a,b,c){return a.call.apply(a.bind,arguments)}function ua(a,b,c){a||m(Error());if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,e);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function va(a,b,c){va=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ta:ua;return va.apply(t,arguments)}
function wa(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}var xa=Date.now||function(){return+new Date};function A(a,b){var c=a.split("."),e=fa;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);for(var d;c.length&&(d=c.shift());)!c.length&&ia(b)?e[d]=b:e=e[d]?e[d]:e[d]={}}
function C(a,b){function c(){}c.prototype=b.prototype;a.u=b.prototype;a.prototype=new c;a.prototype.constructor=a};function ya(a,b,c){this.$a=this.Za=this.Ya=0;3==arguments.length?(this.Ya=Number(a),this.Za=Number(b),this.$a=Number(c)):a instanceof ya?(this.Ya=Number(a.x()),this.Za=Number(a.y()),this.$a=Number(a.d())):(this.Ya=Number(a[0]),this.Za=Number(a[1]),this.$a=Number(a[2]))}
ya.prototype={l:function(){return new ya(this.Ya,this.Za,this.$a)},ac:function(a){return this.Ya*a.x()+this.Za*a.y()+this.$a*a.d()},se:function(a,b){return za(this,Aa(Ca(a,this),b))},length:function(){return Math.sqrt(this.ac(this))},sc:function(a){return new ya(this.Za*a.d()-this.$a*a.y(),this.$a*a.x()-this.Ya*a.d(),this.Ya*a.y()-this.Za*a.x())},x:v("Ya"),y:v("Za"),d:v("$a")};function Da(a){var b=a.length();return new ya(a.Ya/b,a.Za/b,a.$a/b)}
function Aa(a,b){return new ya(a.Ya*b,a.Za*b,a.$a*b)}function Ca(a,b){return new ya(a.Ya-b.x(),a.Za-b.y(),a.$a-b.d())}function za(a,b){return new ya(a.Ya+b.x(),a.Za+b.y(),a.$a+b.d())}function Ea(a){return new ya(-a.Ya,-a.Za,-a.$a)};var D=D||{};D.zk=q;D.Ja=function(a){eval("X.DEV === undefined")||window.console.time(a)};D.Da=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.Wh=0;this.qk=function(){return this.Wh++}};function Fa(a,b){for(var c in b){var e=b.__lookupGetter__(c),d=b.__lookupSetter__(c);c in a||(e||d?(e&&a.__defineGetter__(c,e),d&&a.__defineSetter__(c,d)):a[c]=b[c])}}var Ha=window.Lh;
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,d.concat(e.call(arguments)))}function c(){}"function"!==typeof this&&m(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var e=Array.prototype.slice,d=e.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
for(var Ia=0,Ja=["ms","moz","webkit","o"],Ka=0;Ka<Ja.length&&!window.requestAnimationFrame;++Ka)window.requestAnimationFrame=window[Ja[Ka]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[Ja[Ka]+"CancelAnimationFrame"]||window[Ja[Ka]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=Date.now(),c=Math.max(0,16-(b-Ia)),e=window.setTimeout(function(){a(b+c)},c);Ia=b+c;return e});
window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});
"slice"in ArrayBuffer.prototype||(ArrayBuffer.prototype.slice=function(a,b){a===p&&m(Error("Not enough arguments."));var c=b||this.byteLength;0>a&&(a=this.byteLength+a);0>c&&(c=this.byteLength+c);c<a&&(c=a=0);0>a&&(a=0);0>c&&(c=0);a>this.byteLength&&(a=this.byteLength);c>this.byteLength&&(c=this.byteLength);for(var e=new ArrayBuffer(c-a),d=new Uint8Array(this),f=new Uint8Array(e),g=a,h=0;g<c;++g,++h)f[h]=d[g];return e});A("$",Ha);A("Function.prototype.bind",Function.prototype.bind);
A("window.requestAnimationFrame",window.requestAnimationFrame);A("window.cancelAnimationFrame",window.cancelAnimationFrame);var La=0;function Ma(){}w=Ma.prototype;w.key=0;w.xc=u;w.ie=u;w.Ca=function(a,b,c,e,d,f){oa(a)?this.Ug=q:a&&a.handleEvent&&oa(a.handleEvent)?this.Ug=u:m(Error("Invalid listener argument"));this.bc=a;this.oh=b;this.src=c;this.type=e;this.capture=!!d;this.tf=f;this.ie=u;this.key=++La;this.xc=u};w.handleEvent=function(a){return this.Ug?this.bc.call(this.tf||this.src,a):this.bc.handleEvent.call(this.bc,a)};function Na(a,b){for(var c in a)b.call(p,a[c],c,a)}function Oa(a){var b=[],c=0,e;for(e in a)b[c++]=a[e];return b}var Pa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Qa(a,b){for(var c,e,d=1;d<arguments.length;d++){e=arguments[d];for(c in e)a[c]=e[c];for(var f=0;f<Pa.length;f++)c=Pa[f],Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c])}};function Ra(a){if(!Sa.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Ta,"&"));-1!=a.indexOf("<")&&(a=a.replace(Ua,"<"));-1!=a.indexOf(">")&&(a=a.replace(Va,">"));-1!=a.indexOf('"')&&(a=a.replace(Wa,"""));return a}var Ta=/&/g,Ua=/</g,Va=/>/g,Wa=/\"/g,Sa=/[&<>\"]/;var Xa,Ya,Za,$a,ab,bb,db;function eb(){return fa.navigator?fa.navigator.userAgent:t}function fb(){return fa.navigator}$a=Za=Ya=Xa=u;var gb;if(gb=eb()){var hb=fb();Xa=0==gb.indexOf("Opera");Ya=!Xa&&-1!=gb.indexOf("MSIE");Za=!Xa&&-1!=gb.indexOf("WebKit");$a=!Xa&&!Za&&"Gecko"==hb.product}var ib=Xa,K=Ya,kb=$a,lb=Za,mb,pb=fb();mb=pb&&pb.platform||"";ab=-1!=mb.indexOf("Mac");bb=-1!=mb.indexOf("Win");db=-1!=mb.indexOf("Linux");var qb=!!fb()&&-1!=(fb().appVersion||"").indexOf("X11");
function ub(){var a=fa.document;return a?a.documentMode:p}var vb;a:{var wb="",xb;if(ib&&fa.opera)var yb=fa.opera.version,wb="function"==typeof yb?yb():yb;else if(kb?xb=/rv\:([^\);]+)(\)|;)/:K?xb=/MSIE\s+([^\);]+)(\)|;)/:lb&&(xb=/WebKit\/(\S+)/),xb)var zb=xb.exec(eb()),wb=zb?zb[1]:"";if(K){var Ab=ub();if(Ab>parseFloat(wb)){vb=String(Ab);break a}}vb=wb}var Bb={};
function Cb(a){var b;if(!(b=Bb[a])){b=0;for(var c=String(vb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=Math.max(c.length,e.length),f=0;0==b&&f<d;f++){var g=c[f]||"",h=e[f]||"",l=RegExp("(\\d*)(\\D*)","g"),j=RegExp("(\\d*)(\\D*)","g");do{var k=l.exec(g)||["","",""],n=j.exec(h)||["","",""];if(0==k[0].length&&0==n[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==n[1].length?0:parseInt(n[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==n[1].length?0:parseInt(n[1],10))?1:0)||((0==k[2].length)<(0==n[2].length)?-1:(0==k[2].length)>(0==n[2].length)?1:0)||(k[2]<n[2]?-1:k[2]>n[2]?1:0)}while(0==b)}b=Bb[a]=0<=b}return b}var Db=fa.document,Eb=!Db||!K?p:ub()||("CSS1Compat"==Db.compatMode?parseInt(vb,10):5);var Fb=!K||K&&9<=Eb,Gb=K&&!Cb("9");!lb||Cb("528");kb&&Cb("1.9b")||K&&Cb("8")||ib&&Cb("9.5")||lb&&Cb("528");kb&&!Cb("8")||K&&Cb("9");var Hb=Array.prototype,Ib=Hb.indexOf?function(a,b,c){return Hb.indexOf.call(a,b,c)}:function(a,b,c){c=c==t?0:0>c?Math.max(0,a.length+c):c;if(na(a))return!na(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Jb=Hb.forEach?function(a,b,c){Hb.forEach.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)f in d&&b.call(c,d[f],f,a)},Lb=Hb.map?function(a,b,c){return Hb.map.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=Array(e),f=
na(a)?a.split(""):a,g=0;g<e;g++)g in f&&(d[g]=b.call(c,f[g],g,a));return d},Mb=Hb.some?function(a,b,c){return Hb.some.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)if(f in d&&b.call(c,d[f],f,a))return q;return u};function Nb(a,b){var c=Ib(a,b);0<=c&&Hb.splice.call(a,c,1)}function Ob(a,b,c){return 2>=arguments.length?Hb.slice.call(a,b):Hb.slice.call(a,b,c)};function Pb(){0!=Qb&&(this.xl=Error().stack,qa(this))}var Qb=0;function Rb(a,b){this.type=a;this.currentTarget=this.target=b}w=Rb.prototype;w.wc=u;w.defaultPrevented=u;w.xe=q;w.stopPropagation=function(){this.wc=q};w.preventDefault=function(){this.defaultPrevented=q;this.xe=u};function Sb(a){Sb[" "](a);return a}Sb[" "]=ga;function Tb(a,b){a&&this.Ca(a,b)}C(Tb,Rb);w=Tb.prototype;w.target=t;w.relatedTarget=t;w.offsetX=0;w.offsetY=0;w.clientX=0;w.clientY=0;w.screenX=0;w.screenY=0;w.button=0;w.keyCode=0;w.charCode=0;w.ctrlKey=u;w.altKey=u;w.shiftKey=u;w.metaKey=u;w.Wj=u;w.tb=t;
w.Ca=function(a,b){var c=this.type=a.type;Rb.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;if(e){if(kb){var d;a:{try{Sb(e.nodeName);d=q;break a}catch(f){}d=u}d||(e=t)}}else"mouseover"==c?e=a.fromElement:"mouseout"==c&&(e=a.toElement);this.relatedTarget=e;this.offsetX=lb||a.offsetX!==p?a.offsetX:a.layerX;this.offsetY=lb||a.offsetY!==p?a.offsetY:a.layerY;this.clientX=a.clientX!==p?a.clientX:a.pageX;this.clientY=a.clientY!==p?a.clientY:a.pageY;this.screenX=
a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.Wj=ab?a.metaKey:a.ctrlKey;this.state=a.state;this.tb=a;a.defaultPrevented&&this.preventDefault();delete this.wc};w.stopPropagation=function(){Tb.u.stopPropagation.call(this);this.tb.stopPropagation?this.tb.stopPropagation():this.tb.cancelBubble=q};
w.preventDefault=function(){Tb.u.preventDefault.call(this);var a=this.tb;if(a.preventDefault)a.preventDefault();else if(a.returnValue=u,Gb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.Gi=v("tb");var Ub={},Vb={},Wb={},Xb={};function L(a,b,c,e,d){if(ja(b)){for(var f=0;f<b.length;f++)L(a,b[f],c,e,d);return t}a=Yb(a,b,c,u,e,d);b=a.key;Ub[b]=a;return b}
function Yb(a,b,c,e,d,f){b||m(Error("Invalid event type"));d=!!d;var g=Vb;b in g||(g[b]={oa:0,Na:0});g=g[b];d in g||(g[d]={oa:0,Na:0},g.oa++);var g=g[d],h=qa(a),l;g.Na++;if(g[h]){l=g[h];for(var j=0;j<l.length;j++)if(g=l[j],g.bc==c&&g.tf==f){if(g.xc)break;e||(l[j].ie=u);return l[j]}}else l=g[h]=[],g.oa++;var k=Zb,n=Fb?function(a){return k.call(n.src,n.bc,a)}:function(a){a=k.call(n.src,n.bc,a);if(!a)return a},j=n,g=new Ma;g.Ca(c,j,a,b,d,f);g.ie=e;j.src=a;j.bc=g;l.push(g);Wb[h]||(Wb[h]=[]);Wb[h].push(g);
a.addEventListener?(a==fa||!a.customEvent_)&&a.addEventListener(b,j,d):a.attachEvent(b in Xb?Xb[b]:Xb[b]="on"+b,j);return g}function $b(a,b,c,e,d){if(ja(b))for(var f=0;f<b.length;f++)$b(a,b[f],c,e,d);else a=Yb(a,b,c,q,e,d),Ub[a.key]=a}function ac(a,b,c,e,d){if(ja(b))for(var f=0;f<b.length;f++)ac(a,b[f],c,e,d);else{e=!!e;a:{f=Vb;if(b in f&&(f=f[b],e in f&&(f=f[e],a=qa(a),f[a]))){a=f[a];break a}a=t}if(a)for(f=0;f<a.length;f++)if(a[f].bc==c&&a[f].capture==e&&a[f].tf==d){bc(a[f].key);break}}}
function bc(a){var b=Ub[a];if(!b||b.xc)return u;var c=b.src,e=b.type,d=b.oh,f=b.capture;c.removeEventListener?(c==fa||!c.customEvent_)&&c.removeEventListener(e,d,f):c.detachEvent&&c.detachEvent(e in Xb?Xb[e]:Xb[e]="on"+e,d);c=qa(c);Wb[c]&&(d=Wb[c],Nb(d,b),0==d.length&&delete Wb[c]);b.xc=q;if(b=Vb[e][f][c])b.fh=q,cc(e,f,c,b);delete Ub[a];return q}
function cc(a,b,c,e){if(!e.te&&e.fh){for(var d=0,f=0;d<e.length;d++)e[d].xc?e[d].oh.src=t:(d!=f&&(e[f]=e[d]),f++);e.length=f;e.fh=u;0==f&&(delete Vb[a][b][c],Vb[a][b].oa--,0==Vb[a][b].oa&&(delete Vb[a][b],Vb[a].oa--),0==Vb[a].oa&&delete Vb[a])}}function dc(a){var b=0;if(a!=t){if(a=qa(a),Wb[a]){a=Wb[a];for(var c=a.length-1;0<=c;c--)bc(a[c].key),b++}}else Na(Ub,function(a,c){bc(c);b++})}
function ec(a,b){var c=qa(a),e=Wb[c];if(e){var d=ia(b),f=ia(p);return d&&f?(e=Vb[b],!!e&&!!e[p]&&c in e[p]):!d&&!f?q:Mb(e,function(a){return d&&a.type==b||f&&a.capture==p})}return u}function fc(a,b,c,e,d){var f=1;b=qa(b);if(a[b]){var g=--a.Na,h=a[b];h.te?h.te++:h.te=1;try{for(var l=h.length,j=0;j<l;j++){var k=h[j];k&&!k.xc&&(f&=gc(k,d)!==u)}}finally{a.Na=Math.max(g,a.Na),h.te--,cc(c,e,b,h)}}return Boolean(f)}function gc(a,b){a.ie&&bc(a.key);return a.handleEvent(b)}
function Zb(a,b){if(a.xc)return q;var c=a.type,e=Vb;if(!(c in e))return q;var e=e[c],d,f;if(!Fb){var g;if(!(g=b))a:{g=["window","event"];for(var h=fa;d=g.shift();)if(h[d]!=t)h=h[d];else{g=t;break a}g=h}d=g;g=q in e;h=u in e;if(g){if(0>d.keyCode||d.returnValue!=p)return q;a:{var l=u;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(j){l=q}if(l||d.returnValue==p)d.returnValue=q}}l=new Tb;l.Ca(d,this);d=q;try{if(g){for(var k=[],n=l.currentTarget;n;n=n.parentNode)k.push(n);f=e[q];f.Na=f.oa;for(var s=k.length-
1;!l.wc&&0<=s&&f.Na;s--)l.currentTarget=k[s],d&=fc(f,k[s],c,q,l);if(h){f=e[u];f.Na=f.oa;for(s=0;!l.wc&&s<k.length&&f.Na;s++)l.currentTarget=k[s],d&=fc(f,k[s],c,u,l)}}else d=gc(a,l)}finally{k&&(k.length=0)}return d}c=new Tb(b,this);return d=gc(a,c)}var hc=0;function ic(a){return a+"_"+hc++};function jc(){Pb.call(this);this.Bl={};this.ul=this}C(jc,Pb);jc.prototype.customEvent_=q;w=jc.prototype;w.Lf=t;w.Qf=ba("Lf");w.addEventListener=function(a,b,c,e){L(this,a,b,c,e)};w.removeEventListener=function(a,b,c,e){ac(this,a,b,c,e)};
w.dispatchEvent=function(a){var b=a.type||a,c=Vb;if(b in c){if(na(a))a=new Rb(a,this);else if(a instanceof Rb)a.target=a.target||this;else{var e=a;a=new Rb(b,this);Qa(a,e)}var e=1,d,c=c[b],b=q in c,f;if(b){d=[];for(f=this;f;f=f.Lf)d.push(f);f=c[q];f.Na=f.oa;for(var g=d.length-1;!a.wc&&0<=g&&f.Na;g--)a.currentTarget=d[g],e&=fc(f,d[g],a.type,q,a)&&a.xe!=u}if(u in c)if(f=c[u],f.Na=f.oa,b)for(g=0;!a.wc&&g<d.length&&f.Na;g++)a.currentTarget=d[g],e&=fc(f,d[g],a.type,u,a)&&a.xe!=u;else for(d=this;!a.wc&&
d&&f.Na;d=d.Lf)a.currentTarget=d,e&=fc(f,d,a.type,u,a)&&a.xe!=u;a=Boolean(e)}else a=q;return a};function M(){jc.call(this);this.f="base";this.qa=window["X.counter"].qk();this.j=u}C(M,jc);M.prototype.__defineGetter__("classname",v("f"));M.prototype.__defineGetter__("id",v("qa"));A("X.base",M);function kc(a,b){this.Wa=new ya(a);this.va=new ya(b)}kc.prototype={l:function(){return new kc(this.Wa.l(),this.va.l())},uc:function(){this.va=Ea(this.va)}};function lc(a,b){this.va=a;this.Pd=b}lc.prototype={l:function(){return new lc(this.va.l(),this.Pd)},uc:function(){this.va=Ea(this.va);this.Pd=-this.Pd}};function mc(a,b){this.Lb=a;this.De=b;var c=a[0].Wa,e=a[2].Wa,e=Da(Ca(a[1].Wa,c).sc(Ca(e,c)));this.Va=new lc(e,e.ac(c))}mc.prototype={l:function(){var a=this.Lb.map(function(a){return a.l()});return new mc(a,this.De)},uc:function(){this.Lb.reverse().map(function(a){a.uc()});this.Va.uc()}};
function nc(a,b,c,e,d,f){for(var g=0,h=[],l=0;l<a.Lb.length;l++){var j=b.va.ac(a.Lb[l].Wa)-b.Pd,j=-1E-5>j?2:1E-5<j?1:0,g=g|j;h.push(j)}switch(g){case 0:(0<b.va.ac(a.Va.va)?c:e).push(a);break;case 1:d.push(a);break;case 2:f.push(a);break;case 3:c=[];e=[];for(l=0;l<a.Lb.length;l++){var k=(l+1)%a.Lb.length,j=h[l],n=h[k],g=a.Lb[l],k=a.Lb[k];2!=j&&c.push(g);1!=j&&e.push(2!=j?g.l():g);3==(j|n)&&(j=(b.Pd-b.va.ac(g.Wa))/b.va.ac(Ca(k.Wa,g.Wa)),j=new kc(g.Wa.se(k.Wa,j),g.va.se(k.va,j)),c.push(j),e.push(j.l()))}3<=
c.length&&d.push(new mc(c,a.De));3<=e.length&&f.push(new mc(e,a.De))}};function oc(a){this.Aa=this.Ba=this.Va=t;this.Z=[];a&&pc(this,a)}oc.prototype={l:function(){var a=new oc,b=this.Va&&this.Va.l();a.Va=b;b=this.Ba&&this.Ba.l();a.Ba=b;b=this.Aa&&this.Aa.l();a.Aa=b;a.Ce(this.Z.map(function(a){return a.l()}));return a},Y:function(){for(var a=0;a<this.Z.length;a++)this.Z[a].uc();this.Va.uc();this.Ba&&this.Ba.Y();this.Aa&&this.Aa.Y();a=this.Ba;this.Ba=this.Aa;this.Aa=a},Ce:ba("Z")};
function pc(a,b){if(b.length){a.Va||(a.Va=b[0].Va.l());for(var c=[],e=[],d=0;d<b.length;d++)nc(b[d],a.Va,a.Z,a.Z,c,e);c.length&&(a.Ba||(a.Ba=new oc),pc(a.Ba,c));e.length&&(a.Aa||(a.Aa=new oc),pc(a.Aa,e))}}function qc(a){var b=a.Z.slice();a.Ba&&(b=b.concat(qc(a.Ba)));a.Aa&&(b=b.concat(qc(a.Aa)));return b}function rc(a,b){a.Z=sc(b,a.Z);a.Ba&&rc(a.Ba,b);a.Aa&&rc(a.Aa,b)}
function sc(a,b){if(!a.Va)return b.slice();for(var c=[],e=[],d=0;d<b.length;d++)nc(b[d],a.Va,c,e,c,e);a.Ba&&(c=sc(a.Ba,c));e=a.Aa?sc(a.Aa,e):[];return c.concat(e)};function tc(){this.Z=[]}function uc(a){var b=new tc;b.Ce(a);return b}
tc.prototype={l:function(){var a=new tc;a.Ce(this.Z.map(function(a){return a.l()}));return a},Xf:function(a){var b=new oc(this.l().Z);a=new oc(a.l().Z);rc(b,a);rc(a,b);a.Y();rc(a,b);a.Y();pc(b,qc(a));return uc(qc(b))},wa:function(a){var b=new oc(this.l().Z);a=new oc(a.l().Z);b.Y();rc(b,a);rc(a,b);a.Y();rc(a,b);a.Y();pc(b,qc(a));b.Y();return uc(qc(b))},vf:function(a){var b=new oc(this.l().Z);a=new oc(a.l().Z);b.Y();rc(a,b);a.Y();rc(b,a);rc(a,b);pc(b,qc(a));b.Y();return uc(qc(b))},inverse:function(){var a=
this.l();a.Z.map(function(a){a.uc()});return a},Ce:ba("Z")};function vc(){M.call(this);this.f="indexer";this.bf=[];this.pl=[];this.Ka={}}C(vc,M);vc.prototype.add=function(a){a==t&&m(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.Ka||(this.Ka[b]=this.bf.length,this.bf.push(a));return this.Ka[b]};vc.prototype.unique=v("bf");function wc(a){M.call(this);this.f="file";this.$d=a;this.j=q}C(wc,M);function xc(){this.ab=this.r=t}xc.prototype.__defineSetter__("file",function(a){if(a==t||ja(a)&&0==a.length)this.r=t;else{if(ja(a)){if(1==a.length){this.r=new wc(a[0]);return}this.r=Lb(a,function(a){var c=new P;c.r=new wc(a);return c})}else this.r=new wc(a);this.ab=t}});xc.prototype.__defineGetter__("file",function(){return!this.r?"":ja(this.r)?this.r.map(function(a){return a.r.$d}):this.r.$d});
xc.prototype.__defineGetter__("filedata",function(){return ja(this.r)?this.r.map(function(a){return a.ab}):this.ab});xc.prototype.__defineSetter__("filedata",function(a){if(a==t||ja(a)&&0==a.length)this.ab=t;if(ja(a))if(1==a.length)this.ab=a[0];else{var b=this.r.length,c;for(c=0;c<b;c++)this.r[c].ab=a[c]}else this.ab=a});function yc(a){if("function"==typeof a.Dd)return a.Dd();if(na(a))return a.split("");if(ma(a)){for(var b=[],c=a.length,e=0;e<c;e++)b.push(a[e]);return b}return Oa(a)};function zc(a,b){this.ga={};this.S=[];var c=arguments.length;if(1<c){c%2&&m(Error("Uneven number of arguments"));for(var e=0;e<c;e+=2)this.set(arguments[e],arguments[e+1])}else a&&this.df(a)}w=zc.prototype;w.oa=0;w.Zf=0;w.sf=v("oa");w.Dd=function(){Ac(this);for(var a=[],b=0;b<this.S.length;b++)a.push(this.ga[this.S[b]]);return a};function Bc(a){for(var b=0;b<a.S.length;b++){var c=a.S[b];if(Cc(a.ga,c)&&a.ga[c]==u)return q}return u}w.clear=function(){this.ga={};this.Zf=this.oa=this.S.length=0};
w.remove=function(a){return Cc(this.ga,a)?(delete this.ga[a],this.oa--,this.Zf++,this.S.length>2*this.oa&&Ac(this),q):u};function Ac(a){if(a.oa!=a.S.length){for(var b=0,c=0;b<a.S.length;){var e=a.S[b];Cc(a.ga,e)&&(a.S[c++]=e);b++}a.S.length=c}if(a.oa!=a.S.length){for(var d={},c=b=0;b<a.S.length;)e=a.S[b],Cc(d,e)||(a.S[c++]=e,d[e]=1),b++;a.S.length=c}}w.get=function(a,b){return Cc(this.ga,a)?this.ga[a]:b};w.set=function(a,b){Cc(this.ga,a)||(this.oa++,this.S.push(a),this.Zf++);this.ga[a]=b};
w.df=function(a){var b;if(a instanceof zc)Ac(a),b=a.S.concat(),a=a.Dd();else{b=[];var c=0,e;for(e in a)b[c++]=e;a=Oa(a)}for(c=0;c<b.length;c++)this.set(b[c],a[c])};w.l=function(){return new zc(this)};w.Wf=function(){for(var a=new zc,b=0;b<this.S.length;b++){var c=this.S[b];a.set(this.ga[c],c)}return a};function Cc(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Dc(){M.call(this);this.f="colortable";this.Ka=new zc;Fa(this,new xc)}C(Dc,M);Dc.prototype.add=function(a,b,c,e,d,f){(!x(a)||!x(c)||!x(e)||!x(d)||!x(f))&&m(Error("Invalid color table entry."));this.Ka.set(a,[b,c,e,d,f]);this.j=q};Dc.prototype.get=function(a){return this.Ka.get(a)};A("X.colortable.prototype.get",Dc.prototype.get);function Ec(a,b,c){this.x=ia(a)?a:0;this.y=ia(b)?b:0;this.d=ia(c)?c:0}Ec.prototype.l=function(){return new Ec(this.x,this.y,this.d)};function R(a,b,c){this.x=a;this.y=b;this.d=c}C(R,Ec);w=R.prototype;w.l=function(){return new R(this.x,this.y,this.d)};w.Jb=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.d*this.d)};w.scale=function(a){this.x*=a;this.y*=a;this.d*=a;return this};w.Y=function(){this.x=-this.x;this.y=-this.y;this.d=-this.d;return this};w.normalize=function(){return this.scale(1/this.Jb())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.d+=a.d;return this};
w.wa=function(a){this.x-=a.x;this.y-=a.y;this.d-=a.d;return this};function Fc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return Math.sqrt(c*c+e*e+d*d)}function Gc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return c*c+e*e+d*d}function Hc(a,b){return new R(a.x+b.x,a.y+b.y,a.d+b.d)}function Ic(a,b){return new R(a.y*b.d-a.d*b.y,a.d*b.x-a.x*b.d,a.x*b.y-a.y*b.x)};D.m=R;w=D.m.prototype;w.l=R.prototype.l;w.Jb=R.prototype.Jb;w.scale=R.prototype.scale;w.Y=R.prototype.Y;w.add=R.prototype.add;w.wa=R.prototype.wa;w.normalize=function(){var a=this.Jb();return 0==a?this.scale(0):this.scale(1/a)};D.m.ac=function(a,b){return a.x*b.x+a.y*b.y+a.d*b.d};D.m.sc=Ic;D.m.rf=Fc;D.m.se=function(a,b,c){return new R(a.x+c*(b.x-a.x),a.y+c*(b.y-a.y),a.d+c*(b.d-a.d))};D.m.prototype.__defineGetter__("xx",v("x"));D.m.prototype.__defineGetter__("yy",v("y"));
D.m.prototype.__defineGetter__("zz",v("d"));A("X.vector",D.m);A("X.vector.prototype.clone",D.m.prototype.l);A("X.vector.prototype.magnitude",D.m.prototype.Jb);A("X.vector.prototype.scale",D.m.prototype.scale);A("X.vector.prototype.invert",D.m.prototype.Y);A("X.vector.prototype.normalize",D.m.prototype.normalize);A("X.vector.prototype.add",D.m.prototype.add);A("X.vector.prototype.subtract",D.m.prototype.wa);A("X.vector.dot",D.m.ac);A("X.vector.cross",D.m.sc);A("X.vector.distance",D.m.rf);
A("X.vector.lerp",D.m.se);function Jc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Jc.prototype.BYTES_PER_ELEMENT=8;Jc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Jc.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{Jc.BYTES_PER_ELEMENT=8}catch(Kc){}Jc.prototype.BYTES_PER_ELEMENT=Jc.prototype.BYTES_PER_ELEMENT;Jc.prototype.set=Jc.prototype.set;Jc.prototype.toString=Jc.prototype.toString;A("Float64Array",Jc)};function Lc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Lc.prototype.BYTES_PER_ELEMENT=4;Lc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Lc.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(Lc.BYTES_PER_ELEMENT=4,Lc.prototype.BYTES_PER_ELEMENT=Lc.prototype.BYTES_PER_ELEMENT,Lc.prototype.set=Lc.prototype.set,Lc.prototype.toString=Lc.prototype.toString,A("Float32Array",Lc));function Mc(){return new Float32Array(3)}function Nc(a,b,c){var e=Mc();e[0]=a;e[1]=b;e[2]=c;return e}function Oc(a,b){var c=a[0],e=a[1],d=a[2],c=1/Math.sqrt(c*c+e*e+d*d);b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c};function Pc(){return new Float32Array(4)}function Qc(a,b,c,e){var d=Pc();d[0]=a;d[1]=b;d[2]=c;d[3]=e;return d};function Rc(){return new Float32Array(16)}function Sc(){var a=Rc();a[0]=a[5]=a[10]=a[15]=1;return a}function Tc(a,b,c,e,d,f,g,h,l,j,k,n,s,r,y,z,F){a[0]=b;a[1]=c;a[2]=e;a[3]=d;a[4]=f;a[5]=g;a[6]=h;a[7]=l;a[8]=j;a[9]=k;a[10]=n;a[11]=s;a[12]=r;a[13]=y;a[14]=z;a[15]=F;return a}function Vc(a,b,c,e,d){a[12]=b;a[13]=c;a[14]=e;a[15]=d;return a}function Wc(a,b,c){b*=4;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3]}function Xc(a,b,c){b*=4;c[0]=a[b];c[1]=a[b+1];c[2]=a[b+2];c[3]=a[b+3]}
function T(a,b,c,e,d,f){a[b]=c;a[b+4]=e;a[b+8]=d;a[b+12]=f}function Yc(a,b,c){a[b]=c[0];a[b+4]=c[1];a[b+8]=c[2];a[b+12]=c[3]}function Zc(a,b,c){c[0]=a[b];c[1]=a[b+4];c[2]=a[b+8];c[3]=a[b+12]}
function $c(a,b,c){var e=a[0],d=a[1],f=a[2],g=a[3],h=a[4],l=a[5],j=a[6],k=a[7],n=a[8],s=a[9],r=a[10],y=a[11],z=a[12],F=a[13],G=a[14];a=a[15];var H=b[0],B=b[1],E=b[2],I=b[3],N=b[4],Q=b[5],O=b[6],S=b[7],da=b[8],J=b[9],ca=b[10],la=b[11],U=b[12],V=b[13],Ga=b[14];b=b[15];c[0]=e*H+h*B+n*E+z*I;c[1]=d*H+l*B+s*E+F*I;c[2]=f*H+j*B+r*E+G*I;c[3]=g*H+k*B+y*E+a*I;c[4]=e*N+h*Q+n*O+z*S;c[5]=d*N+l*Q+s*O+F*S;c[6]=f*N+j*Q+r*O+G*S;c[7]=g*N+k*Q+y*O+a*S;c[8]=e*da+h*J+n*ca+z*la;c[9]=d*da+l*J+s*ca+F*la;c[10]=f*da+j*J+r*ca+
G*la;c[11]=g*da+k*J+y*ca+a*la;c[12]=e*U+h*V+n*Ga+z*b;c[13]=d*U+l*V+s*Ga+F*b;c[14]=f*U+j*V+r*Ga+G*b;c[15]=g*U+k*V+y*Ga+a*b;return c}
function ad(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=a[8],n=a[9],s=a[10],r=a[11],y=a[12],z=a[13],F=a[14],G=a[15],H=c*h-e*g,B=c*l-d*g,E=c*j-f*g,I=e*l-d*h,N=e*j-f*h,Q=d*j-f*l,O=k*z-n*y,S=k*F-s*y,da=k*G-r*y,J=n*F-s*z,ca=n*G-r*z,la=s*G-r*F,U=H*la-B*ca+E*J+I*da-N*S+Q*O;if(0==U)return u;U=1/U;b[0]=(h*la-l*ca+j*J)*U;b[1]=(-e*la+d*ca-f*J)*U;b[2]=(z*Q-F*N+G*I)*U;b[3]=(-n*Q+s*N-r*I)*U;b[4]=(-g*la+l*da-j*S)*U;b[5]=(c*la-d*da+f*S)*U;b[6]=(-y*Q+F*E-G*B)*U;b[7]=(k*Q-s*E+r*B)*U;b[8]=(g*
ca-h*da+j*O)*U;b[9]=(-c*ca+e*da-f*O)*U;b[10]=(y*N-z*E+G*H)*U;b[11]=(-k*N+n*E-r*H)*U;b[12]=(-g*J+h*S-l*O)*U;b[13]=(c*J-e*S+d*O)*U;b[14]=(-y*I+z*B-F*H)*U;b[15]=(k*I-n*B+s*H)*U;return q}function bd(a,b,c){var e=b[0],d=b[1];b=b[2];c[0]=e*a[0]+d*a[4]+b*a[8]+a[12];c[1]=e*a[1]+d*a[5]+b*a[9]+a[13];c[2]=e*a[2]+d*a[6]+b*a[10]+a[14]}
function cd(a,b,c){var e=b[0],d=b[1],f=b[2];b=b[3];c[0]=e*a[0]+d*a[4]+f*a[8]+b*a[12];c[1]=e*a[1]+d*a[5]+f*a[9]+b*a[13];c[2]=e*a[2]+d*a[6]+f*a[10]+b*a[14];c[3]=e*a[3]+d*a[7]+f*a[11]+b*a[15];return c}function dd(a,b,c,e){return Vc(a,a[0]*b+a[4]*c+a[8]*e+a[12],a[1]*b+a[5]*c+a[9]*e+a[13],a[2]*b+a[6]*c+a[10]*e+a[14],a[3]*b+a[7]*c+a[11]*e+a[15])}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);D.g={};D.g.Xg=function(a,b,c,e){c=c.wa(b);c.normalize();e=D.m.sc(c,e);e.normalize();var d=D.m.sc(e,c);d.normalize();c.Y();T(a,0,e.x,e.y,e.d,0);T(a,1,d.x,d.y,d.d,0);T(a,2,c.x,c.y,c.d,0);dd(a,-b.x,-b.y,-b.d);return a};D.g.ba=function(a,b,c,e){var d=1/(b*a[3]+c*a[7]+e*a[11]+a[15]);return new D.m((b*a[0]+c*a[4]+e*a[8]+a[12])*d,(b*a[1]+c*a[5]+e*a[9]+a[13])*d,(b*a[2]+c*a[6]+e*a[10]+a[14])*d)};
D.g.nk=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Zc(a,b,e);Zc(a,c,d);Yc(a,b,d);Yc(a,c,e);return a};D.g.mk=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Xc(a,b,e);Xc(a,c,d);Wc(a,b,d);Wc(a,c,e);return a};D.g.Ed=Sc;D.g.l=function(a){var b=Rc();b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};
D.g.Wf=function(a,b){if(b==a){var c=a[1],e=a[2],d=a[3],f=a[6],g=a[7],h=a[11];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=c;b[6]=a[9];b[7]=a[13];b[8]=e;b[9]=f;b[11]=a[14];b[12]=d;b[13]=g;b[14]=h}else b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15];return b};
D.g.ti=function(a){var b=a[0],c=a[1],e=a[2],d=a[3],f=a[4],g=a[5],h=a[6],l=a[7],j=a[8],k=a[9],n=a[10],s=a[11],r=a[12],y=a[13],z=a[14];a=a[15];return(b*g-c*f)*(n*a-s*z)-(b*h-e*f)*(k*a-s*y)+(b*l-d*f)*(k*z-n*y)+(c*h-e*g)*(j*a-s*r)-(c*l-d*g)*(j*z-n*r)+(e*l-d*h)*(j*y-k*r)};D.g.Y=ad;D.g.yf=function(a,b,c,e,d){var f=b/2;b=d-e;var g=Math.sin(f);if(0==b||0==g||0==c)return a;f=Math.cos(f)/g;return Tc(a,f/c,0,0,0,0,f,0,0,0,0,-(d+e)/b,-1,0,0,-(2*e*d)/b,0)};
D.g.dj=function(a,b,c,e,d,f,g){return Tc(a,2*f/(c-b),0,0,0,0,2*f/(d-e),0,0,(c+b)/(c-b),(d+e)/(d-e),-(g+f)/(g-f),-1,0,0,-(2*g*f)/(g-f),0)};D.g.ej=function(a,b,c,e,d,f,g){return Tc(a,2/(c-b),0,0,0,0,2/(d-e),0,0,0,0,-2/(g-f),0,-(c+b)/(c-b),-(d+e)/(d-e),-(g+f)/(g-f),1)};D.g.multiply=$c;D.g.ah=cd;D.g.translate=dd;D.g.scale=function(a,b,c,e){return Tc(a,a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*c,a[5]*c,a[6]*c,a[7]*c,a[8]*e,a[9]*e,a[10]*e,a[11]*e,a[12],a[13],a[14],a[15])};
D.g.rotate=function(a,b,c,e,d){var f=a[0],g=a[1],h=a[2],l=a[3],j=a[4],k=a[5],n=a[6],s=a[7],r=a[8],y=a[9],z=a[10],F=a[11],G=Math.cos(b),H=Math.sin(b),B=1-G;b=c*c*B+G;var E=c*e*B+d*H,I=c*d*B-e*H,N=c*e*B-d*H,Q=e*e*B+G,O=e*d*B+c*H,S=c*d*B+e*H;c=e*d*B-c*H;d=d*d*B+G;return Tc(a,f*b+j*E+r*I,g*b+k*E+y*I,h*b+n*E+z*I,l*b+s*E+F*I,f*N+j*Q+r*O,g*N+k*Q+y*O,h*N+n*Q+z*O,l*N+s*Q+F*O,f*S+j*c+r*d,g*S+k*c+y*d,h*S+n*c+z*d,l*S+s*c+F*d,a[12],a[13],a[14],a[15])};
D.g.ye=function(a,b){var c=a[4],e=a[5],d=a[6],f=a[7],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),n=Math.sin(b);a[4]=c*k+g*n;a[5]=e*k+h*n;a[6]=d*k+l*n;a[7]=f*k+j*n;a[8]=c*-n+g*k;a[9]=e*-n+h*k;a[10]=d*-n+l*k;a[11]=f*-n+j*k;return a};D.g.ze=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),n=Math.sin(b);a[0]=c*k+g*-n;a[1]=e*k+h*-n;a[2]=d*k+l*-n;a[3]=f*k+j*-n;a[8]=c*n+g*k;a[9]=e*n+h*k;a[10]=d*n+l*k;a[11]=f*n+j*k;return a};
D.g.Ae=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=Math.cos(b),n=Math.sin(b);a[0]=c*k+g*n;a[1]=e*k+h*n;a[2]=d*k+l*n;a[3]=f*k+j*n;a[4]=c*-n+g*k;a[5]=e*-n+h*k;a[6]=d*-n+l*k;a[7]=f*-n+j*k;return a};A("X.matrix.identity",D.g.Ed);A("X.matrix.clone",D.g.l);A("X.matrix.transpose",D.g.Wf);A("X.matrix.determinant",D.g.ti);A("X.matrix.invert",D.g.Y);A("X.matrix.multiply",D.g.multiply);A("X.matrix.multiplyByVector",D.g.ba);A("X.matrix.multiplyByVec4",D.g.ah);
A("X.matrix.makePerspective",D.g.yf);A("X.matrix.makeFrustum",D.g.dj);A("X.matrix.makeOrtho",D.g.ej);A("X.matrix.makeLookAt",D.g.Xg);A("X.matrix.translate",D.g.translate);A("X.matrix.scale",D.g.scale);A("X.matrix.rotate",D.g.rotate);A("X.matrix.rotateX",D.g.ye);A("X.matrix.rotateY",D.g.ze);A("X.matrix.rotateZ",D.g.Ae);A("X.matrix.swapRows",D.g.nk);A("X.matrix.swapCols",D.g.mk);function ed(){M.call(this);this.f="transform";this.Q=D.g.Ed()}C(ed,M);ed.prototype.__defineGetter__("matrix",v("Q"));ed.prototype.__defineSetter__("matrix",function(a){(a==t||!(a instanceof Float32Array))&&m(Error("Invalid matrix."));this.Q=a;this.q()});w=ed.prototype;w.ye=function(a){(!x(a)||-360>a||360<a)&&m(Error("Invalid angle."));D.g.ye(this.Q,a*Math.PI/180);this.q()};w.ze=function(a){(!x(a)||-360>a||360<a)&&m(Error("Invalid angle."));D.g.ze(this.Q,a*Math.PI/180);this.q()};
w.Ae=function(a){(!x(a)||-360>a||360<a)&&m(Error("Invalid angle."));D.g.Ae(this.Q,a*Math.PI/180);this.q()};w.Dh=function(a){x(a)||m(Error("Invalid distance."));D.g.translate(this.Q,a,0,0);this.q()};w.Eh=function(a){x(a)||m(Error("Invalid distance."));D.g.translate(this.Q,0,a,0);this.q()};w.Fh=function(a){x(a)||m(Error("Invalid distance."));D.g.translate(this.Q,0,0,a);this.q()};function fd(a,b,c){a.Q[b+4*c]*=-1;a.q()}w.Bi=function(){fd(this,0,0)};w.Ci=function(){fd(this,1,1)};
w.Di=function(){fd(this,2,2)};w.q=function(){this.j=q};A("X.transform",ed);A("X.transform.prototype.rotateX",ed.prototype.ye);A("X.transform.prototype.rotateY",ed.prototype.ze);A("X.transform.prototype.rotateZ",ed.prototype.Ae);A("X.transform.prototype.translateX",ed.prototype.Dh);A("X.transform.prototype.translateY",ed.prototype.Eh);A("X.transform.prototype.translateZ",ed.prototype.Fh);A("X.transform.prototype.flipX",ed.prototype.Bi);A("X.transform.prototype.flipY",ed.prototype.Ci);
A("X.transform.prototype.flipZ",ed.prototype.Di);A("X.transform.prototype.modified",ed.prototype.q);function gd(){M.call(this);this.f="texture";this.Wb=this.jb=this.r=t;this.We=this.Xe=0;this.hg=u;Fa(this,new xc)}C(gd,M);gd.prototype.__defineSetter__("rawData",function(a){this.Wb=a;this.j=q});gd.prototype.__defineSetter__("rawDataHeight",function(a){this.We=a;this.j=q});gd.prototype.__defineSetter__("rawDataWidth",function(a){this.Xe=a;this.j=q});gd.prototype.__defineSetter__("grayscale",function(a){this.hg=a;this.j=q});A("X.texture",gd);function W(a,b){M.call(this);this.f="triplets";this.nb=Infinity;this.kb=-Infinity;this.ob=Infinity;this.lb=-Infinity;this.pb=Infinity;this.mb=-Infinity;this.Rd=[0,0,0];this.gg=q;this.C=0;this.da=new Float32Array(a);b!=t&&(this.da=b.da.subarray(0,b.da.length),this.C=this.da.length,this.nb=b.nb,this.kb=b.kb,this.ob=b.ob,this.lb=b.lb,this.pb=b.pb,this.mb=b.mb,this.Rd=b.Rd.slice(),this.gg=u)}C(W,M);w=W.prototype;
w.add=function(a,b,c){this.nb=Math.min(this.nb,a);this.kb=Math.max(this.kb,a);this.ob=Math.min(this.ob,b);this.lb=Math.max(this.lb,b);this.pb=Math.min(this.pb,c);this.mb=Math.max(this.mb,c);this.Rd=[(this.nb+this.kb)/2,(this.ob+this.lb)/2,(this.pb+this.mb)/2];this.gg=u;this.j=q;this.da[this.C++]=a;this.da[this.C++]=b;this.da[this.C++]=c;return this.C/3};w.Xa=function(){if(this.C!=this.da.length){var a=new Float32Array(this.C);a.set(this.da.subarray(0,this.C));this.da=a}};
w.get=function(a){a*=3;return[this.da[a],this.da[a+1],this.da[a+2]]};w.remove=function(){m(Error("Not implemented."))};w.clear=function(){this.da=new Float32Array(this.da.length);this.j=q};W.prototype.__defineGetter__("count",function(){this.Xa();return this.da.length/3});W.prototype.__defineGetter__("length",function(){this.Xa();return this.da.length});A("X.triplets",W);A("X.triplets.prototype.add",W.prototype.add);A("X.triplets.prototype.resize",W.prototype.Xa);A("X.triplets.prototype.get",W.prototype.get);
A("X.triplets.prototype.remove",W.prototype.remove);A("X.triplets.prototype.clear",W.prototype.clear);function hd(){this.Ia=id;this.ja=new ed;this.w=[1,1,1];this.nc=this.G=this.pa=this.n=this.h=t;this.Nc=[];this.O=q;this.Lc=this.sd=1;this.Dc=t;this.jd=u;this.za=1;this.ya=0;this.rd=q}var id="TRIANGLES";hd.prototype.__defineSetter__("type",function(a){return this.Ia=a});hd.prototype.__defineGetter__("type",v("Ia"));hd.prototype.__defineGetter__("texture",function(){this.G||(this.G=new gd);return this.G});hd.prototype.__defineGetter__("transform",v("ja"));hd.prototype.__defineGetter__("points",v("h"));
hd.prototype.__defineSetter__("points",ba("h"));hd.prototype.__defineGetter__("normals",v("n"));hd.prototype.__defineSetter__("normals",ba("n"));hd.prototype.__defineGetter__("colors",v("pa"));hd.prototype.__defineSetter__("colors",ba("pa"));hd.prototype.__defineGetter__("color",v("w"));hd.prototype.__defineSetter__("color",function(a){(a==t||!ja(a)||3!=a.length)&&m(Error("Invalid color."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e].color=a;this.w=a;this.j=q});
hd.prototype.__defineGetter__("opacity",v("za"));hd.prototype.__defineSetter__("opacity",function(a){(!x(a)||1<a||0>a)&&m(Error("Invalid opacity."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].opacity=a);this.za=a;this.j=q});hd.prototype.__defineGetter__("caption",v("Dc"));hd.prototype.__defineSetter__("caption",function(a){this.Dc=a;this.j=q});hd.prototype.__defineGetter__("visible",v("O"));
hd.prototype.__defineSetter__("visible",function(a){for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].visible=a);this.O=a;this.j=q});hd.prototype.__defineGetter__("pointsize",v("sd"));hd.prototype.__defineSetter__("pointsize",function(a){x(a)||m(Error("Invalid point size."));this.sd=a;this.j=q});hd.prototype.__defineGetter__("magicmode",v("jd"));hd.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&m(Error("Invalid magic mode setting."));this.jd=a;this.j=q});
hd.prototype.__defineGetter__("linewidth",v("Lc"));hd.prototype.__defineSetter__("linewidth",function(a){x(a)||m(Error("Invalid line width."));this.Lc=a;this.j=q});hd.prototype.__defineGetter__("pickable",v("rd"));hd.prototype.__defineSetter__("pickable",function(a){"boolean"!=typeof a&&m(Error("Invalid pickable setting."));this.rd=a;this.j=q});hd.prototype.__defineGetter__("textureCoordinateMap",v("nc"));hd.prototype.__defineSetter__("textureCoordinateMap",ba("sl"));function jd(){this.ra=Infinity;this.U=this.ia=-Infinity;this.W=Infinity;this.Rb=[0,0,0];this.Pb=[1,1,1]}jd.prototype.__defineGetter__("lowerThreshold",v("U"));jd.prototype.__defineSetter__("lowerThreshold",ba("U"));jd.prototype.__defineGetter__("upperThreshold",v("W"));jd.prototype.__defineSetter__("upperThreshold",ba("W"));jd.prototype.__defineGetter__("min",v("ra"));jd.prototype.__defineGetter__("max",v("ia"));jd.prototype.__defineGetter__("minColor",v("Rb"));
jd.prototype.__defineSetter__("minColor",function(a){(a==t||!ja(a)||3!=a.length)&&m(Error("Invalid min. color."));this.Rb=a});jd.prototype.__defineGetter__("maxColor",v("Pb"));jd.prototype.__defineSetter__("maxColor",function(a){(a==t||!ja(a)||3!=a.length)&&m(Error("Invalid max. color."));this.Pb=a});function kd(){M.call(this);this.f="scalars";this.dd=this.I=t;this.ug=q;this.Le=0;Fa(this,new xc);Fa(this,new jd);this.Rb=[0,1,0];this.Pb=[1,0,0]}C(kd,M);kd.prototype.__defineGetter__("array",v("I"));kd.prototype.__defineSetter__("array",function(a){this.dd=this.I=a;this.j=q});kd.prototype.__defineGetter__("interpolation",v("Le"));kd.prototype.__defineSetter__("interpolation",ba("Le"));A("X.scalars",kd);function Y(a){M.call(this);this.f="object";this.c=[];this.F=this.xa=t;Fa(this,new hd);a!=t&&this.rc(a)}C(Y,M);
Y.prototype.rc=function(a){this.Ia=a.Ia;this.ja=new ed;this.ja.Q=new Float32Array(a.ja.Q);this.w=a.w.slice();a.h&&(this.h=new W(a.h.length,a.h));a.n&&(this.n=new W(a.n.length,a.n));a.pa&&(this.pa=new W(a.pa.length,a.pa));this.G=a.G;this.nc=a.nc;a.r&&(this.r=new wc((new String(a.r.$d)).toString()));this.za=a.za;this.c.length=0;var b=a.c;if(b)for(var c=b.length,e=0,e=0;e<c;e++)this.c.push(new D[b[e].f](b[e]));this.O=a.O;this.sd=a.sd;this.Lc=a.Lc;a.Dc&&(this.Dc=(new String(a.Dc)).toString());this.jd=
a.jd;this.rd=a.rd;this.Nc=a.Nc.slice();this.j=q};Y.prototype.__defineGetter__("colortable",function(){this.xa||(this.xa=new Dc);return this.xa});Y.prototype.__defineGetter__("scalars",function(){this.F||(this.F=new kd);return this.F});Y.prototype.__defineGetter__("children",v("c"));Y.prototype.q=function(){var a=new ld;a.D=this;this.dispatchEvent(a)};Y.prototype.remove=function(){var a=new md;a.D=this;this.dispatchEvent(a)};
Y.prototype.Ta=function(){dc(this);if(0<this.c.length)for(var a=this.c,b=a.length,c=0,c=0;c<b;c++)"undefined"!=typeof a[c]&&this.c[c].Ta();this.c.length=0;this.F=this.xa=t};function nd(a,b){(a==t||b==t||!(a instanceof Y)||!(b instanceof Y))&&m(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.za?-1:1==b.za?1:a.ya!=t&&b.ya!=t&&a.ya>b.ya?-1:1}A("X.object",Y);A("X.object.prototype.modified",Y.prototype.q);A("X.object.prototype.remove",Y.prototype.remove);
A("X.object.prototype.destroy",Y.prototype.Ta);function od(){}function pd(a){for(var b=a.h.count,c=[],e=0,e=0;e<b;e+=3){var d=a.h.get(e),f=a.h.get(e+1),g=a.h.get(e+2),h=a.n.get(e),l=a.n.get(e+1),j=a.n.get(e+2),k=a.w;a.pa&&0<a.pa.length&&(k=a.pa.get(e));var n=[];n.push(new kc(d,h));n.push(new kc(f,l));n.push(new kc(g,j));c.push(new mc(n,k))}return uc(c)}
function qd(a,b){(b==t||!(b instanceof tc))&&m(Error("Invalid CSG object."));var c=new vc,e=[];Lb(b.Z,function(a){var b=[],g=a.De,b=Lb(a.Lb,function(a){a.color=g;return c.add(a)});for(a=a=2;a<b.length;a++)e.push([b[0],b[a-1],b[a]])}.bind(a));a.Vh=Lb(c.unique(),function(a){return[a.Wa.x(),a.Wa.y(),a.Wa.d()]});a.Uh=Lb(c.unique(),function(a){return[a.va.x(),a.va.y(),a.va.d()]});a.Th=Lb(c.unique(),function(a){return!a.color?t:[a.color[0],a.color[1],a.color[2]]});a.h=new W(9*e.length);a.n=new W(9*e.length);
a.pa=new W(9*e.length);Lb(e,function(a){var b=a[0],c=a[1];a=a[2];var e=this.Vh,l=this.Uh,j=this.Th;this.h.add(e[b][0],e[b][1],e[b][2]);this.h.add(e[c][0],e[c][1],e[c][2]);this.h.add(e[a][0],e[a][1],e[a][2]);this.n.add(l[b][0],l[b][1],l[b][2]);this.n.add(l[c][0],l[c][1],l[c][2]);this.n.add(l[a][0],l[a][1],l[a][2]);j[b]&&this.pa.add(j[b][0],j[b][1],j[b][2]);j[c]&&this.pa.add(j[c][0],j[c][1],j[c][2]);j[a]&&this.pa.add(j[a][0],j[a][1],j[a][2])}.bind(a));0==a.pa.C&&(a.pa=t);a.Ia=id}
od.prototype.Xf=function(a){(a==t||!(a instanceof tc)&&!(a instanceof Y))&&m(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;Fa(a,new od);qd(a,pd(this).Xf(b));return a};od.prototype.wa=function(a){(a==t||!(a instanceof tc)&&!(a instanceof Y))&&m(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;Fa(a,new od);qd(a,pd(this).wa(b));return a};
od.prototype.vf=function(a){(a==t||!(a instanceof tc)&&!(a instanceof Y))&&m(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;Fa(a,new od);qd(a,pd(this).vf(b));return a};od.prototype.inverse=function(){var a=new Y;Fa(a,new od);qd(a,pd(this).inverse());return a};A("X.constructable",od);A("X.constructable.prototype.intersect",od.prototype.vf);A("X.constructable.prototype.inverse",od.prototype.inverse);A("X.constructable.prototype.subtract",od.prototype.wa);
A("X.constructable.prototype.union",od.prototype.Xf);function rd(a){Rb.call(this,a);this.f="event"}C(rd,Rb);var sd=ic("pan"),td=ic("rotate"),ud=ic("zoom"),vd=ic("scroll");ic("render");var wd=ic("resetview"),xd=ic("windowlevel"),yd=ic("modified"),zd=ic("remove"),Ad=ic("progress"),Bd=ic("hover"),Cd=ic("hover_end"),Dd=ic("computing"),Ed=ic("computing_end"),Fd=ic("computing_progress");function Gd(){rd.call(this,xd);this.Qe=this.cf=0}C(Gd,rd);function Hd(){rd.call(this,sd);this.ya=new D.m(0,0,0)}C(Hd,rd);
function Id(){rd.call(this,td);this.ya=new D.m(0,0,0)}C(Id,rd);function Jd(){rd.call(this,ud);this.ib=this.wb=u}C(Jd,rd);function Kd(){rd.call(this,vd);this.V=u}C(Kd,rd);function Ld(){rd.call(this,Bd);this.ge=this.fe=0}C(Ld,rd);function Md(){rd.call(this,Cd)}C(Md,rd);function Nd(){rd.call(this,wd)}C(Nd,rd);function ld(){rd.call(this,yd);this.v=this.D=t}C(ld,rd);function md(){rd.call(this,zd);this.v=this.D=t}C(md,rd);function Od(){rd.call(this,Ad);this.Ad=0}C(Od,rd);
function Pd(){rd.call(this,Dd);this.D=t}C(Pd,rd);function Qd(){rd.call(this,Fd);this.Ad=0}C(Qd,rd);function Rd(){rd.call(this,Ed);this.D=t}C(Rd,rd);A("X.event.events.PAN",sd);A("X.event.events.ROTATE",td);A("X.event.events.ZOOM",ud);A("X.event.events.SCROLL",vd);function Sd(){M.call(this);this.f="parser";this.J=t;this.C=0;this.Zh=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.Mc=q;this.rl=-Infinity;this.ql=Infinity}C(Sd,M);Sd.prototype.parse=function(){m(Error("The function parse() should be overloaded."))};function Td(a){for(var b=Infinity,c=-Infinity,e=a.length,d=0,d=0;d<e;d++)if(!isNaN(a[d]))var f=a[d],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function Ud(a,b,c){b===p&&(b=0);c===p&&(c=a.length);for(var e="",d=0,d=b;d<c;++d)e+=String.fromCharCode(a[d]);return e}
function Z(a,b,c){c!=t||(c=1);var e=1,d=Uint8Array;switch(b){case "schar":d=Int8Array;break;case "ushort":d=Uint16Array;e=2;break;case "sshort":d=Int16Array;e=2;break;case "uint":d=Uint32Array;e=4;break;case "sint":d=Int32Array;e=4;break;case "float":d=Float32Array;e=4;break;case "complex":d=Float64Array;e=8;break;case "double":d=Float64Array,e=8}b=new d(a.J.slice(a.C,a.C+=c*e));if(a.Zh!=a.Mc){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(d=0;d<a.byteLength;d+=e)for(var f=d+e-1,g=d;f>
g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function Vd(a,b){var c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],e=Qc(0,0,0,1),d=Pc();cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(0,0,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(0,b[1]-
1,0,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,0,0,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,b[1]-1,0,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];
c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,0,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(0,b[1]-1,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,b[1]-1,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:
c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];return c}
function Wd(a,b){var c=Sc();if(!(a.length==b.length&&a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2])){var e=Math.acos(a[2]),d=Mc(),f=a[0],g=a[1],h=a[2],l=b[0],j=b[1],k=b[2];d[0]=g*k-h*j;d[1]=h*l-f*k;d[2]=f*j-g*l;Oc(d,d);f=Math.cos(e/2);g=Math.sin(e/2)*d[0];h=Math.sin(e/2)*d[1];e=Math.sin(e/2)*d[2];T(c,0,f*f+g*g-h*h-e*e,2*(g*h-f*e),2*(g*e+f*h),0);T(c,1,2*(g*h+f*e),f*f+h*h-g*g-e*e,2*(h*e-f*g),0);T(c,2,2*(g*e-f*h),2*(h*e+f*g),f*f+e*e-h*h-g*g,0)}e=Rc();ad(c,e);return[c,e]}
function Xd(a,b,c,e,d,f,g,h,l){var j=new Yd;Oc(c,c);for(var k=[],n=[],s=0;6>s;s++)for(var r=Math.floor(s/2),y=(r+1)%3,z=(r+2)%3,F=(4+2*r)%6,G=0;2>G;G++){var H=(2+G+2*r)%6,B=-(c[r]*(d[s]-a[r])+c[y]*(d[H]-a[y]))/c[z]+a[z];if(B>=d[F]&&B<=d[F+1]||B<=d[F]&&B>=d[F+1]){var E=[];E[r]=d[s];E[y]=d[H];E[z]=B;k.push(E)}else E=[],E[r]=d[s],E[y]=d[H],E[z]=B,n.push(E)}a=Nc(0,0,1);a=Wd(c,a);d=a[0];a=a[1];r=[];for(n=0;n<k.length;++n)s=Qc(k[n][0],k[n][1],k[n][2],1),y=Pc(),cd(d,s,y),r.push([y[0],y[1],y[2]]);d=Nc(1,
0,0);k=Mc();bd(a,d,k);n=Nc(0,1,0);d=Mc();bd(a,n,d);s=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];for(n=n=0;n<r.length;++n)r[n][0]<s[0]&&(s[0]=r[n][0]),r[n][0]>s[1]&&(s[1]=r[n][0]),r[n][1]<s[2]&&(s[2]=r[n][1]),r[n][1]>s[3]&&(s[3]=r[n][1]),r[n][2]<s[4]&&(s[4]=r[n][2]),r[n][2]>s[5]&&(s[5]=r[n][2]);n=Qc(s[0]+(s[1]-s[0])/2,s[2]+(s[3]-s[2])/2,s[4]+(s[5]-s[4])/2,0);r=Pc();$c(a,n,r);y=Math.floor(s[0]);z=Math.ceil(s[1]);y==z&&z++;F=z-y;G=Math.floor(s[2]);
H=Math.ceil(s[3]);G==H&&H++;B=H-G;E=b[0];b=b[1];var n=Math.ceil(F/E),I=Math.ceil(B/b),N=new Uint8Array(4*n*I),Q=new gd;Q.Xe=n;Q.We=I;var I=Pc(),O=Qc(0,0,s[4],1),S=Rc();$c(g.Qh,a,S);for(var da=H-1E-7,J=z-1E-7,ca=0,la=0,U=0,V=G,V=G;V<=da;V+=b){U++;la=0;O[1]=V;for(n=y;n<=J;n+=E){la++;O[0]=n;cd(S,O,I);var Ga=4*ca,rb=Math.floor(I[2]),sb=Math.floor(I[1]),tb=Math.floor(I[0]);if(0<=tb&&tb<g.ca[0]&&0<=sb&&sb<g.ca[1]&&0<=rb&&rb<g.ca[2]){var jb=f[rb][sb][tb],Uc=tb=sb=rb=0;l?((jb=l.get(jb))||(jb=[0,0.61,0,0,
1]),rb=255*jb[1],sb=255*jb[2],tb=255*jb[3],Uc=255*jb[4]):(rb=sb=tb=255*((jb-g.ra)/(g.ia-g.ra)),Uc=255);N[Ga]=rb;N[++Ga]=sb;N[++Ga]=tb;N[++Ga]=Uc}else N[Ga]=0,N[++Ga]=0,N[++Ga]=0,N[++Ga]=0;ca++}}Q.Wb=N;j.G=Q;j.ei=s;j.Sh=a;j.Rh=S;j.Yh=G;j.ol=H;j.di=y;j.tl=z;j.jg=la;j.ig=U;j.Vc=E;j.K=F;j.Gc=b;j.A=B;j.z=[r[0],r[1],r[2]];j.gc=[c[0],c[1],c[2]];j.Oc=[k[0],k[1],k[2]];j.V=[d[0],d[1],d[2]];j.O=u;j.zb=g;j.Cb=g.zb!=t&&!h?u:q;j.ec=e;j.Hb();j.O=u;return j}
function Zd(a,b,c,e){var d;d=e.ma;for(var f=[],g=[],h=0;6>h;h++){var l=Math.floor(h/2),j=(l+1)%3,k=(l+2)%3,n=(2+2*l)%6,s=(4+2*l)%6,r=(d[h]-b[l])*(1/c[l]);if(Infinity!=r&&-Infinity!=r){var y=b[j]+c[j]*r,r=b[k]+c[k]*r;y>=d[n]&&y<=d[n+1]&&r>=d[s]&&r<=d[s+1]?(n=[],n[l]=d[h],n[j]=y,n[k]=r,f.push(n)):(n=[],n[l]=d[h],n[j]=y,n[k]=r,g.push(n))}}d=[f,g];b=d[0];e.b[a].k=d;d=Fc(new R(b[0][0],b[0][1],b[0][2]),new R(b[1][0],b[1][1],b[1][2]));e.b[a].nl=d;f=Nc(0,0,1);g=Wd(c,f)[0];h=Qc(e.ad[0],e.ad[1],e.ad[2],0);
f=Pc();cd(g,h,f);g=Pc();h=f[2];g[0]=c[0]*h;g[1]=c[1]*h;g[2]=c[2]*h;g[3]=c[3]*h;0.1>Math.abs(f[0])&&(f[0]=0.1);0.1>Math.abs(f[1])&&(f[1]=0.1);f[0]/=e.ae;f[1]/=e.ae;e.b[a].Ga=[Math.abs(f[0]),Math.abs(f[1])];e.b[a].Sc=f[2];e.b[a].B=g;d=Math.floor(Math.abs(d/f[2]));e.ud[a]=d+1;e.b[a].p=d+1;e.b[a].k[0][0][0]>e.b[a].k[0][1][0]?0<g[0]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][0]<e.b[a].k[0][1][0]?0>g[0]&&(