text: /*
   * Human Engine v9.2.0
   *
   * (c) 2015 BioDigital, Inc.
   *
   * Built: Fri May 26 2017 12:56:15 GMT-0400 (EDT)
   */
  
  /*
   * SceneJS V4.2.0
   *
   * A WebGL-based 3D scene graph from xeoLabs
   * http://scenejs.org/
   *
   * Built on 2015-04-21
   *
   * MIT License
   * Copyright 2015, Lindsay Kay
   * http://xeolabs.com/
   *
   */
  
  /*
   * Bezier.js
   *
   * A node.js and client-side library for (quadratic and cubic) Bezier curve work. 
   * https://pomax.github.io/bezierjs/
   *
   * MIT License
   * Copyright 2015, Mike Kamermans
   * https://github.com/Pomax/
   *
   */
  var glMatrix={};glMatrix.EPSILON=1e-6,glMatrix.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,glMatrix.RANDOM=Math.random,glMatrix.setMatrixArrayType=function(a){glMatrix.ARRAY_TYPE=a};var degree=Math.PI/180;glMatrix.toRadian=function(a){return a*degree},glMatrix.equals=function(a,b){return Math.abs(a-b)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(b))};var mat4={};mat4.create=function(){var a=new glMatrix.ARRAY_TYPE(16);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.clone=function(a){var b=new glMatrix.ARRAY_TYPE(16);return 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],b},mat4.copy=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a},mat4.fromValues=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){var q=new glMatrix.ARRAY_TYPE(16);return q[0]=a,q[1]=b,q[2]=c,q[3]=d,q[4]=e,q[5]=f,q[6]=g,q[7]=h,q[8]=i,q[9]=j,q[10]=k,q[11]=l,q[12]=m,q[13]=n,q[14]=o,q[15]=p,q},mat4.set=function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){return a[0]=b,a[1]=c,a[2]=d,a[3]=e,a[4]=f,a[5]=g,a[6]=h,a[7]=i,a[8]=j,a[9]=k,a[10]=l,a[11]=m,a[12]=n,a[13]=o,a[14]=p,a[15]=q,a},mat4.identity=function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.transpose=function(a,b){if(a===b){var c=b[1],d=b[2],e=b[3],f=b[6],g=b[7],h=b[11];a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=c,a[6]=b[9],a[7]=b[13],a[8]=d,a[9]=f,a[11]=b[14],a[12]=e,a[13]=g,a[14]=h}else a[0]=b[0],a[1]=b[4],a[2]=b[8],a[3]=b[12],a[4]=b[1],a[5]=b[5],a[6]=b[9],a[7]=b[13],a[8]=b[2],a[9]=b[6],a[10]=b[10],a[11]=b[14],a[12]=b[3],a[13]=b[7],a[14]=b[11],a[15]=b[15];return a},mat4.invert=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],m=b[10],n=b[11],o=b[12],p=b[13],q=b[14],r=b[15],s=c*h-d*g,t=c*i-e*g,u=c*j-f*g,v=d*i-e*h,w=d*j-f*h,x=e*j-f*i,y=k*p-l*o,z=k*q-m*o,A=k*r-n*o,B=l*q-m*p,C=l*r-n*p,D=m*r-n*q,E=s*D-t*C+u*B+v*A-w*z+x*y;return E?(E=1/E,a[0]=(h*D-i*C+j*B)*E,a[1]=(e*C-d*D-f*B)*E,a[2]=(p*x-q*w+r*v)*E,a[3]=(m*w-l*x-n*v)*E,a[4]=(i*A-g*D-j*z)*E,a[5]=(c*D-e*A+f*z)*E,a[6]=(q*u-o*x-r*t)*E,a[7]=(k*x-m*u+n*t)*E,a[8]=(g*C-h*A+j*y)*E,a[9]=(d*A-c*C-f*y)*E,a[10]=(o*w-p*u+r*s)*E,a[11]=(l*u-k*w-n*s)*E,a[12]=(h*z-g*B-i*y)*E,a[13]=(c*B-d*z+e*y)*E,a[14]=(p*t-o*v-q*s)*E,a[15]=(k*v-l*t+m*s)*E,a):null},mat4.adjoint=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],m=b[10],n=b[11],o=b[12],p=b[13],q=b[14],r=b[15];return a[0]=h*(m*r-n*q)-l*(i*r-j*q)+p*(i*n-j*m),a[1]=-(d*(m*r-n*q)-l*(e*r-f*q)+p*(e*n-f*m)),a[2]=d*(i*r-j*q)-h*(e*r-f*q)+p*(e*j-f*i),a[3]=-(d*(i*n-j*m)-h*(e*n-f*m)+l*(e*j-f*i)),a[4]=-(g*(m*r-n*q)-k*(i*r-j*q)+o*(i*n-j*m)),a[5]=c*(m*r-n*q)-k*(e*r-f*q)+o*(e*n-f*m),a[6]=-(c*(i*r-j*q)-g*(e*r-f*q)+o*(e*j-f*i)),a[7]=c*(i*n-j*m)-g*(e*n-f*m)+k*(e*j-f*i),a[8]=g*(l*r-n*p)-k*(h*r-j*p)+o*(h*n-j*l),a[9]=-(c*(l*r-n*p)-k*(d*r-f*p)+o*(d*n-f*l)),a[10]=c*(h*r-j*p)-g*(d*r-f*p)+o*(d*j-f*h),a[11]=-(c*(h*n-j*l)-g*(d*n-f*l)+k*(d*j-f*h)),a[12]=-(g*(l*q-m*p)-k*(h*q-i*p)+o*(h*m-i*l)),a[13]=c*(l*q-m*p)-k*(d*q-e*p)+o*(d*m-e*l),a[14]=-(c*(h*q-i*p)-g*(d*q-e*p)+o*(d*i-e*h)),a[15]=c*(h*m-i*l)-g*(d*m-e*l)+k*(d*i-e*h),a},mat4.determinant=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],j=a[8],k=a[9],l=a[10],m=a[11],n=a[12],o=a[13],p=a[14],q=a[15],r=b*g-c*f,s=b*h-d*f,t=b*i-e*f,u=c*h-d*g,v=c*i-e*g,w=d*i-e*h,x=j*o-k*n,y=j*p-l*n,z=j*q-m*n,A=k*p-l*o,B=k*q-m*o,C=l*q-m*p;return r*C-s*B+t*A+u*z-v*y+w*x},mat4.multiply=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=b[9],n=b[10],o=b[11],p=b[12],q=b[13],r=b[14],s=b[15],t=c[0],u=c[1],v=c[2],w=c[3];return a[0]=t*d+u*h+v*l+w*p,a[1]=t*e+u*i+v*m+w*q,a[2]=t*f+u*j+v*n+w*r,a[3]=t*g+u*k+v*o+w*s,t=c[4],u=c[5],v=c[6],w=c[7],a[4]=t*d+u*h+v*l+w*p,a[5]=t*e+u*i+v*m+w*q,a[6]=t*f+u*j+v*n+w*r,a[7]=t*g+u*k+v*o+w*s,t=c[8],u=c[9],v=c[10],w=c[11],a[8]=t*d+u*h+v*l+w*p,a[9]=t*e+u*i+v*m+w*q,a[10]=t*f+u*j+v*n+w*r,a[11]=t*g+u*k+v*o+w*s,t=c[12],u=c[13],v=c[14],w=c[15],a[12]=t*d+u*h+v*l+w*p,a[13]=t*e+u*i+v*m+w*q,a[14]=t*f+u*j+v*n+w*r,a[15]=t*g+u*k+v*o+w*s,a},mat4.mul=mat4.multiply,mat4.translate=function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n,o,p=c[0],q=c[1],r=c[2];return b===a?(a[12]=b[0]*p+b[4]*q+b[8]*r+b[12],a[13]=b[1]*p+b[5]*q+b[9]*r+b[13],a[14]=b[2]*p+b[6]*q+b[10]*r+b[14],a[15]=b[3]*p+b[7]*q+b[11]*r+b[15]):(d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=b[9],n=b[10],o=b[11],a[0]=d,a[1]=e,a[2]=f,a[3]=g,a[4]=h,a[5]=i,a[6]=j,a[7]=k,a[8]=l,a[9]=m,a[10]=n,a[11]=o,a[12]=d*p+h*q+l*r+b[12],a[13]=e*p+i*q+m*r+b[13],a[14]=f*p+j*q+n*r+b[14],a[15]=g*p+k*q+o*r+b[15]),a},mat4.scale=function(a,b,c){var d=c[0],e=c[1],f=c[2];return a[0]=b[0]*d,a[1]=b[1]*d,a[2]=b[2]*d,a[3]=b[3]*d,a[4]=b[4]*e,a[5]=b[5]*e,a[6]=b[6]*e,a[7]=b[7]*e,a[8]=b[8]*f,a[9]=b[9]*f,a[10]=b[10]*f,a[11]=b[11]*f,a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15],a},mat4.rotate=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C=d[0],D=d[1],E=d[2],F=Math.sqrt(C*C+D*D+E*E);return Math.abs(F)<glMatrix.EPSILON?null:(F=1/F,C*=F,D*=F,E*=F,e=Math.sin(c),f=Math.cos(c),g=1-f,h=b[0],i=b[1],j=b[2],k=b[3],l=b[4],m=b[5],n=b[6],o=b[7],p=b[8],q=b[9],r=b[10],s=b[11],t=C*C*g+f,u=D*C*g+E*e,v=E*C*g-D*e,w=C*D*g-E*e,x=D*D*g+f,y=E*D*g+C*e,z=C*E*g+D*e,A=D*E*g-C*e,B=E*E*g+f,a[0]=h*t+l*u+p*v,a[1]=i*t+m*u+q*v,a[2]=j*t+n*u+r*v,a[3]=k*t+o*u+s*v,a[4]=h*w+l*x+p*y,a[5]=i*w+m*x+q*y,a[6]=j*w+n*x+r*y,a[7]=k*w+o*x+s*y,a[8]=h*z+l*A+p*B,a[9]=i*z+m*A+q*B,a[10]=j*z+n*A+r*B,a[11]=k*z+o*A+s*B,b!==a&&(a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a)},mat4.rotateX=function(a,b,c){var d=Math.sin(c),e=Math.cos(c),f=b[4],g=b[5],h=b[6],i=b[7],j=b[8],k=b[9],l=b[10],m=b[11];return b!==a&&(a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[4]=f*e+j*d,a[5]=g*e+k*d,a[6]=h*e+l*d,a[7]=i*e+m*d,a[8]=j*e-f*d,a[9]=k*e-g*d,a[10]=l*e-h*d,a[11]=m*e-i*d,a},mat4.rotateY=function(a,b,c){var d=Math.sin(c),e=Math.cos(c),f=b[0],g=b[1],h=b[2],i=b[3],j=b[8],k=b[9],l=b[10],m=b[11];return b!==a&&(a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=f*e-j*d,a[1]=g*e-k*d,a[2]=h*e-l*d,a[3]=i*e-m*d,a[8]=f*d+j*e,a[9]=g*d+k*e,a[10]=h*d+l*e,a[11]=i*d+m*e,a},mat4.rotateZ=function(a,b,c){var d=Math.sin(c),e=Math.cos(c),f=b[0],g=b[1],h=b[2],i=b[3],j=b[4],k=b[5],l=b[6],m=b[7];return b!==a&&(a[8]=b[8],a[9]=b[9],a[10]=b[10],a[11]=b[11],a[12]=b[12],a[13]=b[13],a[14]=b[14],a[15]=b[15]),a[0]=f*e+j*d,a[1]=g*e+k*d,a[2]=h*e+l*d,a[3]=i*e+m*d,a[4]=j*e-f*d,a[5]=k*e-g*d,a[6]=l*e-h*d,a[7]=m*e-i*d,a},mat4.fromTranslation=function(a,b){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=b[0],a[13]=b[1],a[14]=b[2],a[15]=1,a},mat4.fromScaling=function(a,b){return a[0]=b[0],a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=b[1],a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=b[2],a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.fromRotation=function(a,b,c){var d,e,f,g=c[0],h=c[1],i=c[2],j=Math.sqrt(g*g+h*h+i*i);return Math.abs(j)<glMatrix.EPSILON?null:(j=1/j,g*=j,h*=j,i*=j,d=Math.sin(b),e=Math.cos(b),f=1-e,a[0]=g*g*f+e,a[1]=h*g*f+i*d,a[2]=i*g*f-h*d,a[3]=0,a[4]=g*h*f-i*d,a[5]=h*h*f+e,a[6]=i*h*f+g*d,a[7]=0,a[8]=g*i*f+h*d,a[9]=h*i*f-g*d,a[10]=i*i*f+e,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a)},mat4.fromXRotation=function(a,b){var c=Math.sin(b),d=Math.cos(b);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=d,a[6]=c,a[7]=0,a[8]=0,a[9]=-c,a[10]=d,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.fromYRotation=function(a,b){var c=Math.sin(b),d=Math.cos(b);return a[0]=d,a[1]=0,a[2]=-c,a[3]=0,a[4]=0,a[5]=1,a[6]=0,a[7]=0,a[8]=c,a[9]=0,a[10]=d,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.fromZRotation=function(a,b){var c=Math.sin(b),d=Math.cos(b);return a[0]=d,a[1]=c,a[2]=0,a[3]=0,a[4]=-c,a[5]=d,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=1,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.fromRotationTranslation=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=d+d,i=e+e,j=f+f,k=d*h,l=d*i,m=d*j,n=e*i,o=e*j,p=f*j,q=g*h,r=g*i,s=g*j;return a[0]=1-(n+p),a[1]=l+s,a[2]=m-r,a[3]=0,a[4]=l-s,a[5]=1-(k+p),a[6]=o+q,a[7]=0,a[8]=m+r,a[9]=o-q,a[10]=1-(k+n),a[11]=0,a[12]=c[0],a[13]=c[1],a[14]=c[2],a[15]=1,a},mat4.getTranslation=function(a,b){return a[0]=b[12],a[1]=b[13],a[2]=b[14],a},mat4.getScaling=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[4],g=b[5],h=b[6],i=b[8],j=b[9],k=b[10];return a[0]=Math.sqrt(c*c+d*d+e*e),a[1]=Math.sqrt(f*f+g*g+h*h),a[2]=Math.sqrt(i*i+j*j+k*k),a},mat4.getRotation=function(a,b){var c=b[0]+b[5]+b[10],d=0;return c>0?(d=2*Math.sqrt(c+1),a[3]=.25*d,a[0]=(b[6]-b[9])/d,a[1]=(b[8]-b[2])/d,a[2]=(b[1]-b[4])/d):b[0]>b[5]&b[0]>b[10]?(d=2*Math.sqrt(1+b[0]-b[5]-b[10]),a[3]=(b[6]-b[9])/d,a[0]=.25*d,a[1]=(b[1]+b[4])/d,a[2]=(b[8]+b[2])/d):b[5]>b[10]?(d=2*Math.sqrt(1+b[5]-b[0]-b[10]),a[3]=(b[8]-b[2])/d,a[0]=(b[1]+b[4])/d,a[1]=.25*d,a[2]=(b[6]+b[9])/d):(d=2*Math.sqrt(1+b[10]-b[0]-b[5]),a[3]=(b[1]-b[4])/d,a[0]=(b[8]+b[2])/d,a[1]=(b[6]+b[9])/d,a[2]=.25*d),a},mat4.fromRotationTranslationScale=function(a,b,c,d){var e=b[0],f=b[1],g=b[2],h=b[3],i=e+e,j=f+f,k=g+g,l=e*i,m=e*j,n=e*k,o=f*j,p=f*k,q=g*k,r=h*i,s=h*j,t=h*k,u=d[0],v=d[1],w=d[2];return a[0]=(1-(o+q))*u,a[1]=(m+t)*u,a[2]=(n-s)*u,a[3]=0,a[4]=(m-t)*v,a[5]=(1-(l+q))*v,a[6]=(p+r)*v,a[7]=0,a[8]=(n+s)*w,a[9]=(p-r)*w,a[10]=(1-(l+o))*w,a[11]=0,a[12]=c[0],a[13]=c[1],a[14]=c[2],a[15]=1,a},mat4.fromRotationTranslationScaleOrigin=function(a,b,c,d,e){var f=b[0],g=b[1],h=b[2],i=b[3],j=f+f,k=g+g,l=h+h,m=f*j,n=f*k,o=f*l,p=g*k,q=g*l,r=h*l,s=i*j,t=i*k,u=i*l,v=d[0],w=d[1],x=d[2],y=e[0],z=e[1],A=e[2];return a[0]=(1-(p+r))*v,a[1]=(n+u)*v,a[2]=(o-t)*v,a[3]=0,a[4]=(n-u)*w,a[5]=(1-(m+r))*w,a[6]=(q+s)*w,a[7]=0,a[8]=(o+t)*x,a[9]=(q-s)*x,a[10]=(1-(m+p))*x,a[11]=0,a[12]=c[0]+y-(a[0]*y+a[4]*z+a[8]*A),a[13]=c[1]+z-(a[1]*y+a[5]*z+a[9]*A),a[14]=c[2]+A-(a[2]*y+a[6]*z+a[10]*A),a[15]=1,a},mat4.fromQuat=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c+c,h=d+d,i=e+e,j=c*g,k=d*g,l=d*h,m=e*g,n=e*h,o=e*i,p=f*g,q=f*h,r=f*i;return a[0]=1-l-o,a[1]=k+r,a[2]=m-q,a[3]=0,a[4]=k-r,a[5]=1-j-o,a[6]=n+p,a[7]=0,a[8]=m+q,a[9]=n-p,a[10]=1-j-l,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,a},mat4.frustum=function(a,b,c,d,e,f,g){var h=1/(c-b),i=1/(e-d),j=1/(f-g);return a[0]=2*f*h,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*f*i,a[6]=0,a[7]=0,a[8]=(c+b)*h,a[9]=(e+d)*i,a[10]=(g+f)*j,a[11]=-1,a[12]=0,a[13]=0,a[14]=g*f*2*j,a[15]=0,a},mat4.perspective=function(a,b,c,d,e){var f=1/Math.tan(b/2),g=1/(d-e);return a[0]=f/c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=f,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=(e+d)*g,a[11]=-1,a[12]=0,a[13]=0,a[14]=2*e*d*g,a[15]=0,a},mat4.perspectiveFromFieldOfView=function(a,b,c,d){var e=Math.tan(b.upDegrees*Math.PI/180),f=Math.tan(b.downDegrees*Math.PI/180),g=Math.tan(b.leftDegrees*Math.PI/180),h=Math.tan(b.rightDegrees*Math.PI/180),i=2/(g+h),j=2/(e+f);return a[0]=i,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=j,a[6]=0,a[7]=0,a[8]=-((g-h)*i*.5),a[9]=(e-f)*j*.5,a[10]=d/(c-d),a[11]=-1,a[12]=0,a[13]=0,a[14]=d*c/(c-d),a[15]=0,a},mat4.ortho=function(a,b,c,d,e,f,g){var h=1/(b-c),i=1/(d-e),j=1/(f-g);return a[0]=-2*h,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=-2*i,a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2*j,a[11]=0,a[12]=(b+c)*h,a[13]=(e+d)*i,a[14]=(g+f)*j,a[15]=1,a},mat4.lookAt=function(a,b,c,d){var e,f,g,h,i,j,k,l,m,n,o=b[0],p=b[1],q=b[2],r=d[0],s=d[1],t=d[2],u=c[0],v=c[1],w=c[2];return Math.abs(o-u)<glMatrix.EPSILON&&Math.abs(p-v)<glMatrix.EPSILON&&Math.abs(q-w)<glMatrix.EPSILON?mat4.identity(a):(k=o-u,l=p-v,m=q-w,n=1/Math.sqrt(k*k+l*l+m*m),k*=n,l*=n,m*=n,e=s*m-t*l,f=t*k-r*m,g=r*l-s*k,n=Math.sqrt(e*e+f*f+g*g),n?(n=1/n,e*=n,f*=n,g*=n):(e=0,f=0,g=0),h=l*g-m*f,i=m*e-k*g,j=k*f-l*e,n=Math.sqrt(h*h+i*i+j*j),n?(n=1/n,h*=n,i*=n,j*=n):(h=0,i=0,j=0),a[0]=e,a[1]=h,a[2]=k,a[3]=0,a[4]=f,a[5]=i,a[6]=l,a[7]=0,a[8]=g,a[9]=j,a[10]=m,a[11]=0,a[12]=-(e*o+f*p+g*q),a[13]=-(h*o+i*p+j*q),a[14]=-(k*o+l*p+m*q),a[15]=1,a)},mat4.str=function(a){return"mat4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+")"},mat4.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2)+Math.pow(a[9],2)+Math.pow(a[10],2)+Math.pow(a[11],2)+Math.pow(a[12],2)+Math.pow(a[13],2)+Math.pow(a[14],2)+Math.pow(a[15],2))},mat4.add=function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a[3]=b[3]+c[3],a[4]=b[4]+c[4],a[5]=b[5]+c[5],a[6]=b[6]+c[6],a[7]=b[7]+c[7],a[8]=b[8]+c[8],a[9]=b[9]+c[9],a[10]=b[10]+c[10],a[11]=b[11]+c[11],a[12]=b[12]+c[12],a[13]=b[13]+c[13],a[14]=b[14]+c[14],a[15]=b[15]+c[15],a},mat4.subtract=function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a[3]=b[3]-c[3],a[4]=b[4]-c[4],a[5]=b[5]-c[5],a[6]=b[6]-c[6],a[7]=b[7]-c[7],a[8]=b[8]-c[8],a[9]=b[9]-c[9],a[10]=b[10]-c[10],a[11]=b[11]-c[11],a[12]=b[12]-c[12],a[13]=b[13]-c[13],a[14]=b[14]-c[14],a[15]=b[15]-c[15],a},mat4.sub=mat4.subtract,mat4.multiplyScalar=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*c,a[5]=b[5]*c,a[6]=b[6]*c,a[7]=b[7]*c,a[8]=b[8]*c,a[9]=b[9]*c,a[10]=b[10]*c,a[11]=b[11]*c,a[12]=b[12]*c,a[13]=b[13]*c,a[14]=b[14]*c,a[15]=b[15]*c,a},mat4.multiplyScalarAndAdd=function(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a[3]=b[3]+c[3]*d,a[4]=b[4]+c[4]*d,a[5]=b[5]+c[5]*d,a[6]=b[6]+c[6]*d,a[7]=b[7]+c[7]*d,a[8]=b[8]+c[8]*d,a[9]=b[9]+c[9]*d,a[10]=b[10]+c[10]*d,a[11]=b[11]+c[11]*d,a[12]=b[12]+c[12]*d,a[13]=b[13]+c[13]*d,a[14]=b[14]+c[14]*d,a[15]=b[15]+c[15]*d,a},mat4.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]&&a[9]===b[9]&&a[10]===b[10]&&a[11]===b[11]&&a[12]===b[12]&&a[13]===b[13]&&a[14]===b[14]&&a[15]===b[15]},mat4.equals=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=a[9],m=a[10],n=a[11],o=a[12],p=a[13],q=a[14],r=a[15],s=b[0],t=b[1],u=b[2],v=b[3],w=b[4],x=b[5],y=b[6],z=b[7],A=b[8],B=b[9],C=b[10],D=b[11],E=b[12],F=b[13],G=b[14],H=b[15];return Math.abs(c-s)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(s))&&Math.abs(d-t)<=glMatrix.EPSILON*Math.max(1,Math.abs(d),Math.abs(t))&&Math.abs(e-u)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(f-v)<=glMatrix.EPSILON*Math.max(1,Math.abs(f),Math.abs(v))&&Math.abs(g-w)<=glMatrix.EPSILON*Math.max(1,Math.abs(g),Math.abs(w))&&Math.abs(h-x)<=glMatrix.EPSILON*Math.max(1,Math.abs(h),Math.abs(x))&&Math.abs(i-y)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(j-z)<=glMatrix.EPSILON*Math.max(1,Math.abs(j),Math.abs(z))&&Math.abs(k-A)<=glMatrix.EPSILON*Math.max(1,Math.abs(k),Math.abs(A))&&Math.abs(l-B)<=glMatrix.EPSILON*Math.max(1,Math.abs(l),Math.abs(B))&&Math.abs(m-C)<=glMatrix.EPSILON*Math.max(1,Math.abs(m),Math.abs(C))&&Math.abs(n-D)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(D))&&Math.abs(o-E)<=glMatrix.EPSILON*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(p-F)<=glMatrix.EPSILON*Math.max(1,Math.abs(p),Math.abs(F))&&Math.abs(q-G)<=glMatrix.EPSILON*Math.max(1,Math.abs(q),Math.abs(G))&&Math.abs(r-H)<=glMatrix.EPSILON*Math.max(1,Math.abs(r),Math.abs(H))};var mat3={};mat3.create=function(){var a=new glMatrix.ARRAY_TYPE(9);return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},mat3.fromMat4=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[4],a[4]=b[5],a[5]=b[6],a[6]=b[8],a[7]=b[9],a[8]=b[10],a},mat3.clone=function(a){var b=new glMatrix.ARRAY_TYPE(9);return 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},mat3.copy=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a[4]=b[4],a[5]=b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a},mat3.fromValues=function(a,b,c,d,e,f,g,h,i){var j=new glMatrix.ARRAY_TYPE(9);return j[0]=a,j[1]=b,j[2]=c,j[3]=d,j[4]=e,j[5]=f,j[6]=g,j[7]=h,j[8]=i,j},mat3.set=function(a,b,c,d,e,f,g,h,i,j){return a[0]=b,a[1]=c,a[2]=d,a[3]=e,a[4]=f,a[5]=g,a[6]=h,a[7]=i,a[8]=j,a},mat3.identity=function(a){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},mat3.transpose=function(a,b){if(a===b){var c=b[1],d=b[2],e=b[5];a[1]=b[3],a[2]=b[6],a[3]=c,a[5]=b[7],a[6]=d,a[7]=e}else a[0]=b[0],a[1]=b[3],a[2]=b[6],a[3]=b[1],a[4]=b[4],a[5]=b[7],a[6]=b[2],a[7]=b[5],a[8]=b[8];return a},mat3.invert=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=k*g-h*j,m=-k*f+h*i,n=j*f-g*i,o=c*l+d*m+e*n;return o?(o=1/o,a[0]=l*o,a[1]=(-k*d+e*j)*o,a[2]=(h*d-e*g)*o,a[3]=m*o,a[4]=(k*c-e*i)*o,a[5]=(-h*c+e*f)*o,a[6]=n*o,a[7]=(-j*c+d*i)*o,a[8]=(g*c-d*f)*o,a):null},mat3.adjoint=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8];return a[0]=g*k-h*j,a[1]=e*j-d*k,a[2]=d*h-e*g,a[3]=h*i-f*k,a[4]=c*k-e*i,a[5]=e*f-c*h,a[6]=f*j-g*i,a[7]=d*i-c*j,a[8]=c*g-d*f,a},mat3.determinant=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],h=a[6],i=a[7],j=a[8];return b*(j*f-g*i)+c*(-j*e+g*h)+d*(i*e-f*h)},mat3.multiply=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=c[0],n=c[1],o=c[2],p=c[3],q=c[4],r=c[5],s=c[6],t=c[7],u=c[8];return a[0]=m*d+n*g+o*j,a[1]=m*e+n*h+o*k,a[2]=m*f+n*i+o*l,a[3]=p*d+q*g+r*j,a[4]=p*e+q*h+r*k,a[5]=p*f+q*i+r*l,a[6]=s*d+t*g+u*j,a[7]=s*e+t*h+u*k,a[8]=s*f+t*i+u*l,a},mat3.mul=mat3.multiply,mat3.translate=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=c[0],n=c[1];return a[0]=d,a[1]=e,a[2]=f,a[3]=g,a[4]=h,a[5]=i,a[6]=m*d+n*g+j,a[7]=m*e+n*h+k,a[8]=m*f+n*i+l,a},mat3.rotate=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=b[4],i=b[5],j=b[6],k=b[7],l=b[8],m=Math.sin(c),n=Math.cos(c);return a[0]=n*d+m*g,a[1]=n*e+m*h,a[2]=n*f+m*i,a[3]=n*g-m*d,a[4]=n*h-m*e,a[5]=n*i-m*f,a[6]=j,a[7]=k,a[8]=l,a},mat3.scale=function(a,b,c){var d=c[0],e=c[1];return a[0]=d*b[0],a[1]=d*b[1],a[2]=d*b[2],a[3]=e*b[3],a[4]=e*b[4],a[5]=e*b[5],a[6]=b[6],a[7]=b[7],a[8]=b[8],a},mat3.fromTranslation=function(a,b){return a[0]=1,a[1]=0,a[2]=0,a[3]=0,a[4]=1,a[5]=0,a[6]=b[0],a[7]=b[1],a[8]=1,a},mat3.fromRotation=function(a,b){var c=Math.sin(b),d=Math.cos(b);return a[0]=d,a[1]=c,a[2]=0,a[3]=-c,a[4]=d,a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},mat3.fromScaling=function(a,b){return a[0]=b[0],a[1]=0,a[2]=0,a[3]=0,a[4]=b[1],a[5]=0,a[6]=0,a[7]=0,a[8]=1,a},mat3.fromMat2d=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=0,a[3]=b[2],a[4]=b[3],a[5]=0,a[6]=b[4],a[7]=b[5],a[8]=1,a},mat3.fromQuat=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c+c,h=d+d,i=e+e,j=c*g,k=d*g,l=d*h,m=e*g,n=e*h,o=e*i,p=f*g,q=f*h,r=f*i;return a[0]=1-l-o,a[3]=k-r,a[6]=m+q,a[1]=k+r,a[4]=1-j-o,a[7]=n-p,a[2]=m-q,a[5]=n+p,a[8]=1-j-l,a},mat3.normalFromMat4=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5],i=b[6],j=b[7],k=b[8],l=b[9],m=b[10],n=b[11],o=b[12],p=b[13],q=b[14],r=b[15],s=c*h-d*g,t=c*i-e*g,u=c*j-f*g,v=d*i-e*h,w=d*j-f*h,x=e*j-f*i,y=k*p-l*o,z=k*q-m*o,A=k*r-n*o,B=l*q-m*p,C=l*r-n*p,D=m*r-n*q,E=s*D-t*C+u*B+v*A-w*z+x*y;return E?(E=1/E,a[0]=(h*D-i*C+j*B)*E,a[1]=(i*A-g*D-j*z)*E,a[2]=(g*C-h*A+j*y)*E,a[3]=(e*C-d*D-f*B)*E,a[4]=(c*D-e*A+f*z)*E,a[5]=(d*A-c*C-f*y)*E,a[6]=(p*x-q*w+r*v)*E,a[7]=(q*u-o*x-r*t)*E,a[8]=(o*w-p*u+r*s)*E,a):null},mat3.str=function(a){return"mat3("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+")"},mat3.frob=function(a){return Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)+Math.pow(a[2],2)+Math.pow(a[3],2)+Math.pow(a[4],2)+Math.pow(a[5],2)+Math.pow(a[6],2)+Math.pow(a[7],2)+Math.pow(a[8],2))},mat3.add=function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a[3]=b[3]+c[3],a[4]=b[4]+c[4],a[5]=b[5]+c[5],a[6]=b[6]+c[6],a[7]=b[7]+c[7],a[8]=b[8]+c[8],a},mat3.subtract=function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a[3]=b[3]-c[3],a[4]=b[4]-c[4],a[5]=b[5]-c[5],a[6]=b[6]-c[6],a[7]=b[7]-c[7],a[8]=b[8]-c[8],a},mat3.sub=mat3.subtract,mat3.multiplyScalar=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a[4]=b[4]*c,a[5]=b[5]*c,a[6]=b[6]*c,a[7]=b[7]*c,a[8]=b[8]*c,a},mat3.multiplyScalarAndAdd=function(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a[3]=b[3]+c[3]*d,a[4]=b[4]+c[4]*d,a[5]=b[5]+c[5]*d,a[6]=b[6]+c[6]*d,a[7]=b[7]+c[7]*d,a[8]=b[8]+c[8]*d,a},mat3.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]&&a[4]===b[4]&&a[5]===b[5]&&a[6]===b[6]&&a[7]===b[7]&&a[8]===b[8]},mat3.equals=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i=a[6],j=a[7],k=a[8],l=b[0],m=b[1],n=b[2],o=b[3],p=b[4],q=b[5],r=b[6],s=b[7],t=b[8];return Math.abs(c-l)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(l))&&Math.abs(d-m)<=glMatrix.EPSILON*Math.max(1,Math.abs(d),Math.abs(m))&&Math.abs(e-n)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(n))&&Math.abs(f-o)<=glMatrix.EPSILON*Math.max(1,Math.abs(f),Math.abs(o))&&Math.abs(g-p)<=glMatrix.EPSILON*Math.max(1,Math.abs(g),Math.abs(p))&&Math.abs(h-q)<=glMatrix.EPSILON*Math.max(1,Math.abs(h),Math.abs(q))&&Math.abs(i-r)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(r))&&Math.abs(j-s)<=glMatrix.EPSILON*Math.max(1,Math.abs(j),Math.abs(s))&&Math.abs(k-t)<=glMatrix.EPSILON*Math.max(1,Math.abs(k),Math.abs(t))};var vec2={};vec2.create=function(){var a=new glMatrix.ARRAY_TYPE(2);return a[0]=0,a[1]=0,a},vec2.clone=function(a){var b=new glMatrix.ARRAY_TYPE(2);return b[0]=a[0],b[1]=a[1],b},vec2.fromValues=function(a,b){var c=new glMatrix.ARRAY_TYPE(2);return c[0]=a,c[1]=b,c},vec2.copy=function(a,b){return a[0]=b[0],a[1]=b[1],a},vec2.set=function(a,b,c){return a[0]=b,a[1]=c,a},vec2.add=function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a},vec2.subtract=function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a},vec2.sub=vec2.subtract,vec2.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a},vec2.mul=vec2.multiply,vec2.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a},vec2.div=vec2.divide,vec2.ceil=function(a,b){return a[0]=Math.ceil(b[0]),a[1]=Math.ceil(b[1]),a},vec2.floor=function(a,b){return a[0]=Math.floor(b[0]),a[1]=Math.floor(b[1]),a},vec2.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a},vec2.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a},vec2.round=function(a,b){return a[0]=Math.round(b[0]),a[1]=Math.round(b[1]),a},vec2.scale=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a},vec2.scaleAndAdd=function(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a},vec2.distance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return Math.sqrt(c*c+d*d)},vec2.dist=vec2.distance,vec2.squaredDistance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1];return c*c+d*d},vec2.sqrDist=vec2.squaredDistance,vec2.length=function(a){var b=a[0],c=a[1];return Math.sqrt(b*b+c*c)},vec2.len=vec2.length,vec2.squaredLength=function(a){var b=a[0],c=a[1];return b*b+c*c},vec2.sqrLen=vec2.squaredLength,vec2.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a},vec2.inverse=function(a,b){return a[0]=1/b[0],a[1]=1/b[1],a},vec2.normalize=function(a,b){var c=b[0],d=b[1],e=c*c+d*d;return e>0&&(e=1/Math.sqrt(e),a[0]=b[0]*e,a[1]=b[1]*e),a},vec2.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]},vec2.cross=function(a,b,c){var d=b[0]*c[1]-b[1]*c[0];return a[0]=a[1]=0,a[2]=d,a},vec2.lerp=function(a,b,c,d){var e=b[0],f=b[1];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a},vec2.random=function(a,b){b=b||1;var c=2*glMatrix.RANDOM()*Math.PI;return a[0]=Math.cos(c)*b,a[1]=Math.sin(c)*b,a},vec2.transformMat2=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[2]*e,a[1]=c[1]*d+c[3]*e,a},vec2.transformMat2d=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[2]*e+c[4],a[1]=c[1]*d+c[3]*e+c[5],a},vec2.transformMat3=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[3]*e+c[6],a[1]=c[1]*d+c[4]*e+c[7],a},vec2.transformMat4=function(a,b,c){var d=b[0],e=b[1];return a[0]=c[0]*d+c[4]*e+c[12],a[1]=c[1]*d+c[5]*e+c[13],a},vec2.forEach=function(){var a=vec2.create();return function(b,c,d,e,f,g){var h,i;for(c||(c=2),d||(d=0),i=e?Math.min(e*c+d,b.length):b.length,h=d;i>h;h+=c)a[0]=b[h],a[1]=b[h+1],f(a,a,g),b[h]=a[0],b[h+1]=a[1];return b}}(),vec2.str=function(a){return"vec2("+a[0]+", "+a[1]+")"},vec2.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]},vec2.equals=function(a,b){var c=a[0],d=a[1],e=b[0],f=b[1];return Math.abs(c-e)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(e))&&Math.abs(d-f)<=glMatrix.EPSILON*Math.max(1,Math.abs(d),Math.abs(f))};var vec3={};vec3.create=function(){var a=new glMatrix.ARRAY_TYPE(3);return a[0]=0,a[1]=0,a[2]=0,a},vec3.clone=function(a){var b=new glMatrix.ARRAY_TYPE(3);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b},vec3.fromValues=function(a,b,c){var d=new glMatrix.ARRAY_TYPE(3);return d[0]=a,d[1]=b,d[2]=c,d},vec3.copy=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a},vec3.set=function(a,b,c,d){return a[0]=b,a[1]=c,a[2]=d,a},vec3.add=function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a},vec3.subtract=function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a},vec3.sub=vec3.subtract,vec3.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a},vec3.mul=vec3.multiply,vec3.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a},vec3.div=vec3.divide,vec3.ceil=function(a,b){return a[0]=Math.ceil(b[0]),a[1]=Math.ceil(b[1]),a[2]=Math.ceil(b[2]),a},vec3.floor=function(a,b){return a[0]=Math.floor(b[0]),a[1]=Math.floor(b[1]),a[2]=Math.floor(b[2]),a},vec3.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a[2]=Math.min(b[2],c[2]),a},vec3.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a},vec3.round=function(a,b){return a[0]=Math.round(b[0]),a[1]=Math.round(b[1]),a[2]=Math.round(b[2]),a},vec3.scale=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a},vec3.scaleAndAdd=function(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a},vec3.distance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2];return Math.sqrt(c*c+d*d+e*e)},vec3.dist=vec3.distance,vec3.squaredDistance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2];return c*c+d*d+e*e},vec3.sqrDist=vec3.squaredDistance,vec3.length=function(a){var b=a[0],c=a[1],d=a[2];return Math.sqrt(b*b+c*c+d*d)},vec3.len=vec3.length,vec3.squaredLength=function(a){var b=a[0],c=a[1],d=a[2];return b*b+c*c+d*d},vec3.sqrLen=vec3.squaredLength,vec3.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a},vec3.inverse=function(a,b){return a[0]=1/b[0],a[1]=1/b[1],a[2]=1/b[2],a},vec3.normalize=function(a,b){var c=b[0],d=b[1],e=b[2],f=c*c+d*d+e*e;return f>0&&(f=1/Math.sqrt(f),a[0]=b[0]*f,a[1]=b[1]*f,a[2]=b[2]*f),a},vec3.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]},vec3.cross=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2];return a[0]=e*i-f*h,a[1]=f*g-d*i,a[2]=d*h-e*g,a},vec3.lerp=function(a,b,c,d){var e=b[0],f=b[1],g=b[2];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a[2]=g+d*(c[2]-g),a},vec3.hermite=function(a,b,c,d,e,f){var g=f*f,h=g*(2*f-3)+1,i=g*(f-2)+f,j=g*(f-1),k=g*(3-2*f);return a[0]=b[0]*h+c[0]*i+d[0]*j+e[0]*k,a[1]=b[1]*h+c[1]*i+d[1]*j+e[1]*k,a[2]=b[2]*h+c[2]*i+d[2]*j+e[2]*k,a},vec3.bezier=function(a,b,c,d,e,f){var g=1-f,h=g*g,i=f*f,j=h*g,k=3*f*h,l=3*i*g,m=i*f;return a[0]=b[0]*j+c[0]*k+d[0]*l+e[0]*m,a[1]=b[1]*j+c[1]*k+d[1]*l+e[1]*m,a[2]=b[2]*j+c[2]*k+d[2]*l+e[2]*m,a},vec3.random=function(a,b){b=b||1;var c=2*glMatrix.RANDOM()*Math.PI,d=2*glMatrix.RANDOM()-1,e=Math.sqrt(1-d*d)*b;return a[0]=Math.cos(c)*e,a[1]=Math.sin(c)*e,a[2]=d*b,a},vec3.transformMat4=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[3]*d+c[7]*e+c[11]*f+c[15];return g=g||1,a[0]=(c[0]*d+c[4]*e+c[8]*f+c[12])/g,a[1]=(c[1]*d+c[5]*e+c[9]*f+c[13])/g,a[2]=(c[2]*d+c[6]*e+c[10]*f+c[14])/g,a},vec3.transformMat3=function(a,b,c){var d=b[0],e=b[1],f=b[2];return a[0]=d*c[0]+e*c[3]+f*c[6],a[1]=d*c[1]+e*c[4]+f*c[7],a[2]=d*c[2]+e*c[5]+f*c[8],a},vec3.transformQuat=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2],j=c[3],k=j*d+h*f-i*e,l=j*e+i*d-g*f,m=j*f+g*e-h*d,n=-g*d-h*e-i*f;return a[0]=k*j+n*-g+l*-i-m*-h,a[1]=l*j+n*-h+m*-g-k*-i,a[2]=m*j+n*-i+k*-h-l*-g,a},vec3.rotateX=function(a,b,c,d){var e=[],f=[];return e[0]=b[0]-c[0],e[1]=b[1]-c[1],e[2]=b[2]-c[2],f[0]=e[0],f[1]=e[1]*Math.cos(d)-e[2]*Math.sin(d),f[2]=e[1]*Math.sin(d)+e[2]*Math.cos(d),a[0]=f[0]+c[0],a[1]=f[1]+c[1],a[2]=f[2]+c[2],a},vec3.rotateY=function(a,b,c,d){var e=[],f=[];return e[0]=b[0]-c[0],e[1]=b[1]-c[1],e[2]=b[2]-c[2],f[0]=e[2]*Math.sin(d)+e[0]*Math.cos(d),f[1]=e[1],f[2]=e[2]*Math.cos(d)-e[0]*Math.sin(d),a[0]=f[0]+c[0],a[1]=f[1]+c[1],a[2]=f[2]+c[2],a},vec3.rotateZ=function(a,b,c,d){var e=[],f=[];return e[0]=b[0]-c[0],e[1]=b[1]-c[1],e[2]=b[2]-c[2],f[0]=e[0]*Math.cos(d)-e[1]*Math.sin(d),f[1]=e[0]*Math.sin(d)+e[1]*Math.cos(d),f[2]=e[2],a[0]=f[0]+c[0],a[1]=f[1]+c[1],a[2]=f[2]+c[2],a},vec3.forEach=function(){var a=vec3.create();return function(b,c,d,e,f,g){var h,i;for(c||(c=3),d||(d=0),i=e?Math.min(e*c+d,b.length):b.length,h=d;i>h;h+=c)a[0]=b[h],a[1]=b[h+1],a[2]=b[h+2],f(a,a,g),b[h]=a[0],b[h+1]=a[1],b[h+2]=a[2];return b}}(),vec3.angle=function(a,b){var c=vec3.fromValues(a[0],a[1],a[2]),d=vec3.fromValues(b[0],b[1],b[2]);vec3.normalize(c,c),vec3.normalize(d,d);var e=vec3.dot(c,d);return e>1?0:-1>e?Math.PI:Math.acos(e)},vec3.str=function(a){return"vec3("+a[0]+", "+a[1]+", "+a[2]+")"},vec3.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]},vec3.equals=function(a,b){var c=a[0],d=a[1],e=a[2],f=b[0],g=b[1],h=b[2];return Math.abs(c-f)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(f))&&Math.abs(d-g)<=glMatrix.EPSILON*Math.max(1,Math.abs(d),Math.abs(g))&&Math.abs(e-h)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(h))};var vec4={};vec4.create=function(){var a=new glMatrix.ARRAY_TYPE(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=0,a},vec4.clone=function(a){var b=new glMatrix.ARRAY_TYPE(4);return b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b},vec4.fromValues=function(a,b,c,d){var e=new glMatrix.ARRAY_TYPE(4);return e[0]=a,e[1]=b,e[2]=c,e[3]=d,e},vec4.copy=function(a,b){return a[0]=b[0],a[1]=b[1],a[2]=b[2],a[3]=b[3],a},vec4.set=function(a,b,c,d,e){return a[0]=b,a[1]=c,a[2]=d,a[3]=e,a},vec4.add=function(a,b,c){return a[0]=b[0]+c[0],a[1]=b[1]+c[1],a[2]=b[2]+c[2],a[3]=b[3]+c[3],a},vec4.subtract=function(a,b,c){return a[0]=b[0]-c[0],a[1]=b[1]-c[1],a[2]=b[2]-c[2],a[3]=b[3]-c[3],a},vec4.sub=vec4.subtract,vec4.multiply=function(a,b,c){return a[0]=b[0]*c[0],a[1]=b[1]*c[1],a[2]=b[2]*c[2],a[3]=b[3]*c[3],a},vec4.mul=vec4.multiply,vec4.divide=function(a,b,c){return a[0]=b[0]/c[0],a[1]=b[1]/c[1],a[2]=b[2]/c[2],a[3]=b[3]/c[3],a},vec4.div=vec4.divide,vec4.ceil=function(a,b){return a[0]=Math.ceil(b[0]),a[1]=Math.ceil(b[1]),a[2]=Math.ceil(b[2]),a[3]=Math.ceil(b[3]),a},vec4.floor=function(a,b){return a[0]=Math.floor(b[0]),a[1]=Math.floor(b[1]),a[2]=Math.floor(b[2]),a[3]=Math.floor(b[3]),a},vec4.min=function(a,b,c){return a[0]=Math.min(b[0],c[0]),a[1]=Math.min(b[1],c[1]),a[2]=Math.min(b[2],c[2]),a[3]=Math.min(b[3],c[3]),a},vec4.max=function(a,b,c){return a[0]=Math.max(b[0],c[0]),a[1]=Math.max(b[1],c[1]),a[2]=Math.max(b[2],c[2]),a[3]=Math.max(b[3],c[3]),a},vec4.round=function(a,b){return a[0]=Math.round(b[0]),a[1]=Math.round(b[1]),a[2]=Math.round(b[2]),a[3]=Math.round(b[3]),a},vec4.scale=function(a,b,c){return a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c,a[3]=b[3]*c,a},vec4.scaleAndAdd=function(a,b,c,d){return a[0]=b[0]+c[0]*d,a[1]=b[1]+c[1]*d,a[2]=b[2]+c[2]*d,a[3]=b[3]+c[3]*d,a},vec4.distance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2],f=b[3]-a[3];return Math.sqrt(c*c+d*d+e*e+f*f)},vec4.dist=vec4.distance,vec4.squaredDistance=function(a,b){var c=b[0]-a[0],d=b[1]-a[1],e=b[2]-a[2],f=b[3]-a[3];return c*c+d*d+e*e+f*f},vec4.sqrDist=vec4.squaredDistance,vec4.length=function(a){var b=a[0],c=a[1],d=a[2],e=a[3];return Math.sqrt(b*b+c*c+d*d+e*e)},vec4.len=vec4.length,
  vec4.squaredLength=function(a){var b=a[0],c=a[1],d=a[2],e=a[3];return b*b+c*c+d*d+e*e},vec4.sqrLen=vec4.squaredLength,vec4.negate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=-b[3],a},vec4.inverse=function(a,b){return a[0]=1/b[0],a[1]=1/b[1],a[2]=1/b[2],a[3]=1/b[3],a},vec4.normalize=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c*c+d*d+e*e+f*f;return g>0&&(g=1/Math.sqrt(g),a[0]=c*g,a[1]=d*g,a[2]=e*g,a[3]=f*g),a},vec4.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3]},vec4.lerp=function(a,b,c,d){var e=b[0],f=b[1],g=b[2],h=b[3];return a[0]=e+d*(c[0]-e),a[1]=f+d*(c[1]-f),a[2]=g+d*(c[2]-g),a[3]=h+d*(c[3]-h),a},vec4.random=function(a,b){return b=b||1,a[0]=glMatrix.RANDOM(),a[1]=glMatrix.RANDOM(),a[2]=glMatrix.RANDOM(),a[3]=glMatrix.RANDOM(),vec4.normalize(a,a),vec4.scale(a,a,b),a},vec4.transformMat4=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3];return a[0]=c[0]*d+c[4]*e+c[8]*f+c[12]*g,a[1]=c[1]*d+c[5]*e+c[9]*f+c[13]*g,a[2]=c[2]*d+c[6]*e+c[10]*f+c[14]*g,a[3]=c[3]*d+c[7]*e+c[11]*f+c[15]*g,a},vec4.transformQuat=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2],j=c[3],k=j*d+h*f-i*e,l=j*e+i*d-g*f,m=j*f+g*e-h*d,n=-g*d-h*e-i*f;return a[0]=k*j+n*-g+l*-i-m*-h,a[1]=l*j+n*-h+m*-g-k*-i,a[2]=m*j+n*-i+k*-h-l*-g,a[3]=b[3],a},vec4.forEach=function(){var a=vec4.create();return function(b,c,d,e,f,g){var h,i;for(c||(c=4),d||(d=0),i=e?Math.min(e*c+d,b.length):b.length,h=d;i>h;h+=c)a[0]=b[h],a[1]=b[h+1],a[2]=b[h+2],a[3]=b[h+3],f(a,a,g),b[h]=a[0],b[h+1]=a[1],b[h+2]=a[2],b[h+3]=a[3];return b}}(),vec4.str=function(a){return"vec4("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},vec4.exactEquals=function(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]&&a[3]===b[3]},vec4.equals=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=b[0],h=b[1],i=b[2],j=b[3];return Math.abs(c-g)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(g))&&Math.abs(d-h)<=glMatrix.EPSILON*Math.max(1,Math.abs(d),Math.abs(h))&&Math.abs(e-i)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(f-j)<=glMatrix.EPSILON*Math.max(1,Math.abs(f),Math.abs(j))};var quat={};if(quat.create=function(){var a=new glMatrix.ARRAY_TYPE(4);return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a},quat.rotationTo=function(){var a=vec3.create(),b=vec3.fromValues(1,0,0),c=vec3.fromValues(0,1,0);return function(d,e,f){var g=vec3.dot(e,f);return-.999999>g?(vec3.cross(a,b,e),vec3.length(a)<1e-6&&vec3.cross(a,c,e),vec3.normalize(a,a),quat.setAxisAngle(d,a,Math.PI),d):g>.999999?(d[0]=0,d[1]=0,d[2]=0,d[3]=1,d):(vec3.cross(a,e,f),d[0]=a[0],d[1]=a[1],d[2]=a[2],d[3]=1+g,quat.normalize(d,d))}}(),quat.setAxes=function(){var a=mat3.create();return function(b,c,d,e){return a[0]=d[0],a[3]=d[1],a[6]=d[2],a[1]=e[0],a[4]=e[1],a[7]=e[2],a[2]=-c[0],a[5]=-c[1],a[8]=-c[2],quat.normalize(b,quat.fromMat3(b,a))}}(),quat.clone=vec4.clone,quat.fromValues=vec4.fromValues,quat.copy=vec4.copy,quat.set=vec4.set,quat.identity=function(a){return a[0]=0,a[1]=0,a[2]=0,a[3]=1,a},quat.setAxisAngle=function(a,b,c){c=.5*c;var d=Math.sin(c);return a[0]=d*b[0],a[1]=d*b[1],a[2]=d*b[2],a[3]=Math.cos(c),a},quat.getAxisAngle=function(a,b){var c=2*Math.acos(b[3]),d=Math.sin(c/2);return 0!=d?(a[0]=b[0]/d,a[1]=b[1]/d,a[2]=b[2]/d):(a[0]=1,a[1]=0,a[2]=0),c},quat.add=vec4.add,quat.multiply=function(a,b,c){var d=b[0],e=b[1],f=b[2],g=b[3],h=c[0],i=c[1],j=c[2],k=c[3];return a[0]=d*k+g*h+e*j-f*i,a[1]=e*k+g*i+f*h-d*j,a[2]=f*k+g*j+d*i-e*h,a[3]=g*k-d*h-e*i-f*j,a},quat.mul=quat.multiply,quat.scale=vec4.scale,quat.rotateX=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2],g=b[3],h=Math.sin(c),i=Math.cos(c);return a[0]=d*i+g*h,a[1]=e*i+f*h,a[2]=f*i-e*h,a[3]=g*i-d*h,a},quat.rotateY=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2],g=b[3],h=Math.sin(c),i=Math.cos(c);return a[0]=d*i-f*h,a[1]=e*i+g*h,a[2]=f*i+d*h,a[3]=g*i-e*h,a},quat.rotateZ=function(a,b,c){c*=.5;var d=b[0],e=b[1],f=b[2],g=b[3],h=Math.sin(c),i=Math.cos(c);return a[0]=d*i+e*h,a[1]=e*i-d*h,a[2]=f*i+g*h,a[3]=g*i-f*h,a},quat.calculateW=function(a,b){var c=b[0],d=b[1],e=b[2];return a[0]=c,a[1]=d,a[2]=e,a[3]=Math.sqrt(Math.abs(1-c*c-d*d-e*e)),a},quat.dot=vec4.dot,quat.lerp=vec4.lerp,quat.slerp=function(a,b,c,d){var e,f,g,h,i,j=b[0],k=b[1],l=b[2],m=b[3],n=c[0],o=c[1],p=c[2],q=c[3];return f=j*n+k*o+l*p+m*q,0>f&&(f=-f,n=-n,o=-o,p=-p,q=-q),1-f>1e-6?(e=Math.acos(f),g=Math.sin(e),h=Math.sin((1-d)*e)/g,i=Math.sin(d*e)/g):(h=1-d,i=d),a[0]=h*j+i*n,a[1]=h*k+i*o,a[2]=h*l+i*p,a[3]=h*m+i*q,a},quat.sqlerp=function(){var a=quat.create(),b=quat.create();return function(c,d,e,f,g,h){return quat.slerp(a,d,g,h),quat.slerp(b,e,f,h),quat.slerp(c,a,b,2*h*(1-h)),c}}(),quat.invert=function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=c*c+d*d+e*e+f*f,h=g?1/g:0;return a[0]=-c*h,a[1]=-d*h,a[2]=-e*h,a[3]=f*h,a},quat.conjugate=function(a,b){return a[0]=-b[0],a[1]=-b[1],a[2]=-b[2],a[3]=b[3],a},quat.length=vec4.length,quat.len=quat.length,quat.squaredLength=vec4.squaredLength,quat.sqrLen=quat.squaredLength,quat.normalize=vec4.normalize,quat.fromMat3=function(a,b){var c,d=b[0]+b[4]+b[8];if(d>0)c=Math.sqrt(d+1),a[3]=.5*c,c=.5/c,a[0]=(b[5]-b[7])*c,a[1]=(b[6]-b[2])*c,a[2]=(b[1]-b[3])*c;else{var e=0;b[4]>b[0]&&(e=1),b[8]>b[3*e+e]&&(e=2);var f=(e+1)%3,g=(e+2)%3;c=Math.sqrt(b[3*e+e]-b[3*f+f]-b[3*g+g]+1),a[e]=.5*c,c=.5/c,a[3]=(b[3*f+g]-b[3*g+f])*c,a[f]=(b[3*f+e]+b[3*e+f])*c,a[g]=(b[3*g+e]+b[3*e+g])*c}return a},quat.str=function(a){return"quat("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+")"},quat.exactEquals=vec4.exactEquals,quat.equals=vec4.equals,void 0===require){var requirejs,require,define;!function(ba){function J(a){return"[object Function]"===N.call(a)}function K(a){return"[object Array]"===N.call(a)}function z(a,b){if(a){var c;for(c=0;c<a.length&&(!a[c]||!b(a[c],c,a));c+=1);}}function O(a,b){if(a){var c;for(c=a.length-1;c>-1&&(!a[c]||!b(a[c],c,a));c-=1);}}function t(a,b){return ha.call(a,b)}function m(a,b){return t(a,b)&&a[b]}function H(a,b){for(var c in a)if(t(a,c)&&b(a[c],c))break}function S(a,b,c,d){return b&&H(b,function(b,e){(c||!t(a,e))&&(d&&"string"!=typeof b?(a[e]||(a[e]={}),S(a[e],b,c,d)):a[e]=b)}),a}function v(a,b){return function(){return b.apply(a,arguments)}}function ca(a){throw a}function da(a){if(!a)return a;var b=ba;return z(a.split("."),function(a){b=b[a]}),b}function B(a,b,c,d){return b=Error(b+"\nhttp://requirejs.org/docs/errors.html#"+a),b.requireType=a,b.requireModules=d,c&&(b.originalError=c),b}function ia(a){function b(a,b,c){var d,e,f,g,h,i,j,k=b&&b.split("/");d=k;var l=C.map,n=l&&l["*"];if(a&&"."===a.charAt(0))if(b){for(d=m(C.pkgs,b)?k=[b]:k.slice(0,k.length-1),b=a=d.concat(a.split("/")),d=0;b[d];d+=1)if(e=b[d],"."===e)b.splice(d,1),d-=1;else if(".."===e){if(1===d&&(".."===b[2]||".."===b[0]))break;d>0&&(b.splice(d-1,2),d-=2)}d=m(C.pkgs,b=a[0]),a=a.join("/"),d&&a===b+"/"+d.main&&(a=b)}else 0===a.indexOf("./")&&(a=a.substring(2));if(c&&l&&(k||n)){for(b=a.split("/"),d=b.length;d>0;d-=1){if(f=b.slice(0,d).join("/"),k)for(e=k.length;e>0;e-=1)if((c=m(l,k.slice(0,e).join("/")))&&(c=m(c,f))){g=c,h=d;break}if(g)break;!i&&n&&m(n,f)&&(i=m(n,f),j=d)}!g&&i&&(g=i,h=j),g&&(b.splice(0,h,g),a=b.join("/"))}return a}function c(a){A&&z(document.getElementsByTagName("script"),function(b){return b.getAttribute("data-requiremodule")===a&&b.getAttribute("data-requirecontext")===w.contextName?(b.parentNode.removeChild(b),!0):void 0})}function d(a){var b=m(C.paths,a);return b&&K(b)&&1<b.length?(c(a),b.shift(),w.require.undef(a),w.require([a]),!0):void 0}function e(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function f(a,c,d,f){var g,h,i=null,j=c?c.name:null,k=a,l=!0,n="";return a||(l=!1,a="_@r"+(M+=1)),a=e(a),i=a[0],a=a[1],i&&(i=b(i,j,f),h=m(I,i)),a&&(i?n=h&&h.normalize?h.normalize(a,function(a){return b(a,j,f)}):b(a,j,f):(n=b(a,j,f),a=e(n),i=a[0],n=a[1],d=!0,g=w.nameToUrl(n))),d=!i||h||d?"":"_unnormalized"+(N+=1),{prefix:i,name:n,parentMap:c,unnormalized:!!d,url:g,originalName:k,isDefine:l,id:(i?i+"!"+n:n)+d}}function g(a){var b=a.id,c=m(D,b);return c||(c=D[b]=new w.Module(a)),c}function i(a,b,c){var d=a.id,e=m(D,d);!t(I,d)||e&&!e.defineEmitComplete?(e=g(a),e.error&&"error"===b?c(e.error):e.on(b,c)):"defined"===b&&c(I[d])}function j(a,b){var c=a.requireModules,d=!1;b?b(a):(z(c,function(b){(b=m(D,b))&&(b.error=a,b.events.error&&(d=!0,b.emit("error",a)))}),d||h.onError(a))}function k(){U.length&&(ja.apply(G,[G.length-1,0].concat(U)),U=[])}function l(a){delete D[a],delete E[a]}function n(a,b,c){var d=a.map.id;a.error?a.emit("error",a.error):(b[d]=!0,z(a.depMaps,function(d,e){var f=d.id,g=m(D,f);g&&!a.depMatched[e]&&!c[f]&&(m(b,f)?(a.defineDep(e,I[f]),a.check()):n(g,b,c))}),c[d]=!0)}function o(){var a,b,e,f,g=(e=1e3*C.waitSeconds)&&w.startTime+e<(new Date).getTime(),h=[],i=[],k=!1,l=!0;if(!s){if(s=!0,H(E,function(e){if(a=e.map,b=a.id,e.enabled&&(a.isDefine||i.push(e),!e.error))if(!e.inited&&g)d(b)?k=f=!0:(h.push(b),c(b));else if(!e.inited&&e.fetched&&a.isDefine&&(k=!0,!a.prefix))return l=!1}),g&&h.length)return e=B("timeout","Load timeout for modules: "+h,null,h),e.contextName=w.contextName,j(e);l&&z(i,function(a){n(a,{},{})}),g&&!f||!k||!A&&!ea||y||(y=setTimeout(function(){y=0,o()},50)),s=!1}}function p(a){t(I,a[0])||g(f(a[0],null,!0)).init(a[1],a[2])}function q(a){var a=a.currentTarget||a.srcElement,b=w.onScriptLoad;return a.detachEvent&&!Z?a.detachEvent("onreadystatechange",b):a.removeEventListener("load",b,!1),b=w.onScriptError,(!a.detachEvent||Z)&&a.removeEventListener("error",b,!1),{node:a,id:a&&a.getAttribute("data-requiremodule")}}function r(){var a;for(k();G.length;){if(a=G.shift(),null===a[0])return j(B("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));p(a)}}var s,u,w,x,y,C={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},D={},E={},F={},G=[],I={},L={},M=1,N=1;return x={require:function(a){return a.require?a.require:a.require=w.makeRequire(a.map)},exports:function(a){return a.usingExports=!0,a.map.isDefine?a.exports?a.exports:a.exports=I[a.map.id]={}:void 0},module:function(a){return a.module?a.module:a.module={id:a.map.id,uri:a.map.url,config:function(){var b=m(C.pkgs,a.map.id);return(b?m(C.config,a.map.id+"/"+b.main):m(C.config,a.map.id))||{}},exports:I[a.map.id]}}},u=function(a){this.events=m(F,a.id)||{},this.map=a,this.shim=m(C.shim,a.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},u.prototype={init:function(a,b,c,d){d=d||{},this.inited||(this.factory=b,c?this.on("error",c):this.events.error&&(c=v(this,function(a){this.emit("error",a)})),this.depMaps=a&&a.slice(0),this.errback=c,this.inited=!0,this.ignore=d.ignore,d.enabled||this.enabled?this.enable():this.check())},defineDep:function(a,b){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=b)},fetch:function(){if(!this.fetched){this.fetched=!0,w.startTime=(new Date).getTime();var a=this.map;if(!this.shim)return a.prefix?this.callPlugin():this.load();w.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],v(this,function(){return a.prefix?this.callPlugin():this.load()}))}},load:function(){var a=this.map.url;L[a]||(L[a]=!0,w.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,b,c=this.map.id;b=this.depExports;var d=this.exports,e=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,1>this.depCount&&!this.defined){if(J(e)){if(this.events.error&&this.map.isDefine||h.onError!==ca)try{d=w.execCb(c,e,b,d)}catch(f){a=f}else d=w.execCb(c,e,b,d);if(this.map.isDefine&&((b=this.module)&&void 0!==b.exports&&b.exports!==this.exports?d=b.exports:void 0===d&&this.usingExports&&(d=this.exports)),a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",j(this.error=a)}else d=e;this.exports=d,this.map.isDefine&&!this.ignore&&(I[c]=d,h.onResourceLoad)&&h.onResourceLoad(w,this.map,this.depMaps),l(c),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=this.map,c=a.id,d=f(a.prefix);this.depMaps.push(d),i(d,"defined",v(this,function(d){var e,k;k=this.map.name;var n=this.map.parentMap?this.map.parentMap.name:null,o=w.makeRequire(a.parentMap,{enableBuildCallback:!0});this.map.unnormalized?(d.normalize&&(k=d.normalize(k,function(a){return b(a,n,!0)})||""),d=f(a.prefix+"!"+k,this.map.parentMap),i(d,"defined",v(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),(k=m(D,d.id))&&(this.depMaps.push(d),this.events.error&&k.on("error",v(this,function(a){this.emit("error",a)})),k.enable())):(e=v(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),e.error=v(this,function(a){this.inited=!0,this.error=a,a.requireModules=[c],H(D,function(a){0===a.map.id.indexOf(c+"_unnormalized")&&l(a.map.id)}),j(a)}),e.fromText=v(this,function(b,d){var i=a.name,k=f(i),l=Q;d&&(b=d),l&&(Q=!1),g(k),t(C.config,c)&&(C.config[i]=C.config[c]);try{h.exec(b)}catch(m){return j(B("fromtexteval","fromText eval for "+c+" failed: "+m,m,[c]))}l&&(Q=!0),this.depMaps.push(k),w.completeLoad(i),o([i],e)}),d.load(a.name,o,e,C))})),w.enable(d,this),this.pluginMaps[d.id]=d},enable:function(){E[this.map.id]=this,this.enabling=this.enabled=!0,z(this.depMaps,v(this,function(a,b){var c,d;if("string"==typeof a){if(a=f(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[b]=a,c=m(x,a.id))return void(this.depExports[b]=c(this));this.depCount+=1,i(a,"defined",v(this,function(a){this.defineDep(b,a),this.check()})),this.errback&&i(a,"error",v(this,this.errback))}c=a.id,d=D[c],!t(x,c)&&d&&!d.enabled&&w.enable(a,this)})),H(this.pluginMaps,v(this,function(a){var b=m(D,a.id);b&&!b.enabled&&w.enable(a,this)})),this.enabling=!1,this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]),c.push(b)},emit:function(a,b){z(this.events[a],function(a){a(b)}),"error"===a&&delete this.events[a]}},w={config:C,contextName:a,registry:D,defined:I,urlFetched:L,defQueue:G,Module:u,makeModuleMap:f,nextTick:h.nextTick,onError:j,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=C.pkgs,c=C.shim,d={paths:!0,config:!0,map:!0};H(a,function(a,b){d[b]?"map"===b?(C.map||(C.map={}),S(C[b],a,!0,!0)):S(C[b],a,!0):C[b]=a}),a.shim&&(H(a.shim,function(a,b){K(a)&&(a={deps:a}),!a.exports&&!a.init||a.exportsFn||(a.exportsFn=w.makeShimExports(a)),c[b]=a}),C.shim=c),a.packages&&(z(a.packages,function(a){a="string"==typeof a?{name:a}:a,b[a.name]={name:a.name,location:a.location||a.name,main:(a.main||"main").replace(ka,"").replace(fa,"")}}),C.pkgs=b),H(D,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=f(b))}),(a.deps||a.callback)&&w.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;return a.init&&(b=a.init.apply(ba,arguments)),b||a.exports&&da(a.exports)}},makeRequire:function(c,d){function e(b,i,k){var l,m;return d.enableBuildCallback&&i&&J(i)&&(i.__requireJsBuild=!0),"string"==typeof b?J(i)?j(B("requireargs","Invalid require call"),k):c&&t(x,b)?x[b](D[c.id]):h.get?h.get(w,b,c,e):(l=f(b,c,!1,!0),l=l.id,t(I,l)?I[l]:j(B("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+a+(c?"":". Use require([])")))):(r(),w.nextTick(function(){r(),m=g(f(null,c)),m.skipMap=d.skipMap,m.init(b,i,k,{enabled:!0}),o()}),e)}return d=d||{},S(e,{isBrowser:A,toUrl:function(a){var d,e=a.lastIndexOf("."),f=a.split("/")[0];return-1!==e&&("."!==f&&".."!==f||e>1)&&(d=a.substring(e,a.length),a=a.substring(0,e)),w.nameToUrl(b(a,c&&c.id,!0),d,!0)},defined:function(a){return t(I,f(a,c,!1,!0).id)},specified:function(a){return a=f(a,c,!1,!0).id,t(I,a)||t(D,a)}}),c||(e.undef=function(a){k();var b=f(a,c,!0),d=m(D,a);delete I[a],delete L[b.url],delete F[a],d&&(d.events.defined&&(F[a]=d.events),l(a))}),e},enable:function(a){m(D,a.id)&&g(a).enable()},completeLoad:function(a){var b,c,e=m(C.shim,a)||{},f=e.exports;for(k();G.length;){if(c=G.shift(),null===c[0]){if(c[0]=a,b)break;b=!0}else c[0]===a&&(b=!0);p(c)}if(c=m(D,a),!b&&!t(I,a)&&c&&!c.inited){if(C.enforceDefine&&(!f||!da(f)))return d(a)?void 0:j(B("nodefine","No define call for "+a,null,[a]));p([a,e.deps||[],e.exportsFn])}o()},nameToUrl:function(a,b,c){var d,e,f,g,i,j;if(h.jsExtRegExp.test(a))g=a+(b||"");else{for(d=C.paths,e=C.pkgs,g=a.split("/"),i=g.length;i>0;i-=1){if(j=g.slice(0,i).join("/"),f=m(e,j),j=m(d,j)){K(j)&&(j=j[0]),g.splice(0,i,j);break}if(f){a=a===f.name?f.location+"/"+f.main:f.location,g.splice(0,i,a);break}}g=g.join("/"),g+=b||(/\?/.test(g)||c?"":".js"),g=("/"===g.charAt(0)||g.match(/^[\w\+\.\-]+:/)?"":C.baseUrl)+g}return C.urlArgs?g+((-1===g.indexOf("?")?"?":"&")+C.urlArgs):g},load:function(a,b){h.load(w,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){("load"===a.type||la.test((a.currentTarget||a.srcElement).readyState))&&(R=null,a=q(a),w.completeLoad(a.id))},onScriptError:function(a){var b=q(a);return d(b.id)?void 0:j(B("scripterror","Script error for: "+b.id,a,[b.id]))}},w.require=w.makeRequire(),w}var h,x,y,E,L,F,R,M,s,ga,ma=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,na=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,fa=/\.js$/,ka=/^\.\//;x=Object.prototype;var N=x.toString,ha=x.hasOwnProperty,ja=Array.prototype.splice,A=!("undefined"==typeof window||!navigator||!window.document),ea=!A&&"undefined"!=typeof importScripts,la=A&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,Z="undefined"!=typeof opera&&"[object Opera]"===opera.toString(),G={},u={},U=[],Q=!1;if("undefined"==typeof define){if("undefined"!=typeof requirejs){if(J(requirejs))return;u=requirejs,requirejs=void 0}"undefined"!=typeof require&&!J(require)&&(u=require,require=void 0),h=requirejs=function(a,b,c,d){var e,f="_";return!K(a)&&"string"!=typeof a&&(e=a,K(b)?(a=b,b=c,c=d):a=[]),e&&e.context&&(f=e.context),(d=m(G,f))||(d=G[f]=h.s.newContext(f)),e&&d.configure(e),d.require(a,b,c)},h.config=function(a){return h(a)},h.nextTick="undefined"!=typeof setTimeout?function(a){setTimeout(a,4)}:function(a){a()},require||(require=h),h.version="2.1.6",h.jsExtRegExp=/^\/|:|\?|\.js$/,h.isBrowser=A,x=h.s={contexts:G,newContext:ia},h({}),z(["toUrl","undef","defined","specified"],function(a){h[a]=function(){var b=G._;return b.require[a].apply(b,arguments)}}),A&&(y=x.head=document.getElementsByTagName("head")[0],E=document.getElementsByTagName("base")[0])&&(y=x.head=E.parentNode),h.onError=ca,h.load=function(a,b,c){var d,e=a&&a.config||{};if(A)return d=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),d.type=e.scriptType||"text/javascript",d.charset="utf-8",d.async=!0,d.setAttribute("data-requirecontext",a.contextName),d.setAttribute("data-requiremodule",b),!d.attachEvent||d.attachEvent.toString&&0>d.attachEvent.toString().indexOf("[native code")||Z?(d.addEventListener("load",a.onScriptLoad,!1),d.addEventListener("error",a.onScriptError,!1)):(Q=!0,d.attachEvent("onreadystatechange",a.onScriptLoad)),d.src=c,M=d,E?y.insertBefore(d,E):y.appendChild(d),M=null,d;if(ea)try{importScripts(c),a.completeLoad(b)}catch(f){a.onError(B("importscripts","importScripts failed for "+b+" at "+c,f,[b]))}},A&&O(document.getElementsByTagName("script"),function(a){return y||(y=a.parentNode),(L=a.getAttribute("data-main"))?(s=L,u.baseUrl||(F=s.split("/"),s=F.pop(),ga=F.length?F.join("/")+"/":"./",u.baseUrl=ga),s=s.replace(fa,""),h.jsExtRegExp.test(s)&&(s=L),u.deps=u.deps?u.deps.concat(s):[s],!0):void 0}),define=function(a,b,c){var d,e;"string"!=typeof a&&(c=b,b=a,a=null),K(b)||(c=b,b=null),!b&&J(c)&&(b=[],c.length&&(c.toString().replace(ma,"").replace(na,function(a,c){b.push(c)}),b=(1===c.length?["require"]:["require","exports","module"]).concat(b))),Q&&((d=M)||(R&&"interactive"===R.readyState||O(document.getElementsByTagName("script"),function(a){return"interactive"===a.readyState?R=a:void 0}),d=R),d&&(a||(a=d.getAttribute("data-requiremodule")),e=G[d.getAttribute("data-requirecontext")])),(e?e.defQueue:U).push([a,b,c])},define.amd={jQuery:!0},h.exec=function(b){return eval(b)},h(u)}}(this)}var SceneJS_Map=function(a,b){this.items=a||[];var c=b||0,d=c+1;this.addItem=function(){var a;if(2==arguments.length){var b=arguments[0];if(a=arguments[1],this.items[b])throw SceneJS_error.fatalError(SceneJS.errors.ID_CLASH,"ID clash: '"+b+"'");return this.items[b]=a,b}for(;;){a=arguments[0];var c=d++;if(!this.items[c])return this.items[c]=a,c}},this.removeItem=function(a){delete this.items[a]}},SceneJS=new function(){function a(b,c){var d,e="";for(d=0;c>d;d++)e+=" ";for(e+="-- ",console.log(e+b.type+" (id: "+b.id+", coreId: "+b.coreId+")"),d=0;d<b.nodes.length;d++)a(b.nodes[d],c+1)}this.VERSION="3.2",this._baseStateId=0,this._handleMap=new SceneJS_Map,this._topicSubs={},this._handleTopics={},this._topicPubs={},this._engines={},this._engineIds=new SceneJS_Map,this.timer=window.performance||window.Date,this.WEBGL_INFO=function(){var a={WEBGL:!1},b=document.createElement("canvas");if(!b)return a;var c=b.getContext("webgl",{stencil:!0,antialias:!0})||b.getContext("experimental-webgl",{antialias:!0});return a.WEBGL=!!c,a.WEBGL?(a.ANTIALIAS=c.getContextAttributes().antialias,a.FS_MAX_FLOAT_PRECISION=c.getShaderPrecisionFormat?c.getShaderPrecisionFormat(c.FRAGMENT_SHADER,c.HIGH_FLOAT).precision>0?"highp":c.getShaderPrecisionFormat(c.FRAGMENT_SHADER,c.MEDIUM_FLOAT).precision>0?"mediump":"lowp":"mediump",a.DEPTH_BUFFER_BITS=c.getParameter(c.DEPTH_BITS),a.MAX_TEXTURE_SIZE=c.getParameter(c.MAX_TEXTURE_SIZE),a.MAX_CUBE_MAP_SIZE=c.getParameter(c.MAX_CUBE_MAP_TEXTURE_SIZE),a.MAX_RENDERBUFFER_SIZE=c.getParameter(c.MAX_RENDERBUFFER_SIZE),a.MAX_TEXTURE_UNITS=c.getParameter(c.MAX_COMBINED_TEXTURE_IMAGE_UNITS),a.MAX_VERTEX_ATTRIBS=c.getParameter(c.MAX_VERTEX_ATTRIBS),a.MAX_VERTEX_UNIFORM_VECTORS=c.getParameter(c.MAX_VERTEX_UNIFORM_VECTORS),a.MAX_FRAGMENT_UNIFORM_VECTORS=c.getParameter(c.MAX_FRAGMENT_UNIFORM_VECTORS),a.MAX_VARYING_VECTORS=c.getParameter(c.MAX_VARYING_VECTORS),a.SUPPORTED_EXTENSIONS={},c.getSupportedExtensions().forEach(function(b){a.SUPPORTED_EXTENSIONS[b]=!0}),a):a}(),this.DISPLAY_FLAGS={FOG_LINEAR:1,FOG_EXP:2,FOG_EXP2:3},this.TEXTURE_FLAGS={baseColor:1,specular:2,emit:4,alpha:8,normals:16,shine:32,add:64,multiply:128},this.PROPERTY_FLAGS={PICKING:1,CLIPPING:2,ENABLED:4,BACKFACES:8,REFLECTIVE:16,SOLID:32,SKYBOX:64,XRAY:128,HIGHLIGHT:256,DESATURATE:512,CCW:1024,XRAY_ENABLED:2048,DEPTH_MASK:4096,ROUND_POINTS:8192,BILLBOARD:16384},this.publish=function(a,b,c){c||(this._topicPubs[a]=b);var d=this._topicSubs[a];if(d)for(var e in d)d.hasOwnProperty(e)&&d[e].call(this,b)},this.unpublish=function(a){var b=this._topicSubs[a];if(b)for(var c in b)b.hasOwnProperty(c)&&b[c].call(this,null);delete this._topicPubs[a]},this.on=function(a,b){var c=this._topicSubs[a];c||(c={},this._topicSubs[a]=c);var d=this._handleMap.addItem();c[d]=b,this._handleTopics[d]=a;var e=this._topicPubs[a];return e&&b.call(this,e),d},this.off=function(a){var b=this._handleTopics[a];if(b){delete this._handleTopics[a];var c=this._topicSubs[b];c&&delete c[a],this._handleMap.removeItem(a),"rendered"==b&&this._engine.branchDirty(this)}},this.once=function(a,b){var c=this,d=this.on(a,function(a){c.off(d),b(a)})},this.createScene=function(a,b){if(a=a||{},a.id){if(this._engines[a.id])throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Scene already exists with this ID: '"+a.id+"'");this._engineIds.addItem(a.id,{})}else a.id=this._engineIds.addItem({});var c=new SceneJS_Engine(a,b);return this._engines[a.id]=c,SceneJS_events.fireEvent(SceneJS_events.SCENE_CREATED,{engine:c}),c.scene.start(b),c.scene},this.scene=function(a){var b=this._engines[a];return b?b.scene:null},this.getScene=function(a){if(!a)for(var a in this._engines)if(this._engines.hasOwnProperty(a))return this._engines[a].scene;var b=this._engines[a];return b?b.scene:null},this.getScenes=function(){var a={};for(var b in this._engines)this._engines.hasOwnProperty(b)&&(a[b]=this._engines[b].scene);return a},this._isArray=function(a){return a&&!a.propertyIsEnumerable("length")&&"object"==typeof a&&"number"==typeof a.length},this._shallowClone=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},this._applyIf=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(void 0==b[c]||null==b[c])&&(b[c]=a[c]);return b},this._apply=function(a,b,c){var d;if(c)for(d in b)b.hasOwnProperty(d)&&delete b[d];for(d in a)a.hasOwnProperty(d)&&void 0!=a[d]&&(b[d]=a[d]);return b};var b=Object.prototype.hasOwnProperty;this._isEmpty=function(a){if(null==a)return!0;if(a.length>0)return!1;if(0===a.length)return!0;for(var c in a)if(b.call(a,c))return!1;return!0},this._isNumeric=function(a){return!isNaN(parseFloat(a))&&isFinite(a)},this._sliceArray=function(a,b,c){if(a.slice)return a.slice(b,c);b=b||0,c=c||a.length;for(var d=c-b,e=new a.constructor(d),f=0;d>f;f++)e[f]=a[b+f];return e},this._loadBinary=function(a,b){var c=new XMLHttpRequest;c.responseType="arraybuffer",c.open("GET",a),c.onload=function(){b(c.response)},c.send(null)};var c=["","MOZ_","WEBKIT_"];this.checkExtension=function(a){for(var b=0,d=c.length;d>b;b++)if(this.WEBGL_INFO.SUPPORTED_EXTENSIONS[c[b]+a])return!0;return!1},this._getExtension=function(a,b){for(var d=0,e=c.length;e>d;d++){var f=a.getExtension(c[d]+b);if(f)return f}return null},this.printGraph=function(b){a(b,0)},this.reset=function(){var a=[];for(var b in this._engines)this._engines.hasOwnProperty(b)&&(a.push(this._engines[b]),delete this._engines[b],this._engineIds.removeItem(b));for(;a.length>0;)a.pop().destroy();SceneJS_events.fireEvent(SceneJS_events.RESET)}};!function(){var a;SceneJS.on("configs",function(b){if(b.pluginPath!=a){a=b.pluginPath;var c=a+"/lib";require.config({paths:{scenejsPluginDeps:c}})}})}();var SceneJS_eventManager=function(){this._handlerIds=new SceneJS_Map,this.typeHandlers={}};SceneJS_eventManager.prototype.createEvent=function(a){this.typeHandlers[a]||(this.typeHandlers[a]={handlers:{},numSubs:0})},SceneJS_eventManager.prototype.onEvent=function(a,b){var c=this.typeHandlers[a]||(this.typeHandlers[a]={handlers:{},numSubs:0}),d=this._handlerIds.addItem(a),e=c.handlers;return e[d]=b,c.numSubs++,d},SceneJS_eventManager.prototype.fireEvent=function(a,b){var c=this.typeHandlers[a]||(this.typeHandlers[a]={handlers:{},numSubs:0});if(c.numSubs>0){var d=c.handlers;for(var e in d)d.hasOwnProperty(e)&&d[e](b)}},SceneJS_eventManager.prototype.unEvent=function(a){var b=this._handlerIds.items[a];if(b){this._handlerIds.removeItem(a);var c=this.typeHandlers[b];c&&(delete c[a],this.typeHandlers[b].numSubs--)}},SceneJS.Plugins=new function(){function a(a,c,f,g){var h=d[a]||(d[a]={});h[c]=g,b(f,0,function(){for(var b=a+c,d=e[b]||(e[b]=[]);d.length>0;)d.pop()(g);delete e[b]})}function b(a,d,e){if(!a||d>=a.length)return void e();var f=a[d],g=SceneJS_configsModule.configs.pluginPath;if(!g)throw"no pluginPath config";f=g+"/"+f,c(f,function(){b(a,d+1,e)})}function c(a,b){var c=document.createElement("script");c.type="text/javascript",c.readyState?c.onreadystatechange=function(){("loaded"==c.readyState||"complete"==c.readyState)&&(c.onreadystatechange=null,b&&b())}:c.onload=function(){b&&b()},c.src=a,document.getElementsByTagName("head")[0].appendChild(c)}var d={},e={};this.addPlugin=function(){var b,c,d=arguments[0],e=arguments[1];4==arguments.length?(b=arguments[2],c=arguments[3]):c=arguments[2],a(d,e,b,c)},this.hasPlugin=function(a,b){var c=d[a];return c&&!!c[b]},this.getPlugin=function(a,b,f){var g=d[a];if(g){var h=g[b];if(h)return void f(h)}var i=a+b,j=e[i]||(e[i]=[]);if(j.push(f),!(j.length>1)){var k=SceneJS_configsModule.configs.pluginPath;if(!k)throw"no pluginPath config";var l=k+"/"+a+"/"+b+".js";c(l)}}};var SceneJS_events=new function(){this.ERROR=0,this.RESET=1,this.NODE_CREATED=2,this.SCENE_CREATED=3,this.SCENE_COMPILING=4,this.SCENE_DESTROYED=5,this.OBJECT_COMPILING=6,this.WEBGL_CONTEXT_LOST=7,this.WEBGL_CONTEXT_RESTORED=8,this.RENDER=9;var a=[];this.addListener=function(b,c,d){var e=a[b];e||(e=[],a[b]=e);for(var f={command:c,priority:void 0==d?e.length:d},g=-1,h=0,i=e.length;i>h;h++)if(!e[h]){g=h;break}0>g&&(e.push(f),g=e.length-1);var j=b+"."+g;return j},this.removeListener=function(b){var c=b.lastIndexOf("."),d=parseInt(b.substr(0,c)),e=parseInt(b.substr(c+1)),f=a[d];f&&delete f[e]},this.fireEvent=function(b,c){var d=a[b];if(d){c=c||{};for(var e=0;e<d.length;e++)d[e]&&d[e].command(c)}}};SceneJS.bind=function(a,b){switch(a){case"error":return SceneJS_events.addListener(SceneJS_events.ERROR,b);case"reset":return SceneJS_events.addListener(SceneJS_events.RESET,function(){b()});case"webglcontextlost":return SceneJS_events.addListener(SceneJS_events.WEBGL_CONTEXT_LOST,function(a){b(a)});case"webglcontextrestored":return SceneJS_events.addListener(SceneJS_events.WEBGL_CONTEXT_RESTORED,function(a){b(a)});default:throw SceneJS_error.fatalError("SceneJS.bind - this event type not supported: '"+a+"'")}},SceneJS.onEvent=SceneJS.bind,SceneJS.unEvent=function(a){return SceneJS_events.removeListener(a)},SceneJS.subscribe=SceneJS.addListener=SceneJS.onEvent=SceneJS.bind,SceneJS.unsubscribe=SceneJS.unEvent,SceneJS.on=SceneJS.onEvent,SceneJS.off=SceneJS.unEvent;var SceneJS_Canvas=function(a,b,c,d){if(this.canvasId,!b){b="canvas-"+a;var e=document.getElementsByTagName("body")[0],f=document.createElement("div"),g=f.style;g.height="100%",g.width="100%",g.padding="0",g.margin="0",g.left="0",g.top="0",g.position="absolute",f.innerHTML+='<canvas id="'+b+'" style="width: 100%; height: 100%; margin: 0; padding: 0;"></canvas>',e.appendChild(f)}var h=document.getElementById(b);if(!h)throw SceneJS_error.fatalError(SceneJS.errors.CANVAS_NOT_FOUND,"SceneJS.Scene attribute 'canvasId' does not match any elements in the page");this.canvasId=b,this.options=d||{},this.canvas=h,this.options.simulateWebGLContextLost&&(window.WebGLDebugUtils?this.canvas=WebGLDebugUtils.makeLostContextSimulatingCanvas(this.canvas):console.error("To simulate context loss, please include WebGLDebugUtils")),this.resolutionScaling=this.options.resolutionScaling||1,this.canvas.width=this.canvas.clientWidth*this.resolutionScaling,this.canvas.height=this.canvas.clientHeight*this.resolutionScaling,this.contextAttr=c||{},this.contextAttr.alpha=!0,this.contextAttr.stencil=!0,this.gl=null,this.webgl2=!1,this.initWebGL()};SceneJS_Canvas.prototype._WEBGL_CONTEXT_NAMES=["webgl","experimental-webgl","webkit-3d","moz-webgl","moz-glweb20"],SceneJS_Canvas.prototype.initWebGL=function(){if(this.options.webgl2===!0){try{this.gl=this.canvas.getContext("webgl2",this.contextAttr)}catch(a){}this.gl?this.webgl2=!0:console.log("Failed to get a WebGL 2 context - defaulting to WebGL 1.")}if(!this.gl)for(var b=0;!this.gl&&b<this._WEBGL_CONTEXT_NAMES.length;b++)try{this.gl=this.canvas.getContext(this._WEBGL_CONTEXT_NAMES[b],this.contextAttr)}catch(a){}if(!this.gl)throw SceneJS_error.fatalError(SceneJS.errors.WEBGL_NOT_SUPPORTED,"Failed to get a WebGL context")},SceneJS_Canvas.prototype.loseWebGLContext=function(){this.options.simulateWebGLContextLost&&this.canvas.loseContext()},SceneJS_Canvas.prototype.setResolutionScaling=function(a){this.resolutionScaling=a,this.canvas.width=this.canvas.clientWidth*a,this.canvas.height=this.canvas.clientHeight*a};var SceneJS_Engine=function(a,b){b=b||{},a.type="scene",this.id=a.id,this._numPasses=a.numPasses||1,this._clearEachPass=!!a.clearEachPass,this.canvas=new SceneJS_Canvas(this.id,a.canvasId,a.contextAttr,b),this.events=new SceneJS_eventManager,this._coreFactory=new SceneJS_CoreFactory,this._nodeFactory=new SceneJS_NodeFactory,this.stats={build:{version:SceneJS.VERSION},client:{browser:navigator&&navigator.userAgent?navigator.userAgent:"n/a"},components:{},state:{programs:0},geometry:{meshes:0,vertices:0,triangles:0},textures:{},load:{sceneGraphCompilation:0,shaderCompilation:0,programCompilation:0},memory:{positions:0,colors:0,normals:0,uvs:0,indices:0,morphPositions:0,morphNormals:0,textures:0,tangents:0,
  pickPositions:0,pickColors:0},frame:{frameCount:0,cpuTime:0,gpuTime:0,useProgram:0,bindTexture:0,bindArray:0,drawElements:0,drawArrays:0,drawChunks:0}},this.display=new SceneJS_Display(this.stats,{canvas:this.canvas,transparent:a.transparent,dof:a.dof,depthSort:b.depthSort}),this.sceneDirty=!1,this._sceneBranchesDirty=!1,this._compilationPaused=!1,this._nodesToDestroy=[],this._numNodesToDestroy=0,this.ticksPerRender=Math.max(b.ticksPerRender||1,1),this.running=!1,this.paused=!1,this.destroyed=!1,this.cpuTimer=SceneJS.timer,this.gpuTimer=this.canvas.gl.getExtension("EXT_disjoint_timer_query")||null,this.gpuTimer&&(this.gpuTimerQuery=this.gpuTimer.createQueryEXT(this.gpuTimer.TIME_ELAPSED_EXT)),this.sceneStatus={nodes:{},numTasks:0};var c=this,d=a.nodes;a.nodes=null,this.scene=this.createNode(a),d&&(a.nodes=d,this.scene.addNodes(d)),SceneJS_events.addListener(SceneJS_events.RENDER,function(a){c.scene.publish("render",a)}),this.canvas.canvas.addEventListener("webglcontextlost",function(a){a.preventDefault(),c.stop(),SceneJS_events.fireEvent(SceneJS_events.WEBGL_CONTEXT_LOST,{scene:c.scene})},!1),this.canvas.canvas.addEventListener("webglcontextrestored",function(){c.canvas.initWebGL(),c.gpuTimer=c.canvas.gl.getExtension("EXT_disjoint_timer_query"),c.gpuTimer&&(c.gpuTimerQuery=c.gpuTimer.createQueryEXT(c.gpuTimer.TIME_ELAPSED_EXT)),c._coreFactory.webglRestored(),c.display.webglRestored(),SceneJS_events.fireEvent(SceneJS_events.WEBGL_CONTEXT_RESTORED,{scene:c.scene}),c.start()},!1)};SceneJS_Engine.prototype.setNumPasses=function(a){this._numPasses=a},SceneJS_Engine.prototype.setClearEachPass=function(a){this._clearEachPass=a},SceneJS_Engine.prototype.loseWebGLContext=function(){this.canvas.loseWebGLContext()},SceneJS_Engine.prototype.getNodeType=function(a,b){SceneJS_NodeFactory.getNodeType(a,b)},SceneJS_Engine.prototype.hasNodeType=function(a){return!!SceneJS_NodeFactory.nodeTypes[a]},SceneJS_Engine.prototype.createNode=function(a,b){this._doDestroyNodes(),a.type=a.type||"node";var c=this._coreFactory.getCore(a.type,a.coreId),d=this;return this._nodeFactory.getNode(this,a,c,function(c){if(!c._fromPlugin&&a.nodes)for(var e=0,f=0,g=a.nodes.length;g>f;f++)d.createNode(a.nodes[f],function(a){c.addNode(a),++e==g&&(b&&b(c),d.scene.publish("nodes/"+c.id,c))});else b&&(b(c),d.scene.publish("nodes/"+c.id,c))})},SceneJS_Engine.prototype._doDestroyNodes=function(){for(var a;this._numNodesToDestroy>0;)--this._numNodesToDestroy,a=this._nodesToDestroy[this._numNodesToDestroy],this._nodesToDestroy[this._numNodesToDestroy]=null,a._doDestroy(),this._coreFactory.putCore(a._core),this._nodeFactory.putNode(a)},SceneJS_Engine.prototype.findNode=function(a){return this._nodeFactory.nodes.items[a]},SceneJS_Engine.prototype.findNodes=function(a){var b=new RegExp(a),c=[],d=this._nodeFactory.nodes.items;for(var e in d)d.hasOwnProperty(e)&&b.test(e)&&c.push(d[e]);return c},SceneJS_Engine.prototype.hasCore=function(a,b){return this._coreFactory.hasCore(a,b)},SceneJS_Engine.prototype.branchDirty=function(a){if(!this.sceneDirty&&a!=window){a.branchDirty=!0,a.dirty=!0;for(var b=a.parent;b&&!b.dirty&&!b.branchDirty;b=b.parent)b.dirty=!0;this._sceneBranchesDirty=!0}},SceneJS_Engine.prototype.renderFrame=function(a){var b=!1;if(this._needCompile()||a&&a.force)for(var c=Date.now(),d=a&&a.force,e=0;e<this._numPasses;e++)this.scene.publish("rendering",{pass:e}),this.compile(),this.display.prepareScene(),this.display.render({pass:e,clear:this._clearEachPass||0==e,force:d,opaqueOnly:a&&a.opaqueOnly}),this.scene.publish("rendered",{sceneId:this.id,time:c,pass:e}),b=!0;return b},SceneJS_Engine.prototype.start=function(){function a(a){k=!1;for(var b=0;b<d._numPasses;b++)if(d._needCompile()||k){if(f=!1,p.pass=b,j.publish("rendering",p),d.compile(),d.display.prepareScene(),!a)break;q.pass=b,q.clear=d._clearEachPass||0==b,d.display.render(q),r.sceneId=d.id,r.time=g,r.pass=b,j.publish("rendered",r),k=!0}d.stats.frame.frameCount++,k||(f||(s.sceneId=d.id,s.startTime=i,s.prevTime=g,s.time=g,j.publish("sleep",s)),f=!0)}if(!this.running){this.running=!0,this.paused=!1,this.sceneDirty=!0;var b,c,d=this,e="__scenejs_sceneLoop"+this.id,f=!1,g=Date.now(),h=g,i=g,j=this.scene,k=!1,l=this.canvas.canvas,m=null,n=null,o=this.ticksPerRender;this.events.fireEvent("started",{sceneId:d.id,startTime:i});var p={pass:0},q={clear:!0},r={sceneId:d.id,time:g,pass:0},s={sceneId:d.id,startTime:g,prevTime:g,time:g},t={width:0,height:0,aspect:1},u={sceneId:d.id,startTime:g,prevTime:g,time:g},v=!1;window[e]=function(){var f=d.cpuTimer.now(),k=!1;if(d.gpuTimer){var p=d.gpuTimer.getQueryObjectEXT(d.gpuTimerQuery,d.gpuTimer.QUERY_RESULT_AVAILABLE_EXT),q=d.canvas.gl.getParameter(d.gpuTimer.GPU_DISJOINT_EXT);p&&(v=!1),p&&!q&&(d.stats.frame.gpuTime=d.gpuTimer.getQueryObjectEXT(d.gpuTimerQuery,d.gpuTimer.QUERY_RESULT_EXT)/1e6)}0===--o&&(k=!0,o=d.ticksPerRender);var r=d.canvas.resolutionScaling||1;if(b=l.width=l.clientWidth*r,c=l.height=l.clientHeight*r,(b!=m||c!=n)&&(t.width=b,t.height=c,t.aspect=b/c,j.publish("canvasSize",t),d.display.imageDirty=!0,m=b,n=c),d.running&&!d.paused){if(g=Date.now(),u.sceneId=d.id,u.startTime=i,u.prevTime=g,u.time=g,u.rendering=k,j.publish("tick",u),h=g,!d.running)return;d.gpuTimer&&!v&&d.gpuTimer.beginQueryEXT(d.gpuTimer.TIME_ELAPSED_EXT,d.gpuTimerQuery),a(k),d.gpuTimer&&!v&&(d.gpuTimer.endQueryEXT(d.gpuTimer.TIME_ELAPSED_EXT),v=!0)}d.stats.frame.cpuTime=d.cpuTimer.now()-f,d.running&&requestAnimationFrame(window[e])},requestAnimationFrame(window[e])}},SceneJS_Engine.prototype.pick=function(a){this._needCompile()&&this.compile();var b=this.display.pick({pickTriangle:a?a.rayPick:!1,pickRegion:a?a.regionPick:!1,canvasPos:a.canvasPos,origin:a.origin,direction:a.direction});return b},SceneJS_Engine.prototype.readPixels=function(a,b,c){return this._needCompile()&&this.compile(),this.display.readPixels(a,b,c)},SceneJS_Engine.prototype._needCompile=function(){return this.display.imageDirty||this.display.drawListDirty||this.display.stateSortDirty||this.display.stateOrderDirty||this.display.objectListDirty||this._sceneBranchesDirty||this.sceneDirty},SceneJS_Engine.prototype.pauseCompilation=function(){this._compilationPaused=!0},SceneJS_Engine.prototype.resumeCompilation=function(){this._compilationPaused=!1},SceneJS_Engine.prototype.compile=function(){if(!this._compilationPaused){if(this._sceneBranchesDirty||this.sceneDirty){this._sceneBranchesDirty=!1,SceneJS_events.fireEvent(SceneJS_events.SCENE_COMPILING,{engine:this}),this.pubSubProxy=new SceneJS_PubSubProxy(this.scene,null);var a={pubSubProxy:this.pubSubProxy},b=SceneJS.timer.now();this.scene._compileNodes(a),this.stats.load.sceneGraphCompilation+=SceneJS.timer.now()-b,this.sceneDirty=!1}this._doDestroyNodes()}},SceneJS_Engine.prototype.setDepthSort=function(a){this.display.setDepthSort(a)},SceneJS_Engine.prototype.pause=function(a){this.paused=a},SceneJS_Engine.prototype.stop=function(){this.running&&(this.running=!1,this.paused=!1,window["__scenejs_sceneLoop"+this.id]=null)},SceneJS_Engine.prototype.destroyNode=function(a){this._nodesToDestroy[this._numNodesToDestroy++]=a;var b=this.sceneStatus.nodes[a.id];b&&(this.sceneStatus.numTasks-=b.numTasks,delete this.sceneStatus.nodes[a.id])},SceneJS_Engine.prototype.destroy=function(){this.destroyed=!0},self.Int32Array||(self.Int32Array=Array,self.Float32Array=Array),function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c<b.length&&!window.requestAnimationFrame;++c)window.requestAnimationFrame=window[b[c]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[b[c]+"CancelAnimationFrame"]||window[b[c]+"RequestCancelAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(b){var c=(new Date).getTime(),d=Math.max(0,16-(c-a)),e=window.setTimeout(function(){b(c+d)},d);return a=c+d,e}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)})}();var SceneJS_error=new function(){var a;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){a=b.engine.id}),SceneJS_events.addListener(SceneJS_events.RESET,function(){a=null},1e5),this.fatalError=function(b,c){"string"==typeof b&&(c=b,b=SceneJS.errors.ERROR);var d={errorName:SceneJS.errors._getErrorName(b)||"ERROR",code:b,exception:c,fatal:!0};return a&&(d.sceneId=a),SceneJS_events.fireEvent(SceneJS_events.ERROR,d),c},this.error=function(b,c){var d={errorName:SceneJS.errors._getErrorName(b)||"ERROR",code:b,exception:c,fatal:!1};a&&(d.sceneId=a),SceneJS_events.fireEvent(SceneJS_events.ERROR,d)}};!function(){SceneJS.errors={};var a=0;SceneJS.errors.ERROR=a++,SceneJS.errors.INVALID_FRAMEBUFFER=a++,SceneJS.errors.WEBGL_NOT_SUPPORTED=a++,SceneJS.errors.WEBGL_CONTEXT_LOST=a++,SceneJS.errors.NODE_CONFIG_EXPECTED=a++,SceneJS.errors.ILLEGAL_NODE_CONFIG=a++,SceneJS.errors.SHADER_COMPILATION_FAILURE=a++,SceneJS.errors.SHADER_LINK_FAILURE=a++,SceneJS.errors.CANVAS_NOT_FOUND=a++,SceneJS.errors.OUT_OF_VRAM=a++,SceneJS.errors.WEBGL_UNSUPPORTED_NODE_CONFIG=a++,SceneJS.errors.NODE_NOT_FOUND=a++,SceneJS.errors.NODE_ILLEGAL_STATE=a++,SceneJS.errors.ID_CLASH=a++,SceneJS.errors.PLUGIN_INVALID=a++}(),SceneJS.errors._getErrorName=function(a){for(var b in SceneJS.errors)if(SceneJS.errors.hasOwnProperty(b)&&SceneJS.errors[b]==a)return b;return null};var SceneJS_configsModule=new function(){this.configs={};var a={};this.setConfigs=function(b,c){if(b){for(var d,e,f=b.split("."),g=this.configs,h=0;h<f.length-1;h++)e=f[h],d=g[e],d||(d=g[e]={}),g=d;g[f.length-1]=c}else this.configs=c;var i=a[b||"_all"];if(i)for(var h=0,j=i.length;j>h;h++)i[h](g);SceneJS.publish("configs",this.configs)},this.getConfigs=function(a){if(a){for(var b=this.configs,c=a.split("."),d=0;b&&d<c.length;d++)b=b[c[d]];return void 0!=b?b:{}}return this.configs},this.on=function(b,c){b=b||"_all",(a[b]||(a[b]=[])).push(c),c(this.getConfigs(b))}};SceneJS.configure=SceneJS.setConfigs=SceneJS.setDebugConfigs=function(){if(1==arguments.length)SceneJS_configsModule.setConfigs(null,arguments[0]);else{if(2!=arguments.length)throw SceneJS_error.fatalError("Illegal arguments given to SceneJS.setDebugs - should be either ({String}:name, {Object}:cfg) or ({Object}:cfg)");SceneJS_configsModule.setConfigs(arguments[0],arguments[1])}},SceneJS.getConfigs=SceneJS.getDebugConfigs=function(a){return SceneJS_configsModule.getConfigs(a)},SceneJS.log=new function(){var a,b=null,c={},d=0,e="";SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){a=b.engine.id}),SceneJS_events.addListener(SceneJS_events.RESET,function(){c={},b=null,a=null},1e5),this._setIndent=function(a){d=a;for(var b=[],c=0;d>c;c++)b.push("----");e=b.join("")},this.error=function(a){this._log("error",a)},this.warn=function(a){this._log("warn",a)},this.info=function(a){this._log("info",a)},this.debug=function(a){this._log("debug",a)},this.setFuncs=function(a){if(a){b=a;for(var d in c)this._flush(d)}},this._flush=function(a){var d=c[a];if(d){var e=b?b[a]:null;if(e){for(var f=0;f<d.length;f++)e(d[f]);c[a]=[]}}},this._log=function(a,b){if(SceneJS._isArray(b))for(var c=0;c<b.length;c++)this.__log(a,b[c]);else this.__log(a,b)},this.__log=function(a,c){c=e+c,b&&b[a]?b[a](c):console&&console[a]&&console[a](c)},this.getFuncs=function(){return b}},function(){{var a=(mat4.create(),mat4.create(),vec2.create(),vec3.create()),b=vec3.create(),c=vec3.create(),d=vec3.create(),e=vec3.create(),f=vec3.create(),g=vec3.create();vec3.create(),vec4.create()}window.SceneJS_math_cross3Vec4=function(a,b){var c=a[0],d=a[1],e=a[2],f=b[0],g=b[1],h=b[2];return[d*h-e*g,e*f-c*h,c*g-d*f,0]},window.SceneJS_math_setCellMat4=function(a,b,c,d){a[b+4*c]=d},window.SceneJS_math_LOOKAT_OBJ={eye:{x:0,y:0,z:10},look:{x:0,y:0,z:0},up:{x:0,y:1,z:0}},window.SceneJS_math_LOOKAT_ARRAYS={eye:[0,0,10],look:[0,0,0],up:[0,1,0]},window.SceneJS_math_ORTHO_OBJ={left:-1,right:1,bottom:-1,near:.1,top:1,far:5e3},window.SceneJS_math_identityQuaternion=function(){return[0,0,0,1]},window.SceneJS_math_angleAxisQuaternion=function(a,b,c,d){var e=d/180*Math.PI,f=e/2,g=Math.sin(f);return[g*a,g*b,g*c,Math.cos(f)]},window.SceneJS_math_mulQuaternions=function(a,b){var c=a[0],d=a[1],e=a[2],f=a[3],g=b[0],h=b[1],i=b[2],j=b[3];return[f*g+c*j+d*i-e*h,f*h+d*j+e*g-c*i,f*i+e*j+c*h-d*g,f*j-c*g-d*h-e*i]},window.SceneJS_math_newMat4FromQuaternion=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=2*b,g=2*c,h=2*d,i=f*e,j=g*e,k=h*e,l=f*b,m=g*b,n=h*b,o=g*c,p=h*c,q=h*d,r=mat4.create();return SceneJS_math_setCellMat4(r,0,0,1-(o+q)),SceneJS_math_setCellMat4(r,0,1,m-k),SceneJS_math_setCellMat4(r,0,2,n+j),SceneJS_math_setCellMat4(r,1,0,m+k),SceneJS_math_setCellMat4(r,1,1,1-(l+q)),SceneJS_math_setCellMat4(r,1,2,p-i),SceneJS_math_setCellMat4(r,2,0,n-j),SceneJS_math_setCellMat4(r,2,1,p+i),SceneJS_math_setCellMat4(r,2,2,1-(l+o)),r},window.SceneJS_math_normalizeQuaternion=function(a){var b=vec4.length([a[0],a[1],a[2],a[3]]);return[a[0]/b,a[1]/b,a[2]/b,a[3]/b]},window.SceneJS_math_angleAxisFromQuaternion=function(a){a=SceneJS_math_normalizeQuaternion(a);var b=a[3],c=2*Math.acos(b),d=Math.sqrt(1-b*b);return.001>d?{x:a[0],y:a[1],z:a[2],angle:57.295779579*c}:{x:a[0]/d,y:a[1]/d,z:a[2]/d,angle:57.295779579*c}},window.SceneJS_math_getPickPrimitives=function(a,b,c){for(var d,e,f,g,h,i,j,k,l=b.length,m=c?new Uint16Array(3*l):new Float32Array(3*l),n=new Uint8Array(4*l),o=0,p=0;l>p;p+=3)e=3*p,f=4*p,k=o>>24&255,j=o>>16&255,i=o>>8&255,h=255&o,g=b[p],d=3*g,m[e]=a[d],m[e+1]=a[d+1],m[e+2]=a[d+2],n[f]=h,n[f+1]=i,n[f+2]=j,n[f+3]=k,g=b[p+1],d=3*g,m[e+3]=a[d],m[e+4]=a[d+1],m[e+5]=a[d+2],n[f+4]=h,n[f+5]=i,n[f+6]=j,n[f+7]=k,g=b[p+2],d=3*g,m[e+6]=a[d],m[e+7]=a[d+1],m[e+8]=a[d+2],n[f+8]=h,n[f+9]=i,n[f+10]=j,n[f+11]=k,o++;return{positions:m,colors:n}},window.SceneJS_math_getPickPositions=function(a,b){for(var c,d,e,f=b.length,g=new Float32Array(3*f),h=0;f>h;h++)c=3*h,e=b[h],d=3*e,g[c]=a[d],g[c+1]=a[d+1],g[c+2]=a[d+2];return g},window.SceneJS_math_getPickColors=function(a){for(var b,c,d,e,f,g=a.length,h=new Uint8Array(4*g),i=0,j=0;g>j;j+=3)b=4*j,f=i>>24&255,e=i>>16&255,d=i>>8&255,c=255&i,h[b]=c,h[b+1]=d,h[b+2]=e,h[b+3]=f,h[b+4]=c,h[b+5]=d,h[b+6]=e,h[b+7]=f,h[b+8]=c,h[b+9]=d,h[b+10]=e,h[b+11]=f,i++;return h},window.SceneJS_math_rayPlaneIntersect=function(e,f,g,h,i,j){j=j||vec3.create(),f=vec3.normalize(a,f);var k=vec3.subtract(b,h,g),l=vec3.subtract(c,i,g),m=vec3.cross(d,k,l);vec3.normalize(m,m);var n=-vec3.dot(g,m),o=-(vec3.dot(e,m)+n)/vec3.dot(f,m);return j[0]=e[0]+o*f[0],j[1]=e[1]+o*f[1],j[2]=e[2]+o*f[2],j},window.SceneJS_math_cartesianToBarycentric=function(d,e,f,g,h){var i=vec3.subtract(a,g,e),j=vec3.subtract(b,f,e),k=vec3.subtract(c,d,e),l=vec3.dot(i,i),m=vec3.dot(i,j),n=vec3.dot(i,k),o=vec3.dot(j,j),p=vec3.dot(j,k),q=l*o-m*m;if(0===q)return null;var r=1/q,s=(o*n-m*p)*r,t=(l*p-m*n)*r;return h[0]=1-s-t,h[1]=t,h[2]=s,h},window.SceneJS_math_barycentricToCartesian=function(a,b,c,d,e){e=e||vec3.create();var f=a[0],g=a[1],h=a[2];return e[0]=b[0]*f+c[0]*g+d[0]*h,e[1]=b[1]*f+c[1]*g+d[1]*h,e[2]=b[2]*f+c[2]*g+d[2]*h,e},window.SceneJS_math_buildTangents=function(h,i,j,k,l){for(var m=new Float32Array(h.length),n=vec3.create(),o=vec3.create(),p=vec3.create(),q=vec2.create(),r=vec2.create(),s=vec2.create(),t=0;t<i.length;t+=3){var u=i[t];n.set(h.subarray(3*u,3*u+3)),q.set(j.subarray(2*u,2*u+2)),u=i[t+1],o.set(h.subarray(3*u,3*u+3)),r.set(j.subarray(2*u,2*u+2)),u=i[t+2],p.set(h.subarray(3*u,3*u+3)),s.set(j.subarray(2*u,2*u+2)),k&&(vec3.transformMat4(n,n,k),vec3.transformMat4(o,o,k),vec3.transformMat4(p,p,k)),l&&(vec2.transformMat3(q,q,l),vec2.transformMat3(r,r,l),vec2.transformMat3(s,s,l));for(var v=vec3.subtract(a,o,n),w=vec3.subtract(b,p,n),x=vec2.subtract(c,r,q),y=vec2.subtract(d,s,q),z=1/(x[0]*y[1]-x[1]*y[0]),A=vec3.scale(f,vec3.subtract(g,vec3.scale(e,v,y[1]),vec3.scale(f,w,x[1])),z),B=0;3>B;B++){var C=3*i[t+B];m[C]+=A[0],m[C+1]+=A[1],m[C+2]+=A[2]}}return m},window.SceneJS_math_octDecodeVec2=function(a,b){var c=a[0],d=a[1];c=(2*c+1)/255,d=(2*d+1)/255;var e=1-Math.abs(c)-Math.abs(d);0>e&&(c=(1-Math.abs(d))*(c>=0?1:-1),d=(1-Math.abs(c))*(d>=0?1:-1));var f=Math.sqrt(c*c+d*d+e*e);return b[0]=c/f,b[1]=d/f,b[2]=e/f,b}}();var SceneJS_sceneStatusModule=new function(){function a(){var a=document.getElementsByTagName("body")[0],b=document.createElement("div"),c=b.style;return c.position="absolute",c.width="200px",c.right="10px",c.top="0",c.padding="10px",c["z-index"]="10000",a.appendChild(b),b}function b(a,b){var c=document.createElement("div"),d=c.style;return d["font-family"]="Helvetica",d["font-size"]="14px",d.padding="5px",d.margin="4px",d["padding-left"]="12px",d.border="1px solid #000055",d.color="black",d.background="#AAAAAA",d.opacity="0.8",d["border-radius"]="3px",d["-moz-border-radius"]="3px",d["box-shadow"]="3px 3px 3px #444444",c.innerHTML=b,a.appendChild(c),c}function c(a){a.style.background="#AAFFAA";var b=.8,c=setInterval(function(){0>=b?(a.parentNode.removeChild(a),clearInterval(c)):(a.style.opacity=b,b-=.1)},100)}function d(a){a.style.background="#FFAAAA"}this.sceneStatus={};var e=new SceneJS_Map,f={},g={},h=this;SceneJS_events.addListener(SceneJS_events.SCENE_DESTROYED,function(a){var b=a.engine.id;delete h.sceneStatus[b],delete g[b]}),this.taskStarted=function(c,d){var h=SceneJS_configsModule.configs.statusPopups!==!1,i=c.getScene(),j=i.getId(),k=c.getId(),l=i.getCanvas(),m=e.addItem(),n=this.sceneStatus[j];n||(n=this.sceneStatus[j]={numTasks:0}),n.numTasks++;var o=g[j];o||(o=g[j]={sceneId:j,nodeStates:{},scene:i,popupContainer:h?a(l):null,descCounts:{}});var p=o.descCounts[d];void 0==p&&(p=o.descCounts[d]=0),o.descCounts[d]++;var q=o.nodeStates[k];q||(q=o.nodeStates[k]={nodeId:k,numTasks:0,tasks:{}}),d=d+" "+o.descCounts[d]+"...",q.numTasks++;var r={sceneState:o,nodeState:q,description:d,element:h?b(o.popupContainer,d):null};return q.tasks[m]=r,f[m]=r,m},this.taskFinished=function(a){if(-1==a||null==a)return null;var b=f[a];if(!b)return null;var d=b.sceneState;this.sceneStatus[d.sceneId].numTasks--,b.element&&c(b.element);var e=b.nodeState;return--e.numTasks<0&&(e.numTasks=0),delete e.tasks[a],0==e.numTasks&&delete d.nodeStates[e.nodeId],null},this.taskFailed=function(a){if(-1==a||null==a)return null;var b=f[a];if(!b)return null;var c=!!SceneJS_configsModule.configs.statusPopups,e=b.sceneState;this.sceneStatus[e.sceneId].numTasks--,c&&d(b.element);var g=b.nodeState;return g.numTasks--,delete g.tasks[a],0==g.numTasks&&delete b.sceneState.nodeStates[g.nodeId],null}};SceneJS._webgl={},SceneJS._webgl.ArrayBuffer=function(a,b,c,d,e,f,g){switch(this.allocated=!1,c.constructor){case Uint8Array:this.itemType=a.UNSIGNED_BYTE,this.itemByteSize=1;break;case Int8Array:this.itemType=a.BYTE,this.itemByteSize=1;break;case Uint16Array:this.itemType=a.UNSIGNED_SHORT,this.itemByteSize=2;break;case Int16Array:this.itemType=a.SHORT,this.itemByteSize=2;break;case Uint32Array:this.itemType=a.UNSIGNED_INT,this.itemByteSize=4;break;case Int32Array:this.itemType=a.INT,this.itemByteSize=4;break;default:this.itemType=a.FLOAT,this.itemByteSize=4}this.gl=a,this.type=b,this.numItems=d,this.itemSize=e,this.usage=f,this.normalize=!!g,this._allocate(c,d)},SceneJS._webgl.ArrayBuffer.prototype._allocate=function(a,b){if(this.allocated=!1,this.handle=this.gl.createBuffer(),!this.handle)throw SceneJS_error.fatalError(SceneJS.errors.OUT_OF_VRAM,"Failed to allocate WebGL ArrayBuffer");this.handle&&(this.gl.bindBuffer(this.type,this.handle),this.gl.bufferData(this.type,a,this.usage),this.gl.bindBuffer(this.type,null),this.numItems=b,this.length=a.length,this.allocated=!0)},SceneJS._webgl.ArrayBuffer.prototype.setData=function(a,b){this.allocated&&(a.length>this.length?(this.destroy(),this._allocate(a,a.length)):b||0===b?this.gl.bufferSubData(this.type,b*this.itemByteSize,a):this.gl.bufferData(this.type,a))},SceneJS._webgl.ArrayBuffer.prototype.unbind=function(){this.allocated&&this.gl.bindBuffer(this.type,null)},SceneJS._webgl.ArrayBuffer.prototype.destroy=function(){this.allocated&&(this.gl.deleteBuffer(this.handle),this.handle=null,this.allocated=!1)},SceneJS._webgl.ArrayBuffer.prototype.bind=function(){this.allocated&&this.gl.bindBuffer(this.type,this.handle)},SceneJS._webgl.Attribute=function(a,b,c,d,e,f){this.gl=a,this.location=f,this.bindArrayBuffer=function(b){b&&(b.bind(),a.enableVertexAttribArray(f),a.vertexAttribPointer(f,b.itemSize,b.itemType,b.normalize,0,0))}},SceneJS._webgl.Attribute.prototype.bindInterleavedFloatArrayBuffer=function(a,b,c){this.gl.enableVertexAttribArray(this.location),this.gl.vertexAttribPointer(this.location,a,this.gl.FLOAT,!1,b,c)},SceneJS._webgl.enumMap={funcAdd:"FUNC_ADD",funcSubtract:"FUNC_SUBTRACT",funcReverseSubtract:"FUNC_REVERSE_SUBTRACT",zero:"ZERO",one:"ONE",srcColor:"SRC_COLOR",oneMinusSrcColor:"ONE_MINUS_SRC_COLOR",dstColor:"DST_COLOR",oneMinusDstColor:"ONE_MINUS_DST_COLOR",srcAlpha:"SRC_ALPHA",oneMinusSrcAlpha:"ONE_MINUS_SRC_ALPHA",dstAlpha:"DST_ALPHA",oneMinusDstAlpha:"ONE_MINUS_DST_ALPHA",contantColor:"CONSTANT_COLOR",oneMinusConstantColor:"ONE_MINUS_CONSTANT_COLOR",constantAlpha:"CONSTANT_ALPHA",oneMinusConstantAlpha:"ONE_MINUS_CONSTANT_ALPHA",srcAlphaSaturate:"SRC_ALPHA_SATURATE",front:"FRONT",back:"BACK",frontAndBack:"FRONT_AND_BACK",never:"NEVER",less:"LESS",equal:"EQUAL",lequal:"LEQUAL",greater:"GREATER",notequal:"NOTEQUAL",gequal:"GEQUAL",always:"ALWAYS",cw:"CW",ccw:"CCW",linear:"LINEAR",nearest:"NEAREST",linearMipMapNearest:"LINEAR_MIPMAP_NEAREST",nearestMipMapNearest:"NEAREST_MIPMAP_NEAREST",nearestMipMapLinear:"NEAREST_MIPMAP_LINEAR",linearMipMapLinear:"LINEAR_MIPMAP_LINEAR",repeat:"REPEAT",clampToEdge:"CLAMP_TO_EDGE",mirroredRepeat:"MIRRORED_REPEAT",alpha:"ALPHA",rgb:"RGB",rgba:"RGBA",luminance:"LUMINANCE",luminanceAlpha:"LUMINANCE_ALPHA",textureBinding2D:"TEXTURE_BINDING_2D",textureBindingCubeMap:"TEXTURE_BINDING_CUBE_MAP",compareRToTexture:"COMPARE_R_TO_TEXTURE",unsignedByte:"UNSIGNED_BYTE"},SceneJS._webgl.RenderBuffer=function(a){this.allocated=!1,this.canvas=a.canvas,this.gl=a.canvas.gl,this.buf=null,this.bound=!1},SceneJS._webgl.RenderBuffer.prototype.webglRestored=function(a){this.gl=a,this.buf=null,this.allocated=!1,this.bound=!1},SceneJS._webgl.RenderBuffer.prototype.bind=function(){this._touch(),this.bound||(this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.buf.framebuf),this.bound=!0)},SceneJS._webgl.RenderBuffer.prototype._touch=function(){var a=this.canvas.canvas.width,b=this.canvas.canvas.height;if(this.buf){if(this.buf.width==a&&this.buf.height==b)return;this.gl.deleteTexture(this.buf.texture),this.gl.deleteFramebuffer(this.buf.framebuf),this.gl.deleteRenderbuffer(this.buf.renderbuf)}if(this.buf={framebuf:this.gl.createFramebuffer(),renderbuf:this.gl.createRenderbuffer(),texture:this.gl.createTexture(),width:a,height:b},this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.buf.framebuf),this.gl.bindTexture(this.gl.TEXTURE_2D,this.buf.texture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.NEAREST),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this._setTexture(a,b),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,this.buf.renderbuf),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,a,b),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this.buf.texture,0),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,this.buf.renderbuf),this.gl.bindTexture(this.gl.TEXTURE_2D,null),this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.buf.framebuf),!this.gl.isFramebuffer(this.buf.framebuf))throw SceneJS_error.fatalError(SceneJS.errors.INVALID_FRAMEBUFFER,"Invalid framebuffer");var c=this.gl.checkFramebufferStatus(this.gl.FRAMEBUFFER);switch(c){case this.gl.FRAMEBUFFER_COMPLETE:break;case this.gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:throw SceneJS_error.fatalError(SceneJS.errors.ERROR,"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_ATTACHMENT");case this.gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:throw SceneJS_error.fatalError(SceneJS.errors.ERROR,"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT");case this.gl.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:throw SceneJS_error.fatalError(SceneJS.errors.ERROR,"Incomplete framebuffer: FRAMEBUFFER_INCOMPLETE_DIMENSIONS");case this.gl.FRAMEBUFFER_UNSUPPORTED:throw SceneJS_error.fatalError(SceneJS.errors.ERROR,"Incomplete framebuffer: FRAMEBUFFER_UNSUPPORTED");default:throw SceneJS_error.fatalError(SceneJS.errors.ERROR,"Incomplete framebuffer: "+c)}this.bound=!1},SceneJS._webgl.RenderBuffer.prototype._setTexture=function(a,b){try{this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,a,b,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null)}catch(c){var d=new WebGLUnsignedByteArray(a*b*3);this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,a,b,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,d)}},SceneJS._webgl.RenderBuffer.prototype.clear=function(){if(!this.bound)throw"Render buffer not bound";this.gl.clear(this.gl.COLOR_BUFFER_BIT|this.gl.DEPTH_BUFFER_BIT),this.gl.disable(this.gl.BLEND)},SceneJS._webgl.RenderBuffer.prototype.read=function(a,b){var c=a,d=this.canvas.canvas.height-b,e=new Uint8Array(4);return this.gl.readPixels(c,d,1,1,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e),e},SceneJS._webgl.RenderBuffer.prototype.unbind=function(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.bound=!1},SceneJS._webgl.RenderBuffer.prototype.getTexture=function(){var a=this;return{bind:function(b){return a.buf&&a.buf.texture?(a.gl.activeTexture(a.gl["TEXTURE"+b]),a.gl.bindTexture(a.gl.TEXTURE_2D,a.buf.texture),!0):!1},unbind:function(b){a.buf&&a.buf.texture&&(a.gl.activeTexture(a.gl["TEXTURE"+b]),a.gl.bindTexture(a.gl.TEXTURE_2D,null))}}},SceneJS._webgl.RenderBuffer.prototype.destroy=function(){this.buf&&(this.gl.deleteTexture(this.buf.texture),this.gl.deleteFramebuffer(this.buf.framebuf),this.gl.deleteRenderbuffer(this.buf.renderbuf),this.buf=null,this.bound=!1)},SceneJS._webgl.Program=function(a,b,c,d){this.stats=a,this.allocated=!1,this.gl=b,this._uniforms={},this._samplers={},this._attributes={},this.materialSettings={specularColor:[0,0,0],specular:0,shine:0,emit:0,alpha:0},this._shaders=[];var e,f,g,h,i,j,k=SceneJS.timer.now();for(f=0;f<c.length;f++)this._shaders.push(new SceneJS._webgl.Shader(a,b,b.VERTEX_SHADER,c[f]));for(f=0;f<d.length;f++)this._shaders.push(new SceneJS._webgl.Shader(a,b,b.FRAGMENT_SHADER,d[f]));if(this.handle=b.createProgram(),this.handle){for(f=0;f<this._shaders.length;f++)j=this._shaders[f],j.valid&&b.attachShader(this.handle,j.handle);b.linkProgram(this.handle),b.getProgramParameter(this.handle,b.LINK_STATUS)||SceneJS.log.error("Shader program failed to link: "+b.getProgramInfoLog(this.handle));var l=b.getProgramParameter(this.handle,b.ACTIVE_UNIFORMS),m=0;for(f=0;l>f;++f)g=b.getActiveUniform(this.handle,f),g&&(h=g.name,"\x00"==h[h.length-1]&&(h=h.substr(0,h.length-1)),i=b.getUniformLocation(this.handle,h),g.type==b.SAMPLER_2D||g.type==b.SAMPLER_CUBE||35682==g.type?this._samplers[h]=new SceneJS._webgl.Sampler(b,this.handle,h,g.type,g.size,i):(this._uniforms[h]=new SceneJS._webgl.Uniform(b,this.handle,h,g.type,g.size,i,m),++m));var n=b.getProgramParameter(this.handle,b.ACTIVE_ATTRIBUTES);for(f=0;n>f;f++)e=b.getActiveAttrib(this.handle,f),e&&(i=b.getAttribLocation(this.handle,e.name),this._attributes[e.name]=new SceneJS._webgl.Attribute(b,this.handle,e.name,e.type,e.size,i));a.load.programCompilation+=SceneJS.timer.now()-k,this.allocated=!0}},SceneJS._webgl.Program.prototype.bind=function(){this.allocated&&this.gl.useProgram(this.handle)},SceneJS._webgl.Program.prototype.getUniformLocation=function(a){if(this.allocated){var b=this._uniforms[a];return b?b.getLocation():void 0}},SceneJS._webgl.Program.prototype.getUniform=function(a){if(this.allocated){var b=this._uniforms[a];return b?b:void 0}},SceneJS._webgl.Program.prototype.getAttribute=function(a){if(this.allocated){var b=this._attributes[a];return b?b:void 0}},SceneJS._webgl.Program.prototype.bindArrayBuffer=function(a,b){if(this.allocated){var c=this._attributes[a];c&&c.bindArrayBuffer(b)}},SceneJS._webgl.Program.prototype.bindTexture=function(a,b,c){if(!this.allocated)return!1;var d=this._samplers[a];return d?d.bindTexture(b,c):!1},SceneJS._webgl.Program.prototype.destroy=function(){if(this.allocated){this.gl.deleteProgram(this.handle);for(var a in this._shaders)this.gl.deleteShader(this._shaders[a].handle);this.handle=null,this._attributes=null,this._uniforms=null,this._samplers=null,this.allocated=!1}},SceneJS._webgl.Program.prototype.setUniform=function(a,b){if(this.allocated){var c=this._uniforms[a];c&&c.setValue(b)}},SceneJS._webgl.Sampler=function(a,b,c,d,e,f){this.bindTexture=function(b,c){return b.bind(c)?(a.uniform1i(f,c),!0):!1}},SceneJS._webgl.Shader=function(a,b,c,d){this.allocated=!1;var e=SceneJS.timer.now();if(this.handle=b.createShader(c),!this.handle)throw SceneJS_error.fatalError(SceneJS.errors.OUT_OF_VRAM,"Failed to create WebGL shader");if(b.shaderSource(this.handle,d),b.compileShader(this.handle),this.valid=0!=b.getShaderParameter(this.handle,b.COMPILE_STATUS),!this.valid&&!b.isContextLost()){SceneJS.log.error("Shader program failed to compile: "+b.getShaderInfoLog(this.handle)),SceneJS.log.error("Shader source:");for(var f=d.split("\n"),g=0;g<f.length;g++)SceneJS.log.error(g+1+": "+f[g]);throw SceneJS_error.fatalError(SceneJS.errors.SHADER_COMPILATION_FAILURE,"Shader program failed to compile")}a.load.shaderCompilation+=SceneJS.timer.now()-e,this.allocated=!0},SceneJS._webgl.Texture2D=function(a,b){try{this._init(a,b)}catch(c){throw SceneJS_error.fatalError(SceneJS.errors.OUT_OF_VRAM,"Failed to create texture: "+c.message||c)}},SceneJS._webgl.Texture2D.prototype._init=function(a,b){this.allocated=!1,this.gl=a,this.target=b.target||a.TEXTURE_2D,this.minFilter=b.minFilter,this.magFilter=b.magFilter,this.wrapS=b.wrapS,this.wrapT=b.wrapT,this.update=b.update,this.texture=b.texture,this.compressed=!!b.compressed,this.format=a.RGBA,this.isDepth=!1,this.depthMode=0,this.depthCompareMode=0,this.depthCompareFunc=0,a.bindTexture(this.target,this.texture),b.minFilter&&a.texParameteri(this.target,a.TEXTURE_MIN_FILTER,b.minFilter),b.magFilter&&a.texParameteri(this.target,a.TEXTURE_MAG_FILTER,b.magFilter),b.wrapS&&a.texParameteri(this.target,a.TEXTURE_WRAP_S,b.wrapS),b.wrapT&&a.texParameteri(this.target,a.TEXTURE_WRAP_T,b.wrapT),this.compressed||this.minFilter!=a.NEAREST_MIPMAP_NEAREST&&this.minFilter!=a.LINEAR_MIPMAP_NEAREST&&this.minFilter!=a.NEAREST_MIPMAP_LINEAR&&this.minFilter!=a.LINEAR_MIPMAP_LINEAR||a.generateMipmap(this.target),a.bindTexture(this.target,null),this.allocated=!0},SceneJS._webgl.Texture2D.prototype.bind=function(a){if(this.allocated){var b=this.gl;return this.texture?(b.activeTexture(b["TEXTURE"+a]),b.bindTexture(this.target,this.texture),this.update&&this.update(b),!0):!1}},SceneJS._webgl.Texture2D.prototype.unbind=function(a){if(this.allocated){var b=this.gl;this.texture&&(b.activeTexture(b["TEXTURE"+a]),b.bindTexture(this.target,null))}},SceneJS._webgl.Texture2D.prototype.destroy=function(){if(this.allocated){var a=this.gl;this.texture&&(a.deleteTexture(this.texture),this.texture=null)}},SceneJS._webgl.clampImageSize=function(a,b){var c=a.width*a.height;if(c>b){var d=b/c,e=a.width*d,f=a.height*d,g=document.createElement("canvas");g.width=SceneJS._webgl.nextHighestPowerOfTwo(e),g.height=SceneJS._webgl.nextHighestPowerOfTwo(f);var h=g.getContext("2d");h.drawImage(a,0,0,a.width,a.height,0,0,g.width,g.height),a=g}return a},SceneJS._webgl.ensureImageSizePowerOfTwo=function(a){if(!SceneJS._webgl.isPowerOfTwo(a.width)||!SceneJS._webgl.isPowerOfTwo(a.height)){var b=document.createElement("canvas");b.width=SceneJS._webgl.nextHighestPowerOfTwo(a.width),b.height=SceneJS._webgl.nextHighestPowerOfTwo(a.height);var c=b.getContext("2d");c.drawImage(a,0,0,a.width,a.height,0,0,b.width,b.height),
  a=b}return a},SceneJS._webgl.isPowerOfTwo=function(a){return 0==(a&a-1)},SceneJS._webgl.nextHighestPowerOfTwo=function(a){--a;for(var b=1;32>b;b<<=1)a|=a>>b;return a+1},function(){function a(a,b){if(b===a.BOOL)return null;if(b===a.BOOL_VEC2)return new Array(2);if(b===a.BOOL_VEC3)return new Array(3);if(b===a.BOOL_VEC4)return new Array(4);if(b===a.INT)return null;if(b===a.INT_VEC2)return new Uint32Array(2);if(b===a.INT_VEC3)return new Uint32Array(3);if(b===a.INT_VEC4)return new Uint32Array(4);if(b===a.FLOAT)return null;if(b===a.FLOAT_VEC2)return new Float32Array(2);if(b===a.FLOAT_VEC3)return new Float32Array(3);if(b===a.FLOAT_VEC4)return new Float32Array(4);if(b===a.FLOAT_MAT2)return new Float32Array(4);if(b===a.FLOAT_MAT3)return new Float32Array(9);if(b===a.FLOAT_MAT4)return new Float32Array(16);throw"Unsupported shader uniform type: "+b}var b=function(){var a={},b=document.createElement("canvas"),c=b.getContext("webgl")||b.getContext("experimental-webgl");return c?(a[c.BOOL]=function(a){this.value!==a&&(this.value=a,this.gl.uniform1i(this.location,a))},a[c.BOOL_VEC2]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1])&&(this.value[0]=a[0],this.value[1]=a[1],this.gl.uniform2iv(this.location,a))},a[c.BOOL_VEC3]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2])&&(this.value[0]=a[0],this.value[1]=a[1],this.value[2]=a[2],this.gl.uniform3iv(this.location,a))},a[c.BOOL_VEC4]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2]||this.value[3]!==a[3])&&(this.value[0]=a[0],this.value[1]=a[1],this.value[2]=a[2],this.value[3]=a[3],this.gl.uniform4iv(this.location,a))},a[c.INT_VEC2]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1])&&(this.value.set(a),this.gl.uniform2iv(this.location,a))},a[c.INT_VEC3]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2])&&(this.value.set(a),this.gl.uniform3iv(this.location,a))},a[c.INT_VEC4]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2]||this.value[3]!==a[3])&&(this.value.set(a),this.gl.uniform4iv(this.location,a))},a[c.FLOAT]=function(a){this.value!==a&&(this.value=a,this.gl.uniform1f(this.location,a))},a[c.FLOAT_VEC2]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1])&&(this.value.set(a),this.gl.uniform2fv(this.location,a))},a[c.FLOAT_VEC3]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2])&&(this.value.set(a),this.gl.uniform3fv(this.location,a))},a[c.FLOAT_VEC4]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2]||this.value[3]!==a[3])&&(this.value.set(a),this.gl.uniform4fv(this.location,a))},a[c.FLOAT_MAT2]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2]||this.value[3]!==a[3])&&(this.value.set(a),this.gl.uniformMatrix2fv(this.location,c.FALSE,a))},a[c.FLOAT_MAT3]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2]||this.value[3]!==a[3]||this.value[4]!==a[4]||this.value[5]!==a[5]||this.value[6]!==a[6]||this.value[7]!==a[7]||this.value[8]!==a[8])&&(this.value.set(a),this.gl.uniformMatrix3fv(this.location,c.FALSE,a))},a[c.FLOAT_MAT4]=function(a){(this.value[0]!==a[0]||this.value[1]!==a[1]||this.value[2]!==a[2]||this.value[3]!==a[3]||this.value[4]!==a[4]||this.value[5]!==a[5]||this.value[6]!==a[6]||this.value[7]!==a[7]||this.value[8]!==a[8]||this.value[9]!==a[9]||this.value[10]!==a[10]||this.value[11]!==a[11]||this.value[12]!==a[12]||this.value[13]!==a[13]||this.value[14]!==a[14]||this.value[15]!==a[15])&&(this.value.set(a),this.gl.uniformMatrix4fv(this.location,c.FALSE,a))},a):a}();SceneJS._webgl.Uniform=function(c,d,e,f,g,h,i){this.index=i,this.gl=c,this.location=h,this.value=a(c,f),this.setValue=b[f]},SceneJS._webgl.Uniform.prototype.getLocation=function(){return this.location}}();var SceneJS_nodeEventsModule=new function(){var a,b=[],c=[],d=0,e={type:"listeners",stateId:SceneJS._baseStateId++,empty:!0,listeners:[]};SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(){d=0,a=!0}),SceneJS_events.addListener(SceneJS_events.OBJECT_COMPILING,function(f){if(a){if(d>0){var g={type:"listeners",stateId:b[d-1],listeners:c.slice(0,d)};f.display.renderListeners=g}else f.display.renderListeners=e;a=!1}}),this.preVisitNode=function(e){var f=!!e.onRendered,g=!!e.onWorldPos,h=!!e.onViewPos,i=!!e.onCameraPos,j=!!e.onProjPos,k=!!e.onCanvasPos;(f||g||h||i||j||k)&&(b[d]=e.id,c[d]=function(a){f&&e.onRendered(a),g&&e.onWorldPos(a.getWorldPos()),h&&e.onViewPos(a.getViewPos()),i&&e.onCameraPos(a.getCameraPos()),j&&e.onProjPos(a.getProjPos()),k&&e.onCanvasPos(a.getCanvasPos())},d++,a=!0)},this.postVisitNode=function(c){c.id==b[d-1]&&(d--,a=!0)}},SceneJS_Core=function(a){this.type=a,this.coreId=null,this.stateId=null,this.useCount=0};!function(){function a(c){this.flags=this.flags|b.MATRIX_DIRTY|b.DIRTY;for(var d=0,e=c.numCores;e>d;d++)a(c.cores[d])}var b={MATRIX_DIRTY:1,COMPILING:2,DIRTY:4},c=window.SceneJS_XformCore=function(){this.type="xform",this.coreId=null,this.stateId=null,this.useCount=0,this.parent=null,this.cores=[],this.numCores=0,this.matrix=mat4.create(),this.mat=mat4.create(),this.normalMat=mat4.create()};c.prototype.setDirty=function(){this.flags=this.flags|b.MATRIX_DIRTY,a(this)};var d=new mat4.create;c.prototype.build=function(){this.flags&b.MATRIX_DIRTY&&(this.buildMatrix&&this.buildMatrix(),this.flags=this.flags&~b.MATRIX_DIRTY);var a=this.parent;if(a)for(d.set(this.matrix);a;)a.flags&b.MATRIX_DIRTY&&(a.buildMatrix&&a.buildMatrix(),a.mat.set(a.matrix),mat4.invert(a.normalMat,a.matrix),mat4.transpose(a.normalMat,a.normalMat),a.flags=a.flags&~b.MATRIX_DIRTY),mat4.multiply(d,a.matrix,d),a=a.parent;else d.set(this.matrix);this.mat.set(d),mat4.invert(this.normalMat,d),mat4.transpose(this.normalMat,this.normalMat),this.flags=this.flags&~b.DIRTY}}(),function(){function a(a){var b,c,d,e=a._engine.canvas.gl;a.arrays.positions?(b=SceneJS_math_getPickPrimitives(a.arrays.positions,a.arrays.indices,a.compressedPositions),c=b.positions,d=b.colors,a.pickPositionsBuf=new SceneJS._webgl.ArrayBuffer(e,e.ARRAY_BUFFER,c,c.length,3,e.STATIC_DRAW),a._engine.stats.memory.pickPositions+=c.length*c.constructor.BYTES_PER_ELEMENT,a._engine.stats.memory.pickColors+=d.length*d.constructor.BYTES_PER_ELEMENT):(d=SceneJS_math_getPickColors(a.arrays.indices),a._engine.stats.memory.pickColors+=d.length*d.constructor.BYTES_PER_ELEMENT),a.pickColorsBuf=new SceneJS._webgl.ArrayBuffer(e,e.ARRAY_BUFFER,d,d.length,4,e.STATIC_DRAW,!0)}var b=window.SceneJS_GeometryCore=function(){this.type="xform",this.coreId=null,this.stateId=null};b.prototype.getTangents=function(a){if(this.tangentBufs||(this.tangentBufs=[]),this.tangentBufs[a])return this.tangentBufs[a];var b=this.arrays,c=this.arrays.tangents[a],d=this._engine.canvas.gl;return c||b.positions&&b.indices&&b.uvs&&b.uvs[a]&&(c=SceneJS_math_buildTangents(b.positions,b.indices,b.uvs[a],this.positionDecodeMat,this.compressedUVs&&this.uvDecodeMats[a]),this._engine.stats.memory.tangents+=c.length*c.constructor.BYTES_PER_ELEMENT),c?(this.tangentBufs[a]=new SceneJS._webgl.ArrayBuffer(d,d.ARRAY_BUFFER,c,c.length,3,d.STATIC_DRAW),this.arrays.tangents[a]=!0,this.tangentBufs[a]):null},b.prototype.getPickPositions=function(){return this.pickPositionsBuf?this.pickPositionsBuf:(a(this),this.pickPositionsBuf)},b.prototype.getPickColors=function(){return this.pickColorsBuf?this.pickColorsBuf:(a(this),this.pickColorsBuf)}}();var SceneJS_PropertiesCore=function(){var a=SceneJS.PROPERTY_FLAGS;this.type="properties",this.coreId=null,this.stateId=null,this.useCount=0,this.solidColor=new Float32Array([1,1,1]),this.name=null,this.layer=0,this.glassFactor=.4,this.murkiness=.8,this.opacity=1,this.flags=a.PICKING|a.CLIPPING|a.ENABLED|a.BACKFACES|a.REFLECTIVE|a.CCW|a.DEPTH_MASK,this.transparent=!1,this.blend=!1,this.hash="refl;;;;"};SceneJS_PropertiesCore.prototype.getFlag=function(a){return!!(this.flags&a)},SceneJS_PropertiesCore.prototype.setFlag=function(a,b){this.flags=b?this.flags|a:this.flags&~a},SceneJS_PropertiesCore.prototype.resetTransparency=function(){this.transparent=this.opacity<1||this.getFlag(SceneJS.PROPERTY_FLAGS.XRAY_ENABLED)&&this.getFlag(SceneJS.PROPERTY_FLAGS.XRAY)};var SceneJS_CoreFactory=function(){this._stateMap=new SceneJS_Map(null,SceneJS._baseStateId),this._cores={}};SceneJS_CoreFactory.coreAliases={rotate:"xform",translate:"xform",scale:"xform",matrix:"xform",xform:"xform"},SceneJS_CoreFactory.coreConstructors={xform:SceneJS_XformCore,geometry:SceneJS_GeometryCore,properties:SceneJS_PropertiesCore,"default":SceneJS_Core},SceneJS_CoreFactory.prototype.getCore=function(a,b){var c=SceneJS_CoreFactory.coreAliases[a];c&&(a=c);var d=this._cores[a];d||(d=this._cores[a]={});var e;if(b&&(e=d[b]))return e.useCount++,e;var f=SceneJS_CoreFactory.coreConstructors[a]||SceneJS_CoreFactory.coreConstructors["default"];return e=new f(a),e.useCount=1,e.stateId=this._stateMap.addItem(e),e.coreId=void 0!=b&&null!=b?b:e.stateId,d[e.coreId]=e,e},SceneJS_CoreFactory.prototype.hasCore=function(a,b){var c=SceneJS_CoreFactory.coreAliases[a];c&&(a=c);var d=this._cores[a];return d&&d[b]},SceneJS_CoreFactory.prototype.putCore=function(a){if(0!=a.useCount&&--a.useCount<=0){var b=this._cores[a.type];delete b[a.coreId],this._stateMap.removeItem(a.stateId)}},SceneJS_CoreFactory.prototype.webglRestored=function(){var a,b;for(var c in this._cores)if(this._cores.hasOwnProperty(c)&&(a=this._cores[c]))for(var d in a)a.hasOwnProperty(d)&&(b=a[d],b&&b.webglRestored&&b.webglRestored())},SceneJS.Node=function(){},SceneJS.Node.prototype.constructor=SceneJS.Node,SceneJS.Node.prototype._construct=function(a,b,c,d){this._engine=a,this._core=b,this.coreId=b.coreId,this.id=c.id||c.nodeId||d,this.type=c.type||"node",this.data=c.data,this.parent=null,this.nodes=[],this.dirty=!1,this.disabled=!1,this.branchDirty=!1,this._init&&this._init(c)},SceneJS.Node.prototype.disable=function(){this.disabled||(this.disabled=!0,this._engine.branchDirty(this))},SceneJS.Node.prototype.enable=function(){this.disabled&&(this.disabled=!1,this._engine.branchDirty(this))},SceneJS.Node.prototype.taskStarted=function(a){return SceneJS_sceneStatusModule.taskStarted(this,a||"Task")},SceneJS.Node.prototype.taskFinished=function(a){return SceneJS_sceneStatusModule.taskFinished(a)},SceneJS.Node.prototype.taskFailed=function(a){return SceneJS_sceneStatusModule.taskFailed(a)},SceneJS.Node.prototype.log=function(){var a,b;switch(1==arguments.length?(a="info",b=arguments[0]):2==arguments.length&&(a=arguments[0],b=arguments[1]),a){case"warn":b="WARN;  [SceneJS.Node type="+this.type+", id="+this.id+"] : "+b;break;case"error":b="ERROR; [SceneJS.Node type="+this.type+", id="+this.id+"] : "+b;break;default:b="INFO;  [SceneJS.Node type="+this.type+", id="+this.id+"] : "+b}console[a]?console[a](b):console.log(b)},SceneJS.Node.prototype.getScene=function(){return this._engine.scene},SceneJS.Node.prototype.getCoreId=function(){return this._core.coreId},SceneJS.Node.prototype.getID=function(){return this.id},SceneJS.Node.prototype.getId=function(){return this.id},SceneJS.Node.prototype.getNodeId=function(){return this.id},SceneJS.Node.prototype.getType=function(){return this.type},SceneJS.Node.prototype.getData=function(){return this.data},SceneJS.Node.prototype.setData=function(a){return this.data=a,this},SceneJS.Node.prototype.getNumNodes=function(){return this.nodes.length},SceneJS.Node.prototype.getNodes=function(){return this.nodes.slice(0)},SceneJS.Node.prototype.getNodeAt=function(a){return 0>a||a>=this.nodes.length?null:this.nodes[a]},SceneJS.Node.prototype.getFirstNode=function(){return 0==this.nodes.length?null:this.nodes[0]},SceneJS.Node.prototype.getLastNode=function(){return 0==this.nodes.length?null:this.nodes[this.nodes.length-1]},SceneJS.Node.prototype.getNode=function(a){for(var b=0;b<this.nodes.length;b++)if(this.nodes[b].id==a)return this.nodes[b];return null},SceneJS.Node.prototype.disconnectNodeAt=function(a){var b=this.nodes.splice(a,1);return b.length>0?(b[0]._disconnectFromScene(),b[0].parent=null,this._engine.branchDirty(this),b[0]):null},SceneJS.Node.prototype.disconnect=function(){if(this.parent){for(var a=0;a<this.parent.nodes.length;a++)if(this.parent.nodes[a]===this){var b=this.parent.disconnectNodeAt(a);return this._disconnectFromScene(),this.parent=null,b}this._disconnectFromScene(),this.parent=null}return null},SceneJS.Node.prototype._connectToScene=function(){this._connect&&this._connect();for(var a=0,b=this.nodes.length;b>a;a++)this.nodes[a]._connectToScene()},SceneJS.Node.prototype._disconnectFromScene=function(){this._disconnect&&this._disconnect();for(var a=0,b=this.nodes.length;b>a;a++)this.nodes[a]._disconnectFromScene()},SceneJS.Node.prototype.removeNodeAt=function(a){var b=this.disconnectNodeAt(a);b&&b.destroy()},SceneJS.Node.prototype.removeNode=function(a){if(!a)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Node#removeNode - node argument undefined");if(!a._compile&&"string"==typeof a){var b=this._engine.findNode(a);if(!b)throw SceneJS_error.fatalError(SceneJS.errors.NODE_NOT_FOUND,"Node#removeNode - node not found anywhere: '"+a+"'");a=b}if(a._compile)for(var c=0;c<this.nodes.length;c++)if(this.nodes[c]===a){var d=this.removeNodeAt(c);return d}throw SceneJS_error.fatalError(SceneJS.errors.NODE_NOT_FOUND,"Node#removeNode - child node not found: "+(a._compile?": "+a.id:a))},SceneJS.Node.prototype.disconnectNodes=function(){for(var a=this.nodes.length,b=0;a>b;b++)this.nodes[b]._disconnectFromScene(),this.nodes[b].parent=null;var c=this.nodes;return this.nodes=[],this._engine.branchDirty(this),c},SceneJS.Node.prototype.removeNodes=function(){for(var a=this.disconnectNodes(),b=0;b<a.length;b++)a[b].destroy()},SceneJS.Node.prototype.splice=function(){var a,b;if(null==this.parent)return null;var c=this.parent,d=this.disconnectNodes();for(a=0,b=d.length;b>a;a++)d[a].parent=this.parent,d[a]._connectToScene();for(a=0,b=c.nodes.length;b>a;a++)if(c.nodes[a]===this)return c.nodes.splice.apply(c.nodes,[a,1].concat(d)),this.nodes=[],this._disconnectFromScene(),this.parent=null,this.destroy(),this._engine.branchDirty(c),c},SceneJS.Node.prototype.addNodes=function(a,b){if(!a)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Node#addNodes - nodes argument is undefined");for(var c,d=[],e=a.length,f=a.length-1;f>=0;f--){var g=a[f];if("node"==g.type||this._engine.hasNodeType(g.type)){if(c=this.addNode(g),d[f]=c,0==--e)return b&&b(a),a}else{var h=this;!function(){var c=f;h.addNode(g,function(f){d[c]=f,0==--e&&b&&b(a)})}()}}return null},SceneJS.Node.prototype.addNode=function(a,b){if(a=a||{},a._compile){if(null!=a.parent)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Node#addNode - node argument is still attached to another parent");return this.nodes.push(a),a.parent=this,a._connectToScene(),this._engine.branchDirty(a),b&&b(a),a}if("string"==typeof a){var c=this._engine.findNode(a);if(!c)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Node#addNode - node not found: '"+a+"'");if(a=c,null!=a.parent)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Node#addNode - node argument is still attached to another parent");return this.nodes.push(a),a.parent=this,a._connectToScene(),this._engine.branchDirty(a),b&&b(a),a}if(a.type=a.type||"node","node"==a.type||this._engine.hasNodeType(a.type))return a=this._engine.createNode(a),this.nodes.push(a),a.parent=this,a._connectToScene(),this._engine.branchDirty(a),b&&b(a),a;var d=this;return this._engine.createNode(a,function(a){d.nodes.push(a),a.parent=d,a._connectToScene(),d._engine.branchDirty(a),b&&b(a)}),null},SceneJS.Node.prototype.insertNode=function(a,b){if(!a)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.Node#insertNode - node argument is undefined");if(a._compile||(a=this._engine.createNode(a)),!a._compile)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.Node#insertNode - node argument is not a SceneJS.Node");if(null!=a.parent)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.Node#insertNode - node argument is still attached to another parent");if(void 0===b||null===b)a.addNodes(this.disconnectNodes()),this.addNode(a);else{if(0>b)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.Node#insertNode - node index out of range: -1");b>=this.nodes.length?this.nodes.push(a):this.nodes.splice(b,0,a)}return a.parent=this,a._connectToScene(),a},SceneJS.Node.prototype.mapNodes=function(a){if(a(this))return this;for(var b,c=0;c<this.nodes.length;c++)if(b=this.nodes[c].mapNodes(a))return b;return null},SceneJS.Node.prototype.getParent=function(){return this.parent},SceneJS.Node.prototype.getParentOfType=function(a){for(var b=this.parent;b&&b.type!=a;)b=b.parent;return b},SceneJS.Node.prototype.eachParent=function(a){if(!a)throw"SceneJS.Node.eachParent param 'fn' is null or undefined";for(var b=0,c=this;c.parent;){if(a.call(c.parent,b++)===!0)return c.parent;c=c.parent}return null},SceneJS.Node.prototype.hasNode=function(a){if(null===a||void 0===a)throw"SceneJS.Node.hasNode param 'node' is null or undefined";var b,c=typeof a;if("number"==c)b=this.getNodeAt(a);else{if("string"!=c)throw"SceneJS.Node.hasNode param 'node' should be either an index number or an ID string";b=this.getNode(a)}return void 0!=b&&null!=b},SceneJS.Node.prototype.node=function(a){if(null===a||void 0===a)throw"SceneJS.Node.node param 'node' is null or undefined";var b,c=typeof a;if("number"==c)b=this.getNodeAt(a);else{if("string"!=c)throw"SceneJS.Node.node param 'node' should be either an index number or an ID string";b=this.getNode(a)}if(!b)throw"SceneJS.Node.node - node not found: '"+a+"'";return b},SceneJS.Node.prototype.eachNode=function(a,b){if(!a)throw"SceneJS.Node.eachNode param 'fn' is null or undefined";if("function"!=typeof a)throw"SceneJS.Node.eachNode param 'fn' should be a function";var c;b=b||{};var d=0;return b.andSelf&&a.call(this,d++)===!0?this:(b.depthFirst||b.breadthFirst?b.depthFirst&&(c=this._iterateEachNodeDepthFirst(a,this,d,!1)):c=this._iterateEachNode(a,this,d),c?c:void 0)},SceneJS.Node.prototype.numNodes=function(){return this.nodes.length},SceneJS.Node.prototype._iterateEachNode=function(a,b,c){for(var d,e=b.nodes.length,f=0;e>f;f++)if(d=b.nodes[f],a.call(d,c++)===!0)return d;return null},SceneJS.Node.prototype._iterateEachNodeDepthFirst=function(a,b,c,d){if(d&&a.call(b,c++)===!0)return b;d=!0;for(var e,f=b.nodes.length,g=0;f>g;g++)if(e=this._iterateEachNodeDepthFirst(a,b.nodes[g],c,d))return e;return null},SceneJS.Node.prototype.findNodesByType=function(a,b){return this._findNodesByType(a,[],b)},SceneJS.Node.prototype._findNodesByType=function(a,b,c){var d;for(d=0;d<this.nodes.length;d++){var e=this.nodes[d];e.type==a&&b.push(e)}if(c)for(d=0;d<this.nodes.length;d++)this.nodes[d]._findNodesByType(a,b,c);return b},SceneJS.Node.prototype.findParentByType=function(a){for(var b=this.parent;b&&b.type!=a;)b=b.parent;return b},SceneJS.Node.prototype.getJSON=function(){return this},SceneJS.Node.prototype._compile=function(a){this.preCompile&&this.preCompile(),this._compileNodes(a),this.postCompile&&this.postCompile()},SceneJS.Node.prototype._compileNodes=function(a){var b=!!this.onRendered;b&&SceneJS_nodeEventsModule.preVisitNode(this);for(var c,d=0,e=this.nodes.length;e>d;d++)c=this.nodes[d],c.branchDirty=c.branchDirty||this.branchDirty,(c.dirty||c.branchDirty||this._engine.sceneDirty)&&(c.disabled?c._compileNodes(a):c._compile(a),c.dirty=!1,c.branchDirty=!1);b&&SceneJS_nodeEventsModule.postVisitNode(this)},SceneJS.Node.prototype.destroy=function(){if(!this.destroyed){if(this.parent)for(var a=this.parent.nodes,b=a.length,c=0;b>c;c++)if(a[c].id===this.id){a.splice(c,1);break}this._engine.scene.unpublish("nodes/"+this.id),this._destroyTree(),this._engine.display.objectListDirty=!0}return this},SceneJS.Node.prototype._destroyTree=function(){this.destroyed=!0,this._engine.destroyNode(this);for(var a,b=0,c=this.nodes.length;c>b;b++)a=this.nodes[b],this._engine.scene.unpublish("nodes/"+a.id),a._destroyTree()},SceneJS.Node.prototype._doDestroy=function(){return this._destroy&&this._destroy(),this},SceneJS_PubSubProxy=function(a,b){this.scene=a,this.proxy=b};var SceneJS_NodeFactory=function(){this.nodes=new SceneJS_Map({})};SceneJS_NodeFactory.nodeTypes={},SceneJS_NodeFactory._subs={},SceneJS_NodeFactory.createNodeType=function(a,b){if(SceneJS_NodeFactory.nodeTypes[a])throw"Node type already defined: "+a;var c=function(){SceneJS.Node.apply(this,arguments),this.type=a};c.prototype=new SceneJS.Node,c.prototype.constructor=c,SceneJS_NodeFactory.nodeTypes[a]=c;var d=SceneJS_NodeFactory.nodeTypes[a];if(!d)throw"Node type plugin did not install itself correctly";b&&b(c);var e=SceneJS_NodeFactory._subs[a];if(e){for(;e.length>0;)e.pop()(d);delete e[a]}return c},SceneJS_NodeFactory.prototype.getNode=function(a,b,c,d){b.type=b.type||"node";var e;if(e="node"==b.type?SceneJS.Node:SceneJS_NodeFactory.nodeTypes[b.type])return this._createNode(e,a,b,c,d);var f=this;this._getType(a,b.type,function(e){f._createNode(e,a,b,c,d)})},SceneJS_NodeFactory.prototype._createNode=function(a,b,c,d,e){var f=new a,g=c.id||c.nodeId;return g?this.nodes.addItem(g,f):g=this.nodes.addItem(f),f._construct(b,d,c,g),e&&e(f),f},SceneJS_NodeFactory.prototype._getType=function(a,b,c){var d=SceneJS_NodeFactory.nodeTypes[b];if(d)return void c(d);var e=SceneJS_NodeFactory._subs[b]||(SceneJS_NodeFactory._subs[b]=[]);if(e.push(c),!(e.length>1)){var f=SceneJS_sceneStatusModule.taskStarted(a.scene,"Loading plugin");e.push(function(){SceneJS_sceneStatusModule.taskFinished(f)});var g=SceneJS_configsModule.configs.pluginPath;if(!g)throw"no typePath config";this._loadScript(g+"/node/"+b+".js",function(){SceneJS_sceneStatusModule.taskFailed(f)})}},SceneJS_NodeFactory.prototype._loadScript=function(a,b){var c=document.createElement("script");c.type="text/javascript",c.src=a,c.onerror=b,document.getElementsByTagName("head")[0].appendChild(c)},SceneJS_NodeFactory.prototype.putNode=function(a){this.nodes.removeItem(a.id)},function(){function a(a){var b=a.optics;if(a.matrix=mat4.create(),"ortho"==b.type)mat4.ortho(a.matrix,b.left,b.right,b.bottom,b.top,b.near,b.far);else if("frustum"==b.type)mat4.frustum(a.matrix,b.left,b.right,b.bottom,b.top,b.near,b.far);else if("perspective"==b.type){var c=b.fov,d=b.fovAxis;("x"==d||"min"==d&&b.aspect<1||"max"==d&&b.aspect>1)&&(c/=b.aspect),c=Math.min(c,120),mat4.perspective(a.matrix,c*Math.PI/180,b.aspect,b.near,b.far)}if(a.pan){var e=a.pan,f=mat4.fromTranslation(mat4.create(),[e.x||0,e.y||0,e.z||0]);mat4.multiply(a.matrix,f,a.matrix)}a.mat?a.mat.set(a.matrix):a.mat=new Float32Array(a.matrix)}var b=mat4.perspective(mat4.create(),45,1,.1,1e4),c=new Float32Array(b),d={type:"camera",stateId:SceneJS._baseStateId++,matrix:b,mat:c,optics:{type:"perspective",fov:45,fovAxis:"y",aspect:1,near:.1,far:1e4},checkAspect:function(b,c){b.optics.aspect!=c&&(b.optics.aspect=c,a(this))}},e=[],f=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){a.engine.display.projTransform=d,f=0}),SceneJS.Camera=SceneJS_NodeFactory.createNodeType("camera"),SceneJS.Camera.prototype._init=function(b){if(1==this._core.useCount){b.optics=b.optics||{};var c=this.getScene().getCanvas();b.optics.aspect=c.width/c.height,this.setOptics(b.optics),b.pan&&this.setPan(b.pan);var d=this;this._canvasSizeSub=this.getScene().on("canvasSize",function(b){d._core.optics.aspect=b.aspect,a(d._core),d._engine.display.imageDirty=!0})}},SceneJS.Camera.getDefaultMatrix=function(){return c},SceneJS.Camera.prototype.setOptics=function(b){var c=this._core;if(b){var d=b.type;if(d||c.optics&&(d=c.optics.type),d=d||"perspective","ortho"==d)c.optics=SceneJS._applyIf(SceneJS_math_ORTHO_OBJ,{type:d,left:b.left,bottom:b.bottom,near:b.near,right:b.right,top:b.top,far:b.far});else if("frustum"==d)c.optics={type:d,left:b.left||-1,bottom:b.bottom||-1,near:b.near||.1,right:b.right||1,top:b.top||1,far:b.far||1e4};else{if("perspective"!=d)throw b.type?SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.Camera configuration invalid: optics type not supported - supported types are 'perspective', 'frustum' and 'ortho'"):SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.Camera configuration invalid: optics type not specified - supported types are 'perspective', 'frustum' and 'ortho'");void 0!=b.fovy&&(b.fov=b.fovy,b.fovAxis="y"),c.optics={type:d,fov:b.fov||60,fovAxis:b.fovAxis||"y",aspect:void 0==b.aspect?1:b.aspect,near:b.near||.1,far:b.far||1e4}}}else c.optics={type:"perspective",fov:60,fovAxis:"y",aspect:1,near:.1,far:1e4};this._core.optics.pan=b.pan,a(this._core),this.onMatrix&&this.onMatrix(this._core.matrix),this._engine.display.imageDirty=!0},SceneJS.Camera.prototype.setPan=function(b){this._core.pan=b,a(this._core),this.onMatrix&&this.onMatrix(this._core.matrix),this._engine.display.imageDirty=!0},SceneJS.Camera.prototype.getOptics=function(){var a={};for(var b in this._core.optics)this._core.optics.hasOwnProperty(b)&&(a[b]=this._core.optics[b]);return a},SceneJS.Camera.prototype.getMatrix=function(){return SceneJS._sliceArray(this._core.matrix,0)},SceneJS.Camera.prototype.setMatrix=function(a){var b=this._core;b.matrix.set(a);var c=b.pan,d=mat4.fromTranslation(mat4.create(),[c.x||0,c.y||0,c.z||0]);mat4.multiply(b.matrix,d,b.matrix),b.mat.set(b.matrix),this.publish("matrix",b.matrix),this._engine.display.imageDirty=!0},SceneJS.Camera.prototype._compile=function(a){this._engine.display.projTransform=e[f++]=this._core,this._compileNodes(a),this._engine.display.projTransform=--f>0?e[f-1]:d,e[f]=null},SceneJS.Camera.prototype._destroy=function(){this.getScene().off(this._canvasSizeSub)}}(),function(){var a={type:"clips",stateId:SceneJS._baseStateId++,empty:!0,hash:"",clips:[]},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.clips=a,c=0}),SceneJS.Clips=SceneJS_NodeFactory.createNodeType("clips"),SceneJS.Clips.prototype._init=function(a){if(1==this._core.useCount){var b=a.clips;if(!b)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"clips node attribute missing : 'clips'");this._core.clips=this._core.clips||[];for(var c=0,d=b.length;d>c;c++)this._setClip(c,b[c])}},SceneJS.Clips.prototype.setClips=function(a){var b;for(var c in a)if(a.hasOwnProperty(c)&&(void 0!=c||null!=c)){if(b=parseInt(c),0>b||b>=this._core.clips.length)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Invalid argument to set 'clips': index out of range ("+this._core.clips.length+" clips defined)");this._setClip(b,a[c]||{})}this._engine.display.imageDirty=!0},SceneJS.Clips.prototype._setClip=function(a,b){var c=this._core.clips[a]||(this._core.clips[a]={});c.normalAndDist=[b.x||0,b.y||0,b.z||0,b.dist||0];var d=b.mode||c.mode||"disabled";if("inside"!=d&&"outside"!=d&&"disabled"!=d)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"clips node invalid value for property 'mode': should be 'inside' or 'outside' or 'disabled'");c.mode=d,this._core.hash=null},SceneJS.Clips.prototype._compile=function(d){this._core.hash||(this._core.hash=this._core.clips.length),this._engine.display.clips=b[c++]=this._core,this._compileNodes(d),this._engine.display.clips=--c>0?b[c-1]:a,b[c]=null}}(),function(){function a(a){return(a.getFlag(b.REFLECTIVE)?"refl":"")+";"+(a.getFlag(b.SKYBOX)?"s":"")+";"+(a.getFlag(b.SOLID)?"sky":"")+";"+(a.getFlag(b.XRAY_ENABLED)?"xray":"")+";"+(a.getFlag(b.ROUND_POINTS)?"rp":"")+";"+(a.getFlag(b.BILLBOARD)?"b":"")+";"}var b=SceneJS.PROPERTY_FLAGS,c=new SceneJS_PropertiesCore;c.stateId=SceneJS._baseStateId++;var d=[],e=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){a.engine.display.properties=c,e=0}),SceneJS.Properties=SceneJS_NodeFactory.createNodeType("properties"),SceneJS.Properties.prototype._init=function(a){1==this._core.useCount&&a.properties&&this.setProperties(a.properties)},SceneJS.Properties.prototype.setProperties=function(d){var e=this._core;if(void 0!=d.picking&&(e.setFlag(b.PICKING,d.picking),this._engine.display.drawListDirty=!0),void 0!=d.clipping&&(e.setFlag(b.CLIPPING,d.clipping),this._engine.display.imageDirty=!0),void 0!=d.enabled&&(e.setFlag(b.ENABLED,d.enabled),this._engine.display.drawListDirty=!0),void 0!=d.backfaces&&(e.setFlag(b.BACKFACES,d.backfaces),this._engine.display.imageDirty=!0),void 0!=d.frontface&&(e.setFlag(b.CCW,"ccw"===d.frontface),this._engine.display.imageDirty=!0),void 0!=d.reflective&&(e.setFlag(b.REFLECTIVE,d.reflective),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),void 0!=d.solid&&(e.setFlag(b.SOLID,d.solid),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),void 0!=d.skybox&&(e.setFlag(b.SKYBOX,d.skybox),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),void 0!=d.billboard&&(e.setFlag(b.BILLBOARD,d.billboard),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),void 0!=d.xray){var f=e.transparent;e.setFlag(b.XRAY,d.xray),e.resetTransparency(),e.transparent!==f&&(this._engine.display.stateOrderDirty=!0,this._engine.display.imageDirty=!0)}if(void 0!=d.highlight&&(e.setFlag(b.HIGHLIGHT,d.highlight),this._engine.display.imageDirty=!0),void 0!=d.desaturate&&(e.setFlag(b.DESATURATE,d.desaturate),this._engine.display.imageDirty=!0),void 0!=d.xrayEnabled){var f=e.transparent;e.setFlag(b.XRAY_ENABLED,d.xrayEnabled),e.resetTransparency(),this._engine.branchDirty(this),e.transparent!==f&&(this._engine.display.stateOrderDirty=!0,this._engine.display.imageDirty=!0)}if(void 0!=d.solidColor){var g=c.solidColor,h=d.solidColor;e.solidColor=h?new Float32Array([void 0!=h.r&&null!=h.r?h.r:g[0],void 0!=h.g&&null!=h.g?h.g:g[1],void 0!=h.b&&null!=h.b?h.b:g[2]]):c.solidColor,this._engine.display.imageDirty=!0}if(void 0!=d.name&&(e.name=d.name),void 0!=d.layer&&(e.layer=d.layer,this._engine.display.stateOrderDirty=!0),void 0!=d.glassFactor&&(e.glassFactor=d.glassFactor,e.getFlag(b.XRAY_ENABLED)&&(this._engine.display.imageDirty=!0)),void 0!=d.murkiness&&(e.murkiness=d.murkiness,e.getFlag(b.XRAY_ENABLED)&&(this._engine.display.imageDirty=!0)),void 0!=d.opacity){var f=e.transparent;e.opacity=d.opacity,e.resetTransparency(),e.transparent!==f&&(this._engine.display.stateOrderDirty=!0),this._engine.display.imageDirty=!0}return void 0!=d.depthMask&&(e.setFlag(b.DEPTH_MASK,d.depthMask),this._engine.display.imageDirty=!0),void 0!=d.roundPoints&&(e.setFlag(b.ROUND_POINTS,d.roundPoints),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),e.hash=a(e),this},SceneJS.Properties.prototype.getProperties=function(){var a=this._core;return{picking:a.getFlag(b.PICKING),clipping:a.getFlag(b.CLIPPING),enabled:a.getFlag(b.ENABLED),backfaces:a.getFlag(b.BACKFACES),frontface:a.getFlag(b.CCW)?"ccw":"cw",reflective:a.getFlag(b.REFLECTIVE),solid:a.getFlag(b.SOLID),solidColor:a.solidColor,xrayEnabled:a.getFlag(b.XRAY_ENABLED),xray:a.getFlag(b.XRAY),highlight:a.getFlag(b.HIGHLIGHT),desaturate:a.getFlag(b.DESATURATE),skybox:a.getFlag(b.SKYBOX),billboard:a.getFlag(b.BILLBOARD),depthMask:a.getFlag(b.DEPTH_MASK),glassFactor:a.glassFactor,murkiness:a.murkiness,opacity:a.opacity,roundPoints:a.roundPoints}},SceneJS.Properties.prototype.setPicking=function(a){return a=!!a,this._core.getFlag(b.PICKING)!==a&&(this._core.setFlag(b.PICKING,a),this._engine.display.drawListDirty=!0),this},SceneJS.Properties.prototype.getPicking=function(){return this._core.getFlag(b.PICKING)},SceneJS.Properties.prototype.setClipping=function(a){return a=!!a,this._core.getFlag(b.CLIPPING)!==a&&(this._core.setFlag(b.CLIPPING,a),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getClipping=function(){return this._core.getFlag(b.CLIPPING)},SceneJS.Properties.prototype.setEnabled=function(a){return a=!!a,this._core.getFlag(b.ENABLED)!==a&&(this._core.setFlag(b.ENABLED,a),this._engine.display.drawListDirty=!0),this},SceneJS.Properties.prototype.getEnabled=function(){
  return this._core.getFlag(b.ENABLED)},SceneJS.Properties.prototype.setBackfaces=function(a){return a=!!a,this._core.getFlag(b.BACKFACES)!==a&&(this._core.setFlag(b.BACKFACES,a),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getBackfaces=function(){return this._core.getFlag(b.BACKFACES)},SceneJS.Properties.prototype.setFrontface=function(a){var c="ccw"===a;return this._core.getFlag(b.CCW)!==c&&(this._core.setFlag(b.CCW,c),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getFrontface=function(){return this._core.getFlag(b.CCW)?"ccw":"cw"},SceneJS.Properties.prototype.setReflective=function(c){return c=!!c,this._core.getFlag(b.REFLECTIVE)!=c&&(this._core.setFlag(b.REFLECTIVE,c),this._core.hash=a(this._core),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getReflective=function(){return this._core.getFlag(b.REFLECTIVE)},SceneJS.Properties.prototype.setSolid=function(c){return c=!!c,this._core.getFlag(b.SOLID)!=c&&(this._core.setFlag(b.SOLID,c),this._core.hash=a(this._core),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getSolid=function(){return this._core.getFlag(b.SOLID)},SceneJS.Properties.prototype.setSolidColor=function(a){var b=c.solidColor;return this._core.solidColor=a?new Float32Array([void 0!=a.r&&null!=a.r?a.r:b[0],void 0!=a.g&&null!=a.g?a.g:b[1],void 0!=a.b&&null!=a.b?a.b:b[2]]):c.solidColor,this._engine.display.imageDirty=!0,this},SceneJS.Properties.prototype.getSolidColor=function(){return{r:this._core.solidColor[0],g:this._core.solidColor[1],b:this._core.solidColor[2]}},SceneJS.Properties.prototype.setSkybox=function(c){return c=!!c,this._core.getFlag(b.SKYBOX)!=c&&(this._core.setFlag(b.SKYBOX,c),this._core.hash=a(this._core),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getSkybox=function(){return this._core.getFlag(b.SKYBOX)},SceneJS.Properties.prototype.setName=function(a){this._core.name=a},SceneJS.Properties.prototype.getName=function(){return this._core.name},SceneJS.Properties.prototype.setLayer=function(a){this._core.layer!=a&&(this._core.layer=a,this._engine.display.stateOrderDirty=!0)},SceneJS.Properties.prototype.getLayer=function(){return this._core.layer},SceneJS.Properties.prototype.setDepthMask=function(a){return a=!!a,this._core.getFlag(b.DEPTH_MASK)!==a&&(this._core.setFlag(b.DEPTH_MASK,a),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getDepthMask=function(){return this._core.getFlag(b.DEPTH_MASK)},SceneJS.Properties.prototype.setRoundPoints=function(c){return c=!!c,this._core.getFlag(b.ROUND_POINTS)!=c&&(this._core.setFlag(b.ROUND_POINTS,c),this._core.hash=a(this._core),this._engine.branchDirty(this),this._engine.display.imageDirty=!0),this},SceneJS.Properties.prototype.getRoundPoints=function(){return this._core.getFlag(b.ROUND_POINTS)},SceneJS.Properties.prototype._compile=function(a){this._engine.display.properties=d[e++]=this._core,this._compileNodes(a),this._engine.display.properties=--e>0?d[e-1]:c,d[e]=null}}(),new function(){var a={type:"renderTarget",stateId:SceneJS._baseStateId++,targets:null},b={},c=[],d=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.renderTarget=a,d=0}),SceneJS_events.addListener(SceneJS_events.WEBGL_CONTEXT_RESTORED,function(){for(var a in b)b.hasOwnProperty(a)&&b[a]._core.renderBuf.webglRestored()}),SceneJS.ColorTarget=SceneJS_NodeFactory.createNodeType("colorTarget"),SceneJS.ColorTarget.prototype._init=function(){b[this._core.coreId]=this,this._core.bufType="color",this._core.renderBuf=new SceneJS._webgl.RenderBuffer({canvas:this._engine.canvas})},SceneJS.ColorTarget.prototype._compile=function(b){this.__core||(this.__core=this._engine._coreFactory.getCore("renderTarget"));var e=this._engine.display.renderTarget;this._core.empty||(this.__core.targets=e&&e.targets?e.targets.concat([this._core]):[this._core]),c[d++]=this.__core,this._engine.display.renderTarget=this.__core,this._compileNodes(b),this._engine.display.renderTarget=--d>0?c[d-1]:a,c[d]=null},SceneJS.ColorTarget.prototype._destroy=function(){this._core&&(this._core.renderBuf&&this._core.renderBuf.destroy(),delete b[this._core.coreId])}},new function(){var a={type:"renderTarget",stateId:SceneJS._baseStateId++,targets:null},b={},c=[],d=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.renderTarget=a,d=0}),SceneJS_events.addListener(SceneJS_events.WEBGL_CONTEXT_RESTORED,function(){for(var a in b)b.hasOwnProperty(a)&&b[a]._buildNodeCore()}),SceneJS.DepthTarget=SceneJS_NodeFactory.createNodeType("depthTarget"),SceneJS.DepthTarget.prototype._init=function(){b[this._core.coreId]=this,this._core.bufType="depth",this._core.renderBuf=new SceneJS._webgl.RenderBuffer({canvas:this._engine.canvas})},SceneJS.DepthTarget.prototype._compile=function(b){this.__core||(this.__core=this._engine._coreFactory.getCore("renderTarget"));var e=this._engine.display.renderTarget;this._core.empty||(this.__core.targets=e&&e.targets?e.targets.concat([this._core]):[this._core]),c[d++]=this.__core,this._engine.display.renderTarget=this.__core,this._compileNodes(b),this._engine.display.renderTarget=--d>0?c[d-1]:a,c[d]=null},SceneJS.DepthTarget.prototype._destroy=function(){this._core&&(this._core.renderBuf&&this._core.renderBuf.destroy(),delete b[this._core.coreId])}},new function(){function a(a){return function(){a._core.tangentBufs=null,a._core.pickPositionsBuf=null,a._core.arrays.tangents&&(a._core.arrays.tangents=[]),a._buildNodeCore(a._engine.canvas.gl,a._core)}}function b(a,b){var c=a.STATIC_DRAW,d=b.arrays,e=b.compressedPositions||b.compressedNormals||b.compressedUVs,f=!e&&SceneJS.getConfigs("enableInterleaving")!==!1,g=0,h=0,i=[],j=[],k=function(a,b){return 0==g?g=a.length/b:a.length/b!=g&&(f=!1),i.push(a),j.push(b),h+=b,4*(h-b)};if(d.positions&&(f&&(b.interleavedPositionOffset=k(d.positions,3)),b.vertexBuf=new SceneJS._webgl.ArrayBuffer(a,a.ARRAY_BUFFER,d.positions,d.positions.length,3,c)),b.compressedNormals?b.normalBuf=new SceneJS._webgl.ArrayBuffer(a,a.ARRAY_BUFFER,d.normals,d.normals.length,2,c,!0):d.normals&&(f&&(b.interleavedNormalOffset=k(d.normals,3)),b.normalBuf=new SceneJS._webgl.ArrayBuffer(a,a.ARRAY_BUFFER,d.normals,d.normals.length,3,c)),d.uvs){var l,m,n,o,p=d.uvs;if(f)for(b.interleavedUVOffsets=[],l=b.interleavedUVOffsets,m=0,n=p.length;n>m;m++)l.push(k(d.uvs[m],2));for(b.uvBufs=[],m=0,n=p.length;n>m;m++)o=d.uvs[m],o.length>0&&b.uvBufs.push(new SceneJS._webgl.ArrayBuffer(a,a.ARRAY_BUFFER,o,o.length,2,c))}if(d.colors&&(f&&(b.interleavedColorOffset=k(d.colors,4)),b.colorBuf=new SceneJS._webgl.ArrayBuffer(a,a.ARRAY_BUFFER,d.colors,d.colors.length,4,c)),d.indices&&(b.indexBuf=new SceneJS._webgl.ArrayBuffer(a,a.ELEMENT_ARRAY_BUFFER,d.indices,d.indices.length,1,c)),h>0&&f){for(var q=[],r=i.length,m=0;g>m;++m)for(var s=0;r>s;++s)for(var t=j[s],u=0;t>u;++u)q.push(i[s][m*t+u]);b.interleavedStride=4*h,b.interleavedBuf=new SceneJS._webgl.ArrayBuffer(a,a.ARRAY_BUFFER,new Float32Array(q),q.length,h,c),b.interleavedBuf.dirty=!1}}var c=[],d=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(){d=0}),SceneJS.Geometry=SceneJS_NodeFactory.createNodeType("geometry"),SceneJS.Geometry.prototype._init=function(b){1==this._core.useCount&&(this._initNodeCore(b,{origin:b.origin,scale:b.scale,autoNormals:"auto"==b.normals}),this._buildNodeCore(this._engine.canvas.gl,this._core),this._core.webglRestored=a(this),this._engine.stats.geometry.meshes++)},SceneJS.Geometry.prototype._initNodeCore=function(a,b){b=b||{};var c=a.primitive||"triangles",d=this._core,e=SceneJS.WEBGL_INFO.SUPPORTED_EXTENSIONS.OES_element_index_uint?Uint32Array:Uint16Array;d._engine=this._engine,d.primitive=this._getPrimitiveType(c),d.primitiveName=c,d.pointSize=a.pointSize||1,d.compressedPositions=!1,d.compressedNormals=!1,d.compressedUVs=!1,a.normals&&"triangles"==c&&("auto"===a.normals||a.normals===!0)&&a.positions&&a.indices&&this._buildNormals(a),d.arrays={},a.positions&&(a.positionDecodeMat?(d.arrays.positions=a.positions,d.positionDecodeMat=a.positionDecodeMat,d.compressedPositions=!0):(a.positions.constructor!=Float32Array&&(a.positions=new Float32Array(a.positions)),(b.scale||b.origin)&&this._applyOptions(a.positions,b),d.arrays.positions=a.positions),this._engine.stats.geometry.vertices+=a.positions.length/3,this._engine.stats.memory.positions+=a.positions.length*a.positions.constructor.BYTES_PER_ELEMENT),a.normals&&(a.normals.constructor==Int8Array?(d.arrays.normals=a.normals,d.compressedNormals=!0):(a.normals.constructor!=Float32Array&&(a.normals=new Float32Array(a.normals)),d.arrays.normals=a.normals),this._engine.stats.memory.normals+=a.normals.length*a.normals.constructor.BYTES_PER_ELEMENT);var f,g;if(a.uvDecodeMats){f=a.uvs;for(var h=0,i=f.length;i>h;h++)g=f[h],g.constructor!=Uint16Array&&(f[h]=new Uint16Array(f[h])),this._engine.stats.memory.uvs+=g.length*g.constructor.BYTES_PER_ELEMENT;d.arrays.uvs=f,d.uvDecodeMats=a.uvDecodeMats,d.compressedUVs=!0}else if(a.uvs){f=a.uvs;for(var h=0,i=f.length;i>h;h++)g=f[h],g.constructor!=Float32Array&&(f[h]=new Float32Array(f[h])),this._engine.stats.memory.uvs+=g.length*g.constructor.BYTES_PER_ELEMENT;d.arrays.uvs=f}a.uv&&(a.uv.constructor!=Float32Array&&(a.uv=new Float32Array(a.uv)),d.arrays.uvs||(d.arrays.uvs=[]),d.arrays.uvs[0]=a.uv,this._engine.stats.memory.uvs+=a.uv.length*a.uv.constructor.BYTES_PER_ELEMENT),a.uv1&&(a.uv1.constructor!=Float32Array&&(a.uv1=new Float32Array(a.uv1)),d.arrays.uvs||(d.arrays.uvs=[]),d.arrays.uvs[1]=a.uv1,this._engine.stats.memory.uvs+=a.uv1.length*a.uv1.constructor.BYTES_PER_ELEMENT),a.uv2&&(a.uv2.constructor!=Float32Array&&(a.uv2=new Float32Array(a.uv2)),d.arrays.uvs||(d.arrays.uvs=[]),d.arrays.uvs[2]=a.uv2,this._engine.stats.memory.uvs+=a.uv2.length*a.uv2.constructor.BYTES_PER_ELEMENT),a.uv3&&(a.uv3.constructor!=Float32Array&&(a.uv3=new Float32Array(a.uv3)),d.arrays.uvs||(d.arrays.uvs=[]),d.arrays.uvs[3]=a.uv3,this._engine.stats.memory.uvs+=a.uv3.length*a.uv3.constructor.BYTES_PER_ELEMENT),d.arrays.normals&&d.arrays.uvs&&(d.arrays.tangents=[]),a.colors&&(a.colors.constructor!=Float32Array&&(a.colors=new Float32Array(a.colors)),d.arrays.colors=a.colors,this._engine.stats.memory.colors+=a.colors.length*a.colors.constructor.BYTES_PER_ELEMENT),a.indices&&(a.indices.constructor!=Uint8Array&&a.indices.constructor!=Uint16Array&&a.indices.constructor!=Uint32Array&&(a.indices=new e(a.indices)),d.arrays.indices=a.indices,this._engine.stats.geometry.triangles+=a.indices.length/3,this._engine.stats.memory.indices+=a.indices.length*a.indices.constructor.BYTES_PER_ELEMENT)},SceneJS.Geometry.prototype._getPrimitiveType=function(a){var b=this._engine.canvas.gl;switch(a){case"points":return b.POINTS;case"lines":return b.LINES;case"line-loop":return b.LINE_LOOP;case"line-strip":return b.LINE_STRIP;case"triangles":return b.TRIANGLES;case"triangle-strip":return b.TRIANGLE_STRIP;case"triangle-fan":return b.TRIANGLE_FAN;default:throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"geometry primitive unsupported: '"+a+"' - supported types are: 'points', 'lines', 'line-loop', 'line-strip', 'triangles', 'triangle-strip' and 'triangle-fan'")}},SceneJS.Geometry.prototype._applyOptions=function(a,b){if(b.scale)for(var c=void 0!=b.scale.x?b.scale.x:1,d=void 0!=b.scale.y?b.scale.y:1,e=void 0!=b.scale.z?b.scale.z:1,f=0,g=a.length;g>f;f+=3)a[f]*=c,a[f+1]*=d,a[f+2]*=e;if(b.origin)for(var h=void 0!=b.origin.x?b.origin.x:0,i=void 0!=b.origin.y?b.origin.y:0,j=void 0!=b.origin.z?b.origin.z:0,f=0,g=a.length;g>f;f+=3)a[f]-=h,a[f+1]-=i,a[f+2]-=j;return a};var e=function(a){if(a.vertexBuf&&(a.vertexBuf.destroy(),a.vertexBuf=null),a.normalBuf&&(a.normalBuf.destroy(),a.normalBuf=null),a.uvBufs){for(var b,c=a.uvBufs,d=0,e=c.length;e>d;d++)b=c[d],b&&b.destroy();a.uvBufs=null}if(a.colorBuf&&(a.colorBuf.destroy(),a.colorBuf=null),a.tangentBufs){for(var f,g=a.tangentBufs,h=0,i=g.length;i>h;h++)f=g[h],f&&f.destroy();a.tangentBufs=null}a.indexBuf&&(a.indexBuf.destroy(),a.indexBuf=null),a.interleavedBuf&&(a.interleavedBuf.destroy(),a.interleavedBuf=null)};SceneJS.Geometry.prototype._buildNodeCore=function(a,c){try{b(a,c)}catch(d){throw e(c),SceneJS_error.fatalError(SceneJS.errors.ERROR,"Failed to allocate geometry: "+d)}},SceneJS.Geometry.prototype._updateArray=function(a,b,c){var d=a.length,e=b.length;e+c>d&&(e-=e+c-d);for(var f=c,g=0;e>g;f++,g++)a[f]=b[g]},SceneJS.Geometry.prototype._buildNormals=function(a){for(var b,c,d,e,f,g,h=a.positions,i=a.indices,j=new Array(h.length/3),k=0,l=i.length-3;l>k;k+=3){b=i[k+0],c=i[k+1],d=i[k+2],e=[h[3*b+0],h[3*b+1],h[3*b+2]],f=[h[3*c+0],h[3*c+1],h[3*c+2]],g=[h[3*d+0],h[3*d+1],h[3*d+2]],f=vec4.subtract(vec4.create(),f,e),g=vec4.subtract(vec4.create(),g,e);var m=vec4.normalize(vec4.create(),SceneJS_math_cross3Vec4(f,g,[0,0,0,0]));j[b]||(j[b]=[]),j[c]||(j[c]=[]),j[d]||(j[d]=[]),j[b].push(m),j[c].push(m),j[d].push(m)}for(var n=new Float32Array(h.length),k=0,l=j.length;l>k;k++){var o=j[k];if(o){for(var p=o.length,q=0,r=0,s=0,t=0;p>t;t++)q+=o[t][0],r+=o[t][1],s+=o[t][2];n[3*k+0]=q/p,n[3*k+1]=r/p,n[3*k+2]=s/p}}a.normals=n,this._engine.stats.memory.normals+=n.length/3},SceneJS.Geometry.prototype.setSource=function(a){this._sourceConfigs=a;var b=this._source;b&&b.configure&&b.configure(a)},SceneJS.Geometry.prototype.getSource=function(){return this._sourceConfigs||{}},SceneJS.Geometry.prototype.setPositions=function(a,b){if(a&&this._core.vertexBuf){this._boundary=null;var c=this._core;c.vertexBuf.bind(),b=b||0,c.vertexBuf.setData(a,b),c.arrays.positions.set(a,b),this._engine.display.imageDirty=!0,c.interleavedBuf&&(c.interleavedBuf.dirty=!0)}},SceneJS.Geometry.prototype.getPositions=function(){return this._core.arrays?this._core.arrays.positions:null},SceneJS.Geometry.prototype.setNormals=function(a,b){if(a&&this._core.normalBuf){var c=this._core;c.normalBuf.bind(),b=b||0,c.normalBuf.setData(a,b),c.arrays.normals.set(a,b),this._engine.display.imageDirty=!0,c.interleavedBuf&&(c.interleavedBuf.dirty=!0)}},SceneJS.Geometry.prototype.getNormals=function(){return this._core.arrays?this._core.arrays.normals:null},SceneJS.Geometry.prototype.setColors=function(a,b){if(a&&this._core.colorBuf){var c=this._core;c.colorBuf.bind(),b=b||0,c.colorBuf.setData(a,b),c.arrays.colors.set(a,b),this._engine.display.imageDirty=!0,c.interleavedBuf&&(c.interleavedBuf.dirty=!0)}},SceneJS.Geometry.prototype.getColors=function(){return this._core.arrays?this._core.arrays.colors:null},SceneJS.Geometry.prototype.setIndices=function(a,b){if(a&&this._core.indexBuf){this._boundary=null;var c=this._core;c.indexBuf.bind(),a.constructor!=c.arrays.indices.constructor&&(a=new c.arrays.indices.constructor(a)),b=b||0,c.indexBuf.setData(a,b),c.arrays.indices.set(a,b),this._engine.display.imageDirty=!0}},SceneJS.Geometry.prototype.getIndices=function(){return this._core.arrays?this._core.arrays.indices:null},SceneJS.Geometry.prototype.getUV=function(){return this._core.arrays?this._core.arrays.uvs[0]:null},SceneJS.Geometry.prototype.getUV2=function(){return this._core.arrays?this._core.arrays.uvs[1]:null},SceneJS.Geometry.prototype.getUV2=function(){return this._core.arrays?this._core.arrays.uvs[2]:null},SceneJS.Geometry.prototype.getUv3=function(){return this._core.arrays?this._core.arrays.uvs[3]:null},SceneJS.Geometry.prototype.getPrimitive=function(){return this.primitive},SceneJS.Geometry.prototype.getPointSize=function(){return this._core.pointSize},SceneJS.Geometry.prototype.setPointSize=function(a){a&&this._core.pointSize!==a&&(this._core.pointSize=a,this._engine.display.imageDirty=!0)},SceneJS.Geometry.prototype.getBoundary=function(){if(this._boundary)return this._boundary;var a=this._core.arrays;if(!a)return null;var b=a.positions;if(!b)return null;this._boundary={xmin:Number.POSITIVE_INFINITY,ymin:Number.POSITIVE_INFINITY,zmin:Number.POSITIVE_INFINITY,xmax:Number.NEGATIVE_INFINITY,ymax:Number.NEGATIVE_INFINITY,zmax:Number.NEGATIVE_INFINITY};for(var c,d,e,f=0,g=b.length-2;g>f;f+=3)c=b[f],d=b[f+1],e=b[f+2],c<this._boundary.xmin&&(this._boundary.xmin=c),d<this._boundary.ymin&&(this._boundary.ymin=d),e<this._boundary.zmin&&(this._boundary.zmin=e),c>this._boundary.xmax&&(this._boundary.xmax=c),d>this._boundary.ymax&&(this._boundary.ymax=d),e>this._boundary.zmax&&(this._boundary.zmax=e);return this._boundary},SceneJS.Geometry.prototype._compile=function(a){if(this._core._loading)return void this._compileNodes(a);var b=this._core;if(b.vertexBuf||(b=this._inheritVBOs(b)),b.indexBuf||"points"===b.primitiveName){var e=[b.normalBuf?"t":"f",b.arrays&&b.arrays.tangents?"t":"f",b.colorBuf?"t":"f",b.primitive,b.compressedPositions?"t":"f",b.compressedNormals?"t":"f",b.compressedUVs?"t":"f"];e.push(";uvs");var f=b.uvBufs;if(f)for(var g=0,h=f.length;h>g;g++)e.push(f[g]?"t":"f");b.hash=e.join(""),b.stateId=this._core.stateId,b.type="geometry",this._engine.display.geometry=c[d++]=b,SceneJS_events.fireEvent(SceneJS_events.OBJECT_COMPILING,{display:this._engine.display}),this._engine.display.buildObject(this.id)}else c[d++]=this._core;this._compileNodes(a),d--,c[d]=null},SceneJS.Geometry.prototype._inheritVBOs=function(a){for(var b={_engine:a._engine,arrays:a.arrays,primitive:a.primitive,primitiveName:a.primitiveName,boundary:a.boundary,normalBuf:a.normalBuf,uvBufs:a.uvBufs,uvDecodeMats:a.uvDecodeMats,colorBuf:a.colorBuf,interleavedBuf:a.interleavedBuf,indexBuf:a.indexBuf,interleavedStride:a.interleavedStride,interleavedPositionOffset:a.interleavedPositionOffset,interleavedNormalOffset:a.interleavedNormalOffset,interleavedUVOffsets:a.interleavedUVOffsets,interleavedColorOffset:a.interleavedColorOffset,getPickIndices:a.getPickIndices,getPickPositions:a.getPickPositions,getPickColors:a.getPickColors,compressedPositions:a.compressedPositions,compressedNormals:a.compressedNormals,compressedUVs:a.compressedUVs},e=d-1;e>=0;e--)if(c[e].vertexBuf)return b.vertexBuf=c[e].vertexBuf,b.positionDecodeMat=c[e].positionDecodeMat,b.boundary=c[e].boundary,b.normalBuf=c[e].normalBuf,b.uvBufs=c[e].uvBufs,b.uvDecodeMats=c[e].uvDecodeMats,b.colorBuf=c[e].colorBuf,b.interleavedBuf=c[e].interleavedBuf,b.interleavedStride=c[e].interleavedStride,b.interleavedPositionOffset=c[e].interleavedPositionOffset,b.interleavedNormalOffset=c[e].interleavedNormalOffset,b.interleavedUVOffsets=c[e].interleavedUVOffsets,b.interleavedColorOffset=c[e].interleavedColorOffset,b.compressedPositions=c[e].compressedPositions,b.compressedNormals=c[e].compressedNormals,b.compressedUVs=c[e].compressedUVs,b;return b},SceneJS.Geometry.prototype._destroy=function(){this._engine.display.removeObject(this.id),1==this._core.useCount&&(this._destroyNodeCore(),this._source&&this._source.destroy&&this._source.destroy(),this._engine.stats.geometry.meshes--)},SceneJS.Geometry.prototype._destroyNodeCore=function(){document.getElementById(this._engine.canvas.canvasId)&&e(this._core);var a=this._core.arrays;a.positions&&(this._engine.stats.memory.positions-=a.positions.length/3),a.normals&&(this._engine.stats.memory.normals-=a.normals.length/3),a.colors&&(this._engine.stats.memory.colors-=a.colors.length/3),a.uvs&&a.uvs.length>0&&(this._engine.stats.memory.uvs-=a.uvs.length*(a.uvs[0].length/2)),a.indices&&(this._engine.stats.memory.indices-=a.indices.length)}},function(){var a={type:"stage",stateId:SceneJS._baseStateId++,priority:0,pickable:!0,enabled:!0},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.stage=a,c=0}),SceneJS.Stage=SceneJS_NodeFactory.createNodeType("stage"),SceneJS.Stage.prototype._init=function(a){1==this._core.useCount&&(this._core.priority=a.priority||0,this._core.enabled=a.enabled!==!1,this._core.pickable=!!a.pickable)},SceneJS.Stage.prototype.setPriority=function(a){a=a||0,this._core.priority!=a&&(this._core.priority=a,this._engine.display.stateOrderDirty=!0)},SceneJS.Stage.prototype.getPriority=function(){return this._core.priority},SceneJS.Stage.prototype.setEnabled=function(a){a=!!a,this._core.enabled!=a&&(this._core.enabled=a,this._engine.display.drawListDirty=!0)},SceneJS.Stage.prototype.getEnabled=function(){return this._core.enabled},SceneJS.Stage.prototype.getEnabled=function(){return this._core.enabled},SceneJS.Stage.prototype._compile=function(d){this._engine.display.stage=b[c++]=this._core,this._compileNodes(d),this._engine.display.stage=--c>0?b[c-1]:a,b[c]=null}}(),SceneJS.Library=SceneJS_NodeFactory.createNodeType("library"),SceneJS.Library.prototype._compile=function(){},function(){function a(a){if(a.lights&&a.lights.length>0){for(var b,c=a.lights,d=[],e=0,f=c.length;f>e;e++)b=c[e],d.push(b.mode),b.specular&&d.push("s"),b.diffuse&&d.push("d"),d.push("world"==b.space?"w":"v");a.hash=d.join("")}else a.hash=""}var b={type:"lights",stateId:SceneJS._baseStateId++,hash:null,empty:!1,lights:[{mode:"ambient",color:new Float32Array([.7,.7,.8]),diffuse:!0,specular:!1},{mode:"dir",color:new Float32Array([1,1,1]),diffuse:!0,specular:!0,dir:new Float32Array([-.5,-.5,-1]),space:"view"},{mode:"dir",color:new Float32Array([1,1,1]),diffuse:!1,specular:!0,dir:new Float32Array([1,-.9,-.7]),space:"view"}]};a(b);var c=[],d=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){a.engine.display.lights=b,d=0}),SceneJS.Lights=SceneJS_NodeFactory.createNodeType("lights"),SceneJS.Lights.prototype._init=function(a){if(1==this._core.useCount){var b=a.lights;if(!b)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"lights node attribute missing : 'lights'");this._core.lights=this._core.lights||[];for(var c=0,d=b.length;d>c;c++)this._initLight(c,b[c])}},SceneJS.Lights.prototype._initLight=function(a,b){var c={};this._core.lights[a]=c;var d=b.mode||"dir";if("dir"!=d&&"point"!=d&&"ambient"!=d&&"spot"!=d)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Light mode not supported - should be 'dir' or 'point' or 'spot' or 'ambient'");var e=b.pos,f=b.dir,g=b.color;c.color=new Float32Array([void 0!=g.r?g.r:1,void 0!=g.g?g.g:1,void 0!=g.b?g.b:1]),c.mode=d,c.diffuse="ambient"==d?!0:void 0!=b.diffuse?b.diffuse:!0,c.specular="ambient"==d?!1:void 0!=b.specular?b.specular:!0,c.pos=new Float32Array(b.pos?[e.x||0,e.y||0,e.z||0]:[0,0,0]),c.dir=new Float32Array(b.dir?[f.x||0,f.y||0,f.z||0]:[0,0,1]),c.innerCone=void 0!=b.innerCone?b.innerCone:.25,c.outerCone=void 0!=b.outerCone?b.outerCone:0,c.attenuation=new Float32Array([void 0!=b.constantAttenuation?b.constantAttenuation:0,b.linearAttenuation||0,b.quadraticAttenuation||0]);var h=b.space;if(h){if("view"!=h&&"world"!=h)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"lights node invalid value for property 'space': '"+h+"' - should be 'view' or 'world'")}else h="world";c.space=h,this._core.hash=null},SceneJS.Lights.prototype.setLights=function(a){var b;for(var c in a)if(a.hasOwnProperty(c)&&(void 0!=c||null!=c)){if(b=parseInt(c),0>b||b>=this._core.lights.length)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Invalid argument to set 'lights': index out of range ("+this._core.lights.length+" lights defined)");this._setLight(b,a[c]||{})}this._engine.branchDirty(this)},SceneJS.Lights.prototype._setLight=function(a,b){var c=this._core.lights[a],d=!1,e=!1;if(b.mode&&b.mode!=c.mode){var f=b.mode;if("dir"!=f&&"point"!=f&&"ambient"!=f)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Light mode not supported - should be 'dir' or 'point' or 'ambient'");c.mode=f,c.diffuse="ambient"==f?!0:void 0!=b.diffuse?b.diffuse:!0,c.specular="ambient"==f?!1:void 0!=b.specular?b.specular:!0,e=!0}if(b.color){var g=b.color;c.color=new Float32Array([void 0!=g.r?g.r:1,void 0!=g.g?g.g:1,void 0!=g.b?g.b:1]),d=!0}var h=b.pos;h&&(c.pos=new Float32Array([h.x||0,h.y||0,h.z||0]),d=!0);var i=b.dir;if(i&&(c.dir=new Float32Array([i.x||0,i.y||0,i.z||0]),d=!0),void 0!=b.innerCone&&b.innerCone!=c.innerCone&&(c.innerCone=b.innerCone,d=!0),void 0!=b.outerCone&&b.outerCone!=c.outerCone&&(c.outerCone=b.outerCone,d=!0),void 0!=b.constantAttenuation&&(c.attenuation[0]=b.constantAttenuation,d=!0),void 0!=b.linearAttenuation&&(c.attenuation[1]=b.linearAttenuation,d=!0),void 0!=b.quadraticAttenuation&&(c.attenuation[2]=b.quadraticAttenuation,d=!0),b.space&&b.space!=c.space){var j=b.space;if("view"!=j&&"world"!=j)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"lights node invalid value for property 'space': '"+j+"' - should be 'view' or 'world'");c.space=j,this._core.hash=null,e=!0}void 0!=b.specular&&b.specular!=c.specular&&(c.specular=b.specular,e=!0),void 0!=b.diffuse&&b.diffuse!=c.diffuse&&(c.diffuse=b.diffuse,e=!0),e?this._engine.branchDirty(this):d&&(this._engine.display.imageDirty=!0),this._core.hash=null},SceneJS.Lights.prototype._compile=function(e){this._core.hash||a(this._core),this._engine.display.lights=c[d++]=this._core,this._compileNodes(e),this._engine.display.lights=--d>0?c[d-1]:b,c[d]=null}}(),function(){var a=mat4.lookAt(mat4.create(),[0,0,10],[0,0,0],[0,1,0]),b=mat4.create(),c=new Float32Array(a),d={type:"lookAt",stateId:SceneJS._baseStateId++,viewMatrix:a,matrix:a,deviceMatrix:b,hasDeviceMatrix:!1,mat:c,lookAt:SceneJS_math_LOOKAT_ARRAYS},e=[],f=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){a.engine.display.viewTransform=d,f=0}),SceneJS.Lookat=SceneJS_NodeFactory.createNodeType("lookAt"),SceneJS.Lookat.prototype._init=function(a){if(this._mat=null,this._xf={type:"lookat"},1==this._core.useCount){this._core.eyeX=0,this._core.eyeY=0,this._core.eyeZ=10,this._core.lookX=0,this._core.lookY=0,this._core.lookZ=0,this._core.upX=0,this._core.upY=1,this._core.upZ=0,a.eye||a.look||a.up?(this.setEye(a.eye),this.setLook(a.look),this.setUp(a.up)):(this.setEye({x:0,y:0,z:10}),this.setLook({x:0,y:0,z:0}),this.setUp({x:0,y:1,z:0}));var b=this._core;b.matrix=mat4.create(),b.deviceMatrix=mat4.create();var c=this;this._core.rebuild=function(){b.mat||(b.viewMatrix=mat4.create(),b.mat=mat4.create()),mat4.lookAt(b.viewMatrix,[b.eyeX,b.eyeY,b.eyeZ],[b.lookX,b.lookY,b.lookZ],[b.upX,b.upY,b.upZ]),b.hasDeviceMatrix?mat4.multiply(b.matrix,b.deviceMatrix,b.viewMatrix):b.matrix.set(b.viewMatrix),b.lookAt={eye:[b.eyeX,b.eyeY,b.eyeZ],look:[b.lookX,b.lookY,b.lookZ],up:[b.upX,b.upY,b.upZ]},b.mat.set(b.matrix),c.onMatrix&&c.onMatrix(b.matrix),b.dirty=!1},this._core.dirty=!0,this._tick=this.getScene().on("tick",function(){c._core.dirty&&c._core.rebuild()})}},SceneJS.Lookat.getDefaultMatrix=function(){return c},SceneJS.Lookat.prototype.setEye=function(a){return a=a||{},void 0!=a.x&&null!=a.x&&(this._core.eyeX=a.x),void 0!=a.y&&null!=a.y&&(this._core.eyeY=a.y),void 0!=a.z&&null!=a.z&&(this._core.eyeZ=a.z),this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incEye=function(a){return a=a||{},this._core.eyeX+=void 0!=a.x&&null!=a.x?a.x:0,this._core.eyeY+=void 0!=a.y&&null!=a.y?a.y:0,this._core.eyeZ+=void 0!=a.z&&null!=a.z?a.z:0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setEyeX=function(a){return this._core.eyeX=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setEyeY=function(a){return this._core.eyeY=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setEyeZ=function(a){return this._core.eyeZ=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incEyeX=function(a){return this._core.eyeX+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incEyeY=function(a){return this._core.eyeY+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incEyeZ=function(a){return this._core.eyeZ+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.getEye=function(){return{x:this._core.eyeX,y:this._core.eyeY,z:this._core.eyeZ}},SceneJS.Lookat.prototype.setLook=function(a){return a=a||{},void 0!=a.x&&null!=a.x&&(this._core.lookX=a.x),void 0!=a.y&&null!=a.y&&(this._core.lookY=a.y),void 0!=a.z&&null!=a.z&&(this._core.lookZ=a.z),this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incLook=function(a){return a=a||{},this._core.lookX+=void 0!=a.x&&null!=a.x?a.x:0,this._core.lookY+=void 0!=a.y&&null!=a.y?a.y:0,this._core.lookZ+=void 0!=a.z&&null!=a.z?a.z:0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setLookX=function(a){return this._core.lookX=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setLookY=function(a){return this._core.lookY=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setLookZ=function(a){return this._core.lookZ=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incLookX=function(a){return this._core.lookX+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incLookY=function(a){return this._core.lookY+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incLookZ=function(a){return this._core.lookZ+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.getLook=function(){return{x:this._core.lookX,y:this._core.lookY,z:this._core.lookZ}},SceneJS.Lookat.prototype.setUp=function(a){return a=a||{},void 0!=a.x&&null!=a.x&&(this._core.upX=a.x),void 0!=a.y&&null!=a.y&&(this._core.upY=a.y),void 0!=a.z&&null!=a.z&&(this._core.upZ=a.z),this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incUp=function(a){return a=a||{},this._core.upX+=void 0!=a.x&&null!=a.x?a.x:0,this._core.upY+=void 0!=a.y&&null!=a.y?a.y:0,this._core.upZ+=void 0!=a.z&&null!=a.z?a.z:0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setUpX=function(a){return this._core.upX=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setUpY=function(a){return this._core.upY=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.setUpZ=function(a){return this._core.upZ=a||0,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incUpX=function(a){return this._core.upX+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incUpY=function(a){return this._core.upY+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.incUpZ=function(a){return this._core.upZ+=a,this._core.dirty=!0,this._engine.display.imageDirty=!0,this},SceneJS.Lookat.prototype.getUp=function(){return{x:this._core.upX,y:this._core.upY,z:this._core.upZ}},SceneJS.Lookat.prototype.getMatrix=function(){return this._core.dirty&&this._core.rebuild(),SceneJS._sliceArray(this._core.viewMatrix,0)},SceneJS.Lookat.prototype.getAttributes=function(){return{look:{x:this._core.lookX,y:this._core.lookY,z:this._core.lookZ},eye:{x:this._core.eyeX,y:this._core.eyeY,z:this._core.eyeZ},up:{x:this._core.upX,y:this._core.upY,z:this._core.upZ}}},SceneJS.Lookat.prototype.setDeviceMatrix=function(a){this._core.hasDeviceMatrix=!!a,a&&this._core.deviceMatrix.set(a),this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Lookat.prototype._compile=function(a){this._engine.display.viewTransform=e[f++]=this._core,this._compileNodes(a),this._engine.display.viewTransform=--f>0?e[f-1]:d,e[f]=null},SceneJS.Lookat.prototype._destroy=function(){this.getScene().off(this._tick)}}(),new function(){var a={type:"material",stateId:SceneJS._baseStateId++,baseColor:new Float32Array([1,1,1]),specularColor:new Float32Array([1,1,1]),emitColor:new Float32Array([1,1,1]),specular:1,shine:70,alpha:1,emit:0},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.material=a,c=0}),SceneJS.Material=SceneJS_NodeFactory.createNodeType("material"),SceneJS.Material.prototype._init=function(a){
  1==this._core.useCount&&(this.setBaseColor(a.color||a.baseColor),this.setSpecularColor(a.specularColor),this.setEmitColor(a.emitColor),this.setSpecular(a.specular),this.setShine(a.shine),this.setEmit(a.emit),this.setAlpha(a.alpha))},SceneJS.Material.prototype.setBaseColor=function(b){var c=a.baseColor;return this._core.baseColor=b?new Float32Array([void 0!=b.r&&null!=b.r?b.r:c[0],void 0!=b.g&&null!=b.g?b.g:c[1],void 0!=b.b&&null!=b.b?b.b:c[2]]):a.baseColor,this._engine.display.imageDirty=!0,this},SceneJS.Material.prototype.setColor=SceneJS.Material.prototype.setBaseColor,SceneJS.Material.prototype.getBaseColor=function(){return{r:this._core.baseColor[0],g:this._core.baseColor[1],b:this._core.baseColor[2]}},SceneJS.Material.prototype.getColor=SceneJS.Material.prototype.getBaseColor,SceneJS.Material.prototype.setSpecularColor=function(b){var c=a.specularColor;return this._core.specularColor=b?new Float32Array([void 0!=b.r&&null!=b.r?b.r:c[0],void 0!=b.g&&null!=b.g?b.g:c[1],void 0!=b.b&&null!=b.b?b.b:c[2]]):a.specularColor,this._engine.display.imageDirty=!0,this},SceneJS.Material.prototype.getSpecularColor=function(){return{r:this._core.specularColor[0],g:this._core.specularColor[1],b:this._core.specularColor[2]}},SceneJS.Material.prototype.setEmitColor=function(b){var c=a.emitColor;return this._core.emitColor=b?new Float32Array([void 0!=b.r&&null!=b.r?b.r:c[0],void 0!=b.g&&null!=b.g?b.g:c[1],void 0!=b.b&&null!=b.b?b.b:c[2]]):a.emitColor,this._engine.display.imageDirty=!0,this},SceneJS.Material.prototype.getEmitColor=function(){return{r:this._core.emitColor[0],g:this._core.emitColor[1],b:this._core.emitColor[2]}},SceneJS.Material.prototype.setSpecular=function(b){return this._core.specular=void 0!=b&&null!=b?b:a.specular,this._engine.display.imageDirty=!0,this},SceneJS.Material.prototype.getSpecular=function(){return this._core.specular},SceneJS.Material.prototype.setShine=function(b){return this._core.shine=void 0!=b&&null!=b?b:a.shine,this._engine.display.imageDirty=!0,this},SceneJS.Material.prototype.getShine=function(){return this._core.shine},SceneJS.Material.prototype.setEmit=function(b){return this._core.emit=void 0!=b&&null!=b?b:a.emit,this._engine.display.imageDirty=!0,this},SceneJS.Material.prototype.getEmit=function(){return this._core.emit},SceneJS.Material.prototype.setAlpha=function(b){var c=!!this._core.transparent;return this._core.alpha=void 0!=b&&null!=b?b:a.alpha,this._core.transparent=this._core.alpha<1,this._core.transparent!==c&&(this._engine.display.stateOrderDirty=!0),this._engine.display.imageDirty=!0,this},SceneJS.Material.prototype.getAlpha=function(){return this._core.alpha},SceneJS.Material.prototype._compile=function(d){this._engine.display.material=b[c++]=this._core,this._compileNodes(d),this._engine.display.material=--c>0?b[c-1]:a,b[c]=null}},new function(){function a(a,b){var c=b.targets||[];if(c.length<2)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"morphGeometry node should have at least two targets");var d=b.keys||[];if(d.length!=c.length)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"morphGeometry node mismatch in number of keys and targets");var e=a._core,f=a._engine.canvas.gl,g=f.STATIC_DRAW;e.keys=d,e.targets=[],e.key1=0,e.key2=1;for(var h,i,j,k,l,m=0,n=c.length;n>m;m++)l=c[m],!h&&l.positions&&(h=l.positions),!i&&l.normals&&(i=l.normals),!j&&l.uv&&(j=l.uv),!k&&l.uv2&&(k=l.uv2);for(var o,p,m=0,n=c.length;n>m;m++)l=c[m],o={},p=l.positions||h,p&&(l.positionDecodeMat?(o.positions=p,o.positionDecodeMat=l.positionDecodeMat,e.compressedPositions=!0):o.positions=p.constructor==Float32Array?p:new Float32Array(p),o.vertexBuf=new SceneJS._webgl.ArrayBuffer(f,f.ARRAY_BUFFER,o.positions,p.length,3,g),h=p,a._engine.stats.memory.morphPositions+=o.positions.length*o.positions.constructor.BYTES_PER_ELEMENT),p=l.normals||i,p&&(p.constructor==Int8Array?(o.normals=p,e.compressedNormals=!0,o.normalBuf=new SceneJS._webgl.ArrayBuffer(f,f.ARRAY_BUFFER,o.normals,p.length,2,g,!0)):(o.normals=p.constructor==Float32Array?p:new Float32Array(p),o.normalBuf=new SceneJS._webgl.ArrayBuffer(f,f.ARRAY_BUFFER,o.normals,p.length,3,g)),i=p,a._engine.stats.memory.morphNormals+=o.normals.length*o.normals.constructor.BYTES_PER_ELEMENT),p=l.uv||j,p&&(o.uv=p.constructor==Float32Array?p:new Float32Array(p),o.uvBuf=new SceneJS._webgl.ArrayBuffer(f,f.ARRAY_BUFFER,o.uv,p.length,2,g),j=p),p=l.uv2||k,p&&(o.uv2=p.constructor==Float32Array?p:new Float32Array(p),o.uvBuf2=new SceneJS._webgl.ArrayBuffer(f,f.ARRAY_BUFFER,o.uv2,p.length,2,g),k=p),e.targets.push(o);a._pickPositionsDirty=!0}var b={type:"morphGeometry",stateId:SceneJS._baseStateId++,hash:"",morph:null},c=[],d=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){a.engine.display.morphGeometry=b,d=0}),SceneJS.MorphGeometry=SceneJS_NodeFactory.createNodeType("morphGeometry"),SceneJS.MorphGeometry.prototype._init=function(a){if(1==this._core.useCount){this._pickPositionsDirty=!0,this._buildNodeCore(a),this._core.webglRestored=function(){};var b=this;this._core.getPickPositions=function(a,c){return b._pickPositionsDirty&&b._buildPickPositions(c),b._core.targets[a].pickPositionsBuf},this._core.getTangents=function(a,c,d,e,f){var g=b._core,h=g.targets[a];if(h.tangentBuf)return h.tangentBuf;var i=h.positions,e=h.positionDecodeMat||e;if(d=h.uv||d,i&&c&&d){var j=b._engine.canvas.gl,k=SceneJS_math_buildTangents(i,c,d,e,f);h.tangents=k;var l=j.STATIC_DRAW;return h.tangentBuf=new SceneJS._webgl.ArrayBuffer(j,j.ARRAY_BUFFER,k,k.length,3,l),h.tangentBuf}},this.setFactor(a.factor)}this._core.factor=a.factor||0,this._core.clamp=!!a.clamp},SceneJS.MorphGeometry.prototype._buildNodeCore=function(b){try{a(this,b)}catch(c){for(var d=0,e=this._core.targets.length;e>d;d++)target=core.targets[d],target.vertexBuf&&target.vertexBuf.destroy(),target.normalBuf&&target.normalBuf.destroy(),target.uvBuf&&target.uvBuf.destroy(),target.uvBuf2&&target.uvBuf2.destroy();throw SceneJS_error.fatalError(SceneJS.errors.ERROR,"Failed to allocate VBO(s) for morphGeometry: "+c)}},SceneJS.MorphGeometry.prototype._buildPickPositions=function(a){for(var b,c=this._core,d=null,e=this._engine.canvas.gl,f=e.STATIC_DRAW,g=0,h=c.targets.length;h>g;g++)d=c.targets[g],d.positions&&(d.pickPositionsBuf&&(d.pickPositionsBuf.destroy(),d.pickPositionsBuf=null),b=SceneJS_math_getPickPositions(d.positions,a),d.pickPositionsBuf=new SceneJS._webgl.ArrayBuffer(e,e.ARRAY_BUFFER,b,b.length,3,f));this._pickPositionsDirty=!1},SceneJS.MorphGeometry.prototype.setFactor=function(a){a=a||0;var b=this._core,c=b.keys,d=b.key1,e=b.key2,f=b.factor;if(a<c[0])d=0,e=1;else if(a>c[c.length-1])d=c.length-2,e=d+1;else{for(;c[d]>a;)d--,e--;for(;c[e]<a;)d++,e++}var g=d!=b.key1;b.factor=(a-c[d])/(c[e]-c[d]),this._factor=a;var h=g||f!=b.factor;if(b.key1=d,b.key2=e,h){var i=this.getCurrentFrame();this.onUpdate&&this.onUpdate(i),g&&this.onFrameUpdate&&this.onFrameUpdate(i)}this._engine.display.imageDirty=!0},SceneJS.MorphGeometry.prototype.getFactor=function(){return this._factor},SceneJS.MorphGeometry.prototype.getKeys=function(){return this._core.keys},SceneJS.MorphGeometry.prototype.getTargets=function(){return this._core.targets},SceneJS.MorphGeometry.prototype.getCurrentFrame=function(){var a=this._core,b=a.key1,c=a.key2;return{key1:b,key2:c,factor:a.factor,target1:a.targets[b],target2:a.targets[c]}},SceneJS.MorphGeometry.prototype._compile=function(a){this._core.hash||this._makeHash(),this._engine.display.morphGeometry=c[d++]=this._core,this._compileNodes(a),this._engine.display.morphGeometry=--d>0?c[d-1]:b,c[d]=null},SceneJS.MorphGeometry.prototype._makeHash=function(){var a=this._core;if(a.targets.length>0){var b=a.targets[0],c="t",d="f";a.hash=[b.vertexBuf?c:d,b.normalBuf?c:d,b.uvBuf?c:d,b.uvBuf2?c:d].join("")}else a.hash=""},SceneJS.MorphGeometry.prototype._destroy=function(){if(1==this._core.useCount&&document.getElementById(this._engine.canvas.canvasId))for(var a,b=this._core,c=0,d=b.targets.length;d>c;c++)a=b.targets[c],a.vertexBuf&&a.vertexBuf.destroy(),a.pickPositionsBuf&&a.pickPositionsBuf.destroy(),a.normalBuf&&a.normalBuf.destroy(),a.uvBuf&&a.uvBuf.destroy(),a.uvBuf2&&a.uvBuf2.destroy()}},new function(){function a(a){var c;if(f>0){c={};for(var d in a)a.hasOwnProperty(d)&&void 0!=a[d]&&(c[d]=g(d))}return b(a.props),{props:a,setProps:function(b){h(b,a)},restoreProps:function(a){c&&i(a,c)}}}function b(a){var b;for(var c in a)a.hasOwnProperty(c)&&(b=a[c],void 0!=b&&null!=b&&(k[c]?a[c]=k[c](null,b):l[c]&&(a[c]=l[c](null,b))))}var c,d={type:"renderer",stateId:SceneJS._baseStateId++,props:null},e=[],f=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){c=a.engine.canvas,f=0,a.engine.display.renderer=e[f++]=d});var g=function(a){for(var b,c,d=f-1;d>=0;d--)if(b=e[d].props,b&&(c=b[a],void 0!=c&&null!=c))return b[a];return null},h=function(a,b){for(var c in b)if(b.hasOwnProperty(c)){var d=k[c];d&&d(a,b[c])}b.viewport&&l.viewport(a,b.viewport),b.scissor&&l.clear(a,b.scissor),b.clear&&l.clear(a,b.clear)},i=function(a,b){var c;for(var d in b)if(b.hasOwnProperty(d)&&(c=b[d],void 0!=c&&null!=c)){var e=k[d];e&&e(a,c)}b.viewport&&l.viewport(a,b.viewport),b.scissor&&l.clear(a,b.scissor)},j=function(a,b){if(!b)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,'Null SceneJS.State node config: "'+b+'"');var c=SceneJS._webgl.enumMap[b];if(!c)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,'Unrecognised SceneJS.State node config value: "'+b+'"');var d=a[c];if(!d)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"This browser's WebGL does not support renderer node config value: \""+b+'"');return d},k={enableBlend:function(a,b){return a?void(b?a.enable(a.BLEND):a.disable(a.BLEND)):((null==b||void 0==b)&&(b=!1),b)},blendColor:function(a,b){return a?void a.blendColor(b.r,b.g,b.b,b.a):(b=b||{},{r:b.r||0,g:b.g||0,b:b.b||0,a:void 0==b.a||null==b.a?1:b.a})},blendEquation:function(a,b){return a?void a.blendEquation(a,j(a,b)):b||"funcAdd"},blendEquationSeparate:function(a,b){return a?void a.blendEquation(j(a,b.rgb),j(a,b.alpha)):(b=b||{},{rgb:b.rgb||"funcAdd",alpha:b.alpha||"funcAdd"})},blendFunc:function(a,b){return a?void a.blendFunc(j(a,b.sfactor||"srcAlpha"),j(a,b.dfactor||"oneMinusSrcAlpha")):(b=b||{},{sfactor:b.sfactor||"srcAlpha",dfactor:b.dfactor||"oneMinusSrcAlpha"})},blendFuncSeparate:function(a,b){return a?void a.blendFuncSeparate(j(a,b.srcRGB||"zero"),j(a,b.dstRGB||"zero"),j(a,b.srcAlpha||"zero"),j(a,b.dstAlpha||"zero")):(b=b||{},{srcRGB:b.srcRGB||"zero",dstRGB:b.dstRGB||"zero",srcAlpha:b.srcAlpha||"zero",dstAlpha:b.dstAlpha||"zero"})},clearColor:function(a,b){return a?void a.clearColor(b.r,b.g,b.b,b.a):(b=b||{},{r:b.r||0,g:b.g||0,b:b.b||0,a:void 0==b.a||null==b.a?1:b.a})},clearDepth:function(a,b){return a?void a.clearDepth(b):null==b||void 0==b?1:b},clearStencil:function(a,b){return a?void a.clearStencil(b):b||0},colorMask:function(a,b){return a?void a.colorMask(b.r,b.g,b.b,b.a):(b=b||{},{r:b.r||0,g:b.g||0,b:b.b||0,a:void 0==b.a||null==b.a?1:b.a})},enableCullFace:function(a,b){return a?void(b?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE)):b},cullFace:function(a,b){return a?void a.cullFace(j(a,b)):b||"back"},enableDepthTest:function(a,b){return a?void(b?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST)):((null==b||void 0==b)&&(b=!0),b)},depthFunc:function(a,b){return a?void a.depthFunc(j(a,b)):b||"less"},enableDepthMask:function(a,b){return a?void a.depthMask(b):((null==b||void 0==b)&&(b=!0),b)},depthRange:function(a,b){return a?void a.depthRange(b.zNear,b.zFar):(b=b||{},{zNear:void 0==b.zNear||null==b.zNear?0:b.zNear,zFar:void 0==b.zFar||null==b.zFar?1:b.zFar})},frontFace:function(a,b){return a?void a.frontFace(j(a,b)):b||"ccw"},lineWidth:function(a,b){return a?void a.lineWidth(b):b||1},enableScissorTest:function(a,b){return a?void(b?a.enable(a.SCISSOR_TEST):(b=!1,a.disable(a.SCISSOR_TEST))):b}},l={viewport:function(a,b){return a?void a.viewport(b.x,b.y,b.width,b.height):(b=b||{},{x:b.x||1,y:b.y||1,width:b.width||c.canvas.width,height:b.height||c.canvas.height})},scissor:function(a,b){return a?void a.scissor(b.x,b.y,b.width,b.height):(b=b||{},{x:b.x||0,y:b.y||0,width:b.width||1,height:b.height||1})},clear:function(a,b){if(!a)return b=b||{};var c;b.color&&(c=a.COLOR_BUFFER_BIT),b.depth&&(c|=a.DEPTH_BUFFER_BIT),b.stencil&&(c|=a.STENCIL_BUFFER_BIT)}};SceneJS.Renderer=SceneJS_NodeFactory.createNodeType("renderer"),SceneJS.Renderer.prototype._init=function(a){if(1==this._core.useCount){for(var b in a)a.hasOwnProperty(b)&&(this._core[b]=a[b]);this._core.dirty=!0}},SceneJS.Renderer.prototype.setViewport=function(a){this._core.viewport=a?{x:a.x||1,y:a.y||1,width:a.width||1e3,height:a.height||1e3}:void 0,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getViewport=function(){return this._core.viewport?{x:this._core.viewport.x,y:this._core.viewport.y,width:this._core.viewport.width,height:this._core.viewport.height}:void 0},SceneJS.Renderer.prototype.setScissor=function(a){this._core.scissor=a?{x:a.x||1,y:a.y||1,width:a.width||1e3,height:a.height||1e3}:void 0,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getScissor=function(){return this._core.scissor?{x:this._core.scissor.x,y:this._core.scissor.y,width:this._core.scissor.width,height:this._core.scissor.height}:void 0},SceneJS.Renderer.prototype.setClear=function(a){this._core.clear=a?{r:a.r||0,g:a.g||0,b:a.b||0}:void 0,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getClear=function(){return this._core.clear?{r:this._core.clear.r,g:this._core.clear.g,b:this._core.clear.b}:null},SceneJS.Renderer.prototype.setEnableBlend=function(a){this._core.enableBlend=a,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getEnableBlend=function(){return this._core.enableBlend},SceneJS.Renderer.prototype.setBlendColor=function(a){this._core.blendColor=a?{r:a.r||0,g:a.g||0,b:a.b||0,a:void 0==a.a||null==a.a?1:a.a}:void 0,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getBlendColor=function(){return this._core.blendColor?{r:this._core.blendColor.r,g:this._core.blendColor.g,b:this._core.blendColor.b,a:this._core.blendColor.a}:void 0},SceneJS.Renderer.prototype.setBlendEquation=function(a){this._core.blendEquation=a,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getBlendEquation=function(){return this._core.blendEquation},SceneJS.Renderer.prototype.setBlendEquationSeparate=function(a){this._core.blendEquationSeparate=a?{rgb:a.rgb||"funcAdd",alpha:a.alpha||"funcAdd"}:void 0,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getBlendEquationSeparate=function(){return this._core.blendEquationSeparate?{rgb:this._core.rgb,alpha:this._core.alpha}:void 0},SceneJS.Renderer.prototype.setBlendFunc=function(a){this._core.blendFunc=a?{sfactor:a.sfactor||"srcAlpha",dfactor:a.dfactor||"one"}:void 0,this._core.dirty=!0,this._engine.display.imageDirty=!0},SceneJS.Renderer.prototype.getBlendFunc=function(){return this._core.blendFunc?{sfactor:this._core.sfactor,dfactor:this._core.dfactor}:void 0},SceneJS.Renderer.prototype.setBlendFuncSeparate=function(a){this._core.blendFuncSeparate=a?{srcRGB:a.srcRGB||"zero",dstRGB:a.dstRGB||"zero",srcAlpha:a.srcAlpha||"zero",dstAlpha:a.dstAlpha||"zero"}:void 0,this._core.dirty=!0},SceneJS.Renderer.prototype.getBlendFuncSeparate=function(){return this._core.blendFuncSeparate?{srcRGB:this._core.blendFuncSeparate.srcRGB,dstRGB:this._core.blendFuncSeparate.dstRGB,srcAlpha:this._core.blendFuncSeparate.srcAlpha,dstAlpha:this._core.blendFuncSeparate.dstAlpha}:void 0},SceneJS.Renderer.prototype.setEnableCullFace=function(a){this._core.enableCullFace=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getEnableCullFace=function(){return this._core.enableCullFace},SceneJS.Renderer.prototype.setCullFace=function(a){this._core.cullFace=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getCullFace=function(){return this._core.cullFace},SceneJS.Renderer.prototype.setEnableDepthTest=function(a){this._core.enableDepthTest=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getEnableDepthTest=function(){return this._core.enableDepthTest},SceneJS.Renderer.prototype.setDepthFunc=function(a){this._core.depthFunc=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getDepthFunc=function(){return this._core.depthFunc},SceneJS.Renderer.prototype.setEnableDepthMask=function(a){this._core.enableDepthMask=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getEnableDepthMask=function(){return this._core.enableDepthMask},SceneJS.Renderer.prototype.setClearDepth=function(a){this._core.clearDepth=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getClearDepth=function(){return this._core.clearDepth},SceneJS.Renderer.prototype.setDepthRange=function(a){this._core.depthRange=a?{zNear:void 0==a.zNear||null==a.zNear?0:a.zNear,zFar:void 0==a.zFar||null==a.zFar?1:a.zFar}:void 0,this._core.dirty=!0},SceneJS.Renderer.prototype.getDepthRange=function(){return this._core.depthRange?{zNear:this._core.depthRange.zNear,zFar:this._core.depthRange.zFar}:void 0},SceneJS.Renderer.prototype.setFrontFace=function(a){this._core.frontFace=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getFrontFace=function(){return this._core.frontFace},SceneJS.Renderer.prototype.setLineWidth=function(a){this._core.lineWidth=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getLineWidth=function(){return this._core.lineWidth},SceneJS.Renderer.prototype.setEnableScissorTest=function(a){this._core.enableScissorTest=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getEnableScissorTest=function(){return this._core.enableScissorTest},SceneJS.Renderer.prototype.setClearStencil=function(a){this._core.clearStencil=a,this._core.dirty=!0},SceneJS.Renderer.prototype.getClearStencil=function(){return this._core.clearStencil},SceneJS.Renderer.prototype.setColorMask=function(a){this._core.colorMask=a?{r:a.r||0,g:a.g||0,b:a.b||0,a:void 0==a.a||null==a.a?1:a.a}:void 0,this._core.dirty=!0},SceneJS.Renderer.prototype.getColorMask=function(){return this._core.colorMask?{r:this._core.colorMask.r,g:this._core.colorMask.g,b:this._core.colorMask.b,a:this._core.colorMask.a}:void 0},SceneJS.Renderer.prototype._compile=function(b){this._core.dirty&&(this._core.props=a(this._core),this._core.dirty=!1),this._engine.display.renderer=e[f++]=this._core,this._compileNodes(b),this._engine.display.renderer=--f>0?e[f-1]:d,e[f]=null}},function(){var a={less:"LESS",equal:"EQUAL",lequal:"LEQUAL",greater:"GREATER",notequal:"NOTEQUAL",gequal:"GEQUAL"},b={type:"depthBuffer",stateId:SceneJS._baseStateId++,enabled:!0,clearDepth:1,depthFunc:null,_depthFuncName:"less"},c=[],d=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){null===b.depthFunc&&(b.depthFunc=a.engine.canvas.gl.LESS),a.engine.display.depthBuffer=b,d=0}),SceneJS.DepthBuf=SceneJS_NodeFactory.createNodeType("depthBuffer"),SceneJS.DepthBuf.prototype._init=function(a){void 0!=a.enabled?this.setEnabled(a.enabled):1==this._core.useCount&&this.setEnabled(!0),void 0!=a.clearDepth?this.setClearDepth(a.clearDepth):1==this._core.useCount&&this.setClearDepth(1),void 0!=a.depthFunc?this.setDepthFunc(a.depthFunc):1==this._core.useCount&&this.setDepthFunc("less"),void 0!=a.clear?this.setClear(a.clear):1==this._core.useCount&&this.setClear(!0)},SceneJS.DepthBuf.prototype.setEnabled=function(a){return this._core.enabled!=a&&(this._core.enabled=a,this._engine.display.imageDirty=!0),this},SceneJS.DepthBuf.prototype.getEnabled=function(){return this._core.enabled},SceneJS.DepthBuf.prototype.setClear=function(a){return this._core.clear!=a&&(this._core.clear=a,this._engine.display.imageDirty=!0),this},SceneJS.DepthBuf.prototype.getClear=function(){return this._core.clear},SceneJS.DepthBuf.prototype.setClearDepth=function(a){return this._core.clearDepth!=a&&(this._core.clearDepth=a,this._engine.display.imageDirty=!0),this},SceneJS.DepthBuf.prototype.getClearDepth=function(){return this._core.clearDepth},SceneJS.DepthBuf.prototype.setDepthFunc=function(b){if(this._core._depthFuncName!=b){var c=a[b];if(void 0==c)throw"unsupported value for 'clearFunc' attribute on depthBuffer node: '"+b+"' - supported values are 'less', 'equal', 'lequal', 'greater', 'notequal' and 'gequal'";this._core.depthFunc=this._engine.canvas.gl[c],this._core._depthFuncName=b,this._engine.display.imageDirty=!0}return this},SceneJS.DepthBuf.prototype.getDepthFunc=function(){return this._core._depthFuncName},SceneJS.DepthBuf.prototype._compile=function(a){this._engine.display.depthBuffer=c[d++]=this._core,this._compileNodes(a),this._engine.display.depthBuffer=--d>0?c[d-1]:b,c[d]=null}}(),function(){var a={never:"NEVER",less:"LESS",equal:"EQUAL",lequal:"LEQUAL",greater:"GREATER",notequal:"NOTEQUAL",gequal:"GEQUAL",always:"ALWAYS",keep:"KEEP",zero:"ZERO",replace:"REPLACE",incr:"INCR",incr_wrap:"INCR_WRAP",decr:"DECR",decr_wrap:"DECR_WRAP",invert:"INVERT",front:"FRONT",back:"BACK",front_and_back:"FRONT_AND_BACK"},b={type:"stencilBuffer",stateId:SceneJS._baseStateId++,enabled:!1,clearStencil:0,stencilFuncFuncFront:null,stencilFuncRefFront:0,stencilFuncMaskFront:255,stencilFuncFuncBack:null,stencilFuncRefBack:0,stencilFuncMaskBack:255,stencilOpSfailFront:null,stencilOpDpfailFront:null,stencilOpDppassFront:null,stencilOpSfailBack:null,stencilOpDpfailBack:null,stencilOpDppassBack:null,_stencilFuncFuncStateFront:"always",_stencilFuncRefStateFront:0,_stencilFuncMaskStateFront:255,_stencilFuncFuncStateBack:"always",_stencilFuncRefStateBack:0,_stencilFuncMaskStateBack:255,_stencilOpSfailStateFront:"keep",_stencilOpDpfailStateFront:"keep",_stencilOpDppassStateFront:"keep",_stencilOpSfailStateBack:"keep",_stencilOpDpfailStateBack:"keep",_stencilOpDppassStateBack:"keep"},c=[],d=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){null===b.stencilFuncFuncFront&&(b.stencilFuncFuncFront=a.engine.canvas.gl.ALWAYS),null===b.stencilFuncFuncBack&&(b.stencilFuncFuncBack=a.engine.canvas.gl.ALWAYS),null===b.stencilOpSfailFront&&(b.stencilOpSfailFront=a.engine.canvas.gl.KEEP,b.stencilOpDpfailFront=a.engine.canvas.gl.KEEP,b.stencilOpDppassFront=a.engine.canvas.gl.KEEP),null===b.stencilOpSfailBack&&(b.stencilOpSfailBack=a.engine.canvas.gl.KEEP,b.stencilOpDpfailBack=a.engine.canvas.gl.KEEP,b.stencilOpDppassBack=a.engine.canvas.gl.KEEP),a.engine.display.stencilBuffer=b,d=0}),SceneJS.StencilBuf=SceneJS_NodeFactory.createNodeType("stencilBuffer"),SceneJS.StencilBuf.prototype._init=function(a){void 0!=a.enabled?this.setEnabled(a.enabled):1==this._core.useCount&&this.setEnabled(!0),void 0!=a.clearStencil?this.setClearStencil(a.clearStencil):1==this._core.useCount&&this.setClearStencil(0),void 0!=a.stencilFunc?this.setStencilFunc(a.stencilFunc):1==this._core.useCount&&this.setStencilFunc({face:"front_back",func:"always",ref:1,mask:255}),void 0!=a.stencilOp?this.setStencilOp(a.stencilOp):1==this._core.useCount&&this.setStencilOp({face:"front_back",sfail:"keep",dpfail:"keep",dppass:"keep"}),void 0!=a.clear&&this.setClear(a.clear)},SceneJS.StencilBuf.prototype.setEnabled=function(a){return this._core.enabled!=a&&(this._core.enabled=a,this._engine.display.imageDirty=!0),this},SceneJS.StencilBuf.prototype.getEnabled=function(){return this._core.enabled},SceneJS.StencilBuf.prototype.setClear=function(a){return this._core.clear!=a&&(this._core.clear=a,this._engine.display.imageDirty=!0),this},SceneJS.StencilBuf.prototype.getClear=function(){return this._core.clear},SceneJS.StencilBuf.prototype.setClearStencil=function(a){return this._core.clearStencil!=a&&(this._core.clearStencil=a,this._engine.display.imageDirty=!0),this},SceneJS.StencilBuf.prototype.getClearStencil=function(){return this._core.clearStencil},SceneJS.StencilBuf.prototype.setStencilFunc=function(b){var c=!1,d=!1,e=b.func||"always",f=void 0!==b.ref?b.ref:1,g=void 0!==b.mask?b.mask:255,h=e,i=f,j=g,k=b.face||"front_and_back";if(b.front||b.back?(b.front&&(c=!0,e=b.front.func||"always",f=void 0!==b.front.ref?b.front.ref:1,g=void 0!==b.front.mask?b.front.mask:255),b.back&&(d=!0,h=b.back.func||"always",i=void 0!==b.back.ref?b.back.ref:1,j=void 0!==b.back.mask?b.back.mask:255)):(c="front"===k||"front_and_back"===k,d="back"===k||"front_and_back"===k),f!==i||g!==j)throw"WebGL only allow same value for stencil ref and mask of front and back faces";if(c&&(this._core._stencilFuncFuncStateFront!=e||this._core._stencilFuncRefStateFront!=f||this._core._stencilFuncMaskStateFront!=g)){var l=a[e];if(void 0==l)throw"unsupported value for 'stencilFunc' attribute on stencilBuffer node: '"+stencilFunc.func+"' - supported values are 'keep', 'always', 'less', 'equal', 'lequal', 'greater', 'notequal' and 'gequal'";this._core.stencilFuncFuncFront=this._engine.canvas.gl[l],this._core.stencilFuncRefFront=f,this._core.stencilFuncMaskFront=g,this._core._stencilFuncFuncStateFront=e,this._core._stencilFuncRefStateFront=f,this._core._stencilFuncMaskStateFront=g,this._engine.display.imageDirty=!0}if(d&&(this._core._stencilFuncFuncStateBack!=h||this._core._stencilFuncRefStateBack!=i||this._core._stencilFuncMaskStateBack!=j)){var l=a[h];if(void 0==l)throw"unsupported value for 'stencilFunc' attribute on stencilBuffer node: '"+stencilFunc.func+"' - supported values are 'keep', 'always', 'less', 'equal', 'lequal', 'greater', 'notequal' and 'gequal'";this._core.stencilFuncFuncBack=this._engine.canvas.gl[l],this._core.stencilFuncRefBack=i,this._core.stencilFuncMaskBack=j,this._core._stencilFuncFuncStateBack=h,this._core._stencilFuncRefStateBack=i,this._core._stencilFuncMaskStateBack=j,this._engine.display.imageDirty=!0}return this},SceneJS.StencilBuf.prototype.setStencilOp=function(b){var c=!1,d=!1,e=b.sfail||"keep",f=b.dpfail||"keep",g=b.dppass||"keep",h=e,i=f,j=g,k=b.face||"front_and_back";if(b.front||b.back?(b.front&&(c=!0,e=b.front.sfail||"keep",f=b.front.dpfail||"keep",g=b.front.dppass||"keep"),b.back&&(d=!0,h=b.back.sfail||"keep",i=b.back.dpfail||"keep",j=b.back.dppass||"keep")):(c="front"===k||"front_and_back"===k,d="back"===k||"front_and_back"===k),c&&(this._core._stencilOpSfailStateFront!=e||this._core._stencilOpDpfailStateFront!=f||this._core._stencilOpDppassStateFront!=g)){var l=a[e],m=a[f],n=a[g];if(void 0==l||void 0==m||void 0==n)throw"unsupported value for 'StencilOp' attribute on stencilBuffer node - supported values are 'keep', 'zero', 'replace', 'incr', 'incr_wrap', 'decr', 'decr_wrap', 'invert'";this._core.stencilOpSfailFront=this._engine.canvas.gl[l],this._core.stencilOpDpfailFront=this._engine.canvas.gl[m],this._core.stencilOpDppassFront=this._engine.canvas.gl[n],this._core._stencilOpSfailStateFront=e,this._core._stencilOpSfailStateFront=f,this._core._stencilOpSfailStateFront=g,this._engine.display.imageDirty=!0}if(d&&(this._core._stencilOpSfailStateBack!=h||this._core._stencilOpDpfailStateBack!=i||this._core._stencilOpDppassStateBack!=j)){var l=a[h],m=a[i],n=a[j];if(void 0==l||void 0==m||void 0==n)throw"unsupported value for 'StencilOp' attribute on stencilBuffer node - supported values are 'keep', 'zero', 'replace', 'incr', 'incr_wrap', 'decr', 'decr_wrap', 'invert'";this._core.stencilOpSfailBack=this._engine.canvas.gl[l],this._core.stencilOpDpfailBack=this._engine.canvas.gl[m],this._core.stencilOpDppassBack=this._engine.canvas.gl[n],this._core._stencilOpSfailStateBack=h,this._core._stencilOpSfailStateBack=i,this._core._stencilOpSfailStateBack=j,this._engine.display.imageDirty=!0}return this},SceneJS.StencilBuf.prototype.getStencilFuncFront=function(){return{func:this._core._stencilFuncFuncStateFront,ref:this._core._stencilFuncRefStateFront,mask:this._core._stencilFuncMaskStateFront}},SceneJS.StencilBuf.prototype.getStencilFuncBack=function(){return{func:this._core._stencilFuncFuncStateBack,ref:this._core._stencilFuncRefStateBack,mask:this._core._stencilFuncMaskStateBack}},SceneJS.StencilBuf.prototype.getStencilOpFront=function(){return{sfail:this._core._stencilOpSfailStateFront,dpfail:this._core._stencilOpDpfailStateFront,dppass:this._core._stencilOpDppassStateFront}},SceneJS.StencilBuf.prototype.getStencilOpBack=function(){return{sfail:this._core._stencilOpSfailStateBack,dpfail:this._core._stencilOpDpfailStateBack,dppass:this._core._stencilOpDppassStateBack}},SceneJS.StencilBuf.prototype._compile=function(a){this._engine.display.stencilBuffer=c[d++]=this._core,this._compileNodes(a),this._engine.display.stencilBuffer=--d>0?c[d-1]:b,c[d]=null}}(),function(){var a={type:"colorBuffer",stateId:SceneJS._baseStateId++,blendEnabled:!1,colorMask:{r:!0,g:!0,b:!0,a:!0}},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.colorBuffer=a,c=0}),SceneJS.ColorBuffer=SceneJS_NodeFactory.createNodeType("colorBuffer"),SceneJS.ColorBuffer.prototype._init=function(a){void 0!=a.blendEnabled?this.setBlendEnabled(a.blendEnabled):1==this._core.useCount&&this.setBlendEnabled(!1),this.setColorMask(a)},SceneJS.ColorBuffer.prototype.setBlendEnabled=function(a){this._core.blendEnabled!=a&&(this._core.blendEnabled=a,this._engine.display.imageDirty=!0),this._engine.display.imageDirty=!0},SceneJS.ColorBuffer.prototype.getBlendEnabled=function(){return this._core.blendEnabled},SceneJS.ColorBuffer.prototype.setColorMask=function(a){this._core.colorMask={r:void 0!=a.r&&null!=a.r?a.r:!0,g:void 0!=a.g&&null!=a.g?a.g:!0,b:void 0!=a.b&&null!=a.b?a.b:!0,a:void 0!=a.a&&null!=a.a?a.a:!0},this._engine.display.imageDirty=!0},SceneJS.ColorBuffer.prototype.getColorMask=function(){return this._core.colorMask},SceneJS.ColorBuffer.prototype._compile=function(d){this._engine.display.colorBuffer=b[c++]=this._core,this._compileNodes(d),this._engine.display.colorBuffer=--c>0?b[c-1]:a,b[c]=null,this._engine.display.imageDirty=!0}}(),function(){var a={type:"view",stateId:SceneJS._baseStateId++,scissorTestEnabled:!1},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.view=a,c=0}),SceneJS.View=SceneJS_NodeFactory.createNodeType("view"),SceneJS.View.prototype._init=function(a){void 0!=a.scissorTestEnabled?this.setScissorTestEnabled(a.scissorTestEnabled):1==this._core.useCount&&this.setScissorTestEnabled(!1)},SceneJS.View.prototype.setScissorTestEnabled=function(a){return this._core.scissorTestEnabled!=a&&(this._core.scissorTestEnabled=a,this._engine.display.imageDirty=!0),this},SceneJS.View.prototype.getScissorTestEnabled=function(){return this._core.scissorTestEnabled},SceneJS.View.prototype._compile=function(d){this._engine.display.view=b[c++]=this._core,this._compileNodes(d),this._engine.display.view=--c>0?b[c-1]:a,b[c]=null}}(),SceneJS.Scene=SceneJS_NodeFactory.createNodeType("scene"),SceneJS.Scene.prototype._init=function(a){a.tagMask&&this.setTagMask(a.tagMask),this._tagSelector=null,this.transparent=a.transparent===!0,this.stats=this._engine.stats,this._handleMap=new SceneJS_Map,this._topicSubs={},this._handleTopics={},this._topicPubs={}},SceneJS.Scene.prototype.loseWebGLContext=function(){this._engine.loseWebGLContext()},SceneJS.Scene.prototype.getCanvas=function(){return this._engine.canvas.canvas},SceneJS.Scene.prototype.getGL=function(){return this._engine.canvas.gl},SceneJS.Scene.prototype.getWebGL2Supported=function(){return this._engine.canvas.webgl2},SceneJS.Scene.prototype.getZBufferDepth=function(){var a=this._engine.canvas.gl;return a.getParameter(a.DEPTH_BITS)},SceneJS.Scene.prototype.setResolutionScaling=function(a){return this._engine.canvas.setResolutionScaling(a)},SceneJS.Scene.prototype.setHighlightColor=function(a,b,c){this._engine.display.highlightColor[0]=a,this._engine.display.highlightColor[1]=b,this._engine.display.highlightColor[2]=c,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogDensity=function(a){this._engine.display.fogDensity=a,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogStart=function(a){this._engine.display.fogStart=a,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogEnd=function(a){
  this._engine.display.fogEnd=a,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogMin=function(a){this._engine.display.fogMin=a,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogMax=function(a){this._engine.display.fogMax=a,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogColor=function(a,b,c){this._engine.display.fogColor[0]=a,this._engine.display.fogColor[1]=b,this._engine.display.fogColor[2]=c,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogMode=function(a){this._engine.display.fogMode=a,this._engine.branchDirty(this),this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setFogEnabled=function(a){this._engine.display.fogEnabled=a,this._engine.branchDirty(this),this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setXrayGlassFactor=function(a){this._engine.display.xrayGlassFactor=a,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setXrayMurkiness=function(a){this._engine.display.xrayMurkiness=a,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setXrayBGColor=function(a,b,c){this._engine.display.xrayBGColor[0]=a,this._engine.display.xrayBGColor[1]=b,this._engine.display.xrayBGColor[2]=c,this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.setTagMask=function(a){a=a||"XXXXXXXXXXXXXXXXXXXXXXXXXX",this._tagSelector||(this._tagSelector={}),this._tagSelector.mask=a,this._tagSelector.regex=a?new RegExp(a):null,this._engine.display.selectTags(this._tagSelector)},SceneJS.Scene.prototype.getTagMask=function(){return this._tagSelector?this._tagSelector.mask:null},SceneJS.Scene.prototype.setNumPasses=function(a){this._engine.setNumPasses(a)},SceneJS.Scene.prototype.setClearEachPass=function(a){this._engine.setClearEachPass(a)},SceneJS.Scene.prototype.renderFrame=function(a){return this._engine.renderFrame(a)},SceneJS.Scene.prototype.pauseCompilation=function(){return this._engine.pauseCompilation()},SceneJS.Scene.prototype.resumeCompilation=function(){return this._engine.resumeCompilation()},SceneJS.Scene.prototype.compile=function(){return this._engine.compile()},SceneJS.Scene.prototype.needFrame=function(){this._engine.display.imageDirty=!0},SceneJS.Scene.prototype.start=function(a){this._engine.start(a)},SceneJS.Scene.prototype.setTicksPerRender=function(a){this._engine.ticksPerRender=a},SceneJS.Scene.prototype.pause=function(a){this._engine.pause(a)},SceneJS.Scene.prototype.isRunning=function(){return this._engine.running},SceneJS.Scene.prototype.pick=function(){var a;if(SceneJS._isNumeric(arguments[0])){var b=arguments[0],c=arguments[1];a=arguments[2]||{},a.canvasPos=new Float32Array([b,c])}else a=arguments[0]||{};var d=this._engine.pick(a);return this.renderFrame({force:!0}),d?(this.publish("pick",d),d):void this.publish("nopick")},SceneJS.Scene.prototype.readPixels=function(a,b,c){return this._engine.readPixels(a,b,c)},SceneJS.Scene.prototype._destroy=function(){this.destroyed||(delete SceneJS._engines[this.id],SceneJS._engineIds.removeItem(this.id),this.destroyed=!0)},SceneJS.Scene.prototype.isActive=function(){return!this._engine.destroyed},SceneJS.Scene.prototype.stop=function(){this._engine.stop()},SceneJS.Scene.prototype.containsNode=function(a){return!!this._engine.findNode(a)},SceneJS.Scene.prototype.findNodes=function(a){return this._engine.findNodes(a)},SceneJS.Scene.prototype.findNode=function(a,b){return this.getNode(a,b)},SceneJS.Scene.prototype.getNode=function(a,b){var c=this._engine.findNode(a);return c?(b&&b(c),c):b?void this.once("nodes/"+a,b):null},SceneJS.Scene.prototype.hasCore=function(a,b){return this._engine.hasCore(a,b)},SceneJS.Scene.prototype.setDepthSort=function(a){this._engine.setDepthSort(a)},SceneJS.Scene.prototype.getStatus=function(){var a=SceneJS_sceneStatusModule.sceneStatus[this.id];return a?SceneJS._shallowClone(a):{destroyed:!0}},SceneJS.Scene.prototype.publish=function(a,b,c){if(c||(this._topicPubs[a]=b),this._topicSubs[a]){var d=this._topicSubs[a];for(var e in d)d.hasOwnProperty(e)&&d[e].call(this,b)}},SceneJS.Scene.prototype.unpublish=function(a){var b=this._topicSubs[a];if(b)for(var c in b)b.hasOwnProperty(c)&&b[c].call(this,null);delete this._topicPubs[a]},SceneJS.Scene.prototype.on=function(a,b){var c=this._topicSubs[a];c||(c={},this._topicSubs[a]=c);var d=this._handleMap.addItem();c[d]=b,this._handleTopics[d]=a;var e=this._topicPubs[a];return e&&b.call(this,e),"rendered"==a&&this._engine.branchDirty(this),d},SceneJS.Scene.prototype.off=function(a){var b=this._handleTopics[a];if(b){delete this._handleTopics[a];var c=this._topicSubs[b];c&&delete c[a],this._handleMap.removeItem(a),"rendered"==b&&this._engine.branchDirty(this)}},SceneJS.Scene.prototype.once=function(a,b){var c=this,d=this.on(a,function(a){c.off(d),b(a)})},function(){var a={type:"style",stateId:SceneJS._baseStateId++,lineWidth:1},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.style=a,c=0}),SceneJS.Style=SceneJS_NodeFactory.createNodeType("style"),SceneJS.Style.prototype._init=function(a){void 0!=a.lineWidth&&this.setLineWidth(a.lineWidth)},SceneJS.Style.prototype.setLineWidth=function(a){return this._core.lineWidth!=a&&(this._core.lineWidth=a,this._engine.display.imageDirty=!0),this},SceneJS.Style.prototype.getLineWidth=function(){return this._core.lineWidth},SceneJS.Style.prototype._compile=function(d){this._engine.display.style=b[c++]=this._core,this._compileNodes(d),this._engine.display.style=--c>0?b[c-1]:a,b[c]=null}}(),function(){var a={type:"tag",stateId:SceneJS._baseStateId++,tag:null},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.tag=a,c=0}),SceneJS.Tag=SceneJS_NodeFactory.createNodeType("tag"),SceneJS.Tag.prototype._init=function(a){if(1==this._core.useCount){if(!a.tag)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"tag node attribute missing : 'tag'");this.setTag(a.tag)}},SceneJS.Tag.prototype.setTag=function(a){var b=this._core;b.tag=a,b.pattern=null,b.matched=!1,this._engine.display.drawListDirty=!0},SceneJS.Tag.prototype.getTag=function(){return this._core.tag},SceneJS.Tag.prototype._compile=function(d){this._engine.display.tag=b[c++]=this._core,this._compileNodes(d),this._engine.display.tag=--c>0?b[c-1]:a,b[c]=null}}(),new function(){function a(a,b,c,d){return function(){if(b.compressedSrc){a._initTexture(c);var e;"dds"===d?e=a._parseDDS:"pvr"===d&&(e=a._parsePVR),SceneJS._loadBinary(b.compressedSrc,e.bind(this))}else b.image?(a._initTexture(c),a._setTextureImage(b.image)):b.src&&(a._initTexture(c),a._loadTexture(b.src))}}function b(a){return a.charCodeAt(0)+(a.charCodeAt(1)<<8)+(a.charCodeAt(2)<<16)+(a.charCodeAt(3)<<24)}function c(a,b){var a=Math.max(a,16),b=Math.max(b,8);return a*b/4}function d(a,b){var a=Math.max(a,8),b=Math.max(b,8);return a*b/2}function e(a,b){return Math.floor((a+3)/4)*Math.floor((b+3)/4)*8}function f(a,b){return Math.floor((a+3)/4)*Math.floor((b+3)/4)*16}var g={type:"texture",stateId:SceneJS._baseStateId++,empty:!0,hash:""};SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(a){a.engine.display.texture=g,i=0});var h=[],i=0,j=null,k=null,l=null,m=SceneJS.TEXTURE_FLAGS;SceneJS.TextureMap=SceneJS_NodeFactory.createNodeType("texture"),SceneJS.TextureMap.prototype._init=function(b){var c=this;if(1==this._core.useCount){var d=b.applyFrom||"uv";if("uv"!==d.substring(0,2))throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"texture applyFrom value is unsupported - should be 'uv<index>'");var e=0;if("uv"!==d&&(e=parseInt(d.substring(2)),isNaN(e)))throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"texture applyFrom value invalid - should be 'uv<index>'");if(b.applyTo){var f=b.applyTo;if("baseColor"!=f&&"color"!=f&&"specular"!=f&&"emit"!=f&&"alpha"!=f&&"normals"!=f&&"shine"!=f)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"texture applyTo value is unsupported - should be either 'color', 'baseColor', 'specular' or 'normals'")}if(b.blendMode&&"add"!=b.blendMode&&"multiply"!=b.blendMode)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"texture layer blendMode value is unsupported - should be either 'add' or 'multiply'");"color"==b.applyTo&&(b.applyTo="baseColor");var g=m[b.applyTo||"baseColor"]|m[b.blendMode||"multiply"];if(SceneJS._apply({waitForLoad:void 0==b.waitForLoad?!0:b.waitForLoad,texture:null,minFilter:b.minFilter,magFilter:b.magFilter,wrapS:b.wrapS,wrapT:b.wrapT,uvLayerIdx:e,isNormalMap:"normals"===b.applyTo,isAlphaMap:"alpha"===b.applyTo,flags:g,blendFactor:void 0!=b.blendFactor&&null!=b.blendFactor?b.blendFactor:1},this._core),this._initTexture(b.preloadColor),b.compressedImage)this.setCompressedImage(b.compressedImage,b.containerFormat,b.compressedSrc);else if(b.compressedSrc){this._core.compressedSrc=b.compressedSrc;var h;if("dds"===b.containerFormat)h=this._parseDDS;else{if("pvr"!==b.containerFormat)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"Compressed textures require containerFormat parameter to be 'dds' or 'pvr'");h=this._parsePVR}SceneJS._loadBinary(b.compressedSrc,h.bind(this))}else b.image?this._setTextureImage(b.image):b.src?(this._core.src=b.src,this._loadTexture(b.src,b.preloadSrc)):b.target&&this.getScene().getNode(b.target,function(a){c.setTarget(a)});this._core.webglRestored=a(this,this._core,b.preloadColor,b.containerFormat)}},SceneJS.TextureMap.prototype._initTexture=function(a){var b=this._engine.canvas.gl;a=a||{r:.57735,g:.57735,b:.57735},a.a=void 0===a.a?1:a.a,a=new Uint8Array([Math.floor(255*a.r),Math.floor(255*a.g),Math.floor(255*a.b),Math.floor(255*a.a)]);var c=b.createTexture();b.bindTexture(b.TEXTURE_2D,c),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,1,1,0,b.RGBA,b.UNSIGNED_BYTE,a),this._setCoreTexture(c)},SceneJS.TextureMap.prototype._loadTexture=function(a,b){var c=this,d=SceneJS_sceneStatusModule.taskStarted(this,"Loading texture"),e=new Image,f=!1,g=!1;if(b){var h=new Image;h.onload=function(){f||(c._setTextureImage(h),SceneJS_sceneStatusModule.taskFinished(d),g=!0,c._engine.display.imageDirty=!0)},h.src=b}e.onload=function(){c._setTextureImage(e),g||SceneJS_sceneStatusModule.taskFinished(d),f=!0,c._engine.display.imageDirty=!0},e.onerror=function(){SceneJS_sceneStatusModule.taskFailed(d)},e.src=a},SceneJS.TextureMap.prototype._setTextureImage=function(a){var b=this._engine.canvas.gl,c=this._core,d=c.texture&&c.texture.texture?c.texture.texture:b.createTexture();b.bindTexture(b.TEXTURE_2D,d);var e=SceneJS_configsModule.configs.maxTextureSize;e&&(a=SceneJS._webgl.clampImageSize(a,e)),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,SceneJS._webgl.ensureImageSizePowerOfTwo(a)),this._setCoreTexture(d),this._gatherStats(a.width,a.height,a.width*a.height*4)},SceneJS.TextureMap.prototype._setCompressedTextureImage=function(a,b,c,d,e,f){var g=this._engine.canvas.gl,h=this._core,i=h.texture&&h.texture.texture?h.texture.texture:g.createTexture(),k=SceneJS._getExtension(g,b);if(!k)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Compressed texture format "+b+"not available.");g.bindTexture(g.TEXTURE_2D,i);var l=0;this._core.width=d,this._core.height=e,this._core.mipMapLevels=f,this._core.compressed=!0;for(var m=j.SIZE_FUNCTIONS[c],n=d,o=e,p=0;f>p;++p){var q=m(n,o),r=new Uint8Array(a.buffer,a.byteOffset+l,q);g.compressedTexImage2D(g.TEXTURE_2D,p,c,n,o,0,r),n/=2,o/=2,l+=q}this._setCoreTexture(i),this._gatherStats(d,e,a.byteLength)},SceneJS.TextureMap.prototype._gatherStats=function(a,b,c){this._engine.stats.memory.textures+=c;var d=this._engine.stats.textures,e=a+"x"+b,f=this._getTextureTarget(),g=d[f]=d[f]||{};g[e]=(g[e]||0)+1,g.memory=(g.memory||0)+c},SceneJS.TextureMap.prototype._setCoreTexture=function(a){var b=this._engine.canvas.gl,c=this._core.compressed&&1===this._core.mipMapLevels?b.LINEAR:b.LINEAR_MIPMAP_NEAREST;this._core.texture=new SceneJS._webgl.Texture2D(b,{texture:a,minFilter:this._getGLOption("minFilter",c),magFilter:this._getGLOption("magFilter",b.LINEAR),wrapS:this._getGLOption("wrapS",b.REPEAT),wrapT:this._getGLOption("wrapT",b.REPEAT),compressed:this._core.compressed,update:null}),this.destroyed&&this._core.texture.destroy(),this._engine.display.imageDirty=!0},SceneJS.TextureMap.prototype._getTextureTarget=function(){var a=this._core.flags;return a&m.baseColor?"baseColor":a&m.normals?"normals":a&m.alpha?"alpha":a&m.specular?"specular":a&m.emit?"emit":a&m.shine?"shine":void 0},SceneJS.TextureMap.prototype._getGLOption=function(a,b){var c=this._engine.canvas.gl,d=this._core[a];if(void 0==d)return b;var e=SceneJS._webgl.enumMap[d];if(void 0==e)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Unrecognised value for texture node property '"+a+"' value: '"+d+"'");return c[e]},SceneJS.TextureMap.prototype._getOption=function(a,b){return void 0==a?b:a},SceneJS.TextureMap.prototype.setSrc=function(a){this._core.image=null,this._core.src=a,this._core.target=null,this._loadTexture(a)},SceneJS.TextureMap.prototype.setImage=function(a){this._core.src=null,this._core.target=null,this._setTextureImage(a)},SceneJS.TextureMap.prototype.setCompressedImage=function(a,b,c){this._core.src=null,this._core.image=null,this._core.target=null,this._core.compressedSrc=c,"dds"===b?this._parseDDS(a):this._parsePVR(a)},SceneJS.TextureMap.prototype.setTarget=function(a){return"colorTarget"!=a.type&&"depthTarget"!=a.type?void console.log("Target node type not compatible: "+a.type):(delete this._core.src,this._core.target=a,this._core.src=null,this._core.image=null,this._core.texture=a._core.renderBuf.getTexture(),this._core.texture.bufType=a._core.bufType,void(this._engine.display.imageDirty=!0))},SceneJS.TextureMap.prototype.setBlendFactor=function(a){this._core.blendFactor=a,this._engine.display.imageDirty=!0},SceneJS.TextureMap.prototype.getBlendFactor=function(){return this._core.blendFactor},SceneJS.TextureMap.prototype.setTranslate=function(a){this._core.translate||(this._core.translate={x:0,y:0}),this._core.translate.x=a.x,this._core.translate.y=a.y,this._core._matrixDirty=!0,this._engine.display.imageDirty=!0},SceneJS.TextureMap.prototype.getTranslate=function(){return this._core.translate},SceneJS.TextureMap.prototype.setScale=function(a){this._core.scale||(this._core.scale={x:0,y:0}),this._core.scale.x=a.x,this._core.scale.y=a.y,this._core._matrixDirty=!0,this._engine.display.imageDirty=!0},SceneJS.TextureMap.prototype.getScale=function(){return this._core.scale},SceneJS.TextureMap.prototype.setRotate=function(a){this._core.rotate=a,this._core._matrixDirty=!0,this._engine.display.imageDirty=!0},SceneJS.TextureMap.prototype.getRotate=function(){return this._core.rotate},SceneJS.TextureMap.prototype.getMatrix=function(){return this._core._matrixDirty&&this._core.buildMatrix.call(this.core)(),this.core.matrix},SceneJS.TextureMap.prototype._compile=function(a){this.__core||(this.__core=this._engine._coreFactory.getCore("texture"),this.__core.transparent=!1);var b=this._engine.display.texture;this._core.empty||(this.__core.layers=b&&b.layers?b.layers.concat([this._core]):[this._core],this.__core.transparent=this._core.isAlphaMap||b.transparent),this._makeHash(this.__core),h[i++]=this.__core,this._engine.display.texture=this.__core,this._compileNodes(a),this._engine.display.texture=--i>0?h[i-1]:g,h[i]=null},SceneJS.TextureMap.prototype._makeHash=function(a){var b;if(a.layers&&a.layers.length>0){for(var c,d=a.layers,e=[],f=0,g=d.length;g>f;f++)c=d[f],e.push("/"),e.push(c.uvLayerIdx),e.push("/"),e.push(c.flags),c.matrix&&e.push("/anim");b=e.join("")}else b="";a.hash!=b&&(a.hash=b)},SceneJS.TextureMap.prototype._destroy=function(){1==this._core.useCount&&(this._core.texture&&!this._core.target&&(this._core.texture.destroy(),this._core.texture=null),this._engine.stats.memory.textures--),this._core&&this._engine._coreFactory.putCore(this._core)},SceneJS.TextureMap.prototype._parseDDS=function(a){if(!k)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"DXT compressed textures not supported on this platform.");var b=new Uint32Array(a,0,k.HEADER_LENGTH);if(b[k.MAGIC_NUMBER_INDEX]!=k.MAGIC_NUMBER)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Invalid DDS File: Magic number invalid.");if(b[k.PIXEL_FORMAT_FLAGS_INDEX]&0===k.PIXEL_FORMAT_FOURCC_FLAG)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Invalid DDS File: FourCC required.");var c=k.FOURCC_MAP[b[k.PIXEL_FORMAT_FOURCC_INDEX]],d=k.EXTENSION_MAP[b[k.PIXEL_FORMAT_FOURCC_INDEX]],e=1;b[k.FLAGS_INDEX]&k.MIPMAPCOUNT_FLAG&&(e=b[k.MIPMAPCOUNT_INDEX]);var f=b[k.WIDTH_INDEX],g=b[k.HEIGHT_INDEX],h=new Uint8Array(a,k.DATA_OFFSET);this._setCompressedTextureImage(h,d,c,f,g,e)},SceneJS.TextureMap.prototype._parsePVR=function(a){var b=new Uint32Array(a,0,l.HEADER_LENGTH);if(b[l.MAGIC_NUMBER_INDEX]!=l.MAGIC_NUMBER)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Invalid PVR File: Magic number invalid.");var c=b[l.PIXEL_FORMAT_INDEX],d=l.EXTENSION_MAP[c],e=l.FORMAT_MAP[c],f=b[l.MIPMAPCOUNT_INDEX],g=b[l.WIDTH_INDEX],h=b[l.HEIGHT_INDEX],i=l.HEADER_SIZE+b[l.METADATA_SIZE_INDEX],j=new Uint8Array(a,i);this._setCompressedTextureImage(j,d,e,g,h,f)},function(){function a(a){var b=SceneJS._getExtension(a,"WEBGL_compressed_texture_pvrtc"),g=SceneJS._getExtension(a,"WEBGL_compressed_texture_etc1"),h=SceneJS._getExtension(a,"WEBGL_compressed_texture_s3tc"),i={PVRTC_SUPPORTED:!!b,ETC1_SUPPORTED:!!g,DXT_SUPPORTED:!!h,FORMAT_ENUMS:{},SIZE_FUNCTIONS:{}};return i.PVRTC_SUPPORTED&&(i.FORMAT_ENUMS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,i.FORMAT_ENUMS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,i.FORMAT_ENUMS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,i.FORMAT_ENUMS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,i.SIZE_FUNCTIONS[b.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]=c,i.SIZE_FUNCTIONS[b.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]=c,i.SIZE_FUNCTIONS[b.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]=d,i.SIZE_FUNCTIONS[b.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]=d),i.ETC1_SUPPORTED&&(i.FORMAT_ENUMS.COMPRESSED_RGB_ETC1_WEBGL=g.COMPRESSED_RGB_ETC1_WEBGL,i.SIZE_FUNCTIONS[g.COMPRESSED_RGB_ETC1_WEBGL]=e),i.DXT_SUPPORTED&&(i.FORMAT_ENUMS.COMPRESSED_RGB_S3TC_DXT1_EXT=h.COMPRESSED_RGB_S3TC_DXT1_EXT,i.FORMAT_ENUMS.COMPRESSED_RGBA_S3TC_DXT3_EXT=h.COMPRESSED_RGBA_S3TC_DXT3_EXT,i.FORMAT_ENUMS.COMPRESSED_RGBA_S3TC_DXT5_EXT=h.COMPRESSED_RGBA_S3TC_DXT5_EXT,i.SIZE_FUNCTIONS[h.COMPRESSED_RGB_S3TC_DXT1_EXT]=e,i.SIZE_FUNCTIONS[h.COMPRESSED_RGBA_S3TC_DXT3_EXT]=f,i.SIZE_FUNCTIONS[h.COMPRESSED_RGBA_S3TC_DXT5_EXT]=f),i}function g(){var a={MAGIC_NUMBER:542327876,MIPMAPCOUNT_FLAG:131072,PIXEL_FORMAT_FOURCC_FLAG:4,HEADER_LENGTH:31,MAGIC_NUMBER_INDEX:0,SIZE_INDEX:1,FLAGS_INDEX:2,HEIGHT_INDEX:3,WIDTH_INDEX:4,MIPMAPCOUNT_INDEX:7,PIXEL_FORMAT_FLAGS_INDEX:20,PIXEL_FORMAT_FOURCC_INDEX:21,DATA_OFFSET:128,FOURCC_MAP:{},EXTENSION_MAP:{}};if(j.DXT_SUPPORTED){var c=b("DXT1"),d=b("DXT3"),e=b("DXT5");a.FOURCC_MAP[c]=j.FORMAT_ENUMS.COMPRESSED_RGB_S3TC_DXT1_EXT,a.FOURCC_MAP[d]=j.FORMAT_ENUMS.COMPRESSED_RGBA_S3TC_DXT3_EXT,a.FOURCC_MAP[e]=j.FORMAT_ENUMS.COMPRESSED_RGBA_S3TC_DXT5_EXT,a.EXTENSION_MAP[c]="WEBGL_compressed_texture_s3tc",a.EXTENSION_MAP[d]="WEBGL_compressed_texture_s3tc",a.EXTENSION_MAP[e]="WEBGL_compressed_texture_s3tc"}if(j.ETC1_SUPPORTED){var f=b("ETC1");a.FOURCC_MAP[f]=j.FORMAT_ENUMS.COMPRESSED_RGB_ETC1_WEBGL,a.EXTENSION_MAP[f]="WEBGL_compressed_texture_etc1"}return a}function h(){var a={MAGIC_NUMBER:55727696,HEADER_LENGTH:13,HEADER_SIZE:52,MAGIC_NUMBER_INDEX:0,PIXEL_FORMAT_INDEX:2,HEIGHT_INDEX:6,WIDTH_INDEX:7,MIPMAPCOUNT_INDEX:11,METADATA_SIZE_INDEX:12,EXTENSION_MAP:{0:"WEBGL_compressed_texture_pvrtc",1:"WEBGL_compressed_texture_pvrtc",2:"WEBGL_compressed_texture_pvrtc",3:"WEBGL_compressed_texture_pvrtc",6:"WEBGL_compressed_texture_etc1",7:"WEBGL_compressed_texture_s3tc",9:"WEBGL_compressed_texture_s3tc",11:"WEBGL_compressed_texture_s3tc"},FORMAT_MAP:{}};return j.PVRTC_SUPPORTED&&(a.FORMAT_MAP[0]=j.FORMAT_ENUMS.COMPRESSED_RGB_PVRTC_2BPPV1_IMG,a.FORMAT_MAP[1]=j.FORMAT_ENUMS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,a.FORMAT_MAP[2]=j.FORMAT_ENUMS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG,a.FORMAT_MAP[3]=j.FORMAT_ENUMS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG),j.ETC1_SUPPORTED&&(a.FORMAT_MAP[6]=j.FORMAT_ENUMS.COMPRESSED_RGB_ETC1_WEBGL),j.DXT_SUPPORTED&&(a.FORMAT_MAP[7]=j.FORMAT_ENUMS.COMPRESSED_RGB_S3TC_DXT1_EXT,a.FORMAT_MAP[9]=j.FORMAT_ENUMS.COMPRESSED_RGBA_S3TC_DXT3_EXT,a.FORMAT_MAP[11]=j.FORMAT_ENUMS.COMPRESSED_RGBA_S3TC_DXT5_EXT),a}var i=document.createElement("canvas");if(i){var m=i.getContext("webgl")||i.getContext("experimental-webgl");m&&(j=a(m),k=g(),l=h())}}()},new function(){var a={type:"fresnel",stateId:SceneJS._baseStateId++,centerBias:1,edgeBias:0,power:1,centerColor:new Float32Array([1,1,1]),edgeColor:new Float32Array([0,0,0]),empty:!0,hash:""};SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.fresnel=a,c=0});var b=[],c=0;SceneJS.Fresnel=SceneJS_NodeFactory.createNodeType("fresnel"),SceneJS.Fresnel.prototype._init=function(a){if(1==this._core.useCount){if(a.applyTo&&"color"!=a.applyTo&&"specular"!=a.applyTo&&"alpha"!=a.applyTo&&"reflect"!=a.applyTo&&"emit"!=a.applyTo&&"fragment"!=a.applyTo)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"fresnel applyTo value is unsupported - should be either 'color', 'specular', 'alpha', 'reflect', 'emit' or 'fragment'");this._core.applyTo=a.applyTo,this.setCenterBias(a.centerBias),this.setEdgeBias(a.edgeBias),this.setPower(a.power),this.setCenterColor(a.centerColor),this.setEdgeColor(a.edgeColor)}},SceneJS.Fresnel.prototype.getApplyTo=function(){return this._core.applyTo},SceneJS.Fresnel.prototype.setCenterBias=function(b){this._core.centerBias=void 0!==b&&null!==b?b:a.centerBias,this._engine.display.imageDirty=!0},SceneJS.Fresnel.prototype.getCenterBias=function(){return this._core.centerBias},SceneJS.Fresnel.prototype.setEdgeBias=function(b){this._core.edgeBias=void 0!==b&&null!==b?b:a.edgeBias,this._engine.display.imageDirty=!0},SceneJS.Fresnel.prototype.getEdgeBias=function(){return this._core.edgeBias},SceneJS.Fresnel.prototype.setPower=function(b){this._core.power=void 0!==b&&null!==b?b:a.power,this._engine.display.imageDirty=!0},SceneJS.Fresnel.prototype.getPower=function(){return this._core.power},SceneJS.Fresnel.prototype.setCenterColor=function(b){var c=a.centerColor;return this._core.centerColor=b?new Float32Array([void 0!=b.r&&null!=b.r?b.r:c[0],void 0!=b.g&&null!=b.g?b.g:c[1],void 0!=b.b&&null!=b.b?b.b:c[2]]):a.centerColor,this._engine.display.imageDirty=!0,this},SceneJS.Fresnel.prototype.getCenterColor=function(){return{r:this._core.centerColor[0],g:this._core.centerColor[1],b:this._core.centerColor[2]}},SceneJS.Fresnel.prototype.setEdgeColor=function(b){var c=a.edgeColor;return this._core.edgeColor=b?new Float32Array([void 0!=b.r&&null!=b.r?b.r:c[0],void 0!=b.g&&null!=b.g?b.g:c[1],void 0!=b.b&&null!=b.b?b.b:c[2]]):a.edgeColor,this._engine.display.imageDirty=!0,this},SceneJS.Fresnel.prototype.getEdgeColor=function(){return{r:this._core.edgeColor[0],g:this._core.edgeColor[1],b:this._core.edgeColor[2]}},SceneJS.Fresnel.prototype._compile=function(d){this.__core||(this.__core=this._engine._coreFactory.getCore("fresnel"),this.__core.transparent=!1);var e=this._engine.display.fresnel;this._core.empty||(this.__core.diffuse="color"==this._core.applyTo?this._core:e.diffuse,this.__core.specular="specular"==this._core.applyTo?this._core:e.specular,this.__core.alpha="alpha"==this._core.applyTo?this._core:e.alpha,this.__core.reflect="reflect"==this._core.applyTo?this._core:e.reflect,this.__core.emit="emit"==this._core.applyTo?this._core:e.emit,this.__core.fragment="fragment"==this._core.applyTo?this._core:e.fragment,this.__core.transparent="alpha"==this._core.applyTo||e.transparent),this._makeHash(this.__core),b[c++]=this.__core,this._engine.display.fresnel=this.__core,this._compileNodes(d),this._engine.display.fresnel=--c>0?b[c-1]:a,b[c]=null},SceneJS.Fresnel.prototype._makeHash=function(a){var b=[];a.diffuse&&b.push("d;"),a.specular&&b.push("s;"),a.alpha&&b.push("a;"),a.reflect&&b.push("r;"),a.emit&&b.push("e;"),a.fragment&&b.push("f;"),b=b.join(""),a.hash!=b&&(a.hash=b)},SceneJS.Fresnel.prototype._destroy=function(){this._core&&this._engine._coreFactory.putCore(this._core)}},function(){var a={type:"cubemap",stateId:SceneJS._baseStateId++,empty:!0,texture:null,hash:""},b=[],c=0;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(b){b.engine.display.cubemap=a,c=0}),SceneJS.Reflect=SceneJS_NodeFactory.createNodeType("reflect"),SceneJS.Reflect.prototype._init=function(a){if(1==this._core.useCount){if(this._core.hash="y",a.blendMode&&"add"!=a.blendMode&&"multiply"!=a.blendMode)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"reflection blendMode value is unsupported - should be either 'add' or 'multiply'");this._core.blendMode=a.blendMode||"multiply",this._core.intensity=void 0!=a.intensity&&null!=a.intensity?a.intensity:1,this._core.applyTo="reflect";for(var b=this,c=this._engine.canvas.gl,d=c.createTexture(),e=[c.TEXTURE_CUBE_MAP_POSITIVE_X,c.TEXTURE_CUBE_MAP_NEGATIVE_X,c.TEXTURE_CUBE_MAP_POSITIVE_Y,c.TEXTURE_CUBE_MAP_NEGATIVE_Y,c.TEXTURE_CUBE_MAP_POSITIVE_Z,c.TEXTURE_CUBE_MAP_NEGATIVE_Z],f=[],g=SceneJS_sceneStatusModule.taskStarted(this,"Loading reflection texture"),h=!1,i=0;i<e.length;i++){var j=new Image;j.onload=function(){var a=j;return function(){if(!h&&(f.push(a),f.length==e.length)){c.bindTexture(c.TEXTURE_CUBE_MAP,d),c.pixelStorei(c.UNPACK_FLIP_Y_WEBGL,!1);for(var i=0,j=f.length;j>i;i++)c.texImage2D(e[i],0,c.RGBA,c.RGBA,c.UNSIGNED_BYTE,SceneJS._webgl.ensureImageSizePowerOfTwo(f[i]));b._core.texture=new SceneJS._webgl.Texture2D(c,{texture:d,target:c.TEXTURE_CUBE_MAP,minFilter:c.LINEAR,magFilter:c.LINEAR,wrapS:c.CLAMP_TO_EDGE,wrapT:c.CLAMP_TO_EDGE}),SceneJS_sceneStatusModule.taskFinished(g),b._engine.display.imageDirty=!0}}}(),j.onerror=function(){h=!0,SceneJS_sceneStatusModule.taskFailed(g)},j.src=a.src[i]}}},SceneJS.Reflect.prototype._compile=function(d){this.__core||(this.__core=this._engine._coreFactory.getCore("cubemap"));var e=this._engine.display.cubemap;this._core.empty||(this.__core.layers=e&&e.layers?e.layers.concat([this._core]):[this._core]),this._makeHash(this.__core),b[c++]=this.__core,this._engine.display.cubemap=this.__core,this._compileNodes(d),this._engine.display.cubemap=--c>0?b[c-1]:a,b[c]=null},SceneJS.Reflect.prototype._makeHash=function(a){var b;if(a.layers&&a.layers.length>0){for(var c,d=a.layers,e=[],f=0,g=d.length;g>f;f++)c=d[f],e.push("/"),e.push(c.applyTo),e.push("/"),e.push(c.blendMode);b=e.join("")}else b="";a.hash!=b&&(a.hash=b)},SceneJS.Reflect.prototype._destroy=function(){1==this._core.useCount&&this._core.texture&&(this._core.texture.destroy(),this._core.texture=null),this._core&&this._engine._coreFactory.putCore(this._core)}}(),new function(){var a={type:"regionMap",stateId:SceneJS._baseStateId++,empty:!0,texture:null,regionColor:[-1,-1,-1],highlightFactor:[1.5,1.5,0],hideAlpha:0,regionData:[],mode:"info",hash:""};SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(c){c.engine.display.regionMap=a,b=0});var b=0,c={info:!0,highlight:!0,hide:!0,isolate:!0};SceneJS.RegionMap=SceneJS_NodeFactory.createNodeType("regionMap"),SceneJS.RegionMap.prototype._init=function(a){var b=this;if(1==this._core.useCount){SceneJS._apply({regionMap:null},this._core);var c=a.applyFrom||"uv";if("uv"!==c.substring(0,2))throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"texture applyFrom value is unsupported - should be 'uv<index>'");var d=0;if("uv"!==c&&(d=c.substring(2),isNaN(d)))throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"texture applyFrom value invalid - should be 'uv<index>'");this._core.uvLayerIdx=d,a.src?(this._initTexture(),this._core.src=a.src,this._loadTexture(a.src)):a.image?(this._initTexture(a.preloadColor),this._core.image=a.image,this._setTextureImage(a.image)):a.target&&this.getScene().getNode(a.target,function(a){b.setTarget(a)}),this._core.webglRestored=function(){b._core.image?(b._initTexture(),b._setTextureImage(b._core.image)):b._core.src?(b._initTexture(),b._loadTexture(b._core.src)):b._core.target},this.setRegionColor(a.regionColor),this.setHighlightFactor(a.highlightFactor),this.setHideAlpha(a.hideAlpha),this.setRegionData(a.regionData),this.setMode(a.mode)}},SceneJS.RegionMap.prototype._initTexture=function(){var a=this._engine.canvas.gl,b={r:.57735,g:.57735,b:.57735};b.a=void 0===b.a?1:b.a,b=new Uint8Array([Math.floor(255*b.r),Math.floor(255*b.g),Math.floor(255*b.b),Math.floor(255*b.a)]);var c=a.createTexture();a.bindTexture(a.TEXTURE_2D,c),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,1,1,0,a.RGBA,a.UNSIGNED_BYTE,b),this._setCoreTexture(c)},SceneJS.RegionMap.prototype._loadTexture=function(a){var b=this,c=SceneJS_sceneStatusModule.taskStarted(this,"Loading texture"),d=new Image,e=!1,f=!1;d.onload=function(){b._setTextureImage(d),f||SceneJS_sceneStatusModule.taskFinished(c),e=!0,b._engine.display.imageDirty=!0},d.onerror=function(){SceneJS_sceneStatusModule.taskFailed(c)},this._fetchImage(d,a)},SceneJS.RegionMap.prototype._fetchImage=function(a,b){0==b.indexOf("data")?a.src=b:(a.crossOrigin="Anonymous",a.src=b)},SceneJS.RegionMap.prototype._setTextureImage=function(a){var b=this._engine.canvas.gl,c=this._core.texture?this._core.texture.texture:b.createTexture();b.bindTexture(b.TEXTURE_2D,c),b.texImage2D(b.TEXTURE_2D,0,b.RGBA,b.RGBA,b.UNSIGNED_BYTE,SceneJS._webgl.ensureImageSizePowerOfTwo(a)),this._core.image=a,this._setCoreTexture(c)},SceneJS.RegionMap.prototype._setCoreTexture=function(a){var b=this._engine.canvas.gl;this._core.texture=new SceneJS._webgl.Texture2D(b,{texture:a,minFilter:this._getGLOption("minFilter",b.NEAREST_MIPMAP_NEAREST),magFilter:this._getGLOption("magFilter",b.NEAREST),wrapS:this._getGLOption("wrapS",b.REPEAT),wrapT:this._getGLOption("wrapT",b.REPEAT),isDepth:this._getOption(this._core.isDepth,!1),depthMode:this._getGLOption("depthMode",b.LUMINANCE),depthCompareMode:this._getGLOption("depthCompareMode",b.COMPARE_R_TO_TEXTURE),depthCompareFunc:this._getGLOption("depthCompareFunc",b.LEQUAL),flipY:this._getOption(this._core.flipY,!0),width:this._getOption(this._core.width,1),height:this._getOption(this._core.height,1),internalFormat:this._getGLOption("internalFormat",b.ALPHA),sourceFormat:this._getGLOption("sourceFormat",b.ALPHA),sourceType:this._getGLOption("sourceType",b.UNSIGNED_BYTE),update:null}),this.destroyed&&this._core.texture.destroy(),this._engine.display.imageDirty=!0},SceneJS.RegionMap.prototype._getGLOption=function(a,b){var c=this._engine.canvas.gl,d=this._core[a];if(void 0==d)return b;var e=SceneJS._webgl.enumMap[d];if(void 0==e)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"Unrecognised value for texture node property '"+a+"' value: '"+d+"'");return c[e]},SceneJS.RegionMap.prototype._getOption=function(a,b){return void 0==a?b:a},SceneJS.RegionMap.prototype.setSrc=function(a){this._core.image=null,this._core.src=a,this._core.target=null,this._loadTexture(a)},SceneJS.RegionMap.prototype.setImage=function(a){this._core.image=a,this._core.src=null,this._core.target=null,this._setTextureImage(a)},SceneJS.RegionMap.prototype.setTarget=function(a){return"colorTarget"!=a.type&&"depthTarget"!=a.type?void console.log("Target node type not compatible: "+a.type):(delete this._core.src,this._core.target=a,this._core.src=null,this._core.image=null,this._core.texture=a._core.renderBuf.getTexture(),this._core.texture.bufType=a._core.bufType,void(this._engine.display.imageDirty=!0))},SceneJS.RegionMap.prototype.setRegionColor=function(b){var c=a.regionColor;return this._core.regionColor=b?[void 0!=b.r&&null!=b.r?b.r:c[0],void 0!=b.g&&null!=b.g?b.g:c[1],void 0!=b.b&&null!=b.b?b.b:c[2]]:a.regionColor,this._engine.display.imageDirty=!0,this},SceneJS.RegionMap.prototype.setHighlightFactor=function(b){var c=a.highlightFactor;
  return this._core.highlightFactor=b?[void 0!=b.r&&null!=b.r?b.r:c[0],void 0!=b.g&&null!=b.g?b.g:c[1],void 0!=b.b&&null!=b.b?b.b:c[2]]:a.highlightFactor,this._engine.display.imageDirty=!0,this},SceneJS.RegionMap.prototype.setHideAlpha=function(b){return this._core.hideAlpha=void 0!=b?b:a.hideAlpha,this._engine.display.imageDirty=!0,this},SceneJS.RegionMap.prototype.setMode=function(b){var d=!!this._core.transparent;return this._core.mode=b&&c[b]?b:a.mode,this._core.transparent="hide"===this._core.mode||"isolate"===this._core.mode,d!==this._core.transparent&&(this._engine.display.stateOrderDirty=!0),this._engine.branchDirty(this),this._engine.display.imageDirty=!0,this._core.hash="reg-"+b,this},SceneJS.RegionMap.prototype.setRegionData=function(b){return this._core.regionData=b?b:a.regionData,this},SceneJS.RegionMap.prototype._compile=function(a){var b=this._engine.display.regionMap;this._engine.display.regionMap=this._core,this._compileNodes(a),this._engine.display.regionMap=b},SceneJS.RegionMap.prototype._destroy=function(){1==this._core.useCount&&this._core.texture&&!this._core.target&&(this._core.texture.destroy(),this._core.texture=null)}},SceneJS.XForm=SceneJS_NodeFactory.createNodeType("xform"),SceneJS.XForm.prototype._init=function(a){1==this._core.useCount&&(this.setElements(a.elements),this.xformParent=null,this.xformChildren=[])},SceneJS.XForm.prototype.getModelMatrix=function(){return this._core.dirty&&this._core.build(),this._core.matrix},SceneJS.XForm.prototype.getWorldMatrix=function(){return this._core.dirty&&this._core.build(),Array.apply([],this._core.mat)},SceneJS.XForm.prototype.setElements=function(a){if(a=a||mat4.create(),16!=a.length)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.XForm elements should number 16");var b=this._core;if(b.matrix)for(var c=0;16>c;c++)b.matrix[c]=a[c];else b.matrix=a;return b.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.XForm.prototype._compile=function(a){var b,c,d=this._core;for(d.numCores=0,b=0,c=this.xformChildren.length;c>b;b++){var e=this.xformChildren[b];this.branchDirty||e.dirty||(d.cores[d.numCores++]=e._core)}for(b=d.numCores,c=d.cores.length;c>b;b++)d.cores[b]=null;SceneJS_modelXFormStack.push(d),this._compileNodes(a),SceneJS_modelXFormStack.pop()},SceneJS.XForm.prototype._connect=function(){if(!this.xformParent)for(var a=this;a.parent;)if(a=a.parent,a.xformChildren&&this.xformParent!==a){this.xformParent=a,a.xformChildren.push(this);break}},SceneJS.XForm.prototype._disconnect=function(){if(this.xformParent){for(var a=this;a.parent;)if(a=a.parent,this.xformParent===a)return;var b=this.xformParent.xformChildren;b.splice(b.indexOf(this),1),this.xformParent=null}},SceneJS.Matrix=SceneJS_NodeFactory.createNodeType("matrix"),SceneJS.Matrix.prototype._init=function(a){1==this._core.useCount&&(this.setElements(a.elements),this.xformParent=null,this.xformChildren=[])},SceneJS.Matrix.prototype.getModelMatrix=function(){return this._core.dirty&&this._core.build(),this._core.matrix},SceneJS.Matrix.prototype.getWorldMatrix=function(){return this._core.dirty&&this._core.build(),Array.apply([],this._core.mat)},SceneJS.Matrix.prototype.setMatrix=function(a){if(a=a||mat4.create(),16!=a.length)throw SceneJS_error.fatalError(SceneJS.errors.ILLEGAL_NODE_CONFIG,"SceneJS.Matrix elements should number 16");var b=this._core;if(b.matrix)for(var c=0;16>c;c++)b.matrix[c]=a[c];else b.matrix=a;return b.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Matrix.prototype.setElements=SceneJS.Matrix.prototype.setMatrix,SceneJS.Matrix.prototype._compile=function(a){var b=this._core;b.numCores=0;for(var c=0,d=this.xformChildren.length;d>c;c++){var e=this.xformChildren[c];this.branchDirty||e.dirty||(b.cores[b.numCores++]=e._core)}for(c=b.numCores,d=b.cores.length;d>c;c++)b.cores[c]=null;SceneJS_modelXFormStack.push(b),this._compileNodes(a),SceneJS_modelXFormStack.pop()},SceneJS.Matrix.prototype._connect=function(){if(!this.xformParent)for(var a=this;a.parent;)if(a=a.parent,a.xformChildren&&this.xformParent!==a){this.xformParent=a,a.xformChildren.push(this);break}},SceneJS.Matrix.prototype._disconnect=function(){if(this.xformParent){for(var a=this;a.parent;)if(a=a.parent,this.xformParent===a)return;var b=this.xformParent.xformChildren;b.splice(b.indexOf(this),1),this.xformParent=null}},SceneJS.Rotate=SceneJS_NodeFactory.createNodeType("rotate"),SceneJS.Rotate.prototype._init=function(a){if(1==this._core.useCount){this.setMultOrder(a.multOrder),this.setAngle(a.angle),this.setXYZ({x:a.x,y:a.y,z:a.z});var b=this._core;b.matrix=mat4.create(),this._core.buildMatrix=function(){mat4.fromRotation(b.matrix,b.angle*Math.PI/180,[b.x,b.y,b.z])},this.xformParent=null,this.xformChildren=[]}},SceneJS.Rotate.prototype.getModelMatrix=function(){return this._core.dirty&&this._core.build(),this._core.matrix},SceneJS.Rotate.prototype.getWorldMatrix=function(){return this._core.dirty&&this._core.build(),Array.apply([],this._core.mat)},SceneJS.Rotate.prototype.setMultOrder=function(a){if(a=a||"post","post"!=a&&"pre"!=a)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"Illegal multOrder for rotate node - '"+a+"' should be 'pre' or 'post'");this._core.multOrder=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Rotate.prototype.setAngle=function(a){this._core.angle=a||0,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Rotate.prototype.getAngle=function(){return this._core.angle},SceneJS.Rotate.prototype.setXYZ=function(a){a=a||{},this._core.x=a.x||0,this._core.y=a.y||0,this._core.z=a.z||0,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Rotate.prototype.getXYZ=function(){return{x:this._core.x,y:this._core.y,z:this._core.z}},SceneJS.Rotate.prototype.setX=function(a){this._core.x=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Rotate.prototype.getX=function(){return this._core.x},SceneJS.Rotate.prototype.setY=function(a){this._core.y=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Rotate.prototype.getY=function(){return this._core.y},SceneJS.Rotate.prototype.setZ=function(a){this._core.z=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Rotate.prototype.getZ=function(){return this._core.z},SceneJS.Rotate.prototype.incAngle=function(a){this._core.angle+=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Rotate.prototype._compile=function(a){var b=this._core;b.numCores=0;for(var c=0,d=this.xformChildren.length;d>c;c++){var e=this.xformChildren[c];this.branchDirty||e.dirty||(b.cores[b.numCores++]=e._core)}for(c=b.numCores,d=b.cores.length;d>c;c++)b.cores[c]=null;SceneJS_modelXFormStack.push(b),this._compileNodes(a),SceneJS_modelXFormStack.pop()},SceneJS.Rotate.prototype._connect=function(){if(!this.xformParent)for(var a=this;a.parent;)if(a=a.parent,a.xformChildren&&this.xformParent!==a){this.xformParent=a,a.xformChildren.push(this);break}},SceneJS.Rotate.prototype._disconnect=function(){if(this.xformParent){for(var a=this;a.parent;)if(a=a.parent,this.xformParent===a)return;var b=this.xformParent.xformChildren;b.splice(b.indexOf(this),1),this.xformParent=null}},SceneJS.Translate=SceneJS_NodeFactory.createNodeType("translate"),SceneJS.Translate.prototype._init=function(a){if(1==this._core.useCount){this.setMultOrder(a.multOrder),this.setXYZ({x:a.x,y:a.y,z:a.z});var b=this._core;this._core.buildMatrix=function(){mat4.fromTranslation(b.matrix,[b.x,b.y,b.z])},this.xformParent=null,this.xformChildren=[]}},SceneJS.Translate.prototype.getModelMatrix=function(){return this._core.dirty&&this._core.build(),this._core.matrix},SceneJS.Translate.prototype.getWorldMatrix=function(){return this._core.dirty&&this._core.build(),Array.apply([],this._core.mat)},SceneJS.Translate.prototype.setMultOrder=function(a){if(a=a||"post","post"!=a&&"pre"!=a)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"Illegal multOrder for translate node - '"+a+"' should be 'pre' or 'post'");this._core.multOrder=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Translate.prototype.setXYZ=function(a){return a=a||{},this._core.x=a.x||0,this._core.y=a.y||0,this._core.z=a.z||0,this._core.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Translate.prototype.getXYZ=function(){return{x:this._core.x,y:this._core.y,z:this._core.z}},SceneJS.Translate.prototype.setX=function(a){return this._core.x=a,this._core.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Translate.prototype.setY=function(a){return this._core.y=a,this._core.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Translate.prototype.setZ=function(a){return this._core.z=a,this._core.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Translate.prototype.incX=function(a){return this._core.x+=a,this._core.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Translate.prototype.incY=function(a){return this._core.y+=a,this._core.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Translate.prototype.incZ=function(a){return this._core.z+=a,this._core.setDirty(),this._engine.display.imageDirty=!0,this},SceneJS.Translate.prototype.getX=function(){return this._core.x},SceneJS.Translate.prototype.getY=function(){return this._core.y},SceneJS.Translate.prototype.getZ=function(){return this._core.z},SceneJS.Translate.prototype._compile=function(a){var b=this._core;b.numCores=0;for(var c=0,d=this.xformChildren.length;d>c;c++){var e=this.xformChildren[c];this.branchDirty||e.dirty||(b.cores[b.numCores++]=e._core)}for(c=b.numCores,d=b.cores.length;d>c;c++)b.cores[c]=null;SceneJS_modelXFormStack.push(b),this._compileNodes(a),SceneJS_modelXFormStack.pop()},SceneJS.Translate.prototype._connect=function(){if(!this.xformParent)for(var a=this;a.parent;)if(a=a.parent,a.xformChildren&&this.xformParent!==a){this.xformParent=a,a.xformChildren.push(this);break}},SceneJS.Translate.prototype._disconnect=function(){if(this.xformParent){for(var a=this;a.parent;)if(a=a.parent,this.xformParent===a)return;var b=this.xformParent.xformChildren;b.splice(b.indexOf(this),1),this.xformParent=null}},SceneJS.Scale=SceneJS_NodeFactory.createNodeType("scale"),SceneJS.Scale.prototype._init=function(a){if(1==this._core.useCount){this.setMultOrder(a.multOrder),this.setXYZ({x:a.x,y:a.y,z:a.z});var b=this._core;b.matrix=mat4.create(),this._core.buildMatrix=function(){mat4.fromScaling(b.matrix,[b.x,b.y,b.z])},this.xformParent=null,this.xformChildren=[]}},SceneJS.Scale.prototype.getModelMatrix=function(){return this._core.dirty&&this._core.build(),this._core.matrix},SceneJS.Scale.prototype.getWorldMatrix=function(){return this._core.dirty&&this._core.build(),Array.apply([],this._core.mat)},SceneJS.Scale.prototype.setMultOrder=function(a){if(a=a||"post","post"!=a&&"pre"!=a)throw SceneJS_error.fatalError(SceneJS.errors.NODE_CONFIG_EXPECTED,"Illegal multOrder for scale node - '"+a+"' should be 'pre' or 'post'");this._core.multOrder=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Scale.prototype.setXYZ=function(a){a=a||{},this._core.x=void 0==a.x?1:a.x,this._core.y=void 0==a.y?1:a.y,this._core.z=void 0==a.z?1:a.z,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Scale.prototype.getXYZ=function(){return{x:this._core.x,y:this._core.y,z:this._core.z}},SceneJS.Scale.prototype.setX=function(a){this._core.x=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Scale.prototype.setY=function(a){this._core.y=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Scale.prototype.setZ=function(a){this._core.z=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Scale.prototype.getX=function(){return this._core.x},SceneJS.Scale.prototype.getY=function(){return this._core.y},SceneJS.Scale.prototype.getZ=function(){return this._core.z},SceneJS.Scale.prototype.incX=function(a){this._core.x+=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Scale.prototype.incY=function(a){this._core.y+=a,this._core.matrixDirty=!0},SceneJS.Scale.prototype.incZ=function(a){this._core.z+=a,this._core.setDirty(),this._engine.display.imageDirty=!0},SceneJS.Scale.prototype._compile=function(a){var b=this._core;b.numCores=0;for(var c=0,d=this.xformChildren.length;d>c;c++){var e=this.xformChildren[c];this.branchDirty||e.dirty||(b.cores[b.numCores++]=e._core)}for(c=b.numCores,d=b.cores.length;d>c;c++)b.cores[c]=null;SceneJS_modelXFormStack.push(b),this._compileNodes(a),SceneJS_modelXFormStack.pop()},SceneJS.Scale.prototype._connect=function(){if(!this.xformParent)for(var a=this;a.parent;)if(a=a.parent,a.xformChildren&&this.xformParent!==a){this.xformParent=a,a.xformChildren.push(this);break}},SceneJS.Scale.prototype._disconnect=function(){if(this.xformParent){for(var a=this;a.parent;)if(a=a.parent,this.xformParent===a)return;var b=this.xformParent.xformChildren;b.splice(b.indexOf(this),1),this.xformParent=null}};var SceneJS_modelXFormStack=new function(){var a=mat4.create(),b=mat4.create(),c=(mat4.create(),mat4.create()),d={type:"xform",stateId:SceneJS._baseStateId++,matrix:a,mat:b,normalMat:c,parent:null,cores:[],numCores:0,dirty:!1,matrixDirty:!1},e=[],f=0;this.top=d;var g,h=this;SceneJS_events.addListener(SceneJS_events.SCENE_COMPILING,function(){f=0,h.top=d,g=!0}),SceneJS_events.addListener(SceneJS_events.OBJECT_COMPILING,function(a){g&&(a.display.modelTransform=f>0?e[f-1]:d,g=!1)}),this.push=function(a){e[f++]=a,a.parent=this.top,a.dirty=!0,this.top&&(this.top.cores[this.top.numCores++]=a),this.top=a,g=!0},this.pop=function(){this.top=--f>0?e[f-1]:d,e[f]=null,g=!0}};SceneJS.Types=new function(){this.addType=function(a,b){SceneJS_NodeFactory.createNodeType(a,function(a){var c;for(var d in b)if(b.hasOwnProperty(d))switch(c=b[d],d){case"init":case"construct":!function(){var c=b[d];a.prototype._init=function(a){c.call(this,a)},a.prototype._fromPlugin=!0}();break;case"destroy":case"destruct":a.prototype._destroy=c;break;default:a.prototype[d]=c}})},this.hasType=function(a){return!!SceneJS_NodeFactory.nodeTypes[a]}};var SceneJS_Display=function(a,b){this.stats=a||{},this._canvas=b.canvas,this._programFactory=new SceneJS_ProgramFactory(this.stats,{canvas:b.canvas}),this._chunkFactory=new SceneJS_ChunkFactory,this.transparent=b.transparent===!0,this.depthSort=b.depthSort===!0,this.enable=null,this.properties=null,this.layer=null,this.stage=null,this.renderer=null,this.depthBuffer=null,this.stencilBuffer=null,this.colorBuffer=null,this.view=null,this.lights=null,this.material=null,this.texture=null,this.fresnel=null,this.cubemap=null,this.modelTransform=null,this.viewTransform=null,this.projTransform=null,this.regionMap=null,this.renderTarget=null,this.clips=null,this.morphGeometry=null,this.tag=null,this.renderListeners=null,this.shader=null,this.shaderParams=null,this.style=null,this.geometry=null,this._objectFactory=new SceneJS_ObjectFactory,this._objects={},this._ambientColor=[0,0,0,1],this.highlightColor=new Float32Array([1.5,1.5,.5]),this.fogDensity=.01,this.fogStart=0,this.fogEnd=1e3,this.fogMin=0,this.fogMax=1,this.fogColor=new Float32Array([1,1,1]),this.fogEnabled=!1,this.xrayGlassFactor=1,this.xrayMurkiness=.8,this.xrayBGColor=new Float32Array([0,0,.1]),this.fogMode=SceneJS.DISPLAY_FLAGS.FOG_LINEAR,this._objectList=[],this._objectListLen=0,this._objectPickList=[null],this._objectPickListLen=1,this._drawList=[],this._drawListLen=0,this._pickDrawList=[],this._pickDrawListLen=0,this._targetList=[],this._targetListLen=0,this._objectDrawList=[],this._objectDrawListLen=0,this._drawListTransparentIndex=-1,this._frameCtx={pickNames:[],regionData:[],canvas:this._canvas,VAO:null},this._frameCtx.renderListenerCtx=new SceneJS.RenderContext(this._frameCtx),this.objectListDirty=!0,this.stateOrderDirty=!0,this.stateSortDirty=!0,this.drawListDirty=!0,this.imageDirty=!0};SceneJS_Display.prototype.webglRestored=function(){this._programFactory.webglRestored(),this._chunkFactory.webglRestored();var a=this._canvas.gl;this.pickBuf&&this.pickBuf.webglRestored(a),this.imageDirty=!0},SceneJS_Display.prototype.buildObject=function(a){var b=this._objects[a];b||(b=this._objects[a]=this._objectFactory.getObject(a),this.objectListDirty=!0),b.modelTransform=this.modelTransform,b.viewTransform=this.viewTransform,b.projTransform=this.projTransform,b.stage=this.stage,b.renderTarget=this.renderTarget,b.texture=this.texture,b.cubemap=this.cubemap,b.geometry=this.geometry,b.morphGeometry=this.morphGeometry,b.properties=this.properties,b.material=this.material,b.fresnel=this.fresnel,b.regionMap=this.regionMap;var c=[this.geometry.hash,this.clips.hash,this.morphGeometry.hash,this.texture.hash,this.fresnel.hash,this.cubemap.hash,this.lights.hash,this.properties.hash,this.regionMap.hash,this.fogEnabled?"f"+this.fogMode:""].join(";");b.program&&c==b.hash||(b.program&&this._programFactory.putProgram(b.program),b.program=this._programFactory.getProgram(c,this),b.hash=c),this._setChunk(b,0,"program"),this._setChunk(b,1,"xform",this.modelTransform),this._setChunk(b,2,"lookAt",this.viewTransform),this._setChunk(b,3,"camera",this.projTransform),this._setChunk(b,4,"properties",this.properties),this._setChunk(b,5,"style",this.style),this._setChunk(b,6,"depthBuffer",this.depthBuffer),this._setChunk(b,7,"stencilBuffer",this.stencilBuffer),this._setChunk(b,8,"colorBuffer",this.colorBuffer),this._setChunk(b,9,"view",this.view),this._setChunk(b,10,"lights",this.lights),this._setChunk(b,11,"material",this.material),this._setChunk(b,12,"texture",this.texture),this._setChunk(b,13,"regionMap",this.regionMap),this._setChunk(b,14,"fresnel",this.fresnel),this._setChunk(b,15,"cubemap",this.cubemap),this._setChunk(b,16,"clips",this.clips),this._setChunk(b,17,"renderer",this.renderer),this._setChunk(b,18,"geometry",this.morphGeometry,this.geometry),this._setChunk(b,19,"listeners",this.renderListeners),this._setChunk(b,20,"draw",this.geometry),this.stateOrderDirty=!0},SceneJS_Display.prototype._setChunk=function(a,b,c,d,e){var f,g=this._chunkFactory.chunkTypes[c];if(d){if(d.empty){var h=a.chunks[b];return h&&this._chunkFactory.putChunk(h),void(a.chunks[b]=null)}f=g.prototype.programGlobal?"_"+d.stateId:"p"+a.program.id+"_"+d.stateId,e&&(f+="__"+e.stateId)}else f="p"+a.program.id;f=b+"__"+f;var h=a.chunks[b];if(h){if(h.id==f)return;this._chunkFactory.putChunk(h)}a.chunks[b]=this._chunkFactory.getChunk(f,c,a.program,d,e),"lights"==c&&this._setAmbient(d)},SceneJS_Display.prototype._setAmbient=function(a){for(var b,c=a.lights,d=0,e=c.length;e>d;d++)b=c[d],"ambient"==b.mode&&(this._ambientColor[0]=b.color[0],this._ambientColor[1]=b.color[1],this._ambientColor[2]=b.color[2])},SceneJS_Display.prototype.removeObject=function(a){var b=this._objects[a];if(b){this._programFactory.putProgram(b.program),b.program=null,b.hash=null;for(var c,d=0,e=b.chunks.length;e>d;d++)c=b.chunks[d],c&&this._chunkFactory.putChunk(c);this._objectFactory.putObject(b),delete this._objects[a],this.objectListDirty=!0}},SceneJS_Display.prototype.setDepthSort=function(a){this.depthSort=a},SceneJS_Display.prototype.selectTags=function(a){this._tagSelector=a,this.drawListDirty=!0},SceneJS_Display.prototype.prepareScene=function(){this.objectListDirty&&(this._buildObjectList(),this.objectListDirty=!1,this.stateOrderDirty=!0),(this.stateOrderDirty||this.imageDirty&&this.depthSort)&&(this.stateSortDirty=this.stateOrderDirty,this._makeStateSortKeys(),this.stateOrderDirty=!1),this.stateSortDirty&&(this._stateSort(),this.stateSortDirty=!1,this.drawListDirty=!0),this.drawListDirty&&(this._buildDrawList(),this.imageDirty=!0)},SceneJS_Display.prototype.render=function(a){a=a||{},0!=this._canvas.canvas.width&&0!=this._canvas.canvas.height&&(this.imageDirty||a.force)&&(SceneJS_events.fireEvent(SceneJS_events.RENDER,{forced:!!a.force}),this._doDrawList({clear:a.clear!==!1,opaqueOnly:a.opaqueOnly,pass:a.pass}),this.imageDirty=!1,this.pickBufDirty=!0)},SceneJS_Display.prototype._buildObjectList=function(){var a=this._objectListLen;this._objectListLen=0;for(var b in this._objects)this._objects.hasOwnProperty(b)&&(this._objectList[this._objectListLen++]=this._objects[b]);if(a>this._objectListLen)for(i=this._objectListLen;i<a;i++)this._objectList[i]=null},SceneJS_Display.prototype._makeStateSortKeys=function(){for(var a,b=0,c=this._objectListLen;c>b;b++)if(a=this._objectList[b],a.program){var d,e=a.isTransparent();e&&this.depthSort?(d=a.getDepth(),this.stateSortDirty=!0):d=0,a.sortKey1=3e3*(a.stage.priority+1)+1e3*(e?2:1)+(a.properties.layer+1)+1/(d+1),a.sortKey2=1e5*(a.program.id+1)+a.texture.stateId}else a.sortKey1=-1},SceneJS_Display.prototype._stateSort=function(){this._objectList.length=this._objectListLen,this._objectList.sort(this._stateSortObjects)},SceneJS_Display.prototype._stateSortObjects=function(a,b){return a.sortKey1-b.sortKey1||a.sortKey2-b.sortKey2},SceneJS_Display.prototype._logObjectList=function(){console.log("--------------------------------------------------------------------------------------------------"),console.log(this._objectListLen+" objects");for(var a=0,b=this._objectListLen;b>a;a++){var c=this._objectList[a];console.log("SceneJS_Display : object["+a+"] sortKey = "+c.sortKey)}console.log("--------------------------------------------------------------------------------------------------")},SceneJS_Display.prototype._buildDrawList=function(){this._lastStateId=this._lastStateId||[],this._lastPickStateId=this._lastPickStateId||[];var a;for(a=0;25>a;a++)this._lastStateId[a]=null,this._lastPickStateId[a]=null;var b=this._drawListLen,c=this._pickDrawListLen,d=this._objectDrawListLen,e=this._objectPickListLen;this._drawListLen=0,this._pickDrawListLen=0,this._objectDrawListLen=0,this._objectPickListLen=1,this._drawListTransparentIndex=-1;var f,g,h,i,j,k={},l=[],m=[];for(this._tagSelector&&(g=this._tagSelector.mask,h=this._tagSelector.regex),a=0,len=this._objectListLen;a<len;a++)if(f=this._objectList[a],j=f.properties,j.getFlag(SceneJS.PROPERTY_FLAGS.ENABLED)&&(!g||(i=f.tag,!i.tag||(i.mask!=g&&(i.mask=g,i.matches=h.test(i.tag)),i.matches))))if(f.renderTarget.targets)for(var n,o,p,q=f.renderTarget.targets,r=0,s=q.length;s>r;r++)n=q[r],o=n.coreId,p=k[o],p||(p=[],k[o]=p,l.push(p),m.push(this._chunkFactory.getChunk(n.stateId,"renderTarget",f.program,n))),p.push(f);else this._objectDrawList[this._objectDrawListLen++]=f;var p,n,f,t;for(a=0,len=l.length;a<len;a++){p=l[a],n=m[a],this._appendRenderTargetChunk(n);for(var r=0,s=p.length;s>r;r++)f=p[r],t=f.stage&&f.stage.pickable&&f.properties&&f.properties.getFlag(SceneJS.PROPERTY_FLAGS.PICKING),this._appendObjectToDrawLists(f,t)}for(f&&this._appendRenderTargetChunk(this._chunkFactory.getChunk(-1,"renderTarget",f.program,{})),a=0,len=this._objectDrawListLen;a<len;a++)f=this._objectDrawList[a],t=(!f.stage||f.stage&&f.stage.pickable)&&f.properties&&f.properties.getFlag(SceneJS.PROPERTY_FLAGS.PICKING),this._appendObjectToDrawLists(f,t);if(b>this._drawListLen)for(a=this._drawListLen;b>a;a++)this._drawList[a]=null;if(c>this._pickDrawListLen)for(a=this._pickDrawListLen;c>a;a++)this._pickDrawList[a]=null;if(d>this._objectDrawListLen)for(a=this._objectDrawListLen;d>a;a++)this._objectDrawList[a]=null;if(e>this._objectPickListLen)for(a=this._objectPickListLen;e>a;a++)this._objectPickList[a]=null;this.drawListDirty=!1},SceneJS_Display.prototype._appendRenderTargetChunk=function(a){this._drawList[this._drawListLen++]=a},SceneJS_Display.prototype._appendObjectToDrawLists=function(a,b){for(var c,d=a.chunks,e=0,f=d.length;f>e;e++)c=d[e],c&&(c.draw&&(c.unique||"properties"==c.type||this._lastStateId[e]!=c.id)&&(this._drawList[this._drawListLen]=c,this._lastStateId[e]=c.id,this._drawListTransparentIndex<0&&c.core&&c.core.transparent&&(this._drawListTransparentIndex=this._drawListLen),this._drawListLen++),b!==!1&&c.pick&&(c.unique||this._lastPickStateId[e]!=c.id)&&(this._pickDrawList[this._pickDrawListLen++]=c,this._lastPickStateId[e]=c.id));b&&(this._objectPickList[this._objectPickListLen++]=a)},SceneJS_Display.prototype._logDrawList=function(){console.log("--------------------------------------------------------------------------------------------------"),console.log(this._drawListLen+" draw list chunks");for(var a=0,b=this._drawListLen;b>a;a++){var c=this._drawList[a];switch(console.log("[chunk "+a+"] type = "+c.type),c.type){case"draw":console.log("\n");break;case"renderTarget":console.log(" bufType = "+c.core.bufType)}}console.log("--------------------------------------------------------------------------------------------------")},SceneJS_Display.prototype._logPickList=function(){console.log("--------------------------------------------------------------------------------------------------"),console.log(this._pickDrawListLen+" pick list chunks");for(var a=0,b=this._pickDrawListLen;b>a;a++){var c=this._pickDrawList[a];switch(console.log("[chunk "+a+"] type = "+c.type),c.type){case"draw":console.log("\n");break;case"renderTarget":console.log(" bufType = "+c.core.bufType)}}console.log("--------------------------------------------------------------------------------------------------")},function(){var a=vec3.create(),b=vec3.create(),c=mat4.create(),d=mat4.frustum(mat4.create(),-1,1,-1,1,.1,1e4),e=vec3.create(),f=vec3.create(),g=vec3.create(),h=vec3.create(),i=vec3.create(),j=vec3.create(),k=vec3.create(),l=vec3.create(),m=vec3.create(),n=(mat4.create(),mat4.create(),vec4.create()),o=vec4.create(),p=vec3.create(),q=vec3.create(),r=(vec3.create(),vec3.create()),s=(vec2.create(),vec2.create()),t=vec2.create(),u=(vec2.create(),function(){var a=mat4.create(),b=mat4.create(),c=mat4.create(),d=vec4.create(),e=vec4.create();return function(f,g,h,i,j){var k=g.modelTransform.mat,l=g.viewTransform.mat,m=g.projTransform.mat;mat4.multiply(a,l,k),mat4.multiply(b,m,a),mat4.invert(c,b);var n=f.width,o=f.height,p=(h[0]-n/2)/(n/2),q=-(h[1]-o/2)/(o/2);vec4.transformMat4(d,[p,q,-1,1],c),vec3.scale(d,d,1/d[3]),vec4.transformMat4(e,[p,q,1,1],c),vec3.scale(e,e,1/e[3]),i[0]=d[0],i[1]=d[1],i[2]=d[2],vec3.subtract(j,e,d),vec3.normalize(j,j)}}()),v=function(){var a=mat4.create(),b=vec4.create(),c=vec4.create();return function(d,e,f,g,h){var i=d.modelTransform.mat;mat4.invert(a,i),b[0]=e[0],b[1]=e[1],b[2]=e[2],b[3]=1,vec4.transformMat4(c,b,a),g[0]=c[0],g[1]=c[1],g[2]=c[2],vec3.transformMat4(h,f,a)}}();SceneJS_Display.prototype.pick=function(w){if(!(w.canvasPos||!w.rayPick||w.origin&&w.direction))return void console.warn("Incomplete pick parameters");if(0!=this._canvas.canvas.width&&0!=this._canvas.canvas.height){var x=this._canvas.canvas,y=this._canvas.resolutionScaling,z=w.canvasPos;z&&(z=new Float32Array([z[0]*y,z[1]*y]));var A,B,C,D=this.pickBuf,E=null;D||(D=this.pickBuf=new SceneJS._webgl.RenderBuffer({canvas:this._canvas}));var F,G,H,I,J=!w.canvasPos;if(J){F=w.origin||new Float32Array([0,0,0]),G=w.direction||new Float32Array([0,0,1]);var K=vec3.add(p,F,G),L=new Float32Array([0,1,0]);mat4.lookAt(c,F,K,L),H=.5*x.clientWidth,I=.5*x.clientHeight}else H=z[0],I=z[1];this.prepareScene(),this.render(),D.bind(),D.clear(),this._doDrawList({pickObject:!0,clear:!0,pickViewMatrix:J?c:null,pickProjMatrix:J?d:null}),this._canvas.gl.finish();var M=D.read(H,I),N=M[0]+256*M[1]+256*M[2]*256+256*M[3]*256*256;if(A=this._objectPickList[N]){E={canvasPos:z};var O=A.properties;O&&(E.name=O.name,E.nodeId=O.nodeId)}if(w.pickRegion&&(D.clear(),this._doDrawList({pickRegion:!0,object:A,pickViewMatrix:J?c:null,pickProjMatrix:J?d:null,clear:!0}),M=D.read(H,I),0!==M[0]||0!==M[1]||0!==M[2]||0!==M[3])){E=E||{canvasPos:z};var P,Q,R={r:M[0]/255,g:M[1]/255,b:M[2]/255,a:M[3]/255},S=this._frameCtx.regionData,T=.01,U={};for(B=0,C=S.length;C>B;B++)if(P=S[B].color,R&&S[B].data&&(Q=Math.max(Math.abs(R.r-P.r),Math.abs(R.g-P.g),Math.abs(R.b-P.b),Math.abs(R.a-(void 0===P.a?R.a:P.a))),T>Q)){U=S[B].data;break}E.color=R,E.regionData=U}if(w.pickTriangle&&A){D.clear(),this._doDrawList({pickTriangle:!0,object:A,pickViewMatrix:J?c:null,pickProjMatrix:J?d:null,clear:!0}),M=D.read(H,I);var V=M[0]+256*M[1]+256*M[2]*256+256*M[3]*256*256;V*=3,E.primitiveIndex=V;var W=A.geometry,X=W.positionDecodeMat;if("triangles"===W.primitiveName){E.primitive="triangle",J?v(A,F,G,a,b):u(x,A,z,a,b);var Y=W.arrays.indices,Z=Y[V],$=Y[V+1],_=Y[V+2],aa=3*Z,ba=3*$,ca=3*_,da=vec3.create();da[0]=Z,da[1]=$,da[2]=_,E.indices=da;var ea=A.morphGeometry,fa=ea.targets;if(fa&&fa.length>0&&fa[0].positions)this._lerpTargets(ea.keys,ea.targets,"positions",Z,$,_,ea.factor,e,f,g);else{var ga=W.arrays.positions;e[0]=ga[aa],e[1]=ga[aa+1],e[2]=ga[aa+2],f[0]=ga[ba],f[1]=ga[ba+1],f[2]=ga[ba+2],g[0]=ga[ca],g[1]=ga[ca+1],g[2]=ga[ca+2],X&&(vec3.transformMat4(e,e,X),vec3.transformMat4(f,f,X),vec3.transformMat4(g,g,X))}var ha=E.position=SceneJS_math_rayPlaneIntersect(a,b,e,f,g,vec3.create());n.set(ha),n[3]=1,vec4.transformMat4(o,n,A.modelTransform.mat),E.worldPos=SceneJS._sliceArray(o,0,3);var ia=E.barycentric=SceneJS_math_cartesianToBarycentric(ha,e,f,g,vec3.create()),ja=!1;if(fa&&fa.length>0&&fa[0].normals&&(this._lerpTargets(ea.keys,ea.targets,"normals",Z,$,_,ea.factor,h,i,j),ja=!0),!ja){var ka=W.arrays.normals;if(ka){if(W.compressedNormals){{var la=2*Z,ma=2*$,na=2*_;ka.subarray(la,la+2),ka.subarray(ma,ma+2),ka.subarray(na,na+2)}SceneJS_math_octDecodeVec2(ka.subarray(la,la+2),h),SceneJS_math_octDecodeVec2(ka.subarray(ma,ma+2),i),SceneJS_math_octDecodeVec2(ka.subarray(na,na+2),j)}else h[0]=ka[aa],h[1]=ka[aa+1],h[2]=ka[aa+2],i[0]=ka[ba],i[1]=ka[ba+1],i[2]=ka[ba+2],j[0]=ka[ca],j[1]=ka[ca+1],j[2]=ka[ca+2];ja=!0}}ja&&(E.normal=vec3.create(),vec3.scale(E.normal,h,ia[0]),vec3.add(E.normal,E.normal,vec3.scale(q,i,ia[1])),vec3.add(E.normal,E.normal,vec3.scale(r,j,ia[2])));var oa=W.arrays.uvs;if(oa&&oa.length>0){E.uvs=[];var pa,qa,la=2*Z,ma=2*$,na=2*_;for(B=0,C=oa.length;C>B;B++)if(pa=oa[B]){if(k[0]=pa[la],k[1]=pa[la+1],l[0]=pa[ma],l[1]=pa[ma+1],m[0]=pa[na],m[1]=pa[na+1],W.compressedUVs){var ra=W.uvDecodeMats[B];vec2.transformMat3(k,k,ra),vec2.transformMat3(l,l,ra),vec2.transformMat3(m,m,ra)}qa=vec2.create(),vec2.scale(qa,k,ia[0]),vec2.add(qa,qa,vec2.scale(s,l,ia[1])),vec2.add(qa,qa,vec2.scale(t,m,ia[2])),E.uvs.push(qa)}else pa.push(null);oa.length>0&&(E.uv=E.uvs[0])}}}return D.unbind(),E}},SceneJS_Display.prototype._lerpTargets=function(a,b,c,d,e,f,g,h,i,j){for(var k=0;k<a.length;k++)if(a[k]===g){var l=b[k][c],m=3*d,n=3*e,o=3*f;return h[0]=l[m],h[1]=l[m+1],h[2]=l[m+2],i[0]=l[n],i[1]=l[n+1],i[2]=l[n+2],j[0]=l[o],j[1]=l[o+1],void(j[2]=l[o+2])}for(var p=0;a[p]<g;)p++;var q=p-1;this._lerpTargetPair(g,a[q],a[p],b[q][c],b[p][c],d,e,f,h,i,j)};var w=vec3.create(),x=vec3.create(),y=vec3.create(),z=vec3.create(),A=vec3.create(),B=vec3.create();SceneJS_Display.prototype._lerpTargetPair=function(a,b,c,d,e,f,g,h,i,j,k){var l=3*f,m=3*g,n=3*h;w[0]=d[l],w[1]=d[l+1],w[2]=d[l+2],x[0]=d[m],x[1]=d[m+1],x[2]=d[m+2],y[0]=d[n],y[1]=d[n+1],y[2]=d[n+2],z[0]=e[l],z[1]=e[l+1],z[2]=e[l+2],A[0]=e[m],A[1]=e[m+1],A[2]=e[m+2],B[0]=e[n],B[1]=e[n+1],B[2]=e[n+2];var o=(a-b)/(c-b);vec3.lerp(i,w,z,o),vec3.lerp(j,x,A,o),vec3.lerp(k,y,B,o)}}(),SceneJS_Display.prototype._doDrawList=function(a){var b=this._canvas.gl,c=this._frameCtx;c.pass=a.pass||0,c.renderTarget=null,c.targetIndex=0,c.renderBuf=null,c.viewMat=null,c.modelMat=null,c.cameraMat=null,c.renderer=null,c.depthbufEnabled=null,c.clearDepth=null,c.depthFunc=b.LESS,c.stencilbufEnabled=null,c.clearStencil=null,c.highlightColor=this.highlightColor,c.fogDensity=this.fogDensity,c.fogStart=this.fogStart,c.fogEnd=this.fogEnd,c.fogMin=this.fogMin,c.fogMax=this.fogMax,c.fogColor=this.fogColor,c.fogMode=this.fogMode,c.fogEnabled=this.fogEnabled,c.xrayGlassFactor=this.xrayGlassFactor,c.xrayMurkiness=this.xrayMurkiness,c.xrayBGColor=this.xrayBGColor,c.stencilFuncFuncFront=b.ALWAYS,c.stencilFuncRefFront=0,c.stencilFuncMaskFront=255,c.stencilFuncFuncBack=b.ALWAYS,c.stencilFuncRefBack=0,c.stencilFuncMaskBack=255,c.stencilOpSfailFront=b.KEEP,c.stencilOpDpfailFront=b.KEEP,c.stencilOpDppassFront=b.KEEP,c.stencilOpSfailBack=b.KEEP,c.stencilOpDpfailBack=b.KEEP,c.stencilOpDppassBack=b.KEEP,c.scissorTestEnabled=!1,
  c.blendEnabled=!1,c.backfaces=SceneJS.PROPERTY_FLAGS.BACKFACES,c.frontface=SceneJS.PROPERTY_FLAGS.CCW,c.picking=!!a.pickObject||!!a.pickTriangle||!!a.pickRegion,c.pickObject=!!a.pickObject,c.pickTriangle=!!a.pickTriangle,c.pickRegion=!!a.pickRegion,c.pickIndex=1,c.textureUnit=0,c.lineWidth=1,c.transparent=0,c.depthMask=SceneJS.PROPERTY_FLAGS.DEPTH_MASK,c.ambientColor=this._ambientColor,c.aspect=this._canvas.canvas.width/this._canvas.canvas.height,c.texture=null,c.normalMapUVLayerIdx=-1,c.regionMapUVLayerIdx=-1,c.drawElements=0,c.drawArrays=0,c.useProgram=0,c.bindTexture=0,c.bindArray=0,c.pickViewMatrix=a.pickViewMatrix,c.pickProjMatrix=a.pickProjMatrix,SceneJS.WEBGL_INFO.SUPPORTED_EXTENSIONS.OES_element_index_uint&&b.getExtension("OES_element_index_uint");var d=b.getExtension("OES_vertex_array_object");if(c.VAO=d?d:null,b.viewport(0,0,b.drawingBufferWidth,b.drawingBufferHeight),this.transparent||c.picking?b.clearColor(0,0,0,0):b.clearColor(this._ambientColor[0],this._ambientColor[1],this._ambientColor[2],1),a.clear&&b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT),b.frontFace(b.CCW),b.disable(b.CULL_FACE),b.disable(b.BLEND),b.depthMask(!0),a.pickObject){for(var e=0,f=this._pickDrawListLen;f>e;e++)this._pickDrawList[e].pick(c);b.flush()}else if(a.pickRegion||a.pickTriangle){if(a.object)for(var g,h=a.object.chunks,e=0,f=h.length;f>e;e++)g=h[e],g&&g.pick&&g.pick(c);else if(a.pickRegion)for(var e=0,f=this._pickDrawListLen;f>e;e++)this._pickDrawList[e].pick(c);b.flush()}else{for(var f=(Date.now(),a.opaqueOnly&&this._drawListTransparentIndex>=0?this._drawListTransparentIndex:this._drawListLen),e=0;f>e;e++)this._drawList[e].draw(c);b.flush();{Date.now()}this.stats.frame.drawElements=c.drawElements,this.stats.frame.drawArrays=c.drawArrays,this.stats.frame.useProgram=c.useProgram,this.stats.frame.bindTexture=c.bindTexture,this.stats.frame.bindArray=c.bindArray,this.stats.frame.drawChunks=this._drawListLen}if(c.renderBuf&&c.renderBuf.unbind(),c.VAO){c.VAO.bindVertexArrayOES(null);for(var e=0;10>e;e++)b.disableVertexAttribArray(e)}},SceneJS_Display.prototype.readPixels=function(a,b,c){if(0!=this._canvas.canvas.width&&0!=this._canvas.canvas.height){this._readPixelBuf||(this._readPixelBuf=new SceneJS._webgl.RenderBuffer({canvas:this._canvas})),this._readPixelBuf.bind(),this._readPixelBuf.clear(),this.prepareScene(),this.render({force:!0,opaqueOnly:c});for(var d,e,f=0;b>f;f++)d=a[f]||(a[f]={}),e=this._readPixelBuf.read(d.x,d.y),d.r=e[0],d.g=e[1],d.b=e[2],d.a=e[3];this._readPixelBuf.unbind()}},SceneJS_Display.prototype.destroy=function(){this._programFactory.destroy()};var SceneJS_ProgramSourceFactory=new function(){function a(){return l(),m("attribute vec4 SCENEJS_aVertex;"),m("attribute vec4 SCENEJS_aColor;"),m("uniform mat4 SCENEJS_uMMatrix;"),m("uniform mat4 SCENEJS_uVMatrix;"),m("uniform mat4 SCENEJS_uPMatrix;"),I&&m("uniform float SCENEJS_uPointSize;"),K&&m("uniform mat4 SCENEJS_uDecodePositionMatrix;"),m("varying vec4 SCENEJS_vWorldVertex;"),F&&(m("attribute vec2 SCENEJS_aRegionMapUV;"),m("varying vec2 SCENEJS_vRegionMapUV;")),E&&(m("uniform float SCENEJS_uMorphFactor;"),o.morphGeometry.targets[0].vertexBuf&&m("attribute vec4 SCENEJS_aMorphVertex;"),K&&m("uniform mat4 SCENEJS_uDecodeMorphPosMatrix;")),m("varying vec4 SCENEJS_vColor;"),m("void main(void) {"),m(K?"    vec4 modelVertex = SCENEJS_uDecodePositionMatrix * SCENEJS_aVertex;":"    vec4 modelVertex = SCENEJS_aVertex;"),E&&o.morphGeometry.targets[0].vertexBuf&&m(K?"  modelVertex = mix(modelVertex, SCENEJS_uDecodeMorphPosMatrix * SCENEJS_aMorphVertex, SCENEJS_uMorphFactor); ":"  modelVertex = mix(modelVertex, SCENEJS_aMorphVertex, SCENEJS_uMorphFactor); "),m("  SCENEJS_vWorldVertex = SCENEJS_uMMatrix * modelVertex; "),m("mat4 vPosMatrix = SCENEJS_uVMatrix;"),A&&m("vPosMatrix[3].xyz = vec3(0.0);"),m("  gl_Position =  SCENEJS_uPMatrix * (vPosMatrix * SCENEJS_vWorldVertex);"),F&&m("SCENEJS_vRegionMapUV = SCENEJS_aRegionMapUV;"),m("SCENEJS_vColor = SCENEJS_aColor;"),I&&m("gl_PointSize = SCENEJS_uPointSize;"),m("}"),n()}function b(){if(l(),m("precision "+SceneJS.WEBGL_INFO.FS_MAX_FLOAT_PRECISION+" float;"),m("varying vec4 SCENEJS_vWorldVertex;"),m("varying vec4  SCENEJS_vColor;"),m("uniform float  SCENEJS_uPickMode;"),m("uniform vec4  SCENEJS_uPickColor;"),m("uniform bool  SCENEJS_uClipping;"),D)for(var a=0;a<o.clips.clips.length;a++)m("uniform float SCENEJS_uClipMode"+a+";"),m("uniform vec4  SCENEJS_uClipNormalAndDist"+a+";");if(F&&(m("varying vec2 SCENEJS_vRegionMapUV;"),m("uniform sampler2D SCENEJS_uRegionMapSampler;")),m("void main(void) {"),D){m("if (SCENEJS_uClipping) {"),m("  float dist = 0.0;");for(var a=0;a<o.clips.clips.length;a++)m("  if (SCENEJS_uClipMode"+a+" != 0.0) {"),m("      dist += clamp(dot(SCENEJS_vWorldVertex.xyz, SCENEJS_uClipNormalAndDist"+a+".xyz) - SCENEJS_uClipNormalAndDist"+a+".w, 0.0, 1000.0);"),m("  }");m("  if (dist > 0.0) { discard; }"),m("}")}return m("    if  (SCENEJS_uPickMode == 0.0) {"),m("          gl_FragColor = SCENEJS_uPickColor;  "),m("    } else if (SCENEJS_uPickMode == 1.0) {"),m("          gl_FragColor = SCENEJS_vColor;  "),m("    } else {"),m(F?"          gl_FragColor = texture2D(SCENEJS_uRegionMapSampler, vec2(SCENEJS_vRegionMapUV.s, 1.0 - SCENEJS_vRegionMapUV.t));":"          gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);"),m("    }"),m("}"),n()}function c(){return o.regionMap.empty?!1:e()}function d(){return o.texture.layers&&o.texture.layers.length>0?e():!1}function e(){return o.geometry.uvBufs?!0:o.morphGeometry.targets&&(o.morphGeometry.targets[0].uvBuf||o.morphGeometry.targets[0].uvBuf2)?!0:!1}function f(a){return a.properties.getFlag(S.REFLECTIVE)&&a.cubemap.layers&&a.cubemap.layers.length>0&&a.geometry.normalBuf}function g(a){return a.geometry.normalBuf?!0:a.morphGeometry.targets&&a.morphGeometry.targets[0].normalBuf?!0:!1}function h(a){if(a.texture){var b=a.texture.layers;if(!b)return!1;for(var c=0,d=b.length;d>c;c++)if(b[c].flags&R.normals)return!0}return!1}function i(){if(o.renderTarget&&o.renderTarget.targets)for(var a=o.renderTarget.targets,b=0,c=a.length;c>b;b++)if("depth"===a[b].bufType)return!0;return!1}function j(){var a={};if(a.vertex&&a.vertex.code&&""!=a.vertex.code&&SceneJS._isEmpty(a.vertex.hooks))return[a.vertex.code];var b,c,d=a.vertex||{},e=d.hooks||{},f=a.fragment||{},g=f.hooks||{};if(l(),m("uniform mat4 SCENEJS_uMMatrix;"),m(T?"uniform mat4 SCENEJS_uVMatrix;":"uniform mediump mat4 SCENEJS_uVMatrix;"),m("uniform mat4 SCENEJS_uPMatrix;"),m("attribute vec4 SCENEJS_aVertex;"),m(T?"uniform vec3 SCENEJS_uWorldEye;":"uniform mediump vec3 SCENEJS_uWorldEye;"),m("varying vec3 SCENEJS_vViewEyeVec;"),I&&m("uniform float SCENEJS_uPointSize;"),K&&m("uniform mat4 SCENEJS_uDecodePositionMatrix;"),y&&(m("attribute vec3 SCENEJS_aNormal;"),m("uniform   mat4 SCENEJS_uMNMatrix;"),m("varying   vec3 SCENEJS_vViewNormal;"),v&&m("varying   vec3 SCENEJS_vWorldNormal;"),C&&(m("attribute vec3 SCENEJS_aTangent;"),m("varying   vec3 SCENEJS_vTangent;"))),w&&(c=o.geometry.uvBufs))for(var b=0,h=c.length;h>b;b++)c[b]&&(m("attribute vec2 SCENEJS_aUVCoord"+b+";"),M&&m("uniform mat3 SCENEJS_uDecodeUVMatrix"+b+";"));if(o.geometry.colorBuf&&(m("attribute vec4 SCENEJS_aVertexColor;"),m("varying vec4 SCENEJS_vColor;")),(D||y)&&m("varying vec4 SCENEJS_vWorldVertex;"),m("varying vec4 SCENEJS_vViewVertex;"),w&&(c=o.geometry.uvBufs))for(b=0,h=c.length;h>b;b++)c[b]&&m("varying vec2 SCENEJS_vUVCoord"+b+";");if(G&&(m("attribute vec2 SCENEJS_aRegionMapUV;"),m("varying vec2 SCENEJS_vRegionMapUV;")),E&&(m("uniform float SCENEJS_uMorphFactor;"),o.morphGeometry.targets[0].vertexBuf&&m("attribute vec4 SCENEJS_aMorphVertex;"),y&&o.morphGeometry.targets[0].normalBuf&&m("attribute vec3 SCENEJS_aMorphNormal;"),C&&m("attribute vec3 SCENEJS_aMorphTangent;"),K&&m("uniform mat4 SCENEJS_uDecodeMorphPosMatrix;")),d.code&&m("\n"+d.code+"\n"),B&&(m("void billboard(inout mat4 mat) {"),m("   mat[0].xyz = vec3(1.0, 0.0, 0.0);"),m("   mat[1].xyz = vec3(0.0, 1.0, 0.0);"),m("   mat[2].xyz = vec3(0.0, 0.0, 1.0);"),m("}")),L&&(m("vec3 octDecode(vec2 oct) {"),m("    vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));"),m("    if (v.z < 0.0) {"),m("        v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);"),m("    }"),m("    return normalize(v);"),m("}")),m("void main(void) {"),C&&m("vec3 modelTangent = SCENEJS_aTangent;"),m(K?"  vec4 modelVertex = SCENEJS_uDecodePositionMatrix * SCENEJS_aVertex;":"  vec4 modelVertex = SCENEJS_aVertex; "),L?m("  vec4 modelNormal = vec4(octDecode(SCENEJS_aNormal.xy), 0.0); "):y&&m("  vec4 modelNormal = vec4(SCENEJS_aNormal, 0.0); "),E&&(o.morphGeometry.targets[0].vertexBuf&&m(K?"  modelVertex = mix(modelVertex, SCENEJS_uDecodeMorphPosMatrix * SCENEJS_aMorphVertex, SCENEJS_uMorphFactor); ":"  modelVertex = mix(modelVertex, SCENEJS_aMorphVertex, SCENEJS_uMorphFactor); "),y&&o.morphGeometry.targets[0].normalBuf&&m(L?"  modelNormal = vec4( mix(modelNormal.xyz, octDecode(SCENEJS_aMorphNormal.xy), SCENEJS_uMorphFactor), 0.0); ":"  modelNormal = vec4( mix(modelNormal.xyz, SCENEJS_aMorphNormal, SCENEJS_uMorphFactor), 0.0); "),C&&m("  modelTangent = mix(modelTangent, SCENEJS_aMorphTangent, SCENEJS_uMorphFactor); ")),m("mat4 modelMatrix = SCENEJS_uMMatrix;"),m("mat4 viewMatrix = SCENEJS_uVMatrix;"),y&&m("mat4 modelNormalMatrix = SCENEJS_uMNMatrix;"),m("vec4 worldVertex;"),m("vec4 viewVertex;"),A&&m("viewMatrix[3].xyz = vec3(0.0);"),B?(m("   mat4 modelViewMatrix =  viewMatrix * modelMatrix;"),m("   billboard(modelMatrix);"),m("   billboard(viewMatrix);"),m("   billboard(modelViewMatrix);"),y&&m("   billboard(modelNormalMatrix);"),e.viewMatrix&&m("viewMatrix = "+e.viewMatrix+"(viewMatrix);"),m("   worldVertex = modelMatrix * modelVertex;"),m("   viewVertex = modelViewMatrix * modelVertex;")):(e.viewMatrix&&m("viewMatrix = "+e.viewMatrix+"(viewMatrix);"),m("  worldVertex = modelMatrix * modelVertex;"),m("  viewVertex  = viewMatrix * worldVertex; ")),e.viewPos&&m("viewVertex="+e.viewPos+"(viewVertex);"),y&&(m("  vec3 worldNormal = (modelNormalMatrix * modelNormal).xyz; "),m("  SCENEJS_vViewNormal = (viewMatrix * vec4(worldNormal, 0.0)).xyz;"),v&&m("  SCENEJS_vWorldNormal = worldNormal;")),(D||y||g.worldPos)&&m("  SCENEJS_vWorldVertex = worldVertex;"),m("  SCENEJS_vViewVertex = viewVertex;"),m(e.projMatrix?"gl_Position = "+e.projMatrix+"(SCENEJS_uPMatrix) * viewVertex;":"  gl_Position = SCENEJS_uPMatrix * viewVertex;"),C&&(m("modelTangent = normalize((viewMatrix * modelNormalMatrix * vec4(modelTangent, 0.0)).xyz);"),m("vec3 bitangent = cross(SCENEJS_vViewNormal, modelTangent);"),m("mat3 TBM = mat3(modelTangent, bitangent, SCENEJS_vViewNormal);"),m("SCENEJS_vTangent = modelTangent;")),m("SCENEJS_vViewEyeVec = ((viewMatrix * vec4(SCENEJS_uWorldEye, 0.0)).xyz  - viewVertex.xyz);"),C&&m("SCENEJS_vViewEyeVec *= TBM;"),w&&(c=o.geometry.uvBufs))for(b=0,h=c.length;h>b;b++)c[b]&&m(M?"SCENEJS_vUVCoord"+b+" = (SCENEJS_uDecodeUVMatrix"+b+" * vec3(SCENEJS_aUVCoord"+b+", 1.0)).xy;":"SCENEJS_vUVCoord"+b+" = SCENEJS_aUVCoord"+b+";");return o.geometry.colorBuf&&m("SCENEJS_vColor = SCENEJS_aVertexColor;"),G&&m("SCENEJS_vRegionMapUV = SCENEJS_aRegionMapUV;"),I&&m("gl_PointSize = SCENEJS_uPointSize;"),m("}"),n()}function k(){var a={};if(a.fragment&&a.fragment.code&&""!=a.fragment.code&&SceneJS._isEmpty(a.fragment.hooks))return[a.fragment.code];var b=a.fragment||{},c=(b.hooks||{},o.fresnel.diffuse),d=o.fresnel.specular,e=o.fresnel.alpha,f=o.fresnel.reflect,g=o.fresnel.emit,h=o.fresnel.fragment;if(l(),m("precision "+SceneJS.WEBGL_INFO.FS_MAX_FLOAT_PRECISION+" float;"),m("uniform mat4 SCENEJS_uVMatrix;"),(D||y)&&m("varying vec4 SCENEJS_vWorldVertex;"),m("varying vec4 SCENEJS_vViewVertex;"),m("uniform float SCENEJS_uZNear;"),m("uniform float SCENEJS_uZFar;"),m("uniform vec3 SCENEJS_uWorldEye;"),D)for(var i=0;i<o.clips.clips.length;i++)m("uniform float SCENEJS_uClipMode"+i+";"),m("uniform vec4  SCENEJS_uClipNormalAndDist"+i+";");if(w){var j=o.geometry.uvBufs;if(j)for(var i=0,k=j.length;k>i;i++)j[i]&&m("varying vec2  SCENEJS_vUVCoord"+i+";");if(w)for(var p,i=0,k=o.texture.layers.length;k>i;i++)p=o.texture.layers[i],m("uniform sampler2D SCENEJS_uSampler"+i+";"),p.matrix&&m("uniform mat4 SCENEJS_uLayer"+i+"Matrix;"),m("uniform float SCENEJS_uLayer"+i+"BlendFactor;")}if(y&&x)for(var p,i=0,k=o.cubemap.layers.length;k>i;i++)p=o.cubemap.layers[i],m("uniform samplerCube SCENEJS_uCubeMapSampler"+i+";"),m("uniform float SCENEJS_uCubeMapIntensity"+i+";");if(G&&(m("varying vec2 SCENEJS_vRegionMapUV;"),m("uniform sampler2D SCENEJS_uRegionMapSampler;"),m("uniform vec3 SCENEJS_uRegionMapRegionColor;"),m("uniform vec3 SCENEJS_uRegionMapHighlightFactor;"),m("uniform float SCENEJS_uRegionMapHideAlpha;")),m("uniform bool  SCENEJS_uClipping;"),z&&m("uniform vec3  SCENEJS_uSolidColor;"),m("uniform bool  SCENEJS_uDepthMode;"),o.geometry.colorBuf&&m("varying vec4 SCENEJS_vColor;"),m("uniform vec3  SCENEJS_uAmbientColor;"),m("uniform vec3  SCENEJS_uMaterialColor;"),m("uniform vec3  SCENEJS_uMaterialSpecularColor;"),m("uniform vec3  SCENEJS_uMaterialEmitColor;"),m("uniform float SCENEJS_uMaterialSpecular;"),m("uniform float SCENEJS_uMaterialShine;"),m("uniform float SCENEJS_uMaterialAlpha;"),m("uniform float SCENEJS_uMaterialEmit;"),c&&(m("uniform float SCENEJS_uDiffuseFresnelCenterBias;"),m("uniform float SCENEJS_uDiffuseFresnelEdgeBias;"),m("uniform float SCENEJS_uDiffuseFresnelPower;"),m("uniform vec3 SCENEJS_uDiffuseFresnelCenterColor;"),m("uniform vec3 SCENEJS_uDiffuseFresnelEdgeColor;")),d&&(m("uniform float SCENEJS_uSpecularFresnelCenterBias;"),m("uniform float SCENEJS_uSpecularFresnelEdgeBias;"),m("uniform float SCENEJS_uSpecularFresnelPower;"),m("uniform vec3 SCENEJS_uSpecularFresnelCenterColor;"),m("uniform vec3 SCENEJS_uSpecularFresnelEdgeColor;")),e&&(m("uniform float SCENEJS_uAlphaFresnelCenterBias;"),m("uniform float SCENEJS_uAlphaFresnelEdgeBias;"),m("uniform float SCENEJS_uAlphaFresnelPower;"),m("uniform vec3 SCENEJS_uAlphaFresnelCenterColor;"),m("uniform vec3 SCENEJS_uAlphaFresnelEdgeColor;")),f&&(m("uniform float SCENEJS_uReflectFresnelCenterBias;"),m("uniform float SCENEJS_uReflectFresnelEdgeBias;"),m("uniform float SCENEJS_uReflectFresnelPower;"),m("uniform vec3 SCENEJS_uReflectFresnelCenterColor;"),m("uniform vec3 SCENEJS_uReflectFresnelEdgeColor;")),g&&(m("uniform float SCENEJS_uEmitFresnelCenterBias;"),m("uniform float SCENEJS_uEmitFresnelEdgeBias;"),m("uniform float SCENEJS_uEmitFresnelPower;"),m("uniform vec3 SCENEJS_uEmitFresnelCenterColor;"),m("uniform vec3 SCENEJS_uEmitFresnelEdgeColor;")),h&&(m("uniform float SCENEJS_uFragmentFresnelCenterBias;"),m("uniform float SCENEJS_uFragmentFresnelEdgeBias;"),m("uniform float SCENEJS_uFragmentFresnelPower;"),m("uniform vec3 SCENEJS_uFragmentFresnelCenterColor;"),m("uniform vec3 SCENEJS_uFragmentFresnelEdgeColor;")),m("varying vec3 SCENEJS_vViewEyeVec;"),y){m("varying vec3 SCENEJS_vViewNormal;"),v&&m("varying vec3 SCENEJS_vWorldNormal;"),C&&m("varying vec3 SCENEJS_vTangent;");for(var q,i=0;i<o.lights.lights.length;i++)q=o.lights.lights[i],"ambient"!=q.mode&&(m("uniform vec3  SCENEJS_uLightColor"+i+";"),"dir"==q.mode&&m("uniform vec3 SCENEJS_uLightDir"+i+";"),"point"==q.mode&&(m("uniform vec3  SCENEJS_uLightAttenuation"+i+";"),m("uniform vec3 SCENEJS_uLightPos"+i+";")),"spot"==q.mode&&(m("uniform vec3  SCENEJS_uLightAttenuation"+i+";"),m("uniform vec3 SCENEJS_uLightPos"+i+";"),m("uniform vec3 SCENEJS_uLightDir"+i+";"),m("uniform float SCENEJS_uInnerCone"+i+";"),m("uniform float SCENEJS_uOuterCone"+i+";")))}if(m("uniform bool  SCENEJS_uXray;"),m("uniform float SCENEJS_uGlassFactor;"),m("uniform float SCENEJS_uMurkiness;"),m("uniform float SCENEJS_uXrayGlassFactor;"),m("uniform float SCENEJS_uXrayMurkiness;"),m("uniform float SCENEJS_uOpacity;"),m("uniform vec3  SCENEJS_uXrayBGColor;"),m("uniform bool SCENEJS_uHighlight;"),m("uniform bool SCENEJS_uDesaturate;"),m("uniform vec3 SCENEJS_uHighlightColor;"),O&&(m("uniform float  SCENEJS_uFogDensity;"),m("uniform float  SCENEJS_uFogStart;"),m("uniform float  SCENEJS_uFogEnd;"),m("uniform float  SCENEJS_uFogMin;"),m("uniform float  SCENEJS_uFogMax;"),m("uniform vec3   SCENEJS_uFogColor;")),(c||d||e||f||g||h)&&(m("float fresnel(vec3 viewDirection, vec3 worldNormal, float edgeBias, float centerBias, float power) {"),m("    float fr = abs(dot(viewDirection, worldNormal));"),m("    float finalFr = clamp((fr - edgeBias) / (centerBias - edgeBias), 0.0, 1.0);"),m("    return pow(finalFr, power);"),m("}")),m("void main(void) {"),D){m("if (SCENEJS_uClipping) {"),m("  float dist = 0.0;");for(var i=0;i<o.clips.clips.length;i++)m("  if (SCENEJS_uClipMode"+i+" != 0.0) {"),m("      dist += clamp(dot(SCENEJS_vWorldVertex.xyz, SCENEJS_uClipNormalAndDist"+i+".xyz) - SCENEJS_uClipNormalAndDist"+i+".w, 0.0, 1000.0);"),m("  }");m("  if (dist > 0.0) { discard; }"),m("}")}I&&J&&(m("vec2 cxy = 2.0 * gl_PointCoord - 1.0;"),m("float r = dot(cxy, cxy);"),m("if (r > 1.0) {"),m("   discard;"),m("}")),y&&(m("vec3 worldEyeVec = normalize(SCENEJS_uWorldEye - SCENEJS_vWorldVertex.xyz);"),v&&m("vec3 worldNormal = normalize(SCENEJS_vWorldNormal); "),z&&(m("  if (gl_FrontFacing == false) {"),m("     gl_FragColor = vec4(SCENEJS_uSolidColor.xyz, 1.0);"),m("     return;"),m("  }"))),m("  vec3 ambient= SCENEJS_uAmbientColor;"),o.geometry.colorBuf?(m("  vec3    color   = SCENEJS_vColor.rgb;"),m("  float   colorA  = SCENEJS_vColor.a;")):m("  vec3    color   = SCENEJS_uMaterialColor;"),m("  float alpha         = SCENEJS_uMaterialAlpha;"),m("  float emit          = SCENEJS_uMaterialEmit;"),m("  float specular      = SCENEJS_uMaterialSpecular;"),m("  vec3  specularColor = SCENEJS_uMaterialSpecularColor;"),m("  vec3  emitColor     = SCENEJS_uMaterialEmitColor;"),m("  float shine         = SCENEJS_uMaterialShine;"),y&&(m("  float   attenuation = 1.0;"),m(C?"  vec3    viewNormalVec = vec3(0.0, 1.0, 0.0);":"  vec3    viewNormalVec = normalize(SCENEJS_vViewNormal);"),m("vec3 viewEyeVec = normalize(SCENEJS_vViewEyeVec);")),N&&(m("if (SCENEJS_uXray) {"),m("    alpha = 1.0;"),m("} else {"),m("    alpha = min(alpha, SCENEJS_uOpacity);"),m("    float gf = (SCENEJS_uGlassFactor  * (SCENEJS_uMurkiness - abs(dot(SCENEJS_vViewNormal, vec3(0.0, 0.0, -1.0)))));"),m("    alpha = max(alpha, gf);"),m("}"));var p;if(w&&(m("  vec4    texturePos;"),m("  vec2    textureCoord=vec2(0.0,0.0);"),w))for(var i=0,k=o.texture.layers.length;k>i;i++){p=o.texture.layers[i];var r=p.uvLayerIdx||0,j=o.geometry.uvBufs;j[r]?(m("texturePos = vec4(SCENEJS_vUVCoord"+r+".s, SCENEJS_vUVCoord"+r+".t, 1.0, 1.0);"),m(p.matrix?"textureCoord=(SCENEJS_uLayer"+i+"Matrix * texturePos).xy;":"textureCoord=texturePos.xy;"),p.flags&R.alpha&&(p.flags&R.multiply?m("alpha = alpha * (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).b);"):p.flags&R.add&&m("alpha = ((1.0 - SCENEJS_uLayer"+i+"BlendFactor) * alpha) + (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).b);")),p.flags&R.baseColor&&m(p.flags&R.multiply?"color = color * (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).rgb);":"color = ((1.0 - SCENEJS_uLayer"+i+"BlendFactor) * color) + (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).rgb);"),p.flags&R.emit&&m(p.flags&R.multiply?"emit  = emit * (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).r);":"emit = ((1.0 - SCENEJS_uLayer"+i+"BlendFactor) * emit) + (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).r);"),p.flags&R.specular&&y&&m(p.flags&R.multiply?"specular  = specular * (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).r);":"specular = ((1.0 - SCENEJS_uLayer"+i+"BlendFactor) * specular) + (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).r);"),p.flags&R.shine&&m(p.flags&R.multiply?"shine  = shine * (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).r);":"shine = ((1.0 - SCENEJS_uLayer"+i+"BlendFactor) * shine) + (SCENEJS_uLayer"+i+"BlendFactor * texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, 1.0 - textureCoord.y)).r);"),p.flags&R.normals&&y&&m("viewNormalVec = normalize(texture2D(SCENEJS_uSampler"+i+", vec2(textureCoord.x, -textureCoord.y)).xyz * 2.0 - 1.0);")):SceneJS.log.warn("Texture layer applyTo='uv' but geometry has no UV coordinates for layer "+r)}if(y&&x){m("float reflectFactor = 1.0;"),f&&(m("float reflectFresnel = fresnel(worldEyeVec, worldNormal, SCENEJS_uReflectFresnelEdgeBias,  SCENEJS_uReflectFresnelCenterBias, SCENEJS_uReflectFresnelPower);"),m("reflectFactor *= mix(SCENEJS_uReflectFresnelEdgeColor.b, SCENEJS_uReflectFresnelCenterColor.b, reflectFresnel);")),m("vec4 v = SCENEJS_uVMatrix * vec4(SCENEJS_vViewEyeVec, 0.0);"),m("vec3 v1 = v.xyz;"),m("v = SCENEJS_uVMatrix * vec4(viewNormalVec, 0.0);"),m("vec3 v2 = v.xyz;"),m("vec3 envLookup = reflect(v1, v2);"),m("envLookup.y = envLookup.y * -1.0;"),m("vec4 envColor;");for(var i=0,k=o.cubemap.layers.length;k>i;i++)p=o.cubemap.layers[i],m("envColor = textureCube(SCENEJS_uCubeMapSampler"+i+", envLookup);"),m("color = mix(color, envColor.rgb, reflectFactor * specular * SCENEJS_uCubeMapIntensity"+i+");")}if(m("  vec4    fragColor;"),y){m("  vec3    lightValue      = vec3(0.0, 0.0, 0.0);"),m("  vec3    specularValue   = vec3(0.0, 0.0, 0.0);"),m("  vec3    viewLightVec;"),m("  vec3    viewLightDir;"),m("  float   dotN;"),m("  float   spotDirRatio;"),m("  float   lightDist;"),C&&(m("vec3 tangent = normalize(SCENEJS_vTangent);"),m("vec3 bitangent = cross(SCENEJS_vViewNormal, tangent);"),m("mat3 TBM = mat3(tangent, bitangent, SCENEJS_vViewNormal);"));for(var q,i=0,k=o.lights.lights.length;k>i;i++)q=o.lights.lights[i],"ambient"!=q.mode&&("point"==q.mode&&("world"==q.space?(m("viewLightVec = SCENEJS_uLightPos"+i+" - SCENEJS_vWorldVertex.xyz;"),m("viewLightVec = vec3(SCENEJS_uVMatrix * vec4(viewLightVec, 0.0)).xyz;"),C&&m("viewLightVec *= TBM;")):(m("viewLightVec = SCENEJS_uLightPos"+i+".xyz - SCENEJS_vViewVertex.xyz;"),C&&m("viewLightVec *= TBM;")),m("dotN = max(dot(viewNormalVec, normalize(viewLightVec)), 0.0);"),m("lightDist = length( SCENEJS_uLightPos"+i+" - SCENEJS_vWorldVertex.xyz);"),m("attenuation = 1.0 - (  SCENEJS_uLightAttenuation"+i+".x +   SCENEJS_uLightAttenuation"+i+".y * lightDist +   SCENEJS_uLightAttenuation"+i+".z * lightDist * lightDist);"),q.diffuse&&m("      lightValue += dotN * SCENEJS_uLightColor"+i+" * attenuation;"),q.specular&&m("    specularValue += specularColor * SCENEJS_uLightColor"+i+" * specular * pow(max(dot(reflect(normalize(-viewLightVec), normalize(-viewNormalVec)), normalize(-SCENEJS_vViewVertex.xyz)), 0.0), shine) * attenuation;")),"spot"==q.mode&&(m("viewLightDir = SCENEJS_uLightDir"+i+";"),"world"==q.space?(m("viewLightVec = SCENEJS_uLightPos"+i+" - SCENEJS_vWorldVertex.xyz;"),m("viewLightVec = vec3(SCENEJS_uVMatrix * vec4(viewLightVec, 0.0)).xyz;"),m("viewLightDir = vec3(SCENEJS_uVMatrix * vec4(viewLightDir, 0.0)).xyz;"),C&&(m("viewLightVec *= TBM;"),m("viewLightDir *= TBM;"))):(m("viewLightVec = SCENEJS_uLightPos"+i+".xyz - SCENEJS_vViewVertex.xyz;"),C&&(m("viewLightVec *= TBM;"),m("viewLightDir *= TBM;"))),m("dotN = max(dot(viewNormalVec, normalize(viewLightVec)), 0.0);"),m("spotDirRatio = 1.0 - max(dot(normalize(viewLightDir), normalize(-viewLightVec)), 0.0);"),m("lightDist = length( SCENEJS_uLightPos"+i+" - SCENEJS_vWorldVertex.xyz);"),m("attenuation = 1.0 - (  SCENEJS_uLightAttenuation"+i+".x +   SCENEJS_uLightAttenuation"+i+".y * lightDist +   SCENEJS_uLightAttenuation"+i+".z * lightDist * lightDist);"),m("attenuation *= 1.0 - clamp((spotDirRatio - SCENEJS_uInnerCone"+i+") / max(SCENEJS_uOuterCone"+i+" - SCENEJS_uInnerCone"+i+", 0.0001), 0.0, 1.0);"),q.diffuse&&m("      lightValue += dotN * SCENEJS_uLightColor"+i+" * attenuation;"),q.specular&&m("    specularValue += specularColor * SCENEJS_uLightColor"+i+" * specular * pow(max(dot(reflect(normalize(-viewLightVec), normalize(-viewNormalVec)), normalize(-SCENEJS_vViewVertex.xyz)), 0.0), shine) * attenuation;")),"dir"==q.mode&&("world"==q.space?(m("viewLightVec = normalize(SCENEJS_uLightDir"+i+");"),m("viewLightVec = vec3(SCENEJS_uVMatrix * vec4(viewLightVec, 0.0)).xyz;"),C&&m("viewLightVec *= TBM;")):(m("viewLightVec = normalize(SCENEJS_uLightDir"+i+");"),C&&m("viewLightVec *= TBM;")),m("viewLightVec = -viewLightVec;"),m("dotN = max(dot(viewNormalVec, normalize(viewLightVec)), 0.0);"),q.diffuse&&m("lightValue += dotN * SCENEJS_uLightColor"+i+";"),q.specular&&m("specularValue += specularColor * SCENEJS_uLightColor"+i+" * specular * pow(max(dot(reflect(normalize(-viewLightVec), normalize(-viewNormalVec)), normalize(-SCENEJS_vViewVertex.xyz)), 0.0), shine);")));o.geometry.colorBuf&&m("alpha *= colorA;"),(c||d||e||g)&&(c&&(m("float diffuseFresnel = fresnel(worldEyeVec, worldNormal, SCENEJS_uDiffuseFresnelEdgeBias, SCENEJS_uDiffuseFresnelCenterBias, SCENEJS_uDiffuseFresnelPower);"),m("color.rgb *= mix(SCENEJS_uDiffuseFresnelEdgeColor.rgb, SCENEJS_uDiffuseFresnelCenterColor.rgb, diffuseFresnel);")),d&&(m("float specFresnel = fresnel(worldEyeVec, worldNormal, SCENEJS_uSpecularFresnelEdgeBias, SCENEJS_uSpecularFresnelCenterBias, SCENEJS_uSpecularFresnelPower);"),m("specularValue *= mix(SCENEJS_uSpecularFresnelEdgeColor.rgb, SCENEJS_uSpecularFresnelCenterColor.rgb, specFresnel);")),e&&(m("float alphaFresnel = fresnel(worldEyeVec, worldNormal, SCENEJS_uAlphaFresnelEdgeBias, SCENEJS_uAlphaFresnelCenterBias, SCENEJS_uAlphaFresnelPower);"),m("alpha *= mix(SCENEJS_uAlphaFresnelEdgeColor.r, SCENEJS_uAlphaFresnelCenterColor.r, alphaFresnel);")),g&&(m("float emitFresnel = fresnel(worldEyeVec, worldNormal, SCENEJS_uEmitFresnelEdgeBias, SCENEJS_uEmitFresnelCenterBias, SCENEJS_uEmitFresnelPower);"),m("emitColor.rgb *= mix(SCENEJS_uEmitFresnelEdgeColor.rgb, SCENEJS_uEmitFresnelCenterColor.rgb, emitFresnel);"))),m("fragColor = vec4((specularValue.rgb + color.rgb * (lightValue.rgb + ambient.rgb)) + (emit * emitColor.rgb), alpha);")}else m("fragColor = vec4((color.rgb + (emit * color.rgb)) *  (vec3(1.0, 1.0, 1.0) + ambient.rgb), alpha);");return G&&(m("vec3 regionColor = texture2D(SCENEJS_uRegionMapSampler, vec2(SCENEJS_vRegionMapUV.s, 1.0 - SCENEJS_vRegionMapUV.t)).rgb;"),m("float tolerance = 0.01;"),m("vec3 colorDelta = abs(SCENEJS_uRegionMapRegionColor - regionColor);"),"highlight"===o.regionMap.mode||"hide"===o.regionMap.mode?(m("if (max(colorDelta.x, max(colorDelta.y, colorDelta.z)) < tolerance) {"),m("highlight"===o.regionMap.mode?"  fragColor.rgb *= SCENEJS_uRegionMapHighlightFactor;":"  fragColor.a = SCENEJS_uRegionMapHideAlpha;"),m("}")):(m("if (max(colorDelta.x, max(colorDelta.y, colorDelta.z)) > tolerance) {"),m("  fragColor.a = SCENEJS_uRegionMapHideAlpha;"),m("}"))),N&&(m("if (SCENEJS_uXray) {"),m("    fragColor.a *= (SCENEJS_uXrayGlassFactor  * (SCENEJS_uXrayMurkiness - abs(dot(SCENEJS_vViewNormal, vec3(0.0, 0.0, -1.0)))));"),m("}"),m("if (SCENEJS_uHighlight) {"),m("    float intensity = 0.3 * fragColor.r + 0.59 * fragColor.g + 0.11 * fragColor.b;"),m("    fragColor = vec4((intensity * - 0.1) + fragColor.rgb * (1.0 + 0.1), fragColor.a);"),m("    fragColor.r = clamp(fragColor.r * SCENEJS_uHighlightColor.r, 0.3, 1.0);"),m("    fragColor.g = clamp(fragColor.g * SCENEJS_uHighlightColor.g, 0.3, 1.0);"),m("    fragColor.b = fragColor.b * SCENEJS_uHighlightColor.b;"),m("} else if (SCENEJS_uDesaturate) {"),m("    fragColor.rgb = SCENEJS_uXrayBGColor;"),m("} ")),O&&(P===Q.FOG_LINEAR?m("float fog = (length(SCENEJS_vViewVertex.xyz) - SCENEJS_uFogStart) / (SCENEJS_uFogEnd - SCENEJS_uFogStart);"):(m("float fogAttenuation = SCENEJS_uFogDensity * max(length(SCENEJS_vViewVertex.xyz) - SCENEJS_uFogStart, 0.0);"),P===Q.FOG_EXP2&&m("fogAttenuation = fogAttenuation * fogAttenuation;"),m("float fog = 1.0 - exp(-fogAttenuation);")),m("fog = clamp(fog, SCENEJS_uFogMin, SCENEJS_uFogMax);"),m("fragColor.rgb = mix(fragColor.rgb, SCENEJS_uFogColor, fog);")),H&&(m("    if (SCENEJS_uDepthMode) {"),m("          float depth = length(SCENEJS_vViewVertex) / (SCENEJS_uZFar - SCENEJS_uZNear);"),m("          const vec4 bias = vec4(1.0 / 255.0,"),m("          1.0 / 255.0,"),m("          1.0 / 255.0,"),m("          0.0);"),m("          float r = depth;"),m("          float g = fract(r * 255.0);"),m("          float b = fract(g * 255.0);"),m("          float a = fract(b * 255.0);"),m("          vec4 colour = vec4(r, g, b, a);"),m("          fragColor = colour - (colour.yzww * bias);"),m("    }")),h&&(m("float fragmentFresnel = fresnel(worldEyeVec, worldNormal, SCENEJS_uFragmentFresnelEdgeBias, SCENEJS_uFragmentFresnelCenterBias, SCENEJS_uFragmentFresnelPower);"),m("fragColor.rgb *= mix(SCENEJS_uFragmentFresnelEdgeColor.rgb, SCENEJS_uFragmentFresnelCenterColor.rgb, fragmentFresnel);")),H||m("fragColor.rgb *= fragColor.a;"),m("gl_FragColor = fragColor;"),m("}"),n()}function l(){V=[]}function m(a){V.push(a||"")}function n(){return V}var o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q=SceneJS.DISPLAY_FLAGS,R=SceneJS.TEXTURE_FLAGS,S=SceneJS.PROPERTY_FLAGS,T="highp"===SceneJS.WEBGL_INFO.FS_MAX_FLOAT_PRECISION,U={},V="";this.getSource=function(e,l){var m=U[e];return m?(m.useCount++,m):(o=l,p=o.fresnel.diffuse,q=o.fresnel.specular,r=o.fresnel.alpha,s=o.fresnel.reflect,t=o.fresnel.emit,u=o.fresnel.fragment,v=p||q||r||s||t||u,w=d(o),x=f(o),y=g(o),z=!!(o.properties.flags&S.SOLID),A=!!(o.properties.flags&S.SKYBOX),B=!!(o.properties.flags&S.BILLBOARD),C=h(o),D=o.clips.clips.length>0,E=!!o.morphGeometry.targets,F=c(),G=F&&"info"!==o.regionMap.mode,H=i(),I="points"===o.geometry.primitiveName,J=!!(o.properties.flags&S.ROUND_POINTS),K=!(!o.geometry.compressedPositions&&!o.morphGeometry.compressedPositions),L=!(!o.geometry.compressedNormals&&!o.morphGeometry.compressedNormals),M=!(!o.geometry.compressedUVs&&!o.morphGeometry.compressedUVs),N=y&&!!(o.properties.flags&S.XRAY_ENABLED),O=o.fogEnabled,P=o.fogMode,m=new SceneJS_ProgramSource(e,a(o),b(o),j(o),k(o)),U[e]=m,m)},this.putSource=function(a){var b=U[a];b&&0==--b.useCount&&(U[b.hash]=null)}},SceneJS_ProgramSource=function(a,b,c,d,e){this.hash=a,this.pickVertexSrc=b,this.pickFragmentSrc=c,this.drawVertexSrc=d,this.drawFragmentSrc=e,this.useCount=0},SceneJS_ProgramFactory=function(a,b){this.stats=a,this._canvas=b.canvas,this._programs={},this._nextProgramId=0};SceneJS_ProgramFactory.prototype.getProgram=function(a,b){var c=this._programs[a];if(!c){var d=SceneJS_ProgramSourceFactory.getSource(a,b);c=new SceneJS_Program(this.stats,this._nextProgramId++,a,d,this._canvas.gl),this._programs[a]=c,this.stats.state.programs++}return c.useCount++,c},SceneJS_ProgramFactory.prototype.putProgram=function(a){--a.useCount<=0&&(a.draw.destroy(),a.pick.destroy(),SceneJS_ProgramSourceFactory.putSource(a.hash),delete this._programs[a.hash],this.stats.state.programs--)},SceneJS_ProgramFactory.prototype.webglRestored=function(){var a,b=this._canvas.gl;for(var c in this._programs)this._programs.hasOwnProperty(c)&&(a=this._programs[c],a&&a.build&&a.build(b))},SceneJS_ProgramFactory.prototype.destroy=function(){};var SceneJS_Program=function(a,b,c,d,e){this.stats=a,this.id=b,this.hash=d.hash,this.source=d,this.gl=e,this.draw=null,this.pick=null,this.useCount=0,this.build(e)};SceneJS_Program.prototype.build=function(a){this.gl=a,this.draw=new SceneJS._webgl.Program(this.stats,a,[this.source.drawVertexSrc.join("\n")],[this.source.drawFragmentSrc.join("\n")]),this.pick=new SceneJS._webgl.Program(this.stats,a,[this.source.pickVertexSrc.join("\n")],[this.source.pickFragmentSrc.join("\n")])};var SceneJS_ObjectFactory=function(){};SceneJS_ObjectFactory.prototype._freeObjects=[],SceneJS_ObjectFactory.prototype._numFreeObjects=0,SceneJS_ObjectFactory.prototype.getObject=function(a){
  var b;return this._numFreeObjects>0?(b=this._freeObjects[--this._numFreeObjects],b.id=a,b):new SceneJS_Object(a)},SceneJS_ObjectFactory.prototype.putObject=function(){};var SceneJS_Object=function(a){this.id=a,this.hash=null,this.sortKey1=null,this.sortKey2=null,this.chunks=[],this.chunksLen=0,this.program=null,this.layer=null,this.texture=null,this.properties=null,this.tag=null,this.centroid=null};!function(){var a=new vec3.create;SceneJS_Object.prototype.getDepth=function(){this.centroid||(this.centroid=this._calculateCentroid(this));var b=this.modelTransform.mat,c=this.viewTransform.mat,d=vec3.transformMat4(a,this.centroid,b);return vec3.transformMat4(d,d,c),-d[2]},SceneJS_Object.prototype.isTransparent=function(){return this.properties.blend=!!(this.properties.transparent||this.material.transparent||this.fresnel.transparent||this.texture.transparent||this.regionMap.transparent),this.properties.blend},SceneJS_Object.prototype._calculateCentroid=function(){for(var a=vec3.create(),b=this.geometry.arrays.positions,c=this.geometry.arrays.indices,d=1/0,e=1/0,f=1/0,g=-(1/0),h=-(1/0),i=-(1/0),j=Math.min,k=Math.max,l=0,m=c.length;m>l;l++){var n=3*c[l],o=b[n],p=b[n+1],q=b[n+2];d=j(o,d),e=j(p,e),f=j(q,f),g=k(o,g),h=k(p,h),i=k(q,i)}return a[0]=.5*(d+g),a[1]=.5*(e+h),a[2]=.5*(f+i),a}}(),SceneJS.RenderContext=function(a){this._frameCtx=a,this._worldPos=vec4.create(),this._viewPos=vec4.create(),this._projPos=vec4.create(),this._cameraPos=vec4.create(),this._canvasPos=vec2.create()},SceneJS.RenderContext.prototype.getPass=function(){return this._frameCtx.pass},SceneJS.RenderContext.prototype.getCameraMatrix=function(){return this._frameCtx.cameraMat},SceneJS.RenderContext.prototype.getViewMatrix=function(){return this._frameCtx.viewMat},SceneJS.RenderContext.prototype.getModelMatrix=function(){return this._frameCtx.modelMat},SceneJS.RenderContext.prototype.getCanvasPos=function(a){this.getProjPos(a);var b=this._frameCtx.canvas.canvas,c=this._frameCtx.canvas.resolutionScaling,d=b.width/c,e=b.height/c,f=this._projPos[0]/this._projPos[3]*d*.5,g=this._projPos[1]/this._projPos[3]*e*.5;return this._canvasPos[0]=f+.5*d,this._canvasPos[1]=e-g-.5*e,this._canvasPos},SceneJS.RenderContext.prototype.getCameraPos=function(a){return vec3.normalize(this._cameraPos,this.getProjPos(a))},SceneJS.RenderContext.prototype.getProjPos=function(a){return vec4.transformMat4(this._projPos,this.getViewPos(a),this._frameCtx.cameraMat)},SceneJS.RenderContext.prototype.getViewPos=function(a){return vec4.transformMat4(this._viewPos,this.getWorldPos(a),this._frameCtx.viewMat)},SceneJS.RenderContext.prototype.getWorldPos=function(){var a=vec4.fromValues(0,0,0,1);return function(b){return a[0]=b?b[0]:0,a[1]=b?b[1]:0,a[2]=b?b[2]:0,vec4.transformMat4(this._worldPos,a,this._frameCtx.modelMat)}}();var SceneJS_Chunk=function(){};SceneJS_Chunk.prototype.init=function(a,b,c,d){this.id=a,this.program=b,this.core=c,this.core2=d,this.build&&this.build()};var SceneJS_ChunkFactory=function(){this._chunks={},this.chunkTypes=SceneJS_ChunkFactory.chunkTypes};SceneJS_ChunkFactory.chunkTypes={},SceneJS_ChunkFactory._freeChunks={},SceneJS_ChunkFactory.createChunkType=function(a){if(!a.type)throw"'type' expected in params";var b=SceneJS_Chunk,c=function(){this.useCount=0,this.init.apply(this,arguments)};return c.prototype=new b,c.prototype.constructor=c,a.drawAndPick&&(a.draw=a.pick=a.drawAndPick),SceneJS_ChunkFactory.chunkTypes[a.type]=c,SceneJS._apply(a,c.prototype),SceneJS_ChunkFactory._freeChunks[a.type]={chunks:[],chunksLen:0},c},SceneJS_ChunkFactory.prototype.getChunk=function(a,b,c,d,e){var f=SceneJS_ChunkFactory.chunkTypes[b];if(!f)throw"chunk type not supported: '"+b+"'";var g=this._chunks[a];return g?(g.useCount++,g):(g=new f(a,c,d,e),g.type=b,g.useCount=1,this._chunks[a]=g,g)},SceneJS_ChunkFactory.prototype.putChunk=function(a){0!=a.useCount&&--a.useCount<=0&&(a.recycle&&a.recycle(),delete this._chunks[a.id])},SceneJS_ChunkFactory.prototype.webglRestored=function(){var a;for(var b in this._chunks)this._chunks.hasOwnProperty(b)&&(a=this._chunks[b],a&&a.build&&a.build())},SceneJS_ChunkFactory.createChunkType({type:"camera",build:function(){this._uPMatrixDraw=this.program.draw.getUniform("SCENEJS_uPMatrix"),this._uZNearDraw=this.program.draw.getUniform("SCENEJS_uZNear"),this._uZFarDraw=this.program.draw.getUniform("SCENEJS_uZFar"),this._uPMatrixPick=this.program.pick.getUniform("SCENEJS_uPMatrix"),this._uZNearPick=this.program.pick.getUniform("SCENEJS_uZNear"),this._uZFarPick=this.program.pick.getUniform("SCENEJS_uZFar")},draw:function(a){this.core.checkAspect&&this.core.checkAspect(this.core,a.aspect);this.program.gl;this._uPMatrixDraw&&this._uPMatrixDraw.setValue(this.core.mat),this._uZNearDraw&&this._uZNearDraw.setValue(this.core.optics.near),this._uZFarDraw&&this._uZFarDraw.setValue(this.core.optics.far),a.cameraMat=this.core.mat},pick:function(a){this.core.checkAspect&&this.core.checkAspect(this.core,a.aspect);this.program.gl;this._uPMatrixPick&&this._uPMatrixPick.setValue(a.pickProjMatrix||this.core.mat),a.rayPick&&(this._uZNearPick&&this._uZNearPick.setValue(this.core.optics.near),this._uZFarPick&&this._uZFarPick.setValue(this.core.optics.far)),a.cameraMat=this.core.mat}}),SceneJS_ChunkFactory.createChunkType({type:"clips",build:function(){this._draw=this._draw||[];for(var a=this.program.draw,b=0,c=this.core.clips.length;c>b;b++)this._draw[b]={uClipMode:a.getUniform("SCENEJS_uClipMode"+b),uClipNormalAndDist:a.getUniform("SCENEJS_uClipNormalAndDist"+b)};this._pick=this._pick||[];for(var d=this.program.pick,b=0,c=this.core.clips.length;c>b;b++)this._pick[b]={uClipMode:d.getUniform("SCENEJS_uClipMode"+b),uClipNormalAndDist:d.getUniform("SCENEJS_uClipNormalAndDist"+b)}},drawAndPick:function(a){for(var b,c,d,e=a.picking,f=e?this._pick:this._draw,g=this.core.clips,h=(this.program.gl,0),i=g.length;i>h;h++)e?(b=f[h].uClipMode,c=f[h].uClipNormalAndDist):(b=f[h].uClipMode,c=f[h].uClipNormalAndDist),b&&c&&(d=g[h],"inside"==d.mode?(b.setValue(2),c.setValue(d.normalAndDist)):"outside"==d.mode?(b.setValue(1),c.setValue(d.normalAndDist)):b.setValue(0))}}),SceneJS_ChunkFactory.createChunkType({type:"draw",unique:!0,build:function(){this._depthModeDraw=this.program.draw.getUniform("SCENEJS_uDepthMode"),this._uPickColor=this.program.pick.getUniform("SCENEJS_uPickColor")},draw:function(a){var b=this.core,c=this.program.gl;this._depthModeDraw&&this._depthModeDraw.setValue(a.depthMode),a.transparent&&!a.blendEnabled?(c.enable(c.BLEND),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA),a.blendEnabled=!0):!a.transparent&&a.blendEnabled&&(c.disable(c.BLEND),a.blendEnabled=!1),b.indexBuf?(c.drawElements(b.primitive,b.indexBuf.numItems,b.indexBuf.itemType,0),a.drawElements++):(c.drawArrays(b.primitive,0,b.vertexBuf.numItems/3),a.drawArrays++),a.transparent=!1},pick:function(a){var b=this.core,c=this.program.gl;if(a.pickObject||a.pickRegion){if(a.pickObject&&this._uPickColor){var d=a.pickIndex>>24&255,e=a.pickIndex>>16&255,f=a.pickIndex>>8&255,g=255&a.pickIndex;a.pickIndex++,this._uPickColor.setValue([g/255,f/255,e/255,d/255])}b.indexBuf?c.drawElements(b.primitive,b.indexBuf.numItems,b.indexBuf.itemType,0):c.drawArrays(b.primitive,0,b.vertexBuf.numItems/3)}else if(a.pickTriangle){var h=b.getPickPositions();h&&c.drawArrays(b.primitive,0,h.numItems/3)}}}),function(){var a=SceneJS.PROPERTY_FLAGS;SceneJS_ChunkFactory.createChunkType({type:"properties",build:function(){var a=this.program.draw;this._uClippingDraw=a.getUniform("SCENEJS_uClipping"),this._uSolidDraw=a.getUniform("SCENEJS_uSolid"),this._uSolidColorDraw=a.getUniform("SCENEJS_uSolidColor"),this._uXrayDraw=a.getUniform("SCENEJS_uXray"),this._uGlassFactorDraw=a.getUniform("SCENEJS_uGlassFactor"),this._uMurkinessDraw=a.getUniform("SCENEJS_uMurkiness"),this._uOpacityDraw=a.getUniform("SCENEJS_uOpacity"),this._uHighlightDraw=a.getUniform("SCENEJS_uHighlight"),this._uDesaturateDraw=a.getUniform("SCENEJS_uDesaturate");var b=this.program.pick;this._uClippingPick=b.getUniform("SCENEJS_uClipping")},drawAndPick:function(b){var c=this.program.gl,d=this.core.flags&a.BACKFACES;b.backfaces!=d&&(d?c.disable(c.CULL_FACE):c.enable(c.CULL_FACE),b.backfaces=d);var e=this.core.flags&a.CCW;b.frontface!=e&&(c.frontFace(e?c.CCW:c.CW),b.frontface=e);var f=b.picking;if(f)this._uClippingPick&&this._uClippingPick.setValue(this.core.flags&a.CLIPPING);else{b.transparent=this.core.blend;var g=this.core.flags&a.DEPTH_MASK;b.depthMask!=g&&(c.depthMask(g),b.depthMask=g),this._uClippingDraw&&this._uClippingDraw.setValue(this.core.flags&a.CLIPPING),this._uSolidDraw&&this._uSolidDraw.setValue(this.core.flags&a.SOLID),this._uSolidColorDraw&&this._uSolidColorDraw.setValue(this.core.solidColor),this._uXrayDraw&&this._uXrayDraw.setValue(this.core.flags&a.XRAY),this._uGlassFactorDraw&&this._uGlassFactorDraw.setValue(this.core.glassFactor),this._uMurkinessDraw&&this._uMurkinessDraw.setValue(this.core.murkiness),this._uOpacityDraw&&this._uOpacityDraw.setValue(this.core.opacity),this._uHighlightDraw&&this._uHighlightDraw.setValue(this.core.flags&a.HIGHLIGHT),this._uDesaturateDraw&&this._uDesaturateDraw.setValue(this.core.flags&a.DESATURATE)}}})}(),SceneJS_ChunkFactory.createChunkType({type:"renderTarget",programGlobal:!0,draw:function(a){var b=this.program.gl;a.renderBuf&&(b.flush(),a.renderBuf.unbind(),a.renderBuf=null);var c=this.core.renderBuf;return c?(c.bind(),a.depthMode="depth"===this.core.bufType,a.depthMode&&(a.transparent=!1),b.viewport(0,0,b.drawingBufferWidth,b.drawingBufferHeight),b.clearColor(a.ambientColor[0],a.ambientColor[1],a.ambientColor[2],1),b.clear(b.COLOR_BUFFER_BIT|b.DEPTH_BUFFER_BIT|b.STENCIL_BUFFER_BIT),void(a.renderBuf=c)):void(a.depthMode=!1)}}),SceneJS_ChunkFactory.createChunkType({type:"geometry",build:function(){var a=this.program.draw;this._aRegionMapUVDraw=a.getAttribute("SCENEJS_aRegionMapUV"),this._aVertexDraw=a.getAttribute("SCENEJS_aVertex"),this._aNormalDraw=a.getAttribute("SCENEJS_aNormal"),this._aUVDraw=[],this._uDecodeUV=[];for(var b,c,d=0;1e3>d&&(b=a.getAttribute("SCENEJS_aUVCoord"+d),b);d++)this._aUVDraw.push(b),c=a.getUniform("SCENEJS_uDecodeUVMatrix"+d),c&&this._uDecodeUV.push(c);this._aTangentDraw=a.getAttribute("SCENEJS_aTangent"),this._aColorDraw=a.getAttribute("SCENEJS_aVertexColor"),this._aMorphVertexDraw=a.getAttribute("SCENEJS_aMorphVertex"),this._aMorphNormalDraw=a.getAttribute("SCENEJS_aMorphNormal"),this._aMorphTangentDraw=a.getAttribute("SCENEJS_aMorphTangent"),this._uMorphFactorDraw=a.getUniform("SCENEJS_uMorphFactor"),this._uPointSizeDraw=a.getUniform("SCENEJS_uPointSize"),this._uDecodePositionsDraw=a.getUniform("SCENEJS_uDecodePositionMatrix"),this._uDecodeMorphPosDraw=a.getUniform("SCENEJS_uDecodeMorphPosMatrix");var e=this.program.pick;this._aRegionMapUVPick=e.getAttribute("SCENEJS_aRegionMapUV"),this._aVertexPick=e.getAttribute("SCENEJS_aVertex"),this._aColorPick=e.getAttribute("SCENEJS_aColor"),this._aMorphVertexPick=e.getAttribute("SCENEJS_aMorphVertex"),this._uMorphFactorPick=e.getUniform("SCENEJS_uMorphFactor"),this._uPointSizePick=e.getUniform("SCENEJS_uPointSize"),this._uDecodePositionsPick=e.getUniform("SCENEJS_uDecodePositionMatrix"),this._uDecodeMorphPosPick=e.getUniform("SCENEJS_uDecodeMorphPosMatrix"),this.VAO=null,this.VAOMorphKey1=0,this.VAOMorphKey2=0,this.VAOHasInterleavedBuf=!1},recycle:function(){if(this.VAO){var a=this.program.gl.getExtension("OES_vertex_array_object");a.deleteVertexArrayOES(this.VAO),this.VAO=null}},morphDraw:function(a){this.VAOMorphKey1=this.core.key1,this.VAOMorphKey2=this.core.key2;var b=this.core.key1,c=this.core.key2,d=this.core.targets[b],e=this.core.targets[c];if(this._aMorphVertexDraw?(this._aVertexDraw.bindArrayBuffer(d.vertexBuf),this._aMorphVertexDraw.bindArrayBuffer(e.vertexBuf),a.bindArray+=2):this._aVertexDraw&&(this._aVertexDraw.bindArrayBuffer(this.core2.vertexBuf),a.bindArray++),this._aMorphNormalDraw?(this._aNormalDraw.bindArrayBuffer(d.normalBuf),this._aMorphNormalDraw.bindArrayBuffer(e.normalBuf),a.bindArray+=2):this._aNormalDraw&&(this._aNormalDraw.bindArrayBuffer(this.core2.normalBuf),a.bindArray++),this._aMorphTangentDraw||this._aTangentDraw){var f=a.normalMapUVLayerIdx;f>=0&&(this._aMorphTangentDraw?(this._aTangentDraw.bindArrayBuffer(this.core.getTangents(b,this.core2.arrays.indices,this.core2.arrays.uvs[f],this.core2.positionDecodeMat,this.core2.compressedUVs&&this.core2.uvDecodeMats[f])),this._aMorphTangentDraw.bindArrayBuffer(this.core.getTangents(c,this.core2.arrays.indices,this.core2.arrays.uvs[f],this.core2.positionDecodeMat,this.core2.compressedUVs&&this.core2.uvDecodeMats[f])),a.bindArray+=2):this._aTangentDraw)}for(var g,h=0,i=this._aUVDraw.length;i>h;h++)g=this.core2.uvBufs[h],g&&(this._aUVDraw[h].bindArrayBuffer(g),a.bindArray++);this._aColorDraw&&(this._aColorDraw.bindArrayBuffer(this.core2.colorBuf),a.bindArray++),this.updateMorphDrawUniforms()},updateGeoDrawUniforms:function(){this._uDecodePositionsDraw&&this._uDecodePositionsDraw.setValue(this.core2.positionDecodeMat)},updateMorphDrawUniforms:function(){var a=this.core.key1,b=this.core.key2,c=this.core.targets[a],d=this.core.targets[b];this._uDecodePositionsDraw&&this._uDecodePositionsDraw.setValue(c.positionDecodeMat),this._uDecodeMorphPosDraw&&this._uDecodeMorphPosDraw.setValue(d.positionDecodeMat),this._uMorphFactorDraw&&this._uMorphFactorDraw.setValue(this.core.factor)},draw:function(a){var b=this.core.targets&&this.core.targets.length,c=this.core2.interleavedBuf&&!this.core2.interleavedBuf.dirty;this._uPointSizeDraw&&this._uPointSizeDraw.setValue(this.core2.pointSize);for(var d=0,e=this._uDecodeUV.length;e>d;d++)this._uDecodeUV[d]&&this._uDecodeUV[d].setValue(this.core2.uvDecodeMats[d]);if(b||this.updateGeoDrawUniforms(),this.VAO&&a.VAO){if(a.VAO.bindVertexArrayOES(this.VAO),b){if(this.VAOMorphKey1==this.core.key1&&this.VAOMorphKey2==this.core.key2)return void this.updateMorphDrawUniforms()}else if(c||!this.VAOHasInterleavedBuf)return}else a.VAO&&(a.VAO.bindVertexArrayOES(null),this.VAO=a.VAO.createVertexArrayOES(),a.VAO.bindVertexArrayOES(this.VAO));if(b)this.morphDraw(a);else{if(c){this.VAOHasInterleavedBuf=!0,this.core2.interleavedBuf.bind(),this._aVertexDraw&&(this._aVertexDraw.bindInterleavedFloatArrayBuffer(3,this.core2.interleavedStride,this.core2.interleavedPositionOffset),a.bindArray++),this._aNormalDraw&&(this._aNormalDraw.bindInterleavedFloatArrayBuffer(3,this.core2.interleavedStride,this.core2.interleavedNormalOffset),a.bindArray++);for(var d=0,e=this._aUVDraw.length;e>d;d++)this._aUVDraw[d].bindInterleavedFloatArrayBuffer(2,this.core2.interleavedStride,this.core2.interleavedUVOffsets[d]),a.bindArray++;this._aColorDraw&&(this._aColorDraw.bindInterleavedFloatArrayBuffer(4,this.core2.interleavedStride,this.core2.interleavedColorOffset),a.bindArray++)}else{this.VAOHasInterleavedBuf=!1,this._aVertexDraw&&(this._aVertexDraw.bindArrayBuffer(this.core2.vertexBuf),a.bindArray++),this._aNormalDraw&&(this._aNormalDraw.bindArrayBuffer(this.core2.normalBuf),a.bindArray++);for(var f,d=0,e=this._aUVDraw.length;e>d;d++)f=this.core2.uvBufs[d],f&&(this._aUVDraw[d].bindArrayBuffer(f),a.bindArray++);this._aColorDraw&&(this._aColorDraw.bindArrayBuffer(this.core2.colorBuf),a.bindArray++)}if(this._aTangentDraw){var g=a.normalMapUVLayerIdx;g>=0&&(this._aTangentDraw.bindArrayBuffer(this.core2.getTangents(g)),a.bindArray++)}}if(this._aRegionMapUVDraw){var h=a.regionMapUVLayerIdx;if(h>=0){var i=this.core2.uvBufs;h<i.length&&(this._aRegionMapUVDraw.bindArrayBuffer(i[h]),a.bindArray++)}}this.core2.indexBuf&&this.core2.indexBuf.bind()},morphPick:function(a){var b=this.core,c=this.core2,d=b.targets[b.key1],e=b.targets[b.key2];if(a.pickObject||a.pickRegion)this._aMorphVertexPick?(this._aVertexPick.bindArrayBuffer(d.vertexBuf),this._aMorphVertexPick.bindArrayBuffer(e.vertexBuf)):this._aVertexPick&&this._aVertexPick.bindArrayBuffer(c.vertexBuf),c.indexBuf.bind();else if(a.pickTriangle)if(this._aMorphVertexPick){var f=b.getPickPositions(b.key1,c.arrays.indices);f&&this._aVertexPick.bindArrayBuffer(f),f=b.getPickPositions(b.key2,c.arrays.indices),f&&this._aMorphVertexPick.bindArrayBuffer(f),this._aColorPick&&this._aColorPick.bindArrayBuffer(c.getPickColors())}else this._aVertexPick&&(this._aVertexPick.bindArrayBuffer(c.vertexBuf),c.indexBuf.bind());this._uDecodePositionsPick&&this._uDecodePositionsPick.setValue(d.positionDecodeMat),this._uDecodeMorphPosPick&&this._uDecodeMorphPosPick.setValue(e.positionDecodeMat),this._uMorphFactorPick&&this._uMorphFactorPick.setValue(b.factor)},pick:function(a){var b=this.core,c=this.core2;b.targets&&b.targets.length?this.morphPick(a):(a.pickObject||a.pickRegion?(this._aVertexPick&&this._aVertexPick.bindArrayBuffer(c.vertexBuf),this._aRegionMapUVPick&&this._aRegionMapUVPick.bindArrayBuffer(c.uvBufs[a.regionMapUVLayerIdx]),c.indexBuf&&c.indexBuf.bind()):a.pickTriangle&&(this._aVertexPick&&this._aVertexPick.bindArrayBuffer(c.getPickPositions()),this._aColorPick&&this._aColorPick.bindArrayBuffer(c.getPickColors())),this._uDecodePositionsPick&&this._uDecodePositionsPick.setValue(this.core2.positionDecodeMat),this._uPointSizePick&&this._uPointSizePick.setValue(this.core2.pointSize))}}),SceneJS_ChunkFactory.createChunkType({type:"lights",build:function(){this._uAmbientColor=this._uAmbientColor||[],this._uLightColor=this._uLightColor||[],this._uLightDir=this._uLightDir||[],this._uLightPos=this._uLightPos||[],this._uLightCutOff=this._uLightCutOff||[],this._uLightSpotExp=this._uLightSpotExp||[],this._uLightAttenuation=this._uLightAttenuation||[],this._uInnerCone=this._uInnerCone||[],this._uOuterCone=this._uOuterCone||[];for(var a=this.core.lights,b=this.program,c=0,d=a.length;d>c;c++)switch(a[c].mode){case"ambient":this._uAmbientColor[c]=b.draw.getUniform("SCENEJS_uAmbientColor");break;case"dir":this._uLightColor[c]=b.draw.getUniform("SCENEJS_uLightColor"+c),this._uLightPos[c]=null,this._uLightDir[c]=b.draw.getUniform("SCENEJS_uLightDir"+c);break;case"point":this._uLightColor[c]=b.draw.getUniform("SCENEJS_uLightColor"+c),this._uLightPos[c]=b.draw.getUniform("SCENEJS_uLightPos"+c),this._uLightDir[c]=null,this._uLightAttenuation[c]=b.draw.getUniform("SCENEJS_uLightAttenuation"+c);break;case"spot":this._uLightColor[c]=b.draw.getUniform("SCENEJS_uLightColor"+c),this._uLightPos[c]=b.draw.getUniform("SCENEJS_uLightPos"+c),this._uLightDir[c]=b.draw.getUniform("SCENEJS_uLightDir"+c),this._uLightAttenuation[c]=b.draw.getUniform("SCENEJS_uLightAttenuation"+c),this._uInnerCone[c]=b.draw.getUniform("SCENEJS_uInnerCone"+c),this._uOuterCone[c]=b.draw.getUniform("SCENEJS_uOuterCone"+c)}},draw:function(a){a.dirty&&this.build();for(var b,c=this.core.lights,d=(this.program.gl,0),e=c.length;e>d;d++)b=c[d],this._uAmbientColor[d]?this._uAmbientColor[d].setValue(b.color):(this._uLightColor[d]&&this._uLightColor[d].setValue(b.color),this._uLightPos[d]&&(this._uLightPos[d].setValue(b.pos),this._uLightAttenuation[d]&&this._uLightAttenuation[d].setValue(b.attenuation)),this._uLightDir[d]&&this._uLightDir[d].setValue(b.dir),this._uInnerCone[d]&&this._uInnerCone[d].setValue(b.innerCone),this._uOuterCone[d]&&this._uOuterCone[d].setValue(b.outerCone))}}),SceneJS_ChunkFactory.createChunkType({type:"listeners",programGlobal:!0,build:function(){},draw:function(a){for(var b=this.core.listeners,c=a.renderListenerCtx,d=b.length-1;d>=0;d--)if(b[d](c)===!0)return!0}}),SceneJS_ChunkFactory.createChunkType({type:"lookAt",build:function(){this._uvMatrixDraw=this.program.draw.getUniform("SCENEJS_uVMatrix"),this._uWorldEyeDraw=this.program.draw.getUniform("SCENEJS_uWorldEye"),this._uvMatrixPick=this.program.pick.getUniform("SCENEJS_uVMatrix")},draw:function(a){this.core.dirty&&this.core.rebuild();this.program.gl;this._uvMatrixDraw&&this._uvMatrixDraw.setValue(this.core.mat),this._uWorldEyeDraw&&this._uWorldEyeDraw.setValue(this.core.lookAt.eye),a.viewMat=this.core.mat},pick:function(a){this.program.gl;this._uvMatrixPick&&this._uvMatrixPick.setValue(a.pickViewMatrix||this.core.mat),a.viewMat=this.core.mat}}),SceneJS_ChunkFactory.createChunkType({type:"material",build:function(){var a=this.program.draw;this._uMaterialBaseColor=a.getUniform("SCENEJS_uMaterialColor"),this._uMaterialSpecularColor=a.getUniform("SCENEJS_uMaterialSpecularColor"),this._uMaterialEmitColor=a.getUniform("SCENEJS_uMaterialEmitColor"),this._uMaterialSpecular=a.getUniform("SCENEJS_uMaterialSpecular"),this._uMaterialShine=a.getUniform("SCENEJS_uMaterialShine"),this._uMaterialEmit=a.getUniform("SCENEJS_uMaterialEmit"),this._uMaterialAlpha=a.getUniform("SCENEJS_uMaterialAlpha")},draw:function(){this.program.gl;this._uMaterialBaseColor&&this._uMaterialBaseColor.setValue(this.core.baseColor),this._uMaterialSpecularColor&&this._uMaterialSpecularColor.setValue(this.core.specularColor),this._uMaterialEmitColor&&this._uMaterialEmitColor.setValue(this.core.emitColor),this._uMaterialSpecular&&this._uMaterialSpecular.setValue(this.core.specular),this._uMaterialShine&&this._uMaterialShine.setValue(this.core.shine),this._uMaterialEmit&&this._uMaterialEmit.setValue(this.core.emit),this._uMaterialAlpha&&this._uMaterialAlpha.setValue(this.core.alpha)}}),SceneJS_ChunkFactory.createChunkType({type:"program",build:function(){var a=this.program.draw,b=this.program.pick;this._depthModeDraw=a.getUniform("SCENEJS_uDepthMode"),this._pickMode=b.getUniform("SCENEJS_uPickMode"),this._uHighlightColorDraw=a.getUniform("SCENEJS_uHighlightColor"),this._uFogDensityDraw=a.getUniform("SCENEJS_uFogDensity"),this._uFogStartDraw=a.getUniform("SCENEJS_uFogStart"),this._uFogEndDraw=a.getUniform("SCENEJS_uFogEnd"),this._uFogMinDraw=a.getUniform("SCENEJS_uFogMin"),this._uFogMaxDraw=a.getUniform("SCENEJS_uFogMax"),this._uFogColorDraw=a.getUniform("SCENEJS_uFogColor"),this._uXrayGlassFactorDraw=a.getUniform("SCENEJS_uXrayGlassFactor"),this._uXrayMurkinessDraw=a.getUniform("SCENEJS_uXrayMurkiness"),this._uXrayBGColorDraw=a.getUniform("SCENEJS_uXrayBGColor")},draw:function(a){var b=this.program.draw;b.bind(),a.textureUnit=0;var c=this.program.gl;if(this._depthModeDraw&&this._depthModeDraw.setValue(a.depthMode),!a.VAO)for(var d=0;10>d;d++)c.disableVertexAttribArray(d);this._uHighlightColorDraw&&this._uHighlightColorDraw.setValue(a.highlightColor),this._uFogDensityDraw&&this._uFogDensityDraw.setValue(a.fogDensity),this._uFogStartDraw&&this._uFogStartDraw.setValue(a.fogStart),this._uFogEndDraw&&this._uFogEndDraw.setValue(a.fogEnd),this._uFogMinDraw&&this._uFogMinDraw.setValue(a.fogMin),this._uFogMaxDraw&&this._uFogMaxDraw.setValue(a.fogMax),this._uFogColorDraw&&this._uFogColorDraw.setValue(a.fogColor),this._uXrayGlassFactorDraw&&this._uXrayGlassFactorDraw.setValue(a.xrayGlassFactor),this._uXrayMurkinessDraw&&this._uXrayMurkinessDraw.setValue(a.xrayMurkiness),this._uXrayBGColorDraw&&this._uXrayBGColorDraw.setValue(a.xrayBGColor),a.drawProgram=this.program.draw,a.useProgram++},pick:function(a){var b=this.program.pick;b.bind();var c=this.program.gl;this._pickMode.setValue(a.pickObject?0:a.pickTriangle?1:2),a.textureUnit=0;for(var d=0;10>d;d++)c.disableVertexAttribArray(d)}}),SceneJS_ChunkFactory.createChunkType({type:"renderer",build:function(){},drawAndPick:function(a){if(this.core.props){var b=this.program.gl;a.renderer&&(a.renderer.props.restoreProps(b),a.renderer=this.core),this.core.props.setProps(b)}}}),SceneJS_ChunkFactory.createChunkType({type:"regionMap",build:function(){this._uRegionMapRegionColor=this.program.draw.getUniform("SCENEJS_uRegionMapRegionColor"),this._uRegionMapHighlightFactor=this.program.draw.getUniform("SCENEJS_uRegionMapHighlightFactor"),this._uRegionMapHideAlpha=this.program.draw.getUniform("SCENEJS_uRegionMapHideAlpha"),this._uRegionMapSampler="SCENEJS_uRegionMapSampler"},draw:function(a){var b=this.core.texture;b&&(this.program.draw.bindTexture(this._uRegionMapSampler,b,a.textureUnit),a.textureUnit=(a.textureUnit+1)%SceneJS.WEBGL_INFO.MAX_TEXTURE_UNITS);this.program.gl;b?(this._uRegionMapRegionColor&&this._uRegionMapRegionColor.setValue(this.core.regionColor),this._uRegionMapHighlightFactor&&this._uRegionMapHighlightFactor.setValue(this.core.highlightFactor),this._uRegionMapHideAlpha&&this._uRegionMapHideAlpha.setValue(this.core.hideAlpha),a.regionMapUVLayerIdx=this.core.uvLayerIdx):a.regionMapUVLayerIdx=-1},pick:function(a){var b=this.core.texture;b?(a.regionData=this.core.regionData,a.textureUnit=0,this.program.pick.bindTexture(this._uRegionMapSampler,b,a.textureUnit),a.textureUnit=(a.textureUnit+1)%SceneJS.WEBGL_INFO.MAX_TEXTURE_UNITS,a.regionMapUVLayerIdx=this.core.uvLayerIdx):a.regionMapUVLayerIdx=-1}}),SceneJS_ChunkFactory.createChunkType({type:"depthBuffer",programGlobal:!0,drawAndPick:function(a){var b=this.program.gl,c=this.core.enabled;a.depthbufEnabled!=c&&(c?b.enable(b.DEPTH_TEST):b.disable(b.DEPTH_TEST),a.depthbufEnabled=c);var d=this.core.clearDepth;a.clearDepth!=d&&(b.clearDepth(d),a.clearDepth=d);var e=this.core.depthFunc;a.depthFunc!=e&&(b.depthFunc(e),a.depthFunc=e),this.core.clear&&b.clear(b.DEPTH_BUFFER_BIT)}}),SceneJS_ChunkFactory.createChunkType({type:"stencilBuffer",programGlobal:!0,drawAndPick:function(a){var b=this.program.gl,c=this.core.enabled;a.stencilbufEnabled!=c&&(c?b.enable(b.STENCIL_TEST):b.disable(b.STENCIL_TEST),a.stencilbufEnabled=c);var d=this.core.clearStencil;void 0!==d&&a.clearStencil!=d&&(b.clearStencil(d),a.clearStencil=d);var e=this.core.stencilFuncFuncFront,f=this.core.stencilFuncRefFront,g=this.core.stencilFuncMaskFront;e&&(a.stencilFuncFuncFront!=e||a.stencilFuncRefFront!=f||a.stencilFuncMaskFront!=g)&&(b.stencilFuncSeparate(b.FRONT,e,f,g),a.stencilFuncFuncFront=e,a.stencilFuncRefFront=f,a.stencilFuncMaskFront=g);var h=this.core.stencilFuncFuncBack,i=this.core.stencilFuncRefBack,j=this.core.stencilFuncMaskBack;h&&(a.stencilFuncFuncBack!=h||a.stencilFuncRefBack!=i||a.stencilFuncMaskBack!=j)&&(b.stencilFuncSeparate(b.BACK,h,i,j),a.stencilFuncFuncBack=h,a.stencilFuncRefBack=i,a.stencilFuncMaskBack=j);var k=this.core.stencilOpSfailFront,l=this.core.stencilOpDpfailFront,m=this.core.stencilOpDppassFront;k&&(a.stencilOpSfailFront!=k||a.stencilOpDpfailFront!=l||a.stencilOpDppassFront!=m)&&(b.stencilOpSeparate(b.FRONT,k,l,m),a.stencilOpSfailFront=k,a.stencilOpDpfailFront=l,a.stencilOpDppassFront=m);var n=this.core.stencilOpSfailBack,o=this.core.stencilOpDpfailBack,p=this.core.stencilOpDppassBack;n&&(a.stencilOpSfailBack!=n||a.stencilOpDpfailBack!=o||a.stencilOpDppassBack!=p)&&(b.stencilOpSeparate(b.BACK,n,o,p),a.stencilOpSfailBack=n,a.stencilOpDpfailBack=o,a.stencilOpDppassBack=p),this.core.clear&&b.clear(b.STENCIL_BUFFER_BIT)}}),SceneJS_ChunkFactory.createChunkType({type:"colorBuffer",programGlobal:!0,build:function(){},drawAndPick:function(a){if(!a.transparent){a.transparent=this.core.blendEnabled;var b=this.core.colorMask;this.program.gl.colorMask(b.r,b.g,b.b,b.a)}}}),SceneJS_ChunkFactory.createChunkType({type:"view",programGlobal:!0,build:function(){},drawAndPick:function(a){var b=this.core.scissorTestEnabled;if(a.scissorTestEnabled!=b){var c=this.program.gl;b?c.enable(c.SCISSOR_TEST):c.disable(c.SCISSOR_TEST),a.scissorTestEnabled=b}}}),SceneJS_ChunkFactory.createChunkType({type:"style",programGlobal:!0,drawAndPick:function(a){var b=this.core.lineWidth;if(a.lineWidth!=b){var c=this.program.gl;c.lineWidth(b),a.lineWidth=b}}}),SceneJS_ChunkFactory.createChunkType({type:"texture",build:function(){this._uTexSampler=this._uTexSampler||[],this._uTexMatrix=this._uTexMatrix||[],this._uTexBlendFactor=this._uTexBlendFactor||[];var a=this.core.layers;if(a)for(var b,c=this.program.draw,d=0,e=a.length;e>d;d++)b=a[d],this._uTexSampler[d]="SCENEJS_uSampler"+d,this._uTexMatrix[d]=c.getUniform("SCENEJS_uLayer"+d+"Matrix"),this._uTexBlendFactor[d]=c.getUniform("SCENEJS_uLayer"+d+"BlendFactor")},draw:function(a){a.textureUnit=0,a.normalMapUVLayerIdx=-1;var b=this.core.layers;if(b)for(var c,d=this.program.draw,e=0,f=b.length;f>e;e++)c=b[e],this._uTexSampler[e]&&c.texture&&(d.bindTexture(this._uTexSampler[e],c.texture,a.textureUnit),a.textureUnit=(a.textureUnit+1)%SceneJS.WEBGL_INFO.MAX_TEXTURE_UNITS,a.bindTexture++,c._matrixDirty&&c.buildMatrix&&c.buildMatrix.call(c),this._uTexMatrix[e]&&this._uTexMatrix[e].setValue(c.matrixAsArray),this._uTexBlendFactor[e]&&this._uTexBlendFactor[e].setValue(c.blendFactor),c.isNormalMap&&(a.normalMapUVLayerIdx=c.uvLayerIdx));a.texture=this.core}}),SceneJS_ChunkFactory.createChunkType({type:"fresnel",build:function(){var a=this.program.draw,b=this.core;b.diffuse&&(this._uDiffuseFresnelCenterBias=a.getUniform("SCENEJS_uDiffuseFresnelCenterBias"),this._uDiffuseFresnelEdgeBias=a.getUniform("SCENEJS_uDiffuseFresnelEdgeBias"),this._uDiffuseFresnelPower=a.getUniform("SCENEJS_uDiffuseFresnelPower"),this._uDiffuseFresnelCenterColor=a.getUniform("SCENEJS_uDiffuseFresnelCenterColor"),this._uDiffuseFresnelEdgeColor=a.getUniform("SCENEJS_uDiffuseFresnelEdgeColor")),b.specular&&(this._uSpecularFresnelCenterBias=a.getUniform("SCENEJS_uSpecularFresnelCenterBias"),this._uSpecularFresnelEdgeBias=a.getUniform("SCENEJS_uSpecularFresnelEdgeBias"),this._uSpecularFresnelPower=a.getUniform("SCENEJS_uSpecularFresnelPower"),this._uSpecularFresnelCenterColor=a.getUniform("SCENEJS_uSpecularFresnelCenterColor"),this._uSpecularFresnelEdgeColor=a.getUniform("SCENEJS_uSpecularFresnelEdgeColor")),b.alpha&&(this._uAlphaFresnelCenterBias=a.getUniform("SCENEJS_uAlphaFresnelCenterBias"),this._uAlphaFresnelEdgeBias=a.getUniform("SCENEJS_uAlphaFresnelEdgeBias"),this._uAlphaFresnelPower=a.getUniform("SCENEJS_uAlphaFresnelPower"),this._uAlphaFresnelCenterColor=a.getUniform("SCENEJS_uAlphaFresnelCenterColor"),this._uAlphaFresnelEdgeColor=a.getUniform("SCENEJS_uAlphaFresnelEdgeColor")),b.reflect&&(this._uReflectFresnelCenterBias=a.getUniform("SCENEJS_uReflectFresnelCenterBias"),this._uReflectFresnelEdgeBias=a.getUniform("SCENEJS_uReflectFresnelEdgeBias"),this._uReflectFresnelPower=a.getUniform("SCENEJS_uReflectFresnelPower"),this._uReflectFresnelCenterColor=a.getUniform("SCENEJS_uReflectFresnelCenterColor"),this._uReflectFresnelEdgeColor=a.getUniform("SCENEJS_uReflectFresnelEdgeColor")),b.emit&&(this._uEmitFresnelCenterBias=a.getUniform("SCENEJS_uEmitFresnelCenterBias"),this._uEmitFresnelEdgeBias=a.getUniform("SCENEJS_uEmitFresnelEdgeBias"),this._uEmitFresnelPower=a.getUniform("SCENEJS_uEmitFresnelPower"),this._uEmitFresnelCenterColor=a.getUniform("SCENEJS_uEmitFresnelCenterColor"),this._uEmitFresnelEdgeColor=a.getUniform("SCENEJS_uEmitFresnelEdgeColor")),b.fragment&&(this._uFragmentFresnelCenterBias=a.getUniform("SCENEJS_uFragmentFresnelCenterBias"),this._uFragmentFresnelEdgeBias=a.getUniform("SCENEJS_uFragmentFresnelEdgeBias"),this._uFragmentFresnelPower=a.getUniform("SCENEJS_uFragmentFresnelPower"),this._uFragmentFresnelCenterColor=a.getUniform("SCENEJS_uFragmentFresnelCenterColor"),this._uFragmentFresnelEdgeColor=a.getUniform("SCENEJS_uFragmentFresnelEdgeColor"))},draw:function(){var a=(this.program.gl,this.core);a.diffuse&&(this._uDiffuseFresnelCenterBias&&this._uDiffuseFresnelCenterBias.setValue(a.diffuse.centerBias),this._uDiffuseFresnelEdgeBias&&this._uDiffuseFresnelEdgeBias.setValue(a.diffuse.edgeBias),this._uDiffuseFresnelPower&&this._uDiffuseFresnelPower.setValue(a.diffuse.power),this._uDiffuseFresnelCenterColor&&this._uDiffuseFresnelCenterColor.setValue(a.diffuse.centerColor),this._uDiffuseFresnelEdgeColor&&this._uDiffuseFresnelEdgeColor.setValue(a.diffuse.edgeColor)),a.specular&&(this._uSpecularFresnelCenterBias&&this._uSpecularFresnelCenterBias.setValue(a.specular.centerBias),this._uSpecularFresnelEdgeBias&&this._uSpecularFresnelEdgeBias.setValue(a.specular.edgeBias),this._uSpecularFresnelPower&&this._uSpecularFresnelPower.setValue(a.specular.power),this._uSpecularFresnelCenterColor&&this._uSpecularFresnelCenterColor.setValue(a.specular.centerColor),this._uSpecularFresnelEdgeColor&&this._uSpecularFresnelEdgeColor.setValue(a.specular.edgeColor)),a.alpha&&(this._uAlphaFresnelCenterBias&&this._uAlphaFresnelCenterBias.setValue(a.alpha.centerBias),this._uAlphaFresnelEdgeBias&&this._uAlphaFresnelEdgeBias.setValue(a.alpha.edgeBias),this._uAlphaFresnelPower&&this._uAlphaFresnelPower.setValue(a.alpha.power),
  this._uAlphaFresnelCenterColor&&this._uAlphaFresnelCenterColor.setValue(a.alpha.centerColor),this._uAlphaFresnelEdgeColor&&this._uAlphaFresnelEdgeColor.setValue(a.alpha.edgeColor)),a.reflect&&(this._uReflectFresnelCenterBias&&this._uReflectFresnelCenterBias.setValue(a.reflect.centerBias),this._uReflectFresnelEdgeBias&&this._uReflectFresnelEdgeBias.setValue(a.reflect.edgeBias),this._uReflectFresnelPower&&this._uReflectFresnelPower.setValue(a.reflect.power),this._uReflectFresnelCenterColor&&this._uReflectFresnelCenterColor.setValue(a.reflect.centerColor),this._uReflectFresnelEdgeColor&&this._uReflectFresnelEdgeColor.setValue(a.reflect.edgeColor)),a.emit&&(this._uEmitFresnelCenterBias&&this._uEmitFresnelCenterBias.setValue(a.emit.centerBias),this._uEmitFresnelEdgeBias&&this._uEmitFresnelEdgeBias.setValue(a.emit.edgeBias),this._uEmitFresnelPower&&this._uEmitFresnelPower.setValue(a.emit.power),this._uEmitFresnelCenterColor&&this._uEmitFresnelCenterColor.setValue(a.emit.centerColor),this._uEmitFresnelEdgeColor&&this._uEmitFresnelEdgeColor.setValue(a.emit.edgeColor)),a.fragment&&(this._uFragmentFresnelCenterBias&&this._uFragmentFresnelCenterBias.setValue(a.fragment.centerBias),this._uFragmentFresnelEdgeBias&&this._uFragmentFresnelEdgeBias.setValue(a.fragment.edgeBias),this._uFragmentFresnelPower&&this._uFragmentFresnelPower.setValue(a.fragment.power),this._uFragmentFresnelCenterColor&&this._uFragmentFresnelCenterColor.setValue(a.fragment.centerColor),this._uFragmentFresnelEdgeColor&&this._uFragmentFresnelEdgeColor.setValue(a.fragment.edgeColor))}}),SceneJS_ChunkFactory.createChunkType({type:"cubemap",build:function(){this._uCubeMapSampler=this._uCubeMapSampler||[],this._uCubeMapIntensity=this._uCubeMapIntensity||[];var a=this.core.layers;if(a)for(var b,c=this.program.draw,d=0,e=a.length;e>d;d++)b=a[d],this._uCubeMapSampler[d]="SCENEJS_uCubeMapSampler"+d,this._uCubeMapIntensity[d]=c.getUniform("SCENEJS_uCubeMapIntensity"+d)},draw:function(a){var b=this.core.layers;if(b)for(var c,d=this.program.draw,e=0,f=b.length;f>e;e++)c=b[e],this._uCubeMapSampler[e]&&c.texture&&(d.bindTexture(this._uCubeMapSampler[e],c.texture,a.textureUnit),a.textureUnit=(a.textureUnit+1)%SceneJS.WEBGL_INFO.MAX_TEXTURE_UNITS,this._uCubeMapIntensity[e]&&this._uCubeMapIntensity[e].setValue(c.intensity))}}),SceneJS_ChunkFactory.createChunkType({type:"xform",build:function(){var a=this.program.draw;this._uMatLocationDraw=a.getUniform("SCENEJS_uMMatrix"),this._uNormalMatLocationDraw=a.getUniform("SCENEJS_uMNMatrix");var b=this.program.pick;this._uMatLocationPick=b.getUniform("SCENEJS_uMMatrix")},draw:function(a){var b=!1;(SceneJS_configsModule.configs.forceXFormCoreRebuild===!0||this.core.dirty&&this.core.build)&&(this.core.build(),b=!0);this.program.gl;this._uMatLocationDraw&&this._uMatLocationDraw.setValue(this.core.mat),this._uNormalMatLocationDraw&&this._uNormalMatLocationDraw.setValue(this.core.normalMat),a.modelMat=this.core.mat},pick:function(a){this.core.dirty&&this.core.build();this.program.gl;this._uMatLocationPick&&this._uMatLocationPick.setValue(this.core.mat),a.modelMat=this.core.mat}}),SceneJS.configure({pluginPath:location.origin+location.pathname.substring(0,location.pathname.lastIndexOf("/"))+"/lib/scenejs/plugins"}),function(){function a(a){var b,c,d;a.size?(b=a.size[0],c=a.size[1],d=a.size[2]):(b=a.xSize||1,c=a.ySize||1,d=a.zSize||1);var e="geometry/box_"+b+"_"+c+"_"+d+(a.wire?"wire":"_solid");return this.getScene().hasCore("geometry",e)?{type:"geometry",coreId:e}:{type:"geometry",primitive:a.wire?"lines":"triangles",coreId:e,positions:new Float32Array([b,c,d,-b,c,d,-b,-c,d,b,-c,d,b,c,d,b,-c,d,b,-c,-d,b,c,-d,b,c,d,b,c,-d,-b,c,-d,-b,c,d,-b,c,d,-b,c,-d,-b,-c,-d,-b,-c,d,-b,-c,-d,b,-c,-d,b,-c,d,-b,-c,d,b,-c,-d,-b,-c,-d,-b,c,-d,b,c,-d]),normals:new Float32Array([0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1]),uv:new Float32Array([b,c,0,c,0,0,b,0,0,c,0,0,b,0,b,c,b,0,b,c,0,c,0,0,b,c,0,c,0,0,b,0,0,0,b,0,b,c,0,c,0,0,b,0,b,c,0,c]),indices:new Uint16Array([0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23])}}SceneJS.Types.addType("geometry/box",{construct:function(b){this.addNode(a.call(this,b))}})}(),function(){function a(a){var b="geometry/quad"+(a.wire?"wire":"_solid");return this.getScene().hasCore("geometry",b)?{type:"geometry",coreId:b}:{type:"geometry",primitive:a.wire?"lines":"triangles",coreId:b,positions:[1,1,0,-1,1,0,-1,-1,0,1,-1,0],normals:[-1,0,0,-1,0,0,-1,0,0,-1,0,0],uv:[1,1,0,1,0,0,1,0],indices:[0,1,2,0,2,3]}}SceneJS.Types.addType("geometry/quad",{construct:function(b){this.addNode(a.call(this,b))}})}(),function(){function a(a){var b=a.latitudeBands||30,c=a.longitudeBands||30,d=a.radius||1,e="geometry/sphere_"+(a.wire?"wire":"_solid")+d+"_"+c+"_"+b;if(this.getScene().hasCore("geometry",e))return{type:"geometry",coreId:e};for(var f=[],g=[],h=[],i=0;b>=i;i++)for(var j=i*Math.PI/b,k=Math.sin(j),l=Math.cos(j),m=0;c>=m;m++){var n=2*m*Math.PI/c,o=Math.sin(n),p=Math.cos(n),q=p*k,r=l,s=o*k,t=1-m/c,u=i/b;g.push(q),g.push(r),g.push(s),h.push(t),h.push(u),f.push(d*q),f.push(d*r),f.push(d*s)}for(var v=[],i=0;b>i;i++)for(var m=0;c>m;m++){var w=i*(c+1)+m,x=w+c+1;v.push(w+1),v.push(x+1),v.push(x),v.push(w+1),v.push(x),v.push(w)}return{type:"geometry",primitive:a.wire?"lines":"triangles",coreId:e,positions:new Float32Array(f),normals:new Float32Array(g),uv:new Float32Array(h),indices:new Uint16Array(v)}}SceneJS.Types.addType("geometry/sphere",{construct:function(b){this.addNode(a.call(this,b))}})}(),function(){function a(a){var b=a.width||1,c=a.height||1,d=a.widthSegments||1,e=a.heightSegments||1,f="geometry/plane_"+(1==a.wire?"wire_":"")+c+"_"+d+"_"+e;if(this.getScene().hasCore("geometry",f))return{type:"geometry",coreId:f};var g,h,i,j,k=[],l=[],m=[],n=[],o=b/2,p=c/2,q=d,r=e,s=q+1,t=r+1,u=b/q,v=c/r;for(h=0;t>h;h++)for(g=0;s>g;g++)i=g*u-o,j=h*v-p,k.push(i),k.push(-j),k.push(0),l.push(0),l.push(0),l.push(1),m.push(g/q),m.push(1-h/r);var w,x,y,z;for(h=0;r>h;h++)for(g=0;q>g;g++)w=g+s*h,x=g+s*(h+1),y=g+1+s*(h+1),z=g+1+s*h,n.push(w),n.push(x),n.push(y),n.push(y),n.push(z),n.push(w);return{type:"geometry",primitive:a.wire?"lines":"triangles",coreId:f,positions:new Float32Array(k),normals:new Float32Array(l),uv:new Float32Array(m),indices:new Uint16Array(n)}}SceneJS.Types.addType("geometry/plane",{construct:function(b){this.addNode(a.call(this,b))}})}(),function(){"use strict";var a=window.Human={},b="9.2.0";b=b.indexOf("ENGINE_VERSION")>0?"qa":b;var c="2.0.1";c=c.indexOf("API_VERSION")>0?"qa":c,a.VERSION=b,a.API_VERSION=c,a.deployed=!(window.location.hostname.match(/(localhost|192\.168\.11\.\d{1,3})/)||"file:"===window.location.protocol),a.locale="en-US",a.timer=window.performance||window.Date,a.stats={loadSequence:{startTime:a.timer.now(),moduleRequest:0,moduleLoaded:0,assetsRequested:0,assetsLoaded:0,texturesRequested:0,texturesLoaded:0},loadTimes:{preModule:0,moduleDownload:0,preAsset:0,assetDownload:0,preTexture:0,textureDownload:0}},a.CANVAS_ID="theCanvas",a.ANNOTATION_CANVAS_ID="annotationCanvas",a.CONTAINER_ID="container",a.SCENE_ROOT_ID="bds-human",a.CONTENT_ROOT_ID="outline",a.MATERIAL_ROOT_ID="human.outline",a.NULL_OBJECT_ID="null-object",a.NULL_OBJECT_ID2="null-object-2",a.CLIP_INDICATORS_ATTACH_ID="clip-indicators",a.CLIP_ATTACH_ID="clips",a.LOOKAT_ID="theLookat",a.CAMERA_ID="theCamera",a.VIEW_SPACE_ID="viewSpace",SceneJS.bind("error",function(b){a._error("WEBGL",b.errorName,b.exception,!0)}),a.error=function(b,c){return void 0===c&&(c=b,b="ERROR"),a._error("HUMAN",b,c,!1)},a.fatalError=function(b,c){return void 0===c&&(c=b,b="ERROR"),a._error("HUMAN",b,c,!0)},a._error=function(b,c,d,e){return a.events.fire("error",{type:b,name:c,message:d,fatal:e,log:a.log.messages.join("\n"),stack:a.utils.getStackTrace(),webglInfo:SceneJS.WEBGL_INFO}),d};var d=document.getElementById(a.ANNOTATION_CANVAS_ID);d&&d.getContext("2d")}(),function(){"use strict";Human.Component=function(){},Human.Component.prototype={_init:function(a){this._ctx=a,this._handleMap=new Human.utils.Map,this._topicSubs={},this._handleTopics={},this._topicPubs={}},publish:function(a,b,c){c||(this._topicPubs[a]=b);var d=this._topicSubs[a];if(d)for(var e in d)d.hasOwnProperty(e)&&d[e].call(this,b)},on:function(a,b){var c=this._topicSubs[a];c||(c={},this._topicSubs[a]=c);var d=this._handleMap.addItem();c[d]=b,this._handleTopics[d]=a;var e=this._topicPubs[a];return e&&b.call(this,e),d},off:function(a){var b=this._handleTopics[a];if(b){delete this._handleTopics[a];var c=this._topicSubs[b];c&&delete c[a],this._handleMap.removeItem(a)}},once:function(a,b){var c=this,d=this.on(a,function(a){c.off(d),b(a)})}}}(),function(){"use strict";function a(a,b){return b>a?-1:a>b?1:0}Human.utils=Human.utils||{},Human.utils.isArray=function(a){return a&&!a.propertyIsEnumerable("length")&&"object"==typeof a&&"number"==typeof a.length},Human.utils.isObject=function(a){return!!a&&"[object Object]"===Object.prototype.toString.call(a)},Human.utils.isPrimitive=function(a){return null===a||!!(typeof a).match(/^(string|number|boolean|undefined)$/)},Human.utils.isString=function(a){return"string"==typeof a||a instanceof String},Human.utils.filterInPlace=function(a,b){for(var c=0,d=0,e=a.length;e>d;d++)b(a[d])?a[d-c]=a[d]:c++;return a.length=a.length-c,a},Human.utils.getStackTrace=function(){var a,b=new Error;if(b.stack)a=b.stack;else try{throw b}catch(c){a=c.stack}return a||null},Human.utils.extend=function(a,b){var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a},Human.utils.apply=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},Human.utils.applyIf=function(a,b){for(var c in a)a.hasOwnProperty(c)&&(void 0===b[c]||null===b[c])&&(b[c]=a[c]);return b},Human.utils.applyIf2=function(a,b){a=a||{};var c={};for(var d in b)b.hasOwnProperty(d)&&(c[d]=void 0!==a[d]?a[d]:b[d]);return c},Human.utils.shallowClone=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},Human.utils.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0},Human.utils.getDir=function(a){var b=a.lastIndexOf("/");return b>-1?a.substring(0,b>0?b+1:0):""},Human.utils.async=function(a){setTimeout(a,0)},Human.utils.noop=function(){},Human.utils.getKeys=function(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b},Human.utils.createUUID=function(){for(var a=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"],b=["8","9","A","B"],c=[],d=0;38>d;d++)switch(d){case 8:c.push("-");break;case 13:c.push("-");break;case 18:c.push("-");break;case 14:c.push("4");break;case 19:c.push(b[Math.round(3*Math.random())]);break;default:c.push(a[Math.round(15*Math.random())])}return c.join("")},Human.utils.binarySearch=function(b,c,d,e){d=d||a,e=e||{index1:null,index2:null,value1:null,value2:null};var f,g,h,i=0,j=b.length-1;if(d(b[0],c)>0)return e.index1=null,e.value1=null,e.index2=0,e.value2=b[0],e;if(d(b[j],c)<0)return e.index1=j,e.value1=b[j],e.index2=null,e.value2=null,e;for(;j>=i;){if(f=Math.floor((i+j)/2),g=b[f],h=b[f+1],d(g,c)<=0&&d(h,c)>=0)return e.index1=f,e.index2=f+1,e.value1=g,e.value2=h,e;d(g,c)>0?j=f-1:i=f+1}},Human.utils.atos=function(a,b,c){b=b||0,c=c||a.byteLength;var d=new Uint8Array(a,b,c),e=new TextDecoder("utf-8").decode(d);return e},Human.utils.atoj=function(a,b,c){return JSON.parse(Human.utils.atos(a,b,c))},Human.utils.benchmark=function(a,b){b=b||1e7;for(var c=performance.now(),d=0;b>d;d++)a();c=performance.now()-c,console.log("Total time: "+c.toFixed(3)+"ms"),console.log("Time / operation: "+(c/b).toExponential(3)+"ms")},Human.utils.setRandomVisibleObjects=function(a){for(var b=Object.keys(Human.scene.objects).filter(function(a){return Human.scene.objects[a].isLeaf()}),c={},d=0;a>d;d++){var e=Math.floor(Math.random()*b.length);c[b.splice(e,1)]=!0}Human.scene.setEnabledObjects({objectIds:c,replace:!0})},Human.utils.getBinary=function(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="arraybuffer",d.onload=function(){200===d.status?b(d.response):c()},d.send(null)}}(),function(){"use strict";var a=Human.math={X_AXIS:vec3.fromValues(1,0,0),Y_AXIS:vec3.fromValues(0,1,0),Z_AXIS:vec3.fromValues(0,0,1)};a.clamp=function(a,b,c){return b>a?b:a>c?c:a},a.lerpVec3=function(a,b,c,d,e,f){f=f||vec3.create();var g=(a-b)/(c-b);return f[0]=d[0]+g*(e[0]-d[0]),f[1]=d[1]+g*(e[1]-d[1]),f[2]=d[2]+g*(e[2]-d[2]),f},a.getShortRotation=function(a,b){var c=b>a?1:-1,d=(b-a)*c;return d=(d+Math.PI)%(2*Math.PI)-Math.PI,d*c},a.lerpRadian=function(b,c,d){var e=a.getShortRotation(c,d),f=c+b*e;return f},a.lerpVec3Cylindrical=function(b,c,d,e,f,g){g=g||vec3.create();var h=(b-c)/(d-c);return g[0]=e[0]+h*(f[0]-e[0]),g[1]=a.lerpRadian(h,e[1],f[1]),g[2]=e[2]+h*(f[2]-e[2]),g},Human.math.vec3ObjToArray=function(a,b){var c=b||vec3.create();return c[0]=a.x||0,c[1]=a.y||0,c[2]=a.z||0,c},Human.math.vec3ArrayToObj=function(a){return{x:a[0],y:a[1],z:a[2]}},a.cartesianToCylindrical=function(a,b){var c=b||vec3.create();return c[0]=Math.sqrt(a[0]*a[0]+a[2]*a[2]),c[1]=Math.atan2(a[0],a[2]),c[2]=a[1],c},a.cylindricalToCartesian=function(a,b){var c=b||vec3.create();return c[0]=a[0]*Math.sin(a[1]),c[1]=a[2],c[2]=a[0]*Math.cos(a[1]),c},a.AxisBox3=function(a,b){this.verts=[[a[0],a[1],a[2]],[b[0],a[1],a[2]],[b[0],b[1],a[2]],[a[0],b[1],a[2]],[a[0],a[1],b[2]],[b[0],a[1],b[2]],[b[0],b[1],b[2]],[a[0],b[1],b[2]]]},a.easeOut=function(a,b,c){var d=a*a,e=d*a;return b+c*(-1*d*d+4*e+-6*d+4*a)},a.easeIn=function(b,c,d){return 1-a.easeOut(1-b,c,d)},a.easeInOut=function(b,c,d){return.5>b?a.easeIn(2*b,c,d)/2:.5*a.easeOut(2*b-1,c,d)+.5},a.getBoundaryCenter=function(a,b){var c=b||vec3.create();return c[0]=.5*(a.xmax+a.xmin),c[1]=.5*(a.ymax+a.ymin),c[2]=.5*(a.zmax+a.zmin),c};var b=vec3.create();a.getBoundaryDiag=function(a){return b[0]=a.xmax-a.xmin,b[1]=a.ymax-a.ymin,b[2]=a.zmax-a.zmin,vec3.length(b)},a.createPlane=function(a,b){var c={p:a||vec3.create(),n:b||vec3.create(),d:0};c.update=function(a,b){c.p.set(a),c.n.set(b),c.d=-vec3.dot(c.n,a)},c.distance=function(a){return vec3.dot(c.n,a)+c.d};var d=vec3.create();return c.boundaryInside=function(a,b,e,f,g,h){return d[0]=a,d[1]=e,d[2]=g,c.n[0]>=0&&(d[0]=b),c.n[1]>=0&&(d[1]=f),c.n[2]>=0&&(d[2]=h),c.distance(d)<0?!1:!0},c}}(),function(){"use strict";function a(a,b,c,d,e){"undefined"==typeof e&&(e=.5);var f=i.projectionratio(e,a),g=1-f,h={x:f*b.x+g*d.x,y:f*b.y+g*d.y},j=i.abcratio(e,a),k={x:c.x+(c.x-h.x)/j,y:c.y+(c.y-h.y)/j};return{A:k,B:c,C:h}}var b=Math.abs,c=Math.cos,d=Math.sin,e=Math.atan2,f=Math.sqrt,g=Math.pow,h={x:0,y:0,z:0},i={Tvalues:[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Cvalues:[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],arcfn:function(a,b){var c=b(a),d=c.x*c.x+c.y*c.y;return"undefined"!=typeof c.z&&(d+=c.z*c.z),f(d)},length:function(a){var b,c,d=.5,e=0,f=i.Tvalues.length;for(b=0;f>b;b++)c=d*i.Tvalues[b]+d,e+=i.Cvalues[b]*i.arcfn(c,a);return d*e},map:function(a,b,c,d,e){var f=c-b,g=e-d,h=a-b,i=h/f;return d+g*i},lerp:function(a,b,c){var d={x:b.x+a*(c.x-b.x),y:b.y+a*(c.y-b.y)};return b.z&&c.z&&(d.z=b.z+a*(c.z-b.z)),d},pointToString:function(a){var b=a.x+"/"+a.y;return"undefined"!=typeof a.z&&(b+="/"+a.z),b},pointsToString:function(a){return"["+a.map(i.pointToString).join(", ")+"]"},angle:function(a,b,c){var d,g=b.x-a.x,h=b.y-a.y,i=c.x-a.x,j=c.y-a.y,k=g*j-h*i,l=f(g*g+h*h),m=f(i*i+j*j);return g/=l,h/=l,i/=m,j/=m,d=g*i+h*j,e(k,d)},dist:function(a,b){var c=a.x-b.x,d=a.y-b.y;return f(c*c+d*d)},abcratio:function(a,c){if(2!==c&&3!==c)return!1;if("undefined"==typeof a)a=.5;else if(0===a||1===a)return a;var d=g(a,c)+g(1-a,c),e=d-1;return b(e/d)},projectionratio:function(a,b){if(2!==b&&3!==b)return!1;if("undefined"==typeof a)a=.5;else if(0===a||1===a)return a;var c=g(1-a,b),d=g(a,b)+c;return c/d},align:function(a,b){var f=b.p1.x,g=b.p1.y,h=-e(b.p2.y-g,b.p2.x-f),i=function(a){return{x:(a.x-f)*c(h)-(a.y-g)*d(h),y:(a.x-f)*d(h)+(a.y-g)*c(h)}};return a.map(i)}},j=Human.math.bezier=function(a){var c=a&&a.forEach?a:[].slice.call(arguments),d=!1;if("object"==typeof c[0]){d=c.length;var e=[];c.forEach(function(a){["x","y","z"].forEach(function(b){"undefined"!=typeof a[b]&&e.push(a[b])})}),c=e}var f=!1,g=c.length;if(d){if(d>4){if(1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");f=!0}}else if(6!==g&&8!==g&&9!==g&&12!==g&&1!==arguments.length)throw new Error("Only new Bezier(point[]) is accepted for 4th and higher order curves");var h=!f&&(9===g||12===g)||a&&a[0]&&"undefined"!=typeof a[0].z;this._3d=h;for(var j=[],k=0,l=h?3:2;g>k;k+=l){var m={x:c[k],y:c[k+1]};h&&(m.z=c[k+2]),j.push(m)}this.order=j.length-1,this.points=j;var n=["x","y"];h&&n.push("z"),this.dims=n,this.dimlen=n.length,function(a){for(var c=i.align(j,{p1:j[0],p2:j[a.order]}),d=0;d<c.length;d++)if(b(c[d].y)>1e-4)return void(a._linear=!1);a._linear=!0}(this),this._t1=0,this._t2=1,this.update()};j.quadraticFromPoints=function(b,c,d,e){if("undefined"==typeof e&&(e=.5),0===e)return new j(c,c,d);if(1===e)return new j(b,c,c);var f=a(2,b,c,d,e);return new j(b,f.A,d)},j.cubicFromPoints=function(b,c,d,e,f){"undefined"==typeof e&&(e=.5);var g=a(3,b,c,d,e);"undefined"==typeof f&&(f=i.dist(c,g.C));var h=f*(1-e)/e,k=i.dist(b,d),l=(d.x-b.x)/k,m=(d.y-b.y)/k,n=f*l,o=f*m,p=h*l,q=h*m,r={x:c.x-n,y:c.y-o},s={x:c.x+p,y:c.y+q},t=g.A,u={x:t.x+(r.x-t.x)/(1-e),y:t.y+(r.y-t.y)/(1-e)},v={x:t.x+(s.x-t.x)/e,y:t.y+(s.y-t.y)/e},w={x:b.x+(u.x-b.x)/e,y:b.y+(u.y-b.y)/e},x={x:d.x+(v.x-d.x)/(1-e),y:d.y+(v.y-d.y)/(1-e)};return new j(b,w,x,d)},j.prototype={valueOf:function(){return this.toString()},toString:function(){return i.pointsToString(this.points)},update:function(){this.dpoints=[];for(var a=this.points,b=a.length,c=b-1;b>1;b--,c--){for(var d,e=[],f=0;c>f;f++)d={x:c*(a[f+1].x-a[f].x),y:c*(a[f+1].y-a[f].y)},this._3d&&(d.z=c*(a[f+1].z-a[f].z)),e.push(d);this.dpoints.push(e),a=e}this.computedirection()},computedirection:function(){var a=this.points,b=i.angle(a[0],a[this.order],a[1]);this.clockwise=b>0},length:function(){return i.length(this.derivative.bind(this))},_lut:[],getLUT:function(a){if(a=a||100,this._lut.length===a)return this._lut;this._lut=[];for(var b=0;a>=b;b++)this._lut.push(this.compute(b/a));return this._lut},on:function(a,b){b=b||5;for(var c,d=this.getLUT(),e=[],f=0,g=0;g<d.length;g++)c=d[g],i.dist(c,a)<b&&(e.push(c),f+=g/d.length);return e.length?f/=e.length:!1},get:function(a){return this.compute(a)},point:function(a){return this.points[a]},compute:function(a){if(0===a)return this.points[0];if(1===a)return this.points[this.order];var b,c=this.points,d=1-a;if(1===this.order)return b={x:d*c[0].x+a*c[1].x,y:d*c[0].y+a*c[1].y},this._3d&&(b.z=d*c[0].z+a*c[1].z),b;if(this.order<4){var e,f,g,i=d*d,j=a*a,k=0;return 2===this.order?(c=[c[0],c[1],c[2],h],e=i,f=d*a*2,g=j):3===this.order&&(e=i*d,f=i*a*3,g=d*j*3,k=a*j),b={x:e*c[0].x+f*c[1].x+g*c[2].x+k*c[3].x,y:e*c[0].y+f*c[1].y+g*c[2].y+k*c[3].y},this._3d&&(b.z=e*c[0].z+f*c[1].z+g*c[2].z+k*c[3].z),b}for(var l=JSON.parse(JSON.stringify(this.points));l.length>1;){for(var m=0;m<l.length-1;m++)l[m]={x:l[m].x+(l[m+1].x-l[m].x)*a,y:l[m].y+(l[m+1].y-l[m].y)*a},"undefined"!=typeof l[m].z&&(l[m]=l[m].z+(l[m+1].z-l[m].z)*a);l.splice(l.length-1,1)}return l[0]},derivative:function(a){var b,c,d=1-a,e=0,f=this.dpoints[0];2===this.order&&(f=[f[0],f[1],h],b=d,c=a),3===this.order&&(b=d*d,c=d*a*2,e=a*a);var g={x:b*f[0].x+c*f[1].x+e*f[2].x,y:b*f[0].y+c*f[1].y+e*f[2].y};return this._3d&&(g.z=b*f[0].z+c*f[1].z+e*f[2].z),g}}}(),Human.utils.concurrentMapIterate=function(a,b,c,d,e){"use strict";function f(){++k>=j&&!l&&d()}function g(a){l||(l=!0,e(a))}var h=[];for(var i in a)a.hasOwnProperty(i)&&h.push(i);var j=h.length;if(0===j)return void d();var k=0,l=!1;if(b)for(var m=0,n=h.length;n>m;m++)c.call(b,h[m],a[h[m]],f,g);else for(m=0,n=h.length;n>m;m++)c(h[m],a[h[m]],f,g)},Human.utils.ConcurrentTasks=function(){"use strict";function a(){--f<=0&&!g&&c()}function b(a){g||(g=!0,d(a))}var c,d,e=[],f=0,g=!1;this.add=function(a){e[f++]=a},this.go=function(h,i){if(c=h,d=i,g=!1,f>0)for(var j=0,k=f;k>j;j++)e[j](a,b);else h()}},function(){"use strict";var a=Human.utils.fileExists={},b={},c=[],d=200;a.test=function(a,e){var f=b[a];if(void 0!==f)return void e(f);var g=new XMLHttpRequest;g.open("HEAD",a),g.onreadystatechange=function(){if(4===g.readyState){if(c.length>=d){var h=c.shift();delete b[h]}f=404!==g.status,b[a]=f,c.push(a),e(f)}},g.send()}}(),Human.utils.ArrayIteration=function(a,b,c,d){"use strict";function e(){0===a.length?c&&c():window.setTimeout(g,1)}function f(a){h||(h=!0,d?d(a):c&&c())}function g(){a.length>0&&b(a.shift(),e,f)}this.push=function(b){a.push(b),window.setTimeout(g,1)};var h=!1;return 0===a.length?void(c&&c()):void window.setTimeout(g,1)},Human.utils.TagMap=function(){"use strict";var a,b={},c={},d={};this.addItem=function(e,f,g){for(var h,i,j,k=0,l=f.length;l>k;k++)h=f[k],i=b[h],i||(i=b[h]={}),i[e]=g,j=c[h],j?c[h]++:c[h]=1;d[e]=g,a&&(a=null)},this.findItems=function(b){b=b||{};var c=b.tags||[],d=c.join("."),e=b.matching||"any";a||(a={});var f=a[e];f||(f=a[e]={});var g=f[d];if(!g){switch(e){case"most":g=this._findHitsMost(c);break;case"atLeast":g=this._findHitsAtLeast(c);break;case"any":g=this._findHitsAny(c)}f[d]=g}return g},this._findHitsMost=function(a){for(var c,d,e,f={},g=0,h=a.length;h>g;g++)if(c=a[g],d=b[c])for(var i in d)if(d.hasOwnProperty(i)){var j=f[i];j=j?++f[i]:f[i]=1,(!e||j>f[e])&&(e=i)}var k={};return e&&(k[e]=d[e]),k},this._findHitsAtLeast=function(a){for(var c,d,e={},f=a.length,g={},h=0,i=a.length;i>h;h++)if(c=a[h],d=b[c])for(var j in d)if(d.hasOwnProperty(j)){var k=e[j];k=k?++e[j]:e[j]=1,k===f&&(g[j]=d[j])}return g},this._findHitsAny=function(a){for(var c,d,e={},f=0,g=a.length;g>f;f++)if(c=a[f],d=b[c])for(var h in d)d.hasOwnProperty(h)&&(e[h]=d[h]);return e},this.removeItem=function(e){var f,g;for(var h in b)b.hasOwnProperty(h)&&(f=b[h],g=f[e],g&&(delete f[e],0===--c[h]&&(delete b[h],delete c[h])));delete d[e],a&&(a=null)}},Human.utils.TagMapList=function(){"use strict";var a,b={},c={},d={};this.addItem=function(e,f,g){if(0!==f.length){for(var h,i,j,k=0,l=f.length;l>k;k++)h=f[k],i=b[h],i||(i=b[h]={}),i[e]=g,j=c[h],j?c[h]++:c[h]=1;d[e]=g,a&&(a=null)}},this.findItems=function(b){b=b||{};var c=b.tags||[],d=c.join("."),e=b.matching||"any";a||(a={});var f=a[e];f||(f=a[e]={});var g=f[d];if(!g){switch(e){case"most":g=this._findHitsMost(c);break;case"atLeast":g=this._findHitsAtLeast(c);break;case"any":g=this._findHitsAny(c);break;case"except":g=this._findHitsExcept(c)}f[d]=g}return g},this._findHitsMost=function(a){for(var c,d,e,f={},g=0,h=a.length;h>g;g++)if(c=a[g],d=b[c])for(var i in d)if(d.hasOwnProperty(i)){var j=f[i];j=j?++f[i]:f[i]=1,(!e||j>f[e])&&(e=i)}var k=[];return e&&k.push(d[e]),k},this._findHitsAtLeast=function(a){for(var c,d,e={},f=a.length,g={},h=[],i=0,j=a.length;j>i;i++)if(c=a[i],d=b[c])for(var k in d)if(d.hasOwnProperty(k)&&!g[k]){var l=e[k];l=l?++e[k]:e[k]=1,l===f&&(h.push(d[k]),g[k]=!0)}return h},this._findHitsAny=function(a){for(var c,d,e={},f=[],g=0,h=a.length;h>g;g++)if(c=a[g],d=b[c])for(var i in d)d.hasOwnProperty(i)&&(e[i]||(f.push(d[i]),e[i]=!0));return f},this._findHitsExcept=function(a){var c=[];for(var e in d)if(d.hasOwnProperty(e))for(var f=0;f<a.length;f++){var g=b[a[f]];if(void 0!==g&&void 0!==g[e])break;f===a.length-1&&c.push(d[e])}return c},this.removeItem=function(e){var f,g;for(var h in b)b.hasOwnProperty(h)&&(f=b[h],g=f[e],g&&(delete f[e],0===--c[h]&&(delete b[h],delete c[h])));delete d[e],a&&(a=null)}},Human.utils.Map=function(a,b){"use strict";this.items=a||[];var c=b||0,d=c;"number"!=typeof c&&(d=c+"0"),this.addItem=function(){var a;if(2===arguments.length){var b=arguments[0];if(a=arguments[1],this.items[b])throw"ID clash: '"+b+"'";return this.items[b]=a,b}for(;;){a=arguments[0];var e;if("number"==typeof c?e=d++:(e=c+parseInt(d.substr(c.length)),d=c+(parseInt(d.substr(c.length))+1)),!this.items[e])return this.items[e]=a,e}},this.removeItem=function(a){var b=this.items[a];return void 0!==b&&(delete this.items[a],d=a),b}},Human.utils.IDPool=function(a){"use strict";a=a||{};var b=a.prefix||"id",c=b.length,d=[],e={},f={};this.getId=function(a){if(a){if(e[a]||f[a])throw"ID already in use: "+a;return e[a]=!0,a}for(var c,g=0,h=d.length;h>g;g++)if(!d[g]&&(c=b+g,!e[c]))return d[g]=!0,f[c]=!0,c;return d.push(!0),c=b+(d.length-1),f[c]=!0,c},this.containsId=function(a){return void 0!==e[a]||void 0!==f[a]},this.putId=function(a){e[a]?delete e[a]:f[a]&&(d[parseInt(a.substr(c))]=!1,delete f[a])}},Human.utils.Loader=function(){"use strict";this._loadedModelLibs={},this.configure=function(){},this.load=function(a,b,c,d,e,f){if(this._loadedModelLibs[b]=this._loadedModelLibs[b]||{},this._loadedModelLibs[b][c])return Human.log.warn("Human.utils.Loader.load","Library '"+c+"' already loaded for model '"+b+"' - not reloading"),void e();var g=this,h=function(){g._loadedModelLibs[b][c]=!0,e()};this._load(a,b,c,d,h,f)},this._load=function(a,b,c,d,e){Human.log.error("Human.utils.Loader._load not implemented"),e()},this.unload=function(a){var b=this._loadedModelLibs[a];if(b){for(var c in b)b.hasOwnProperty(c)&&this._unload(a+"."+c);delete this._loadedModelLibs[a]}},this._unload=function(){Human.log.error("Human.utils.Loader._unload","This method needs to be implemented")}},function(){"use strict";var a=Human.events={},b={},c=0,d=[{}],e={},f={},g=!1;a.addBinder=function(a,c){(b[a]||(b[a]=[])).push(c)},a.createChannel=function(b){var c=d.length;return d.push({}),b&&b.enabled&&a.enableChannel(c,b.enabled),c},a.enableChannel=function(a,b){e[a]=b},a.onEvent=a.on=function(){var a,g,h,i;if("number"==typeof arguments[0]){if(a=arguments[0],a>d.length-1)return void Human.log.error("Human_event.onEvent","Channel not created: "+a+" - should be created first with Human.events.createChannel");g=arguments[1],h=arguments[2],i=arguments[3]}else if("object"==typeof arguments[0]){var j=arguments[0];g=j.type,h=j.fn;var k=b[g];if(k)for(var l=j.mask||{},m=0,n=k.length;n>m;m++)k[m](l,h);a=void 0!==j.channel&&null!==j.channel?j.channel:c,i=j.options}else a=c,g=arguments[0],h=arguments[1],i=arguments[2];e[a]=i&&void 0!==i.enable&&null!==i.enable?i.enable:!0,i=i||{};var o=d[a];o||(o=d[a]={});var p=o[g];p||(p=[],o[g]=p);var q={fn:h,priority:void 0===i.priority?p.length:i.priority,once:i.once};for(m=0;m<p.length;m++)if(p[m].priority>q.priority)return void p.splice(m,0,q);p.push(q),f[g]&&q.fn(f[g])},a.once=function(b,c){var d=function(e){a.off(b,d),c(e)};a.on(b,d)},a.fireEvent=a.fire=function(a,b,c){if(!g){for(var h,i,j=0,k=d.length;k>j;j++)if(e[j]&&(h=d[j],i=h[a])){b||(b={});for(var l,m,n=0,o=i.length;o>n;n++){m=i[n];try{m.fn(b),m.once&&(l||(l=[]),l.push(n))}catch(p){Human.log.error(p)}}if(l)for(n=l.length-1;n>=0;n--)i.splice(l[n])}c&&(f[a]=b)}},a.blockEvents=function(a){g=!0;try{a()}catch(b){Human.log.error(b.message)}g=!1},a.unEvent=a.off=function(a,b,e){if(void 0===e||null===e)e=c;else if(e>=d.length||0>e)throw"Channel does not exist: "+e;var f=d[e];f||(f=d[e]={});var g=f[a];g||(g=[],f[a]=g);for(var h=g.length;h--;)g[h].fn===b&&g.splice(h,1)}}(),function(){"use strict";var a=Human.properties={},b=new Human.utils.IDPool;a.properties={};var c={},d={},e={};a.subscribe=function(f){f=f||{};var g=f.propId;if(!g)return Human.log.error("Human.properties.subscribe","Param expected: propId"),null;var h=f.callback;if(!h)return Human.log.error("Human.properties.subscribe","Param expected: callback"),null;if(f.subId&&b.containsId(f.subId))return Human.log.error("Human.properties.subscribe","Subscription already exists with this ID: "+f.subId),null;var i,j=f.value,k=b.getId(f.subId),l=a.properties[g];return l?(i=d[g]||(d[g]={}),i[k]=h,j&&(a.properties[g]=j),c[k]=h,e[k]=g,h(j),k):(i=d[g]||(d[g]={}),i[k]=h,(void 0===j||null===j)&&(j={}),a.properties[g]=j,c[k]=h,e[k]=g,h(j),k)},a.resubscribe=function(b,f){var g=c[b];if(!g)return void Human.log.warn("Human.properties.resubscribe","Subscription not found: '"+b+"'");var h=e[b],i=a.properties[f];h&&i&&(d[h]&&delete d[h][b],(d[f]||(d[f]={}))[b]=g,e[b]=f,g(i))},a.set=function(b){var c,e;for(var f in b)if(b.hasOwnProperty(f)&&(c=b[f],a.properties[f]=c,e=d[f]))for(var g in e)e.hasOwnProperty(g)&&e[g](c)},a.unsubscribe=function(a){var b=e[a];b&&(delete e[a],delete d[b][a])},a.query=function(b){if(!b)return a.properties;var c;if(b){var d=new RegExp(b);c={};for(var e in a.properties)a.properties.hasOwnProperty(e)&&d.test(e)&&(c[e]=a.properties[e])}return c};var f={"annotations.margins":{top:80,left:50,right:50,bottom:50},"annotations.labelWidth":120,"annotations.horizontalLines":!1,"annotations.fadeoutAngle":100,"annotation.layout.labelWidth":100,"annotations.hideWhileCameraMoving":!1,"annotations.layout.type":"draggable","camera.optics.far":5e3,"camera.optics.fov":55,"camera.optics.near":.1,"camera.zoomLimits":{max:300,min:.01},"fog.color":[1,1,1],"fog.density":.01,"fog.enabled":!1,"fog.end":1e3,"fog.max":1,"fog.min":0,"fog.mode":1,"fog.start":0,"timeline.autoPlay.enabled":!1,"timeline.autoPlay.type":"play","timeline.chapterCamerasEnabled":!0,"timeline.prevNextMode":"scrub","tooltips.enabled":!0,"ui.mouseWheel.capture":!0,"ui.zoom.mouseWheel.enabled":!0};a.getDefaults=function(a){return a?f.hasOwnProperty(a)?f[a]:void 0:Human.utils.shallowClone(f)},a.setDefaults=function(a){Human.utils.apply(a,f)}}(),function(){"use strict";function a(a){return a.length<45?a+"                                                           ".substr(0,45-a.length):a}function b(a,b){var e=d[b].toUpperCase();c.messages.length>c.maxMessages&&c.messages.shift(),a="["+e+"]	"+a,c.messages.push(a)}var c=Human.log={};c.LOG_NONE=0,c.LOG_DEBUG=1,c.LOG_INFO=2,c.LOG_WARN=3,c.LOG_ERROR=4,c.messages=[],c.maxMessages=100;var d=["none","debug","info","warn","error"],e=c.messageBuf=[],f=200,g=c.LOG_WARN,h=c.reporters={};c.setLevel=function(a){g=a},c.getLevel=function(){return g},c.log=function(a,i){switch(i=void 0===i||null===i?c.INFO:i){case c.LOG_DEBUG:g<=c.LOG_DEBUG&&window.console&&window.console.debug&&(window.console.debug(a),b(a,i));break;case c.LOG_ERROR:g<=c.LOG_ERROR&&window.console&&window.console.error&&(window.console.error(a),b(a,i));break;case c.LOG_INFO:g<=c.LOG_INFO&&window.console&&window.console.info&&(window.console.info(a),b(a,i));break;case c.LOG_WARN:g<=c.LOG_WARN&&window.console&&window.console.warn&&(window.console.warn(a),b(a,i))}var j={message:a,level:d[i]};for(var k in h)h.hasOwnProperty(k)&&Human.events.fire(k,j);e.length>f&&(e.length=0,e.push({message:"Logging buffer exceeded max length of "+f+" - messages to this point were flushed",level:d[c.LOG_WARN]})),e.push(j)},c.debug=function(){c.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],c.LOG_DEBUG)},c.error=function(){c.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],c.LOG_ERROR)},c.info=function(){c.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],c.LOG_INFO)},c.warn=function(){c.log(1===arguments.length?arguments[0]:"["+a(arguments[0])+"] "+arguments[1],c.LOG_WARN)},Human.events.on("error",function(a){c.error(a.message)})}(),function(){"use strict";var a,b,c,d=Human.request={};d.getHashStr=function(){
  return window.location.hash},d.getHashParams=function(){if(!b||a!==window.location.hash){b={};for(var c,d=window.location.hash.slice(1),e=d.split(","),f=0,g=e.length;g>f;f++)c=e[f].split("="),b[c[0]]=c[1];a=window.location.hash}return b},d.getHashParam=function(c){return b&&a===window.location.hash||d.getHashParams(),b[c]},d.getSearchStr=function(){return window.location.search},d.getSearchParams=function(){if(!c){c={};for(var a,b=window.location.search.slice(1),d=b.split("&"),e=0,f=d.length;f>e;e++)a=d[e].split("="),c[a[0]]=a[1]}return c},d.getSearchParam=function(a){return c||d.getSearchParams(),c[a]}}(),function(){"use strict";function a(a,b){this.procName=a,this.callId=b}function b(a,b,c){function d(b){if(!c||!e){e=!0;var d=h?h(b):b;null!==d&&a.setResult(d||{})}}var e=!1,f=c?"once":"on",g=b.events,h=b.map;b.init&&b.init();for(var i=0,j=g.length;j>i;i++)Human.events[f](g[i],d)}function c(a){return a&&"object"==typeof a?a===window?!1:"string"==typeof a.nodeName&&"function"==typeof a.querySelectorAll&&"function"==typeof a.getElementsByTagName?!1:"function"==typeof a.preventDefault&&"function"==typeof a.stopPropagation?!1:!0:!0}var d=Human.rpc={windowClientEnabled:!0},e=1e4;d._procedures={},d._eventMap={};var f=[],g=!1,h={},i=[];a.prototype.setResult=function(a){for(var b=0,c=f.length;c>b;b++)f[b](this.callId,a)},a.prototype.info=function(a){Human.log.info(this.procName,a)},a.prototype.warn=function(a){Human.log.warn(this.procName,a)},a.prototype.error=function(a){Human.log.error(this.procName,a)},d.define=function(b,c,e){d._procedures[b]&&Human.log.warn("Human.rpc.define","Redefining procedure: "+b),e=e||{},(e.hidden||g)&&(h[b]=!0),d._procedures[b]=function(d,e){c.call(new a(b,d),e||{})}},d.defineEvent=function(a,b){d._eventMap[a]&&Human.log.warn("Human.rpc.defineEvent","Redefining event: "+a),d._eventMap[a]=b||a},d.enableEvent=function(a,c,e){if(!d._eventMap[c])return void Human.log.warn("Human.rpc.enableEvent","Event: "+c+" not defined.");var f=d._eventMap[c];if("string"==typeof f){var g=e?"once":"on";Human.events[g](f,function(b){a.setResult(b)})}else b(a,f,e)},d.getProcedures=function(){var a=Object.keys(d._procedures);return Human.utils.filterInPlace(a,function(a){return!h[a]}),a},d.getEvents=function(){return["human.ready"].concat(Object.keys(d._eventMap))},d.hideDefinitions=function(a){g=!0;try{a()}finally{g=!1}},d.onResult=function(a){f.push(a)},d.call=function(a,b,c){var e=d._procedures[b];return e?void e(a,c):void Human.log.warn("Human.rpc.call","Target procedure not found: "+b)},d.log=function(a){i.length>e&&i.shift(),i.push({engine_version:Human.VERSION,api_version:Human.API_VERSION,identifier:a,category:a.split(".")[0]})},d.getLog=function(){return i},d.logPending=function(){return i.length>0},d.resetLog=function(){i.length=0},d.filterUnsafeProperties=function(a){if(!Human.utils.isObject(a))return a;var b={};for(var d in a)a.hasOwnProperty(d)&&c(a[d])&&(b[d]=a[d]);return b}}(),function(){"use strict";Human.rpc.define("human.info",function(){this.setResult({version:Human.VERSION,webglInfo:SceneJS.WEBGL_INFO,apiFunctions:Human.rpc.getProcedures().sort(),apiEvents:Human.rpc.getEvents().sort()})}),Human.rpc.defineEvent("human.error","error")}(),function(){"use strict";function a(a){a=Human.view.annotations.annotations[a.annotationId];var b=a.pin;if(!b.canvasPos){var c=Human.renderer.getViewMat(),d=Human.renderer.getProjMat(),e=Human.renderer.canvas.annotationCanvas[0];b.transform(c,d,e)}return{annotationId:a.annotationId,title:a.label.title,description:a.label.description,objectId:a.object?a.object.objectId:null,position:{x:b.pos[0],y:b.pos[1],z:b.pos[2]},canvasPosition:{x:b.canvasPos[0],y:b.canvasPos[1]},occludable:a.occludable,shown:a.pin.shown}}Human.rpc.define("annotations.info",function(){var b,c=Human.view.annotations.annotations,d={};for(var e in c)c.hasOwnProperty(e)&&(b=c[e],d[e]=a(b));this.setResult(d)}),Human.rpc.define("annotations.create",function(b){b.saved=b.saved!==!1,b.position&&(b.pos=b.position);var c=Human.view.annotations.createAnnotation(b);this.setResult(a(c))}),Human.rpc.define("annotations.update",function(a){Human.view.annotations.updateAnnotation(a.annotationId,a),this.setResult(!0)}),Human.rpc.define("annotations.show",function(){Human.view.annotations.setShown(!0),this.setResult(!0)}),Human.rpc.define("annotations.hide",function(){Human.view.annotations.setShown(!1),this.setResult(!0)}),Human.rpc.define("annotations.destroy",function(a){"string"==typeof a&&(a={annotationId:a});var b=Human.view.annotations.annotations[a.annotationId];b&&b.destroy(),this.setResult(!0)}),Human.rpc.defineEvent("annotations.created",{events:["annotations.created"],map:a}),Human.rpc.defineEvent("annotations.destroyed"),Human.rpc.defineEvent("annotations.shown",{events:["annotations.shown"],map:function(a){return a.shown?void 0:null}}),Human.rpc.defineEvent("annotations.hidden",{events:["annotations.shown"],map:function(a){return a.shown?null:void 0}})}(),function(){"use strict";function a(){var a=Human.view.camera.getLookAt();return{position:a.eye,target:a.look,up:a.up,zoom:Human.view.camera.getZoom()}}Human.rpc.define("camera.set",function(a){var b=this;a.position&&(a.eye=a.position),a.target&&(a.look=a.target),"direct"===a.animationStyle&&(a.cylindricalView=!1),a.animate?Human.view.camera.fly.flyTo(a,function(){b.setResult(!0)}):Human.view.camera.fly.jumpTo(a,function(){b.setResult(!0)})}),Human.rpc.define("camera.orbit",function(a){a.yaw&&Human.view.camera.rotateY(a.yaw),a.pitch&&Human.view.camera.rotateX(a.pitch),this.setResult(!0)}),Human.rpc.define("camera.pan",function(a){Human.view.camera.pan({x:a.x||0,y:a.y||0,z:a.z||0}),this.setResult(!0)}),Human.rpc.define("camera.zoom",function(a){var b="number"==typeof a?a:a.factor;b=Math.max(0,Math.min(b||0,1)),Human.view.camera.setZoom(b),this.setResult(!0)}),Human.rpc.define("camera.path",function(a){var b=this;Human.view.camera.fly.flyAlongCurvePath(a,function(){b.setResult(!0)})}),Human.rpc.define("camera.info",function(){this.setResult(a())}),Human.rpc.define("camera.reset",function(){var a=this;Human.init.resetCamera(function(){a.setResult(!0)})}),Human.rpc.defineEvent("camera.updated",{events:["camera.rested"],map:a})}(),Human.rpc.hideDefinitions(function(){"use strict";Human.rpc.define("apiEvents.on",function(a){Human.rpc.enableEvent(this,a,!1)}),Human.rpc.define("apiEvents.once",function(a){Human.rpc.enableEvent(this,a,!0)})}),function(){"use strict";Human.rpc.define("input.disable",function(){Human.input.setEnabled(!1)}),Human.rpc.define("input.enable",function(){Human.input.setEnabled(!0)})}(),function(){"use strict";function a(a){var b,c={},d=Human.rpc.fmaIds,e=Human.modules.MALE_STATE_ID,f=Human.modules.FEMALE_STATE_ID;for(var g in a)if(a.hasOwnProperty(g)){b=d[g];for(var h=0;h<b.length;h++){var i=Human.scene.objects[e+"-"+b[h]]||Human.scene.objects[f+"-"+b[h]];i&&(c[i.objectId]=a[g])}}return c}function b(a){if(!a)return null;var b={};return b.objectId=a.objectId,b.canvasPosition={x:a.canvasPos[0],y:a.canvasPos[1]},a.worldPos&&(b.position={x:a.worldPos[0],y:a.worldPos[1],z:a.worldPos[2]}),b}Human.rpc.define("scene.load",function(a){var b=this,c=null,d=null;"string"==typeof a?".json"===a.slice(-5)?d=a:c=a:(d=a.moduleId,c=a.bookmarkId),Human.modules.destroyModules(),c?jQuery.ajax({dataType:"json",url:"/search/bookmarks/data?be="+c,success:function(a){Human.bookmarks.restore(a.bookmark,function(){b.setResult(!0)})},error:function(){b.setResult(!1)}}):d&&Human.modules.activateModuleWithAssets(d,function(){b.setResult(!0)},function(){b.setResult(!1)})}),Human.rpc.define("scene.pick",function(a){var c;void 0!==a.x&&(a.canvasX=a.x),void 0!==a.y&&(a.canvasY=a.y),a.rayPick=a.rayPick!==!1,c=a.triggerActions?Human.view.pick.pick(a):Human.view.pick.queryPick(a),this.setResult(b(c))}),Human.rpc.define("scene.pickingMode",function(a){"dissect"===a?(Human.events.blockEvents(function(){Human.view.annotations.setEnabled(!1)}),Human.view.dissect.setEnabled(!0)):"annotate"===a?(Human.events.blockEvents(function(){Human.view.dissect.setEnabled(!1)}),Human.view.annotations.setEnabled(!0)):"highlight"===a&&(Human.events.blockEvents(function(){Human.view.dissect.setEnabled(!1),Human.view.annotations.setEnabled(!1)}),Human.view.highlight.setEnabled(!0)),this.setResult(!0)}),Human.rpc.define("scene.selectionMode",function(a){"isolate"===a?(Human.events.blockEvents(function(){Human.view.highlight.setEnabled(!1)}),Human.view.isolate.setEnabled(!0)):"highlight"===a?(Human.events.blockEvents(function(){Human.view.isolate.setEnabled(!1)}),Human.view.highlight.setEnabled(!0)):"none"===a&&(Human.events.blockEvents(function(){Human.view.isolate.setEnabled(!1)}),Human.view.highlight.setEnabled(!1)),this.setResult(!0)}),Human.rpc.define("scene.enableXray",function(){Human.view.xray.setEnabled(!0),this.setResult(!0)}),Human.rpc.define("scene.disableXray",function(){Human.view.xray.setEnabled(!1),this.setResult(!0)}),Human.rpc.define("scene.showObjects",function(b){var c=!!b.replace;delete b.replace,b.fmaIds&&(b=a(b.fmaIds)),Human.scene.setEnabledObjects({objects:b,replace:c}),this.setResult(!0)}),Human.rpc.define("scene.selectObjects",function(b){var c=!!b.replace;delete b.replace,b.fmaIds&&(b=a(b.fmaIds)),Human.scene.setSelectedObjects({objects:b,replace:c}),this.setResult(!0)}),function(){function a(a,c){function d(a){c[a.objectId]||(c[a.objectId]=b(a))}for(var e=0,f=a.length;f>e;e++)a[e].traverseUp(d)}function b(a){var b={objectId:a.objectId,name:a.displayName||"",description:a.description||"",shown:a.shown,selected:a.selected};b.children=[];for(var c=0,d=a.objects.length;d>c;c++)b.children.push(a.objects[c].objectId);return b.parent=a.parent?a.parent.objectId:null,b}Human.rpc.define("scene.info",function(c){var d={},e=Human.modules.activeModules[Object.keys(Human.modules.activeModules)[0]];d.name=e?e.displayName:null;var f,g=d.objects={};if(c.objectId){var h=c.objectId;f=Human.scene.objects[h],f&&(g[f.objectId]=b(f))}else for(var i=0,j=Human.scene.rootObjects.length;j>i;i++)a(Human.scene.rootObjects[i].getRenderableObjects(),g);this.setResult(d)})}(),Human.rpc.define("scene.transformObject",function(a){var b=a.objectId,c=Human.scene.objects[b];c?(c.setTransform(a),this.setResult(!0)):(this.error("Scene object not found: '"+b+"'"),this.setResult(!1))}),Human.rpc.define("scene.capture",function(){this.setResult(Human.bookmarks.capture())}),Human.rpc.define("scene.restore",function(a){var b=this;Human.bookmarks.restore(a,function(){b.setResult(!0)})}),Human.rpc.define("scene.reset",function(){var a=this;Human.init.reset(function(){a.setResult(!0)})}),Human.rpc.defineEvent("scene.objectsShown",{events:["scene.objectsShown"],map:function(a){return a.enabledObjectsUpdate}}),Human.rpc.defineEvent("scene.objectsSelected",{events:["scene.objectsSelected"],map:function(a){return a.selectedObjectsUpdate}}),Human.rpc.defineEvent("scene.restored","bookmarks.restored"),Human.rpc.defineEvent("scene.picked",{events:["pick.picked"],init:function(){Human.properties.set({"pick.alwaysRayPick":!0})},map:b});var c;Human.rpc.defineEvent("scene.pickingModeUpdated",{events:["highlight.toggled","dissect.toggled","annotations.toggled"],map:function(){var a;return Human.view.dissect.enabled?a="dissect":Human.view.annotations.enabled?a="annotate":Human.view.highlight.enabled&&(a="highlight"),a===c?null:(c=a,{pickingMode:c})}});var d;Human.rpc.defineEvent("scene.selectionModeUpdated",{events:["highlight.toggled","isolate.toggled"],map:function(){var a;return a=Human.view.isolate.enabled?"isolate":Human.view.highlight.enabled?"highlight":"none",a===d?null:(d=a,{selectionMode:d})}}),Human.rpc.defineEvent("scene.xrayEnabled",{events:["xray.toggled"],map:function(a){return a.enabled?void 0:null}}),Human.rpc.defineEvent("scene.xrayDisabled",{events:["xray.toggled"],map:function(a){return a.enabled?null:void 0}})}(),function(){"use strict";function a(){var a=Human.timeline.getTimeFrame();return{time:Human.timeline.time,startTime:a.firstTime,endTime:a.lastTime,chapters:Object.keys(Human.timeline.chapters),playing:Human.timeline.playing}}Human.rpc.define("timeline.info",function(){this.setResult(a())}),Human.rpc.define("timeline.set",function(a){Human.timeline.scrub(a),this.setResult(!0)}),Human.rpc.define("timeline.play",function(a){a.time&&(a.startTime=a.time),a.chapterId&&(a.startChapterId=a.chapterId),Human.timeline.play(a),this.setResult(!0)}),Human.rpc.define("timeline.pause",function(){Human.timeline.pause(),this.setResult(!0)}),Human.rpc.define("timeline.previousChapter",function(){Human.timeline.prev(),this.setResult(!0)}),Human.rpc.define("timeline.nextChapter",function(){Human.timeline.next(),this.setResult(!0)}),Human.rpc.defineEvent("timeline.chapterTransition",{events:["timeline.chapters.activated"],map:function(a){return{previousChapter:a.oldChapterIndex,currentChapter:a.newChapterIndex,time:a.time}}})}(),Human.rpc.hideDefinitions(function(){"use strict";function a(a){var b,c={},d=Human.rpc.fmaIds,e=Human.modules.MALE_STATE_ID,f=Human.modules.FEMALE_STATE_ID;for(var g in a)if(a.hasOwnProperty(g)){b=d[g];for(var h=0;h<b.length;h++){var i=Human.scene.objects[e+"-"+b[h]]||Human.scene.objects[f+"-"+b[h]];i&&(c[i.objectId]=a[g])}}return c}function b(a){var b,c={};for(var d in a)a.hasOwnProperty(d)&&(b=a[d],Human.utils.isPrimitive(b)&&"_"!==d[0]&&(c[d]=b));return c.objectId=a.object?a.object.objectId:"",c.title=a.label.title,c.description=a.label.description,c.pos=a.pin.pos,c.pinVec=a.pin.dir,c.visible=a.pin.visible,c}function c(a){var b=g[a];if(b){var c=b[0],d=b[1];Human.unEvent(c,d),delete g[a]}}function d(a,b){a&&Human.view.annotations.unsavedAnnotation?alert("Please save or cancel annotation first"):b()}Human.rpc.define("bookmarks.capture",function(){this.setResult(Human.bookmarks.capture())}),Human.rpc.define("bookmarks.restore",function(a){var b=this;Human.bookmarks.restore(a,function(){b.setResult(!0)})}),Human.rpc.define("events.off",function(a){if(a.id)c(a.id);else if(a.ids)for(var b=a.ids,d=0,e=b.length;e>d;d++)c(b[d]);else for(var f in g)g.hasOwnProperty(f)&&c(f)}),Human.rpc.define("timeline.query",function(){this.setResult(Human.timeline.query())}),Human.rpc.define("camera.query",function(){var a=Human.view.camera.getLookAt();a.zoom=Human.view.camera.getZoom(),this.setResult(a)}),Human.rpc.define("properties.query",function(a){this.setResult(Human.properties.query(a.regex))}),Human.rpc.define("actions.doAction",function(a){Human.actions._doAction([a.action,a.arguments])}),Human.rpc.define("alert",function(a){window.alert(a.message||"")}),Human.rpc.define("videos.getClips",function(){this.setResult(Human.media.videos.clipsList)}),Human.rpc.define("videos.open",function(a){var b=this;Human.media.videos.open(a.clipId,function(){b.setResult(!0)})}),Human.rpc.define("videos.play",function(a){Human.media.videos.play(a.clipId)}),Human.rpc.define("videos.scrub",function(a){Human.media.videos.scrub(a.clipId,a.time)}),Human.rpc.define("videos.pause",function(a){Human.media.videos.pause(a.clipId)}),Human.rpc.define("videos.stop",function(a){Human.media.videos.stop(a.clipId)}),Human.rpc.define("videos.close",function(a){Human.media.videos.close(a.clipId)}),Human.rpc.define("audio.getClips",function(){this.setResult(Human.media.audio.clipsList)}),Human.rpc.define("audio.open",function(a){var b=this;Human.media.audio.open(a.clipId,function(){b.setResult(!0)})}),Human.rpc.define("audio.play",function(a){Human.media.audio.play(a.clipId)}),Human.rpc.define("audio.scrub",function(a){Human.media.audio.scrub(a.clipId,a.time)}),Human.rpc.define("audio.pause",function(a){Human.media.audio.pause(a.clipId)}),Human.rpc.define("audio.stop",function(a){Human.media.audio.stop(a.clipId)}),Human.rpc.define("audio.close",function(a){Human.media.videos.close(a.clipId)}),Human.rpc.define("modules.getModules",function(a){this.setResult(Human.modules.query(a))}),Human.rpc.define("modules.activate",function(a){var b=this;Human.modules.activateModules(a,function(){b.setResult(!0)})}),Human.rpc.define("modules.deactivate",function(a){Human.modules.deactivateModules(a)}),Human.rpc.define("properties.subscribe",function(a){var b=this;Human.properties.subscribe({subId:a.subId,propId:"myProperty",callback:function(a){b.setResult(a)}})}),Human.rpc.define("properties.resubscribe",function(a){Human.properties.resubscribe(a.subId,a.propId)}),Human.rpc.define("properties.unsubscribe",function(a){Human.properties.unsubscribe(a.subId)}),Human.rpc.define("renderer.getBGColor",function(){this.setResult(Human.renderer.bg.getBGColor())}),Human.rpc.define("renderer.setBGColor",function(a){Human.renderer.bg.setBGColor(a.color)}),Human.rpc.define("request.getParams",function(){this.setResult({hashParams:Human.request.getHashParams(),hashStr:Human.request.getHashStr(),searchParams:Human.request.getSearchParams(),searchStr:Human.request.getSearchStr()})}),Human.rpc.define("scene.queryBoundary",function(a){var b,c,d;if(a.objectId)b=Human.scene.getBoundary({objectId:a.objectId});else if(a.fmaId){if(d=a.fmaId,c=Human.scene.objectsByFMAID[d],!c)return void this.error("No scene object found for the given FMA ID: '"+d+"'");b=c.getBoundary()}else if(a.objectIds)b=Human.scene.getBoundary({objectIds:a.objectIds});else if(a.fmaIds){for(var e=a.fmaIds,f=[],g=0,h=e.length;h>g;g++){if(d=e[g],c=Human.scene.objectsByFMAID[d],!c)return void this.error("No scene object found for the given FMA ID: '"+d+"'");f.push(c.objectId)}b=Human.scene.getBoundary({objectIds:f})}else b=a.selectedObjects?Human.scene.getBoundary({objects:Human.scene.selectedObjects}):a.enabledObjects?Human.scene.getBoundary({objects:Human.scene.enabledObjects}):Human.scene.getBoundary();this.setResult(b)}),Human.rpc.define("scene.showBoundary",function(a){var b;a.objectId?(b=Human.scene.getBoundary({objectId:a.objectId}),b&&Human.view.boundary.setBoundary(b,!0)):Human.view.boundary.setBoundary(!1)}),function(){var a=document.getElementById("theCanvas"),b=function(b,c){c&&vec3.add(b,c,b);var d=Human.renderer.getViewMat(),e=Human.renderer.getProjMat(),f=vec4.create();vec3.transformMat4(f,b,d),f[3]=1,vec4.transformMat4(f,f,e);var g=f[0],h=f[1],i=f[3];return[Math.round((1+g/i)*a.width/2),Math.round((1-h/i)*a.height/2)]};Human.rpc.define("scene.getCanvasPos",function(a){this.setResult(b(a.worldPos,a.offset))}),Human.rpc.define("scene.getObjectCanvasPos",function(a){var c=Human.scene.objects[a.objectId];if(c){var d=c.getCenter();this.setResult(b(d,a.offset))}})}(),Human.rpc.define("annotations.setTitle",function(a){var b=Human.view.annotations.annotations[a.annotationId];b&&b.label.setTitle(a.title),this.setResult(!0)}),Human.rpc.define("annotations.setDescription",function(a){var b=Human.view.annotations.annotations[a.annotationId];b&&b.label.setDescription(a.description),this.setResult(!0)}),Human.rpc.define("annotations.setLabelStyles",function(a){a.label&&$(".annotationContainer").css(a.label),a.title&&$(".annotationContainer > .title").css(a.title),a.description&&$(".annotationContainer > .description").css(a.description),Human.view.annotations.updateDimensions(),Human.view.annotations.layouts.redrawLayout(),this.setResult(!0)}),Human.rpc.define("annotations.setPinStyles",function(a){a.hasOwnProperty("pin")?($(".annotationPin").css(a.pin),a.hasOwnProperty("after")&&($(".annotationPin").html('<div class="after"></div>'),$(".annotationPin > .after").css(a.after))):$(".annotationPin").css(a),this.setResult(!0)}),Human.rpc.define("annotations.setWireStyles",function(a){$(".annotationWire").css(a),this.setResult(!0)}),Human.rpc.define("annotations.setLabelsShown",function(a){Human.view.annotations.setLabelsShown(a),this.setResult(!0)}),Human.rpc.define("timeline.getBookmark",function(){this.setResult(Human.timeline.getBookmark())}),Human.rpc.define("timeline.setBookmark",function(a){Human.timeline.setBookmark(a)}),Human.rpc.define("clip.set",function(a){if(a.clips){var b,c=a.clips;for(var d in c)c.hasOwnProperty(d)&&(b=c[d],b.clipId=d,Human.view.clip.setClip(b))}else a.clip&&Human.view.clip.setClip(a.clip)}),Human.rpc.define("clip.reset",function(){Human.view.clip.reset()}),Human.rpc.define("effects.getEffects",function(){var a,b=[],c=Human.view.effects.effects;for(var d in c)c.hasOwnProperty(d)&&(a=c[d],b.push({effectId:d,displayName:a.displayName,description:a.description,enabled:a.enabled,params:a.params}));this.setResult(b)}),Human.rpc.define("effects.setEnabled",function(a){Human.view.effects.setEnabled(a)}),Human.rpc.define("effects.setParams",function(a){Human.view.effects.setParams(a)}),Human.rpc.define("focus.focusObject",function(a){var b=this;Human.view.focus.focusObject(a,function(){b.setResult(!0)})}),Human.rpc.define("labels.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.labels.getEnabled()),Human.view.labels.setEnabled(b)}),Human.rpc.define("labels.create",function(a){return a.objectId?(a.replace&&Human.view.labels.clearLabels(),void Human.view.labels.createLabel(a)):void this.error("parameter expected: 'objectId'")}),Human.rpc.define("labels.clear",function(){Human.view.labels.clearLabels()}),Human.rpc.define("lights.getLights",function(){var a,b=[],c=Human.view.lights.lights;for(var d in c)c.hasOwnProperty(d)&&(a=c[d],b.push({lightId:d,displayName:a.displayName,description:a.description,enabled:a.enabled,params:a.params}));this.setResult(b)}),Human.rpc.define("lights.setEnabled",function(a){Human.view.lights.setEnabled(a)}),Human.rpc.define("lights.setParams",function(a){Human.view.lights.setParams(a)}),Human.rpc.define("tooltips.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.tooltips.getEnabled()),Human.view.tooltips.setEnabled(b)}),Human.rpc.define("dissect.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.dissect.enabled),d(b,function(){Human.view.dissect.setEnabled(b),b?(Human.view.pick.setMultiPickEnabled(!1),Human.view.pick.setSinglePickEnabled(!1),Human.view.annotations.setEnabled(!1)):Human.view.pick.setSinglePickEnabled(!0)})}),Human.rpc.define("highlight.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.highlight.enabled),Human.view.highlight.setEnabled(b),b&&(Human.view.isolate.setEnabled(!1),Human.view.xray.setEnabled(!1))}),Human.rpc.define("isolate.setEnabled",function(a){var b=a.enable;if((void 0===b||null===b)&&(b=!Human.view.isolate.enabled),b){var c=Human.scene.anySelected();if(!c)return}Human.view.isolate.setEnabled(b),b&&(Human.view.highlight.setEnabled(!1),Human.view.xray.setEnabled(!1),Human.view.pick.setSinglePickEnabled(!0),Human.view.pick.setMultiPickEnabled(!1))}),Human.rpc.define("pick.single.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.pick.getSinglePickEnabled()),d(b,function(){Human.view.pick.setSinglePickEnabled(b),b&&(Human.view.pick.setMultiPickEnabled(!1),Human.view.dissect.setEnabled(!1),Human.view.annotations.setEnabled(!1))})}),Human.rpc.define("pick.multi.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.pick.getMultiPickEnabled()),d(b,function(){Human.view.pick.setMultiPickEnabled(b),b?(Human.view.pick.setSinglePickEnabled(!1),Human.view.dissect.setEnabled(!1),Human.view.annotations.setEnabled(!1)):Human.view.pick.setSinglePickEnabled(!0)})}),Human.rpc.define("pick.doublePick",function(a){Human.view.pick.doublePick({canvasX:a.canvasX,canvasY:a.canvasY})}),Human.rpc.define("pick.hoverPick",function(a){Human.view.pick.hoverPick({canvasX:a.canvasX,canvasY:a.canvasY})}),Human.rpc.define("annotations.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.annotations.enabled),d(!b,function(){Human.view.annotations.setEnabled(b),b?(Human.view.pick.setSinglePickEnabled(!1),Human.view.pick.setMultiPickEnabled(!1),Human.view.dissect.setEnabled(!1)):Human.view.pick.setSinglePickEnabled(!0)})}),Human.rpc.define("xray.setEnabled",function(a){var b=a.enable;(void 0===b||null===b)&&(b=!Human.view.xray.enabled),Human.view.xray.setEnabled(b),b&&(Human.view.highlight.setEnabled(!1),Human.view.isolate.setEnabled(!1))}),Human.rpc.define("queryModes",function(){var a={xray:Human.view.xray.enabled,highlight:Human.view.highlight.enabled,annotation:Human.view.annotations.enabled,singlePick:Human.view.pick.singleEnabled,multipick:Human.view.pick.multiEnabled,dissect:Human.view.dissect.enabled};this.setResult(a)}),Human.rpc.define("jquery",function(a){"document"===a.selector&&(a.selector=document),$.fn[a.method].apply($(a.selector),a.args)}),Human.rpc.define("navigation.setEnabled",function(a){h("navigator_container",a.enable)}),Human.rpc.define("fullscreen.setEnabled",function(a){h("embed-full-screen",a.enable)});var e=Human.log.reporters,f=Human.log.messageBuf;Human.rpc.define("log.createReporter",function(a){if(!a.id)return void Human.log.error("param expected: id");var b="log.reporters."+a.id;if(!e[b]){e[b]={};for(var c=0,d=f.length;d>c;c++)Human.events.fire(b,f[c])}}),Human.rpc.define("log.destroyReporter",function(a){if(!a.id)return void Human.log.error("param expected: id");var b="log.reporters."+a.id;delete e[b]}),Human.rpc.define("annotations.getAnnotations",function(){var a,c=Human.view.annotations.annotations,d={};for(var e in c)c.hasOwnProperty(e)&&(a=c[e],d[e]=b(a));this.setResult(d)}),Human.rpc.define("annotations.setShown",function(a){Human.view.annotations.setShown(a.shown),this.setResult(!0)}),Human.rpc.define("camera.flyTo",function(a){var b=this;Human.view.camera.fly.flyTo(a,function(){b.setResult(!0)})}),Human.rpc.define("camera.jumpTo",function(a){var b=this;Human.view.camera.fly.jumpTo(a,function(){b.setResult(!0)})}),Human.rpc.define("camera.getZoom",function(){this.setResult(Human.view.camera.getZoom())});var g={};Human.rpc.define("events.on",function(a){var b=this,c=this.id;if(c&&g[c])return void this.error("an event is already bound to this ID: '"+c+"'");var d=a.type;if(!d)return void this.error("parameter expected: 'type'");var e=function(a){b.setResult(a)};a.mask?(a.fn=e,Human.events.on(a)):Human.events.on(a.type,e),c&&(g[c]=[d,e])}),Human.rpc.define("events.once",function(a){var b=this,c=a.type;return c?void Human.events.once(c,function(a){b.setResult(a)}):void this.error("parameter expected: 'type'")}),Human.rpc.define("events.fire",function(a){Human.events.fire(a.eventName,a.params)}),Human.rpc.define("reset",function(){var a=this;Human.init.reset(function(){a.setResult(!0)})}),Human.rpc.define("reload",function(){Human.init.reload()}),Human.rpc.define("pick.pick",function(a){Human.view.pick.pick({canvasX:a.canvasX,canvasY:a.canvasY})}),Human.rpc.define("pick.queryPick",function(a){this.setResult(Human.view.pick.queryPick({canvasX:a.canvasX,canvasY:a.canvasY,rayPick:a.rayPick})||{})}),Human.rpc.define("scene.setEnabledObjects",function(b){var c;if(b.fmaIds)c=a(b.fmaIds);else if(Human.utils.isArray(b.objectIds)){c={};for(var d=0,e=b.objectIds.length;e>d;d++)c[b.objectIds[d]]=!0}else c=b.objectIds;Human.scene.setEnabledObjects({objects:c,replace:b.replace})}),Human.rpc.define("scene.setSelectedObjects",function(b){var c;if(b.fmaIds)c=a(b.fmaIds);else if(Human.utils.isArray(b.objectIds)){c={};for(var d=0,e=b.objectIds.length;e>d;d++)c[b.objectIds[d]]=!0}else c=b.objectIds;b.objectIds=c,Human.scene.setSelectedObjects(b)}),function(){function a(c,d){if(c){d.push(b(c));for(var e=0,f=c.objects.length;f>e;e++)a(c.objects[e],d)}}function b(a){var b={};for(var c in a)if(a.hasOwnProperty(c)&&"_"!==c[0]){var d=a[c];Human.utils.isPrimitive(d)&&(b[c]=d)}return b.parentObjectId=a.parent?a.parent.objectId:null,b}Human.rpc.define("scene.getObjects",function(c){var d,e=[];if(c.objectId){var f=c.objectId;d=Human.scene.objects[f],d&&e.push(b(d))}else for(var g=0,h=Human.scene.rootObjects.length;h>g;g++)a(Human.scene.rootObjects[g],e);this.setResult(e)})}(),Human.rpc.define("scene.setObjectTransform",function(a){var b,c=a.objectId,d=a.fmaId;if(c){if(b=Human.scene.objects[c],!b)return void this.error("Scene object not found: '"+c+"'")}else if(d&&(b=Human.scene.objectsByFMAID[d],!b))return void this.error("scene object not found for the given FMA ID: '"+d+"'");b.setTransform(a)}),Human.rpc.define("timeline.scrub",function(a){Human.timeline.scrub(a)}),Human.rpc.define("timeline.stop",function(){Human.timeline.stop()}),Human.rpc.define("timeline.prev",function(){Human.timeline.prev()}),Human.rpc.define("timeline.next",function(){Human.timeline.next()}),Human.rpc.define("timeline.unpause",function(){Human.timeline.unpause()}),Human.rpc.define("properties.set",function(a){var b=a.props||a;Human.properties.set(b||{})});var h=function(a,b){var c="undefined"==typeof b?!0:b,d=document.getElementById(a);d.style.display=c?"block":"none"}}),Human.rpc.fmaIds={3734:["Base_of_aorta_3734_ID"],3768:["Aortic_arch_3768_ID"],3784:["Descending_Aorta_3784_ID"],3818:["Marginal_branch_of_right_coronary_artery_3818_ID"],3829:["Anterior_atrial_branch_of_right_coronary_artery_3829_ID"],3837:["Posterior_left_ventricular_branch_of_left_coronary_artery_3837_ID"],3932:["left_lower_subclavian_artery_3932_ID","Right_Brachiocephalic_trunk_3932_ID"],3941:["Right_common_carotid_artery_3941_ID"],3945:["Right_external_carotid_artery_3945_ID"],3949:["Right_Internal_Carotid_Artery_3949_ID"],3950:["Right_Internal_Carotid_Artery_3950_ID"],3958:["Right_Vertebral_Artery_3958_ID"],3969:["Right_internal_thoracic_artery_3969_ID"],3988:["Superior_right_epigastric_artery_3988_ID","Right_Superior_epigastric_artery_3988_ID"],4058:["Left_common_carotid_artery_4058_ID","Base_of_left_common_carotid_artery_4058_ID","Base_of_Left_common_carotid_artery_4058_ID"],4060:["Left_external_carotid_artery_4060_ID"],4062:["Left_Internal_Carotid_Artery_4062_ID"],4066:["Left_Vertebral_Artery_4066_ID"],4068:["Left_internal_thoracic_artery_4068_ID"],4083:["Left_Superior_epigastric_artery_4083_ID"],4085:["Right_costocervical_trunk_4085_ID"],4086:["Right_costocervical_trunk_4086_ID","Left_costocervical_trunk_4086_ID"],4134:["Left_deep_cervical_artery_4134_ID","left_deep_cervical_artery_4134_ID"],4634:["Right_Subcostal_artery_4634_ID","Right_subcostal_artery_4634_ID"],4654:["Left_Subcostal_artery_4654_ID","Left_subcostal_artery_4654_ID"],4693:["Right_subclavian_artery_4693_ID"],4694:["left_subclavian_artery_4694_ID","Left_Lower_Subclavian_artery_4694_ID","right_subclavian_artery_4694_ID"],4706:["Coronary_sinus_4706_ID"],4707:["Great_cardiac_vein_4707_ID"],4712:["Posterior_vein_of_left_ventricle_4712_ID"],4713:["Middle_cardiac_vein_4713_ID"],4714:["Small_cardiac_vein_4714_ID"],4715:["Oblique_vein_of_left_atrium_4715_ID"],4720:["Superior_Vena_Cava_4720_ID"],4728:["Inferior_Thyroid_vein_4728_ID"],4751:["Right_Brachiocephalic_vein_4751_ID","Right_brachiocephalic_vein_4751_ID"],4755:["Right_internal_jugular_vein_4755_ID"],4756:["Right_Vertebral_vein_4756_ID"],4758:["Right_internal_thoracic_vein_4758_ID"],4761:["Left_Brachiocephalic_vein_4761_ID","Left_brachiocephalic_vein_4761_ID"],4763:["Left_internal_jugular_vein_4763_ID"],4764:["Left_Vertebral_vein_4764_ID"],4766:["Left_internal_thoracic_vein_4766_ID"],4771:["Right_Superior_epigastric_vein_4771_ID","Right_superior_epigastric_vein_4771_ID"],4785:["Left_superior_epigastric_vein_4785_ID"],4838:["Azygos_Vein_4838_ID","Azygos_vein_4838_ID"],4843:["Right_ascending_lumbar_vein_4843_ID"],4944:["Hemiazgos_vein_4944_ID","Hemiazygos_vein_4944_ID"],4950:["Left_ascending_lumbar_vein_4950_ID"],5011:["Left_Accessory_Hemiazgos_vein_5011_ID","Left_Accessory_Hemiazygos_vein_5011_ID"],5883:["Right_Splanchnic_Nerve_5883_ID","Left_Splanchnic_Nerve_5883_ID"],6192:["Right_Phrenic_Nerve_6192_ID"],6193:["Left_Phrenic_Nerve_6193_ID"],6246:["Left_Recurrent_Laryngeal_Nerve_6246_ID","Right_Recurrent_Laryngeal_Nerve_6246_ID"],6258:["Left_Sympathetic_Chain_6258_ID","Right_Sympathetic_Chain_6258_ID"],6259:["Right_Sympathetic_Chain_6259_ID"],6442:["Left_C1_Spinal_Nerve_6442_ID","Right_C1_Spinal_Nerve_6442_ID"],6451:["Left_C2_Spinal_Nerve_6451_ID","Right_C2_Spinal_Nerve_6451_ID"],6453:["Left_C3_Spinal_Nerve_6453_ID","Right_C3_Spinal_Nerve_6453_ID"],6456:["Left_C4_Spinal_Nerve_6456_ID","Right_C4_Spinal_Nerve_6456_ID"],
  6457:["Right_C5_Spinal_Nerve_6457_ID","Left_C5_Spinal_Nerve_6457_ID"],6459:["Left_C6_Spinal_Nerve_6459_ID","Right_C6_Spinal_Nerve_6459_ID"],6461:["Right_C7_Spinal_Nerve_Group_6461_ID","Left_C7_Spinal_Nerve_6461_ID","Right_C7_Spinal_Nerve_6461_ID","Left_C7_Spinal_Nerve_Group_6461_ID"],6465:["Left_C8_Spinal_Nerve_6465_ID","Right_C8_Spinal_Nerve_6465_ID"],6582:["Ansa_Subclavia_6582_ID"],6642:["Superior_hypogastric_nerve_plexus_6642_ID"],6643:["Inferior_hypogastric_nerve_plexus_6643_ID"],6647:["Prostatic_nerve_plexus_6647_ID"],7088:["Heart_7088_ID"],7096:["Right_atrium_7096_ID"],7097:["Left_atrium_7097_ID"],7098:["Right_Ventricle_7098_ID"],7101:["Left_Ventricle_7101_ID"],7131:["Esophagus_7131_ID"],7133:["Interventricular_Septum_7133_ID"],7148:["Stomach_7148_ID"],7196:["Spleen_7196_ID"],7197:["Liver_7197_ID"],7198:["Pancreas_7198_ID"],7200:["Small_intestine_7200_ID"],7202:["Gallbladder_7202_ID"],7204:["Left_Kidney_7204_ID","Right_Kidney_7204_ID"],7205:["Right_Kidney_7205_ID","Left_Kidney_7205_ID"],7206:["Duodenum_7206_ID"],7207:["Jejunum_7207_ID"],7208:["Ileum_7208_ID"],7209:["Ovaries_7209_ID"],7211:["Right_testis_7211_ID"],7212:["Left_testis_7212_ID"],7213:["Right_Ovary_7213_ID"],7214:["Left_Ovary_7214_ID"],7218:["Right_auricle_7218_ID"],7219:["Left_auricle_7219_ID"],7234:["Tricuspid_Valve_7234_ID"],7235:["Mitral_valve_7235_ID"],7236:["Aortic_Valve_7236_ID"],7246:["Pulmonary_Valve_7246_ID"],7309:["Right_Lung_7309_ID"],7310:["Left_Lung_7310_ID"],7333:["Right_Superior_Lobe_7333_ID"],7337:["Right_Inferior_Lobe_7337_ID"],7370:["Left_Superior_Lobe_7370_ID"],7371:["Left_Inferior_Lobe_7371_ID"],7383:["Right_Middle_Lobe_7383_ID"],7394:["Trachea_7394_ID"],7486:["manubrium_of_sternum_7486_ID","body_of_sternum_7486_ID"],7591:["Right_Costal_Cartilage_7591_ID","Left_Costal_Cartilage_7591_ID"],7592:["Left_Costal_Cartilage_7592_ID","Right_Costal_Cartilage_7592_ID"],7647:["spinal_cord_7647_ID"],7857:["Left_first_rib_7857_ID","Right_first_rib_7857_ID"],7882:["Right_second_rib_7882_ID"],7883:["Left_second_rib_7883_ID"],7909:["Right_third_rib_7909_ID"],7910:["Left_third_rib_7910_ID"],7957:["Right_fourth_rib_7957_ID"],7958:["Left_fourth_rib_7958_ID"],8066:["Right_fifth_rib_8066_ID","Left_fifth_rib_8066_ID"],8175:["Left_sixth_rib_8175_ID","Right_sixth_rib_8175_ID"],8229:["Left_seventh_rib_8229_ID","Right_seventh_rib_8229_ID"],8283:["Left_eighth_rib_8283_ID","Right_eighth_rib_8283_ID"],8364:["Left_ninth_rib_8364_ID","Right_ninth_rib_8364_ID"],8445:["Right_tenth_rib_8445_ID","Left_tenth_rib_8445_ID"],8531:["Left_eleventh_rib_8531_ID","Right_eleventh_rib_8531_ID"],8533:["Right_twelfth_rib_8533_ID","Left_twelfth_rib_8533_ID"],8612:["Pulmonary_trunk_8612_ID"],9165:["First_thoracic_vertebra_9165_ID"],9187:["Second_thoracic_vertebra_9187_ID"],9209:["Third_thoracic_vertebra_9209_ID"],9248:["Fourth_thoracic_vertebra_9248_ID"],9600:["Prostate_9600_ID"],9603:["Thyroid_Gland_9603_ID"],9615:["Cricoid_cartilage_9615_ID"],9706:["Bile_Ducts_9706_ID"],9707:["Penis_9707_ID"],9710:["Vomer_9710_ID"],9711:["Maxilla_9711_ID"],9761:["Right_Transversus_thoracis_9761_ID"],9762:["Right_Transversus_thoracis_9762_ID","Left_Transversus_thoracis_9762_ID"],9922:["Fifth_thoracic_vertebra_9922_ID"],9945:["Sixth_thoracic_vertebra_9945_ID"],9968:["Seventh_thoracic_vertebra_9968_ID"],9991:["Eighth_thoracic_vertebra_9991_ID"],10014:["Ninth_thoracic_vertebra_10014_ID"],10037:["Tenth_thoracic_vertebra_10037_ID"],10059:["Eleventh_thoracic_vertebra_10059_ID"],10081:["Twelfth_thoracic_vertebra_10081_ID"],10551:["Right_dorsal_scapular_artery_10551_ID"],10552:["right_dorsal_scapular_artery_10552_ID","left_dorsal_scapular_artery_10552_ID"],10660:["Right_deep_cervical_artery_10660_ID"],10679:["Right_inferior_thyroid_artery_10679_ID"],10680:["left_inferior_thyroid_artery_10680_ID","Right_suprascapular_artery_10680_ID"],10681:["left_suprascapular_artery_10681_ID","Right_transverse_cervical_artery_10681_ID","right_suprascapular_artery_10681_ID"],10682:["left_transverse_cervical_artery_10682_ID","Right_superficial_cervical_artery_10682_ID"],10683:["left_superficial_cervical_artery_10683_ID"],10951:["Inferior_vena_cava_10951_ID","base_of_inferior_vena_cava_10951_ID"],12519:["Atlas_C1_12519_ID"],12520:["Axis_C2_12520_ID"],12521:["Third_cervical_vertebra_12521_ID"],12522:["Fourth_cervical_vertebra_12522_ID"],12523:["Fifth_cervical_vertebra_12523_ID"],12524:["Sixth_cervical_vertebra_12524_ID"],12525:["Seventh_cervical_vertebra_12525_ID"],12770:["Deep_lateral_cervical_lymph_nodes_12770_ID"],12858:["Union_between_ascending_lumbar_veins_12858_ID"],13072:["First_lumbar_vertebra_13072_ID"],13073:["Second_lumbar_vertebra_13073_ID"],13074:["Third_lumbar_vertebra_13074_ID"],13075:["Fourth_lumbar_vertebra_13075_ID"],13076:["Fifth_lumbar_vertebra_13076_ID"],13111:["Right_external_jugular_vein_13111_ID"],13112:["Left_external_jugular_vein_13112_ID","Right_external_jugular_vein_13112_ID"],13113:["Left_external_jugular_vein_13113_ID"],13295:["Diaphragm_13295_ID"],13322:["Right_Clavicle_13322_ID"],13323:["Left_Clavicle_13323_ID"],13325:["Right_cephalic_vein_13325_ID"],13326:["right_cephalic_vein_13326_ID","left_cephalic_vein_13326_ID"],13328:["Left_Clavicle_13328_ID"],13336:["Right_external_oblique_13336_ID"],13337:["Left_external_oblique_13337_ID"],13346:["Right_Sternohyoid_13346_ID"],13347:["Left_Sternohyoid_13347_ID"],13350:["Right_Sternothyroid_13350_ID"],13351:["Left_Sternothyroid_13351_ID"],13352:["Right_Thyrohyoid_13352_ID"],13353:["Left_Thyrohyoid_13353_ID"],13354:["Intercostal_Muscles_of_Left_Thorax_13354_ID","Intercostal_Muscles_of_Right_Thorax_13354_ID"],13358:["Right_latissimus_dorsi_13358_ID"],13359:["Left_latissimus_dorsi_13359_ID"],13373:["Right_pectoralis_major_13373_ID"],13374:["Left_pectoralis_major_13374_ID","Right_pectoralis_major_13374_ID"],13375:["Right_Pectoralis_minor_13375_ID"],13376:["Left_Pectoralis_minor_13376_ID","Right_Pectoralis_minor_13376_ID"],13377:["Right_Rectus_Abdominis_13377_ID"],13378:["Left_Rectus_Abdominis_13378_ID"],13379:["Right_Rectus_Abdominis_13379_ID"],13381:["Right_Rhomboid_Major_13381_ID"],13382:["Left_Rhomboid_Major_13382_ID"],13383:["Right_Rhomboid_Minor_13383_ID"],13384:["Left_Rhomboid_Minor_13384_ID"],13395:["Right_Scapula_13395_ID"],13396:["Left_Scapula_13396_ID","Right_Scapula_13396_ID"],13398:["Right_serratus_anterior_13398_ID"],13399:["Left_serratus_anterior_13399_ID"],13403:["Right_Serratus_Posterior_Superior_13403_ID"],13404:["Left_Serratus_Posterior_Superior_13404_ID"],13405:["Right_Serratus_Posterior_Inferior_13405_ID"],13406:["Left_Serratus_Posterior_Inferior_13406_ID"],13408:["Right_Sternocleidomastoid_13408_ID"],13409:["Left_Sternocleidomastoid_13409_ID"],13410:["Right_Subclavius_13410_ID"],13411:["Left_Subclavius_13411_ID","Right_Subclavius_13411_ID"],13414:["Right_subscapularis_13414_ID"],13415:["Left_subscapularis_13415_ID","Right_subscapularis_13415_ID"],13417:["Right_Thoracoepigastric_vein_13417_ID"],13418:["Left_Thoracoepigastric_vein_13418_ID"],13419:["Right_Trapezius_13419_ID"],13420:["Left_Trapezius_13420_ID"],13421:["Ligamentum_arteriosum_13421_ID"],13478:["Vertebral_Column_13478_ID"],13889:["Pituitary_Gland_13889_ID"],13890:["Parathyroid_Glands_13890_ID"],13892:["Right_Internal_oblique_13892_ID"],13893:["Left_Internal_oblique_13893_ID"],13912:["Anterior_interventricular_artery_13912_ID"],14331:["splenic_vein_14331_ID"],14332:["superior_mesenteric_vein_14332_ID"],14335:["Right_renal_vein_14335_ID"],14336:["Left_renal_vein_14336_ID"],14338:["Right_Hepatic_Vein_14338_ID"],14339:["Left_Hepatic_Vein_14339_ID"],14341:["Right_testicular_vein_14341_ID"],14345:["Left_testicular_vein_14345_ID"],14384:["Right_median_nerve_14384_ID"],14385:["Left_median_nerve_14385_ID"],14468:["Right_Recurrent_Laryngeal_Nerve_14468_ID"],14469:["Left_Recurrent_Laryngeal_Nerve_14469_ID"],14542:["Appendix_14542_ID"],14543:["Colon_14543_ID"],14544:["Rectum_14544_ID"],14545:["Ascending_colon_14545_ID"],14546:["Transverse_colon_14546_ID"],14547:["Descending_Colon_14547_ID"],14548:["Sigmoid_Colon_14548_ID"],14735:["Right_Lumbar_artery_14735_ID","Left_Lumbar_Artery_14735_ID","Right_Lumbar_Artery_14735_ID"],14746:["Right_Inferior_Phrenic_Artery_14746_ID"],14747:["Left_Inferior_Phrenic_Artery_14747_ID"],14749:["superior_mesenteric_artery_14749_ID"],14750:["Inferior_Mesenteric_artery_14750_ID"],14752:["Right_renal_artery_14752_ID"],14753:["Left_Renal_artery_14753_ID"],14759:["Right_testicular_artery_14759_ID"],14760:["Left_testicular_artery_14760_ID"],14768:["Left_Gastric_Artery_14768_ID"],14771:["Common_hepatic_artery_14771_ID"],14772:["Hepatic_artery_proper_14772_ID"],14773:["Splenic_artery_14773_ID"],14775:["Gastroduodenal_artery_14775_ID"],14776:["Right_Gastric_artery_14776_ID"],14778:["Right_hepatic_artery_14778_ID"],14779:["Left_hepatic_artery_14779_ID"],14781:["Right_Gastroepiploic_artery_14781_ID"],14787:["Dorsal_pancreatic_artery_14787_ID"],14790:["Inferior_pancreatic_artery_14790_ID"],14791:["Prepancreatic_Artery_14791_ID"],14792:["Great_pancreatic_artery_14792_ID"],14793:["Caudal_pancreatic_artery_14793_ID"],14796:["Left_Gastroepiploic_artery_14796_ID"],14810:["middle_colic_artery_14810_ID"],14811:["Right_colic_artery_14811_ID"],14812:["Celiac_Trunk_14812_ID"],14815:["Ileocolic_artery_14815_ID"],14819:["ileal_branch_of_ileocolic_artery_14819_ID"],14820:["Ileal_branch_of_ileocolic_vein_14820_ID","Colic_branch_of_ileocolic_vein_14820_ID"],14822:["Superior_branch_of_ileocolic_artery_14822_ID"],14826:["Left_colic_artery_14826_ID"],14830:["Sigmoid_artery_14830_ID"],14831:["Marginal_artery_of_colon_14831_ID"],14832:["Superior_Rectal_artery_14832_ID"],14835:["Cystic_artery_14835_ID"],15388:["Pancreatic_tributary_of_splenic_vein_15388_ID"],15390:["left_gastroepiploic_vein_15390_ID"],15391:["Inferior_Mesenteric_vein_15391_ID"],15394:["Left_colic_vein_15394_ID"],15395:["Sigmoid_vein_15395_ID"],15397:["Right_gastroepiploic_vein_15397_ID"],15398:["Anterior_Superior_pancreaticoduodenal_vein_15398_ID","Anterior_Inferior_pancreaticoduodenal_vein_15398_ID","Pancreaticoduodenal_vein_15398_ID","Posterior_Superior_pancreaticoduodenal_vein_15398_ID","Posterior_Inferior_pancreaticoduodenal_vein_15398_ID"],15399:["Left_Gastric_vein_15399_ID"],15400:["Right_Gastric_vein_15400_ID"],15407:["right_colic_vein_15407_ID"],15408:["Ileocolic_vein_15408_ID"],15414:["Right_Hepatic_Portal_Vein_15414_ID"],15415:["Left_Hepatic_Portal_Vein_15415_ID"],15571:["Right_Ureter_15571_ID"],15572:["Left_Ureter_15572_ID"],15629:["Right_Adrenal_Gland_15629_ID"],15630:["Left_Adrenal_Gland_15630_ID"],15710:["Internal_anal_sphincter_15710_ID"],15900:["Bladder_15900_ID"],16202:["Sacrum_16202_ID"],16491:["Right_iliohypogastric_nerve_16491_ID"],16492:["Left_iliohypogastric_nerve_16492_ID"],16493:["Right_ilioinguinal_nerve_16493_ID"],16494:["Left_ilioinguinal_nerve_16494_ID"],16497:["Right_lateral_femoral_cutaneous_nerve_16497_ID"],16498:["Left_lateral_femoral_cutaneous_nerve_16498_ID"],16499:["Right_femoral_nerve_16499_ID"],16500:["Left_femoral_nerve_16500_ID"],16501:["Right_obturator_nerve_16501_ID"],16502:["Left_obturator_nerve_16502_ID"],17559:["Uterus_17559_ID"],17740:["Cervix_of_uterus_17740_ID"],18245:["Right_Fallopian_Tube_18245_ID","Left_Fallopian_Tube_18245_ID"],18256:["Right_epididymis_18256_ID"],18257:["Left_epididymis_18257_ID"],18806:["Right_external_iliac_artery_18806_ID"],18807:["Left_external_iliac_artery_18807_ID"],18809:["Right_internal_iliac_artery_18809_ID"],18810:["Left_internal_iliac_artery_18810_ID"],18824:["Right_inferior_vesical_artery_18824_ID"],18825:["Left_inferior_vesical_artery_18825_ID"],18829:["Left_Uterine_Artery_18829_ID","Right_Uterine_Artery_18829_ID"],18836:["Right_internal_pudendal_artery_18836_ID"],18837:["Left_internal_pudendal_artery_18837_ID"],18846:["Right_iliolumbar_artery_18846_ID"],18847:["Left_iliolumbar_artery_18847_ID"],18856:["Right_lateral_sacral_artery_18856_ID"],18857:["Left_lateral_sacral_artery_18857_ID"],18866:["Right_obturator_artery_18866_ID"],18867:["Left_obturator_artery_18867_ID"],18869:["Right_superior_gluteal_artery_18869_ID"],18870:["Right_superior_gluteal_artery_18870_ID","Left_superior_gluteal_artery_18870_ID"],18872:["Right_inferior_gluteal_artery_18872_ID"],18873:["Left_inferior_gluteal_artery_18873_ID"],18885:["Right_external_iliac_vein_18885_ID"],18886:["Left_external_iliac_vein_18886_ID"],18887:["Right_internal_iliac_vein_18887_ID"],18888:["Left_internal_iliac_vein_18888_ID"],18891:["Right_inferior_vesical_vein_18891_ID"],18892:["Left_inferior_vesical_vein_18892_ID"],18897:["Right_Uterine_Vein_18897_ID"],18898:["Left_Uterine_Vein_18898_ID"],18903:["Right_iliolumbar_vein_18903_ID"],18904:["Left_iliolumbar_vein_18904_ID"],18906:["Right_lateral_sacral_vein_18906_ID"],18907:["Left_lateral_sacral_vein_18907_ID"],18909:["Right_superior_gluteal_vein_18909_ID"],18910:["Left_superior_gluteal_vein_18910_ID"],18912:["Right_inferior_gluteal_vein_18912_ID"],18913:["Left_inferior_gluteal_vein_18913_ID"],18915:["Right_obturator_vein_18915_ID"],18916:["Left_obturator_vein_18916_ID"],18918:["Right_internal_pudendal_vein_18918_ID"],18919:["Left_internal_pudendal_vein_18919_ID"],19086:["Muscles_of_the_Pelvis_19086_ID"],19087:["Levator_Ani_19087_ID"],19090:["Pubococcygeus_19090_ID"],19091:["Puborectalis_19091_ID"],19119:["Right_Uterosacral_Ligament_19119_ID"],19120:["Left_Uterosacral_Ligament_19120_ID"],19235:["Right_vas_deferens_19235_ID"],19236:["Left_vas_deferens_19236_ID"],19387:["Right_Seminal_Vesicle_19387_ID"],19388:["Left_Seminal_Vesicle_19388_ID"],19617:["Corpus_spongiosum_of_penis_19617_ID"],19618:["Right_corporus_cavernosum_of_penis_19618_ID","Left_corporus_cavernosum_of_penis_19618_ID"],19667:["Urethra_19667_ID"],19668:["Male_urethra_19668_ID"],19730:["Left_Ischiocavernosus_19730_ID","Right_Ischiocavernosus_19730_ID"],19731:["Right_Superficial_Transverse_Perineal_Muscle_19731_ID","Left_Superficial_Transverse_Perineal_Muscle_19731_ID"],19732:["Deep_transverse_perineal_muscle_19732_ID"],19949:["Vagina_19949_ID"],20224:["Right_Ribs_20224_ID"],20225:["Right_Ribs_20225_ID","Left_Ribs_20225_ID"],20226:["Right_Bony_Pelvis_20226_ID","Left_Ribs_20226_ID","Right_side_of_bony_pelvis_20226_ID"],20227:["Left_Bony_Pelvis_20227_ID","Left_side_of_bony_pelvis_20227_ID"],20274:["Perineal_Body_20274_ID"],20630:["Right_genitofemoral_nerve_20630_ID"],20631:["Left_genitofemoral_nerve_20631_ID"],20632:["Genital_branch_of_right_genitofemoral_nerve_20632_ID"],20633:["Genital_branch_of_left_genitofemoral_nerve_20633_ID"],20634:["Femoral_branch_of_right_genitofemoral_nerve_20634_ID"],20635:["Femoral_branch_of_left_genitofemoral_nerve_20635_ID"],20688:["Right_Inferior_Epigastric_Artery_20688_ID"],20689:["Left_Inferior_Epigastric_Artery_20689_ID"],20735:["Right_Superficial_Epigastric_Artery_20735_ID"],20736:["Left_Superficial_Epigastric_Artery_20736_ID"],20796:["Right_deep_femoral_artery_20796_ID"],20797:["Left_deep_femoral_artery_20797_ID"],20801:["Right_lateral_circumflex_femoral_artery_20801_ID"],20802:["Left_lateral_circumflex_femoral_artery_20802_ID"],20807:["Right_Medial_circumflex_femoral_artery_20807_ID"],20808:["Left_Medial_circumflex_femoral_artery_20808_ID"],20818:["Right_dorsal_artery_of_penis_20818_ID"],20819:["Left_dorsal_artery_of_penis_20819_ID"],20967:["Prostatic_part_of_right_inferior_vesical_artery_20967_ID"],20968:["Prostatic_part_of_left_inferior_vesical_artery_20968_ID"],21163:["Right_Inferior_Epigastric_Vein_21163_ID"],21164:["Left_Inferior_Epigastric_Vein_21164_ID"],21188:["Right_Femoral_Vein_21188_ID"],21189:["Left_Femoral_Vein_21189_ID"],21378:["Superficial_Veins_of_the_Left_Leg_21378_ID","Superficial_Veins_of_the_Right_Leg_21378_ID"],21379:["Right_Great_Saphenous_Vein_21379_ID"],21380:["Left_Great_Saphenous_Vein_21380_ID"],21422:["Descending_branch_of_right_lateral_circumflex_femoral_artery_21422_ID"],21423:["Descending_branch_of_left_lateral_circumflex_femoral_artery_21423_ID"],21863:["Right_Pudendal_nerve_21863_ID"],21864:["Left_Pudendal_nerve_21864_ID"],21919:["Right_superficial_transverse_perineal_muscle_21919_ID"],21920:["Left_superficial_transverse_perineal_muscle_21920_ID"],21921:["Right_bulbospongiosus_21921_ID"],21922:["Left_bulbospongiosus_21922_ID"],21923:["Right_ischiocavernosus_21923_ID"],21924:["Left_ischiocavernosus_21924_ID"],21930:["External_Anal_Sphincter_21930_ID"],22109:["Right_Tibial_nerve_22109_ID"],22110:["Left_Tibial_nerve_22110_ID"],22111:["Right_sciatic_nerve_22111_ID"],22112:["Left_sciatic_nerve_22112_ID"],22171:["Right_inferior_ulnar_collateral_artery_22171_ID"],22172:["right_inferior_ulnar_collateral_artery_22172_ID","left_inferior_ulnar_collateral_artery_22172_ID"],22322:["Right_Iliacus_22322_ID"],22323:["Left_Iliacus_22323_ID"],22324:["Right_Obturator_Internus_22324_ID"],22325:["Left_Obturator_Internus_22325_ID"],22326:["Right_Obturator_externus_22326_ID"],22327:["Left_Obturator_externus_22327_ID"],22328:["Right_gluteus_maximus_22328_ID"],22329:["Left_gluteus_maximus_22329_ID"],22330:["Right_gluteus_medius_22330_ID"],22331:["Left_gluteus_medius_22331_ID"],22332:["Right_Gluteus_minimus_22332_ID"],22333:["Left_Gluteus_minimus_22333_ID"],22334:["Right_superior_gemellus_22334_ID"],22335:["Left_superior_gemellus_22335_ID"],22336:["Right_inferior_gemellus_22336_ID"],22337:["Left_inferior_gemellus_22337_ID"],22338:["Right_Quadratus_femoris_22338_ID"],22339:["Left_Quadratus_femoris_22339_ID"],22340:["Right_Piriformis_22340_ID"],22341:["Left_Piriformis_22341_ID"],22342:["Right_Psoas_Major_22342_ID"],22343:["Left_Psoas_Major_22343_ID"],22344:["Right_Transversus_abdominis_22344_ID"],22345:["Left_Transversus_abdominis_22345_ID"],22348:["Right_Quadratus_lumborum_22348_ID"],22349:["Left_Quadratus_lumborum_22349_ID"],22351:["Right_Psoas_Minor_22351_ID"],22352:["Left_Psoas_Minor_22352_ID"],22354:["Right_Sartorius_22354_ID"],22355:["Left_Sartorius_22355_ID"],22358:["Right_Semitendinosus_22358_ID"],22359:["Left_Semitendinosus_22359_ID"],22360:["Right_Biceps_Femoris_22360_ID"],22361:["Left_Biceps_Femoris_22361_ID"],22425:["Right_Tensor_Fasciae_Latae_22425_ID"],22426:["Left_Tensor_Fasciae_Latae_22426_ID"],22444:["Right_quadriceps_femoris_22444_ID"],22445:["Left_quadriceps_femoris_22445_ID"],22446:["Right_Articularis_Genus_22446_ID"],22447:["Left_Articularis_Genus_22447_ID"],22448:["Right_Semimembranosus_22448_ID"],22449:["Left_Semimembranosus_22449_ID"],22450:["Right_Pectineus_22450_ID"],22451:["Left_Pectineus_22451_ID"],22456:["Right_Adductor_Longus_22456_ID"],22457:["Right_Adductor_Longus_22457_ID","Left_Adductor_Longus_22457_ID"],22458:["Left_Adductor_Longus_22458_ID"],22459:["Right_Adductor_Magnus_22459_ID"],22460:["Left_Adductor_Magnus_22460_ID"],22507:["Right_descending_genicular_artery_22507_ID"],22508:["Left_descending_genicular_artery_22508_ID"],22539:["Right_Fibularis_tertius_22539_ID","Left_Fibularis_tertius_22539_ID"],22545:["Right_Tibialis_anterior_22545_ID","Left_Tibialis_anterior_22545_ID"],22547:["Left_Extensor_hallucis_longus_22547_ID","Right_Extensor_hallucis_longus_22547_ID"],22548:["Right_Extensor_hallucis_longus_22548_ID","Left_Extensor_hallucis_longus_22548_ID"],22549:["Right_extensor_digitorum_longus_22549_ID","Left_extensor_digitorum_longus_22549_ID"],22551:["Right_Fibularis_tertius_22551_ID","Left_Fibularis_tertius_22551_ID"],22553:["Right_Fibularis_longus_22553_ID","Left_Fibularis_longus_22553_ID"],22555:["Left_Fibularis_brevis_22555_ID","Right_Fibularis_brevis_22555_ID"],22556:["Right_Gastrocnemius_22556_ID"],22557:["Left_Gastrocnemius_22557_ID"],22559:["Right_Soleus_22559_ID","Left_Soleus_22559_ID"],22561:["Left_Plantaris_22561_ID","Right_Plantaris_22561_ID"],22586:["Right_superior_medial_genicular_artery_22586_ID"],22587:["Left_superior_medial_genicular_artery_22587_ID"],22588:["Right_superior_lateral_genicular_artery_22588_ID"],22589:["Left_superior_lateral_genicular_artery_22589_ID"],22592:["Right_Popliteus_22592_ID","Left_Popliteus_22592_ID"],22655:["Right_Axillary_artery_22655_ID"],22656:["Left_Axillary_artery_22656_ID","Right_Axillary_artery_22656_ID"],22669:["right_superior_thoracic_artery_22669_ID"],22670:["left_superior_thoracic_artery_22670_ID"],22675:["Right_lateral_thoracic_artery_22675_ID"],22676:["right_lateral_thoracic_artery_22676_ID","left_lateral_thoracic_artery_22676_ID"],22679:["Right_subscapular_artery_22679_ID"],22680:["left_subscapular_artery_22680_ID","right_subscapular_artery_22680_ID"],22682:["Right_anterior_humeral_circumflex_artery_22682_ID"],22683:["right_anterior_humeral_circumflex_artery_22683_ID","left_anterior_humeral_circumflex_artery_22683_ID"],22686:["Right_posterior_humeral_circumflex_artery_22686_ID"],22687:["left_posterior_humeral_circumflex_artery_22687_ID","right_posterior_humeral_circumflex_artery_22687_ID"],22691:["Right_brachial_artery_22691_ID"],22692:["right_brachial_artery_22692_ID","left_brachial_artery_22692_ID"],22696:["Right_deep_brachial_artery_22696_ID"],22697:["right_deep_brachial_artery_22697_ID","left_deep_brachial_artery_22697_ID"],22707:["Right_superior_ulnar_collateral_artery_22707_ID"],22708:["right_superior_ulnar_collateral_artery_22708_ID","left_superior_ulnar_collateral_artery_22708_ID"],22726:["Right_Splenius_cervicis_22726_ID"],22727:["Left_Splenius_cervicis_22727_ID"],22728:["Right_Splenius_capitis_22728_ID"],22729:["Left_Splenius_capitis_22729_ID"],22733:["Right_radial_artery_22733_ID"],22734:["Right_radial_artery_22734_ID","Left_radial_artery_22734_ID"],22740:["Right_Iliocostalis_Lumborum_22740_ID"],22741:["Left_Iliocostalis_Lumborum_22741_ID"],22742:["Right_Iliocostalis_Thoracis_22742_ID"],22743:["Left_Iliocostalis_Thoracis_22743_ID"],22744:["Right_Iliocostalis_Cervicis_22744_ID"],22745:["Left_Iliocostalis_Cervicis_22745_ID"],22751:["Right_Longissimus_Thoracis_22751_ID"],22753:["Left_Longissimus_Thoracis_22753_ID"],22754:["Right_Longissimus_Capitis_22754_ID"],22756:["Left_Longissimus_Capitis_22756_ID"],22757:["Right_Longissimus_Cervicis_22757_ID"],22758:["Left_Longissimus_Cervicis_22758_ID"],22765:["Right_radial_recurrent_artery_22765_ID"],22766:["left_radial_recurrent_artery_22766_ID","right_radial_recurrent_artery_22766_ID"],22772:["dorsal_carpal_branch_of_Right_radial_artery_22772_ID"],22773:["dorsal_carpal_branch_of_left_radial_artery_22773_ID","dorsal_carpal_branch_of_right_radial_artery_22773_ID"],22779:["Right_Spinalis_Thoracis_22779_ID"],22780:["Left_Spinalis_Thoracis_22780_ID"],22781:["Right_Spinalis_Cervicis_22781_ID"],22782:["Left_Spinalis_Cervicis_22782_ID"],22783:["Right_Spinalis_Capitis_22783_ID"],22784:["Left_Spinalis_Capitis_22784_ID"],22798:["Right_ulnar_artery_22798_ID","Left_ulnar_artery_22798_ID"],22801:["Right_anterior_ulnar_recurrent_artery_22801_ID"],22802:["right_anterior_ulnar_recurrent_artery_22802_ID","left_anterior_ulnar_recurrent_artery_22802_ID"],22804:["Right_posterior_ulnar_recurrent_artery_22804_ID"],22805:["right_posterior_ulnar_recurrent_artery_22805_ID","left_posterior_ulnar_recurrent_artery_22805_ID"],22807:["Right_common_interosseous_artery_22807_ID"],22808:["left_common_interosseous_artery_22808_ID","right_common_interosseous_artery_22808_ID"],22812:["Right_anterior_interosseous_artery_22812_ID"],22813:["left_anterior_interosseous_artery_22813_ID","right_anterior_interosseous_artery_22813_ID"],22821:["dorsal_carpal_branch_of_Right_ulnar_artery_22821_ID"],22822:["dorsal_carpal_branch_of_left_ulnar_artery_22822_ID","dorsal_carpal_branch_of_right_ulnar_artery_22822_ID"],22836:["Right_superficial_palmar_arch_22836_ID"],22837:["left_superficial_palmar_arch_22837_ID","right_superficial_palmar_arch_22837_ID"],22839:["Right_deep_palmar_arterial_arch_22839_ID"],22840:["left_deep_palmar_venous_arch_22840_ID","right_deep_palmar_venous_arch_22840_ID","right_deep_palmar_arterial_arch_22840_ID","left_deep_palmar_arterial_arch_22840_ID","right_deep_palmar_arch_22840_ID","left_deep_palmar_arch_22840_ID"],22872:["Right_Semispinalis_thoracis_22872_ID"],22873:["Left_Semispinalis_thoracis_22873_ID"],22874:["Right_Semispinalis_cervicis_22874_ID"],22875:["Left_Semispinalis_cervicis_22875_ID"],22876:["Right_Semispinalis_capitis_22876_ID"],22877:["Left_Semispinalis_capitis_22877_ID"],22878:["Right_Multifidus_22878_ID"],22879:["Left_Multifidus_22879_ID"],22909:["Right_basilic_vein_22909_ID"],22910:["right_basilic_vein_22910_ID","left_basilic_vein_22910_ID","Left_basilic_vein_22910_ID"],22920:["Right_palmar_metacarpal_veins_22920_ID"],22921:["right_palmar_metacarpal_veins_22921_ID","left_palmar_metacarpal_veins_22921_ID"],22935:["Right_medial_brachial_vein_22935_ID"],22936:["right_medial_brachial_vein_22936_ID","left_medial_brachial_vein_22936_ID"],22948:["Right_radial_vein_22948_ID"],22949:["left_radial_vein_22949_ID","right_radial_vein_22949_ID"],22951:["right_ulnar_vein_22951_ID"],22952:["right_ulnar_vein_22952_ID","left_ulnar_vein_22952_ID"],22964:["Right_median_cubital_vein_22964_ID"],22965:["right_median_cubital_vein_22965_ID","left_median_cubital_vein_22965_ID"],22968:["Right_median_antebrachial_vein_22968_ID"],22969:["left_median_antebrachial_vein_22969_ID","right_median_antebrachial_vein_22969_ID"],23111:["Right_deep_dorsal_vein_23111_ID"],23112:["right_deep_dorsal_vein_23112_ID","left_deep_dorsal_vein_23112_ID"],23123:["Right_medial_collateral_artery_23123_ID"],23124:["right_medial_collateral_artery_23124_ID","left_medial_collateral_artery_23124_ID"],23126:["Right_radial_collateral_artery_23126_ID"],23127:["right_radial_collateral_artery_23127_ID","left_radial_collateral_artery_23127_ID"],23130:["Right_Humerus_23130_ID","Left_Humerus_23130_ID"],23180:["Right_circumflex_scapular_artery_23180_ID"],23181:["right_circumflex_scapular_artery_23181_ID","left_circumflex_scapular_artery_23181_ID"],23464:["Left_radius_23464_ID","Right_radius_23464_ID"],23467:["Left_Ulna_23467_ID","Right_Ulna_23467_ID"],23707:["Right_Interosseous_membrane_23707_ID"],23708:["Left_Interosseous_membrane_23708_ID"],24160:["Bones_of_the_Right_Arm_24160_ID"],24162:["Bones_of_the_Left_Arm_24162_ID"],24435:["Right_scaphoid_bone_24435_ID","Left_scaphoid_bone_24435_ID"],24437:["Left_lunate_bone_24437_ID","Right_lunate_bone_24437_ID"],24439:["Left_triquetral_bone_24439_ID","Right_triquetral_bone_24439_ID"],24441:["Right_pisiform_24441_ID","Left_pisiform_24441_ID"],24443:["Right_trapezium_24443_ID","Left_trapezium_24443_ID"],24444:["Right_trapezoid_bone_24444_ID","Left_trapezoid_bone_24444_ID"],24446:["Right_capitate_bone_24446_ID","Left_capitate_bone_24446_ID"],24448:["Left_hamate_bone_24448_ID","Right_hamate_bone_24448_ID"],24474:["Right_femur_24474_ID"],24475:["Left_femur_24475_ID"],24477:["Right_tibia_24477_ID"],24478:["Right_tibia_24478_ID","Left_tibia_24478_ID"],24480:["Right_fibula_24480_ID"],24481:["Right_fibula_24481_ID","Left_fibula_24481_ID"],24482:["Right_talus_24482_ID"],24483:["Right_talus_24483_ID","Left_talus_24483_ID"],24486:["Right_patella_24486_ID"],24487:["Right_patella_24487_ID","Left_patella_24487_ID"],24497:["Right_calcaneus_24497_ID"],24498:["Right_calcaneus_24498_ID","Left_calcaneus_24498_ID"],24500:["Navicular_bone_of_right_foot_24500_ID"],24501:["Navicular_of_right_foot_24501_ID","Navicular_of_left_foot_24501_ID","Navicular_bone_of_left_foot_24501_ID"],24521:["Right_medial_Cuneiform_bone_24521_ID"],24522:["Left_medial_Cuneiform_bone_24522_ID","Right_medial_Cuneiform_bone_24522_ID"],24523:["Right_intermediate_Cuneiform_bone_24523_ID"],24524:["Right_intermediate_Cuneiform_bone_24524_ID","Left_intermediate_Cuneiform_bone_24524_ID"],24525:["Right_lateral_Cuneiform_bone_24525_ID"],24526:["Right_lateral_Cuneiform_bone_24526_ID","Left_lateral_Cuneiform_bone_24526_ID"],24528:["Right_cuboid_bone_24528_ID"],24529:["Left_cuboid_bone_24529_ID","Right_cuboid_bone_24529_ID"],25005:["Anterior_atlanto_occipital_membrane_25005_ID","Anterior_atlantooccipital_membrane_25005_ID"],29711:["Prostatic_venous_plexus_29711_ID"],31893:["Anterior_longitudinal_ligament_31893_ID"],32530:["Right_Rectus_capitis_posterior_major_32530_ID"],32531:["Left_Rectus_Capitis_posterior_major_32531_ID"],32532:["Right_Rectus_capitis_posterior_minor_32532_ID"],32533:["Left_Rectus_capitis_posterior_minor_32533_ID","Right_Rectus_Capitis_posterior_major_32533_ID"],32535:["Right_Rectus_capitis_posterior_minor_32535_ID"],32540:["Right_Levator_Scapulae_32540_ID","Right_Levator_scapulae_32540_ID"],32541:["Left_Levator_scapulae_32541_ID"],32542:["Right_Deltoid_32542_ID"],32543:["Left_Deltoid_32543_ID","Right_Deltoid_32543_ID"],32544:["Right_supraspinatus_32544_ID","Right_Supraspinatus_32544_ID"],32545:["Left_Supraspinatus_32545_ID"],32547:["Right_infraspinatus_32547_ID"],32548:["Left_infraspinatus_32548_ID"],32551:["Right_Teres_Major_32551_ID"],32552:["Left_Teres_Major_32552_ID"],32553:["Right_teres_minor_32553_ID"],32554:["Left_teres_minor_32554_ID"],33098:["Right_Rotatores_short_fibers_33098_ID","Right_Rotatores_long_fibers_33098_ID"],33099:["Left_Rotatores_long_fibers_33099_ID","Left_Rotatores_short_fibers_33099_ID"],33520:["Right_pectoral_girdle_muscles_33520_ID"],33521:["Left_pectoral_girdle_muscles_33521_ID","Right_pectoral_girdle_muscles_33521_ID"],37318:["Right_ulnar_nerve_37318_ID"],37319:["Left_ulnar_nerve_37319_ID"],37386:["Right_Abductor_pollicis_brevis_37386_ID"],37387:["Left_Abductor_pollicis_brevis_37387_ID"],37388:["Right_Flexor_pollicis_brevis_37388_ID"],37389:["Left_Flexor_pollicis_brevis_37389_ID"],37390:["Right_Opponens_pollicis_37390_ID"],37391:["Left_Opponens_pollicis_37391_ID"],37392:["Right_Adductor_pollicis_37392_ID"],37393:["Left_Adductor_pollicis_37393_ID","Right_Palmaris_brevis_37393_ID"],37395:["Left_Palmaris_brevis_37395_ID"],37396:["Right_Abductor_digiti_minimi_37396_ID"],37397:["Left_Abductor_digiti_minimi_37397_ID"],37398:["Right_Flexor_digiti_minimi_brevis_37398_ID"],37399:["Left_Flexor_digiti_minimi_brevis_37399_ID"],37400:["Right_Opponens_digiti_minimi_37400_ID"],37401:["Left_Opponens_digiti_minimi_37401_ID"],37460:["Right_Abductor_hallucis_37460_ID","Left_Abductor_hallucis_37460_ID"],37462:["Right_Flexor_digiti_minimi_brevis_37462_ID","Left_Flexor_digiti_minimi_brevis_37462_ID"],37464:["Abductor_digiti_minimi_of_right_foot_37464_ID","Abductor_digiti_minimi_of_left_foot_37464_ID"],37468:["Left_Flexor_hallucis_brevis_37468_ID","Right_Flexor_hallucis_brevis_37468_ID"],37470:["Left_Adductor_hallucis_37470_ID","Left_Adductor_hallucis_oblique_head_37470_ID","Left_Adductor_hallucis_transverse_head_37470_ID","Right_Adductor_hallucis_37470_ID","Right_Adductor_hallucis_oblique_head_37470_ID","Right_Adductor_hallucis_transverse_head_37470_ID"],37665:["Right_Coracobrachialis_37665_ID"],37666:["Left_Coracobrachialis_37666_ID","Right_Coracobrachialis_37666_ID"],37668:["Right_Brachialis_37668_ID"],37669:["Left_Brachialis_37669_ID"],37671:["Right_Biceps_Brachii_37671_ID"],37672:["Right_Biceps_Brachii_37672_ID","Left_Biceps_Brachii_37672_ID"],37689:["Right_Triceps_Brachii_37689_ID"],37690:["Right_Triceps_Brachii_37690_ID","Left_Triceps_Brachii_37690_ID"],37705:["Right_anconeus_37705_ID"],37706:["Left_anconeus_37706_ID","Right_anconeus_37706_ID"],38451:["Right_Pronator_teres_38451_ID"],38452:["Left_Pronator_teres_38452_ID"],38454:["Right_Pronator_quadratus_38454_ID"],38455:["Left_Pronator_quadratus_38455_ID"],38460:["Right_Flexor_carpi_radialis_longus_38460_ID"],38461:["Left_Flexor_carpi_radialis_longus_38461_ID"],38463:["Right_Palmaris_longus_38463_ID"],38464:["Left_Palmaris_longus_38464_ID"],38466:["Right_Flexor_carpi_ulnaris_38466_ID"],38467:["Left_Flexor_carpi_ulnaris_38467_ID"],38483:["Right_flexor_pollicis_longus_38483_ID"],38484:["Left_flexor_pollicis_longus_38484_ID"],38486:["Right_Brachioradialis_38486_ID"],38487:["Left_Brachioradialis_38487_ID"],38495:["Right_Extensor_carpi_radialis_longus_38495_ID"],38496:["Left_Extensor_carpi_radialis_longus_38496_ID"],38498:["Right_Extensor_carpi_radialis_brevis_38498_ID"],38499:["Left_Extensor_carpi_radialis_brevis_38499_ID"],38504:["Right_Extensor_digiti_minimi_38504_ID"],38505:["Left_Extensor_digiti_minimi_38505_ID"],38507:["Right_Extensor_carpi_ulnaris_38507_ID"],38508:["Left_Extensor_carpi_ulnaris_38508_ID"],38513:["Right_Supinator_38513_ID"],38514:["Left_Supinator_38514_ID"],38516:["Right_Abductor_pollicis_longus_38516_ID"],
  38517:["Left_Abductor_pollicis_longus_38517_ID"],38519:["Right_Extensor_pollicis_brevis_38519_ID"],38520:["Left_Extensor_pollicis_brevis_38520_ID"],38522:["Right_Extensor_pollicis_longus_38522_ID"],38523:["Left_Extensor_pollicis_longus_38523_ID"],38525:["Right_Extensor_indicis_38525_ID"],38526:["Left_Extensor_indicis_38526_ID"],38928:["Right_Rectus_Femoris_38928_ID"],38929:["Left_Rectus_Femoris_38929_ID"],38930:["Right_Vastus_Lateralis_38930_ID"],38931:["Left_Vastus_Lateralis_38931_ID"],38932:["Right_Vastus_Medialis_38932_ID"],38933:["Left_Vastus_Medialis_38933_ID"],38934:["Right_Vastus_Intermedius_38934_ID"],38935:["Left_Vastus_Intermedius_38935_ID"],39091:["Left_forearm_muscles_39091_ID"],39092:["Right_forearm_muscles_39092_ID"],39987:["Right_Extensor_retinaculum_of_hand_39987_ID","Left_Extensor_retinaculum_of_hand_39987_ID"],39988:["Right_Flexor_retinaculum_of_hand_39988_ID","Left_Flexor_retinaculum_of_hand_39988_ID"],42313:["Right_Pisohamate_Ligament_42313_ID","Left_Pisohamate_Ligament_42313_ID"],42369:["Right_hand_muscles_42369_ID"],42370:["Left_hand_muscles_42370_ID"],43883:["Right_Gracilis_43883_ID"],43884:["Left_Gracilis_43884_ID"],43890:["Right_inferior_medial_genicular_artery_43890_ID"],43891:["Left_inferior_medial_genicular_artery_43891_ID","Right_inferior_medial_genicular_artery_43891_ID"],43892:["Right_inferior_lateral_genicular_artery_43892_ID"],43893:["Left_inferior_lateral_genicular_artery_43893_ID"],43896:["Right_anterior_tibial_artery_43896_ID"],43897:["Right_anterior_tibial_artery_43897_ID","Left_anterior_tibial_artery_43897_ID"],43898:["Left_anterior_tibial_artery_43898_ID","Right_posterior_tibial_artery_43898_ID"],43899:["Left_posterior_tibial_artery_43899_ID"],43907:["Right_anterior_tibial_recurrent_artery_43907_ID"],43908:["Left_anterior_tibial_recurrent_artery_43908_ID"],43916:["Right_dorsalis_pedis_artery_43916_ID"],43917:["Left_dorsalis_pedis_artery_43917_ID"],43922:["Right_fibular_artery_43922_ID"],43923:["Left_fibular_artery_43923_ID"],43929:["Right_medial_plantar_artery_43929_ID"],43930:["Left_medial_plantar_artery_43930_ID"],43931:["Right_lateral_plantar_artery_43931_ID"],43932:["Left_lateral_plantar_artery_43932_ID"],43935:["Right_deep_medial_plantar_artery_43935_ID"],43936:["Left_deep_medial_plantar_artery_43936_ID"],43943:["Right_plantar_arch_43943_ID"],43944:["Left_plantar_arch_43944_ID"],43950:["Calcaneal_branch_of_right_fibular_artery_43950_ID"],43951:["Calcaneal_branch_of_left_fibular_artery_43951_ID"],44227:["Left_Popliteal_Lymph_Nodes_44227_ID","Right_Popliteal_Lymph_Nodes_44227_ID"],44249:["Right_Long_plantar_ligament_44249_ID","Left_Long_plantar_ligament_44249_ID"],44310:["Lymphatics_of_the_Lower_Limb_44310_ID"],44326:["Descending_branch_of_right_lateral_circumflex_femoral_Vein_44326_ID"],44327:["Descending_branch_of_left_lateral_circumflex_femoral_Vein_44327_ID"],44328:["Right_Popliteal_vein_44328_ID"],44329:["Left_Popliteal_vein_44329_ID"],44334:["Right_small_saphenous_vein_44334_ID"],44335:["Left_small_saphenous_vein_44335_ID"],44336:["Right_Anterior_Tibial_Vein_44336_ID"],44337:["Left_Anterior_Tibial_Vein_44337_ID"],44338:["Right_Posterior_Tibial_Vein_44338_ID"],44339:["Left_Posterior_Tibial_Vein_44339_ID"],44340:["Right_superficial_epigastric_vein_44340_ID"],44341:["Left_superficial_epigastric_vein_44341_ID"],44583:["Right_Oblique_Popliteal_Ligament_44583_ID"],44584:["Left_Oblique_Popliteal_Ligament_44584_ID"],44585:["Right_Patellar_Ligament_44585_ID"],44586:["Left_Patellar_Ligament_44586_ID"],44597:["Right_Arcuate_Popliteal_Ligament_44597_ID"],44599:["Left_Arcuate_Popliteal_Ligament_44599_ID"],44601:["Right_Tibial_Collateral_Ligament_44601_ID"],44602:["Left_Tibial_Collateral_Ligament_44602_ID"],44609:["Right_Fibular_Collateral_Ligament_44609_ID"],44610:["Left_Fibular_Collateral_Ligament_44610_ID"],44615:["Right_Anterior_Cruciate_Ligament_44615_ID"],44616:["Left_Anterior_Cruciate_Ligament_44616_ID"],44618:["Right_Posterior_Cruciate_Ligament_44618_ID"],44619:["Left_Posterior_Cruciate_Ligament_44619_ID"],44741:["Right_proper_plantar_digital_nerves_44741_ID"],44742:["Left_proper_plantar_digital_nerves_44742_ID"],44874:["Right_dorsal_branch_of_ulnar_nerve_44874_ID"],44875:["Left_dorsal_branch_of_ulnar_nerve_44875_ID"],44881:["Branch_of_Dorsal_venous_arch_of_Right_foot_44881_ID","Right_Dorsalis_pedis_vein_44881_ID","Dorsal_venous_arch_of_Right_foot_44881_ID"],44882:["Branch_of_Dorsal_venous_arch_of_Left_foot_44882_ID","Dorsal_venous_arch_of_Left_foot_44882_ID","Left_Dorsalis_pedis_vein_44882_ID"],44883:["Medial_branch_of_Plantar_venous_arch_of_right_foot_44883_ID","Plantar_venous_arch_of_Right_foot_44883_ID","Lateral_branch_of_Plantar_venous_arch_of_right_foot_44883_ID"],44884:["Medial_branch_of_Plantar_venous_arch_of_left_foot_44884_ID","Lateral_branch_of_Plantar_venous_arch_of_left_foot_44884_ID","Plantar_venous_arch_of_Left_foot_44884_ID"],44885:["Right_Fibular_vein_44885_ID"],44886:["Left_Fibular_vein_44886_ID"],44887:["Right_Superior_Medial_Genicular_vein_44887_ID","Right_Genicular_Veins_44887_ID","Right_Inferior_Medial_Genicular_Vein_44887_ID","Right_Superior_Lateral_Genicular_vein_44887_ID","Right_Inferior_Lateral_Genicular_Vein_44887_ID"],44888:["Left_Inferior_Lateral_Genicular_Vein_44888_ID","Left_Genicular_Veins_44888_ID","Left_Inferior_Medial_Genicular_Vein_44888_ID","Left_Superior_Medial_Genicular_vein_44888_ID","Left_Superior_Lateral_Genicular_vein_44888_ID"],44918:["Right_medial_circumflex_femoral_vein_44918_ID"],44919:["Left_medial_circumflex_femoral_vein_44919_ID"],44920:["Right_lateral_circumflex_femoral_vein_44920_ID"],44922:["Left_lateral_circumflex_femoral_vein_44922_ID"],45257:["Right_Intermediate_Femoral_Cutaneous_Nerve_45257_ID"],45258:["Left_Intermediate_Femoral_Cutaneous_Nerve_45258_ID"],45263:["Right_saphenous_nerve_45263_ID"],45264:["Left_saphenous_nerve_45264_ID"],45338:["Right_Posterior_femoral_cutaneous_nerve_45338_ID"],45339:["Left_Posterior_femoral_cutaneous_nerve_45339_ID"],45357:["Right_common_fibular_nerve_45357_ID"],45358:["Left_common_fibular_nerve_45358_ID"],45363:["Right_superficial_fibular_nerve_45363_ID"],45364:["Left_superficial_fibular_nerve_45364_ID"],45387:["Right_deep_fibular_nerve_45387_ID"],45388:["Left_deep_fibular_nerve_45388_ID"],45389:["Right_Lateral_terminal_branch_of_deep_fibular_nerve_45389_ID"],45390:["Left_Lateral_terminal_branch_of_deep_fibular_nerve_45390_ID"],45426:["Right_sural_nerve_45426_ID"],45427:["Left_sural_nerve_45427_ID"],45434:["Right_medial_proper_plantar_nerve_45434_ID"],45435:["Left_medial_proper_plantar_nerve_45435_ID"],45450:["Right_lateral_plantar_nerve_45450_ID"],45451:["Left_lateral_plantar_nerve_45451_ID"],45654:["Female_Internal_Genitalia_45654_ID"],45739:["Right_platysma_45739_ID"],45740:["Left_platysma_45740_ID"],45769:["Internal_Urethral_Sphincter_45769_ID"],45826:["Right_Stylohyoid_45826_ID"],45827:["Left_Stylohyoid_45827_ID"],45858:["Right_Iliococcygeus_45858_ID"],45859:["Left_Iliococcygeus_45859_ID"],45890:["Right_Biceps_Femoris_Short_Head_45890_ID"],45891:["Left_Biceps_Femoris_Short_Head_45891_ID"],46283:["Superior_oblique_part_of_right_longus_colli_46283_ID"],46284:["Superior_oblique_part_of_left_longus_colli_46284_ID"],46285:["Vertical_Intermediate_part_of_right_longus_colli_46285_ID"],46286:["Vertical_Intermediate_part_of_left_longus_colli_46286_ID"],46287:["Inferior_oblique_part_of_right_longus_colli_46287_ID"],46288:["Inferior_oblique_part_of_left_longus_colli_46288_ID"],46292:["Right_Digastric_46292_ID","Right_Digastric_muscle_46292_ID"],46293:["Left_Digastric_46293_ID","Left_Digastric_muscle_46293_ID"],46309:["Right_Longus_capitis_46309_ID"],46310:["Left_Longus_capitis_46310_ID"],46313:["Right_Rectus_capitis_anterior_46313_ID"],46314:["Left_Rectus_capitis_anterior_46314_ID"],46317:["Right_Rectus_capitis_lateralis_46317_ID"],46318:["Right_Rectus_capitis_lateralis_46318_ID","Left_Rectus_capitis_lateralis_46318_ID"],46319:["Left_Rectus_capitis_lateralis_46319_ID"],46321:["Right_Mylohyoid_muscle_46321_ID","Right_Mylohyoid_Muscle_46321_ID"],46322:["Left_Mylohyoid_46322_ID","Left_Mylohyoid_Muscle_46322_ID"],46326:["Right_Geniohyoid_46326_ID"],46327:["Left_Geniohyoid_46327_ID"],46443:["Right_Coccygeus_46443_ID"],46444:["Left_Coccygeus_46444_ID"],46563:["Vertical_part_of_left_cricothyroid_muscle_46563_ID","Right_Cricothyroid_muscle_46563_ID","Oblique_part_of_left_cricothyroid_muscle_46563_ID"],46564:["Vertical_part_of_left_cricothyroid_muscle_46564_ID","Left_Cricothyroid_muscle_46564_ID","Oblique_part_of_left_cricothyroid_muscle_46564_ID"],46621:["Superior_Pharyngeal_Constrictor_46621_ID"],46622:["Middle_Pharyngeal_Constrictor_46622_ID"],46623:["Inferior_Pharyngeal_Constrictor_46623_ID"],46690:["Genioglossus_46690_ID"],46703:["Right_Hyoglossus_46703_ID"],46704:["Left_Hyoglossus_46704_ID"],46705:["Right_Styloglossus_46705_ID"],46706:["Right_Styloglossus_46706_ID","Left_Styloglossus_46706_ID"],46759:["Right_frontalis_46759_ID"],46760:["Left_frontalis_46760_ID"],46761:["Right_occipitalis_46761_ID"],46762:["Left_occipitalis_46762_ID"],46768:["Epicranial_aponeurosis_46768_ID"],46777:["Depressor_septi_nasi_46777_ID"],46792:["Right_orbicularis_oculi_46792_ID"],46793:["Left_orbicularis_oculi_46793_ID"],46796:["Right_corrugator_supercilii_46796_ID"],46797:["Left_corrugator_supercilii_46797_ID"],46803:["Right_levator_labii_superioris_alaeque_nasi_46803_ID"],46804:["Left_levator_labii_superioris_alaeque_nasi_46804_ID"],46806:["Right_levator_labii_superioris_46806_ID"],46807:["Left_levator_labii_superioris_46807_ID"],46812:["Right_zygomaticus_major_46812_ID"],46813:["Left_zygomaticus_major_46813_ID"],46814:["Right_zygomaticus_minor_46814_ID"],46815:["Left_zygomaticus_minor_46815_ID"],46817:["Right_depressor_labii_inferioris_46817_ID"],46818:["Left_depressor_labii_inferioris_46818_ID"],46823:["Right_levator_anguli_oris_46823_ID"],46824:["Left_levator_anguli_oris_46824_ID"],46826:["Right_mentalis_46826_ID"],46827:["Left_mentalis_46827_ID"],46829:["Right_depressor_anguli_oris_46829_ID"],46830:["Left_depressor_anguli_oris_46830_ID"],46835:["Right_buccinator_46835_ID"],46836:["Left_buccinator_46836_ID"],46839:["Right_risorius_46839_ID"],46840:["Left_risorius_46840_ID"],46841:["Orbicularis_oris_46841_ID"],48025:["Left_Tendon_of_Digastric_48025_ID","Right_Tendon_of_Digastric_48025_ID","Right_Tendon_of_Digastric_Muscle_48025_ID","Left_Tendon_of_Digastric_Muscle_48025_ID"],48957:["Right_auricularis_superior_48957_ID"],48958:["Left_auricularis_superior_48958_ID"],48959:["Right_auricularis_anterior_48959_ID"],48960:["Left_auricularis_anterior_48960_ID"],48961:["Right_auricularis_posterior_48961_ID"],48962:["Left_auricularis_posterior_48962_ID"],48997:["Right_masseter_48997_ID"],48998:["Left_masseter_48998_ID"],49007:["Right_temporalis_49007_ID"],49008:["Left_temporalis_49008_ID"],49012:["Right_Medial_Pterygoid_49012_ID"],49013:["Left_Medial_Pterygoid_49013_ID"],49016:["Right_inferior_lateral_pterygoid_49016_ID","Right_superior_lateral_pterygoid_49016_ID"],49017:["Left_superior_lateral_pterygoid_49017_ID","Left_inferior_lateral_pterygoid_49017_ID"],49036:["Left_inferior_rectus_49036_ID"],49044:["Right_superior_rectus_49044_ID"],49045:["Left_superior_rectus_49045_ID"],49046:["Right_inferior_rectus_49046_ID"],49047:["Left_inferior_rectus_49047_ID"],49048:["Right_levator_palpebrae_superioris_49048_ID"],49049:["Left_levator_palpebrae_superioris_49049_ID"],49050:["Right_inferior_oblique_49050_ID"],49051:["Left_inferior_oblique_49051_ID"],49052:["Right_superior_oblique_49052_ID"],49053:["Left_superior_oblique_49053_ID"],49054:["Right_lateral_rectus_49054_ID"],49055:["Left_lateral_rectus_49055_ID"],49056:["Right_medial_rectus_49056_ID"],49057:["Left_medial_rectus_49057_ID"],49152:["Right_Ciliary_Muscle_49152_ID"],49153:["Left_Ciliary_Muscle_49153_ID"],49177:["Upper_Gastrointestinal_Tract_49177_ID"],49386:["Right_Inferior_extensor_retinaculum_49386_ID","Left_Inferior_extensor_retinaculum_49386_ID"],49388:["Right_Superior_extensor_retinaculum_49388_ID","Left_Superior_extensor_retinaculum_49388_ID"],49481:["Right_superior_laryngeal_artery_49481_ID"],49482:["Left_superior_laryngeal_artery_49482_ID"],49486:["Right_superior_thyroid_artery_49486_ID"],49487:["Left_superior_thyroid_artery_49487_ID"],49498:["Right_ascending_pharyngeal_artery_49498_ID"],49499:["Left_ascending_pharyngeal_artery_49499_ID"],49550:["Right_facial_artery_49550_ID"],49551:["Left_facial_artery_49551_ID","Right_facial_artery_49551_ID"],49552:["Left_facial_artery_49552_ID"],49556:["Right_ascending_palatine_artery_49556_ID"],49557:["Left_ascending_palatine_artery_49557_ID"],49559:["Right_tonsillar_artery_49559_ID"],49560:["Left_tonsillar_artery_49560_ID"],49561:["Right_tonsillar_artery_49561_ID"],49567:["Inferior_labial_artery_49567_ID"],49570:["Superior_labial_artery_49570_ID"],49584:["Right_angular_artery_49584_ID"],49585:["Left_angular_artery_49585_ID"],49625:["Right_posterior_auricular_artery_49625_ID"],49626:["Left_posterior_auricular_artery_49626_ID"],49651:["Right_superficial_temporal_artery_49651_ID"],49652:["Left_superficial_temporal_artery_49652_ID"],49658:["Right_transverse_facial_artery_49658_ID"],49659:["Left_transverse_facial_artery_49659_ID"],49660:["Right_transverse_facial_artery_49660_ID"],49676:["Right_maxillary_artery_49676_ID"],49677:["Left_maxillary_artery_49677_ID"],49678:["Right_maxillary_artery_49678_ID"],49705:["Right_mental_artery_49705_ID","branch_of_right_mental_artery_49705_ID"],49706:["Left_mental_artery_49706_ID","branch_of_left_mental_artery_49706_ID"],49712:["Right_middle_meningeal_artery_49712_ID"],49713:["Left_middle_meningeal_artery_49713_ID"],49743:["Right_deep_temporal_artery_49743_ID"],49744:["Left_deep_temporal_artery_49744_ID"],49755:["Right_buccal_artery_49755_ID"],49756:["Left_buccal_artery_49756_ID"],49768:["Right_infraorbital_artery_49768_ID"],49769:["Left_infraorbital_artery_49769_ID"],49792:["Right_descending_palatine_artery_49792_ID"],49793:["Left_descending_palatine_artery_49793_ID"],49799:["Left_greater_palatine_artery_49799_ID"],49800:["Right_greater_palatine_artery_49800_ID"],49802:["Right_lesser_palatine_artery_49802_ID"],49803:["Left_lesser_palatine_artery_49803_ID"],49805:["Right_sphenopalatine_artery_49805_ID"],49806:["Left_sphenopalatine_artery_49806_ID"],49810:["Right_posterior_lateral_nasal_artery_49810_ID"],49811:["Left_posterior_lateral_nasal_artery_49811_ID"],49812:["Posterior_septal_branch_of_right_sphenopalatine_artery_49812_ID"],49813:["Posterior_septal_branch_of_left_sphenopalatine_artery_49813_ID"],49869:["Right_opthalmic_artery_49869_ID","Right_ophthalmic_artery_49869_ID"],49870:["Left_opthalmic_artery_49870_ID","Left_ophthalmic_artery_49870_ID"],49881:["Right_central_retinal_artery_49881_ID","Left_central_retinal_artery_49881_ID"],49911:["Right_Inferior_Pulmonary_vein_49911_ID"],49913:["Left_Inferior_Pulmonary_vein_49913_ID"],49914:["Right_Superior_Pulmonary_vein_49914_ID"],49916:["Left_Superior_Pulmonary_vein_49916_ID"],49928:["Right_lacrimal_artery_49928_ID"],49929:["Left_lacrimal_artery_49929_ID"],49974:["Right_supraorbital_artery_49974_ID"],49975:["Left_supraorbital_artery_49975_ID"],49987:["Right_anterior_ethmoidal_artery_49987_ID"],49988:["Left_anterior_ethmoidal_artery_49988_ID"],49990:["Right_posterior_ethmoidal_artery_49990_ID"],49991:["Left_posterior_ethmoidal_artery_49991_ID"],50001:["Right_dorsal_nasal_artery_50001_ID"],50002:["Left_dorsal_nasal_artery_50002_ID"],50026:["Right_supratrochlear_artery_50026_ID"],50027:["Left_supratrochlear_artery_50027_ID","Right_supratrochlear_artery_50027_ID"],50028:["Left_supratrochlear_artery_50028_ID"],50029:["Right_anterior_cerebral_artery_50029_ID"],50030:["Left_anterior_cerebral_artery_50030_ID"],50031:["Left_anterior_cerebral_artery_50031_ID"],50038:["Left_coronary_artery_50038_ID"],50039:["Right_Coronary_Artery_50039_ID"],50082:["Right_Middle_Cerebral_Artery_50082_ID"],50083:["Left_Middle_Cerebral_Artery_50083_ID"],50085:["Right_Posterior_Communicating_Artery_50085_ID"],50086:["Left_Posterior_Communicating_Artery_50086_ID"],50169:["Anterior_Communicating_Artery_50169_ID"],50197:["Muscles_of_the_Right_Arm_50197_ID"],50198:["Muscles_of_the_Right_Arm_50198_ID","Muscles_of_the_Left_Arm_50198_ID"],50203:["Right_upper_arm_muscles_50203_ID"],50204:["Right_upper_arm_muscles_50204_ID","Left_upper_arm_muscles_50204_ID"],50221:["Right_shoulder_muscles_50221_ID","Left_shoulder_muscles_50221_ID"],50222:["Left_shoulder_muscles_50222_ID","Right_shoulder_muscles_50222_ID"],50542:["Basilar_Artery_50542_ID"],50545:["Right_Anterior_Inferior_cerebellar_artery_50545_ID","Right_anterior_Inferior_cerebellar_artery_50545_ID"],50546:["Left_Anterior_Inferior_cerebellar_artery_50546_ID","Left_anterior_Inferior_cerebellar_artery_50546_ID"],50574:["Right_Superior_Cerebellar_artery_50574_ID"],50575:["Left_Superior_Cerebellar_Artery_50575_ID","Left_Superior_Cerebellar_artery_50575_ID"],50584:["Right_Posterior_cerebral_artery_50584_ID","Right_posterior_cerebral_artery_50584_ID"],50585:["Left_Posterior_cerebral_artery_50585_ID","Left_posterior_cerebral_artery_50585_ID"],50718:["Superior_Terminal_Branch_of_Right_Middle_Cerebral_Artery_50718_ID"],50719:["Superior_Terminal_Branch_of_Left_Middle_Cerebral_Artery_50719_ID"],50735:["Hepatic_Portal_and_Associated_Branches_50735_ID"],50764:["Right_transverse_sinus_50764_ID"],50765:["Left_transverse_sinus_50765_ID"],50767:["Superior_sagittal_sinus_50767_ID"],50768:["Inferior_Sagittal_Sinus_50768_ID"],50769:["Straight_Sinus_50769_ID"],50773:["Intercavernous_sinus_50773_ID"],50781:["Occipital_Sinus_50781_ID"],50784:["Sinus_Confluence_50784_ID"],50808:["Right_superior_thyroid_vein_50808_ID"],50809:["Left_superior_thyroid_vein_50809_ID"],50852:["Right_posterior_auricular_vein_50852_ID"],50853:["Left_posterior_auricular_vein_50853_ID"],50859:["Right_suprascapular_vein_50859_ID"],50860:["Left_suprascapular_vein_50860_ID","Right_suprascapular_vein_50860_ID"],50872:["Right_Pulmonary_artery_50872_ID"],50873:["Left_Pulmonary_artery_50873_ID"],50875:["Right_optic_nerve_50875_ID"],50876:["Left_Facial_Vein_50876_ID","Right_Facial_Vein_50876_ID"],50877:["Right_Facial_Vein_50877_ID","Left_Facial_Vein_50877_ID"],50878:["Left_optic_nerve_50878_ID"],50879:["Right_oculomotor_nerve_50879_ID"],50880:["Left_oculomotor_nerve_50880_ID"],50881:["Right_trochlear_nerve_50881_ID"],50882:["Left_trochlear_nerve_50882_ID"],50886:["Right_abducens_nerve_50886_ID"],50887:["Left_abducens_nerve_50887_ID"],50888:["Right_facial_nerve_50888_ID"],50889:["Left_facial_nerve_50889_ID"],50890:["Right_vestibulocochlear_nerve_50890_ID"],50891:["Left_vestibulocochlear_nerve_50891_ID"],50892:["Right_glossopharyngeal_nerve_50892_ID"],50894:["Left_glossopharyngeal_nerve_50894_ID"],50897:["Right_spinal_accessory_nerve_50897_ID","Left_spinal_accessory_nerve_50897_ID"],50899:["Left_spinal_accessory_nerve_50899_ID"],50902:["Right_hypoglossal_nerve_50902_ID"],50903:["Left_hypoglossal_Nerve_50903_ID"],50929:["Right_retromandibular_vein_50929_ID"],50930:["Left_retromandibular_vein_50930_ID"],50933:["Right_Superficial_Temporal_Vein_50933_ID"],50934:["Left_Superficial_Temporal_Vein_50934_ID"],51042:["Right_Deep_Femoral_vein_51042_ID"],51043:["Left_Deep_Femoral_vein_51043_ID"],51085:["Tendon_of_left_flexor_digitorum_brevis_51085_ID","Tendon_of_right_flexor_digitorum_brevis_51085_ID","Right_flexor_digitorum_longus_51085_ID","Left_flexor_digitorum_longus_51085_ID"],51289:["Right_superior_petrosal_sinus_51289_ID"],51290:["Left_superior_petrosal_sinus_51290_ID"],51402:["Right_Cavernous_sinus_51402_ID"],51403:["Left_Cavernous_Sinus_51403_ID"],51489:["Right_occipital_vein_51489_ID"],51490:["Left_occipital_vein_51490_ID"],51885:["Left_central_retinal_vein_51885_ID","Right_central_retinal_vein_51885_ID"],51942:["Right_superior_central_retinal_artery_51942_ID","Left_superior_central_retinal_artery_51942_ID"],51944:["Right_inferior_central_retinal_artery_51944_ID","Left_inferior_central_retinal_artery_51944_ID"],52619:["Right_trigeminal_ganglion_52619_ID"],52620:["Left_trigeminal_ganglion_52620_ID"],52629:["Right_lacrimal_nerve_52629_ID"],52630:["Left_lacrimal_nerve_52630_ID"],52639:["Right_opthalmic_nerve_52639_ID"],52640:["Left_opthalmic_nerve_52640_ID"],52643:["Right_supratrochlear_nerve_52643_ID"],52644:["Left_supratrochlear_nerve_52644_ID"],52661:["Medial_branch_of_right_supraorbital_nerve_52661_ID"],52662:["Medial_branch_of_left_supraorbital_nerve_52662_ID"],52663:["Lateral_branch_of_right_supraorbital_nerve_52663_ID"],52664:["Lateral_branch_of_left_supraorbital_nerve_52664_ID"],52669:["Right_nasociliary_nerve_52669_ID"],52670:["Left_nasociliary_nerve_52670_ID"],52725:["Right_maxillary_nerve_52725_ID"],52726:["Left_maxillary_nerve_52726_ID"],52734:["Frontal_bone_52734_ID"],52735:["Occipital_bone_52735_ID"],52736:["Sphenoid_bone_52736_ID"],52738:["Right_temporal_bone_52738_ID"],52739:["Left_temporal_bone_52739_ID"],52740:["Ethmoid_bone_52740_ID"],52745:["Nasal_bone_52745_ID"],52746:["Palatine_bone_52746_ID"],52748:["Mandible_52748_ID"],52749:["Hyoid_bone_52749_ID"],52784:["Left_lateral_posterior_superior_nasal_nerve_52784_ID"],52785:["Right_lateral_posterior_superior_nasal_nerve_52785_ID"],52788:["Right_parietal_bone_52788_ID"],52789:["Left_parietal_bone_52789_ID"],52803:["Right_greater_palatine_nerve_52803_ID"],52804:["Left_greater_palatine_nerve_52804_ID"],52806:["Right_lesser_palatine_nerve_52806_ID"],52807:["Left_lesser_palatine_nerve_52807_ID"],52824:["Left_posterior_inferior_nasal_nerve_52824_ID"],52825:["Right_posterior_inferior_nasal_nerve_52825_ID"],52892:["Right_zygomatic_bone_52892_ID"],52893:["Left_zygomatic_bone_52893_ID"],52974:["Zygomaticotemporal_branch_of_right_zygomatic_nerve_52974_ID"],52975:["Zygomaticotemporal_branch_of_left_zygomatic_nerve_52975_ID"],52976:["Zygomaticofacial_branch_of_right_zygomatic_nerve_52976_ID"],52977:["Zygomaticotemporal_branch_of_right_zygomatic_nerve_52977_ID","Zygomaticofacial_branch_of_left_zygomatic_nerve_52977_ID"],52978:["Zygomaticotemporal_branch_of_left_zygomatic_nerve_52978_ID"],52979:["Right_infraorbital_nerve_52979_ID"],52980:["Left_infra_orbital_nerve_52980_ID","Left_infraorbital_nerve_52980_ID"],52997:["Right_Mandibular_Nerve_52997_ID"],52998:["Left_Mandibular_Nerve_52998_ID"],53001:["Right_auriculotemporal_nerve_53001_ID"],53002:["Left_auriculotemporal_nerve_53002_ID"],53069:["Right_pterygopalatine_ganglion_53069_ID"],53070:["Left_pterygopalatine_ganglion_53070_ID"],53121:["Right_zygomatic_bone_53121_ID"],53122:["Left_zygomatic_bone_53122_ID"],53185:["Buccal_branch_of_right_facial_nerve_53185_ID","Buccal_branch_of_Right_Facial_Nerve_53185_ID"],53186:["Buccal_branch_of_Left_Facial_Nerve_53186_ID"],53219:["Right_lingual_nerve_53219_ID"],53220:["Left_lingual_nerve_53220_ID"],53244:["Right_Inferior_Alveolar_Nerve_53244_ID"],53245:["Left_Inferior_Alveolar_Nerve_53245_ID"],53251:["Right_mental_nerve_53251_ID","Left_mental_nerve_53251_ID"],53252:["Left_mental_nerve_53252_ID"],53279:["Right_posterior_auricular_nerve_53279_ID"],53280:["Left_posterior_auricular_nerve_53280_ID"],53290:["Temporal_branch_of_the_right_facial_nerve_53290_ID"],53291:["Temporal_branch_of_the_left_facial_nerve_53291_ID","Temporal_branch_of_the_right_facial_nerve_53291_ID"],53366:["Marginal_mandibular_branch_of_right_facial_nerve_53366_ID"],53367:["Marginal_mandibular_branch_of_left_facial_nerve_53367_ID"],53398:["Cervical_branch_of_right_facial_nerve_53398_ID"],53399:["Cervical_branch_of_left_facial_nerve_53399_ID"],53549:["Right_ciliary_ganglion_53549_ID"],53550:["Left_ciliary_ganglion_53550_ID"],53641:["Right_ear_53641_ID"],53642:["Left_ear_53642_ID"],53643:["Left_ear_53643_ID"],53645:["Right_Lacrimal_Bone_53645_ID"],53646:["Left_lacrimal_bone_53646_ID"],53654:["Palatine_bone_53654_ID"],54375:["Nasal_septum_54375_ID"],54449:["Right_eye_54449_ID"],54450:["Left_eye_54450_ID"],54640:["Tongue_54640_ID"],55099:["Thyroid_Cartilage_55099_ID"],55123:["Lower_part_of_cricopharyngeus_55123_ID"],55132:["Thyrohyoid_Membrane_55132_ID"],55143:["Right_ansa_cervicalis_nerve_55143_ID"],55144:["left_ansa_cervicalis_nerve_55144_ID"],55145:["Right_ansa_cervicalis_nerve_55145_ID"],55233:["Cricothyroid_ligament_55233_ID"],55560:["Right_Superior_Parathyroid_55560_ID"],55561:["Left_Superior_Parathyroid_55561_ID"],55562:["Right_Inferior_Parathyroid_55562_ID"],55563:["Left_Inferior_Parathyroid_55563_ID"],55610:["Right_procerus_55610_ID"],55611:["Left_procerus_55611_ID"],55612:["Transverse_part_of_right_nasalis_55612_ID"],55613:["Transverse_part_of_left_nasalis_55613_ID"],55614:["Alar_part_of_right_nasalis_55614_ID"],55615:["Alar_part_of_left_nasalis_55615_ID"],56103:["Right_Internal_acoustic_meatus_56103_ID"],56104:["Left_Internal_acoustic_meatus_56104_ID"],56427:["Right_tympanic_membrane_56427_ID"],56428:["Left_tympanic_membrane_56428_ID"],58236:["Right_Iris_58236_ID"],58237:["Left_Iris_58237_ID"],58242:["Right_Lens_58242_ID"],58243:["Left_Lens_58243_ID"],58271:["Right_Sclera_58271_ID"],58272:["Left_Sclera_58272_ID"],58299:["Right_Choroid_58299_ID"],58300:["Left_Choroid_58300_ID"],58302:["Right_Retina_58302_ID"],58303:["Left_Retina_58303_ID"],58841:["Right_Hyaloid_Canal_58841_ID"],58842:["Left_Hyaloid_Canal_58842_ID"],59102:["Right_lacrimal_gland_59102_ID"],59103:["Left_lacrimal_gland_59103_ID"],59505:["Right_major_alar_cartilage_59505_ID"],59506:["Left_major_alar_cartilage_59506_ID"],59512:["Right_lateral_nasal_cartilage_59512_ID"],59513:["Left_lateral_nasal_cartilage_59513_ID"],59545:["Right_lacrimal_sac_59545_ID"],59546:["Left_lacrimal_sac_59546_ID"],59797:["Left_Parotid_Gland_59797_ID","Right_Parotid_Gland_59797_ID"],59798:["Right_Parotid_Gland_59798_ID","Left_Parotid_Gland_59798_ID"],59802:["Right_Submandibular_Gland_59802_ID"],59803:["Left_Submandibular_Gland_59803_ID"],59804:["Right_Sublingual_Gland_59804_ID"],59805:["Left_Sublingual_Gland_59805_ID"],59866:["Right_Parotid_Duct_59866_ID"],59867:["Left_Parotid_Duct_59867_ID"],59964:["Right_Submandibular_Duct_59964_ID"],59965:["Left_Submandibular_Duct_59965_ID"],60180:["Right_osseous_labyrinth_60180_ID"],60181:["Left_osseous_labyrinth_60181_ID"],60188:["Right_Anterior_semicircular_canal_60188_ID"],60189:["Left_Anterior_semicircular_canal_60189_ID"],60191:["Right_Posterior_semicircular_canal_60191_ID"],60192:["Left_Posterior_semicircular_canal_60192_ID"],60194:["Right_Lateral_semicircular_canal_60194_ID"],60195:["Left_Lateral_semicircular_canal_60195_ID"],60202:["Right_Cochlea_60202_ID"],60203:["Left_Cochlea_60203_ID"],61020:["Right_Internal_Ear_61020_ID"],61021:["Left_Internal_Ear_61021_ID"],61735:["Right_external_acoustic_tube_61735_ID"],61736:["Left_external_acoustic_tube_61736_ID"],61965:["fornix_61965_ID"],62008:["hypothalamus_62008_ID"],62033:["Pineal_Gland_62033_ID"],62045:["optic_chiasm_62045_ID"],64919:["Right_Iliopsoas_64919_ID"],64920:["Left_Iliopsoas_64920_ID"],65015:["Left_Flexor_hallucis_longus_65015_ID","Right_Flexor_hallucis_longus_65015_ID"],65019:["Left_Tibialis_posterior_65019_ID","Right_Tibialis_posterior_65019_ID"],65281:["Right_long_thoracic_nerve_65281_ID"],65282:["Left_long_thoracic_nerve_65282_ID"],65536:["Right_lumbosacral_trunk_nerve_65536_ID"],65537:["Left_lumbosacral_trunk_nerve_65537_ID","Left_lumbosacral_trunk_65537_ID"],66321:["Right_thoracodorsal_artery_66321_ID"],66322:["right_thoracodorsal_artery_66322_ID","left_thoracodorsal_artery_66322_ID"],67584:["Left_nerve_of_pterygoid_canal_67584_ID","Right_nerve_of_pterygoid_canal_67584_ID"],67944:["cerebellum_67944_ID"],69316:["Right_Brachiocephalic_trunk_69316_ID"],69490:["Right_lateral_tarsal_artery_69490_ID"],69491:["Left_lateral_tarsal_artery_69491_ID"],69494:["Right_arcuate_artery_69494_ID"],69495:["Left_arcuate_artery_69495_ID"],69514:["Right_deep_plantar_artery_69514_ID"],69515:["Right_deep_plantar_artery_69515_ID"],69516:["Left_deep_plantar_artery_69516_ID"],69726:["Calcaneal_branch_of_right_posterior_tibial_artery_69726_ID"],69727:["Calcaneal_branch_of_left_posterior_tibial_artery_69727_ID"],70249:["Right_femoral_artery_70249_ID"],70250:["Left_femoral_artery_70250_ID"],70799:["Right_dorsal_metacarpal_arteries_70799_ID"],70800:["left_dorsal_metacarpal_arteries_70800_ID","right_dorsal_metacarpal_arteries_70800_ID"],70801:["left_dorsal_digital_arteries_70801_ID","right_dorsal_digital_arteries_70801_ID","Right_dorsal_digital_arteries_70801_ID","Right_palmar_metacarpal_arteries_70801_ID"],70802:["left_palmar_metacarpal_arteries_70802_ID","right_palmar_metacarpal_arteries_70802_ID","Right_common_palmar_digital_arteries_70802_ID"],70803:["right_common_palmar_digital_arteries_70803_ID","Right_proper_palmar_digital_arteries_70803_ID","left_common_palmar_digital_arteries_70803_ID"],70804:["left_proper_palmar_digital_arteries_70804_ID","right_proper_palmar_digital_arteries_70804_ID","left_common_palmar_digital_arteries_70804_ID"],70809:["Set_of_Jejunal_arteries_70809_ID"],70810:["Set_of_ileal_arteries_70810_ID"],70815:["Perforating_arteries_of_left_deep_fibular_artery_70815_ID","Perforating_arteries_of_right_deep_fibular_artery_70815_ID"],70889:["Left_lumbar_vein_70889_ID","Right_lumbar_vein_70889_ID"],70917:["Right_palmar_digital_veins_70917_ID"],70918:["right_palmar_digital_veins_70918_ID","left_palmar_digital_veins_70918_ID"],70922:["Right_distal_perforating_veins_70922_ID","Perforating_veins_of_right_deep_femoral_artery_70922_ID","Perforating_veins_of_left_deep_femoral_artery_70922_ID","Left_distal_perforating_veins_70922_ID"],70927:["Set_of_jejunal_veins_70927_ID"],70928:["Set_of_ileal_veins_70928_ID"],71132:["Gastrointestinal_Tract_71132_ID"],71211:["Right_lateral_thoracic_vein_71211_ID"],71212:["Left_lateral_thoracic_vein_71212_ID","Right_lateral_thoracic_vein_71212_ID"],71214:["Right_thoracodorsal_vein_71214_ID","Left_thoracodorsal_vein_71214_ID"],71215:["Right_thoracodorsal_vein_71215_ID"],71287:["Muscles_of_the_Head_and_Neck_71287_ID"],71291:["Muscles_of_the_Back_71291_ID"],71293:["Muscles_of_the_Thorax_71293_ID"],71310:["Left_Intertransversarii_71310_ID","Right_Intertransversarii_71310_ID"],71398:["Left_Radiate_Sternocostal_Ligaments_71398_ID","Right_Radiate_Sternocostal_Ligaments_71398_ID"],71894:["Right_carpal_bones_71894_ID","Left_carpal_bones_71894_ID"],71898:["Right_metacarpal_bones_of_hand_71898_ID","Left_metacarpal_bones_of_hand_71898_ID"],71900:["Phalanges_of_right_hand_71900_ID","Phalanges_of_left_hand_71900_ID"],72063:["Set_of_cervical_vertebrae_72063_ID"],72064:["Set_of_thoracic_vertebrae_72064_ID"],72065:["Set_of_lumbar_vertebrae_72065_ID"],72309:["Right_Stylohyoid_Ligament_72309_ID"],72311:["Left_Stylohyoid_Ligament_72311_ID"],72316:["Set_of_intervertebral_discs_72316_ID"],72826:["right_caudate_nucleus_72826_ID"],72827:["left_caudate_nucleus_72827_ID"],72828:["right_putamen_72828_ID"],72829:["left_putamen_72829_ID"],72832:["right_amygdaloid_body_72832_ID"],72833:["left_amygdaloid_body_72833_ID"],72856:["right_lateral_globus_pallidus_72856_ID"],72857:["left_lateral_globus_pallidus_72857_ID"],72858:["right_medial_globus_pallidus_72858_ID"],72859:["left_medial_globus_pallidus_72859_ID"],74048:["Right_stapes_74048_ID"],74049:["Left_stapes_74049_ID"],74050:["Right_Incus_74050_ID"],74051:["Left_Incus_74051_ID"],74052:["Right_malleus_74052_ID"],74053:["Left_malleus_74053_ID"],74073:["Right_Levatores_costarum_74073_ID"],74074:["Left_Levatores_costarum_74074_ID"],74075:["Right_Levatores_costarum_longi_74075_ID"],74076:["Left_Levatores_costarum_longi_74076_ID"],74079:["Right_Subcostales_74079_ID"],74080:["Left_Subcostales_74080_ID"],74525:["Occipital_74525_ID"],75150:["Teeth_75150_ID"],75398:["Superficial_dorsal_vein_of_penis_75398_ID"],75492:["Right_common_plantar_digital_nerves_75492_ID"],75493:["Left_common_plantar_digital_nerves_75493_ID"],76767:["Anterior_cardiac_vein_76767_ID"],76829:["Right_Zonula_Fibers_76829_ID","Left_Zonula_Fibers_76829_ID"],77161:["Intermediate_Hepatic_Vein_77161_ID"],77380:["Right_popliteal_artery_77380_ID"],77381:["Left_popliteal_artery_77381_ID"],77596:["Hypogastric_nerve_77596_ID"],77949:["Right_circumflex_scapular_vein_77949_ID"],77950:["Right_circumflex_scapular_vein_77950_ID","Left_circumflex_scapular_vein_77950_ID"],
  78023:["Right_lateral_brachial_vein_78023_ID"],78024:["right_lateral_brachial_vein_78024_ID","left_lateral_brachial_vein_78024_ID"],78209:["trunk_of_Hepatic_portal_vein_78209_ID"],78508:["Right_tarsal_bones_78508_ID"],78509:["Left_tarsal_bones_78509_ID"],78510:["Right_metatarsal_bones_78510_ID"],79468:["Right_accessory_meningeal_artery_79468_ID"],79469:["Left_accessory_meningeal_artery_79469_ID"],82695:["trunk_of_Hepatic_portal_vein_82695_ID"],82933:["Right_Nerve_to_levator_ani_82933_ID"],82934:["Left_Nerve_to_levator_ani_82934_ID"],85274:["External_Urethral_Sphincter_85274_ID"],86233:["Lymphatics_of_the_Upper_Limb_86233_ID"],86917:["Muscles_of_the_Abdomen_86917_ID"],87217:["Descending_aorta_thoracic_87217_ID","Descending_thoracic_aorta_87217_ID"],228738:["Muscles_of_the_Throat_228738_ID"],231317:["Phalanges_of_the_right_foot_231317_ID"],231319:["Phalanges_of_the_left_foot_231319_ID"],258714:["right_thalamus_258714_ID"],258716:["left_thalamus_258716_ID"],258847:["Right_Calcaneal_Tendon__aka_Achilles_Tendon_258847_ID"],258848:["Left_Calcaneal_Tendon__aka_Achilles_Tendon_258848_ID"],268668:["Right_interosseous_recurrent_artery_268668_ID"],268669:["right_interosseous_recurrent_artery_268669_ID","left_interosseous_recurrent_artery_268669_ID"]},function(){"use strict";var a=Human.clients={};a.numConnections=0,a.addClient=function(b){b({connected:function(){a.numConnections++,Human.events.fire("clients.connected",{})},disconnected:function(){a.numConnections--,Human.events.fire("clients.disconnected",{})}})}}(),function(){"use strict";function a(a){var b=g+":"+h+"/socket.io/socket.io.js";Human.log.info("[Socket] Loading Socket.IO library from "+b),require([b],function(b){a(b)})}function b(a){try{j.emit("sendreply",i,a)}catch(b){Human.log.error("Human.clients.webSocketClient#sendResponse","Error sending response: "+b)}}function c(a){var b=a.call;return"camera.pan"===b||"camera.orbit"===b||"camera.flyTo"===b||"camera.jumpTo"===b||"camera.zoom"===b||"camera.getZoom"===b||a.params&&a.params.connected?void d(a):void(0===k?d(a):(l.push(a),f||(f=setInterval(function(){l.length>0&&0===k&&d(l.shift()),0===l.length&&(clearInterval(f),f=null)},20))))}function d(a){try{Human.rpc.call(a.id,a.call,a.params)}catch(b){Human.log.error("Human.clients.webSocketClient","Error executing RPC call [callId: "+a.id+", procedure: "+a.call+"]: "+b)}}var e="true"===Human.request.getSearchParam("socketEnabled");if(!e)return void Human.log.info("Human.clients.webSocketClient","WebSocket enabled: NO - socketEnabled=true was not found on URL.");Human.log.info("Human.clients.webSocketClient","WebSocket enabled: YES - socketEnabled=true was found on URL.");var f,g=Human.request.getSearchParam("socketURL")||"https://api.biodigitalhuman.com",h=Human.request.getSearchParam("socketPort")||443,i=Human.request.getSearchParam("socketChannel")||"human",j=null,k=0,l=[],m=!1,n=null,o=!1;Human.events.on("error",function(a){m&&b({error:a}),n=a}),Human.events.on("started",function(){m&&b({message:"ready"}),o=!0}),Human.events.on("loaded",function(){Human.clients.numConnections++,Human.events.fire("clients.connected",{}),Human.log.info("Human.clients.webSocketClient","WebSocket server enabled."),Human.log.info("Human.clients.webSocketClient","Loading Socket.IO Library..."),a(function(a){Human.log.info("Human.clients.webSocketClient","Socket.IO library loaded."),Human.rpc.onResult(function(a,c){var d={};d[a]=c,b({results:d})});try{j=a.connect(g+":"+h);var d=!1;j.on("connect",function(){d||(d=!0,Human.log.info("Human.clients.webSocketClient","Connected."),Human.log.info("Human.clients.webSocketClient","Subscribing"),j.emit("subscribe",i))}),j.on("status",function(a){Human.log.info("[client "+g+"] received status:"+a)}),j.on("message",function(a){Human.log.info("Human.clients.webSocketClient",JSON.stringify(a)),"connect"===a.action?(Human.log.info("Human.clients.webSocketClient","Client connected"),j.emit("sendreply",i,{message:"connected"}),n?j.emit("sendreply",i,{message:"error",error:n}):o&&j.emit("sendreply",i,{message:"ready"})):a.call&&c(a)})}catch(e){Human.log.error("Human.clients.webSocketClient#start","Error initializing socket: "+e)}})})}(),Human.clients.addClient(function(a){"use strict";function b(a){var b=JSON.stringify(a);return f?void f.postMessage(b,g):void i.push(b)}function c(){for(;i.length>0;)f.postMessage(i.pop(),g)}function d(a){var b=a.call;return"camera.pan"===b||"camera.orbit"===b||"camera.flyTo"===b||"camera.jumpTo"===b||"camera.zoom"===b||a.params&&a.params.connected?void e(a):void(0===k?e(a):(j.push(a),h||(h=setInterval(function(){j.length>0&&0===k&&e(j.shift()),0===j.length&&clearInterval(h)},20))))}function e(a){if(Human.rpc.windowClientEnabled)try{Human.rpc.call(a.id,a.call,a.params),Human.rpc.log(a.call)}catch(b){Human.log.error("Human.clients.windowClient","Error executing RPC call [callId: "+a.id+", procedure: "+a.call+"]: "+b)}}var f,g,h,i=[],j=[],k=0;Human.events.on("started",function(){b({message:"status",status:"ready"})}),window.addEventListener?(Human.events.on("error",function(a){b({error:a})}),Human.rpc.onResult(function(a,c){var d={};d[a]=Human.rpc.filterUnsafeProperties(c),b({results:d})}),addEventListener("message",function(e){var h;try{h=JSON.parse(e.data)}catch(i){return void Human.log.error("Human.clients.windowClient","JSON parse failed on an incoming Web message: "+i.message||i)}"connect"===h.action?f||(Human.log.info("Human.clients.windowClient","Client connected"),a.connected(),f=e.source,g=e.origin,b({message:"connected"}),c()):h.call&&d(h)},!1)):Human.log.error("Human.clients.windowClient","Browser does not support cross-window messaging")}),function(){"use strict";var a=Human.cookies={};a.setCookie=function(a,b,c){var d;if(c){var e=new Date;e.setTime(e.getTime()+24*c*60*60*1e3),d="; expires="+e.toGMTString()}else d="";document.cookie=a+"="+b+d+"; path=/"},a.getCookie=function(a){for(var b=a+"=",c=document.cookie.split(";"),d=0;d<c.length;d++){for(var e=c[d];" "===e.charAt(0);)e=e.substring(1,e.length);if(0===e.indexOf(b))return e.substring(b.length,e.length)}return null},a.eraseCookie=function(b){a.setCookie(b,"",-1)}}(),function(){"use strict";var a=Human.init={},b=[],c=!1;a.bookmark={},a.cameraBookmark={};var d=Human.request.getHashParams(),e=location.origin+location.pathname.substring(0,location.pathname.lastIndexOf("/"))+"/lib/scenejs/plugins",f="true"===d.validateShaders,g="false"!==d.enableVAO,h="false"!==d.enableInterleaving;SceneJS.setConfigs({texturing:{waitForLoad:!0},pluginPath:e,statusPopups:!1,validateShaders:f,enableVAO:g,enableInterleaving:h}),require.config({waitSeconds:30}),a.saveReset=function(){var b=Human.bookmarks.capture(),c=b.modules;if(c){var d=c.active;d&&d.length>1&&(c.active=[c.active[0]])}a.bookmark=b,Human.timeline.activeRoot&&(a.bookmark.camera=Human.timeline.activeRoot._chapters[0].camera.location),a.bookmarkCamera=a.bookmark.camera},a.require=function(a,d){return c?(Human.log.error("Human.init.require","Engine already started, ignoring script: "+a),this):(b.push({path:a,params:d||{}}),this)},a.step=function(a){return c?(a(),this):(b.push({callback:a}),this)},a.reset=function(b){return a.bookmark?(Human.view.lights.restoreDefaults(),void Human.bookmarks.restore(a.bookmark,function(){Human.events.fire("init.reset"),b&&b()},function(a){Human.log.error("Human.init.reset","Reset failed: "+a),b&&b()})):(Human.log.error("Human.init.reset","Bookmark for reset was not captured"),void(b&&b()))},a.resetCamera=function(b){var c=Human.timeline.getCurrentChapterCamera();if(c)return void Human.view.camera.fly.flyTo(c,b);var d,e,f=0,g=Human.modules.activeModules;for(var h in g)g.hasOwnProperty(h)&&(e=g[h],e.camera&&e.timeActivated>f&&(d=e));return d?void Human.view.camera.fly.flyTo(d.camera,b):a.bookmark?void Human.view.camera.fly.flyTo(a.bookmark.camera,b):(Human.log.error("Human.init.resetCamera","Bookmark for reset was not captured"),void(b&&b()))},a.reload=function(){window.location.reload()},a.start=function(d,e){function f(){function d(){function d(){--g>0||(c=!0,a.saveReset(),Human.events.fire("started"),e&&e())}if(!(--j>0)){var f=[];b.forEach(function(a){a.callback&&f.push(a.callback)});var g=f.length;return 0===g?void d():void f.forEach(function(a){a(d)})}}if(g&&h){var f=[],i=[];b.forEach(function(a){a.path&&(f.push(a.path),i.push(a.params))});var j=f.length;require(f,function(){var a=Array.prototype.slice.call(arguments);return 0===j?void d():void a.forEach(function(a,b){var c=f[b],e=i[b];Human.log.info("Human.init","Loading init script: "+c),a(e,d)})})}}var g=!1,h=!1;require([d],function(a){a(),g=!0,f()}),Human.assets.server.init(),Human.renderer.init(function(){Human.events.fire("loaded"),h=!0,f()})}}(),function(){"use strict";function a(){c.setHighlightColor(e[0],e[1],e[2]),c.setFogEnabled(f),c.setFogMode(g),c.setFogStart(i),c.setFogEnd(j),c.setFogMin(k),c.setFogMax(l),c.setFogDensity(h),c.setFogColor(m[0],m[1],m[2]),d=!1}var b=Human.renderer={};b.NULL_OBJECT_ID="null-object";var c,d=!1,e=new Float32Array([1.5,1.5,.5]),f=!1,g=SceneJS.DISPLAY_FLAGS.FOG_LINEAR,h=.01,i=0,j=1e3,k=0,l=1,m=new Float32Array([1,1,1]);Human.properties.subscribe({propId:"highlight.color",value:e,callback:function(a){e=a,d=!0}}),Human.properties.subscribe({propId:"fog.enabled",value:f,callback:function(a){f=a,d=!0}}),Human.properties.subscribe({propId:"fog.mode",value:g,callback:function(a){g=a,d=!0}}),Human.properties.subscribe({propId:"fog.start",value:i,callback:function(a){i=a,d=!0}}),Human.properties.subscribe({propId:"fog.end",value:j,callback:function(a){j=a,d=!0}}),Human.properties.subscribe({propId:"fog.min",value:k,callback:function(a){k=a,d=!0}}),Human.properties.subscribe({propId:"fog.max",value:l,callback:function(a){l=a,d=!0}}),Human.properties.subscribe({propId:"fog.density",value:h,callback:function(a){h=a,d=!0}}),Human.properties.subscribe({propId:"fog.color",value:m,callback:function(a){m=a,d=!0}}),b.init=function(e){c=b.graph.init();var f=Date.now(),g=f,h=0;c.on("tick",function(){d&&a();var b=Date.now();Human.events.fire("tick",{timeStarted:f,timeLast:g,timeNow:b,tick:h}),g=b,h++}),c.on("sleep",function(){Human.events.fire("Scene.Sleep")}),e&&e()},b.setFPS=function(a){c.setFPS(a)},b.updateDisplayForBG=function(){d=!0},b.pushPause=function(){b._pauses=b._pauses?b._pauses+1:1,1===b._pauses&&c.pause(!0)},b.popPause=function(){b._pauses&&0===--b._pauses&&(c.pause(!1),c.renderFrame())},b.pauseCompilation=function(){c.pauseCompilation()},b.resumeCompilation=function(){c.resumeCompilation()},b.onTasksComplete=function(a){void 0!==b._pauses&&null!==b._pauses&&b._pauses>0&&Human.log.error("Human.renderer.onTaskComplete","Renderer deadlock: Human.renderer.pushPause has paused renderer. Renderer needs to be unpaused in order to complete pending tasks.");var c=Human.renderer.getScene().getStatus().numTasks;if(!c||0===c)return void a();if(b.__checkLoaded)throw"Human.renderer.onTasksComplete: already blocking";b.__checkLoaded=window.setInterval(function(){var c=Human.renderer.getScene().getStatus().numTasks;c&&0!==c||(window.clearInterval(b.__checkLoaded),b.__checkLoaded=null,a())},200)},b.compile=function(){c.compile()},b.forceRenderFrame=function(){c.renderFrame({force:!0})};var n=!1;b.enableRayPick=function(a){n=a},b.pick=function(a,b,d){return c?c.pick(a,b,{rayPick:d}):(Human.log.error("Human.renderer.pick","Engine not started, ignoring pick"),null)},b.getScene=function(){return SceneJS.scene(Human.SCENE_ROOT_ID)},b.getContentRootNode=function(){return b.getNode(Human.CONTENT_ROOT_ID)},b.getNode=function(a){return c.findNode(a)},b.getLookAt=function(){return b.getNode(Human.LOOKAT_ID)},b.nodeExists=function(a){var b=c.findNode(a);return null!==b&&void 0!==b},b.getViewMat=function(){return b.getNode(Human.LOOKAT_ID).getMatrix()},b.getProjMat=function(){return b.getNode(Human.CAMERA_ID).getMatrix()},b.checkWebGLExtension=function(a){return SceneJS.checkExtension(a)},b.setXrayBGColor=function(a){c.setXrayBGColor(a[0],a[1],a[2])},b.setXrayGlassFactor=function(a){c.setXrayGlassFactor(a)},b.setXrayMurkiness=function(a){c.setXrayMurkiness(a)}}(),function(){"use strict";var a,b,c=Human.CONTENT_ROOT_ID,d="assetLibraryRoot",e={xform:1,properties:2,texture:3,material:3,reflect:3,fresnel:3,billboard:3,morphGeometry:4,geometry:5},f=Human.renderer.graph={};f.rootNodes={library:null},f.SSAA_MULTIPLIER=function(){var a=parseInt(Human.request.getSearchParam("forceSSAA"),10);if(a>=1)return a;var b=document.createElement("canvas"),c=b.getContext("webgl",{antialias:!0})||b.getContext("experimental-webgl",{antialias:!0});return c&&c.getContextAttributes().antialias?1:2}();var g={type:"scene",id:Human.SCENE_ROOT_ID,canvasId:Human.CANVAS_ID,transparent:!0,contextAttr:{preserveDrawingBuffer:!1,antialias:!0},nodes:[{type:"library",id:"assetLibraryRoot"},{type:"camera",id:Human.CAMERA_ID,optics:{type:"perspective",fov:60,near:.01,far:400,fovAxis:"min"},pan:{x:0,y:0,z:0},nodes:[{type:"lookAt",eye:{x:0,y:0,z:.05},look:{x:0,y:0,z:0},up:{y:1},nodes:[{type:"lights",lights:[{mode:"dir",color:{r:1,g:1,b:1},dir:{x:0,y:0,z:-1},diffuse:!0,specular:!0,space:"view"}],nodes:[{type:"node",id:"annotation-labels"}]}]},{type:"lookAt",id:Human.LOOKAT_ID,eye:{x:0,y:0,z:55},look:{x:0,y:0,z:0},up:{y:1},nodes:[{type:"properties",id:Human.CLIP_INDICATORS_ATTACH_ID,properties:{picking:!1,layer:1e4}},{id:"clips",nodes:[{id:"occlusionIndicators"},{id:"lights",nodes:[{id:"lights.subtree",nodes:[{id:"effect",nodes:[{id:"effect.subtree",nodes:[{type:"material",id:Human.MATERIAL_ROOT_ID,emit:0,baseColor:{r:.9,g:.9,b:.9},specularColor:{r:.9,g:.9,b:.9},specular:.9,shine:100,nodes:[{type:"node",id:Human.renderer.NULL_OBJECT_ID,enableEvents:!0,nodes:[{type:"geometry",positions:[0,0,0,.1,.1,.1,.2,.2,.2],indices:[0,1,2],uv:[0,0,1,0,1,1],normals:[0,1,0,0,1,0,0,1,0],primitive:"triangles"}]},{type:"properties",id:c,properties:{picking:!0,enabled:!0,specular:!0,backfaceLighting:!0,backfaceTexturing:!0,backfaces:!0,reflection:!1}}]},{type:"properties",id:"object-boundary-flags",properties:{enabled:!1,transparent:!0,clipping:!1},nodes:[{type:"material",baseColor:{r:0,g:1,b:0},specularColor:{r:0,g:1,b:0},emit:1,alpha:.4,nodes:[{type:"style",lineWidth:1,nodes:[{type:"geometry",id:"object-boundary-geo",positions:[1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1],primitive:"lines",indices:[0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]}]}]}]}]}]}]}]}]}]}]}]};f.init=function(){var e=Human.request.getSearchParam("testContextLost");if(a=SceneJS.createScene(g,{resolutionScaling:f.SSAA_MULTIPLIER,simulateWebGLContextLost:!!e}),e){var h=parseInt(e);window.setInterval(function(){a.loseWebGLContext()},1e3*h)}return b=a.getNode(c),f.rootNodes.library=a.getNode(d),a},f.createSubtree=function(a,c){if(!b)throw"Not initialized - call #init first";var d;return d=a?a.addNode(c):b.addNode(c)},f.insertNode=function(a,b){b instanceof SceneJS.Node&&("library"===b.parent.type?b.disconnect():b={type:b.type,coreId:b.getCoreId()});for(var c=b.type,d=e[c],f=a;f;){var g=e[f.type]?e[f.type]:0;if(g>d){var h=f.parent;return f.disconnect(),b=h.addNode(b),b.addNode(f),b}if(0===f.nodes.length)return f.addNode(b);f=f.nodes[0]}},f.destroySubtree=function(a){var b=this.rootNodes;for(var c in b)if(b.hasOwnProperty(c)&&b[c].id===a.id)return void Human.log.warn("Human.renderer.graph.destroySubtree","Tried to destroy one of the built-in root nodes");a.destroy()}}(),function(){"use strict";var a=Human.renderer.bg={},b=null;a.getBGColor=function(){return b?[b[0],b[1],b[2]]:b},a.setBGColor=function(a){Array.isArray(a)&&(b=a)}}(),function(){"use strict";function a(){var a=b.parent(),d=a.width(),e=a.height(),f=Human.renderer.SSAA_MULTIPLIER;b.attr({width:d*f,height:e*f}),b.css({width:d,height:e}),c.attr({width:d,height:e}),Human.events.fire("canvas.resized",{canvasWidth:d,canvasHeight:e})}var b=$("#"+Human.CANVAS_ID),c=$("#"+Human.ANNOTATION_CANVAS_ID);Human.renderer.canvas={canvas:b,getCanvas:function(){return b},annotationCanvas:c,getAnnotationCanvas:function(){return c}},Human.renderer.resize=a,$(window).resize(a),a()}(),function(){"use strict";var a=Human.tasks={},b=8;Human.events.on("tick",function(){var c=Date.now();a._runScheduledTasks(c+b)}),a._taskQueue=[],a.scheduleTask=function(b,c){a._taskQueue.push(b),a._taskQueue.push(c)},a._runScheduledTasks=function(b){for(var c,d,e=Date.now(),f=a._taskQueue;f.length>0&&b>e;)c=f.shift(),d=f.shift(),d?c.call(d):c(),e=Date.now()}}(),function(){"use strict";var a=Human.view={},b=["Highlight","Xray","Isolate"];a.currentMode=b[0],a.setModeEnabled=function(a){if(a=a.toLowerCase(),"isolate"===a&&!Human.scene.anySelected())return void alert("Please select an object before Isolating.");var c=b.map(function(a){return a.toLowerCase()}),d=c.indexOf(a);d>=0&&c.forEach(function(a,b){var c=d===b;Human.view[a].setEnabled(c)})}}(),function(){"use strict";var a=Human.view.camera={},b=null,c=null,d=vec3.create(),e=vec3.create(),f=vec3.create(),g=vec3.create(),h=vec3.create(),i=vec3.create(),j=vec3.create(),k=vec3.create(),l=vec3.create(),m=mat4.create(),n=vec3.create();a.eye={x:0,y:0,z:-80},a.look={x:0,y:0,z:0},a.up={x:0,y:1,z:0},a._screenPan={x:0,y:0,z:0},a._startcamera={eye:{x:0,y:0,z:-80},look:{x:0,y:0,z:0},up:{x:0,y:1,z:0}};var o=!1,p=!1,q=!1;a.lock=!1,a.aspect=1,a.fovy=55,Human.properties.subscribe({propId:"camera.optics.fov",value:a.fovy,callback:function(b){a.fovy=b,p=!0}}),a.near=.1,Human.properties.subscribe({propId:"camera.optics.near",value:.1,callback:function(b){a.near=b,p=!0}}),a.far=5e3,Human.properties.subscribe({propId:"camera.optics.far",value:5e3,callback:function(b){a.far=b,p=!0}}),a.minZoom=.01,a.maxZoom=150,Human.properties.subscribe({propId:"camera.zoomLimits",value:{min:.01,max:150},callback:function(b){return b.min<.01?void Human.log.error("Human.view.camera","Property 'camera.zoomLimits.min' too small - should be >= 0.01"):b.min>=b.max?void Human.log.error("Human.view.camera","Property 'camera.zoomLimits.min' should be less than camera.zoomLimits.max"):(a.minZoom=b.min,a.maxZoom=b.max,void(o=!0))}});var r=!0;Human.events.on("loaded",function(){a._lookatNode=b=Human.renderer.getNode(Human.LOOKAT_ID),a._cameraNode=c=Human.renderer.getNode(Human.CAMERA_ID);var d=c.getOptics();a.aspect=d.aspect,a.fovy=d.fovy,o=!0,p=!0,q=!1}),Human.events.on("canvas.resized",function(b){a.setAspect(b.canvasWidth/b.canvasHeight)}),Human.events.on("tick",function(){o?(b.setEye(a.eye),b.setLook(a.look),b.setUp(a.up),Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),vec3.subtract(l,d,e),Human.events.fire("camera.updated",{eye:a.eye,look:a.look,up:a.up,dist:Math.abs(vec3.length(l))}),q=!1,o=!1):q||(q=!0,Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),vec3.subtract(l,d,e),Human.events.fire("camera.rested",{eye:a.eye,look:a.look,up:a.up,dist:Math.abs(vec3.length(l))})),p&&(c.setOptics({type:"perspective",fov:a.fovy,near:a.near,far:a.far,aspect:a.aspect,fovAxis:"min"}),c.setPan(a._screenPan),p=!1)}),a.setLookAt=function(b){var c=b.eye||a.eye,d=b.look||a.look,e=b.up||a.up;a.eye=c,a.look=d,a.up=e,b.updateOrbitOrigin&&a.setOrbitOrigin(d),o=!0},a.getLookAt=function(){return{eye:a.eye,look:a.look,up:a.up}},a.getEye=function(){return a.eye},a.getLook=function(){return a.look},a.getUp=function(){return a.up},a.setScreenPan=function(b){a._screenPan.x=b.x||0,a._screenPan.y=b.y||0,a._screenPan.z=b.z||0,p=!0},a.getScreenPan=function(){return a._screenPan},a._reset={eye:{x:a.eye.x,y:a.eye.y,z:a.eye.z},look:{x:a.look.x,y:a.look.y,z:a.look.z},up:{x:a.up.x,y:a.up.y,z:a.up.z}},a.reset=function(){a.yaw=0,a.pitch=90,a._eye={x:a._reset.eye.x,y:a._reset.eye.y,z:a._reset.eye.z},a._look={x:a._reset.look.x,y:a._reset.look.y,z:a._reset.look.z},a._up={x:a._reset.up.x,y:a._reset.up.y,z:a._reset.up.z},o=!0},a.rotateSceneY=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),Human.math.vec3ObjToArray(a.up,f),vec3.subtract(e,d,e),vec3.subtract(d,d,n),mat4.fromRotation(m,.0174532925*b,r?Human.math.Y_AXIS:f),vec3.transformMat4(d,d,m),vec3.transformMat4(e,e,m),vec3.add(d,n,d),vec3.subtract(e,d,e),r&&vec3.transformMat4(f,f,m),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]},look:{x:e[0],y:e[1],z:e[2]},up:{x:f[0],y:f[1],z:f[2]},updateOrbitOrigin:!1}))},a.rotateY=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),Human.math.vec3ObjToArray(a.up,f),vec3.subtract(d,d,e),mat4.fromRotation(m,.0174532925*b,r?Human.math.Y_AXIS:f),vec3.transformMat4(d,d,m),vec3.add(d,d,e),r&&vec3.transformMat4(f,f,m),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]},up:{x:f[0],y:f[1],z:f[2]}}))},a.rotateSceneX=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),Human.math.vec3ObjToArray(a.up,f),vec3.subtract(e,d,e),vec3.subtract(d,d,n),vec3.normalize(g,e),vec3.scale(g,g,-1),vec3.normalize(i,f),vec3.cross(j,g,i),mat4.fromRotation(m,.0174532925*b,j),vec3.transformMat4(d,d,m),vec3.transformMat4(e,e,m),vec3.adds(d,n,d),vec3.subtract(e,d,e),vec3.transformMat4(f,f,m),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]},look:{x:e[0],y:e[1],z:e[2]},up:{x:f[0],y:f[1],z:f[2]},updateOrbitOrigin:!1}))},a.rotateX=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),Human.math.vec3ObjToArray(a.up,f),vec3.subtract(d,d,e),vec3.normalize(g,d),vec3.normalize(i,f),vec3.cross(j,g,i),mat4.fromRotation(m,.0174532925*b,j),vec3.transformMat4(d,d,m),vec3.add(d,d,e),vec3.transformMat4(f,f,m),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]},up:{x:f[0],y:f[1],z:f[2]}}))},a.rotateLookY=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),Human.math.vec3ObjToArray(a.up,f),vec3.subtract(e,e,d),mat4.fromRotation(m,.0174532925*b,r?Human.math.Y_AXIS:f),vec3.transformMat4(e,e,m),vec3.add(e,e,d),a.setLookAt({look:{x:e[0],y:e[1],z:e[2]},up:{x:f[0],y:f[1],z:f[2]}}))},a.rotateLookX=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),Human.math.vec3ObjToArray(a.up,f),vec3.subtract(e,e,d),vec3.normalize(h,e),vec3.normalize(i,f),vec3.cross(j,h,i),mat4.fromRotation(m,.0174532925*b,j),vec3.transformMat4(e,e,m),vec3.add(e,e,d),vec3.transformMat4(f,f,m),a.setLookAt({look:{x:e[0],y:e[1],z:e[2]},up:{x:f[0],y:f[1],z:f[2]}}))},a.setOrbitOrigin=function(a){n[0]=a.x||0,n[1]=a.y||0,n[2]=a.z||0};var s=vec3.create();a.pan=function(b){if(!a.lock){if(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),Human.math.vec3ObjToArray(a.up,f),vec3.subtract(s,d,e),k[0]=k[1]=k[2]=0,void 0!==b.x&&null!==b.x){vec3.normalize(g,s),vec3.normalize(i,f);var c=vec3.cross(j,s,f);vec3.normalize(c,vec3.cross(j,s,f)),vec3.scale(l,c,b.x),k[0]+=l[0],k[1]+=l[1],k[2]+=l[2]}void 0!==b.y&&null!==b.y&&(vec3.normalize(i,f),vec3.scale(l,i,b.y),k[0]+=l[0],k[1]+=l[1],k[2]+=l[2]),void 0!==b.z&&null!==b.z&&(vec3.normalize(g,d),vec3.scale(l,g,b.z),k[0]+=l[0],k[1]+=l[1],k[2]+=l[2]),vec3.add(d,d,k),vec3.add(e,e,k),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]},look:{x:e[0],y:e[1],z:e[2]},updateOrbitOrigin:!1})}},a.setAspect=function(b){a.aspect=b,p=!0},a.viewRight=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:-c,y:d,z:0},up:{x:0,y:1,z:0}})}},a.viewLeft=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:c,y:d,z:0},up:{x:0,y:1,z:0}})}},a.viewPosterior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:d,z:-c},up:{x:0,y:1,z:0}})}},a.viewAnterior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:d,z:c},up:{x:0,y:1,z:0}})}},a.viewSuperior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:-c+d,z:0},up:{x:0,y:0,z:1}})}},a.viewInferior=function(){if(!a.lock){var b=Human.init.bookmark.camera.eye,c=b.z,d=b.y;a.setLookAt({look:{x:0,y:d,z:0},eye:{x:0,y:c+d,z:0},up:{x:0,y:0,z:-1}})}},a.zoom=function(b){if(!a.lock){Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),vec3.subtract(d,d,e);var c=Math.abs(vec3.length(d)),f=Math.abs(c+b);if(a.minZoom&&a.maxZoom){var h=c/a.maxZoom*.6;b=40*b*h,f=Math.abs(c+b),f<a.minZoom?f=a.minZoom:f>a.maxZoom&&(f=a.maxZoom)}vec3.normalize(g,d),vec3.scale(d,g,f),vec3.add(d,e,d),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]},updateOrbitOrigin:!1})}},a.setZoom=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),vec3.subtract(d,d,e),vec3.normalize(g,d),vec3.scale(d,g,a.minZoom+(1-b)*(a.maxZoom-a.minZoom)),vec3.add(d,e,d),a.setLookAt({eye:{x:d[0],y:d[1],z:d[2]}}))},a.getZoom=function(){Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),vec3.subtract(d,d,e);var b=Math.abs(vec3.length(d));return 1-(b-a.minZoom)/a.maxZoom},a.setZoomPercent=function(b){a.lock||(Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),vec3.subtract(d,d,e),vec3.normalize(g,d),vec3.scale(d,g,a.minZoom+.01*(100-b)*(a.maxZoom-a.minZoom)),a.setLookAt({eye:{x:e[0]+d[0],y:e[1]+d[1],z:e[2]+d[2]}}))},a.getZoomPercent=function(){Human.math.vec3ObjToArray(a.eye,d),Human.math.vec3ObjToArray(a.look,e),vec3.subtract(d,d,e);var b=Math.abs(vec3.length(d));return 100-(b-a.minZoom)/a.maxZoom*100}}(),function(){"use strict";Human.view.camera.CurvePath=function(){var a,b,c=[],d=0,e=vec3.create(),f=Human.math.bezier;this.init=function(g){c=[],d=0,a=g.length,b=a-1,2>a&&Human.log.error("curvePath init no enough points");var h=vec3.create(),i=vec3.create();vec3.subtract(e,g[0],g[1]),vec3.scale(e,e,.25),vec3.add(h,g[0],e),vec3.subtract(e,g[a-1],g[a-2]),vec3.scale(e,e,.25),vec3.add(i,g[a-1],e);var j,k,l,m,n,o,p,q=vec3.create(),r=vec3.create();for(j=1;a>j;++j)l=g[j-1],m=g[j],o=l,p=m,1>=j?vec3.subtract(e,l,h):(k=g[j-2],vec3.subtract(e,m,k),vec3.scale(e,e,.25)),vec3.add(q,o,e),j>=a-1?vec3.subtract(e,i,m):(n=g[j+1],vec3.subtract(e,n,l),vec3.scale(e,e,.25)),vec3.subtract(r,p,e),c.push(new f(o[0],o[1],o[2],q[0],q[1],q[2],r[0],r[1],r[2],p[0],p[1],p[2]));for(j=0;b>j;++j)d+=c[j].length()},this.getPosition=function(a){var b=this.getParameter(a);return{position:c[b.i].compute(b.t01),i:b.i,t01:b.t01}},this.getParameter=function(b){var c,d;return d=b*(a-1),d=Human.math.clamp(d,0,a-1),c=Math.floor(d),c>=a-1&&(c-=1),d-=c,{i:c,t01:d}},this.getPathLength=function(){return d}}}(),function(){"use strict";function a(a,b){Human.view.camera.lock=!0,b&&g.push(b),a=a||{},h=new Human.view.camera.fly.CurvePathAnimation({eyeCurvePath:a.eyeCurvePath,lookCurvePath:a.lookCurvePath,upVecs:a.upVecs,velocity:a.velocity,constrainUp:a.constrainUp,easeIn:a.easeIn,easeOut:a.easeOut,onComplete:c}),h.update(Date.now())}function b(a,b){Human.view.camera.lock=!0,b&&g.push(b),a=a||{},h=new Human.view.camera.fly.Animation({animationDuration:a.animationDuration,velocity:a.velocity,target:a.target,arc:a.arc,backOff:a.backOff,constrainUp:a.constrainUp,onComplete:c,cylindricalView:a.cylindricalView,easeIn:a.easeIn,easeOut:a.easeOut}),h.update(Date.now())}function c(){for(h=null;g.length>0;)g.pop()();Human.view.camera.lock=!1}function d(a){var b=a.backOff||0;0>b?b=0:b>1&&(b=1),b=1-b;var c=Human.math.vec3ObjToArray(Human.view.camera.look),d=Human.math.vec3ObjToArray(Human.view.camera.eye),e=vec3.create();vec3.subtract(e,d,c),vec3.normalize(e,e);var f=a.boundary,g=Human.math.getBoundaryCenter(f),h=a.stopFOV,i=vec3.length(e),j=Human.math.getBoundaryDiag(f),k=Math.abs(j/(1+.8*b)/Math.tan(h/2)),l=k/i;return vec3.scale(e,e,l),vec3.add(e,g,e),{target:{eye:{x:e[0],y:e[1],z:e[2]},look:{x:g[0],y:g[1],z:g[2]},up:{x:0,y:1,z:0}}}}var e=Human.view.camera.fly={};e.flyTimeScale=1,e.cylindricalView=!1,e.cylindricalOnly=!1,e.cylindricalRotationLerpMin=Math.PI/6,e.cylindricalRotationLerpMax=Math.PI/2,e.cylindricalRadiusLerpMin=.2,e.cylindricalRadiusLerpMax=1;var f=55,g=[],h=null,i=vec3.create(),j=vec3.create(),k=vec3.create(),l=vec3.create(),m=new Human.view.camera.CurvePath,n=new Human.view.camera.CurvePath;Human.events.on("tick",function(){h&&h.update(Date.now())}),e.cancelAnimation=function(){h&&(c(),h=null)},e.flyAlongCurvePath=function(b,c,d){c=c||function(){},d=d||function(a){Human.log.error("Human.view.camera.fly.flyAlongCurvePath",a),c()},b||(d("params must be defined"),c());var e,f,g=void 0!==b.velocity?b.velocity:1,h=[],i=[],j=[];for(e=0,f=b.points.length;f>e;++e)h.push(Human.math.vec3ObjToArray(b.points[e].eye||b.points[e].position)),i.push(Human.math.vec3ObjToArray(b.points[e].look||b.points[e].target)),j.push(Human.math.vec3ObjToArray(b.points[e].up));m.init(h),n.init(i),a({eyeCurvePath:m,lookCurvePath:n,upVecs:j,velocity:g,constrainUp:b.constrainUp,easeIn:b.easeIn,easeOut:b.easeOut},c)},e.flyTo=function(a,c,d){var e,f,g;if(c=c||function(){},d=d||function(a){Human.log.error("Human.view.camera.fly",a),c()},a.objectId){if(g=a.objectId,e=Human.scene.objects[g],!e)return void d("No scene object found for the given ID: '"+g+"'");f=Human.scene.getBoundary({objectId:g}),f?(Human.view.boundary.setBoundary(f,!0),b({target:{boundary:f},arc:a.arc,backOff:a.backOff,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},function(){Human.view.boundary.setBoundary(f,!1),c()})):c()}else if(a.fmaId){var h=a.fmaId;if(e=Human.scene.objectsByFMAID[h],!e)return void d("no object found for the given FMA ID: '"+h+"'");f=Human.scene.getBoundary({objectId:e.objectId}),f?(Human.view.boundary.setBoundary(f,!0),b({target:{boundary:f},arc:a.arc,backOff:a.backOff,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},function(){Human.view.boundary.setBoundary(f,!1),c()})):c()}else if(a.boundary)f=a.boundary,Human.view.boundary.setBoundary(f,!0),b({target:{boundary:f},arc:a.arc,backOff:a.backOff,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},function(){Human.view.boundary.setBoundary(f,!1),c()});else if(a.lookVec){var m=a.lookVec,n=Human.view.camera.eye,o=Human.view.camera.look;k[0]=m.x,k[1]=m.y,k[2]=m.z,i[0]=n.x,i[1]=n.y,i[2]=n.z,j[0]=o.x,j[1]=o.y,j[2]=o.z,vec3.subtract(l,j,i);var p=vec3.length(l);vec3.subtract(l,k,i);var q=vec3.length(l),r=p/q;Human.math.lerpVec3(r,0,1,j,k,j),b({target:{look:{x:j[0],y:j[1],z:j[2]}},arc:a.arc,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},c)}else if(a.eye||a.look)b({target:{eye:a.eye,look:a.look,up:a.up},arc:a.arc,backOff:a.backOff,animationDuration:a.animationDuration,velocity:a.velocity,constrainUp:!1,cylindricalView:a.cylindricalView,easeIn:a.easeIn,easeOut:a.easeOut},c);else if(a.selectedObjects)f=Human.scene.getBoundary({objects:Human.scene.selectedObjects}),Human.view.boundary.setBoundary(f,!0),b({target:{boundary:f},arc:a.arc,backOff:a.backOff,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},function(){Human.view.boundary.setBoundary(f,!1),c()});else if(a.selectedLeafObjects){var s=[],t=Human.scene.selectedObjects;for(g in t)t.hasOwnProperty(g)&&(e=t[g],0===e.objects.length&&s.push(g));f=Human.scene.getBoundary({objectIds:s}),Human.view.boundary.setBoundary(f,!0),b({target:{boundary:f},arc:a.arc,backOff:a.backOff,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},function(){Human.view.boundary.setBoundary(f,!1),c()})}else a.enabledObjects?(f=Human.scene.getBoundary({objects:Human.scene.enabledObjects}),b({target:{boundary:f},arc:a.arc,backOff:a.backOff,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},function(){Human.view.boundary.setBoundary(f,!1),c()})):a.objects?(f=Human.scene.getBoundary({objectIds:a.objects}),b({target:{boundary:f},arc:a.arc,backOff:a.backOff,animationDuration:a.animationDuration,velocity:a.velocity,
  cylindricalView:a.cylindricalView,easeIn:a.easeIn,easeOut:a.easeOut},function(){Human.view.boundary.setBoundary(f,!1),c()})):b({target:{eye:{x:0,y:6,z:-70},look:{x:0,y:0,z:0},up:{x:0,y:1,z:0}},arc:a.arc,backOff:a.backOff,cylindricalView:a.cylindricalView,animationDuration:a.animationDuration,velocity:a.velocity,easeIn:a.easeIn,easeOut:a.easeOut},function(){c()})},e.jumpTo=function(a,b,e){var g,h,i;b=b||function(){},e=e||function(a){Human.log.error("Human.view.camera.fly",a),b()};var j;if(a.objectId){if(i=a.objectId,g=Human.scene.objects[i],!g)return void e("No scene object found for the given ID: '"+i+"'");h=Human.scene.getBoundary({objectId:i}),h&&(j={target:{boundary:h},backOff:a.backOff})}else if(a.fmaId){var k=a.fmaId;if(g=Human.scene.objectsByFMAID[k],!g)return void e("no object found for the given FMA ID: '"+k+"'");h=Human.scene.getBoundary({objectId:g.objectId}),h&&(j={target:{boundary:h},backOff:a.backOff})}else if(a.boundary)j=d(a);else if(a.eye||a.look){if(!a.eye&&!a.look)return void e("incomplete parameter configuration: both 'eye' and 'look' expected");j={target:{eye:a.eye,look:a.look,up:a.up}}}else if(a.selectedObjects)h=Human.scene.getBoundary({objects:Human.scene.selectedObjects}),Human.view.boundary.setBoundary(h,!0),j={target:{boundary:h},backOff:a.backOff};else if(a.enabledObjects)h=Human.scene.getBoundary({objects:Human.scene.enabledObjects}),j={target:{boundary:h},backOff:a.backOff};else if(a.lookVec){var l=a.lookVec,m=Human.view.camera.eye,n=Human.view.camera.look,o=vec3.length(vec3.subtract(vec3.create(),[n.x,n.y,n.z],[m.x,m.y,m.z])),p=vec3.length(vec3.subtract(vec3.create(),[l.x,l.y,l.z],[m.x,m.y,m.z])),q=o/p,r=Human.math.lerpVec3(q,0,1,[n.x,n.y,n.z],[l.x,l.y,l.z]);j={target:{look:{x:r[0],y:r[1],z:r[2]}}}}else j={target:{eye:{x:0,y:6,z:-70},look:{x:0,y:0,z:0},up:{x:0,y:1,z:0}},backOff:a.backOff};j&&(c(),j.target.boundary?(j.target.stopFOV=f||j.target.stopFOV,Human.view.camera.fly.jumpTo(j.target)):Human.view.camera.setLookAt(j.target)),b()},e.cancel=c}(),function(){"use strict";function a(a,b){var c=Human.view.camera.fly,d=Human.math.clamp((a-c.cylindricalRotationLerpMin)/(c.cylindricalRotationLerpMax-c.cylindricalRotationLerpMin),0,1),e=Human.math.clamp((b-c.cylindricalRadiusLerpMin)/(c.cylindricalRadiusLerpMax-c.cylindricalRadiusLerpMin),0,1);return Math.min(d,e)}var b=1,c=55,d=vec3.create(),e=vec3.create(),f=vec3.create();Human.view.camera.fly.Animation=function(g){var h=g.target,i=void 0!==g.cylindricalView?g.cylindricalView:Human.view.camera.fly.cylindricalView;if(this.arc=i?void 0===g.arc?1:g.arc:0,this.easeIn=!!g.easeIn,this.easeOut=g.easeOut!==!1,this.constrainUp=void 0===g.constrainUp?!1:g.constrainUp,!h)return Human.log.error("Human.view.camera.fly.Animation config missing: target"),void(g.onComplete&&g.onComplete());var j=Human.view.camera;this._look1=Human.math.vec3ObjToArray(j.look),this._eye1=Human.math.vec3ObjToArray(j.eye),this._up1=Human.math.vec3ObjToArray(j.up),vec3.subtract(d,this._eye1,this._look1),this._vec=vec3.create(),vec3.normalize(this._vec,d);var k=g.backOff||0;if(0>k?k=0:k>1&&(k=1),k=1-k,h.boundary){var l=h.boundary,m=h.dist||2.5,n=Math.abs(vec3.length(this._vec)),o=Human.math.getBoundaryDiag(l),p=Math.abs(o/(1+.8*k)/Math.tan(c/2)),q=p/n*m;this._look2=Human.math.getBoundaryCenter(l),h.offset&&(this._look2[0]+=h.offset[0],this._look2[1]+=h.offset[1],this._look2[2]+=h.offset[2]);var r=Human.view.camera.fly.cylindricalOnly;if(i){this.arc=1,Human.math.cartesianToCylindrical(this._look1,e),Human.math.cartesianToCylindrical(this._look2,f);var s=Human.math.getShortRotation(e[1],f[1]),t=f[0],u=a(Math.abs(s),t);r?(f[0]=f[0]+q,this._eye2=Human.math.cylindricalToCartesian(f)):(f[0]=q,f[2]=0,this._eye2=Human.math.cylindricalToCartesian(f),vec3.scale(d,this._vec,q),Human.math.lerpVec3(u,0,1,d,this._eye2,d),vec3.normalize(d,d),vec3.scale(d,d,q),vec3.add(this._eye2,this._look2,d))}else vec3.scale(d,this._vec,q),this._eye2=vec3.add(vec3.create(),this._look2,d);this._up2=vec3.create(),this.constrainUp?(this._up2[0]=j.up.x,this._up2[1]=j.up.y,this._up2[2]=j.up.z):h.up?(this._up2[0]=h.up.x||0,this._up2[1]=h.up.y||0,this._up2[2]=h.up.z||0):this._up2[1]=1}else{var v=h.look,w=h.eye,x=h.up,y=Human.view.camera.eye,z=Human.view.camera.look,A=Human.view.camera.up;this._look2=vec3.create(),this._eye2=vec3.create(),this._up2=vec3.create(),v?(this._look2[0]=v.x||0,this._look2[1]=v.y||0,this._look2[2]=v.z||0):(this._look2[0]=z.x,this._look2[1]=z.y,this._look2[2]=z.z),w?(this._eye2[0]=w.x||0,this._eye2[1]=w.y||0,this._eye2[2]=w.z||0):(this._eye2[0]=y.x,this._eye2[1]=y.y,this._eye2[2]=y.z),x&&!this.constrainUp?(this._up2[0]=x.x||0,this._up2[1]=x.y||0,this._up2[2]=x.z||0):(this._up2[0]=A.x,this._up2[1]=A.y,this._up2[2]=A.z)}vec3.subtract(d,this._look2,this._look1);var B=Math.abs(vec3.length(d));vec3.subtract(d,this._eye2,this._eye1);var C=Math.abs(vec3.length(d));if(this.arc>0){Human.math.cartesianToCylindrical(this._eye1,e),Human.math.cartesianToCylindrical(this._eye2,f);var D=Human.math.getShortRotation(e[1],f[1]),E=(e[0]+f[0])*Math.abs(D),F=f[2]-e[1],G=Math.sqrt(E*E+F*F);C=(1-this.arc)*C+this.arc*G}this._dist=B>C?B:C,this._animationDuration=g.animationDuration?1e3*g.animationDuration:1e3*Human.view.camera.fly.flyTimeScale*(this._dist/(200*(g.velocity||b))+1),this._onComplete=g.onComplete};var g=vec3.create(),h=vec3.create();Human.view.camera.fly.Animation.prototype.update=function(a){if(void 0===this._time1&&(this._time1=a,this._time2=this._time1+this._animationDuration),this._done||a>this._time2)return this._done||Human.view.camera.setLookAt({look:Human.math.vec3ArrayToObj(this._look2),eye:Human.math.vec3ArrayToObj(this._eye2),up:Human.math.vec3ArrayToObj(this._up2)}),this._done=!0,void this._onComplete(this);var b,c=(a-this._time1)/this._animationDuration;if(b=this.easeIn&&this.easeOut?Human.math.easeInOut(c,0,1,1):this.easeIn?Human.math.easeIn(c,0,1,1):this.easeOut?Human.math.easeOut(c,0,1,1):c,Human.math.lerpVec3(b,0,1,this._look1,this._look2,h),this.arc>0?(Human.math.lerpVec3Cylindrical(b,0,1,e,f,d),Human.math.cylindricalToCartesian(d,g),this.arc<1&&(Human.math.lerpVec3(b,0,1,this._eye1,this._eye2,d),Human.math.lerpVec3(this.arc,0,1,d,g,g))):Human.math.lerpVec3(b,0,1,this._eye1,this._eye2,g),this.constrainUp)Human.view.camera.setLookAt({look:Human.math.vec3ArrayToObj(h),eye:Human.math.vec3ArrayToObj(g)});else{var i=Human.math.lerpVec3(b,0,1,this._up1,this._up2,[]);Human.view.camera.setLookAt({look:Human.math.vec3ArrayToObj(h),eye:Human.math.vec3ArrayToObj(g),up:Human.math.vec3ArrayToObj(i)})}},Human.view.camera.fly.Animation.prototype.stop=function(){}}(),function(){"use strict";var a=1,b=vec3.create();Human.properties.subscribe({propId:"camera.flyCurvePath",value:{velocity:1},callback:function(b){a=b.velocity||1}}),Human.view.camera.fly.CurvePathAnimation=function(b){this.easeIn=!!b.easeIn,this.easeOut=b.easeOut!==!1,this.constrainUp=void 0===b.constrainUp?!1:b.constrainUp,this._eyeCurvePath=b.eyeCurvePath,this._lookCurvePath=b.lookCurvePath,this._upVecs=b.upVecs;var c=Human.view.camera,d=1,e=this._lookCurvePath.getParameter(d),f=e.i;this._look2=Human.math.vec3ObjToArray(this._lookCurvePath.getPosition(d).position),this._eye2=Human.math.vec3ObjToArray(this._eyeCurvePath.getPosition(d).position),this._up2=this.constrainUp?Human.math.vec3ObjToArray(c.up):this._upVecs[f+1];var g=this._eyeCurvePath.getPathLength(),h=this._lookCurvePath.getPathLength();this._dist=Math.max(g,h),this._duration=1e3*Human.view.camera.fly.flyTimeScale*(this._dist/(200*(b.velocity||a))+1),this._onComplete=b.onComplete},Human.view.camera.fly.CurvePathAnimation.prototype.update=function(a){if(void 0===this._time1&&(this._time1=a,this._time2=this._time1+this._duration),this._done||a>this._time2)return this._done||Human.view.camera.setLookAt({look:Human.math.vec3ArrayToObj(this._look2),eye:Human.math.vec3ArrayToObj(this._eye2),up:Human.math.vec3ArrayToObj(this._up2)}),this._done=!0,void this._onComplete(this);var c,d=(a-this._time1)/this._duration;c=this.easeIn&&this.easeOut?Human.math.easeInOut(d,0,1,1):this.easeIn?Human.math.easeIn(d,0,1,1):this.easeOut?Human.math.easeOut(d,0,1,1):d;var e=this._lookCurvePath.getPosition(c).position,f=this._eyeCurvePath.getPosition(c).position;if(this.constrainUp)Human.view.camera.setLookAt({look:e,eye:f});else{var g=this._lookCurvePath.getParameter(c);Human.math.lerpVec3(g.t01,0,1,this._upVecs[g.i],this._upVecs[g.i+1],b),Human.view.camera.setLookAt({look:e,eye:f,up:Human.math.vec3ArrayToObj(b)})}}}(),function(){"use strict";var a,b,c=Human.view.boundary={},d=!1,e=!1;Human.events.on("loaded",function(){a=Human.renderer.getNode("object-boundary-flags"),b=Human.renderer.getNode("object-boundary-geo"),d=!0}),c.setBoundary=function(){if(d){if(0===arguments.length)return void c.reset();var a,b;1===arguments.length?"boolean"==typeof arguments[0]?(b=!!arguments[0],c._showBoundary(b)):(a=arguments[0],c._setBoundaryExtents(a)):(a=arguments[0],b=arguments[1],c._setBoundaryExtents(a),c._showBoundary(b))}},c._setBoundaryExtents=function(){var c=new Float32Array(24);return function(d){a.setEnabled(e);var f=d.xmin,g=d.ymin,h=d.zmin,i=d.xmax,j=d.ymax,k=d.zmax;c[0]=i,c[1]=j,c[2]=k,c[3]=i,c[4]=g,c[5]=k,c[6]=f,c[7]=g,c[8]=k,c[9]=f,c[10]=j,c[11]=k,c[12]=i,c[13]=j,c[14]=h,c[15]=i,c[16]=g,c[17]=h,c[18]=f,c[19]=g,c[20]=h,c[21]=f,c[22]=j,c[23]=h,b.setPositions(c)}}(),c._showBoundary=function(b){e!==b&&(a.setEnabled(b),e=b)},c.reset=function(){c._setBoundaryExtents({xmin:0,ymin:0,zmin:0,xmax:0,ymax:0,zmax:0}),c._showBoundary(!1)}}(),function(){"use strict";var a,b=Human.view.tooltips={},c=!0,d=null,e={};Human.events.on("loaded",function(){var c="#"+Human.CONTAINER_ID;$(c).append('<div id="objectToolTip" style="display: none;" class="objectTooltip">XXXX</div>'),a=$("#objectToolTip"),b._hide()}),Human.events.on("scene.objectDestroyed",function(c){a&&d&&c.objectId===d&&b._hide()}),Human.events.on("scene.objectsShown",function(c){a&&d&&c.enabledObjectsUpdate[d]===!1&&b._hide()}),Human.events.on("labels.updated",function(a){e=a.enabledLabels,d&&e[d]}),Human.events.on("camera.updated",function(){a&&d&&b._hide()}),b.setTooltip=function(c){var e=c.objectId;e&&a&&(d&&b._hide(),b._show(c))},b.clearTooltip=function(){a&&d&&b._hide()},b._show=function(f){if(c){var g;if(f.objectId){if(d=f.objectId,e[d])return void b._hide();var h=Human.scene.objects[f.objectId];g=h.displayName}g=f.title||g,a.css({left:f.canvasX+10,top:f.canvasY+0}),a.text(g),a.show()}},b._hide=function(){d&&a&&(a.hide(),d=null)},b.getEnabled=function(){return c},b.setEnabled=function(a){c!==a&&(a||b._hide(),c=a),Human.events.fire("tooltips.toggled",{enabled:c})}}(),function(){"use strict";var a=Human.view.labels={};a.enabled=!0;var b={},c=0;Human.events.on("loaded",function(){a.clearLabels()}),Human.events.on("scene.objectDestroyed",function(d){if(a.enabled&&c>0){var e=d.objectId;if(b[e]){a._destroyLabel(e);var f={};f[e]=!1,Human.events.fire("labels.updated",{enabledLabels:b})}}}),Human.events.on("scene.objectsSelected",function(d){if(a.enabled&&c>0){var e=d.selectedObjectsUpdate,f=Human.scene.objects;for(var g in e)e.hasOwnProperty(g)&&0===f[g].objects.length&&e[g]===!1&&b[g]&&a._destroyLabel(g);Human.events.fire("labels.updated",{enabledLabels:b})}}),Human.events.on("scene.objectsShown",function(d){if(a.enabled&&c>0){var e=d.enabledObjectsUpdate;for(var f in e)e.hasOwnProperty(f)&&e[f]===!1&&b[f]&&a._destroyLabel(f);Human.events.fire("labels.updated",{enabledLabels:b})}}),a._destroyLabel=function(a){var d=b[a];d&&(d.destroy(),delete b[a],c--)},a.createLabel=function(d){var e=d.objectId,f=Human.scene.objects[e];if(!f)return void Human.log.warn("Human.view.labels.createLabel","Scene object not found: '"+e+"'");if(d.replace&&a.clearLabels(),!f.displayName)return void Human.log.warn("Human.view.labels.createLabel","Scene object has no displayName: '"+e+"'");var g=d.offset||f.getCenter();b[e]=new Human.view.labels.Label({labelId:e,text:f.displayName,style:null,offset:g,nodeId:e,objectId:e,enabled:a.enabled,onHide:function(){a._destroyLabel(e)}}),Human.events.fire("labels.updated",{enabledLabels:b}),c++},a.clearLabels=function(){c>0&&(a._clearLabels(),Human.events.fire("labels.updated",{enabledLabels:b}))},a._clearLabels=function(){for(var d in b)b.hasOwnProperty(d)&&a._destroyLabel(d);c=0},a.setEnabled=function(b){a.enabled!==b&&(a.enabled=b,b||a._clearLabels(),Human.events.fire("labels.toggled",{enabled:b}))},a.getEnabled=function(){return a.enabled}}(),function(){"use strict";var a,b,c,d={};Human.events.on("loaded",function(){a=$("#container");var d=$(Human.renderer.canvas.getCanvas());b=d.width(),c=d.height()}),Human.events.on("loaded",function(){Human.renderer.getNode(Human.renderer.NULL_OBJECT_ID).onRendered=function(a){for(var b in d)d.hasOwnProperty(b)&&d[b]._onRender(a)}}),Human.events.on("canvas.resized",function(a){b=a.canvasWidth,c=a.canvasHeight}),Human.view.labels.Label=function(b){this.nodeId=b.nodeId,this.objectId=b.objectId,this.animationId=b.animationId,this.offset=b.offset,this.shown=b.shown,this.enabled=b.enabled,this._style=b.style||"labelStyleDefault",this.labelId=b.labelId?b.labelId:this.animationId?"a."+this.objectId:this.objectId?"o."+this.objectId:"n."+this.nodeId,this._labelElement=jQuery(['<div id="',this.labelId,'" class="label-container right hidden">','<div class="label-container-header ',this.style,'">',"<span>",b.text,"</span>",'<img src="img/shim.gif" alt="Close" class="icon-close icon-inverse" />','<div class="label-toggle-secondary icon-expand"></div>','<ul class="options"></ul>',"</div>","</div>"].join("")),a.append(this._labelElement),this._elementWidth=this._labelElement.width(),this._elementHeight=this._labelElement.height();var c=this;this._onRender=function(a){c.updatePos({canvasPos:a.getCanvasPos(c.offset),viewPos:a.getViewPos(c.offset)})},d[this.labelId]=this;var e=this._labelElement.find(".icon-close");e.click(function(){b.onHide()});var f=this._labelElement.find(".options"),g=this._labelElement.find(".label-toggle-secondary");f.hide(),g.hide();var h=Human.view.annotations.getAnnotations({objectId:this.objectId,type:"secondary"}),i=Object.keys(h).length>0;if(i){var j=0,k=function(a){o.text(a?"Hide Pins":"Show Pins")},l=function(a){a===!0?j++:j>0&&j--,k(0!==j)},m=!1,n=function(){if(m!==!0){j=0;for(var a in h)if(h.hasOwnProperty(a)){var b=h[a];b.label.on("shown",l),b.label.shown===!0&&j++}k(0!==j)}},o=$("<li />");o.click(function(){var a=0!==j,b={};b[c.objectId]=!a,Human.view.annotations.setLabelsShown({objects:b,type:"secondary",replace:!0})}),g.click(function(){m!==!0&&(n(),m=!0)}),f.append(o)}if(f.children().length>0){e.hide();var p=$("<li />");p.text("Hide Label"),p.click(function(){b.onHide()}),f.append(p),g.click(function(){f.is(":visible")?(f.hide(),g.attr("class","icon-expand")):(f.show(),g.attr("class","icon-collapse"))}),g.show()}},Human.view.labels.Label.prototype.updatePos=function(a){var d=a.canvasPos[0],e=a.canvasPos[1]+40,f=a.viewPos[2];return f>0?void(this.shown&&this.setShown(!1)):(d=Math.max(20,Math.min(d,b-this._elementWidth-10)),e=Math.max(10,Math.min(e,c-this._elementHeight-10)),this._labelElement.css({left:d,top:e}),void(this.shown||this.setShown(!0)))},Human.view.labels.Label.prototype.update=function(a){var b=a.canvasPos.x,c=a.canvasPos.y;0>=c?this.shown&&this.setShown(!1):(this._labelElement.css({left:b,top:c+40}),a.style&&(this._style&&this._labelElement.removeClass(this._style),this._labelElement.addClass(a.style),this._style=a.style),this.shown||this.setShown(!0))},Human.view.labels.Label.prototype.setShown=function(a){this.shown!==a&&(a&&this.enabled?this._labelElement.show():this._labelElement.hide(),this.shown=a)},Human.view.labels.Label.prototype.setEnabled=function(a){this.enabled!==a&&(this.shown&&a?this._labelElement.show():this._labelElement.hide(),this.enabled=a)},Human.view.labels.Label.prototype.destroy=function(){delete d[this.labelId],this.shown&&this.setShown(!1),this._labelElement&&(this._labelElement.remove(),this._labelElement=null)}}(),function(){"use strict";function a(a){var b,c;if(a)for(c in Human.scene.objects)Human.scene.objects.hasOwnProperty(c)&&(b=Human.scene.objects[c],b&&(Human.scene.selectedObjects.hasOwnProperty(c)?b.highlight||b.setHighlight(!0):b.highlight&&b.setHighlight(!1)));else for(c in Human.scene.objects)Human.scene.objects.hasOwnProperty(c)&&(b=Human.scene.objects[c],b.highlight&&b.setHighlight(!1))}var b=Human.view.highlight={};b.enabled=!0;var c=!1;Human.events.on("loaded",function(){b.setEnabled(!0)}),Human.events.on("scene.objectsSelected",function(){b.enabled&&(c=!0)}),Human.events.on("tick",function(){c&&(a(b.enabled),c=!1)}),b.setEnabled=function(a){b.enabled!==a&&(b.enabled=a,c=!0),Human.events.fire("highlight.toggled",{enabled:b.enabled}),b.enabled&&(Human.view.currentMode="Highlight")},b.getEnabled=function(){return b.enabled}}(),function(){"use strict";var a=Human.view.isolate={};a.enabled=!1;var b=!0;Human.events.on("loaded",function(){a.enabled=!1,b=!1}),Human.events.on("tick",function(){b&&(Human.scene.setShowSelectedObjects(a.enabled),b=!1)}),Human.events.on("scene.objectsSelected",function(){a.enabled&&(b=!0)}),a.setEnabled=function(c){a.enabled!==c&&(a.enabled=c,b=!0),Human.events.fire("isolate.toggled",{enabled:a.enabled}),a.enabled&&(Human.view.currentMode="Isolate",Human.view.pick.setSinglePickEnabled(!0),Human.view.pick.setMultiPickEnabled(!1))},a.getEnabled=function(){return a.enabled}}(),function(){"use strict";var a=Human.view.dissect={};a.enabled=!1;var b=[],c=[];Human.events.on("loaded",function(){a.enabled=!1}),a.setEnabled=function(b){a.enabled!==b&&(a.enabled=b,Human.events.fire("dissect.toggled",{enabled:a.enabled}))},a.getEnabled=function(){return a.enabled},a.dissect=function(d){if(a.enabled){c.length=0,b.push(d);var e={};e[d]=!1,Human.scene.setEnabledObjects({objectIds:e})}},a.undo=function(){if(!a.enabled,b.length){var d=b.pop(),e={};e[d]=!0,Human.scene.setEnabledObjects({objectIds:e}),c.unshift(d)}},a.redo=function(){if(a.enabled){var d,e;c.length&&(d=c.shift(),e={},e[d]=!1,Human.scene.setEnabledObjects({objects:e}),b.push(d))}},a.reset=function(){c.length=0,b.length=0}}(),function(){"use strict";function a(a){if(a.object){var b=a.object,c=e.objectAnnotations[b.objectId];c||(c=e.objectAnnotations[b.objectId]={annotations:{},numAnnotations:0}),c.annotations[a.annotationId]=a,c.numAnnotations++}}function b(a){if(a.object){var b=a.object,c=e.objectAnnotations[b.objectId];if(c){var d=c.annotations[a.annotationId];d&&(delete c.annotations[a.annotationId],0===--c.numAnnotations&&delete e.objectAnnotations[b.objectId])}}}function c(a,b){Human.events.fire(a,{annotationId:b.id||b.annotationId,type:b.type,styleId:b.styleId,objectId:b.object?b.object.objectId:null,title:b.label.title,description:b.label.description,pos:b.pin.pos,pinVec:b.pin.dir})}function d(a,b,c,d,e,f){i.fillStyle=d,i.lineWidth=f,i.strokeStyle=e,i.beginPath(),i.arc(a,b,c,0,2*Math.PI),d&&i.fill(),e&&i.stroke()}var e=Human.view.annotations={},f="__a",g=new Human.utils.IDPool({prefix:f});e.enabled=!1,e.shown=!0,e.annotations={},e.objectAnnotations={},e.unsavedAnnotation=null,e.setEnabled=function(a){e.enabled!==a&&(e.enabled=a,Human.events.fire("annotations.toggled",{enabled:a}))},e.createAnnotation=function(d){function h(a,b){a.setHighlight(b);for(var c=0,d=a.objects.length;d>c;c++)h(a.objects[c],b)}var i;if(d.objectId&&(i=Human.scene.objects[d.objectId],i||Human.log.warn("Human.view.annotations.createAnnotation","Scene object not found: '"+d.objectId+"'")),e.unsavedAnnotation&&(d.title=e.unsavedAnnotation.label.$titleField.val(),d.description=e.unsavedAnnotation.label.$descriptionField.val(),d.objectId=e.unsavedAnnotation.object?e.unsavedAnnotation.object.objectId:null,e.unsavedAnnotation.destroy(),e.unsavedAnnotation=null),d.annotationId){if(d.annotationId.toString().slice(0,f.length)===f)d.annotationId=g.getId();else if(e.annotations[d.annotationId])return Human.log.error("Human.view.annotations.createAnnotation","Annotation with this ID already exists: '"+d.annotationId+"'"),null}else d.annotationId=g.getId();var j=new Human.view.annotations.Annotation(i,d);return e.annotations[d.annotationId]=j,a(j),e.unsavedAnnotation=d.saved?null:j,j.setAnnotationsShown(e.shown),j.on("picked",function(){Human.events.fire("annotations.picked",{annotationId:j.annotationId})}),j.label.on("mouseClick",function(){Human.events.fire("annotations.mouseClick",{annotationId:j.annotationId})}),j.label.on("mouseEnter",function(a){j.object&&h(j.object,!0),Human.events.fire("annotations.mouseEnter",a)}),j.label.on("mouseLeave",function(a){j.object&&h(j.object,!1),Human.events.fire("annotations.mouseLeave",a)}),j.label.on("mouseDown",function(a){Human.events.fire("annotations.mouseDown",a)}),j.label.on("mouseUp",function(a){Human.events.fire("annotations.mouseUp",a)}),j.on("saved",function(){e.unsavedAnnotation&&e.unsavedAnnotation.annotationId===j.annotationId?c("annotations.created",j):c("annotations.updated",j),e.unsavedAnnotation=null}),j.on("destroyed",function(){j.object&&h(j.object,!1),e.unsavedAnnotation=null,delete e.annotations[j.annotationId],b(j),Human.events.fire("annotations.destroyed",{annotationId:j.annotationId})}),d.saved?(c("annotations.created",j),e.unsavedAnnotation=null):Human.events.fire("annotations.creating",{annotationId:j.annotationId}),j},e.updateDimensions=function(){for(var a in e.annotations)e.annotations.hasOwnProperty(a)&&e.annotations[a].label.updateWidth()},e.setShown=function(a){if(e.shown!==a){for(var b in e.annotations)e.annotations.hasOwnProperty(b)&&e.annotations[b].setAnnotationsShown(a);e.shown=a,Human.events.fire("annotations.shown",{shown:a})}},e.showByObjectId=function(a,b){var c=e.objectAnnotations[a];if(c){var d=c.annotations;for(var f in d)d.hasOwnProperty(f)&&d[f].setShown(b)}},e.destroyByObjectId=function(a){var b=e.objectAnnotations[a];if(b){var c=b.annotations;for(var d in c)c.hasOwnProperty(d)&&c[d].destroy()}},e.clearAnnotations=function(a){a=a||{};var b=!!a.keepModuleAnnotations;e.unsavedAnnotation=null;var c;for(var d in e.annotations)e.annotations.hasOwnProperty(d)&&(c=e.annotations[d],b&&c.moduleId||c.destroy())},e.getAnnotations=function(a){var b={},c=e.annotations;a.objectId&&(c=e.objectAnnotations.hasOwnProperty(a.objectId)?e.objectAnnotations[a.objectId].annotations:{});var d=a.type;for(var f in c)if(c.hasOwnProperty(f)){var g=c[f];d&&d!==g.type||(b[f]=g)}return b},e.setLabelsShown=function(a){var b,c,d,f,g={},h=a.type;if(a.annotations){c=a.annotations;for(d in c)c.hasOwnProperty(d)&&(b=e.annotations[d],b&&(h&&h!==b.type||(g[d]=c[d])))}else if(a.objects){c=a.objects;for(var i in c)if(c.hasOwnProperty(i)){var j=Human.scene.objects[i];if(j){var k=e.objectAnnotations[i];if(k){f=c[i];for(d in k.annotations)k.annotations.hasOwnProperty(d)&&(b=k.annotations[d],h&&h!==b.type||(g[d]=f))}}}}else if(a.type){f=a.shown!==!1;for(d in e.annotations)e.annotations.hasOwnProperty(d)&&(b=e.annotations[d],b&&(h&&h!==b.type||(g[d]=f)))}if(a.replace)for(d in e.annotations)e.annotations.hasOwnProperty(d)&&(g[d]||(b=e.annotations[d],h&&h!==b.type||(b.pin.setShown(!1),b.label.setShown(!1))));for(d in g)if(g.hasOwnProperty(d)){var l=g[d];b=e.annotations[d],b.pin.setShown(l),b.label.setShown(l)}},e.updateAnnotation=function(a,b){var d=e.annotations[a];if(d){var f=d.label;b.title&&b.title!==f.title&&f.setTitle(b.title),b.description&&b.description!==f.description&&f.setDescription(b.description),c("annotations.updated",d)}};var h,i,j,k,l,m;Human.events.on("loaded",function(){h=Human.renderer.canvas.annotationCanvas[0],i=h.getContext("2d")});var n={outerPin:{radius:4.25,fillStyle:"rgb(255,255,255)",lineWidth:1,strokeStyle:"rgb(204,204,204)"},innerPin:{radius:1.75,fillStyle:"rgb(153,0,0)"},wire:{lineWidth:1,strokeStyle:"rgb(204,204,204)"}};e.setCanvasStyles=function(a){for(var b in n)n.hasOwnProperty(b)&&a.hasOwnProperty(b)&&Human.utils.apply(a[b],n[b])},e.drawWire=function(a,b,c,f){if(i){void 0!==j&&i.clearRect(j,k,l,m),e.clearWire(),a!==c&&b!==f&&(i.beginPath(),i.moveTo(a,b),i.lineTo(c,f),i.lineWidth=n.wire.lineWidth,i.strokeStyle=n.wire.strokeStyle,i.stroke(),j=a,k=b,l=c,m=f);var g=n.outerPin;d(a,b,g.radius,g.fillStyle,g.strokeStyle,g.lineWidth);var h=n.innerPin;d(a,b,h.radius,h.fillStyle,h.strokeStyle,h.lineWidth)}},e.clearWire=function(){i.clearRect(0,0,h.width,h.height)}}(),function(){"use strict";Human.view.annotations.Annotation=function(a,b){var c=this;this._init(),this.moduleId=b.moduleId,this.type=b.type||"default",this.annotationId=b.annotationId,this.annotationsShown=Human.view.annotations.shown,this.draggable=!!b.labelOffset,this.occludable=b.occludable!==!1&&!!b.pos,this.followsObject=b.followsObject!==!1&&!!a,b.offset=b.labelOffset,this.label=new Human.view.annotations.Label(this,b),this.wire=$('<div class="annotationWire"></div>').appendTo("#container"),this.pin=new Human.view.annotations.Pin(this,b.annotationId,b),this.saved=void 0!==b.saved&&null!==b.saved?b.saved:!1,this.pin.on("picked",function(){return c.label.saved?(c.label.setShown(!c.label.shown),void c.publish("picked",!0,!0)):void alert("Please save or cancel annotation before hiding label")}),this.label.on("saved",function(){c.publish("saved",c.saved=!0)}),this.label.on("delete",function(){c.destroy()});var d=function(a){a?c.wire.show():c.wire.hide()};if(this.pin.on("enabled",function(a){d(c.annotationsShown&&a&&!c.label.culled&&c.label.shown&&c.pin.shown)}),this.label.on("shown",function(a){d(c.annotationsShown&&c.pin.enabled&&!c.label.culled&&a&&c.pin.shown)}),this.label.on("culled",function(a){d(c.annotationsShown&&c.pin.enabled&&!a&&c.label.shown&&c.pin.shown)}),this.label.on("annotationsShown",function(){d(c.annotationsShown&&c.pin.enabled&&!c.label.culled&&c.label.shown&&c.pin.shown)}),this.pin.on("occluded",function(a){a&&c.wire.css("opacity","0")}),this.object=null,a&&(this.setObject(a),b.pos||this.pin.setPos(a.getCenter())),b.on){var e=b.on;e.mouseClick&&this.label.on("mouseClick",function(){Human.rpc.call(null,e.mouseClick.call,e.mouseClick)})}},Human.utils.extend(Human.view.annotations.Annotation,Human.Component),Human.view.annotations.Annotation.prototype.setObject=function(a){this.publish("object",this.object=a)},Human.view.annotations.Annotation.prototype.setAnnotationsShown=function(a){this.annotationsShown=a,this.pin.setAnnotationsShown(a),this.label.setAnnotationsShown(a)},Human.view.annotations.Annotation.prototype.setShown=function(a){this.pin.setShown(a),this.label.setShown(a)},Human.view.annotations.Annotation.prototype.destroy=function(){this.pin.destroy(),this.label.destroy(),this.wire.remove(),this.publish("destroyed",!0)}}(),function(){"use strict";Human.view.annotations.Pin=function(a,b,c){var d=$("#container");this._init(),this._id=b,this.annotation=a,this.annotationsShown=Human.view.annotations.shown,this.enabled=c.enabled!==!1,this.shown=c.shown!==!1,this.culled=!1,this.pos=vec3.create(),c.pos&&(this.pos[0]=c.pos[0],this.pos[1]=c.pos[1],this.pos[2]=c.pos[2]),this.primitiveIndex=c.primitiveIndex,this.barycentric=vec3.create(),c.barycentric?(this.barycentric[0]=c.barycentric[0],this.barycentric[1]=c.barycentric[1],this.barycentric[2]=c.barycentric[2]):this.barycentric[0]=this.barycentric[1]=this.barycentric[2]=1/3,this.viewPos=vec4.create(),this.occluded=!1,this.dir=c.dir||[0,0,-1],this._element=$('<div class="annotationPin"></div>'),this.setPos(c.pos||[0,0,0]),this.setDir(c.dir||[0,0,0]),this.setAnnotationsShown(Human.view.annotations.shown),this.setEnabled(void 0!==c.enabled&&null!==c.enabled?c.enabled:!0),this.setShown(void 0!==c.shown&&null!==c.shown?c.shown:!0),this.setCulled(!!c.culled),this.setOpacity(1),d.append(this._element),this._element.click(this.pick.bind(this))},Human.utils.extend(Human.view.annotations.Pin,Human.Component),Human.view.annotations.Pin.prototype.setAnnotationsShown=function(a){this._showElement(a&&this.enabled&&this.shown&&!this.culled&&!this.occluded),this.publish("enabled",this.annotationsShown=a)},Human.view.annotations.Pin.prototype.setEnabled=function(a){this._showElement(this.annotationsShown&&a&&this.shown&&!this.culled&&!this.occluded),this.publish("enabled",this.enabled=a)},Human.view.annotations.Pin.prototype.setShown=function(a){this._showElement(this.annotationsShown&&this.enabled&&a&&!this.culled&&!this.occluded),this.publish("shown",this.shown=a)},Human.view.annotations.Pin.prototype._showElement=function(a){a?this._element.show():this._element.hide()},Human.view.annotations.Pin.prototype.cullToRectangle=function(a,b,c,d){var e=this.canvasPos;if(e)return this.setCulled(e[0]<a||e[0]>c||e[1]<b||e[1]>d),this.culled},Human.view.annotations.Pin.prototype.setCulled=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!a&&!this.occluded),this.publish("culled",this.culled=a)};var a=vec4.create();Human.view.annotations.Pin.prototype.transform=function(b,c,d){vec3.transformMat4(this.viewPos,this.pos,b),this.viewPos[3]=1,vec4.transformMat4(a,this.viewPos,c);var e=a[0],f=a[1],g=a[3];this.canvasPos=[(1+e/g)*d.width/2,(1-f/g)*d.height/2],this._element.css({left:this.canvasPos[0],top:this.canvasPos[1]})},Human.view.annotations.Pin.prototype.setOccluded=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!this.culled&&!a),this.publish("occluded",this.occluded=a)},Human.view.annotations.Pin.prototype.setViewAngle=function(a){this.publish("angle",this.viewAngle=a)},Human.view.annotations.Pin.prototype.setOpacity=function(a){this._element.css({opacity:this.opacity=a}),this.publish("opacity",a)},Human.view.annotations.Pin.prototype.setPos=function(a){this.pos[0]=a[0],this.pos[1]=a[1],this.pos[2]=a[2],this.publish("pos",this.pos)},Human.view.annotations.Pin.prototype.setDir=function(a){this.publish("dir",this.dir=a)},Human.view.annotations.Pin.prototype.pick=function(){this.publish("picked",!0,!0)},Human.view.annotations.Pin.prototype.destroy=function(){this._element.remove(),this.publish("destroyed",!0)}}(),function(a,b){"use strict";var c=a.view.annotations.Label=function(c,d){this._init(),this.annotation=c,this.saved=!!d.saved,this.offset=d.offset||[70,70],this.offset2=[this.offset[0],this.offset[1]],this.offset2=[this.offset[0],this.offset[1]];var f=!d.saved||d.saved&&d.isOwner,g=this.editing=f&&!this.saved,h=this.saved?"":"new",i=f?"editable":"",j=g?"editing":"",k=a.view.annotations.layouts.activeLayout,l=k?k:"",m=[h,i,j,l].join(" "),n=b("#container");this.$element=b(['<div class="annotationContainer">','<div class="annotationTitle clearfix">','<input type="text" placeholder="">',"<h1></h1>",'<button class="annotationSave"></button>','<button class="annotationDelete"></button>',"</div>",'<div class="annotationDescription">','<textarea placeholder=""></textarea>',"<p></p>","</div>",'<div class="embedContainer"></div>',"</div>"].join("")),this.$titleContainer=this.$element.find(".annotationTitle"),this.$title=this.$element.find("h1"),this.$description=this.$element.find("p"),this.$titleField=this.$element.find("input"),this.$descriptionField=this.$element.find("textarea"),this.$deleteBtn=this.$element.find(".annotationDelete"),this.$saveBtn=this.$element.find(".annotationSave"),e(this.$titleField,100),e(this.$descriptionField,300),this.setTitle(d.title||""),this.setDescription(d.description||""),this.$element.addClass(m).appendTo(n),this.bindHandlers(f),this.setAnnotationsShown(a.view.annotations.shown),this.setEnabled(d.enabled!==!1),this.setShown(d.labelShown!==!1),this.setCulled(!!d.culled),this.setOccluded(!!d.occluded),d.embed&&this.setEmbed(d.embed),this.setOffset(d.offset||[70,-70]),this.updateWidth()};a.utils.extend(a.view.annotations.Label,a.Component),c.prototype.bindHandlers=function(c){var d=this,e=b(document),g=function(a){var c=b(a.target),f=0===c.closest(".annotationContainer").length;f&&(d.$titleField.val()||d.$descriptionField.val()?(d.save(),e.off("click.set-annotation")):d.pos&&(d["delete"](),e.off("click.set-annotation")))},i=function(){var a=d.annotation;if(a.pin){var b=a.pin,c=a.label,e=b.canvasPos||[],f=c.offset[0]<0,g=[e[0]+c.offset[0],e[1]+c.offset[1]];
  
  f&&(g[0]-=c.getWidth()),d.setPos(g)}},j=h(d.$titleField),k=h(d.$descriptionField),l=f("Description",k),m=function(a){var b=d.$titleField.val(),c=f(b,j,a);""!==b&&c>=l?d.$descriptionField.attr("placeholder","Description"):d.$descriptionField.attr("placeholder","")},n=function(a){var b=d.$titleField.val(),c=d.$descriptionField.val(),e=c.split("\n"),g=f(e[0]+"X",k,a),h=parseInt(d.$element.css("max-width"),10),l=h+""=="NaN"?200:h,m=f(b+"X",j,a),n=Math.max(m,g);n=Math.min(n,l),d.$titleContainer.css("width",n+"px"),d.$titleField.css("width",n+"px"),d.$descriptionField.css("width",n+"px"),""===b&&""===c?d.$element.hasClass("empty")||d.$element.addClass("empty"):d.$element.removeClass("empty"),i()},o=function(a){n(a),m(a)};d.on("title",function(){o(!0)}),d.$titleField.on("keypress focus",function(){o(!c)}),d.$descriptionField.on("keypress focus",function(){o(!c)}),c&&this.editing&&(e.on("click.set-annotation",function(a){g(a)}),d.$titleField.focus(),a.utils.async(function(){d.$titleField.focus()})),d.on("mouseClick",function(a){var f=b(a.e.target),h=f.is(d.$titleContainer)||0!==d.$titleContainer.has(f).length;c&&!d.editing&&h&&(d.editing=!0,d.$descriptionField.height(d.$description[0].offsetHeight),d.$element.addClass("editing"),d.$titleField.focus(),d.publish("edit",!0,!0),d.publish("updateWidth",!0,!0),e.on("click.set-annotation",function(a){g(a)}))}),d.$descriptionField.blur(function(a){g(a)}),d.$deleteBtn.click(function(a){a.preventDefault(),d["delete"]()}),d.$saveBtn.click(function(a){a.preventDefault(),d.save()});var p=0,q=0,r=function(a){p=a.clientX,q=a.clientY};d.$element.mouseenter(function(a){d.publish("mouseEnter",{annotationId:d.annotation.annotationId,e:a},!0),r(a)}),d.$element.mouseleave(function(a){d.publish("mouseLeave",{annotationId:d.annotation.annotationId,e:a},!0),r(a)}),d.$element.mousedown(function(a){d.publish("mouseDown",{annotationId:d.annotation.annotationId,x:a.clientX,y:a.clientY,e:a},!0),r(a)}),d.$element.mouseup(function(a){var b=a.clientX,c=a.clientY;d.publish("mouseUp",{annotationId:d.annotation.annotationId,x:b,y:c,e:a},!0),p===b&&q===c&&d.publish("mouseClick",{annotationId:d.annotation.annotationId,x:b,y:c,e:a},!0),r(a)}),d.on("updateWidth",this._redrawWireConnection.bind(this))},c.prototype.save=function(){this.editing=!1,this.setTitle(this.$titleField.val()),this.setDescription(this.$descriptionField.val()),this.$element.removeClass("new editing"),this.publish("saved",this.saved=!0),this.publish("updateWidth",!0,!0)},c.prototype["delete"]=function(){this.publish("delete",!0,!0)},c.prototype.setOffset=function(a){this.offset[0]=a[0],this.offset[1]=a[1],this.offset2[0]=a[0],this.offset2[1]=a[1],this.publish("offset",this.offset)},c.prototype.setAnnotationsShown=function(a){this._showElement(a&&this.enabled&&this.shown&&!this.culled&&!this.occluded),this.publish("annotationsShown",this.annotationsShown=a)},c.prototype.setEnabled=function(a){this._showElement(this.annotationsShown&&a&&this.shown&&!this.culled&&!this.occluded),this.publish("enabled",this.enabled=a)},c.prototype.setShown=function(a){this._showElement(this.annotationsShown&&this.enabled&&a&&!this.culled&&!this.occluded),this.publish("shown",this.shown=a)},c.prototype.setCulled=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!a&&!this.occluded),this.publish("culled",this.culled=a)},c.prototype.setOccluded=function(a){this._showElement(this.annotationsShown&&this.enabled&&this.shown&&!this.culled&&!a),this.publish("occluded",this.occluded=a)},c.prototype.setOpacity=function(a){this.$element.css({opacity:this.opacity=a}),this.publish("opacity",a)},c.prototype._showElement=function(a){a?this.$element.css("display","inline-block"):this.$element.hide()},c.prototype.setTitle=function(a){this.$titleField.val(a),this.$title.html(a),this.publish("title",this.title=a)},c.prototype.setDescription=function(a){this.$descriptionField.val(a),this.$description.html(a),this.publish("description",this.description=a)},c.prototype.setEmbed=function(a){var b=["ui-all=false"];for(var c in a)a.hasOwnProperty(c)&&b.push(c+"="+a[c]);var d="/embedded.html?"+b.join("&"),e='<iframe src="'+d+'" width="150" height="150" border="0"></iframe>';this.$element.addClass("annotationEmbed"),this.$element.find(".embedContainer").append(e).show(),this.publish("embed",this.embed=a)},c.prototype.setPos=function(a,b){b&&(a[1]=a[1]-this.$titleContainer[0].offsetHeight),this.$element.css({left:a[0]+"px",top:a[1]+"px"}),this.publish("pos",this.pos=a)},c.prototype.setSide=function(a){this.side=a,this.$element.removeClass("left right").addClass(a),this.connectionPoint=[this.pos[0]+("left"===a?this.getWidth():0),this.pos[1]+this.$titleContainer[0].offsetHeight]},c.prototype.getTop=function(){return this.$element[0].offsetTop},c.prototype.getBottom=function(){return this.$element[0].offsetTop+this.getHeight()},c.prototype.getHeight=function(){return this.$element[0].offsetHeight},c.prototype.getWidth=function(){return this.$element[0].offsetWidth},c.prototype.updateWidth=function(){this.width=this.getWidth()},c.prototype._redrawWireConnection=function(){this.updateWidth(),a.view.annotations.layouts.redrawLayout()},c.prototype.destroy=function(){this.$element.remove(),this.publish("destroyed",!0)};var d,e=function(a,b){b&&b>0&&(a.attr("maxlength",b),a.keyup(function(c){13!==c.keyCode&&a.val().length>=b&&alert("Maximum characters allowed ("+b+")")}))},f=function(a,b,c){d=d||document.createElement("canvas");var e=d.getContext("2d");e.font=b,c&&(a=g(a));var f=e.measureText(a);return f.width},g=function(a){var b=document.createElement("div");return b.innerHTML=a,b.innerText},h=function(a){return b(a).css("font")}}(Human,jQuery),function(){"use strict";var a=Human.view.annotations.placer={},b=vec3.create();a.placeAnnotation=function(a){var c=Human.view.camera.eye;b[0]=c.x,b[1]=c.y,b[2]=c.z;var d=vec3.create();vec3.subtract(d,b,a.pos),Human.view.annotations.createAnnotation({objectId:a.objectId,title:a.title||"",description:a.description||"",pos:a.pos,mouseDownPos:a.mouseDownPos,dir:d,enabled:!0,shown:!0,labelShown:!0,labelOffset:a.labelOffset,saved:void 0!==a.saved&&null!==a.saved?a.saved:!1})}}(),function(){"use strict";var a=14,b=12,c="left",d=5,e=2,f=Human.view.annotations.renderer={};f.render=function(f){var g=f.annotation,h=f.canvasData,i=f.bgColor,j=h.context,k=g.label,l=g.pin,m=k.connectionPoint,n=h.scaleX,o=h.scaleY,p=l.canvasPos[0]*n,q=l.canvasPos[1]*o,r=k.enabled&&k.shown&&!k.occluded&&!k.culled;if(r){var s=k.pos[0]*n,t=m[0]*n,u=m[1]*o,v=Math.min(h.width-s-10,k.width*n);j.fillStyle="white"===i?"rgb(0, 0, 0)":"rgb(255, 255, 255)",j.textAlign=c;var w=Math.round(a*n),x=Math.round(b*n),y=function(a,b,c){for(var d=b.split(" "),e="",f=[],g=0;g<d.length;g++){var h=e+d[g],i=a.measureText(h);i.width>c&&g>0?(f.push(e),e=d[g]+" "):e=h+" "}return f.push(e),f},z=function(a,b,c,d){var e=1.25*b;j.font=(c?"bold ":"")+b+"px Arial";for(var f=y(j,a||"",v),g=u+d(f,e),h=0;h<f.length;h++)j.fillText(f[h],s,g+e*h)};z(k.title,w,!0,function(a,b){return-(a.length-1)*b-b/2}),z(k.description,x,!1,function(a,b){return b});var A=l.opacity;j.strokeStyle="rgba(204, 204, 204, "+A+")",j.beginPath(),j.moveTo(p,q),j.lineTo(t,u);var B="left"===k.side?-v:v;j.lineTo(t+B,u),j.stroke()}var C=function(a,b,c){j.fillStyle=b,j.beginPath(),j.arc(p,q,a,0,2*Math.PI),j.fill(),c&&c()},D=d*n,E=e*n;C(D,"rgb(255, 255, 255)",function(){j.lineWidth=1,j.strokeStyle="rgb(204, 204, 204)",j.stroke()}),C(E,"rgb(153,0,0)")}}(),function(){"use strict";function a(){b&&b.setDirty()}var b,c=Human.view.annotations.layouts={},d={};c.activeLayout=null,c.getLayout=function(a){return d[a]},Human.events.on("loaded",function(){var a=Human.renderer.canvas.annotationCanvas[0];if(!a)return void Human.log.error("Human.view.annotations.layouts","DOM element not found: 'annotationCanvas'");var d=a.getContext("2d");return d?(Human.properties.subscribe({propId:"annotations.layout.type",value:"columns",callback:function(a){c._selectLayout(a)}}),void Human.events.on("tick",function(){b&&a&&d&&b.layout(a,d)})):void Human.log.error("Human.view.annotations.layouts","Failed to get 2D canvas context")}),Human.events.on("camera.updated",function(){a()}),Human.events.on("canvas.resized",function(){a()}),Human.events.on("annotations.creating",function(a){e(a)}),Human.events.on("clip.updated",function(){a()}),Human.events.on("scene.objectsShown",function(){a()}),Human.events.on("annotations.created",function(a){e(a)});var e=function(b){Human.events.onEvent("annotations.shown",a);var c=Human.view.annotations.annotations[b.annotationId];c.on("object",a),c.pin.on("enabled",a),c.pin.on("shown",a),c.label.on("shown",a),c.label.on("edit",a),c.label.on("saved",a),c.label.on("cancel",a),c.label.on("destroyed",a),a()};c.addLayoutType=function(a,e){return d[a]?void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout already added: '"+a+"'"):e.setEnabled?e.setDirty?e.layout?(d[a]=e,void(b||c._selectLayout(a))):void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout strategy does not have a 'layout' method"):void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout strategy does not have a 'setDirty' method"):void Human.log.error("Human.view.annotations.layouts.addLayoutType","Layout strategy does not have a 'setEnabled' method")},c._selectLayout=function(a){return"columns-v2"===a&&(a="columns"),Human.log.info("Human.view.annotations.layouts._selectLayout","Selecting label type: '"+a+"'"),d[a]?void(b!==a&&(b&&b.setEnabled(!1),b=d[a],b.setEnabled(!0),b.setDirty(),c.activeLayout=a)):void Human.log.error("Human.view.annotations.layouts._selectLayout","Layout not found: '"+a+"'")},c.redrawLayout=a}(),Human.view.annotations.layouts.addLayoutType("columns",function(){"use strict";function a(a,b,c,d){var e,f,g,h,i,j,k=Human.scene.enabledObjects,l={xmin:Number.POSITIVE_INFINITY,ymin:Number.POSITIVE_INFINITY,xmax:Number.NEGATIVE_INFINITY,ymax:Number.NEGATIVE_INFINITY};for(var m in k)if(k.hasOwnProperty(m)){var n=k[m];if(0===n.numSubObjects){e=n.getBoundary(),f=[[e.xmin,e.ymin,e.zmin],[e.xmax,e.ymin,e.zmin],[e.xmax,e.ymax,e.zmin],[e.xmin,e.ymax,e.zmin],[e.xmin,e.ymin,e.zmax],[e.xmax,e.ymin,e.zmax],[e.xmax,e.ymax,e.zmax],[e.xmin,e.ymax,e.zmax]];for(var o=0;8>o;o++)g=f[o],vec3.transformMat4(t,f[o],c),t[2]>.1||(t[3]=1,vec4.transformMat4(t,t,d),h=t[0],i=t[1],j=t[3],h=(1+h/j)*a.width/2,i=(1-i/j)*a.height/2,0>h||0>i||h>a.width||i>a.height||(l.xmin>h&&(l.xmin=h),l.ymin>i&&(l.ymin=i),l.xmax<h&&(l.xmax=h),l.ymax<i&&(l.ymax=i)))}}return l}function b(a){var b=Human.view.camera.eye;u[0]=b.x,u[1]=b.y,u[2]=b.z,vec3.subtract(u,u,a.pos);var c=vec3.dot(u,a.dir),d=vec3.length(u),e=vec3.length(a.dir),f=57.2957795*Math.acos(c/(d*e));return f}function c(a,b){for(var c,d,e=0;b-1>e;e++){d=e;for(var f=e;b>f;f++)a[f].pin.canvasPos[1]<a[d].pin.canvasPos[1]&&(d=f);c=a[e],a[e]=a[d],a[d]=c}}function d(a,b,c,d,f,g){for(var j,k,l,m,n=0>g?Math.max(e.left,c.xmin-h-50):Math.min(a.width-e.right-h,c.xmax),o=Math.max(e.top,c.ymin),p=Math.min(e.bottom,c.ymax),q=o,r=a.height-o-p,s=r/f,t=0;f>t;t++){j=d[t],k=j.pin,l=j.label,m=j.wire;var u=k.canvasPos[0],v=k.canvasPos[1];l.setPos([n,i?v:q],i),l.setSide(0>g?"left":"right");var w,x=l.connectionPoint,y=Math.sqrt(Math.pow(x[0]-u,2)+Math.pow(x[1]-v,2));w=i?0>g?0:180:180*Math.atan2(v-x[1],u-x[0])/Math.PI,m.css({width:y+"px",left:x[0]+"px",top:x[1]+"px",opacity:k.opacity,"-webkit-transform":"rotate("+w+"deg)","-moz-transform":"rotate("+w+"deg)","-ms-transform":"rotate("+w+"deg)","-o-transform":"rotate("+w+"deg)",transform:"rotate("+w+"deg)"}),q+=s}}var e,f=Human.view.annotations,g={};Human.properties.subscribe({propId:"annotations.margins",value:{top:50,left:50,right:50,bottom:50},callback:function(a){e=a}});var h;Human.properties.subscribe({propId:"annotations.labelWidth",value:150,callback:function(a){h=a}});var i=!1;Human.properties.subscribe({propId:"annotations.horizontalLines",value:i,callback:function(a){i=a,o=!0}});var j,k,l=100,m=80,n=!1,o=!0,p=[],q=0,r=[],s=0;g.setEnabled=function(a){n=a,o=!0},g.setDirty=function(){o=!0},g.layout=function(g,i){if(o){if(i.clearRect(0,0,g.width,g.height),!f.shown)return void(o=!1);q=0,s=0;var n,t,u,v,w=f.annotations,x=Human.renderer.getViewMat(),y=Human.renderer.getProjMat(),z=a(g,i,x,y);Human.request.getSearchParam("showBoundary")&&(i.beginPath(),i.rect(z.xmin,z.ymin,z.xmax-z.xmin,z.ymax-z.ymin),i.lineWidth=2,i.strokeStyle="black",i.stroke());for(var A in w)if(w.hasOwnProperty(A)){if(n=w[A],t=n.pin,u=n.label,!t.shown||!t.enabled)continue;if(!u.shown&&!t.shown)continue;t.transform(x,y,g);var B=b(t);t.setViewAngle(B);var C=-l>B||B>l;t.setOccluded(C);var D;B>=m?(D=1-(B-m)/(l-m),0>D&&(D=0)):D=1,t.setOpacity(D),u.setOpacity(D),t.cullToRectangle(e.left,0,g.width-e.right-h,g.height),t.culled!==u.culled&&u.setCulled(t.culled),t.occluded!==u.occluded&&u.setOccluded(t.occluded),t.enabled&&t.shown&&!t.culled&&!t.occluded&&u.shown&&(v=n.pin.viewPos[0]<0,v?p[q++]=n:r[s++]=n)}c(p,q),c(r,s),d(g,i,z,p,q,-1),d(g,i,z,r,s,1),j=g.width,k=g.height,o=!1}};var t=vec4.create(),u=vec3.create();return g.snapshot=function(a,b,c){if(f.shown){var d,e,g=a.width,h=a.height,i=g/j,l=h/k,m=f.annotations,n={context:b,width:g,height:h,halfWidth:g/2,scaleX:i,scaleY:l};for(var o in m)m.hasOwnProperty(o)&&(d=m[o],d.pin.enabled&&!d.pin.occluded&&(e=d.label,e.shown&&f.renderer.render({annotation:d,canvasData:n,bgColor:c})))}},g}()),Human.view.annotations.layouts.addLayoutType("radial",function(){"use strict";function a(a,b){for(var c,d,e=0;b-1>e;e++){d=e;for(var f=e;b>f;f++)a[f].pin.pos[1]>a[d].pin.pos[1]&&(d=f);c=a[e],a[e]=a[d],a[d]=c}}function b(a,b,c,d,e){for(var f,g,h,i=a.width/2,j=a.height,k=j/d,l=50,m=0;d>m;m++)f=c[m],g=f.pin,h=f.label,h.setPos([e,l]),b.strokeStyle="rgb(0, 0, 100)",b.beginPath(),b.moveTo(g.canvasPos[0],g.canvasPos[1]),i>e?b.lineTo(e+h.getWidth(),l):b.lineTo(e,l),b.closePath(),b.stroke(),l+=k}var c,d,e=Human.view.annotations,f={},g=100,h=200,i=!1,j=!0,k=[],l=0,m=[],n=0;return f.setEnabled=function(a){i=a,j=!0},f.setDirty=function(){j=!0},f.layout=function(f,i){if(j){l=0,n=0;var o,p,q,r,s=e.annotations;for(var t in s)s.hasOwnProperty(t)&&(o=s[t],p=o.pin,q=o.label,p.cullToRectangle(0,0,f.width,f.height),p.culled!==q.culled&&q.setCulled(p.culled),p.enabled&&p.shown&&!p.culled&&q.shown&&o.pin.viewPos&&(r=o.pin.viewPos[0]<0,r?k[l++]=o:m[n++]=o));a(k,l),a(m,n),i.clearRect(0,0,f.width,f.height),b(f,i,k,l,g),b(f,i,m,n,f.width-g-h),c=f.width,d=f.height,j=!1}},f.snapshot=function(a,b){var f,g,h=a.width,i=a.height,j=h/c,k=i/d,l=e.annotations,m={context:b,width:h,height:i,halfWidth:h/2,scaleX:j,scaleY:k};for(var n in l)l.hasOwnProperty(n)&&(f=l[n],f.pin.enabled&&(g=f.label,g.shown&&e.renderer.render({annotation:f,canvasData:m})))},f}()),Human.view.annotations.layouts.addLayoutType("floating",function(){"use strict";function a(a){var b=Human.view.camera.eye;j[0]=b.x,j[1]=b.y,j[2]=b.z,vec3.subtract(j,j,a.pos);var c=vec3.dot(j,a.dir),d=vec3.length(j),e=vec3.length(a.dir),f=57.2957795*Math.acos(c/(d*e));return f}var b,c=Human.view.annotations,d={};Human.properties.subscribe({propId:"annotations.labelWidth",value:120,callback:function(a){b=a}});var e,f,g=!1,h=!0,i=90;d.setEnabled=function(a){g=a,h=!0},d.setDirty=function(){h=!0},d.layout=function(b){if(h){var d,g,j,k=c.annotations,l=Human.renderer.getViewMat(),m=Human.renderer.getProjMat();for(var n in k)if(k.hasOwnProperty(n)){d=k[n],g=d.pin,j=d.label,g.transform(l,m,b);var o=a(g);g.setViewAngle(o);var p=-90>o||o>90;g.setOccluded(p);var q=-1*(o-0)/(i-0)+1;0>q&&(q=0),g.setOpacity(q),j.setOpacity(q+.5),g.cullToRectangle(0,0,b.width,b.height),g.culled!==j.culled&&j.setCulled(g.culled),g.occluded!==j.occluded&&j.setOccluded(g.occluded),g.enabled&&g.shown&&!g.culled&&!g.occluded&&j.shown&&j.setPos(g.canvasPos)}e=b.width,f=b.height,h=!1}};var j=vec3.create();return d.snapshot=function(a,b){var d,g,h=a.width,i=a.height,j=h/e,k=i/f,l=c.annotations,m={context:b,width:h,height:i,halfWidth:h/2,scaleX:j,scaleY:k};for(var n in l)l.hasOwnProperty(n)&&(d=l[n],d.pin.enabled&&!d.pin.occluded&&(g=d.label,g.shown&&c.renderer.render({annotation:d,canvasData:m})))},d}()),Human.view.annotations.layouts.addLayoutType("draggable",function(){"use strict";function a(a,c,e,f){var g=a.pin,h=a.label,k=f.height,l=f.width;if(g.shown&&g.enabled&&g.shown){g.transform(c,e,f);var m=b(g);g.setViewAngle(m);var n;return m>=j?(n=1-(m-j)/(i-j),0>n&&(n=0)):n=1,g.setOpacity(n),h.setOpacity(n),g.cullToRectangle(d.left,0,l-d.right,k),g.culled!==h.culled&&h.setCulled(g.culled),g.culled?!1:!0}}function b(a){var b=Human.view.camera.eye;vec3.subtract(o,[b.x,b.y,b.z],a.pos);var c=vec3.dot(o,a.dir),d=vec3.length(o),e=vec3.length(a.dir),f=57.2957795*Math.acos(c/(d*e));return f}function c(a){var b=a.pin,c=a.label,d=a.wire,e=b.canvasPos,f=c.offset[0]<0,g=[e[0]+c.offset[0],e[1]+c.offset[1]];f&&(g[0]-=c.getWidth()),c.setPos(g),c.setSide(f?"left":"right");var h,i=c.connectionPoint,j=Math.sqrt(Math.pow(i[0]-e[0],2)+Math.pow(i[1]-e[1],2));h=180*Math.atan2(i[1]-e[1],i[0]-e[0])/Math.PI,d.css({width:j+"px",left:e[0]+"px",top:e[1]+"px",opacity:b.opacity,"-webkit-transform":"rotate("+h+"deg)","-moz-transform":"rotate("+h+"deg)","-ms-transform":"rotate("+h+"deg)","-o-transform":"rotate("+h+"deg)",transform:"rotate("+h+"deg)"})}var d,e=Human.view.annotations,f={};Human.properties.subscribe({propId:"annotations.margins",value:{top:50,left:50,right:50,bottom:50},callback:function(a){d=a}});var g,h,i=100,j=80,k=!1,l=!0,m=null;f.setEnabled=function(a){k=a,l=!0},function(){var a,b=-1,c=-1;Human.events.on("annotations.mouseDown",function(d){k&&(a=e.annotations[d.annotationId],b=d.x,c=d.y)}),$("body").mousemove(function(d){if(k&&a){var e=d.clientX,f=d.clientY,g=a.label.offset;a.label.setOffset([g[0]+e-b,g[1]+f-c]),b=e,c=f,m=a}}),$("body").mouseup(function(){k&&(a=null)})}(),f.setDirty=function(){l=!0};var n=[];f.layout=function(b){if(l||m){var d,f,i,j=Human.renderer.getViewMat(),k=Human.renderer.getProjMat();if(n.length=0,l){if(d=e.annotations,!e.shown)return void(l=!1);for(i in d)d.hasOwnProperty(i)&&(f=d[i],a(f,j,k,b)&&(f.occludable?n.push(f):c(f)));g=b.width,h=b.height,l=!1}else d={},d[m.annotationId]=m,a(m,j,k,b)&&(m.occludable?n.push(m):c(m)),m=null;Human.view.annotations.occlusionQuery.runQuery(n,c)}};var o=vec3.create();return f.snapshot=function(a,b,c){if(e.shown){var d,f,i=a.width,j=a.height,k=i/g,l=j/h,m=e.annotations,n={context:b,width:i,height:j,halfWidth:i/2,scaleX:k,scaleY:l};for(var o in m)m.hasOwnProperty(o)&&(d=m[o],f=d.pin,f.enabled&&f.shown&&!f.occluded&&e.renderer.render({annotation:d,canvasData:n,bgColor:c}))}},f}()),function(){"use strict";var a,b=!1,c=!1;Human.properties.subscribe({propId:"annotations.hideWhileCameraMoving",value:b,callback:function(a){b=a}}),Human.events.on("camera.updated",function(){c=!0}),Human.events.on("tick",function(){b&&(c?(a&&(clearTimeout(a),a=null),Human.view.annotations.setShown(!1),c=!1):a||(a=setTimeout(function(){clearTimeout(a),Human.view.annotations.setShown(!0)},200)))})}(),function(){"use strict";function a(a){if(!c(Human.modules.modules[a.moduleId])){var d=b()?"draggable":"columns-v2";Human.properties.set({"annotations.layout.type":d})}}function b(){var a,b,c=Human.view.annotations.annotations,d=Human.timeline.chapters;for(a in c)if(c.hasOwnProperty(a)&&!c[a].draggable)return!1;for(b in d)if(d.hasOwnProperty(b)){c=d[b].annotations||{};for(a in c)if(c.hasOwnProperty(a)&&!c[a].draggable)return!1}var e=!0;return Human.timeline.activeRoot&&Human.timeline.activeRoot._chapters.forEach(function(a){var b,c;for(c=0;c<a.annotations.length;c++)b=a.annotations[c],b.hasOwnProperty("labelOffset")||(e=!1)}),e}function c(a){return a?a.annotationsLayout?!0:a.properties&&a.properties["annotations.layout.type"]?!0:!1:!1}Human.events.on("bookmarks.restored",a),Human.events.on("modules.activated",a),Human.events.on("modules.deactivated",a)}(),function(){"use strict";function a(a){this._annotation=a.annotation,this._object=a.object,this._pinPos=vec3.create(),this._pinPos.set(this._annotation.pin.pos),mat4.invert(k,this._object.getWorldMatrix()),vec3.transformMat4(this._pinPos,this._pinPos,k)}function b(a){var b=a.morph,d=a.geometry,e=a.annotation,f=e.pin;this._object=a.object,this._morph=b,this._annotation=e,this._times=b.getKeys(),this._targets=[],this._index1=0,this._index2=1,this._loop=!!a.loop,this._pickPos=vec3.create(),this._pinPos=vec3.create(),mat4.invert(k,this._object.getWorldMatrix()),vec3.transformMat4(this._pinPos,e.pin.pos,k),this._offset=[e.label.offset[0],e.label.offset[1]];var g=this;e.label.on("offset",function(a){g._offset=a});var h,i,j,l,p=this._morph.getTargets(),q=f.primitiveIndex,r=d.getIndices(),s=r[q],t=r[q+1],u=r[q+2],v=f.barycentric;for(h=0,i=p.length;i>h;h++)j=p[h].positions,m[0]=j[3*s],m[1]=j[3*s+1],m[2]=j[3*s+2],n[0]=j[3*t],n[1]=j[3*t+1],n[2]=j[3*t+2],o[0]=j[3*u],o[1]=j[3*u+1],o[2]=j[3*u+2],l=c(v,m,n,o,vec3.create()),this._targets.push(l);this._pickPos[0]=this._pinPos[0],this._pickPos[1]=this._pinPos[1],this._pickPos[2]=this._pinPos[2]}function c(a,b,c,d,e){var f=a[0],g=a[1],h=a[2];return e[0]=b[0]*f+c[0]*g+d[0]*h,e[1]=b[1]*f+c[1]*g+d[1]*h,e[2]=b[2]*f+c[2]*g+d[2]*h,e}function d(){Human.timeline.playing&&(Human.timeline.playing=!1,t=!0),Human.timeline.playfree&&(Human.timeline.playfree=!1,u=!0)}function e(){t&&(Human.timeline.playing=!0,t=!1),u&&(Human.timeline.playfree=!0,u=!1)}var f,g={},h=[],i=0,j=!1;Human.events.on("loaded",function(){f=Human.renderer.canvas.annotationCanvas[0]}),Human.events.on("annotations.pinning",d),Human.events.on("annotations.creating",d),Human.events.on("annotations.created",function(c){var d=c.annotationId,f=Human.view.annotations.annotations[d];if(!f.followsObject)return void e();var h=c.objectId,i=Human.scene.objects[h];if(!h||!i)return void e();var k=i.morph&&i.geometry&&f.pin.primitiveIndex;if(k){var l=f.label.offset;g[d]=new b({object:i,morph:i.morph,geometry:i.geometry,annotation:f,offset:[l[0],l[1]]})}else g[d]=new a({object:i,annotation:f});j=!0,e()}),Human.events.on("annotations.destroyed",function(a){var b=a.annotationId;g[b]&&(delete g[b],j=!0),e()}),Human.events.on("tick",function(){if(j){i=0;for(var a in g)g.hasOwnProperty(a)&&(h[i++]=g[a]);j=!1}if(i>0){for(var b=0;i>b;b++)h[b].update();Human.view.annotations.layouts.redrawLayout()}});var k=mat4.create(),l=vec3.create();a.prototype.update=function(){var a=this._annotation;a.pin.shown&&(vec3.transformMat4(l,this._pinPos,this._object.getWorldMatrix()),a.pin.setPos(l))};var m=vec3.create(),n=vec3.create(),o=vec3.create(),p=vec2.create(),q=vec2.create();b.prototype.update=function(){var a=this._annotation;if(a.pin.shown){var b=this._morph.getFactor();if(!(this._targets.length<2)){void 0===b&&(b=this._times[0]);var c=this._times[0],d=this._times[this._times.length-1];if(this._loop)b=this._times[0]+b%(d-c);else{if(c>=b)return this._targets[0];if(b>=d)return this._targets[this._targets.length-1]}for(;this._times[this._index1]>b;)this._index1--,this._index2--;for(;this._times[this._index2]<b;)this._index1++,this._index2++;Human.math.lerpVec3(b,this._times[this._index1],this._times[this._index2],this._targets[this._index1],this._targets[this._index2],this._pinPos),vec3.transformMat4(this._pinPos,this._pinPos,this._object.getWorldMatrix()),a.pin.setPos(this._pinPos),this._transform(this._pickPos,p),this._transform(this._pinPos,q),a.label.offset2[0]=this._offset[0]-(q[0]-p[0]),a.label.offset2[1]=this._offset[1]-(q[1]-p[1])}}};var r=vec4.create(),s=vec4.create();b.prototype._transform=function(a,b){var c=Human.renderer.getViewMat(),d=Human.renderer.getProjMat();vec3.transformMat4(r,a,c),r[3]=1,vec4.transformMat4(s,r,d);var e=s[0],g=s[1],h=s[3];return b[0]=(1+e/h)*f.width/2,b[1]=(1-g/h)*f.height/2,b};var t=!1,u=!1}(),function(){"use strict";function a(){var a,b;for(g.clear(),a=0,b=r.length;b>a;a++)g.addAnnotation(r[a]);g.doQuery();var c,d,e,f,h=Human.view.annotations.annotations,i=g.result,j=g.lenResult;for(a=0;j>a;a++)f=i[a],c=h[f.annotationId],d=c.pin,e=c.label,f.occluded?(d.setOccluded(!0),e.setOccluded(!0)):(d.setOccluded(!1),e.setOccluded(!1),s&&s(c))}function b(a){var b=Human.view.camera.eye;vec3.subtract(x,[b.x,b.y,b.z],a.pos);var c=vec3.dot(x,a.dir),d=vec3.length(x),e=vec3.length(a.dir),f=57.2957795*Math.acos(c/(d*e));return f}function c(a,b,c,d,e,f){vec3.transformMat4(y,a,b),y[3]=1,vec4.transformMat4(y,y,c);var g=y[0],h=y[1],i=y[3];f[0]=(1+g/i)*d/2,f[1]=(1-h/i)*e/2}function d(){this._flags=e.addNode({type:"properties",properties:{enabled:!1,clipping:!0,picking:!1}}),this._material=this._flags.addNode({type:"material",color:{r:0,g:0,b:1},specularColor:{r:0,g:0,b:0},emitColor:{r:0,g:0,b:1},emit:1}),this._translate=this._material.addNode({type:"translate",x:0,y:0,z:0}),this._geometry=this._translate.addNode({type:"geometry",primitive:"points",coreId:"__occludePoint",positions:[0,0,0],pointSize:3})}var e,f,g=Human.view.annotations.occlusionQuery={},h=[],i=0;g.result=[],g.lenResult=0,Human.events.on("loaded",function(){e=Human.renderer.getNode("occlusionIndicators"),f=Human.renderer.canvas.canvas[0]});var j,k,l,m,n=100,o=6,p=!0,q=o,r=[],s=null;Human.events.on("tick",function(){q++,p&&q>=o&&r.length>0&&(j=Human.renderer.getViewMat(),k=Human.renderer.getProjMat(),l=f.width,m=f.height,a(),p=!1,q=0)}),g.runQuery=function(a,b){r=a||[],s=b||null,p=!0,r.forEach(function(a){a.pin.occluded||s(a)})},g.clear=function(){for(var a=0;i>a;a++)h[a].point.setShown(!1);i=0};var t=vec3.create(),u=vec3.create(),v=vec3.create(),w=vec2.create();g.addAnnotation=function(a){var e=a.pin,f=a.label,o=b(e);e.setViewAngle(o);var p=-n>o||o>n;if(e.setOccluded(p),e.occluded!==f.occluded&&f.setOccluded(p),!p){var q=a.object,r=Human.view.camera.eye,s=q&&!q.clippable?!1:!0;u.set(e.pos),t[0]=r.x,t[1]=r.y,t[2]=r.z,vec3.subtract(v,t,u);var x=vec3.length(v);vec3.normalize(v,v),vec3.scale(v,v,Math.min(.1*x,.5)),vec3.add(u,u,v),c(u,j,k,l,m,w);var y=h[i]||(h[i]={x:0,y:0,r:0,g:0,b:0,a:0,point:new d,occluded:!1});y.annotation=a,y.x=w[0],y.y=w[1],y.point.setWorldPos(u),y.point.setShown(!0),y.point.setClipping(s);var z=g.result[i]||(g.result[i]={annotationId:null,occluded:!1});z.annotationId=a.annotationId,z.occluded=!1,i++}},g.doQuery=function(){if(0!==i){var a=!0;Human.renderer.getScene().readPixels(h,i,a);for(var b,c=0;i>c;c++)b=h[c],g.result[c].occluded=!(0===b.r&&0===b.g&&255===b.b),b.point.setShown(!1);g.lenResult=i,i=0}};var x=vec3.create(),y=vec4.create();d.prototype.setShown=function(a){this._flags.setEnabled(!!a)},d.prototype.setClipping=function(a){this._flags.setClipping(!!a)},d.prototype.setWorldPos=function(a){this._translate.setXYZ({x:a[0],y:a[1],z:a[2]})},d.destroy=function(){this._flags.destroy()}}(),function(){"use strict";function a(a){Human.view.labels.createLabel({objectId:a.objectId,afterDelay:!0}),Human.renderer.forceRenderFrame()}function b(a,b){var c=Human.scene.objects[a];c&&Human.events.fire("focus.objectFocused",{objectId:a,description:c.description,flyTo:b})}var c=Human.view.focus={};c.focusObject=function(c,d){d=d||Human.utils.noop;var e=c.fmaId,f=c.objectId,g=c.objectIds;if(!f&&!e&&!g)return Human.log.error("Human.view.focusObject","Parameter expected: either 'objectId', 'objectIds' or 'fmaId'"),void d();var h,i=Human.scene;if(f){if(h=i.objects[f],!h)return Human.log.error("Human.view.focusObject","Scene object not found: '"+f+"'"),void d()}else if(e){if(h=i.objectsByFMAID[e],!h)return Human.log.error("Human.view.focusObject","Scene object not found for this FMAID: '"+e+"'"),void d();f=h.objectId}c.xray===!0?Human.rpc.call(null,"xray.setEnabled",{enable:!0}):c.xray===!1&&Human.rpc.call(null,"xray.setEnabled",{enable:!1});var j=c.select;j=void 0===j||null===j?c.replace||!i.selectedObjects[f]:c.select;var k,l=c.flyTo;if(c.replace)i.setSelectedObjects({objectId:f,select:j,replace:c.replace});else if(j){var m={};m[f]=j,i.setSelectedObjects({objects:m,replace:c.replace})}c.showLabel===!1&&j||Human.view.labels._clearLabels(),c.showLabel!==!1&&a(c),j&&"newSelected"===l?(k=h.getBoundary(),k&&(Human.view.boundary.setBoundary(k,!0),Human.view.camera.fly.flyTo({boundary:k,backOff:c.backOff,arc:0},function(){Human.view.boundary.setBoundary(!1),b(f,l),d()}))):l&&"allSelected"!==l?"selectedLeafObjects"===l?Human.view.camera.fly.flyTo({selectedLeafObjects:!0,backOff:c.backOff,arc:0},function(){Human.view.boundary.setBoundary(!1),j&&b(f,l),d()}):"object"===l?(k=h.getBoundary(),Human.view.boundary.setBoundary(k,!0),Human.view.camera.fly.flyTo({boundary:k,backOff:c.backOff,arc:0},function(){Human.view.boundary.setBoundary(!1),j&&b(f,l),d()})):(b(f,l),d()):(k=i.getBoundary({objects:i.selectedObjects}),k?(Human.view.boundary.setBoundary(k,!0),Human.view.camera.fly.flyTo({boundary:k,backOff:c.backOff,arc:0},function(){Human.view.boundary.setBoundary(!1),j&&b(f,l),d()})):(Human.view.boundary.setBoundary(!1),j&&b(f,l),d()))}}(),function(){"use strict";function a(a){var b,c=Human.scene,d=c.objects;for(var e in d)d.hasOwnProperty(e)&&(b=d[e],a?Human.scene.selectedObjects[b.objectId]?(b.setXRay(!1),b.setHighlight(!1)):b.setXRay(!0):b.setXRay(!1))}var b=Human.view.xray={};b.enabled=!1;var c=!0;Human.events.on("loaded",function(){b.enabled=!1,c=!1}),Human.events.on("scene.objectsSelected",function(){b.enabled&&(c=!0)}),Human.events.on("tick",function(){c&&(a(b.enabled),c=!1)}),b.setEnabled=function(d){b.enabled!==d&&(b.enabled=d,c=!0),Human.events.fire("xray.toggled",{enabled:d}),b.enabled&&(Human.view.currentMode="Xray"),a(d)},b.getEnabled=function(){return b.enabled}}(),function(){"use strict";function a(a){for(var b=Human.scene.objects[a];b&&b.anonymous;)b=b.parent;return b}var b=Human.view.pick={};b.singleEnabled=!0,b.multiEnabled=!1;var c=!1,d=!1;Human.properties.subscribe({propId:"pick.regions.pickAll",value:d,callback:function(a){d=a}}),Human.events.on("loaded",function(){b.setSinglePickEnabled(!0),b.setMultiPickEnabled(!1)}),b.setSinglePickEnabled=function(a){b.singleEnabled!==a&&(b.singleEnabled=a),a&&(b.multiEnabled&&(b.multiEnabled=!1),Human.events.fire("pick.multi.toggled",{enabled:b.multiEnabled})),Human.events.fire("pick.single.toggled",{enabled:b.singleEnabled})},b.getSinglePickEnabled=function(){return b.singleEnabled},b.setMultiPickEnabled=function(a){b.multiEnabled!==a&&(b.multiEnabled=a),a&&(b.singleEnabled&&(b.singleEnabled=!1),Human.events.fire("pick.single.toggled",{enabled:b.singleEnabled})),Human.events.fire("pick.multi.toggled",{enabled:b.multiEnabled})},b.getMultiPickEnabled=function(){return b.multiEnabled},b.hoverPick=function(a){return b._pick(a,!0,!1,!1,c,a.regionPick)},b.hoverOff=function(){Human.view.tooltips.clearTooltip()},b.pick=function(a){return b._pick(a,!1,!1,!1,c,a.regionPick)},b.doublePick=function(a){return b._pick(a,!1,!0,!1,c,a.regionPick)},b.queryPick=function(a){return b._pick(a,!1,!1,!0,a.rayPick||c,a.regionPick)},b._pick=function(c,e,f,g,h,i){var j,k,l,m,n,o,p=c.canvasX,q=c.canvasY,r=c.mouseDownLeft,s=c.mouseDownRight,t=c.spaceDown,u=c.ctrlDown;if(Human.assets.regionMaps.highlightRegion(null),g){if(j=Human.renderer.pick(p,q,h)){if(l=a(j.name)){var v=Human.utils.apply(j,{mode:"query",objectId:l.objectId,mouseDownLeft:r,mouseDownRight:s});return l.regionMap&&(j=Human.renderer.pick(p,q,h,!0),j&&(v.regionMapId=l.regionMap.regionMapId,v=Human.utils.apply(v,j))),Human.events.fire("pick.picked",v),v}return}}else if((b.singleEnabled||b.multiEnabled||Human.view.dissect.enabled||Human.view.annotations.enabled||Human.view.highlight.enabled)&&!Human.scene.checkTestStarted)if(e){if(j=Human.renderer.pick(p,q,h),j&&(l=a(j.name))){var w=Human.utils.apply(j,{mode:"hover",objectId:l.objectId}),x=l.displayName;l.regionMap&&(j=Human.renderer.pick(p,q,h,!0),j&&(d?k=null:(k=l.regionMap.regionMapId,w.regionMapId=k,w=Human.utils.apply(w,j)),o=j.color,Human.assets.regionMaps.highlightRegion({regionColor:o,regionMapId:k,highlight:!0}),j.regionData.name&&(x=j.regionData.name))),Human.view.tooltips.setTooltip({objectId:l.objectId,canvasX:p,canvasY:q,title:x}),Human.events.fire("pick.hoverPicked",w),Human.events.fire("pick.picked",w)}}else{if((Human.view.highlight.enabled||Human.view.xray.enabled)&&!Human.view.dissect.enabled&&!Human.view.annotations.enabled)if(j=Human.renderer.pick(p,q,h,i))if(l=a(j.name)){
  if(f)return void Human.view.focus.focusObject({objectId:l.objectId,replace:b.singleEnabled,showLabel:!0,select:!0,flyTo:"selectedLeafObjects"});if(Human.view.annotations.setLabelsShown({objects:{},type:"secondary",replace:!0}),t)return m={},m[l.objectId]=!0,void Human.view.annotations.setLabelsShown({objects:m,type:"secondary"});if(u)return m={},m[l.objectId]=!1,void Human.view.annotations.setLabelsShown({objects:m,type:"secondary"});Human.scene.selectedObjects[l.objectId]?Human.scene.setSelectedObjects({objectId:l.objectId,select:!Human.scene.selectedObjects[l.objectId],replace:!b.multiEnabled}):(Human.view.focus.focusObject({objectId:l.objectId,showLabel:!0,replace:!b.multiEnabled,flyTo:"none"}),Human.view.tooltips.setTooltip({objectId:l.objectId,canvasX:p,canvasY:q})),Human.events.fire("pick.picked",Human.utils.apply(j,{mode:Human.view.highlight.enabled?"highlight":"xray",objectId:l.objectId,mouseDownLeft:r,mouseDownRight:s}))}else n=Human.view.annotations.annotations[j.name],n&&n.pin.pick();else f&&(Human.view.xray.enabled||Human.scene.setSelectedObjects({select:!1,replace:!0}));if(Human.view.isolate.enabled&&!Human.view.dissect.enabled&&!Human.view.annotations.enabled&&(j=Human.renderer.pick(p,q,h),j&&(l=a(j.name)))){if(f)return void Human.view.focus.focusObject({objectId:l.objectId,showLabel:!0,select:!1,flyTo:"object"});Human.view.focus.focusObject({objectId:l.objectId,showLabel:!0,select:!1,flyTo:"none"}),Human.view.tooltips.setTooltip({objectId:l.objectId,canvasX:p,canvasY:q}),Human.events.fire("pick.picked",Human.utils.apply(j,{mode:"isolate",objectId:l.objectId}))}if(Human.view.dissect.enabled&&!Human.view.annotations.enabled){if(f)return;return j=Human.renderer.pick(p,q,h),void(j&&(l=a(j.name),l&&(Human.view.dissect.dissect(l.objectId),Human.events.fire("pick.picked",Human.utils.apply(j,{mode:"dissect",objectId:l.objectId})))))}if(Human.view.annotations.enabled){if(f)return;if(h=!0,j=Human.renderer.pick(p,q,h)){var y=j.name;l=Human.scene.objects[y],l||(n=Human.view.annotations.annotations[j.name],n&&n.pin.pick())}}else;}}}(),function(){"use strict";function a(a){a.onUpdate=function(a){g._onUpdate(a)},g.clips[a.clipId]=new Human.view.clip.Plane(a)}function b(){var a;for(var b in g.clips)if(g.clips.hasOwnProperty(b)&&(a=g.clips[b],a.state!==Human.view.clip.Plane.STATE_DORMANT&&0!==a.progress))return void c();d()}function c(){if(!n){var a=Human.renderer.getNode("clips"),b=a.parent,c=b.disconnectNodes();h.disconnect(),h.addNodes(c),b.addNode(h),n=!0;for(var d=0,f=Human.scene.rootObjects.length;f>d;d++)Human.scene.rootObjects[d].traverseDown(e);Human.events.fire("clips.activated")}}function d(){if(n){h.splice();var a=Human.renderer.getNode("assetLibraryRoot");if(!a)return void Human.log.error("Human.view.clip.deactivateClipsNode","Scene node not found: 'assetlibraryRoot'");a.addNode(h),n=!1;for(var b=0,c=Human.scene.rootObjects.length;c>b;b++)Human.scene.rootObjects[b].traverseDown(f);Human.events.fire("clips.deactivated")}}function e(a){a.isLeaf()&&a.setBackfaces(!0)}function f(a){a.isLeaf()&&a.setBackfaces(!1)}var g=Human.view.clip={};g.LEFT="left",g.RIGHT="right",g.TOP="top",g.BOTTOM="bottom",g.FRONT="front",g.BACK="back";var h,i,j,k=!1,l=!1,m=!0,n=!1;g.clips={},g.selectedClip=null,Human.events.on("loaded",function(){l=!1;var b=Human.renderer.getNode("assetLibraryRoot");return b?(h=b.addNode({type:"clips",clips:[{mode:"disabled",x:-1,y:0,z:0},{mode:"disabled",x:1,y:0,z:0},{mode:"disabled",x:0,y:-1,z:0},{mode:"disabled",x:0,y:1,z:0},{mode:"disabled",x:0,y:0,z:-1},{mode:"disabled",x:0,y:0,z:1}]}),a({index:0,type:g.LEFT,clipId:g.LEFT}),a({index:1,type:g.RIGHT,clipId:g.RIGHT}),a({index:2,type:g.TOP,clipId:g.TOP}),a({index:3,type:g.BOTTOM,clipId:g.BOTTOM}),a({index:4,type:g.FRONT,clipId:g.FRONT}),a({index:5,type:g.BACK,clipId:g.BACK}),void g.selectClip("front")):void Human.log.error("Human.view.clip.createClipsNode","Scene node not found: 'assetlibraryRoot'")}),g._onUpdate=function(a){var b={};b[""+a.index]={x:a.x,y:a.y,z:a.z,dist:a.dist,mode:a.clipping?"inside":"disabled"},h.setClips(b)},Human.events.on("tick",function(){i&&(g._updateClipForIsolatedObjects(),i=!1)}),g._updateClipForIsolatedObjects=function(){var a=Human.scene.objects,b=Human.scene.selectedObjects;for(var c in a)a.hasOwnProperty(c)&&a[c].setClippable(b[c]?!1:!0)},Human.events.on("Scene.Sleep",function(){var a;for(var b in g.clips)g.clips.hasOwnProperty(b)&&(a=g.clips[b],a.state===Human.view.clip.Plane.STATE_VISIBLE&&(a.framesUntilHide>0?a.framesUntilHide--:Human.view.clip.setClip({clipId:a.clipId,state:Human.view.clip.Plane.STATE_CLIPPING})))}),Human.events.on("scene.objectsSelected",function(){i=!0}),Human.events.on("scene.objectsShown",function(){m=!0;for(var a in g.clips)if(g.clips.hasOwnProperty(a)){var b=g.clips[a];b.state!==Human.view.clip.Plane.STATE_DORMANT&&g._configureClip(b)}}),g.setClip=function(a){var c;if(a.clipId){if(c=g.clips[a.clipId],!c)return void Human.log.error("Human.view.clip.setClip","Clip plane not found: '"+a.clipId+"'")}else{if(!g.selectedClip)return void Human.log.error("Human.view.clip.setClip","Parameter expected: 'clipId'");c=g.selectedClip}if(a.state&&a.state!==Human.view.clip.Plane.STATE_DORMANT&&a.state!==Human.view.clip.Plane.STATE_ACTIVE&&a.state!==Human.view.clip.Plane.STATE_CLIPPING&&a.state!==Human.view.clip.Plane.STATE_VISIBLE)return void Human.log.error("Human.view.clip.setClip","State not recognized: '"+a.state+"'");var d=c.state,e=a.state||d;switch(e){case Human.view.clip.Plane.STATE_DORMANT:c._setClipping(!1),c._setVisible(!1);break;case Human.view.clip.Plane.STATE_ACTIVE:g._configureClip(c,a),c._setClipping(!1),c._setVisible(!1);break;case Human.view.clip.Plane.STATE_CLIPPING:switch(c._setClipping(!0),c._setVisible(!1),d){case Human.view.clip.Plane.STATE_DORMANT:g._configureClip(c,a);break;default:void 0!==a.progress&&c._setProgress(a.progress)}break;case Human.view.clip.Plane.STATE_VISIBLE:switch(c._setClipping(!0),c._setVisible(!0),d){case Human.view.clip.Plane.STATE_DORMANT:g._configureClip(c,a);break;default:void 0!==a.progress&&c._setProgress(a.progress)}}c.state=e,Human.events.fire("clip.updated",{clipId:c.clipId,state:c.state,progress:c.progress}),b()},g._configureClip=function(a,b){b=b||{},m&&(j=Human.scene.getBoundary({objects:Human.scene.enabledObjects}),m=!1);var c,d,e,f,h=.5*(j.xmin+j.xmax),i=.5*(j.ymin+j.ymax),k=.5*(j.zmin+j.zmax);switch(a.type){case g.LEFT:c={x:j.xmax,y:i,z:k},d={y:1,angle:-90},e={x:j.zmax-j.zmin,y:j.ymax-j.ymin},f={min:j.xmin,max:j.xmax};break;case g.RIGHT:c={x:j.xmin,y:i,z:k},d={y:1,angle:90},e={x:j.zmax-j.zmin,y:j.ymax-j.ymin},f={min:j.xmin,max:j.xmax};break;case g.FRONT:c={x:h,y:i,z:j.zmin},d={y:1,angle:0},e={x:j.xmax-j.xmin,y:j.ymax-j.ymin},f={min:j.zmin,max:j.zmax};break;case g.BACK:c={x:-h,y:i,z:j.zmax},d={y:1,angle:180},e={x:j.xmax-j.xmin,y:j.ymax-j.ymin},f={min:j.zmin,max:j.zmax};break;case g.TOP:c={x:h,y:j.ymax,z:k},d={x:1,angle:90},e={x:j.xmax-j.xmin,y:j.zmax-j.zmin},f={min:j.ymin,max:j.ymax};break;case g.BOTTOM:c={x:h,y:j.ymin,z:k},d={x:1,angle:-90},e={x:j.xmax-j.xmin,y:j.zmax-j.zmin},f={min:j.ymin,max:j.ymax};break;default:c=b.pos,d=b.dir,e=b.size,f=b.range}a._setPos(c),a._setDir(d),a._setRange(f),a._setSize(e),void 0!==b.progress&&a._setProgress(b.progress)},g.selectClip=function(a){var b;return a&&(b=g.clips[a],!b)?void Human.log.error("Human.view.clip.selectClip","Clip plane not found: '"+a+"'"):void(g.selectedClip=b)},g.reset=function(){var a;for(var b in g.clips)g.clips.hasOwnProperty(b)&&(a=g.clips[b],g.setClip({clipId:a.clipId,state:Human.view.clip.Plane.STATE_DORMANT}),g._configureClip(a));k&&g.selectClip("front"),Human.events.fire("CrossSections.Reset")}}(),function(){"use strict";var a=mat4.create(),b=vec3.fromValues(-1,-1,0),c=vec3.fromValues(1,-1,0),d=vec3.fromValues(1,1,0);Human.view.clip.Plane=function(a){this.index=a.index,this.clipId=a.clipId,this.type=a.type,this.state=Human.view.clip.Plane.STATE_DORMANT,this.framesUntilHide=1;var b=a.pos||{};this.pos={x:b.x||0,y:b.y||0,z:b.z||0};var c=a.dir||{};this.dir={x:c.x||0,y:c.y||0,z:c.z||0,angle:c.angle||0};var d=a.size||{};this.size={x:d.x||10,y:d.y||10};var e=a.range||{};this.range={min:e.min||0,max:e.max||0},this.progress=0;var f=a.clipId+".indicator.flags",g=a.clipId+".indicator.xf";this.visible=a.visible||!1,this.clipping=a.clipping||!1,this._onUpdate=a.onUpdate,Human.renderer.getNode(Human.CLIP_INDICATORS_ATTACH_ID).addNode({type:"properties",id:f,properties:{enabled:this.visible,transparent:!0,backfaces:!0,clipping:!1,picking:!1},nodes:[{type:"xform",id:g,nodes:[{type:"material",emit:.9,baseColor:{r:.3,g:.3,b:.4},specularColor:{r:.3,g:.3,b:.4},specular:0,shine:100,alpha:.2,nodes:[{type:"geometry/plane",width:2,height:2}]},{type:"material",emit:.9,baseColor:{r:.3,g:.3,b:.4},specularColor:{r:.3,g:.3,b:.4},specular:0,shine:100,alpha:.9,nodes:[{type:"geometry",primitive:"lines",positions:[1,1,1,1,-1,1,-1,-1,1,-1,1,1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1],indices:[0,1,1,2,2,3,3,0]}]}]}]}),this.indicatorFlagsNode=Human.renderer.getNode(f),this.indicatorXFormNode=Human.renderer.getNode(g),this._updatePosition()};var e=vec3.create(),f=vec3.create(),g=vec3.create(),h=vec3.create(),i=mat4.create(),j=mat4.create(),k=vec3.create(),l=vec3.create();Human.view.clip.Plane.prototype._updatePosition=function(){var m=this.progress*(this.range.max-this.range.min),n=[this.pos.x,this.pos.y,this.pos.z];switch(this.type){case Human.view.clip.BACK:n[2]=this.range.max-m;break;case Human.view.clip.FRONT:n[2]=this.range.min+m;break;case Human.view.clip.LEFT:n[0]=this.range.max-m;break;case Human.view.clip.RIGHT:n[0]=this.range.min+m;break;case Human.view.clip.TOP:n[1]=this.range.max-m;break;case Human.view.clip.BOTTOM:n[1]=this.range.min+m}mat4.fromTranslation(a,n),mat4.fromRotation(i,this.dir.angle*Math.PI/180,[this.dir.x,this.dir.y,this.dir.z]),mat4.fromScaling(j,[.5*this.size.x,.5*this.size.y,0]),mat4.multiply(a,a,i),mat4.multiply(a,a,j),this.indicatorXFormNode.setElements(a),vec3.transformMat4(e,b,a),vec3.transformMat4(f,c,a),vec3.transformMat4(g,d,a),vec3.subtract(k,f,e),vec3.normalize(k,k),vec3.subtract(l,f,g),vec3.normalize(l,l),vec3.cross(h,k,l),vec3.normalize(h,h);var o=vec3.dot(h,e);this.x=h[0],this.y=h[1],this.z=h[2],this.dist=o,this._onUpdate(this)},Human.view.clip.Plane.STATE_DORMANT="dormant",Human.view.clip.Plane.STATE_ACTIVE="active",Human.view.clip.Plane.STATE_CLIPPING="clipping",Human.view.clip.Plane.STATE_VISIBLE="visible",Human.view.clip.Plane.prototype._setPos=function(a){a=a||{},this.pos={x:a.x||0,y:a.y||0,z:a.z||0},this._updatePosition()},Human.view.clip.Plane.prototype._setDir=function(a){a=a||{},this.dir={x:a.x||0,y:a.y||0,z:a.z||0,angle:a.angle||0},this._updatePosition()},Human.view.clip.Plane.prototype._setRange=function(a){a=a||{},this.range={min:a.min||0,max:a.max||0},this._updatePosition()},Human.view.clip.Plane.prototype._setProgress=function(a){this.progress!==a&&(0>a?(a=0,this._setClipping(!1)):a>1?(a=1,this._setClipping(!1)):this._setClipping(!0),this.progress=a,this._updatePosition())},Human.view.clip.Plane.prototype._setSize=function(a){a=a||{},this.size={x:a.x||10,y:a.y||10},this._updatePosition()},Human.view.clip.Plane.prototype._setVisible=function(a){this.framesUntilHide=a?1:0,this.visible!==a&&(this.indicatorFlagsNode.setEnabled(a),this.visible=a)},Human.view.clip.Plane.prototype._setMode=function(a){this.mode!==a&&(this.mode=a,this._onUpdate(this))},Human.view.clip.Plane.prototype._setClipping=function(a){this.clipping!==a&&(this.clipping=a,this._onUpdate(this))}}(),function(){"use strict";var a=Human.view.lights={};a.lights={},a.defaultLightIds=[];var b=!1;Human.events.on("loaded",function(){a.addLight({lightId:"light0",enabled:!0,displayName:"Default ambient",description:"Default ambient light source",params:{mode:"ambient",color:{r:.15,g:.15,b:.15},diffuse:!0}}),a.defaultLightIds.push("light0"),a.addLight({lightId:"light2",enabled:!0,displayName:"Default directional",description:"Default directional light source",params:{mode:"dir",color:{r:1.3,g:1.3,b:1.2},dir:{x:-1,y:0,z:1},diffuse:!0,specular:!0,space:"view"}}),a.defaultLightIds.push("light2"),a.addLight({lightId:"light3",enabled:!0,displayName:"Default directional",description:"Default directional light source",params:{mode:"dir",color:{r:.5,g:.5,b:.5},dir:{x:1.1,y:0,z:1},diffuse:!0,specular:!0,space:"view"}}),a.defaultLightIds.push("light3"),a.addLight({lightId:"light4",enabled:!0,displayName:"Default directional",description:"Default directional light source",params:{mode:"dir",color:{r:1.1,g:1.1,b:1.05},dir:{x:-.05,y:0,z:-1},diffuse:!0,specular:!0,space:"view"}}),a.defaultLightIds.push("light4")}),Human.events.on("tick",function(){a.compile()}),a.addLight=function(c){var d=new Human.view.lights.Light(c);a.lights[c.lightId]=d,d.on("enabled",function(){b=!0}),b=!0},a.removeLight=function(c){a.lights[c]&&(delete a.lights[c],b=!0)},a.removeAllLights=function(){a.lights={},b=!0},a.setEnabled=function(c){c.replace&&a.clearEnabled();var d,e,f;if(c.lightId){if(d=c.lightId,e=a.lights[d],!e)return void Human.log.error("Human.view.lights.setEnabled","Light not found: "+d);f=!!c.enable,e.enabled!==f&&(e.enabled=f,b=!0)}else if(c.lights){var g=c.lights;for(d in g)if(g.hasOwnProperty(d)){if(e=a.lights[d],!e){Human.log.error("Human.view.lights.setEnabled","Light not found: "+d);continue}f=!!g[d],e.enabled!==f&&(e.enabled=f,b=!0),f&&"boolean"!=typeof f&&e.setParams(f)}}},a.clearEnabled=function(){for(var c in a.lights)a.lights.hasOwnProperty(c)&&(a.lights[c].setEnabled(!1),b=!0)},a.setParams=function(b){var c;for(var d in b)if(b.hasOwnProperty(d)){if(c=a.lights[d],!c){Human.log.error("Human.view.lights.setParams","Light not found: "+d);continue}c.setParams(b[d])}},a.restoreDefaults=function(){var b={lights:{},replace:!0};a.defaultLightIds.forEach(function(a){b.lights[a]=!0}),a.setEnabled(b)},a.compile=function(){if(b){var c=Human.renderer.getScene();c.getNode("lights",function(b){c.getNode("lights.subtree",function(d){d.disconnect(),b.removeNodes();var e,f,g=[];for(f in a.lights)a.lights.hasOwnProperty(f)&&(e=a.lights[f],e.enabled&&e.params&&g.push(e.params||{}));var h=b.addNode({type:"lights",lights:g.slice(0),nodes:[{id:"lightsSubTree"}]}),i=0;for(f in a.lights)a.lights.hasOwnProperty(f)&&(e=a.lights[f],e.node=h,e.index=i++);c.getNode("lightsSubTree",function(a){a.addNode(d)})})}),b=!1}}}(),function(){"use strict";Human.view.lights.Light=function(a){this._init(),this.displayName=a.displayName,this.description=a.description,this.lightId=a.lightId,this.enabled=!!a.enabled,this.params=a.params||{},this.node=null,this.index=0},Human.utils.extend(Human.view.lights.Light,Human.Component),Human.view.lights.Light.prototype.setEnabled=function(a){this.publish("enabled",this.enabled=a)},Human.view.lights.Light.prototype.setParams=function(a){if(Human.utils.apply(a,this.params),this.node){var b={};b[""+this.index]=a,this.node.setLights(b)}}}(),function(){"use strict";function a(a){return function(b){a.node=b}}var b=Human.view.effects={};b.pipeline=[],b.effects={};var c=!1;Human.events.on("loaded",function(){b.addEffect({effectId:"dof",type:"postprocess/dof",displayName:"Depth-of-field",description:"Simulates photographic depth-of-field",params:{texelSize:22e-5,blurCoeff:.0084,ppm:1e4,autofocus:!0}}),b.addEffect({effectId:"sepia",type:"postprocess/sepia",displayName:"Sepia",description:"Sepia color filter"}),b.addEffect({effectId:"scanlines",type:"postprocess/scanlines",displayName:"Scanlines",description:"Scan lines pattern"}),b.addEffect({effectId:"filmGrain",type:"postprocess/filmGrain",displayName:"Film Grain",description:"Film grain noise"}),b.addEffect({effectId:"technicolor",type:"postprocess/technicolor",displayName:"Technicolor",description:"Technicolor color filter"}),b.addEffect({effectId:"oculusRift",type:"effects/oculusRift",displayName:"Oculus Rift",description:"View using Oculus Rift",params:{eyeSep:20.6,focalLength:27}}),b.addEffect({effectId:"stereo",type:"effects/stereo",displayName:"Stereo",description:"View in stereo"}),b.addEffect({effectId:"anaglyph",type:"effects/anaglyph",displayName:"Anaglyph 3D",description:"View in Anaglyph 3D"})}),Human.events.on("tick",function(){b.compile()}),b.addEffect=function(a){var d=new Human.view.effects.Effect(a);b.effects[a.effectId]=d,b.pipeline.unshift(d),d.on("enabled",function(){c=!0}),c=!0},b.setEnabled=function(a){var d;if(a.replace)for(var e=0,f=b.pipeline.length;f>e;e++)b.pipeline[e].enabled=!1;var g;if(a.effectId){if(d=a.effectId,g=b.effects[d],!g)return void Human.log.error("Human.view.effects.setEnabled","Effect not found: "+d);g.enabled=!!a.enable}else if(a.effectIds){var h,i=a.effectIds;for(d in i)if(i.hasOwnProperty(d)){if(g=b.effects[d],!g){Human.log.error("Human.view.effects.setEnabled","Effect not found: "+d);continue}h=i[d],g.enabled=!!h,h&&"boolean"!=typeof h&&g.setParams(h)}}c=!0},b.clearEnabled=function(){for(var a=0,d=b.pipeline.length;d>a;a++)b.pipeline[a].enabled=!1;c=!0},b.setParams=function(a){var c;for(var d in a)if(a.hasOwnProperty(d)){if(c=b.effects[d],!c){Human.log.error("Human.view.effects.setParams","Effect not found: "+d);continue}c.setParams(a[d])}};var d={anaglyph:!1,dof:!1,filmGrain:!1,oculusRift:!1,scanlines:!1,sepia:!1,stereo:!1,technicolor:!1};b.getDefaults=function(){return Human.utils.shallowClone(d)},b.compile=function(){if(c){var d=Human.renderer.getScene();d.getNode("effect",function(c){d.getNode("effect.subtree",function(e){e.disconnect(),c.removeNodes();for(var f,g={nodes:[]},h=g,i=0,j=b.pipeline.length;j>i;i++)if(f=b.pipeline[i],f.enabled){var k=Human.utils.applyIf(f.params,{type:f.type,id:"__effects."+f.effectId,nodes:[]});h.nodes.push(k),h=k,d.getNode("__effects."+f.effectId,a(f))}else f.node=null;h.nodes.push({id:"effectsSubTree"}),c.addNode(g),d.getNode("effectsSubTree",function(a){a.addNode(e)})})}),c=!1}}}(),function(){"use strict";Human.view.effects.Effect=function(a){this._init(),this.effectId=a.effectId,this.type=a.type,this.displayName=a.displayName,this.description=a.description,this.enabled=!1,this.params=a.params||{},this.node=null},Human.utils.extend(Human.view.effects.Effect,Human.Component),Human.view.effects.Effect.prototype.setEnabled=function(a){this.publish("enabled",this.enabled=a)},Human.view.effects.Effect.prototype.setParams=function(a){Human.utils.apply(a,this.params),this.node&&this.node.set(a)}}(),function(){"use strict";function a(){c();var a,d,e,f,g,h,r={x:!1,y:!1,z:!1};o=0,p=0,q=0;for(a in Human.scene.enabledObjects)if(Human.scene.enabledObjects.hasOwnProperty(a)&&(d=Human.scene.enabledObjects[a],0===d.objects.length)){for(;d&&d.anonymous;)d=d.parent;d&&d.parent&&!b(d)&&(i[n]=d,j[d.objectId]=d,e=k[n],h=d.translate||{x:0,y:0,z:0},e?(e.x=h.x,e.y=h.y,e.z=h.z):e=k[n]={x:h.x,y:h.y,z:h.z},f=d.getCenter(),o+=f[0],p+=f[1],q+=f[2],l[n]=f,n++)}if(n>1){o/=n,p/=n,q/=n;for(var s=0;n>s;s++)f=l[s],d=i[s],d.parent.getNegatedAxes(r),m[s]||(m[s]=[0,0,0]),g=vec3.normalize(m[s],[f[0]-o,f[1]-p,f[2]-q]),r.x&&(g[0]*=-1),r.y&&(g[1]*=-1),r.z&&(g[2]*=-1),m[s]=g}u=!1}function b(a){for(;a;){if(j[a.objectId])return!0;a=a.parent}return!1}function c(){for(var a=0;n>a;a++)delete j[i[a].objectId];n=0}var d,e,f,g=Human.view.explode={},h=.5,i=[],j={},k=[],l=[],m=[],n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=!0,v=0,w=1,x=2,y=v,z=!1;Human.events.on("scene.objectsShown",function(){g.reset()}),Human.events.on("timeline.played",function(){(y===w||y===x)&&g.reset()}),Human.events.on("timeline.scrubbed",function(){(y===w||y===x)&&g.reset()}),Human.events.on("tick",function(b){if(z){u&&a();var c=.001*(b.timeNow-b.timeLast),g=c*h,j=0>d-r?-1:1,l=0>e-s?-1:1,o=0>f-t?-1:1;r+=g*j,s+=g*l,t+=g*o;var p=0,q=0;j>0&&r>d&&(r=d,p++),0>j&&0>r&&(r=0,q++),l>0&&s>e&&(s=e,p++),0>l&&0>s&&(s=0,q++),o>0&&t>f&&(t=f,p++),0>o&&0>t&&(t=0,q++),3===p?(y=x,z=!1):3===q&&(y=v,z=!1);for(var w,A,B=0;n>B;B++)w=k[B],A=m[B],i[B].setTransform({translate:{x:w.x+A[0]*r,y:w.y+A[1]*s,z:w.z+A[2]*t}});Human.events.fire("explode.updated",{scale:Math.round((r+s+t)/3),speed:h})}}),g.explode=function(a){a=a||{};var b=a.scale;Human.utils.isArray(b)?(d=b[0],e=b[1],f=b[2]):(b=b||0,0>b&&(b=0),d=b,e=b,f=b),0>d&&(d=0),0>e&&(e=0),0>f&&(f=0),h=a.speed||1,0>h&&(h=1),Human.timeline.stop(),y=w,z=!0},g.reset=function(){r=0,s=0,t=0,d=0,e=0,f=0,n&&this._resetPositions(),y=v,c(),u=!0,z=!1,Human.events.fire("explode.reseted",{scale:0,speed:h})},g._resetPositions=function(){for(var a,b=0;n>b;b++)a=k[b],i[b].setTransform({translate:a})}}(),function(){"use strict";function a(a){$(a.target).is("canvas")&&(a.stopPropagation(),a.preventDefault())}function b(a){var b={x:0,y:0};if(a){for(var c=a.target,d=0,e=0;c.offsetParent;)d+=c.offsetLeft,e+=c.offsetTop,c=c.offsetParent;b.x=a.pageX-d,b.y=a.pageY-e}else a=window.event,b.x=a.x,b.y=a.y;return b}function c(a){a.preventDefault(),a.stopPropagation();var b=[],c=!1,d=!1,e=0,f=0,g=0,h=0,i=0,j=a.touches,k=a.changedTouches,l=H.getCoordiantes(j);M=l;var m,n=Date.now(),o=function(){return{touches:l,xDelta:e,yDelta:f,distanceX:S,distanceY:T,elapse:g,xSpeed:h,ySpeed:i}},p=function(a,b){b=b||o();for(var c=0;c<a.length;c++)a[c](b)};if("touchmove"===a.type&&O){var q=n-O;if(25>=q)return}switch(a.type){case"touchstart":V=1===a.touches.length&&1===k.length,V?(F=n,O=null):F=null,G=n,O=2===j.length?n:null,L.length=0,L=L.concat(l),P=l[0],Q=l[0];var B=l.length>1;B?R=l:(b.push(r),R=[]);break;case"touchmove":var C=2===l.length&&2===R.length;if(C){O=n;var D=Math.abs(R[0].x-R[1].x),E=Math.abs(R[0].y-R[1].y),I=Math.abs(l[0].x-l[1].x),J=Math.abs(l[0].y-l[1].y),K=l[0].x-R[0].x,W=l[0].y-R[0].y,X=l[1].x-R[1].x,Y=l[1].y-R[1].y;e=(K+X)/2,f=(W+Y)/2,S=Math.abs(l[0].x-l[1].x),T=Math.abs(l[0].y-l[1].y);var Z=Math.sqrt(Math.pow(D,2)+Math.pow(E,2)),$=Math.sqrt(Math.pow(I,2)+Math.pow(J,2)),_=Math.abs(Z-$);U=5>=_;var aa=0>K&&X>0||K>0&&0>X,ba=0>W&&Y>0||W>0&&0>Y;U?(e=(K+X)/2,f=(W+Y)/2,b.push(v)):(aa||ba)&&(D>I&&E>J?b.push(t):I>D&&J>E&&b.push(u)),R=l.concat([])}else{if(e=l[0].x-Q.x,f=l[0].y-Q.y,O){var ca=n-O;ca>250&&b.push(s)}else b.push(s);R=[],O=null}Q=l[0];break;case"touchend":V=V&&0===a.touches.length&&1===k.length,c=!1,d=!1,V?(c=z>n-F,c&&(N&&(d=A>F-N),d||(N=n))):(c=!1,d=!1,F=null,N=null),g=n-G,R.length<=1&&b.push(w),e=Q.x-P.x,f=Q.y-P.y,h=Math.abs(e)/g,i=Math.abs(f)/g}for(m=0;m<b.length;m++)for(var da=b[m],ea=0;ea<da.length;ea++)p(da);if(c||d){var fa=o();fa.touches=L,c&&p(x,fa),d&&p(y,fa)}}var d=Human.input={},e=Human.renderer.canvas.annotationCanvas,f=[],g=[],h={},i={},j=[],k=[],l=[],m=[],n=[],o=[],p=[],q=!0,r=[],s=[],t=[],u=[],v=[],w=[],x=[],y=[],z=250,A=325,B=jQuery(document);B.ready(function(){B.bind("contextmenu",function(a){return"snapshotPanelImage"!==a.target.id&&"input"!==a.target.type&&"email"!==a.target.type&&"text"!==a.target.type&&"textarea"!==a.target.type?!1:void 0})});var C={altDown:!1,ctrlDown:!1,keyDown:[],onTick:function(a){g.push(a)},onKeyDown:function(a,b){for(var c,d=0,e=a.length;e>d;d++)c=a[d],(h[c]||(h[c]=[])).push(b)},onKeyUp:function(a,b){for(var c,d=0,e=a.length;e>d;d++)c=a[d],(i[c]||(i[c]=[])).push(b)},onMouseDown:function(a){j.push(a)},onMouseUp:function(a){k.push(a)},onMouseClick:function(a){l.push(a)},onMouseDoubleClick:function(a){m.push(a)},onMouseMove:function(a){n.push(a)},onMouseWheel:function(a){o.push(a)},onReset:function(a){p.push(a)},onTouchStart:function(a){r.push(a)},onTouchMove:function(a){s.push(a)},onTouchEnd:function(a){w.push(a)},onTouchTap:function(a){x.push(a)},onTouchDoubleTap:function(a){y.push(a)},onTouchPinch:function(a){t.push(a)},onTouchZoom:function(a){u.push(a)},onTouchPan:function(a){v.push(a)}},D=null;Human.events.on("tick",function(){if(!q)return void(D=null);var a=Date.now()/1e3;if(null!==D)for(var b=a-D,c=0,d=g.length;d>c;c++)g[c](a,b);D=a}),document.addEventListener("keydown",function(a){if(q&&"INPUT"!==a.target.tagName&&"TEXTAREA"!==a.target.tagName){C.ctrlDown=a.ctrlKey||17===a.keyCode||a.metaKey,C.altDown=a.altKey||18===a.keyCode,C.keyDown[a.keyCode]=!0;var b=a.keyCode,c=h[b];if(c)for(var d=0,e=c.length;e>d;d++)c[d](b)}},!0),document.addEventListener("keyup",function(a){if(q&&"INPUT"!==a.target.tagName&&"TEXTAREA"!==a.target.tagName){(a.ctrlKey||17===a.keyCode)&&(C.ctrlDown=!1),(a.altKey||18===a.keyCode)&&(C.altDown=!1),C.keyDown[a.keyCode]=!1;var b=a.keyCode,c=i[b];if(c)for(var d=0,e=c.length;e>d;d++)c[d](b)}}),e.mousedown(function(a){switch(a.which){case 1:C.mouseDownLeft=!0;break;case 2:C.mouseDownMiddle=!0;break;case 3:C.mouseDownRight=!0}var c=b(a);C.mouseDownX=c.x,C.mouseDownY=c.y;for(var d=c.x,e=c.y,f=0,g=j.length;g>f;f++)j[f](d,e)}),e.mouseup(function(a){switch(a.which){case 1:C.mouseDownLeft=!1;break;case 2:C.mouseDownMiddle=!1;break;case 3:C.mouseDownRight=!1}for(var c=b(a),d=c.x,e=c.y,f=0,g=k.length;g>f;f++)k[f](d,e)}),e.click(function(a){for(var c=b(a),d=c.x,e=c.y,f=0,g=l.length;g>f;f++)l[f](d,e)}),e.dblclick(function(a){switch(a.which){case 1:C.mouseDownLeft=!1,C.mouseDownRight=!1;break;case 2:C.mouseDownMiddle=!1;break;case 3:C.mouseDownLeft=!1,C.mouseDownRight=!1}for(var c=b(a),d=c.x,e=c.y,f=0,g=m.length;g>f;f++)m[f](d,e)}),e.mousemove(function(a){for(var c=b(a),d=c.x,e=c.y,f=0,g=n.length;g>f;f++)n[f](d,e)}),e.bind("mousewheel",function(a,b){for(var c=0,d=o.length;d>c;c++)o[c](a,b)}),Human.properties.subscribe({propId:"ui.mouseWheel.capture",value:!0,callback:function(b){B[b?"on":"off"]("mousewheel.capture",a)}});var E={EVENTS:"mousedown mouseup keydown keypress",handler:function(){return!1},block:function(){$('<div class="block-ui"></div>').css({position:"absolute",top:0,left:0,width:"100%",height:"100%","z-index":1e3}).appendTo("body"),B.on(this.EVENTS,this.handler)},unblock:function(){$("body > .block-ui").remove(),B.off(this.EVENTS,this.handler)}};d.addHandler=function(a){f.push(new a(C))},d.setEnabled=function(a){q!==a&&(a?E.unblock():E.block(),q=a,Human.events.fire(a?"inputEnabled":"inputDisabled",{}))};var F,G,H=Human.input.touch={},I=!1,J=["touchstart","touchmove","touchend"],K="container",L=[],M=[],N=null,O=null,P=null,Q=null,R=[],S=0,T=0,U=!1;H.isSupported=function(){return"ontouchstart"in window},H.setEnabled=function(a){a===!0?I!==!0&&H._bindHandlers():I===!0&&H._unbindHandlers(),I=a===!0},H._getTouchContainer=function(){return document.getElementById(K)};var V=!1;H._bindHandlers=function(){var a=H._getTouchContainer();if(a){H._unbindHandlers();for(var b=0;b<J.length;b++)a.addEventListener(J[b],c,!1)}},H._unbindHandlers=function(){var a=H._getTouchContainer();if(a)for(var b=0;b<J.length;b++)a.removeEventListener(J[b],c,!1)},H.getCoordiantes=function(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];b.push({x:e.pageX,y:e.pageY})}return b};var W=H.isSupported();H.setEnabled(W),d.KEY_BACKSPACE=8,d.KEY_TAB=9,d.KEY_ENTER=13,d.KEY_SHIFT=16,d.KEY_CTRL=17,d.KEY_ALT=18,d.KEY_PAUSE_BREAK=19,d.KEY_CAPS_LOCK=20,d.KEY_ESCAPE=27,d.KEY_PAGE_UP=33,d.KEY_PAGE_DOWN=34,d.KEY_END=35,d.KEY_HOME=36,d.KEY_LEFT_ARROW=37,d.KEY_UP_ARROW=38,d.KEY_RIGHT_ARROW=39,d.KEY_DOWN_ARROW=40,d.KEY_INSERT=45,d.KEY_DELETE=46,d.KEY_NUM_0=48,d.KEY_NUM_1=49,d.KEY_NUM_2=50,d.KEY_NUM_3=51,d.KEY_NUM_4=52,d.KEY_NUM_5=53,d.KEY_NUM_6=54,d.KEY_NUM_7=55,d.KEY_NUM_8=56,d.KEY_NUM_9=57,d.KEY_A=65,d.KEY_B=66,d.KEY_C=67,d.KEY_D=68,d.KEY_E=69,d.KEY_F=70,d.KEY_G=71,d.KEY_H=72,d.KEY_I=73,d.KEY_J=74,d.KEY_K=75,d.KEY_L=76,d.KEY_M=77,d.KEY_N=78,d.KEY_O=79,d.KEY_P=80,d.KEY_Q=81,d.KEY_R=82,d.KEY_S=83,d.KEY_T=84,d.KEY_U=85,d.KEY_V=86,d.KEY_W=87,d.KEY_X=88,d.KEY_Y=89,d.KEY_Z=90,d.KEY_LEFT_WINDOW=91,d.KEY_RIGHT_WINDOW=92,d.KEY_SELECT_KEY=93,d.KEY_NUMPAD_0=96,d.KEY_NUMPAD_1=97,d.KEY_NUMPAD_2=98,d.KEY_NUMPAD_3=99,d.KEY_NUMPAD_4=100,d.KEY_NUMPAD_5=101,d.KEY_NUMPAD_6=102,d.KEY_NUMPAD_7=103,d.KEY_NUMPAD_8=104,d.KEY_NUMPAD_9=105,d.KEY_MULTIPLY=106,d.KEY_ADD=107,d.KEY_SUBTRACT=109,d.KEY_DECIMAL_POINT=110,d.KEY_DIVIDE=111,d.KEY_F1=112,d.KEY_F2=113,d.KEY_F3=114,d.KEY_F4=115,d.KEY_F5=116,d.KEY_F6=117,d.KEY_F7=118,d.KEY_F8=119,d.KEY_F9=120,d.KEY_F10=121,d.KEY_F11=122,d.KEY_F12=123,d.KEY_NUM_LOCK=144,d.KEY_SCROLL_LOCK=145,d.KEY_SEMI_COLON=186,d.KEY_EQUAL_SIGN=187,d.KEY_EQUAL_SIGN_FIREFOX=61,d.KEY_DASH_FIREFOX=173,d.KEY_COMMA=188,d.KEY_DASH=189,d.KEY_PERIOD=190,d.KEY_FORWARD_SLASH=191,d.KEY_GRAVE_ACCENT=192,d.KEY_OPEN_BRACKET=219,d.KEY_BACK_SLASH=220,d.KEY_CLOSE_BRAKET=221,d.KEY_SINGLE_QUOTE=222,d.KEY_SPACE=32}(),Human.input.addHandler(function(a){"use strict";var b,c,d,e=!1,f=null,g=null,h=Human.view.annotations;a.onMouseClick(function(a,i){if(e){if(c=d.name,b=Human.scene.objects[c]){var j=Human.view.camera.eye,k=new Float32Array(3);k[0]=j.x-d.worldPos[0],k[1]=j.y-d.worldPos[1],k[2]=j.z-d.worldPos[2],vec3.normalize(k,k),Human.view.annotations.createAnnotation({objectId:c,title:"",description:"",pos:d.worldPos,dir:k,primitiveIndex:d.primitiveIndex,barycentric:d.barycentric,enabled:!0,shown:!0,labelShown:!0,labelOffset:[a-d.canvasPos[0],i-d.canvasPos[1]-30],saved:!1})}Human.view.annotations.clearWire(),d=!1,e=!1}else f=a,g=i,h.enabled&&(d=Human.view.pick.queryPick({canvasX:a,canvasY:i,rayPick:!0}),d&&(c=d.name,b=Human.scene.objects[c],b&&(e=!0,Human.view.annotations.drawWire(a,i,a,i),d.objectId=c,d.pos=d.worldPos,Human.events.fire("annotations.pinning",d))))}),a.onMouseMove(function(a,b){e&&Human.view.annotations.drawWire(f,g,a,b)})}),function(){"use strict";var a=Human.view.camera.rotateSceneX,b=Human.view.camera.rotateSceneY,c=!1;Human.properties.subscribe({propId:"input.cameraFirstPerson",value:c,callback:function(d){c=d,c&&(a=Human.view.camera.rotateLookX,b=Human.view.camera.rotateLookY)}});var d=!1;Human.properties.subscribe({propId:"input.cameraRotateScene",value:d,callback:function(e){d=e,c||(d?(a=Human.view.camera.rotateSceneX,b=Human.view.camera.rotateSceneY):(a=Human.view.camera.rotateX,b=Human.view.camera.rotateY))}});var e=!0;Human.properties.subscribe({propId:"input.mouseOrbitPan",value:"orbit",callback:function(a){e="orbit"===a}}),Human.input.addHandler(function(c){var d,f,g=.5,h=.2,i=0,j=0,k=!1,l=vec3.create(),m=vec3.create(),n=vec3.create();c.onMouseDown(function(a,b){k=!0,d=a,f=b}),c.onMouseUp(function(){k=c.mouseDownLeft||c.mouseDownMiddle||c.mouseDownRight}),c.onMouseMove(function(a,b){k&&(i+=(a-d)*g,j+=(b-f)*g,d=a,f=b)}),c.onTick(function(){if(Math.abs(i)>0||Math.abs(j)>0){var d=c.keyDown[Human.input.KEY_SHIFT]||c.mouseDownMiddle||c.mouseDownLeft&&c.mouseDownRight,f=d?!e:e;if(f)b(-i*g),a(j*g);else{var k=Human.view.camera,o=k.eye,p=k.look;l[0]=o.x,l[1]=o.y,l[2]=o.z,m[0]=p.x,m[1]=p.y,m[2]=p.z,vec3.subtract(n,l,m);var q=Math.abs(vec3.length(n)),r=q/50;r*=h,Human.view.camera.pan({x:i*r,y:j*r})}i=0,j=0}})});var f=!0;Human.properties.subscribe({propId:"ui.zoom.mouseWheel.enabled",value:f,callback:function(a){f=!!a}}),Human.input.addHandler(function(a){var b,c=0,d=0,e=!1,g=!1,h=0,i=.2,j=vec3.create(),k=vec3.create(),l=vec3.create(),m=!1;a.onKeyDown([Human.input.KEY_ALT],function(){m=!0}),a.onKeyUp([Human.input.KEY_ALT],function(){m=!1}),a.onMouseWheel(function(a,b){f&&(m||(c=-b,0===c?(g=!1,e=!1):e=!0))}),a.onTick(function(a){if(f){var m=Human.view.camera,n=m.eye,o=m.look;j[0]=n.x,j[1]=n.y,j[2]=n.z,k[0]=o.x,k[1]=o.y,k[2]=o.z,vec3.subtract(l,j,k);var p=Math.abs(vec3.length(l)),q=m.maxZoom-m.minZoom,r=i*(2+p/q);e&&(d=c*r,h=0,e=!1,g=!0),g&&(c>0?(h+=.2*r,h>d&&(g=!1)):0>c&&(h-=.2*r,d>h&&(g=!1)),g&&Human.view.camera.zoom(h)),b=a}})}),Human.input.addHandler(function(c){var d=50,e=50;c.onTick(function(f,g){if(!c.ctrlDown&&!c.altDown){var h=c.keyDown[Human.input.KEY_LEFT_ARROW],i=c.keyDown[Human.input.KEY_RIGHT_ARROW],j=c.keyDown[Human.input.KEY_UP_ARROW],k=c.keyDown[Human.input.KEY_DOWN_ARROW];if(h||i||j||k){var l=0,m=0;i?l=-g*d:h&&(l=g*d),k?m=-(g*e):j&&(m=g*e),Math.abs(l)>Math.abs(m)?m=null:l=null,b(l),a(m)}}})}),Human.input.addHandler(function(a){var b=10;a.onTick(function(c,d){if(!a.ctrlDown&&!a.altDown){var e=a.keyDown[Human.input.KEY_W],f=a.keyDown[Human.input.KEY_S],g=a.keyDown[Human.input.KEY_A],h=a.keyDown[Human.input.KEY_D];if(e||f||g||h){var i=0,j=0,k=0;f?j=d*b:e&&(j=-d*b),h?i=d*b:g&&(i=-d*b),Human.view.camera.pan({x:i,y:j,z:k})}}})}),Human.input.addHandler(function(a){var b=3;a.onTick(function(c,d){if(!a.ctrlDown&&!a.altDown){var e=a.keyDown[Human.input.KEY_ADD]||a.keyDown[Human.input.KEY_EQUAL_SIGN]||a.keyDown[Human.input.KEY_EQUAL_SIGN_FIREFOX],f=a.keyDown[Human.input.KEY_SUBTRACT]||a.keyDown[Human.input.KEY_DASH]||a.keyDown[Human.input.KEY_DASH_FIREFOX];
  
  if(e||f){var g=e?-(d*b):d*b;Human.view.camera.zoom(g)}}})}),Human.input.addHandler(function(a){a.onKeyDown([Human.input.KEY_NUM_1,Human.input.KEY_NUM_2,Human.input.KEY_NUM_3,Human.input.KEY_NUM_4,Human.input.KEY_NUM_5,Human.input.KEY_NUM_6],function(b){if(!a.ctrlDown&&!a.altDown){var c=Human.view.camera;b===Human.input.KEY_NUM_1?c.viewAnterior():b===Human.input.KEY_NUM_2?c.viewPosterior():b===Human.input.KEY_NUM_3?c.viewRight():b===Human.input.KEY_NUM_4?c.viewLeft():b===Human.input.KEY_NUM_5?c.viewSuperior():b===Human.input.KEY_NUM_6&&c.viewInferior()}})}),Human.input.addHandler(function(c){var d=.2,e=.16,f=1,g=.1,h=Human.view.camera,i=vec3.create(),j=vec3.create(),k=vec3.create(),l=function(a,b){var c=Math.sqrt(Math.pow(a,2)+Math.pow(b,2));return c*g};c.onTouchPinch(function(a){var b=l(a.xDelta,a.yDelta);h.zoom(b)}),c.onTouchZoom(function(a){var b=l(a.xDelta,a.yDelta);h.zoom(-b)}),c.onTouchPan(function(a){var b=h.eye,c=h.look;i[0]=b.x,i[1]=b.y,i[2]=b.z,j[0]=c.x,j[1]=c.y,j[2]=c.z,vec3.subtract(k,i,j);var d=Math.abs(vec3.length(k)),g=h.maxZoom-h.minZoom,l=e*(d/g),m=a.xDelta*l,n=a.yDelta*l;h.pan({x:m*f,y:n*f})}),c.onTouchMove(function(c){var e=c.xDelta*d,f=c.yDelta*d,g=c.touches.length>1;g||(a(f),b(-e))})})}(),Human.input.addHandler(function(a){"use strict";function b(){f&&(clearTimeout(f),f=null),c=null,d=null,Human.view.pick.hoverOff()}var c=null,d=null,e=4,f=null,g=!1,h=500;Human.properties.subscribe({propId:"pick.hover.delay",value:h,callback:function(a){h=a}}),a.onReset(function(){b()}),a.onMouseMove(function(a,i){g||(null!==c&&(Math.abs(a-c)>e||Math.abs(i-d)>e?b():(f&&(clearTimeout(f),f=null),Human.view.pick.hoverOff(),f=setTimeout(function(){Human.view.pick.hoverPick({canvasX:a,canvasY:i}),clearTimeout(f),f=null,c=null,d=null},h))),c=a,d=i)}),a.onMouseDown(function(){b(),g=!0}),a.onMouseUp(function(a,b){c=a,d=b,g=!1})}),Human.input.addHandler(function(a){"use strict";var b,c,d=null,e=null,f=4,g=!1,h=!1,i=!1,j=!1,k=!1,l=!1,m=!1;a.onKeyDown([Human.input.KEY_SHIFT],function(b){if(!a.ctrlDown&&!a.CTRL)switch(b){case Human.input.KEY_SHIFT:Human.view.pick.setMultiPickEnabled(!0)}}),a.onKeyUp([Human.input.KEY_SHIFT],function(b){if(!a.ctrlDown&&!a.CTRL)switch(b){case Human.input.KEY_SHIFT:Human.view.pick.setSinglePickEnabled(!0)}}),a.onKeyDown([Human.input.KEY_SPACE],function(){k=!0}),a.onKeyUp([Human.input.KEY_SPACE],function(){k=!1}),a.onKeyDown([Human.input.KEY_CTRL],function(){l=!0}),a.onKeyUp([Human.input.KEY_CTRL],function(){l=!1}),a.onKeyDown([Human.input.KEY_R],function(){m=!0}),a.onKeyUp([Human.input.KEY_R],function(){m=!1}),a.onMouseDown(function(b,c){d=b,e=c,i=a.mouseDownLeft,j=a.mouseDownRight}),a.onMouseUp(function(a,h){Math.abs(d-a)<f&&Math.abs(e-h)<f&&(b=a,c=h,g=!0)}),a.onMouseDoubleClick(function(k,l){Math.abs(d-k)<f&&Math.abs(e-l)<f&&(b=k,c=l,g=!0,h=!0,i=a.mouseDownLeft,j=a.mouseDownRight)}),a.onTick(function(){if(g){var a={canvasX:b,canvasY:c,mouseDownLeft:i,mouseDownRight:j,spaceDown:k,ctrlDown:l,regionPick:m};h?Human.view.pick.doublePick(a):Human.view.pick.pick(a),g=!1,h=!1,d=null,e=null}})}),Human.input.addHandler(function(a){"use strict";a.onTouchTap(function(a){var b=a.touches;Human.view.pick.pick({canvasX:b[0].x,canvasY:b[0].y})}),a.onTouchDoubleTap(function(a){var b=a.touches;Human.view.pick.doublePick({canvasX:b[0].x,canvasY:b[0].y})})}),Human.input.addHandler(function(a){"use strict";a.onKeyDown([Human.input.KEY_R,Human.input.KEY_T,Human.input.KEY_I,Human.input.KEY_Y,Human.input.KEY_Z,Human.input.KEY_C],function(b){if(!a.ctrlDown&&!a.altDown)switch(b){case Human.input.KEY_R:Human.rpc.call(null,"highlight.setEnabled",{enable:!0});break;case Human.input.KEY_T:Human.rpc.call(null,"xray.setEnabled",{enable:!0});break;case Human.input.KEY_I:Human.rpc.call(null,"isolate.setEnabled",{enable:!0})}if(a.ctrlDown&&!a.altDown)switch(b){case Human.input.KEY_Y:Human.view.dissect.redo();break;case Human.input.KEY_Z:Human.view.dissect.undo();break;case Human.input.KEY_R:Human.init.reset();break;case Human.input.KEY_C:Human.rpc.call(null,"dissect.setEnabled",{enable:!0})}})}),Human.input.addHandler(function(a){"use strict";var b,c=10,d=null;a.onTick(function(e){if(!a.ctrlDown&&!a.altDown){var f=a.keyDown[Human.input.KEY_M],g=a.keyDown[Human.input.KEY_N];if(f||g){if(!Human.view.clip.selectedClip)return;if(b){var h,i=(e-b)/1e3;g?h=i*c:f&&(h=-i*c);var j=Human.view.clip.selectedClip;return j.shown||(d=j.clipId),Human.view.clip.setClip({state:Human.view.clip.Plane.STATE_VISIBLE,progress:j.progress+h}),!0}b=e}else b=null,d&&(Human.view.clip.setClip({clipId:d,state:Human.view.clip.Plane.STATE_CLIPPING}),d=null)}})}),Human.input.addHandler(function(a){"use strict";var b=!1;a.onKeyDown([Human.input.KEY_X],function(){!a.ctrlDown||a.altDown||b||(Human.view.dissect.setEnabled(!0),b=!0)}),a.onKeyUp([Human.input.KEY_X],function(){b&&(Human.view.dissect.setEnabled(!1),b=!1)})}),Human.input.addHandler(function(a){"use strict";a.onKeyDown([Human.input.KEY_R],function(){if(a.keyDown[Human.input.KEY_SHIFT]){var b="This will reset to the initial view. Are you sure you want to continue?";confirm(b)&&(a.keyDown[Human.input.KEY_SHIFT]=!1,Human.init.reset())}})}),function(){"use strict";var a="true"===Human.request.getSearchParam("explode"),b=!1,c=0,d=0;Human.input.addHandler(function(e){e.onKeyDown([Human.input.KEY_ALT],function(){b=!0}),e.onKeyUp([Human.input.KEY_ALT],function(){b=!1}),e.onMouseWheel(function(e,f){if(a&&b){var g=.001*e.timeStamp;d=g,c+=1*f,0>c&&(c=0),Human.view.explode.explode({scale:c,speed:10})}})})}(),function(){"use strict";var a=Human.scene={};a.checkTestStarted=!1,a.rootObjects=[],a.modelObjects={},a.objects={},a.objectsByFMAID={},a.objectsForTags={},a.numObjects=0,a._boundary=null,a.center=[0,0,0],a.enabledObjects={},a.selectedObjects={},a.showSelectedObjects=!1,a.alwaysEnabledObjects={},a._leavesCache={},a.createObject=function(b){if(!b.objectId)return void Human.log.error("Scene.createObject","Param expected: objectId");if(a.objects[b.objectId])return void Human.log.error("Scene.createObject","Param: objectId already in use");var c=b.parentObjectId?a.objects[b.parentObjectId]:null,d=b.modelId;b.tags=b.tags||[];var e=c?a._inheritTags(b.tags,c):b.tags;b.modelId=d,b.parent=c,b.attachNodeId=Human.CONTENT_ROOT_ID,b.level=c?c.level+1:0,b.tags=e;var f=new Human.scene.Object(b);return a.objects[b.objectId]=f,f.fmaId&&(a.objectsByFMAID[f.fmaId]=f),c?c.__addObject(f):a.rootObjects.push(f),(a.modelObjects[d]=a.modelObjects[d]||{})[b.objectId]=f,a._registerObjectForTags(f),a.numObjects++,a._boundary=null,Human.events.fire("scene.objectCreated",{moduleId:b.moduleId,modelId:d,objectId:f.objectId,name:f.displayName,description:f.description,displayName:f.displayName,fmaId:f.fmaId,tags:f.tags,parentObjectId:c?c.objectId:null}),void 0!==b.shown&&(f.show(b.shown),b.shown&&(a.enabledObjects[b.objectId]=f)),f},a._inheritTags=function(a,b){var c,d,e=a||[],f=b.tags,g=[];if(e){for(var h=0,i=f.length;i>h;h++){d=f[h];for(var j=!0,k=0,l=e.length;l>k;k++)c=e[k],c===d&&(j=!1);j&&g.push(d)}return e.concat(g)}return e},a._registerObjectForTags=function(b){for(var c,d,e=b.tags,f=0,g=e.length;g>f;f++)c=e[f],d=a.objectsForTags[c],d||(d=a.objectsForTags[c]={}),d[b.objectId]=b},a._deregisterObjectForTags=function(b){for(var c,d,e=b.tags,f=0,g=e.length;g>f;f++)c=e[f],d=a.objectsForTags[c],d&&delete d[b.objectId]},a.getObject=function(b){var c=a.objects[b];return c||Human.log.error("Human.scene.getObject","Scene object not found: '"+b+"'"),c},a.setEnabledObjects=function(b){var c,d=a.enabledObjects,e=a.selectedObjects,f=b.objects||b.objectIds,g={},h={},i=!1,j=!1;if(b.replace)for(c in d)d.hasOwnProperty(c)&&(d[c].numEnabledSubObjects=0,delete d[c],g[c]=!1,e.hasOwnProperty(c)&&(e[c]._selectedSubObjects=0,delete e[c],h[c]=!1,j=!0),a._updateObjectVisibility(c),i=!0);a._getEnabledFlagsinSubtreeForObjectMap(f,g);for(c in g)g.hasOwnProperty(c)&&(g[c]?d[c]||(d[c]=a.objects[c],a._updateObjectVisibility(c),g[c]=!0,i=!0):d[c]&&(delete d[c],e[c]&&(h||(h={}),delete e[c],h[c]=!1),a._updateObjectVisibility(c),g[c]=!1,i=!0));i&&Human.events.fire("scene.objectsShown",{enabledObjectsUpdate:g,showSelectedObjects:a.showSelectedObjects}),j&&Human.events.fire("scene.objectsSelected",{selectedObjectsUpdate:h,showSelectedObjects:a.showSelectedObjects})},a._getEnabledFlagsinSubtreeForObjectMap=function(b,c){for(var d,e,f=a._sortObjectIDsIntoLevelBuckets(b),g=0,h=f.length;h>g;g++)if(d=f[g])for(var i=0,j=d.length;j>i;i++)e=d[i],a._getEnabledFlags(e,!!b[e],c)},a._sortObjectIDsIntoLevelBuckets=function(b){var c,d,e,f,g=[];for(c in b)b.hasOwnProperty(c)&&(e=a.objects[c],e&&(f=e.level,d=g[f]||(g[f]=[]),d.push(c)));return g},a._getEnabledFlags=function(b,c,d){d=d||{};var e=a.objects[b];if(!e||e._destroyed)return d;for(var f=a._getEnabledFlagsInSubtreeForObject(b,c,d),g=e.parent;g;e=e.parent,g=g.parent)if(g&&c){if(g.parent){e.numEnabledSubObjects=e.numEnabledSubObjects||0;for(var h=0,i=0;i<g.objects.length;i++)g.objects[i].objectId!==e.objectId&&d[g.objects[i].objectId]&&h++;if(g.numEnabledSubObjects+h!==e.numEnabledSubObjects+1)break;a._updateAncestorSubObjects(g.parent,c)}}else g&&!c&&g.parent&&(e.numEnabledSubObjects=e.numEnabledSubObjects||0,g.numEnabledSubObjects===e.numEnabledSubObjects&&a._updateAncestorSubObjects(g.parent,c,f));return f},a._getEnabledFlagsInSubtreeForObject=function(b,c,d){var e=a.objects[b];if(!e||e._destroyed)return d;d[b]=c;for(var f=e.objects,g=0,h=f.length;h>g;g++)a._getEnabledFlagsInSubtreeForObject(f[g].objectId,c,d);var i=a.enabledObjects[b];if(e.parent)for(var j=e.parent;j;j=j.parent)(void 0===j.numEnabledSubObjects||null===j.numEnabledSubObjects)&&(j.numEnabledSubObjects=0),c?i||1===++j.numEnabledSubObjects&&(d[j.objectId]=!0):i&&0===--j.numEnabledSubObjects&&(d[j.objectId]=!1);return d},a._updateAncestorSubObjects=function(b,c,d){b&&c?(b.numEnabledSubObjects++,a._updateAncestorSubObjects(b.parent,c,d)):b&&!c&&(a.enabledObjects[b.objectId]&&0===--b.numEnabledSubObjects&&(d[b.objectId]=!1),a._updateAncestorSubObjects(b.parent,c,d))},a.setSelectedObjects=function(b){var c,d,e=b.objects||b.objectIds||{},f={};if(b.objectId){if(d=a.objects[b.objectId],!d)return void Human.log.error("Human.scene.setSelectedObjects","Scene object not found: '"+b.objectId+"'");var g=!!b.select;if(b.replace)for(c in a.selectedObjects)a.selectedObjects.hasOwnProperty(c)&&(d=a.selectedObjects[c],d._selectedSubObjects=0,delete a.selectedObjects[c],d.selected&&d.select(!1),a.showSelectedObjects&&d.shown&&d.show(!1),f[c]=!1);a._getObjectSelectedFlagsInSubtree(b.objectId,g,f)}else{if(b.replace)for(c in a.selectedObjects)a.selectedObjects.hasOwnProperty(c)&&(d=a.selectedObjects[c],d._selectedSubObjects=0,d.selected&&d.select(!1),delete a.selectedObjects[c],f[c]=!1,a._updateObjectVisibility(c));a._getSelectedFlagsInSubtreeForObjectMap(e,f)}var h;for(c in f)if(f.hasOwnProperty(c))if(d=a.objects[c],f[c]){if(!a.selectedObjects[c]){a.selectedObjects[c]=d,a.enabledObjects[c]||(h||(h={}),h[c]=!0,a.enabledObjects[c]=d);var i=!!a.enabledObjects[c];a.showSelectedObjects&&(i=i&&!!a.selectedObjects[c]),d.shown!==i&&d.show(i),d.selected||d.select(!0),f[c]=!0}}else a.selectedObjects[c]&&(delete a.selectedObjects[c],a._updateObjectVisibility(c),d.selected&&d.select(!1),f[c]=!1);h&&Human.events.fire("scene.objectsShown",{enabledObjectsUpdate:h,showSelectedObjects:a.showSelectedObjects}),Human.events.fire("scene.objectsSelected",{selectedObjectsUpdate:f,showSelectedObjects:a.showSelectedObjects})},a._getSelectedFlagsInSubtreeForObjectMap=function(b,c){for(var d,e,f=a._sortObjectIDsIntoLevelBuckets(b),g=0,h=f.length;h>g;g++)if(d=f[g])for(var i=0,j=d.length;j>i;i++)e=d[i],a._getObjectSelectedFlagsInSubtree(e,!!b[e],c)},a._getObjectSelectedFlagsInSubtree=function(b,c,d){d=d||{};var e=a.objects[b];if(!e||e._destroyed)return d;d[b]=c;var f=a.selectedObjects[b],g=a.enabledObjects[b];if(e.parent)for(var h=e.parent;h;h=h.parent)(void 0===h.numEnabledSubObjects||null===h.numEnabledSubObjects)&&(h.numEnabledSubObjects=0),(void 0===h._selectedSubObjects||null===h._selectedSubObjects)&&(h._selectedSubObjects=0),c?(f||1===++h._selectedSubObjects&&(d[h.objectId]=!0),g||h.numEnabledSubObjects++):f&&--h._selectedSubObjects<=0&&(h._selectedSubObjects=0,d[h.objectId]=!1);for(var i=e.objects,j=0,k=i.length;k>j;j++)a._getObjectSelectedFlagsInSubtree(i[j].objectId,c,d);return d},a.anySelected=function(b){var c;for(var d in a.selectedObjects)if(a.selectedObjects.hasOwnProperty(d)){if(c=a.selectedObjects[d],!b)return!0;if(0===c.numSubObjects)return!0}return!1},a.setShowSelectedObjects=function(b){a.showSelectedObjects=b;var c,d;for(var e in a.objects)a.objects.hasOwnProperty(e)&&(c=a.objects[e],d=!!a.enabledObjects[e],a.showSelectedObjects&&(d=d&&!!a.selectedObjects[e]),c.shown!==d&&c.show(d))},a._updateObjectVisibility=function(b){var c=a.objects[b],d=!!a.enabledObjects[b];a.showSelectedObjects&&(d=d&&!!a.selectedObjects[b]),c.shown!==d&&c.show(d)},a.getLeaves=function(b){var c=a._leavesCache[b];if(!c){c=[];var d=a.objects[b];d&&a._getLeaves([d],c),a._leavesCache[b]=c}return c},a._getLeaves=function(b,c){for(var d,e=0,f=b.length;f>e;e++)d=b[e],0===d.objects.length?c.push(d.objectId):a._getLeaves(d.objects,c)},a.getEnabledLeaves=function(b){var c=[],d=a.objects[b];return d&&a._getEnabledLeaves([d],c),c},a._getEnabledLeaves=function(b,c){for(var d,e=0,f=b.length;f>e;e++)d=b[e],0===d.objects.length?a.enabledObjects.hasOwnProperty(d.objectId)&&c.push(d.objectId):a._getEnabledLeaves(d.objects,c)},a._getKeys=function(a,b){var c={};for(var d in a)a.hasOwnProperty(d)&&(d[d]=b);return c},a.destroyObject=function(b){var c=a.objects[b];if(c&&!c._destroyed){var d,e,f;for(e=0,f=a.rootObjects.length;f>e;e++)if(a.rootObjects[e].objectId===b){a.rootObjects.splice(e,1);break}if(delete a.objects[b],c.fmaId&&delete a.objectsByFMAID[c.fmaId],a.enabledObjects[b])for(d=c.parent;d;d=d.parent)void 0!==d.numEnabledSubObjects&&null!==d.numEnabledSubObjects&&d.numEnabledSubObjects--;if(a.selectedObjects[b])for(d=c.parent;d;d=d.parent)void 0!==d._selectedSubObjects&&null!==d._selectedSubObjects&&d._selectedSubObjects--;delete a.selectedObjects[b],delete a.enabledObjects[b],a.numObjects--,c.parent&&c.parent._removeObject(b);var g=c.objects.slice(0);for(e=0,f=g.length;f>e;e++)a.destroyObject(g[e].objectId);c._destroy(),c._destroyed=!0,delete a.modelObjects[c.modelId][c.objectId],a._deregisterObjectForTags(c),a._leavesCache={},a._boundary=null,Human.events.fire("scene.objectDestroyed",{objectId:b})}},a.getBoundary=function(b){b=b||{};var c;if(b.objectId)return c=Human.scene.objects[b.objectId],c?c.getBoundary():(Human.log.warn("Human.scene.getBoundary","Scene object not found: '"+b.objectId+"'"),this.getBoundary());a._boundary?(a._boundary.xmin=1e5,a._boundary.ymin=1e5,a._boundary.zmin=1e5,a._boundary.xmax=-1e5,a._boundary.ymax=-1e5,a._boundary.zmax=-1e5):a._boundary={xmin:1e5,ymin:1e5,zmin:1e5,xmax:-1e5,ymax:-1e5,zmax:-1e5};var d,e,f=a._boundary,g=!1;if(b.objectIds)for(var h=b.objectIds,i=0,j=h.length;j>i;i++)c=a.objects[h[i]],c&&0===c.objects.length&&(e=c.getBoundary(),e.xmin<f.xmin&&(f.xmin=e.xmin),e.ymin<f.ymin&&(f.ymin=e.ymin),e.zmin<f.zmin&&(f.zmin=e.zmin),e.xmax>f.xmax&&(f.xmax=e.xmax),e.ymax>f.ymax&&(f.ymax=e.ymax),e.zmax>f.zmax&&(f.zmax=e.zmax),g=!0);else if(b.objects){var k=b.objects;for(d in k)k.hasOwnProperty(d)&&a.objects[d]&&(c=a.objects[d],0===c.objects.length&&(e=c.getBoundary(),e.xmin<f.xmin&&(f.xmin=e.xmin),e.ymin<f.ymin&&(f.ymin=e.ymin),e.zmin<f.zmin&&(f.zmin=e.zmin),e.xmax>f.xmax&&(f.xmax=e.xmax),e.ymax>f.ymax&&(f.ymax=e.ymax),e.zmax>f.zmax&&(f.zmax=e.zmax),g=!0))}else{k=a.objects;for(d in k)k.hasOwnProperty(d)&&(c=k[d],0===c.objects.length&&(e=c.getBoundary(),e.xmin<f.xmin&&(f.xmin=e.xmin),e.ymin<f.ymin&&(f.ymin=e.ymin),e.zmin<f.zmin&&(f.zmin=e.zmin),e.xmax>f.xmax&&(f.xmax=e.xmax),e.ymax>f.ymax&&(f.ymax=e.ymax),e.zmax>f.zmax&&(f.zmax=e.zmax),g=!0))}return g?f:{xmin:-100,ymin:-100,zmin:-100,xmax:100,ymax:100,zmax:100}},a.setObjectProperties=function(b){function c(c){d=b[c.objectId]||{},c.parent&&(d=Human.scene.sets.union(c.parent.getProperties(),d),d.glassFactor=c.glassFactor,d.murkiness=c.murkiness),d.hasOwnProperty("selected")&&c.selected!==d.selected&&(e[c.objectId]=d.selected),d.hasOwnProperty("shown")&&c.shown!==d.shown&&(g[c.objectId]=d.shown),d.shown?(h[c.objectId]=c,a.enabledObjects[c.objectId]=c):delete a.enabledObjects[c.objectId],d.selected?(f[c.objectId]=c,a.selectedObjects[c.objectId]=c):delete a.selectedObjects[c.objectId],c.setProperties(d)}b=b||{};for(var d={},e={},f={},g={},h={},i=Human.scene.rootObjects,j=0,k=i.length;k>j;j++)i[j].traverseDown(c);Human.scene.selectedObjects=f,Human.events.fire("scene.objectsSelected",{selectedObjectsUpdate:e,showSelectedObjects:a.showSelectedObjects}),Human.events.fire("scene.objectsShown",{enabledObjectsUpdate:g,showSelectedObjects:a.showSelectedObjects})}}(),function(){"use strict";Human.scene.Object=function(a){this.modelId=a.modelId,this.objectId=a.objectId,this.anonymous=a.anonymous,this.fmaId=a.fmaId,this.layer=a.layer,this.displayName=a.displayName,this.description=a.description,this.parent=a.parent,this.shown=!1,this.selected=!1,this.level=a.level,this.pickable=!0,this.clippable=!0,this.xray=!1,this.opacity=1,this.glassFactor=1,this.murkiness=1,this.highlight=!1,this.backfaces=!1,this.windingOrder="ccw",this.tags=a.tags,this.numSubObjects=0,this.numSubObjectsLoaded=0,this.numEnabledSubObjects=0,this.objects=[],this._boundedAsset=null,this._boundaryDirty=!0,this.geometryId=a.geometryId,this.materialId=a.materialId,this.transformId=a.transformId,this.morphId=a.morphId,this.attachedAssets={},this._pendingAssets={};var b;this.transformId?(this._transformNode=Human.renderer.graph.createSubtree(this._getParentContainerNode(),{type:"xform"}),this.pivot={x:0,y:0,z:0},this.translate={x:0,y:0,z:0},this.scale={x:1,y:1,z:1},this.rotate={x:0,y:0,z:0}):(this._transformNode=null,this.pivot=null,this.translate=null,this.scale=null,this.rotate=null),this._rootNode=this._childNodeContainer=this._transformNode,this.material=null,this.region=null,(this.geometryId||this.morphId||a.geometry||a.morph)&&(b=this.getDefaultFlags(),this._xrayBackfaces=!1,b.enabled=!1,b.pickable=!0,b.solid=!0,b.layer=a.layer||0,b.name=a.objectId||"noname",b.xray=!1,b.highlight=!1,b.opacity=1,b.glassFactor=this.glassFactor,b.murkiness=this.murkiness,b.xrayEnabled=!0,this._propertiesNode=this._rootNode?Human.renderer.graph.insertNode(this._rootNode,{type:"properties",properties:b}):this._rootNode=Human.renderer.graph.createSubtree(this._getParentContainerNode(),{type:"properties",properties:b}),a.regionMap&&(this.regionMap=a.regionMap,Human.renderer.graph.insertNode(this._rootNode,{type:"regionMap",coreId:a.regionMap.node.getCoreId()})),this._boundedAsset=a.morph?a.morph:a.geometry),this.parent&&this.parent._subObjectReady(this),(a.pivot||a.translate||a.scale||a.rotate)&&(this.pivot=a.pivot?Human.utils.apply(a.pivot,{x:0,y:0,z:0}):{x:0,y:0,z:0},this.translate=a.translate?Human.utils.apply(a.translate,{x:0,y:0,z:0}):{x:0,y:0,z:0},this.scale=a.scale?Human.utils.apply(a.scale,{x:1,y:1,z:1}):{x:1,y:1,z:1},this.rotate=a.rotate?Human.utils.apply(a.rotate,{x:0,y:0,z:0}):{x:0,y:0,z:0},this._buildMatrix()),this._propertiesNode&&this._propertiesNode.setSolidColor(a.capColor||{r:.7,g:.7,b:.7})};var a={geometry:function(a,b){a.geometry=Human.renderer.graph.insertNode(a._rootNode,b.geometry),a._boundedAsset=b,a._boundaryDirty=!0},morph:function(a,b){a.morph=b.morphGeometry,Human.renderer.graph.insertNode(a._rootNode,b.morphGeometry),b.morphGeometry.onFrameUpdate=function(){a._boundaryDirty=!0},a._boundedAsset=b,a._boundaryDirty=!0},material:function(a,b){if(a.material=b,b.textures){var c,d,e=b.textures;for(c=0,d=e.length;d>c;c++)e[c]&&Human.renderer.graph.insertNode(a._rootNode,{type:"texture",coreId:e[c].getCoreId()})}if(b.material&&Human.renderer.graph.insertNode(a._rootNode,b.material),b.flags){var f=Human.utils.apply(b.flags,a._propertiesNode.getProperties());f.frontface&&(a.windingOrder=f.frontface),a._propertiesNode.setProperties(f)}if(b.reflection&&Human.renderer.graph.insertNode(a._rootNode,b.reflection),b.fresnels){var g=b.fresnels;for(var h in g)g.hasOwnProperty(h)&&Human.renderer.graph.insertNode(a._rootNode,g[h])}void 0!==b.glassFactor&&a.setGlassFactor(b.glassFactor),void 0!==b.murkiness&&a.setMurkiness(b.murkiness)},transform:function(a,b){function c(){a.pivot=b.pivot,a.translate=b.translate,a.scale=b.scale,a.rotate=b.rotate,a._buildMatrix()}a._transform=b,c(),b.onUpdated=c}},b={geometry:!0,material:!0,transform:!0};Human.scene.Object.prototype.attachAsset=function(c,d){b[c]&&this.isLeaf()?this._attachRenderAsset(c,d):(a[c](this,d),this.attachedAssets[c]=!0)},Human.scene.Object.prototype._attachRenderAsset=function(b,c){if(this.isRenderable())return a[b](this,c),void(this.attachedAssets[b]=!0);if(this.attachedAssets[b]=!0,this._pendingAssets[b]=c,this.isRenderable()){var d=this._pendingAssets;for(var e in d)d.hasOwnProperty(e)&&a[e](this,d[e]);this._pendingAssets={},Human.events.fire("scene.objectRenderable",{objectId:this.objectId})}},Human.scene.Object.prototype.isRenderable=function(){return!(!this.attachedAssets.geometry||!this.attachedAssets.material||!this.attachedAssets.transform&&this.transformId)},Human.scene.Object.prototype.isLeaf=function(){return!this.objects||0===this.objects.length},Human.scene.Object.prototype._subObjectReady=function(a){this.numSubObjectsLoaded++,this._boundaryDirty=!0,this.numSubObjects>0&&this.numSubObjects===this.numSubObjectsLoaded&&this.parent&&this.parent._subObjectReady(this),this.parent&&this.parent._subObjectReady(a)},Human.scene.Object.prototype.setTransform=function(a){return this._transform?void this._transform.set(a):(null===this.pivot&&(this.pivot={x:0,y:0,z:0},this.translate={x:0,y:0,z:0},this.rotate={x:0,y:0,z:0},this.scale={x:1,y:1,z:1}),a.pivot&&(void 0!==a.pivot.x&&(this.pivot.x=a.pivot.x),void 0!==a.pivot.y&&(this.pivot.y=a.pivot.y),void 0!==a.pivot.z&&(this.pivot.z=a.pivot.z)),a.translate&&(void 0!==a.translate.x&&(this.translate.x=a.translate.x),void 0!==a.translate.y&&(this.translate.y=a.translate.y),void 0!==a.translate.z&&(this.translate.z=a.translate.z)),a.scale&&(void 0!==a.scale.x&&(this.scale.x=a.scale.x),void 0!==a.scale.y&&(this.scale.y=a.scale.y),void 0!==a.scale.z&&(this.scale.z=a.scale.z)),a.rotate&&(void 0!==a.rotate.x&&(this.rotate.x=a.rotate.x),void 0!==a.rotate.y&&(this.rotate.y=a.rotate.y),void 0!==a.rotate.z&&(this.rotate.z=a.rotate.z)),void this._buildMatrix())};var c=mat4.create(),d=mat4.create(),e=mat4.create(),f=mat4.create(),g=mat4.create(),h=mat4.create(),i=mat4.create();Human.scene.Object.prototype._buildMatrix=function(){this._transformNode=this._transformNode||this._initTransformNode();var a=this.pivot,b=this.translate;mat4.fromTranslation(c,[-a.x,-a.y,-a.z]);var j=this.scale;mat4.fromScaling(d,[j.x,j.y,j.z]),mat4.fromTranslation(e,[b.x+a.x,b.y+a.y,b.z+a.z]);var k=this.rotate;mat4.fromRotation(f,k.z*Math.PI/180,Human.math.Z_AXIS),mat4.fromRotation(g,k.y*Math.PI/180,Human.math.Y_AXIS),mat4.fromRotation(h,k.x*Math.PI/180,Human.math.X_AXIS),mat4.identity(i),mat4.multiply(i,c,i),mat4.multiply(i,d,i),mat4.multiply(i,h,i),mat4.multiply(i,g,i),mat4.multiply(i,f,i),mat4.multiply(i,e,i),this.matrix=i,this._transformNode.setElements(this.matrix),this._setBoundaryDirty(),this._updateFaceWinding()},Human.scene.Object.prototype._initTransformNode=function(){var a=[];return this._rootNode&&(this._rootNode.disconnect(),a.push(this._rootNode)),this._gatherChildRootNodes(a),this._transformNode=Human.renderer.graph.createSubtree(this._getParentContainerNode(),{type:"xform"}),this._transformNode.addNodes(a),this._rootNode=this._childNodeContainer=this._transformNode,this._transformNode},Human.scene.Object.prototype._getParentContainerNode=function(){for(var a=this.parent;a;){if(a._childNodeContainer)return a._childNodeContainer;a=a.parent}return null},Human.scene.Object.prototype._gatherChildRootNodes=function(a){for(var b=this.objects,c=0,d=b.length;d>c;c++){var e=b[c];e._rootNode?(e._rootNode.disconnect(),a.push(e._rootNode)):e._gatherChildRootNodes(a)}},Human.scene.Object.prototype._setBoundaryDirty=function(){this._boundaryDirty=!0,this._setSubBoundaryDirty(),this._setAncestorBoundaryDirty()},Human.scene.Object.prototype._inNegativeCoordSpace=function(a){if(a.scale&&(a.scale.x<0||a.scale.y<0||a.scale.z<0))return!0;var b=a.parent;return b?this._inNegativeCoordSpace(b):!1};var j={x:0,y:0,z:0};Human.scene.Object.prototype.getNegatedAxes=function(a){return a=a||{},j.x=0,j.y=0,j.z=0,this._getAxisInversionCounts(j),a.x=j.x%2===1,a.y=j.y%2===1,a.z=j.z%2===1,a},Human.scene.Object.prototype._getAxisInversionCounts=function(a){this.scale&&(this.scale.x<0&&a.x++,this.scale.y<0&&a.y++,this.scale.z<0&&a.z++);var b=this.parent;b&&b._getAxisInversionCounts(a)},Human.scene.Object.prototype._setAncestorBoundaryDirty=function(){for(var a=this.parent;a&&!a._boundaryDirty;a=a.parent)a._boundaryDirty=!0},Human.scene.Object.prototype._setSubBoundaryDirty=function(){for(var a,b=0,c=this.objects.length;c>b;b++)a=this.objects[b],a._boundaryDirty||(a._boundaryDirty=!0,a._setSubBoundaryDirty())},Human.scene.Object.prototype._updateFaceWinding=function(){var a=this._inNegativeCoordSpace(this);if(this._propertiesNode){var b=this.windingOrder,c="ccw"===this.windingOrder?"cw":"ccw";this._propertiesNode.setFrontface(a?c:b)}for(var d=0,e=this.objects.length;e>d;d++)this.objects[d]._updateFaceWinding2(a)},Human.scene.Object.prototype._inNegativeCoordSpace=function(a){if(a.scale&&(a.scale.x<0||a.scale.y<0||a.scale.z<0))return!0;var b=a.parent;return b?this._inNegativeCoordSpace(b):!1},Human.scene.Object.prototype._updateFaceWinding2=function(a){if(this.scale&&(this.scale.x<0||this.scale.y<0||this.scale.z<0)&&(a=!0),this._propertiesNode){var b=this.windingOrder,c="ccw"===this.windingOrder?"cw":"ccw";this._propertiesNode.setFrontface(a?c:b)}for(var d=0,e=this.objects.length;e>d;d++)this.objects[d]._updateFaceWinding2(a)},Human.scene.Object.prototype.getBoundary=function(){return this._boundaryDirty&&this._rebuildBoundary(),this._boundary},Human.scene.Object.prototype.getWorldMatrix=function(){if(this._transformNode)return this._transformNode.getWorldMatrix();var a=this._getParentContainerNode();return a?a.getWorldMatrix():mat4.create()},Human.scene.Object.prototype.getCenter=function(){return this._boundaryDirty&&this._rebuildBoundary(),this._center},Human.scene.Object.prototype._rebuildBoundary=function(){if(this._boundaryDirty){var a,b;if(this._boundary={xmin:1e6,ymin:1e6,zmin:1e6,xmax:-1e6,ymax:-1e6,zmax:-1e6},this._boundedAsset){var c,d,e=this.getWorldMatrix(),f=this._boundedAsset;"function"==typeof f.updateBoundary&&f.updateBoundary(),c=f.axisBoundary,c&&(d=this._getBoundary(c,e),this._expandBoundary(this._boundary,d))}var g;for(a=0,b=this.objects.length;b>a;a++)g=this.objects[a],g._boundaryDirty&&g._rebuildBoundary(),this._expandBoundary(this._boundary,g._boundary);this._center=[.5*(this._boundary.xmax+this._boundary.xmin),.5*(this._boundary.ymax+this._boundary.ymin),.5*(this._boundary.zmax+this._boundary.zmin)],this._boundaryDirty=!1}};var k=vec3.create();Human.scene.Object.prototype._getBoundary=function(a,b){for(var c,d,e,f=1e5,g=1e5,h=1e5,i=-1e5,j=-1e5,l=-1e5,m=new Float32Array(a.buffer,0,3),n=new Float32Array(a.buffer,12,3),o=0;8>o;o++)k[0]=1&o?m[0]:n[0],k[1]=2&o?m[1]:n[1],k[2]=4&o?m[2]:n[2],vec3.transformMat4(k,k,b),c=k[0],d=k[1],e=k[2],f>c&&(f=c),g>d&&(g=d),h>e&&(h=e),c>i&&(i=c),d>j&&(j=d),e>l&&(l=e);return{xmin:f,ymin:g,zmin:h,xmax:i,ymax:j,zmax:l}},Human.scene.Object.prototype._expandBoundary=function(a,b){a.xmin>b.xmin&&(a.xmin=b.xmin),a.ymin>b.ymin&&(a.ymin=b.ymin),a.zmin>b.zmin&&(a.zmin=b.zmin),a.xmax<b.xmax&&(a.xmax=b.xmax),a.ymax<b.ymax&&(a.ymax=b.ymax),a.zmax<b.zmax&&(a.zmax=b.zmax)},Human.scene.Object.prototype.__addObject=function(a){this.objects.push(a),this._subObjectAdded(a)},Human.scene.Object.prototype._subObjectAdded=function(a){this.numSubObjects++,this._boundaryDirty=!0,this.parent&&this.parent._subObjectAdded(a)},Human.scene.Object.prototype.show=function(a){if(this.shown!==a&&(this._propertiesNode&&this._propertiesNode.setEnabled(a),this.shown=a,Human.view.annotations.showByObjectId(this.objectId,this.shown),this.isLeaf())){var b="scene.object"+(this.shown?"Shown":"Hidden");Human.events.fire(b,{objectId:this.objectId})}},Human.scene.Object.prototype.select=function(a){if(this.selected!==a&&(this.selected=a,this.isLeaf())){var b="scene.object"+(this.selected?"Selected":"Deselected");Human.events.fire(b,{objectId:this.objectId})}},Human.scene.Object.prototype.setOpacity=function(a){this._propertiesNode&&(this._propertiesNode.setProperties({opacity:a}),this.opacity=a)},Human.scene.Object.prototype.setXRay=function(a){this.xray!==a&&(this._propertiesNode&&this._propertiesNode.setProperties({xray:a,desaturate:a,backfaces:!a&&this.backfaces}),this.xray=a)},Human.scene.Object.prototype.setGlassFactor=function(a){this.glassFactor=a,this._propertiesNode&&this._propertiesNode.setProperties({glassFactor:a})},Human.scene.Object.prototype.setMurkiness=function(a){this.murkiness=a,this._propertiesNode&&this._propertiesNode.setProperties({murkiness:a})},Human.scene.Object.prototype.setPickable=function(a){this.pickable!==a&&(this._propertiesNode&&this._propertiesNode.setPicking(a),this.pickable=a)},Human.scene.Object.prototype.setClippable=function(a){this.clippable!==a&&(this._propertiesNode&&this._propertiesNode.setClipping(a),this.clippable=a)},Human.scene.Object.prototype.setHighlight=function(a){this.highlight!==a&&(this._propertiesNode&&this._propertiesNode.setProperties({highlight:a}),this.highlight=a)},Human.scene.Object.prototype.setBackfaces=function(a){this.backfaces!==a&&(this._propertiesNode&&this._propertiesNode.setBackfaces(!this.xray&&a),this.backfaces=a)},Human.scene.Object.prototype._destroy=function(){this._destroyed||(this._rootNode&&Human.renderer.graph.destroySubtree(this._rootNode),Human.view.annotations.destroyByObjectId(this.objectId))},Human.scene.Object.prototype._removeObject=function(a){for(var b=0,c=this.objects.length;c>b;b++){if(this.objects[b].objectId===a)return this.objects.splice(b,1),void this._subObjectRemoved();this._setBoundaryDirty()}},Human.scene.Object.prototype._subObjectRemoved=function(){this.numSubObjects--};var l={shown:{setter:Human.scene.Object.prototype.show,value:!1,keyable:!0,type:"boolean"},selected:{setter:Human.scene.Object.prototype.select,value:!1,keyable:!1,type:"boolean"},pickable:{setter:Human.scene.Object.prototype.setPickable,value:!0,keyable:!1,type:"boolean"},backfaces:{setter:Human.scene.Object.prototype.setBackfaces,value:!1,keyable:!1,type:"boolean"},glassFactor:{setter:Human.scene.Object.prototype.setGlassFactor,value:0,keyable:!1,type:"number"},murkiness:{setter:Human.scene.Object.prototype.setMurkiness,value:1,keyable:!1,type:"number"},opacity:{setter:Human.scene.Object.prototype.setOpacity,value:1,keyable:!0,type:"number"}},m=Object.keys(l);Human.scene.Object.prototype.getDefaultFlags=function(){return{picking:this.pickable,enabled:!1,specular:!0,backfaces:!1,reflection:!0,solid:!0}},Human.scene.Object.prototype.getDefaultProperties=function(){for(var a={},b=0,c=m.length;c>b;b++){var d=m[b];a[d]=l[d].value}return a},Human.scene.Object.prototype.getProperties=function(){for(var a=this,b={},c=0,d=m.length;d>c;c++){var e=m[c];b[e]=a[e]}return b},Human.scene.Object.prototype.setProperties=function(a){a=a||{};for(var b,c,d=this,e=0,f=m.length;f>e;e++){var g=m[e];b=l[g],c=void 0!==a[g]?a[g]:b.value,d[g]!==c&&b.setter.call(d,c)}},Human.scene.Object.prototype.traverseUp=function(a){a(this),this.parent&&this.parent.traverseUp(a)},Human.scene.Object.prototype.traverseDown=function(a){a(this);for(var b=0,c=this.objects.length;c>b;b++)this.objects[b].traverseDown(a)},Human.scene.Object.prototype.getLeafObjects=function(a){var b=[];return this.traverseDown(function(c){c.isLeaf()&&(b.push(c),a&&a(c))}),b},Human.scene.Object.prototype.getRenderableObjects=function(a){
  var b=[];return this.traverseDown(function(c){c.isRenderable()&&(b.push(c),a&&a(c))}),b}}(),function(){"use strict";var a=Human.scene.sets={},b=function(a,b){var c=[null,void 0];return c.indexOf(b)<0?b:c.indexOf(a)<0?a:null},c=function(a,b){return b===a?!0:!1};a.keys=function(a,b){b=b||!1;var c=Object.keys(a),d=[];return b?c.forEach(function(a){b(a)&&d.push(a)}):d=c,d},a.filterKeys=function(b,c){var d,e=[];if(c instanceof RegExp)d=c;else try{d=new RegExp(c)}catch(f){return{}}var g=function(a){return d.test(a)};return e=a.keys(b).filter(g)},a.keysWhere=function(a,b){var c=[];for(var d in a)a.hasOwnProperty(d)&&b(a[d])&&c.push(d);return c},a.hasKey=function(b,c){var d=a.keys(b);return d.indexOf(c)>=0?!0:!1},a.getSetIterator=function(b){var c=0,d=a.keys(b),e=d.length;return{next:function(){var a;if(!this.hasNext())return null;var e=d[c];return a={key:e,value:b[e]},c++,a},hasNext:function(){return e>c},rewind:function(){return c=0,b[d[0]]},current:function(){return b[d[c]]}}},a.values=function(b){var c=a.keys(b),d=[];return c.forEach(function(a){d.push(b[a])}),d},a.jointKeys=function(b,c){var d={},e=function(a){d[a]=!0},f=a.keys(b),g=a.keys(c);return f.forEach(e),g.forEach(e),a.keys(d)},a.commonKeys=function(b,c){var d={},e=a.keys(b),f=a.keys(c);return e.forEach(function(a){d[a]=1}),f.forEach(function(a){d[a]=(d[a]||0)+1}),a.keysWhere(d,function(a){return a>1?!0:!1})},a.uniqueKeys=function(b,c){var d={},e=function(a){d[a]=1},f=function(a){d[a]=0},g=a.keys(b),h=a.keys(c);return g.forEach(e),h.forEach(f),a.keysWhere(d,function(a){return a>0?!0:!1})},a.union=function(c,d,e){var f,g={},h=null;return e||(e=b),f=a.jointKeys(c,d),f.forEach(function(a){h=e(c[a],d[a]),null!==h&&(g[a]=h)}),g},a.intersection=function(c,d,e){var f,g={},h=null;return e||(e=b),f=a.commonKeys(c,d),f.forEach(function(a){h=e(c[a],d[a]),null!==h&&(g[a]=h)}),g},a.difference=function(c,d,e){var f=a.uniqueKeys(c,d),g=null;e||(e=b);var h={};return f.forEach(function(a){g=e(c[a]),null!==g&&(h[a]=g)}),h},a.isin=function(b,d,e){e||(e=c);for(var f,g=!1,h=a.getSetIterator(d);h.hasNext()&&!g;)f=h.next(),g=e(b,f.key,f.value);return g}}(),function(){"use strict";function a(c,d,e,f){var g=d.shift();b(c,g,function(){if(f){for(var b={},h=0,i=g.length;i>h;h++)b[g[h]]=!0;f(b,e,!d.length)}d.length&&a(c,d,e+1,f)})}function b(a,b,c){function d(){0===--f&&c&&c()}var e,f=a.length;if(0===f)return void(c&&Human.utils.async(c));for(var g=0,h=f;h>g;g++)e=a[g],l.attachAssetsToObject(e,b,d)}function c(a){a.geometryId&&Human.assets.putAsset(a.geometryId),a.materialId&&Human.assets.putAsset(a.materialId),a.transformId&&Human.assets.putAsset(a.transformId),a.morphId&&Human.assets.putAsset(a.morphId)}function d(a,b,c,e){if(a){Array.isArray(a)||(a=[a]);for(var f,g=0;g<a.length;g++){var h=a[g];if(h.anonymous=!1,!h.objectId){if(!b){d(h.objects,null,c,e);continue}h.objectId=b.objectId+p++,h.anonymous=!0}f=j(h,b,c),null!==f&&(null===b&&e.push(f),d(h.objects,f,c,e))}}}function e(a,b,c){for(var d=0,e=b.length;e>d;d++){var f=b[d];if(!a.attachedAssets[f]){var g,h=a[f+"Id"];h&&(c[f]=c[f]||{},g=c[f][h]=c[f][h]||[],g.push(a.objectId))}}return c}function f(){Human.events.fire("graph.assetAttach.start")}function g(a,b,c,d){o++,Human.events.fire("graph.assetAttach.progress",{assetId:a,targetObjects:c,assetType:b,nullAsset:d}),m[b]||(m[b]=[]),d||m[b].push(a),n===o&&h()}function h(){Human.events.fire("graph.assetAttach.finish",m),m={},n=0,o=0}function i(a,b,c,d){0===n&&f(),n++,Human.assets.getAsset(a,b,function(e){if(e)for(var f=0,h=c.length;h>f;f++){var i=c[f],j=Human.scene.objects[i];j&&j.attachAsset(b,e)}g(a,b,c,!e),d(e)})}function j(a,b,c){var d=a.objectId,e=a.geometryId||null,f=a.morphId||null,g=a.materialId||null,h=a.transformId||null,i=a.regionMapId||null;if(c){var j=c+"-",l=c+"/";(0!==d.indexOf(j)||a.anonymous)&&(d=j+d),e&&0!==e.indexOf(l)&&(e=l+e),f&&0!==f.indexOf(l)&&(f=l+f),g&&0!==g.indexOf(l)&&(g=l+g),h&&0!==h.indexOf(l)&&(h=l+h),i&&0!==i.indexOf(l)&&(i=l+i)}if(Human.scene.objects[d])return null;void 0===a.layer&&(a.layer=b?b.layer:0),a.objectId=d,a.modelId=c,a.parent=b,a.parentObjectId=b?b.objectId:null,a.materialId=g,a.geometryId=e,a.morphId=f,a.transformId=h,a.regionMapId=i,a.tags=a.tags||[],a.capColor=k("capColor",a,b);var m=Human.scene.createObject(a);return void 0!==a.opacity&&m.setOpacity(a.opacity),m}function k(a,b,c){return c?void 0!==b[a]&&null!==b[a]?b[a]:c[a]:b[a]}var l=Human.scene.graph={},m={},n=0,o=0,p=0;l.buildSceneGraph=function(a,b){var c=[];return p=0,d(a,null,b,c),c},l.gatherAssetIdsFromObject=function(a,b,c){Array.isArray(a)||(a=[a]),b=b||["geometry","material","transform","morph"],c=c||{};for(var d=0,f=a.length;f>d;d++)e(a[d],b,c);return c},l.attachAssetsToObject=function(a,b,c){function d(){0===--e&&c&&c()}"function"==typeof b&&(c=b,b=null),Array.isArray(a)||(a=[a]),b=b||["geometry","material","transform","morph"];for(var e=0,f=0,g=a.length;g>f;f++){var h=l.gatherAssetIdsFromObject(a[f],b);e++,l.attachAssets(h,d)}},l.attachAssetSetsToSubtree=function(b,c,d){function e(a){k[a.objectId]=a}function f(a){i[a.objectId]||(j.push(a),i[a.objectId]=!0)}"function"==typeof c&&(d=c,c=null),Array.isArray(b)||(b=[b]),c=c||[["geometry","material","transform"],["morph"]];for(var g,h,i={},j=[],k={},l=0;l<b.length;l++)b[l].getLeafObjects(e);for(g in k)k.hasOwnProperty(g)&&(g=Human.modules.convertBaseAnatomyObjectId(g),h=k[g],h&&h.traverseUp(f));a(j,c,0,d)},l.attachAssets=function(a,b){function c(){0===--d&&b&&b()}var d=0,e=Object.keys(a);if(0===e.length)return void(b&&Human.utils.async(b));for(var f=0,g=e.length;g>f;f++){var h=e[f],j=a[h];if(!j)return;for(var k in j)if(j.hasOwnProperty(k)){var l=j[k];d++,i(k,h,l,c)}}},l.destroySubtree=function(a){Array.isArray(a)||(a=[a]);var b,d,e;for(b=0,d=a.length;d>b;b++)e=a[b],e.traverseDown(c),Human.scene.destroyObject(e.objectId)}}(),function(){"use strict";var a=Human.timeline={};a.animations={},a.leafTimelines={},a.branchTimelines={},a.rootTimelines={},a.activeRoot=null,a.FRAME_LENGTH=.033,a.TIME_CONSTANT=.001,a.borderConditions={start:{which:"second",direction:a.direction},middle:{which:"both",direction:a.direction},end:{which:"first",direction:a.direction}},a.playing=!1,a.transitioning=!1,a.playfree=!0,a._lastWorldTime=0,a._dynamicTransition={},a._time1=0,a._time2=0,a._freeTime=0,a.time=0,a.playQueue=[],a.loop=!1,a.scale=1,a.direction="forwards",a._playParams=null,a._scrubParams=null,a.chapters={},a.chapterList=[];var b,c,d,e,f;a.addAnimation=function(b,c){return c.update?(a.animations[b]&&a.removeAnimation(b),a.animations[b]=c,void Human.events.fire("Timeline.Loaded")):void Human.log.error("Human.timeline.addAnimation","Param expected: update")},a.removeAnimation=function(b){var c=a.animations[b];return c?(delete a.animations[b],c.destroy&&c.destroy(),void(Human.utils.isEmpty(a.animations)&&Human.events.fire("Timeline.Empty"))):void Human.log.warn("Human.timeline.removeAnimation","Animation not found: "+b)};var g=function(){return"forwards"===a.direction?a._time2:a._time1},h=function(){return"forwards"===a.direction?a._time1:a._time2},i=function(){var b=g();return a.time===b?!0:!1},j=function(){var b=h();return a.time===b?!0:!1},k=function(b){var c={},d="backwards"===b?-1:1,e=["forwards","backwards"];return e.indexOf(b)<0?(Human.log.warn("timeline.setBorderConditions","invalid direction :"+b),null):(c.start={which:"second",direction:b},c.middle={which:"both",direction:b},c.end={which:"first",direction:b},a.direction=b,a.borderConditions=c,void(a.scale=d*Math.abs(a.scale)))};a.initScene=function(){a.activeRoot&&a.activeRoot.initScene()},a.initCamera=function(b){a.activeRoot&&a.activeRoot.initCamera(b)},a.cancelCameraInit=function(){a.activeRoot&&a.activeRoot.cancelCameraInit()},a.initAnnotations=function(){a.activeRoot&&a.activeRoot.initAnnotations()},a.cancelAnnotationInit=function(){a.activeRoot&&a.activeRoot.cancelAnnotationInit()},a.initTransparencies=function(){Human.log.error("timeline.initTransparencies() is deprecated and no longer required for loading")},Human.events.on("tick",function(){if(b=a.activeRoot,null!==b&&void 0!==b){if(c=(new Date).getTime(),d=(c-a._lastWorldTime)*a.TIME_CONSTANT,e=d/a.FRAME_LENGTH,a._lastWorldTime=c,a.time>a._time2?a.time=a._time2:a.time<a._time1&&(a.time=a._time1),a.playfree&&(b.updateFreeAnimations(a._freeTime),a._freeTime+=a.scale*e*a.FRAME_LENGTH),a.transitioning&&a.playing){var g=a._dynamicTransition;g._time1<=g.time&&g.time<=g._time2?(g.branch.update(g.time),g.time+=e*a.FRAME_LENGTH):(a.transition=null,a.transitioning=!1)}if(!a.transitioning&&a.playing){b.prepareNextTransition(a.time),f=a.borderConditions.middle;var k=!0;i()?a.loop===!0?(f=a.borderConditions.start,a.time=h()):(f=a.borderConditions.end,k=!1):j()&&(f=a.borderConditions.start),b.update(a.time,f),k?(a.playing=!0,Human.events.fire("timeline.playing",{time:a.time}),a.time+=a.scale*e*a.FRAME_LENGTH):(a.playing=!1,Human.events.fire("timeline.stopped",{time:a.time}))}}}),Human.events.on("timeline.stopped",function(){if(a.playQueue.shift(),a.playQueue.length>0){var b=a.playQueue[0];a._play(b)}else Human.events.fire("timeline.paused",{time:Human.timeline.time})}),a.play=function(b){b=b||{},b.queue&&a.playing?a.playQueue.push(b):(a.playQueue=[b],a._play(b))},a._play=function(b){b=b||{};var c=a.activeRoot,d="forwards";c.getTimeFrame();var e,f,g,h,i,j,m=null,n=null,o=null,p=b.hasOwnProperty("align")?b.align:!0,q=["nextChapter","prevChapter","startChapterId","startTime"],r=["nextChapter","prevChapter","finishChapterId","finishTime","numChapters"],s=null;switch(a._playParams=b,e=l(q,b)[0]||"default",f=l(r,b)[0]||"default",e){case"nextChapter":h=0,g=c.getNeighborChapter(c._nowBranch,"next");break;case"prevChapter":h=0,g=c.getNeighborChapter(c._nowBranch,"previous");break;case"startChapterId":if(h=0,g=c.getBranch({id:b.startChapterId}),Human.utils.isEmpty(g))return void Human.log.warn("timeline.play","Invalid chapter id: "+b.startChapterId);break;case"startTime":s=c.mapGlobalTime(b.startTime,{tie:"later"}),g=s.branch,h=s.time;break;case"default":g=c._chapters[0],h=0}switch(f){case"nextChapter":i=g,j=i.getTimeFrame().lastTime;break;case"prevChapter":i=g,j=i.getTimeFrame().lastTime;break;case"finishChapterId":if(i=c.getBranch({id:b.finishChapterId}),Human.utils.isEmpty(i))return void Human.log.warn("timeline.play","Invalid chapter id: "+b.finishChapterId);j=i.getTimeFrame().lastTime;break;case"finishTime":if(0===b.finishTime)i=c._chapters[0],j=0;else{var t={tie:"earlier"};s=c.mapGlobalTime(b.finishTime,t),i=s.branch,j=s.time}break;case"numChapters":var u=c.whereIsBranch(g,{chapters:!0}),v=c._chapters.length-u,w=b.numChapters||1;w=Math.min(w,v),i=c._chapters[u+w-1],j=i.getTimeFrame().lastTime;break;case"default":i=c._chapters[c._chapters.length-1],j="end"}if(m=c.mapBranchTime(g,h),n=c.mapBranchTime(i,j),n>=m?(d="forwards",o=m):(s=m,m=n,n=s,o=n,d="backwards"),p&&("forwards"===d?(m=c.mapBranchTime(g,0),n=c.mapBranchTime(i,"end")):"backwards"===d&&(m=c.mapBranchTime(i,0),n=c.mapBranchTime(g,"end"))),b.loop===!0)a.loop=!0;else{a.loop=!1;var x=["startChapterId","nextChapter","prevChapter"],y=["numChapters","nextChapter","finishChapterId"];x.indexOf(e)>=0&&y.indexOf(f)>=0&&g.id===i.id&&(a.loop=g.animation.loop)}a._time1=m,a._time2=n,a.time=o,k(d),a.playing=!0,a.transitioning=!1,a._lastWorldTime=(new Date).getTime(),Human.events.fire("timeline.played",{time:a.time})};var l=function(a,b){var c=Object.keys(b),d=function(a){return c.indexOf(a)>=0};return a.filter(d)};a.stop=function(){a.playing=!1,a.transitioning=!1,a.playQueue=[],Human.events.fire("timeline.stopped",{time:a.time})},a.scrub=function(b){var c,d=a.activeRoot,e=0,f={which:"first",direction:"forwards"};if(a.playQueue=[],a._scrubParams=b,b.hasOwnProperty("time"))e=b.time;else if(b.hasOwnProperty("chapterId")){var g=d.getBranch({id:b.chapterId});g?(e=d.mapBranchTime(g,0),f={which:"second",direction:"forwards"}):e=a.time}else e=a.time;if(b.hasOwnProperty("borderCondition")){var h=b.borderCondition,i=["first","both","second"],j=["forwards","backwards"];i.indexOf(h.which)>=0&&(f.which=h.which),j.indexOf(h.direction)>=0&&(f.direction=h.direction)}0===e?f={which:"second",direction:"forwards"}:e===d.getTimeFrame.lastTime&&(f={which:"first",direction:"forwards"}),(e<a._time1||e>a._time2)&&(c=d.mapGlobalTime(e,f),a._time1=d.mapBranchTime(c.branch,0),a._time2=d.mapBranchTime(c.branch,"end")),a.playing=!1,a.transitioning=!1,a.time=e,d.update(e,f),Human.events.fire("timeline.scrubbed",{time:a.time})},a.next=function(){var b=a.activeRoot,c=Human.properties.properties["timeline.prevNextMode"],d=b._nowBranch,e=b.getNeighborChapter(d,"next");if(b.isLast(d))return void Human.log.warn("timeline.next","can't proceed beyond last chapter");var f=b.whereIsBranch(d);"transition"===b._theQueue[f+1].role&&(d=b._theQueue[f+1]);var g=b.mapBranchTime(d,"end")+.001;if("play"===c){var h;h=e.animation.loop?{startTime:b.mapBranchTime(e,0),align:!0,finishTime:b.mapBranchTime(e,"end"),loop:e.animation.loop,queue:!1}:{startTime:a.time,align:!1,finishTime:g,loop:!1,queue:!0},a.play(h)}else a.scrub({time:g})},a.prev=function(){var b=a.activeRoot,c=Human.properties.properties["timeline.prevNextMode"],d=b._nowBranch;if(b.isFirst(d))return void Human.log.warn("timeline.next","can't go to chapter before first chapter");var e,f=b.getNeighborChapter(d,"previous"),g=b.mapBranchTime(f,"start")+.001;"play"===c?(e=d.animation.loop?{startTime:b.mapBranchTime(f,"start"),align:!0,finishTime:b.mapBranchTime(f,"end"),loop:f.animation.loop,queue:!1}:{startTime:b.mapBranchTime(f,"end"),align:!1,finishTime:b.mapBranchTime(f,"start"),loop:!1,queue:!1},a.play(e)):a.scrub({time:g})},a.getBookmark=function(){var b={};return Human.timeline.activeRoot&&(b.rootName=Human.timeline.activeRoot.id),a.playing?b.play=a._playParams:b.scrub=a._scrubParams,b},a.setBookmark=function(b){if(b.rootName&&a.rootTimelines.hasOwnProperty(b.rootName))a.activeRoot=a.rootTimelines[b.rootName];else if(b.modules&&b.modules.activeModules){var c=b.modules.activeModules;c=c.filter(function(a){return Human.timeline.rootTimelines.hasOwnProperty(a)}),c.length>1&&(c=c.filter(function(a){return!Human.modules.isBaseModule(a)}));var d=c[0];Human.timeline.activeRoot=Human.timeline.rootTimelines[d]}else Human.log.warn("Human.timeline.setBookmark: Unable to set appropriate root timeline")},a.pause=function(){a.playing=!1,a.transitioning=!1,Human.events.fire("timeline.paused",{time:a.time})},a.unpause=function(){var b={startTime:a.time,numChapters:1,loop:a.activeRoot._nowBranch.animation.loop};a.play(b),Human.events.fire("timeline.unpaused",{time:a.time})},a.playFreeAnimations=function(){a.playfree=!0},a.pauseFreeAnimations=function(){a.playfree=!1},a.getTimeFrame=function(){return Human.utils.isEmpty(a.activeRoot)?0:a.activeRoot.getTimeFrame()},a.getCurrentChapterCamera=function(){return Human.timeline.activeRoot._nowBranch.getCamera(0)},a._convertPlayParams=function(a){var b=a;return a.hasOwnProperty("endTime")&&(b.finishTime=b.endTime),a.hasOwnProperty("endChapterId")&&(b.finishChapterId=a.endChapterId),b},a.query=function(){if(!a.activeRoot)return{};var b=a.activeRoot._assembleQueryChapters();return{chapters:b,time:a.time,timeFrame:a.getTimeFrame(),playing:a.playing,paused:!a.playing}},a.destroyChapterSet=function(b){if(a.stop(),a.chapterList=[],a.rootTimelines.hasOwnProperty(b))a.rootTimelines[b].destroy();else if(b)for(var c in a.rootTimelines)a.rootTimelines.hasOwnProperty(c)&&(Human.modules.isBaseModule(c)||a.rootTimelines[c].destroy());else Human.log.warn("timeline.destoryChapterSet","Invalid argument: "+b)},a.addMorphs=function(a){function b(a){var b={};for(var c in d.maps)d.maps.hasOwnProperty(c)&&d.maps[c].data.timeline.id===a&&(b[c]=d.maps[c]);return b}function c(a){if(Object.keys(g).indexOf(a)<0&&(i={},i.start=j[e],i.end=j[e+1],i.timeline=Human.timeline.leafTimelines[a],i.fit=!1,i.onEnd="freeze",h=i.end-i.start,d.makeMapComponent(a,0,h,i)),e===Human.timeline.activeRoot._chapters.length-1){var c=b(a);for(var f in c)c.hasOwnProperty(f)&&(void 0===c[f].data.end||null===c[f].data.end)&&(k=!0,h=Human.timeline.leafTimelines[a].getTimeFrame().lastTime-j[e],i={},i.start=j[e],i.timeline=Human.timeline.leafTimelines[a],i.fit=!1,i.onEnd="freeze",i.end=Human.timeline.leafTimelines[a].getTimeFrame().lastTime,delete d.maps[f],d.makeMapComponent(a,0,Math.max(1,h),i))}}var d,e,f,g,h,i={},j=Human.timeline.activeRoot._times,k=!1,l={};if(0!==a.length){a.forEach(function(a){l[a.split("/")[0]]=!0});var m=Object.keys(Human.timeline.leafTimelines).filter(function(a){return l[a]});for(e=0;e<Human.timeline.activeRoot._chapters.length;e++){d=Human.timeline.activeRoot._chapters[e];for(f in d.maps)d.maps.hasOwnProperty(f)&&"dummy"===d.maps[f].data.timeline.id&&delete d.maps[f];g=d.getUniqueLeafTimelines(),m.forEach(c)}k&&Human.timeline.activeRoot.build()}}}(),function(){"use strict";Human.timeline.TweenAnimation=function(a){this._options=a.options||{},this._tweens=a.tweens,this.timeline=a.timeline,this.firstTime=1e6,this.lastTime=-1e6;for(var b,c=0,d=this._tweens.length;d>c;c++)b=this._tweens[c],b.firstTime<this.firstTime&&(this.firstTime=b.firstTime),b.lastTime>this.lastTime&&(this.lastTime=b.lastTime)},Human.timeline.TweenAnimation.prototype.update=function(a,b){for(var c=0,d=this._tweens.length;d>c;c++)this._tweens[c].update(a,b)},Human.timeline.TweenAnimation.prototype.destroy=function(){for(var a,b=0,c=this._tweens.length;c>b;b++)a=this._tweens[b],a.destroy&&a.destroy()}}(),function(){"use strict";function a(a){for(var b in a)if(a.hasOwnProperty(b)&&!Human.utils.isObject(a[b]))return!1;return!0}Human.timeline.Tween=function(b){this._control=b.control,this._tweenList=[];for(var c,d,e,f,g,h,i={},j=0,k=b.targets.length;k>j;j++){c=b.targets[j],d=b.keys[j],Human.utils.isObject(c.attr)&&a(c.attr)&&(c=c.attr),e=c;for(var l in e)e.hasOwnProperty(l)&&(f=e[l],g=i[l],g||(h=this._control.attr[l],g=new Human.timeline.TweenAttr(h,b.options),i[l]=g,this._tweenList.push(g)),g.addTarget(d,f))}this.firstTime=b.keys[0],this.lastTime=b.keys[b.keys.length-1]},Human.timeline.Tween.prototype._run=function(a,b){for(var c=0,d=this._tweenList,e=0,f=d.length;f>e;e++)d[e].update(a,b)&&c++;return c},Human.timeline.Tween.prototype.query=function(a,b){return this._run(a,b),this._control.attr},Human.timeline.Tween.prototype.update=function(a,b){this._run(a,b)>0&&this._control.update(a)}}(),function(){"use strict";function a(a,b,c,d){"number"!=typeof c&&(c=c.value);var e=a.controlPoints,f=Math.floor(50*(b-d));a.bezier=new Human.math.bezier(d,c,e.x[0],e.y[0],e.x[1],e.y[1],b,a.value),a.lookUp=a.bezier.getLUT(f)}function b(a,b,c,d,e){var f=(a-b)/(c-b),g=e-d,h=f*g;return d+h}function c(a,c){var d,e,f,g=c.lookUp,h=0,i=g.length-1;if(a<=g[h].x)return g[h].y;if(a>=g[i].x)return g[i].y;for(;i>=h;){if(d=Math.floor((h+i)/2),e=g[d],f=g[d+1],e.x<=a&&f.x>=a)return b(a,e.x,f.x,e.y,f.y);e.x>a?i=d-1:h=d+1}}Human.timeline.TweenAttr=function(a,b){this.attr=a,this.attrNames=null,b=b||{},this.keys=[],this.attrTargetLists={},this._tweens=[],this._key1=0,this._key2=1,this._firstKey=null,this._lastKey=null,this._keyDiff=null,this._loop=!!b.loop,this._timeOffset=b.timeOffset||0,this._paddingDirty=!0},Human.timeline.TweenAttr.prototype.addTarget=function(b,c){b+=this._timeOffset,this.keys.push(b);var d,e,f,g,h,i=this.keys.length-1;for(var j in c)if(c.hasOwnProperty(j)){if(d=this.attrTargetLists[j],!d){if(this.keys.length>1)throw"First target in tween must contain a value for each animated attribute on target";d=this.attrTargetLists[j]=[]}if(f=c[j],d[i]=f,"number"!=typeof f&&a(f,b,d[i-1],this.keys[i-1]),i>0)for(e=!1,g=i-1;!e&&g>=0;)h=d[g],void 0===h&&null===h?(d[g]=f,g--):e=!0}(null===this._firstKey||this._firstKey>b)&&(this._firstKey=b),(null===this._lastKey||this._lastKey<b)&&(this._lastKey=b),this._keyDiff=this._lastKey-this._firstKey,this._paddingDirty=!1},Human.timeline.TweenAttr.prototype._padTargets=function(){var a,b,c,d=this.attrTargetLists,e=this.keys.length;for(a in d)if(d.hasOwnProperty(a)){if(b=d[a],b.length===e)continue;for(c=b[b.length-1];b.length<e;)b.push(c)}this._paddingDirty=!1},Human.timeline.TweenAttr.prototype.update=function(a,d){this._paddingDirty&&this._padTargets();var e=this.keys,f=this.attrNames?this.attrNames:this.attrNames=Object.keys(this.attrTargetLists);if(this._loop)d=this._firstKey+d%this._keyDiff;else{if(d<e[0])return this._key1=0,this._key2=1,this._clampToTarget(f,0),!0;if(d>e[e.length-1])return this._key1=e.length-2,this._key2=this._key1+1,this._clampToTarget(f,this.keys.length-1),!0}for(;e[this._key1]>d;)this._key1--,this._key2--;for(;e[this._key2]<d;)this._key1++,this._key2++;var g,h,i,j,k,l,m=this.attrTargetLists,n=this._key1,o=this._key2,p=this.attr,q=!1;for(j=0,k=f.length;k>j;j++)l=f[j],g=m[l],h=g[n],"number"!=typeof h&&(h=h.value),i="number"==typeof g[o]?b(d,e[n],e[o],h,g[o]):c(d,g[o]),p[l]=i,q=!0;return q},Human.timeline.TweenAttr.prototype._clampToTarget=function(a,b){var c,d,e,f,g=this.attr,h=this.attrTargetLists;for(d=0,e=a.length;e>d;d++)f=a[d],c=h[f][b],"number"!=typeof c&&(c=c.value),g[f]=c}}(),function(){"use strict";var a=1,b=2,c=3,d=4;Human.timeline.Switch=function(a){this._keys=a.keys,this._targets=a.targets,this._control=a.control,this._options=a.options||{},this._key=0,this._lastKey=null,this.firstTime=a.keys[0],this.lastTime=a.keys[a.keys.length-1]},Human.timeline.Switch.prototype.query=function(a,b){return this._findTarget(b),this._targets[this._key]},Human.timeline.Switch.prototype.update=function(d,e){var f=this._findTarget(e);switch(f){case a:return;case b:break;case c:}this._control.attr=this._targets[this._key],this._control.update(d),this._lastKey=this._key},Human.timeline.Switch.prototype._findTarget=function(e){if(e<this._keys[0])return this._key=0,a;if(e===this._keys[0])return this._key=0,b;if(e>this._keys[this._keys.length-1])return this._key=this._keys.length-1,c;for(;this._keys[this._key]>e;)this._key--;for(;void 0!==this._keys[this._key+1]&&null!==this._keys[this._key+1]&&this._keys[this._key+1]<e;)this._key++;return d}}(),function(){"use strict";Human.timeline.CameraControl=function(){this.attr={up:{x:0,y:1,z:0},eye:{x:0,y:0,z:0},look:{x:0,y:0,z:0}}},Human.timeline.CameraControl.prototype.update=function(a){return a.cameraEnabled!==!1?(Human.view.camera.setLookAt(this.attr),!0):void 0}}(),function(){"use strict";Human.timeline.MaterialControl=function(a){this._materialId=a.modelId+"/"+a.materialId,this.attr={},a.attributes.hasOwnProperty("attr")&&(a.attributes=a.attributes.attr);var b,c={r:0,g:0,b:0,a:1},d={r:1,g:1,b:1},e={r:0,g:0,b:0},f={"float":1};for(b in a.attributes)a.attributes.hasOwnProperty(b)&&("baseColor"===b?this.attr.baseColor=c:"specularColor"===b?this.attr.specularColor=d:"emitColor"===b?this.attr.emitColor=e:"alphaColor"===b&&(this.attr.alphaColor=f))},Human.timeline.MaterialControl.prototype.update=function(){var a=Human.assets.materials.materials[this._materialId];if(!a)return void(this._targetMissing||(Human.log.error("Human.timeline.TweenAnimation","'material' tween can't find material: "+this._materialId),this._targetMissing=!0));if(a.material){var b=a.material,c=this.attr;return c.baseColor&&b.setBaseColor(c.baseColor),c.specularColor&&b.setSpecularColor(c.specularColor),c.emitColor&&b.setEmitColor(c.emitColor),c.alphaColor&&b.setAlpha(c.alphaColor["float"]),!0}}}(),function(){"use strict";function a(c,d){if(void 0!==d.opacity&&null!==d.opacity&&c.setOpacity(d.opacity),void 0!==d.pickable&&null!==d.pickable&&c.setPickable(d.pickable),void 0!==d.shown&&null!==d.shown&&b(c,d.shown),c.objects.length>0)for(var e=c.objects,f=0,g=e.length;g>f;f++)a(e[f],d)}Human.timeline.ObjectControl=function(a){var b=a.objectId;b.indexOf(".")<0&&b.indexOf("-")<0&&(b=a.modelId+"-"+a.objectId),this._objectId=b,this.attr={attr:{}}},Human.timeline.ObjectControl.prototype.update=function(){var b=Human.scene.objects[this._objectId];if(!b)return void(this._targetMissing||(Human.log.warn("Human.timeline.TweenAnimation","'lerp:objectAttr' tween can't find object: "+this._objectId),this._targetMissing=!0));var c=Human.timeline.activeRoot._nowBranch.synchronization[this._objectId];c&&c.shown===!1||a(b,this.attr.attr)};var b=function(){function a(a,b){var c=Human.scene.enabledObjects,d=!!c[a.objectId];if(a.isLeaf()&&d!==b)return!0;if(b){if(a.numSubObjects!==a.numEnabledSubObjects)return!0;for(;a;){if(d!==b)return!0;a=a.parent}}else if(a.numEnabledSubObjects>0)return!0;return!1}var b={},c=!1;return Human.events.on("tick",function(){c&&(Human.scene.setEnabledObjects({objectIds:b,replace:!1}),b={},c=!1)}),function(d,e){a(d,e)&&(b[d.objectId]=e,c=!0)}}()}(),function(){"use strict";Human.timeline.ObjectTransformControl=function(a){var b=a.objectId,c=a.initial;b.indexOf(".")<0&&b.indexOf("-")<0&&(b=a.modelId+"-"+a.objectId),this._objectId=b;var d=this.attr={};["translate","rotate","scale","pivot"].forEach(function(a){var b="scale"===a?1:0;void 0!==c[a]&&(d[a]={},void 0!==c[a].x&&(d[a].x=b),void 0!==c[a].y&&(d[a].y=b),void 0!==c[a].z&&(d[a].z=b))})},Human.timeline.ObjectTransformControl.prototype.update=function(){var a=Human.scene.objects[this._objectId];if(!a)return void(this._targetMissing||(Human.log.warn("Human.timeline.ObjectTransformControl","Can't find object: "+this._objectId),this._targetMissing=!0));var b=!0;(void 0===b||null===b||b===!0)&&a.setTransform(this.attr)}}(),function(){"use strict";Human.timeline.TextureControl=function(a){return this._material=a.modelId+"/"+a.materialId,void 0===a.targetLayer||null===a.targetLayer?void Human.log.error("Human.timeline.TweenAnimation","'texture' tween attribute expected: 'targetLayer'"):(this._targetLayer=a.targetLayer,void(this.attr={rotate:{z:0},translate:{x:0,y:0},scale:{x:1,y:1},blend:{factor:1}}))},Human.timeline.TextureControl.prototype.update=function(){var a=Human.assets.materials.materials[this._material];if(!a)return void(this._targetMissing||(Human.log.error("Human.timeline.TweenAnimation","'material' tween can't find material: "+this._material),this._targetMissing=!0));var b=a.textures;if(this._targetLayer>=0&&this._targetLayer<b.length){var c=b[this._targetLayer],d=this.attr;d.scale&&c.setScale(d.scale),d.translate&&c.setTranslate(d.translate),void 0!==d.rotate&&null!==d.rotate&&c.setRotate(d.rotate.z),void 0!==d.blend&&null!==d.blend&&c.setBlendFactor(d.blend.factor)}}}(),function(){"use strict";Human.timeline.FresnelControl=function(a){this._materialId=a.modelId+"/"+a.materialId,this._fresnelType=a.fresnelType,"baseFresnel"===this._fresnelType&&(this._fresnelType="colorFresnel"),this.attr={bias:{edge:0,center:.7,power:1},edge:{r:.8,g:.7,b:.7},center:{r:.05,g:.05,b:.09}}},Human.timeline.FresnelControl.prototype.update=function(){if(!this._fresnel){var a=Human.assets.materials.materials[this._materialId];if(!a)return void(this._materialMissing||(Human.log.error("Human.timeline.TweenAnimation","'material' tween can't find material: "+this._materialId),this._materialMissing=!0));var b=this._fresnelType.length<=7?this._fresnelType:this._fresnelType.substring(0,this._fresnelType.length-7);if(this._fresnel=a.fresnels[b],!this._fresnel)return void(this._fresnelMissing||(Human.log.error("Human.timeline.TweenAnimation","'material' tween can't find fresnel type: "+this._fresnelType),this._fresnelMissing=!0))}var c=this.attr.bias;return this._fresnel.setEdgeBias(c.edge),this._fresnel.setCenterBias(c.center),this._fresnel.setPower(c.power),this._fresnel.setEdgeColor(this.attr.edge),this._fresnel.setCenterColor(this.attr.center),!0}}(),function(){"use strict";function a(){j=[],k=[],l=0}function b(a){0===j.length&&(l=0),k.push(a.time),j.push(a)}function c(a){l=a,e()}function d(){return k.length>0?k[k.length-1]:0}function e(){if(0!==j.length){if(l<=k[0])return void Human.view.camera.setLookAt(j[0]);if(l>=d()||1===j.length)return void Human.view.camera.setLookAt(j[j.length-1]);for(var a=0;k[a]<l;)++a;f(l,a-1)}}function f(a,b){var c=k[b],d=k[b+1],e=j[b],f=j[b+1];Human.view.camera.setLookAt({eye:g(a,c,d,e.eye,f.eye),look:g(a,c,d,e.look,f.look),up:g(a,c,d,e.up,f.up)})}function g(a,b,c,d,e){var f=(a-b)/(c-b),g=1-f;return{x:d.x*g+e.x*f,y:d.y*g+e.y*f,z:d.z*g+e.z*f}}var h=Human.timeline.chapterCameras={};h.pathMode=!1;var i=[],j=[],k=[],l=0,m=!0;Human.events.on("timeline.chapters.updated",function(c){a();for(var d,e,f=0,g=c.length;g>f;f++)d=c[f],e=d.flyTo||d.jumpTo,e&&(e.time=d.time,b(e));i=c}),Human.events.on("timeline.playing",function(a){m&&h.pathMode&&c(a.time)}),Human.events.on("timeline.scrubbed",function(a){m&&h.pathMode&&c(a.time)}),Human.events.on("timeline.chapters.activated",function(a){if(m&&!h.pathMode){var b=i[a.newChapterIndex];b&&(b.flyTo?Human.view.camera.fly.flyTo(b.flyTo):b.jumpTo&&Human.view.camera.fly.jumpTo(b.jumpTo))}})}(),function(){"use strict";function a(a){$(document).bind(a,i[a]=function(){e=!1,b()})}function b(){c&&(clearTimeout(c),c=null),d&&(c=setTimeout(function(){if(d&&!Human.timeline.playing&&!e){e=!0;var a=h[g]||h.play;a()}},1e3*f))}var c=null,d=!1,e=!1;Human.properties.subscribe({propId:"timeline.autoPlay.enabled",value:d,callback:function(a){d=!!a,d?b():e=!1}});var f=10,g="play",h={play:function(){Human.timeline.play({startTime:Human.timeline.time})},"chapter-rotate":function(){var a=5e3,b=function(){if(e)var b=Human.view.camera.eye.x,d=0,f=20,g=setInterval(function(){e||clearInterval(g),Human.view.camera.rotateY(.5);var h=Math.abs(b-Human.view.camera.eye.x);(.005>=h&&d>5*f||d>40*f)&&(clearInterval(g),setTimeout(c,a)),d++},f)},c=function(){e&&(Human.timeline.time===Human.timeline.getTimeFrame().lastTime?(Human.timeline.scrub({time:0}),setTimeout(b,a)):Human.timeline.next(),Human.events.once("timeline.stopped",function(){setTimeout(b,a)}))};c()}};Human.properties.subscribe({propId:"timeline.autoPlay.type",value:g,callback:function(a){g=a}}),Human.events.on("started",function(){b()}),Human.events.on("timeline.stopped",function(){b()});var i={};a("mousedown"),a("keydown"),a("mousewheel")}(),Human.timeline.LeafTimeline=function(a,b){"use strict";function c(a){return a instanceof Human.timeline.Switch}function d(a){var b=a._targets;if(!b||0===b.length)return!1;var c,d;for(c=0,d=b.length;d>c;c++)if(b[c].attr.hasOwnProperty("shown"))return!0;return!1}function e(a){var b=a._tweenList;if(!b||0===b.length)return!1;var c,d,e,f,g=Human.timeline.TweenAttr;for(c=0,d=b.length;d>c;c++)if(e=b[c],e instanceof g&&(f=e.attrTargetLists,f&&f.hasOwnProperty("opacity")))return!0;return!1}var f=this;b=b||{},f.level="leaf",f.id=a,f.animations={},f.timelineAnimations={},f.freeAnimations={},f.cameraTween=null,f.animationCtx={cameraEnabled:!0},Human.timeline.leafTimelines[f.id]=f,f.addAnimation=function(a,b){if(!b)return void Human.log.error("LeafTimeline.addAnimation","null or undefined animation object");if(!b.update)return void Human.log.error("LeafTimeline.addAnimation","Param expected: update");if(f.animations[a]&&f.removeAnimation(a),f.animations[a]=b,b.timeline===!1?f.freeAnimations[a]=b:f.timelineAnimations[a]=b,!f.cameraTween){var c,d,e,g=!1,h=b._tweens||[],i=Human.timeline.CameraControl;for(c=0,d=h.length;d>c&&!g;c++)e=h[c],e._control&&e._control instanceof i&&(g=!0,f.cameraTween=e)}Human.events.fire("Timeline.Loaded")},f.removeAnimation=function(a){var b=f.animations[a];return b?(a in f.freeAnimations?delete f.freeAnimations[a]:delete f.timelineAnimations[a],delete f.animations[a],void(b.destroy&&b.destroy())):void Human.log.warn("Human.timeline.LeafTimeline.removeAnimation","Animation not found: "+a)},f.getTimeFrame=function(){var a,b,c=!1,d=0,e=f.timelineAnimations;for(var g in e)e.hasOwnProperty(g)&&(c=!0,b=e[g].lastTime,d=Math.max(d,b));return a={firstTime:0,lastTime:d}},f.update=function(a,b,c){c=c||{};var d,e={cameraEnabled:a===!1?a:f.animationCtx.cameraEnabled},g=f.timelineAnimations;for(var h in g)g.hasOwnProperty(h)&&(d=g[h],"lerp:camera"===d.type?d.update(b):d.update(e,b))},f.destroy=function(){f.animations={},f.freeAnimations={},f.timelineAnimations={},f.cameraTween=null},f.hide=function(){var a,b={},c=f.getReferencedObjectIds(!1);for(a in c)c.hasOwnProperty(a)&&(b[a]=!1);Human.scene.setEnabledObjects({
  objectIds:b,replace:!1})},f.getCamera=function(a){return null===f.cameraTween||void 0===f.cameraTween?null:f.cameraTween.query(f.cameraTween._control,a)},f.getTweensByType=function(a,b){var c,d=0,e=f.animations;if("shown"===a||"visibility"===a)for(c in e)e.hasOwnProperty(c)&&(d=f._visibilityTweens(e[c],b,d));else if("opacity"===a||"transparency"===a)for(c in e)e.hasOwnProperty(c)&&(d=f._opacityTweens(e[c],b,d));return d},f.getTweenLibraries=function(){var a,b=[],c=f.animations;for(var d in c)c.hasOwnProperty(d)&&(a=c[d],a._tweens&&b.push(a));return b},f.getReferencedObjectIds=function(){var a,b,c,d,e,g,h,i=f.getTweenLibraries(),j=[];for(a=0,b=i.length;b>a;a++)for(c=i[a],d=0,e=c.length;e>d;d++)g=c[d],h=g._control._objectId,null!==h&&void 0!==h&&j.indexOf(h)<0&&j.push(h);return j},f._visibilityTweens=function(a){var b=a._tweens;if(!b)return[];var e=b.filter(c);return e.filter(d)},f._opacityTweens=function(a){var b=a._tweens;if(!b)return[];var c=b.filter(g);return c.filter(e)};var g=function(a){return a instanceof Human.timeline.Tween};f.queryTweens=function(a,b){"visibility"===a&&(a="shown");var c,d,e,g,h={},i=[],j=f.getTweensByType(a,i);for(c=0;j>c;c++)d=i[c],e=d.query({},b),g=e.attr,h[d._control._objectId]=g.hasOwnProperty(a)?g[a]:g;return h}},Human.timeline.BranchTimeline=function(a,b){"use strict";var c=this;c._onEndOptions=["loop","freeze","hide"],c.id=a.id,c.level="branch",c.role=b,c.childTimelines={},c.maps={},c.media={},c.firstUpdate=!0,c.sceneInitialized=!1,c.cameraInitialized=!1,c.cameraInitCanceled=!1,c.annotationsInitialized=!1,c.annotationInitCanceled=!1,c.animation={loop:!1},c.camera={},c.timeRange=null,c.moduleId=null,c.vizTweens={},c.info={displayName:"",description:""},c.options={},c.properties={},c.synchronization={},c.annotations=[],c.transition={},c.setRole=function(a){"chapter"===a?c.role="chapter":"transition"===a?c.role="transition":(Human.log.error("Failed to set role of branch timeline. Setting to chapter"),c.role="chapter")},c.makeMediaClip=function(a){var b={};"audio"===a.streamType?b=Human.media.audio.getClipById(a.clipId):"video"===a.streamType&&(b=Human.media.videos.getClipById(a.clipId)),a=Human.scene.sets.union(b,a),c.addClip(a.streamType+"_"+a.clipId,a)},c.makeMapComponent=function(a,b,d,e,f){f=f||{};var g={};g.mapId=a,g.start=b,g.end=d,g.data={},g.data=e;var h,i;if(g.data.fit){var j=g.data.end-g.data.start,k=g.end-g.start;h=j/k,i=g.data.start,g.calcChildTime=function(a){return h*(a-g.start)+i}}else h=1,i=g.data.start,"freeze"===g.data.onEnd||"hide"===g.data.onEnd?g.calcChildTime=function(a){var b=h*(a-g.start)+i;return Math.min(b,g.data.end)}:"loop"===g.data.onEnd?g.calcChildTime=function(a){var b=g.data.end-g.data.start,c=a-g.start;return c-b*Math.floor(c/b)+i}:Human.log.warn("WARNING: invalid onEnd property for branch timeline map data.");c.childTimelines.hasOwnProperty(e.timeline.id)||(c.childTimelines[e.timeline.id]=e.timeline),c.maps[a]=g,c.timeRange=c.getTimeFrame()},c.addClip=function(a,b){c.media.hasOwnProperty(a)&&delete c.media[a],b.hasOwnProperty("fullUrl")||(b.fullUrl=Human.media[b.streamType].clips[b.clipId].fullUrl);var d={data:b,published:!1};d.publish=function(){console.log("publishing "+b.fullUrl),Human.events.fire(b.streamType+".suggestedClipInfo",this.data),Human.events.fire(b.streamType+".suggestedClips",[this.data.clipId],!0),this.published=!0},d.update=function(a){this.data.time1<=a&&a<=this.data.time2&&(this.published||this.publish())},c.media[a]=d},c._getAudio=function(){var a=[];for(var b in c.media)c.media.hasOwnProperty(b)&&"audio"===c.media[b].data.streamType&&a.push(c.media[b].data);return a},c.getTimeFrame=function(){var a=0;for(var b in c.maps)c.maps.hasOwnProperty(b)&&c.maps[b].end>a&&(a=c.maps[b].end);0===a&&(a=2);var d={firstTime:0,lastTime:a};return d},c.checkChildTime=function(a,b){var c=a.getTimeFrame(),d=b;return b>c._lastTime?d=c._lastTime:b<c._firstTime&&(d=c._firstTime),d},c.checkOnEnd=function(a){return c._onEndOptions.indexOf(a)>=0?a:"freeze"},c.needsAnimatedTransition=function(){return Human.utils.isEmpty(c.transition)?!1:!0},c.getCamera=function(a){"end"===a?a=c.getTimeFrame().lastTime:"start"===a&&(a=0);var b=c.getAnimatedCamera(a);if(b)return b.screenPan=b.screenPan||c.options.screenPan,b;if(!Human.utils.isEmpty(c.camera))return b=c.camera.location,b.screenPan=c.options.screenPan,b;var d=Human.view.camera._startcamera;return d.screenPan=c.options.screenPan,d},c.getAnimatedCamera=function(a){var b=c.getTimeFrame();"start"===a||a<b.startTime?a=b.startTime:("end"===a||"last"===a||a>b.lastTime)&&(a=b.lastTime);var d=c.whichCameraMap(0);if(null===d||void 0===d)return null;if(!(a>=d.start&&a<=d.end))return null;var e=d.data.timeline,f=d.calcChildTime(a),g=e.getCamera(f);return null!==g&&void 0!==g?g:void 0},c.whichCameraMap=function(a){if("transition"===c.role)return c.maps.transitionCamera;if("chapter"===c.role){var b,d=c.whichMaps(a);for(b=0;b<d.length;b++)if(d[b].map.data.timeline.cameraTween)return d[b].map}return null},c._handleSynchronization=function(){Human.scene.setObjectProperties(c.synchronization)},c._handleProperties=function(){c.options.xray===!0?Human.rpc.call(null,"xray.setEnabled",{enable:!0}):Human.rpc.call(null,"highlight.setEnabled",{enable:!0});var a=Human.view.camera.getScreenPan(),b=c.options.screenPan;(a.x!==b.x||a.y!==b.y||a.z!==b.z)&&Human.view.camera.setScreenPan(b),Human.properties.set(c.properties),Human.view.effects.setEnabled({effectIds:c.effects,replace:!0})},c._handleAnnotations=function(){Human.view.annotations.clearAnnotations(),c.annotations.every(function(a,b){var d,e="___"+c.id+"."+b;if(!a.pos&&a.objectId){var f=Human.scene.objects[a.objectId];d=f.getCenter()}return Human.view.annotations.createAnnotation({annotationId:e,objectId:a.objectId,title:a.title||"",description:a.description||"",pos:a.pos||d,dir:a.pinVec||a.dir,type:a.type||"default",enabled:"secondary"===a.type?!1:!0,shown:"secondary"===a.type?!1:!0,labelShown:"secondary"===a.type?!1:!0,labelOffset:a.labelOffset||null,saved:!0,occludable:a.occludable,followsObject:a.followsObject}),!0})},c.reset=function(){c.firstUpdate=!0,c.sceneInitialized=!1,c.cameraInitialized=!1,c.annotationsInitialized=!1,c.maps.hasOwnProperty("transitionCamera")&&delete c.maps.transitionCamera;var a,b,d=c.media;for(a in d)d.hasOwnProperty(a)&&(b=d[a],b.published=!1)},c.whichMaps=function(a){var b=[],d=[];"start"===a?a=0:"end"===a&&(a=c.getTimeFrame().lastTime);for(var e in c.maps)if(c.maps.hasOwnProperty(e)){var f=c.maps[e];a>=f.start&&a<=f.end&&b.push(e)}if(b.indexOf("transitionCamera")>=0){var g=b.indexOf("camera");null!==g&&void 0!==g&&b.splice(g,1)}return b.every(function(a){var b=c.maps[a],e={map:b};return"leaf"===b.data.timeline.level?(e.camera=!0,d.push(e)):(e.camera=!1,d.unshift(e)),!0}),d},c.getChildLeafTimelines=function(a){var b=c.whichMaps(a),d={};return b.every(function(b){var c=b.map.data.timeline.id,e=b.map.calcChildTime(a);return d[c]=e,!0}),d},c.getUniqueLeafTimelines=function(){var a={};for(var b in c.maps)if(c.maps.hasOwnProperty(b)){var d=c.maps[b];a[d.data.timeline.id]=d.data.timeline}return a},c.query=function(a,b){var d={},e=c.getChildLeafTimelines(b);for(var f in e)if(e.hasOwnProperty(f)){var g=e[f],h=Human.timeline.leafTimelines[f].queryTweens(a,g);d=Human.scene.sets.union(d,h)}return d},c.initScene=function(){c.sceneInitialized||(c.sceneInitialized=!0,"chapter"===c.role&&Human.events.fire("timeline.chapters.activating",{chapterId:c.id}),c._handleProperties(),c._handleSynchronization(),Human.view.annotations.clearAnnotations())},c.initCamera=function(a,b){return"function"==typeof a&&(b=a,a=0),c.cameraInitialized?void(b&&b()):(c.cameraInitialized=!0,c.cameraInitCanceled=!1,void(c.needsAnimatedTransition()||c.whichCameraMap(a)?b&&b():("flyTo"===c.camera.action?Human.view.camera.fly.flyTo(c.camera.location,b):Human.view.camera.fly.jumpTo(c.camera.location,b),c.camera.location.screenPan&&Human.view.camera.setScreenPan(c.camera.location.screenPan))))},c.initAnnotations=function(){c.annotationsInitialized||(c.annotationsInitialized=!0,c._handleAnnotations())},c.update=function(a,b){return b=b||{},c.firstUpdate?(c.firstUpdate=!1,c.timeRange=c.getTimeFrame(),c.sceneInitialized||(c.initScene(),Human.renderer.compile()),void(c.ignoreCamera||c.cameraInitCanceled?(c.annotationInitCanceled||c.initAnnotations(),c._update2(a)):c.initCamera(a,function(){c.annotationInitCanceled||c.initAnnotations(),c._update2(a)}))):void c._update2(a)},c._update2=function(a){(null===c.timeRange||void 0===c.timeRange)&&(c.timeRange=c.getTimeFrame());var b=c.timeRange;"start"===a||a<b.startTime?a=b.startTime:("end"===a||"last"===a||a>b.lastTime)&&(a=b.lastTime);var d=c.whichMaps(a);d.forEach(function(b){var c=b.map,d=b.camera,e=c.data.timeline,f=c.calcChildTime(a);return e.update(d,f),f===c.data.end&&"hide"===c.data.onEnd&&e.hide(),!0});for(var e in c.media)c.media.hasOwnProperty(e)&&c.media[e].update(a)},c.destroy=function(){var a=c.getUniqueLeafTimelines();for(var b in a)a.hasOwnProperty(b)&&"dummy"!==b&&(a[b].destroy(),delete Human.timeline.leafTimelines[b]);Human.view.annotations.clearAnnotations()};var d,e;c.info.displayName=a.displayName,c.info.description=a.description,c.synchronization=a.createInstructions(),c.properties=a.properties,c.annotations=a.annotations,c.transition=a.transition,c.options=a.options,c.camera=a.camera,c.animation=a.animation,c.effects=a.effects,c.reflections=a.reflections,c.ignoreCamera=a.ignoreCamera,c.customData=a.customData;for(d in a.media)a.media.hasOwnProperty(d)&&c.addClip(d,a.media[d]);var f;a.timelineMap.forEach(function(a,b){e=a.data.timeline,Human.timeline.leafTimelines.hasOwnProperty(e)?a.data.timeline=Human.timeline.leafTimelines[e]:(Human.log.warn("Unknown leaf timeline: "+e),a.data.timeline=Human.timeline.leafTimelines.dummy),f=e+"_"+b,c.makeMapComponent(f,a.start,a.end,a.data)}),Human.timeline.branchTimelines[c.id]=c},Human.timeline.RootTimeline=function(a,b){"use strict";b=b||{};var c=this;c.id=a,c.level="root",c.animationOptions={},c._theQueue=[],c._chapters=[],c._transitions=[],c._times=[],c._timeFrame=null,c.freeAnimations={},c._firstUpdate=!0,c._prevBranch=null,c._prevTime=null,c._nowBranch=null,c._nowTime=null,c.setAnimationOptions=function(a,b){b=b||{},a.animation&&(c.animationOptions=a.animation)},c.addChapter=function(a,b){b=b||{};var d=b.hasOwnProperty("rebuild")?b.rebuild:!0,e=b.position||c._chapters.length;return"chapter"!==a.role?void Human.log.warn("RootTimeline.addChapter(): The branch timeline with id "+a.id+"is not a chapter. Root will not be updated"):((0>e||e>c._chapters.length)&&Human.log.warn("RootTimeline.addChapter(): Invalid index "+e+"position"),c._chapters.splice(e,0,a),void(d&&c.build()))},c.getDescendentLeaves=function(){var a={};return c._chapters.forEach(function(b){var c=b.getChildLeafTimelines(0);for(var d in c)c.hasOwnProperty(d)&&(a.hasOwnProperty(d)||(a[d]=Human.timeline.leafTimelines[d]))}),a},c.getTimeFrame=function(a){a=a||{};var b=0,d=a.transitions===!1?c._chapters:c._theQueue;return d.forEach(function(a){b+=a.getTimeFrame().lastTime}),{firstTime:0,lastTime:b}},c.whereIsBranch=function(a,b){b=b||{};var d=0,e=!1,f=null,g=[];for(g=b.chapters===!0?c._chapters:c._theQueue;!e&&d<g.length;)e=g[d].id===a.id?!0:!1,e?f=d:d++;return f},c.getBranch=function(a){a=a||{};var b,d,e=!1,f=0,g={};if(Human.utils.isEmpty(a))return null;for(Object.keys(a).length>1&&Human.log.warn("timeline.RootTimeline.getBranch","too many parameters, using only the first."),b=Object.keys(a)[0],d=a[b];!e&&f<c._theQueue.length;)g=c._theQueue[f],c._theQueue[f][b]===d&&(e=!0),f++;var h;return h=e?g:null},c.mapGlobalTime=function(a,b){b=b||{},"end"===a?a=c.getTimeFrame().lastTime:"start"===a&&(a=0),0>a?a=0:a>c.getTimeFrame().lastTime&&(a=c.getTimeFrame().lastTime);var d="earlier";b.tie?d=b.tie:b.which&&b.direction&&("forwards"===b.direction?d="second"===b.which?"later":"earlier":"backwards"===b.direction&&(d="first"===b.which?"later":"earlier"));var e={branch:null,time:null,index:null},f=c._times.indexOf(a);if(f>=0){var g="later"!==d?f-1:f;g=0>g?c._theQueue.length-1:g,g=g>=c._times.length-1?0:g,e.branch=c._theQueue[g],e.time="later"!==d?a-c._times[g]:0,e.index=g}else{var h=Human.utils.binarySearch(c._times,a);e.branch=c._theQueue[h.index1],e.time=a-h.value1,e.index=h.index1}return e},c.mapBranchTime=function(a,b,d){d=d||{};var e=0,f=c.whereIsBranch(a);return"end"===b?b=a.getTimeFrame().lastTime:"start"===b&&(b=0),e=null===f?null:c._times[f]+b},c.getNeighborChapter=function(a,b,d){d=d||{};var e=null,f=null;if(b="previous"===b?"previous":"next",a instanceof Human.timeline.BranchTimeline)e=a;else{if("number"!=typeof a)return Human.log.warn("timeline.root.getNeighborChapter","invalid 'now' argument :"+JSON.stringify(a)),null;var g="later"===d.tie?"later":"earlier";e=c.mapGlobalTime(a,{tie:g})}if(f=c.whereIsBranch(e),0===f&&"previous"===b)return null;if(f===c._theQueue.length-1&&"next"===b)return null;var h=f;"next"===b?(h++,"chapter"!==c._theQueue[h].role&&h++):(h--,"chapter"!==c._theQueue[h].role&&h--);var i=c._theQueue[h];return"chapter"===i.role?i:(Human.log.warn("timeline.root.getNeighborChapter","could not find a valid chapter, returning null."),null)},c.isFirst=function(a){return a.id===c._theQueue[0].id?!0:!1},c.isLast=function(a){var b=c._theQueue.length-1;return a.id===c._theQueue[b].id?!0:!1},c.buildFreeAnimations=function(a){a=a||{};var b=c.getDescendentLeaves();for(var d in b)if(b.hasOwnProperty(d)){var e=b[d].freeAnimations;for(var f in e)e.hasOwnProperty(f)&&!c.freeAnimations.hasOwnProperty(f)&&(c.freeAnimations[f]=e[f])}},c.buildQueue=function(a){a=a||{},c._theQueue=[];var b=0;c._times=[b],c._chapters.forEach(function(a,d){b+=a.getTimeFrame().lastTime,c._theQueue.push(a),c._times.push(b);var e=c._transitions[d];Human.utils.isEmpty(e)||(b+=e.getTimeFrame(),c._theQueue.push(e),c._times.push(b))})},c.buildMedia=function(){var a,b,d,e,f,g,h=function(a){return"local"===a.type?[a.modelId,a.streamType,a.subasset,a.src].join("/"):"youtube"===a.type?a.src:void 0},i=function(a,b,d){b=Human.utils.shallowClone(b),b.fullUrl=h(b);var e=c.mapBranchTime(d,0);b.time1-=e;var f=b.time2-e;b.time2=Math.min(f,d.getTimeFrame().lastTime),["length","suggested","status"].forEach(function(a){delete b[a]});var g=a+"_"+b.clipId;d.addClip(g,b)},j=Human.media.audio.clips,k=Human.media.videos.clips;for(var l in j)if(j.hasOwnProperty(l)&&(a=j[l],"number"==typeof a.time1&&"number"==typeof a.time2))for(d=c.mapGlobalTime(a.time1,{tie:"later"}),e=c.mapGlobalTime(a.time2,{tie:"earlier"}),g=d.index;g<=e.index;g++)f=c._theQueue[g],i("audio",a,f);for(var m in k)if(k.hasOwnProperty(m)&&(b=k[m],"number"==typeof a.time1&&"number"==typeof a.time2))for(d=c.mapGlobalTime(b.time1,{tie:"later"}),e=c.mapGlobalTime(b.time2,{tie:"earlier"}),g=d.index;g<=e.index;g++)f=c._theQueue[g],i("video",b,f)},c.build=function(a){a=a||{},c._theQueue=[],c._times=[],c.buildFreeAnimations(),c.buildQueue(),c.buildMedia(),Human.timeline.rootTimelines[c.id]&&delete Human.timeline.rootTimelines[c.id],Human.timeline.rootTimelines[c.id]=c,c._timeFrame=c.getTimeFrame(),null===c._nowBranch?(c._nowBranch=c._theQueue[0],c._nowTime=0,c._prevBranch=c._nowBranch,c._prevTime=0):null===c.whereIsBranch(c._nowBranch)&&(c._nowBranch=c._theQueue[0],c._nowTime=0,null===c._prevBranch?(c._prevBranch=c._nowBranch,c._prevTime=c._nowTime):null===c.whereIsBranch(c._prevBranch)&&(c._prevBranch=c._nowBranch,c._prevTime=c._nowTime)),Human.events.fire("timeline.chapters.updated",c._assembleChaptersUpdated()),Human.events.fire("timeline.timeFrame.updated",{firstTime:c._timeFrame.firstTime,lastTime:c._timeFrame.lastTime})},c.prepareNextTransition=function(a,b){b=b||{};var d={},e=.033;Human.utils.binarySearch(c._times,a,null,d),d.value2-a<e},c.destroy=function(){if(c._theQueue.forEach(function(a){Human.timeline.branchTimelines.hasOwnProperty(a.id)&&(a.destroy(),delete Human.timeline.branchTimelines[a.id]),a=null}),c._theQueue=[],c._chapters=[],c._transitions=[],c._times=[],c._timeFrame=null,c.freeAnimations={},c._firstUpdate=!0,c._prevBranch=null,c._prevTime=null,c._nowBranch=null,c._nowTime=null,Human.timeline.rootTimelines.hasOwnProperty(c.id)&&(delete Human.timeline.rootTimelines[c.id],Human.timeline.activeRoot&&Human.timeline.activeRoot.id===c.id)){Human.timeline.activeRoot=null;var a=Human.view.annotations.annotations;for(var b in a)a.hasOwnProperty(b)&&a[b].destroy();a=null}c._timeFrame=c.getTimeFrame(),Human.events.fire("timeline.chapters.updated",c._assembleChaptersUpdated()),Human.events.fire("timeline.timeFrame.updated",{firstTime:c._timeFrame.firstTime,lastTime:c._timeFrame.lastTime})},c.updateFreeAnimations=function(a){for(var b in c.freeAnimations)c.freeAnimations.hasOwnProperty(b)&&c.freeAnimations[b].update({cameraEnabled:!1},a)},c.initScene=function(){c._nowBranch.initScene()},c.initCamera=function(a){c._nowBranch.initCamera(a)},c.cancelCameraInit=function(){c._nowBranch.cameraInitCanceled=!0},c.initAnnotations=function(){c._nowBranch.initAnnotations()},c.cancelAnnotationInit=function(){c._nowBranch.annotationInitCanceled=!0},c.update=function(a,b){b=b||{};var d={},e=[];d={which:"both",direction:"forwards"},b.hasOwnProperty("which")&&(d.which=b.which),b.hasOwnProperty("direction")&&(d.direction=b.direction),0>a?(a=0,Human.log.warn("Time violates lower bound. Updating to time = 0.0")):a>c._timeFrame.lastTime&&(a=c._timeFrame.lastTime,Human.log.warn("Time violates upper bound. Updating to time = "+a)),e=c._getBranchesToUpdate(a,d),c._firstUpdate&&(c._nowBranch=e[0].branch,c._nowTime=e[0].time,c._firstUpdate=!1);var f=!1;e.forEach(function(a){c._prevBranch=c._nowBranch,c._prevTime=c._nowTime,f=a.branch.firstUpdate,c._nowBranch=a.branch,c._nowTime=a.time,a.branch.update(a.time),f&&Human.events.fire("timeline.chapters.activated",c._assembleChaptersActivated())}),c._prevBranch.id!==c._nowBranch.id&&c._prevBranch.reset()},c._getBranchesToUpdate=function(a,b){return c._times.indexOf(a)>=0?c._getBorderBranches(a,b):[c.mapGlobalTime(a,{tie:"earlier"})]},c._getBorderBranches=function(a,b){var d=c.mapGlobalTime(a,{tie:"earlier"}),e=c.mapGlobalTime(a,{tie:"later"}),f=[d,e];return"backwards"===b.direction&&(f=[e,d]),"first"===b.which?f.splice(1,1):"second"===b.which&&f.splice(0,1),f},c._assembleChaptersUpdated=function(){Human.timeline.chapters={};var a,b,d,e,f=[],g=c._chapters;for(a=0,b=g.length;b>a;a++)d=g[a],e={chapterId:d.id,time:c.mapBranchTime(d,0),duration:d.getTimeFrame().lastTime,displayName:d.info.displayName,description:d.info.description,loop:d.animation.loop,index:a},f.push(e),Human.timeline.chapters[d.id]=e;return f},c._assembleChaptersActivated=function(){var a={};return a.oldChapterIndex=c.whereIsBranch(c._prevBranch,{chapters:!0}),a.newChapterIndex=c.whereIsBranch(c._nowBranch,{chapters:!0}),a.time=c.mapBranchTime(c._nowBranch,c._nowTime),a.loop=c._nowBranch.animation.loop||!1,a},c._assembleQueryChapters=function(){var a,b,d,e=[],f=c._chapters;for(a=0,b=f.length;b>a;a++)d=f[a],e.push({chapterId:d.id,time:c.mapBranchTime(d,0),displayName:d.info.displayName,description:d.info.description,type:"branch",tags:d.tags||[],annotations:d.annotations,hotspots:null,flyTo:d.camera.location,active:c._nowBranch.id===d.id,sounds:d._getAudio(),translations:d.translations||null});return e}},function(){"use strict";function a(a){var b,c;for(b in a)a.hasOwnProperty(b)&&Human.modules.isBase(b)&&(c=Human.modules.convertBaseAnatomyObjectId(b),b!==c&&(a[c]=a[b],delete a[b]));return a}var b={action:"jumpTo",location:{eye:{x:0,y:0,z:0},look:{x:0,y:0,z:0},up:{x:0,y:1,z:0}}},c={loop:!1},d={xray:!1,screenPan:{x:0,y:0,z:0}},e=new Human.timeline.LeafTimeline("dummy"),f={start:0,end:2,data:{timeline:e.id,start:0,end:e.getTimeFrame().lastTime,onEnd:"freeze",fit:!1}},g={showObjects:"shown",selectObjects:"selected",pickThroughObjects:"pickable"},h=Human.timeline.chapter=function(a,e){e=e||{};var h=this;h.id=a,h.showObjects={},h.selectObjects={},h.pickThroughObjects={},h.transition={},h.annotations=[],h.timelineMap=[],h.displayName="",h.description="",h.media={},h.reflections={},h.effects=Human.view.effects.getDefaults(),h.properties=Human.properties.getDefaults(),h.camera=Human.utils.shallowClone(b),h.animation=Human.utils.shallowClone(c),h.options=Human.utils.shallowClone(d),h.objectSetsMap=Human.utils.shallowClone(g),h.timelineMap=[f],h.ignoreCamera=!1,h.customData={},h._type="module",Human.utils.isEmpty(e)||h.merge(e)};h.prototype._mergeModule=function(b){var c,d,e,f,g,h=this,i=h.objectSetsMap,j=Human.scene.rootObjects;for(c in i)if(i.hasOwnProperty(c)&&b.hasOwnProperty(c)){if(d=b[c]||{},d.hasOwnProperty("*")){for(e in j)j.hasOwnProperty(e)&&(f=j[e],g=f.modelId,b.modelIds.indexOf(g)>=0&&!Human.modules.isBase(g)&&(d[f.objectId]=b[c]["*"]));delete b[c]["*"]}h[c]="showObjects"===c?d:Human.scene.sets.union(h[c],d),h[c]=a(h[c])}},h.prototype._mergeChapter=function(b){var c,d,e,f,g=this.objectSetsMap,h=Human.utils,i=Human.scene.rootObjects;b.showObjects=b.showObjects||{};for(c in g)if(g.hasOwnProperty(c)&&b.hasOwnProperty(c))if(b[c]=a(b[c]),h.isEmpty(b[c]))"showObjects"===c&&(this[c]={});else{if(d=b[c]||{},d.hasOwnProperty("*")){for(e in i)i.hasOwnProperty(e)&&(f=i[e],d[f.objectId]=d["*"]);delete d["*"]}this[c]=d}},h.prototype.merge=function(a){var b,c=this,d=!0;if(a.hasOwnProperty("chapterId")?(c.id=a.chapterId,c._type="chapter"):a.hasOwnProperty("moduleId")?(c.id=a.moduleId,c._type="module"):a.hasOwnProperty("_type")&&(c._type=a._type),a.hasOwnProperty("customData")&&(c.customData=a.customData),"module"===c._type?c._mergeModule(a):"chapter"===c._type?c._mergeChapter(a):console.log("unknown type for merge"),a.hasOwnProperty("timelineMap")?c.timelineMap=a.timelineMap:a.hasOwnProperty("modelIds")&&(c.timelineMap=[],a.modelIds.forEach(function(a){if(Human.timeline.leafTimelines.hasOwnProperty(a)){var b=Human.timeline.leafTimelines[a],d={};d.start=0,d.end=b.getTimeFrame().lastTime;var e=0===Object.keys(b.animations).length?!0:!1;d.data={timeline:b.id,start:0,end:e?null:b.getTimeFrame().lastTime,onEnd:"freeze",fit:!1},c.timelineMap.push(d)}})),a.hasOwnProperty("media")&&(c.media=a.media),a.hasOwnProperty("annotations")&&(c.annotations=a.annotations||[]),a.hasOwnProperty("displayName")&&(c.displayName=a.displayName),a.hasOwnProperty("description")&&(c.description=a.description),a.hasOwnProperty("camera")&&a.camera?(c.camera={},a.camera.hasOwnProperty("action")?c.camera=a.camera:(c.camera.action="flyTo",c.camera.location=a.camera)):a.hasOwnProperty("flyTo")&&a.flyTo?(c.camera={},c.camera.action="flyTo",c.camera.location=a.flyTo):a.hasOwnProperty("jumpTo")&&a.jumpTo&&(c.camera={},c.camera.action="jumpTo",c.camera.location=a.jumpTo),c.ignoreCamera=!!a.ignoreCamera,a.hasOwnProperty("properties")){a.properties=a.properties||[];for(b in a.properties)a.properties.hasOwnProperty(b)&&(c.properties.hasOwnProperty(b)?c.properties[b]=a.properties[b]:Human.log.warn("scene.chapter.merge","Invalid per-chapter property : "+b))}if(a.hasOwnProperty("background")&&(c.background=a.background||null),a.hasOwnProperty("xray")?c.options.xray=a.xray:a.hasOwnProperty("options")&&(c.options.xray=a.options.xray,c.options.screenPan=a.options.screenPan),a.hasOwnProperty("screenPan"))c.options.screenPan=a.screenPan;else if(a.hasOwnProperty("camera")){var e=a.camera;e&&e.hasOwnProperty("screenPan")&&(c.options.screenPan=e.screenPan)}a.hasOwnProperty("animation")&&!Human.utils.isEmpty(a.animation)?a.animation.hasOwnProperty("loop")&&(c.animation.loop=a.animation.loop):a.hasOwnProperty("loop")&&(c.animation.loop=a.loop||!1,delete a.loop),a.hasOwnProperty("annotationsLayout")&&a.annotationsLayout&&(c.properties["annotations.layout.type"]=a.annotationsLayout),a.hasOwnProperty("reflections")&&a.reflections&&(c.reflections=a.reflections);for(var f=0;f<c.annotations.length;f++)c.annotations[f].hasOwnProperty("labelOffset")||(d=!1);d||(c.properties["annotations.layout.type"]="columns")},h.prototype.requiresBase=function(){var a=this,b=Object.keys(a.createInstructions());return Human.modules.requiresBase(b)},h.prototype.transitionTypes={},h.prototype.createInstructions=function(){var a,b,c=this,d={};for(a in c.objectSetsMap)c.objectSetsMap.hasOwnProperty(a)&&(b=c.objectSetsMap[a],i(c[a],b,d));return d};var i=function(a,b,c){var d,e;for(d in a)a.hasOwnProperty(d)&&(e="pickable"===b?!a[d]:a[d],c.hasOwnProperty(d)||(c[d]={}),c[d][b]=e)};h.getObjectSets=function(){return Object.keys(g)}}(),Human.media=Human.media||{},Human.media.Clips=function(a){"use strict";var b=this;this._streamType=a,this.clips={},this.clipsList=[],this.libraries={},this.suggestedClips=[],Human.events.fire(this._streamType+".clips",b.clipsList,!0),b.getClipById=function(a){var b=null;return this.clipsList.forEach(function(c){c.clipId===a&&(b=c)}),b},this.createLibrary=function(a,b){if(this.libraries[a])return void Human.log.warn("Human.media."+this._streamType+".createLibrary","Library already loaded: "+a);for(var c,d,e=a.split("/"),f=e[0],g=e[1],h=this.libraries[a]={libraryId:a,clips:{}},i=0,j=b.length;j>i;i++)if(c=b[i],c.clipId)if(c.type)if(c.src){(void 0===c.time1||null===c.time1)&&(c.time1=null),(void 0===c.time2||null===c.time2)&&(c.time2=null),this.clips[c.clipId]&&Human.log.error("Human.media."+this._streamType+".createLibrary","Clip 'clipId' clashes with another clip: '"+c.clipId+"' - replacing existing clip");var k=[f,this._streamType,g,c.src].join("/");d={clipId:c.clipId,modelId:f,streamType:this._streamType,subasset:g,displayName:c.displayName,description:c.description||"",time1:c.time1,time2:c.time2,type:c.type||"",src:c.src,fullUrl:k,alternatives:c.alternatives||[],length:c.length||0,suggested:!1,status:"closed"},h.clips[c.clipId]=d,this.clips[c.clipId]=d}else Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: src");else Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: type");else Human.log.error("Human.media."+this._streamType+".createLibrary","Clip property missing: clipId");this._rebuildClipList()},this._rebuildClipList=function(){this.clipsList=[];for(var a in this.clips)this.clips.hasOwnProperty(a)&&this._insertClipIntoList(this.clipsList,this.clips[a]);Human.events.fire(this._streamType+".clips",this.clipsList,!0)},this._insertClipIntoList=function(a,b){if(0===a.length)a.push(b);else{for(var c,d=a.length-1;d>=0;d--)if(c=a[d],c.time1<b.time1)return void a.splice(d+1,0,b);a.splice(0,0,b)}},this.destroyLibrary=function(a){var b=this.libraries[a];if(!b)return void Human.log.warn("Human.media."+this._streamType+".destroyLibrary","Library not found: "+a);for(var c in b.clips)b.clips.hasOwnProperty(c)&&(delete this.clips[c],Human.events.fire(this._streamType+".status",{clipId:c,status:"destroyed"}));delete this.libraries[a],this._rebuildClipList()},this.open=function(a,b){Human.events.fire(this._streamType+".status",{clipId:a,status:"open"},!0),b()},this.play=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"playing"},!0)},this.scrub=function(a,b){Human.events.fire(this._streamType+".scrubbed",{clipId:a,time:b})},this.pause=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"paused"},!0)},this.stop=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"stopped"},!0)},this.close=function(a){Human.events.fire(this._streamType+".status",{clipId:a,status:"closed"},!0)},this.reset=function(){for(var a in this.libraries)this.libraries.hasOwnProperty(a)&&this.destroyLibrary(a)}},Human.media.audio=new Human.media.Clips("audio"),Human.media.videos=new Human.media.Clips("videos"),function(){"use strict";var a=Human.actions={};a._actions={},Human.events.on("loaded",function(){$(document).on("click","[data-human-action]",function(){var b=$(this),c=b.attr("data-human-action"),d=b.attr("data-arguments");c&&a._doAction([c,d])})}),a.addAction=function(b,c){a._actions[b]=c},a._doAction=function(b){var c;if("string"==typeof b){if(c=b.split("?"),0===c.length)return void Human.log.error("Human.actions._parse","Parsed invalid action link: "+b+"(ignoring)")}else c=b;var d=c[0],e=a._actions[d];if(!e)return void Human.log.error("Human.actions._doAction","Parsed invalid action link - action not found: "+d+" (ignoring)");var f={},g=c[1];if(g)for(var h,i=g.split("&"),j=0,k=i.length;k>j;j++)h=i[j].split("="),f[h[0]]=h[1];try{e(f)}catch(l){Human.log.error("Human.actions._doAction","Action '"+d+"' threw an exception: "+l)}},a.parse=function(a){return a.replace(/\[\[([^|]*?)\|(.*?)\]\]/g,"<a href=\"javascript:Human.actions._doAction('$1')\">$2</a>")}}(),function(){"use strict";function a(){Human.events.fire("assets.load.start"),Human.stats.loadSequence.assetsRequested=Human.timer.now(),Human.stats.loadTimes.preAsset=Human.stats.loadSequence.assetsRequested-Human.stats.loadSequence.startTime}function b(a,b){o++,Human.events.fire("assets.load.progress",{assetId:a,assetType:b,requestedAssets:n,receivedAssets:o}),o===n&&c()}function c(){Human.events.fire("assets.load.finish"),n=0,o=0,Human.stats.loadSequence.assetsLoaded=Human.timer.now(),Human.stats.loadTimes.assetDownload=Human.stats.loadSequence.assetsLoaded-Human.stats.loadSequence.assetsRequested}function d(a){return void 0===j[a]?void(j[a]=1):void j[a]++}function e(a){return void 0===i[a]?void(i[a]=1):void i[a]++}function f(a){return h[a]||a+"s"}var g=Human.assets={loadedAssets:{},nullAssets:{}},h={geometry:"geometries",audio:"audio",videos:"video"},i={},j={},k={},l={},m={},n=0,o=0;g.getAsset=function(c,d,h){return g.nullAssets[c]?void(h&&Human.utils.async(function(){h(null)})):"LOADING"===g.loadedAssets[c]?void(h&&m[c].push(h)):g.loadedAssets[c]?(e(c),void(h&&Human.utils.async(function(){h(g.loadedAssets[c])}))):(0===n&&a(),n++,g.loadedAssets[c]="LOADING",m[c]=[],h&&m[c].push(h),void g.server.getAsset(d,c,function(a){if(b(c,d),!a||a===g.server.TIMEOUT){a||(g.nullAssets[c]=!0),g.loadedAssets[c]=null;for(var h=m[c],i=0,j=h.length;j>i;i++)h[i](null);return void delete m[c]}var k=Human.assets[f(d)];try{k.parseAsset(c,a,function(a){g.loadedAssets[c]=a,e(c);for(var b=m[c],d=0,f=b.length;f>d;d++)b[d](a);delete m[c]})}catch(l){Human.log.error("Error parsing asset: "+c+" - "+l.message),g.loadedAssets[c]=null,g.nullAssets[c]=!0;for(var h=m[c],i=0,j=h.length;j>i;i++)h[i](null);delete m[c]}}))},g.getAssetLibrary=function(a,b,c,e,h,i){return l[c]?void Human.utils.async(i):j[c]?(d(c),void Human.utils.async(i)):void g.server.getAssetLibrary(b,c,e,function(b){var e;if(!b)return l[c]=!0,void(i&&i());if(j[c])return d(c),void(i&&i());if("animation"===a){if("binary"===b.format)return void(i&&i());e=Human.assets.tweens}else e=Human.assets[f(a)];e?e.parseLibrary(c,b,h,function(){d(c),k[c]=e,i&&i()}):(Human.log.error("Unknown asset library type: "+a),i&&i())})},g.putAssetLibrary=function(a){if(void 0!==j[a]&&--j[a]<=0){delete i[a];var b=k[a];b&&b.unloadLibrary&&b.unloadLibrary(a),delete k[a]}},g.putAsset=function(a){if(void 0!==i[a]&&--i[a]<=0){var b=g.loadedAssets[a],c=Human.assets[f(b.type)];c.destroyAsset(a),delete g.loadedAssets[a],delete i[a]}}}(),function(){"use strict";function a(){var a=new WebSocket(f);return a.binaryType="arraybuffer",a.addEventListener("open",function(){a.send(JSON.stringify({open:"sesame!"}));for(var b=0,c=j.length;c>b;b++)j[b]();j.length=0}),a.addEventListener("close",function(a){Human.log.log("Socket closed",a.code,a.reason)}),a.addEventListener("error",function(){Human.log.error("Socket error")}),a.addEventListener("message",function(a){var b,d,e=a.data;if(c=Date.now(),"string"==typeof e){if("🍺"===e)return;var f=JSON.parse(e);d=f.id,f.error?(Human.log.error("Asset not found: "+d),b=null):f.asset?b=f.asset:(Human.log.error("Null asset: "+d),b=null)}else{b=e;var g,h,i=new DataView(b),j=i.getUint32(0,!0);17===j?(h=new Uint32Array(b,0,2)[1],g=11*Uint32Array.BYTES_PER_ELEMENT):(h=i.getUint32(4,!0),g=i.getUint32(12,!0)),d=Human.utils.atos(b,g,h).trim()}var l=k[d];if(l){for(var m=0,n=l.length;n>m;m++)l[m](b);delete k[d]}}),a}function b(){if(0!==l.length){if(c=Date.now(),e.readyState===WebSocket.OPEN)return e.send(JSON.stringify({
  assets:l})),void(l.length=0);j.push(function(){e.send(JSON.stringify({assets:l})),l.length=0}),(e.readyState===WebSocket.CLOSING||e.readyState===WebSocket.CLOSED)&&(e=a())}}var c,d,e,f,g=Human.assets.server={TIMEOUT:1},h=!0,i=12e4,j=[],k={},l=[],m={geometry:"geometry"},n={},o={},p=!1;Human.properties.subscribe({propId:"assetDomain",value:"assets-human.biodigital.com",callback:function(a){d=a}}),g.init=function(){if(!p){var j="https:"===window.location.protocol?"wss:":"ws:";f=j+"//"+d+"/assets/ws"+(h?3:2),e=a(),setInterval(function(){b();var a=Date.now();if(a-c>i)for(var d in k)if(k.hasOwnProperty(d)){Human.log.error("Server timeout on asset: "+d);for(var e=k[d],f=0,h=e.length;h>f;f++)e[f](g.TIMEOUT);delete k[d]}},100),p=!0}},g.cacheModuleDefinition=function(a,b){return n[a]?void 0:b?void(n[a]=JSON.stringify(b)):void g.getModuleDefinition(a)},g.getModuleDefinition=function(a,b,c){return n[a]?void(b&&b(JSON.parse(n[a]))):(Human.stats.loadSequence.moduleRequest=Human.timer.now(),Human.stats.loadTimes.preModule=Human.stats.loadSequence.moduleRequest-Human.stats.loadSequence.startTime,void $.ajax({dataType:"text",url:"/content/modules/"+a,success:function(c){n[a]=c,Human.stats.loadSequence.moduleLoaded=Human.timer.now(),Human.stats.loadTimes.moduleDownload=Human.stats.loadSequence.moduleLoaded-Human.stats.loadSequence.moduleRequest,b&&b(JSON.parse(c))},error:function(b,d,e){Human.events.fire("net.error",{id:a,type:"modules",status:b.status,statusText:b.statusText}),c&&c(e)}}))},g.cacheStateIndex=function(a,b){return o[a]?void 0:b?void(o[a]=JSON.stringify(b)):void $.ajax({dataType:"text",url:"/content/states/"+a+"/index?v="+Human.VERSION+"&locale="+Human.locale,success:function(b){o[a]=b}})},g.getStateIndex=function(a,b,c){return o[a]?void(b&&b(JSON.parse(o[a]))):void $.ajax({dataType:"json",url:"/content/states/"+a+"/index?v="+Human.VERSION+"&locale="+Human.locale,success:b,error:c})},g.getAnimationManifest=function(a,b,c){var d=a.split("/");$.ajax({dataType:"json",url:"/content/states/"+d[0]+"/animations/"+d[1]+"/manifest",success:b,error:c})},g.getAsset=function(a,b,c){var d=b.split("/"),e=d[0],f=d[1],g=d[2],h=e+"/"+(m[a]||a+"s")+"/"+f;return g&&(h+="/"+g),k[h]?void k[h].push(c):(k[h]=[c],void l.push(h))},g.getAssetLibrary=function(a,b,c,d){var e=b.split("/");$.ajax({dataType:"json",url:"/content/states/"+e[0]+"/"+a+"/"+e[1]+"/"+c,success:d,error:function(){Human.log.error("Asset library not found: "+b),d(null)}})}}(),function(){"use strict";function a(a,b){var d=new Uint32Array(a,0,11),e=d[1],f=d[2],g=d[3],h=d[4],i=d[5],j=d[6],k=11*Uint32Array.BYTES_PER_ELEMENT,l=k+e,m=l+f,n=m+g,o=n+h,p=o+i,q=0;g>0&&(b.geometry.positions=new Float32Array(a,m,g/Float32Array.BYTES_PER_ELEMENT),b.boundary=c(b.geometry.positions),q=b.geometry.positions.length/3),h>0&&(b.geometry.normals=new Float32Array(a,n,h/Float32Array.BYTES_PER_ELEMENT)),j>0&&(b.geometry.uv=new Float32Array(a,p,j/Float32Array.BYTES_PER_ELEMENT)),i>0&&(b.geometry.indices=new Uint32Array(a,o,i/Uint32Array.BYTES_PER_ELEMENT),256>=q?b.geometry.indices=new Uint8Array(b.geometry.indices):65536>=q&&(b.geometry.indices=new Uint16Array(b.geometry.indices)))}function b(a,b){var d,e,k=new DataView(a),l=k.getUint32(4,!0),m=k.getUint32(8,!0),n=k.getUint32(12,!0),o=k.getUint32(16,!0),p=k.getUint32(20,!0),q=k.getUint32(24,!0),r=k.getUint32(28,!0),s=k.getUint16(32,!0),t=k.getUint8(34),u=k.getUint8(35),v=new Array(u);for(e=0,d=36;u>e;e++,d+=6)v[e]={uvSize:k.getUint32(d,!0),uvDecodeSize:k.getUint16(d+4,!0)};if(d=n+l+m,s>0&&(b.positionTranslate=new Float32Array(a,d,3),b.positionScale=new Float32Array(a,d+12,3),mat4.fromScaling(g,b.positionScale),mat4.fromTranslation(h,b.positionTranslate),b.geometry.positionDecodeMat=mat4.create(),mat4.multiply(b.geometry.positionDecodeMat,h,g),d+=s),u>0)for(b.geometry.uvDecodeMats=new Array(u),b.uvTranslates=new Array(u),b.uvScales=new Array(u),e=0;u>e;e++){var w=b.uvTranslates[e]=new Float32Array(a,d,2),x=b.uvScales[e]=new Float32Array(a,d+8,2);mat3.fromScaling(i,x),mat3.fromTranslation(j,w),b.geometry.uvDecodeMats[e]=mat3.create(),mat3.multiply(b.geometry.uvDecodeMats[e],j,i),d+=v[e].uvDecodeSize}if(p>0&&(b.geometry.positions=new Uint16Array(a,d,p/Uint16Array.BYTES_PER_ELEMENT),b.boundary=c(b.geometry.positions,b.positionScale,b.positionTranslate),d+=p),u>0)for(b.geometry.uvs=new Array(u),e=0;u>e;e++)b.geometry.uvs[e]=new Uint16Array(a,d,v[e].uvSize/Uint16Array.BYTES_PER_ELEMENT),d+=v[e].uvSize;if(q>0&&(b.geometry.normals=new Int8Array(a,d,q/Int8Array.BYTES_PER_ELEMENT),d+=q),r>0){var y=f[t];b.geometry.indices=new y(a,o,r/y.BYTES_PER_ELEMENT)}}function c(a,b,c){b=b||l,c=c||k;for(var d,e,f,g=1e5,h=1e5,i=1e5,j=-1e5,m=-1e5,n=-1e5,o=0,p=a.length-2;p>o;o+=3)d=a[o]*b[0]+c[0],e=a[o+1]*b[1]+c[1],f=a[o+2]*b[2]+c[2],g>d&&(g=d),h>e&&(h=e),i>f&&(i=f),d>j&&(j=d),e>m&&(m=e),f>n&&(n=f);return{xmin:g,ymin:h,zmin:i,xmax:j,ymax:m,zmax:n}}var d=Human.assets.geometries={};d.geometries={};var e,f={1:Uint8Array,2:Uint16Array,4:Uint32Array};Human.events.on("loaded",function(){e=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Geometry library"})}),d.parseAsset=function(c,e,f){var g=new Uint32Array(e,0,1)[0],h={geometry:{primitive:"triangles"},compressed:17!==g};h.compressed?b(e,h):a(e,h),f(d.createGeometry(c,h))},d.createGeometry=function(a,b){if(d.geometries[a])return void Human.log.error("Human.assets.geometries.createGeometry","Geometry already loaded: "+a);if(!b.geometry)return void Human.log.error("Human.assets.geometries.createGeometry","Mandatory attribute 'geometryId' expected on geometry: "+a);b.geometry.type="geometry";var c={geometry:e.addNode(b.geometry),type:"geometry",compressed:b.compressed};if(b.boundary){var f=b.boundary;c.boundary=f,c.center=[.5*(f.xmax+f.xmin),.5*(f.ymax+f.ymin),.5*(f.zmax+f.zmin)],c.axisBoundary=new Float32Array([f.xmin,f.ymin,f.zmin,f.xmax,f.ymax,f.zmax])}return d.geometries[a]=c,c},d.getCompressionStats=function(){var a={compressed:0,uncompressed:0};for(var b in d.geometries)d.geometries.hasOwnProperty(b)&&(d.geometries[b].compressed?a.compressed++:a.uncompressed++);return a},d.destroyAsset=function(a){if(a){var b=d.geometries[a];b.geometry.destroy(),delete d.geometries[a]}else d.reset()},d.reset=function(){for(var a in d.geometries)d.geometries.hasOwnProperty(a)&&d.destroyAsset(a)};var g=mat4.create(),h=mat4.create(),i=mat3.create(),j=mat3.create(),k=vec3.fromValues(0,0,0),l=vec3.fromValues(1,1,1)}(),function(){"use strict";function a(a,e,f){function g(){0===--o&&(Human.stats.loadSequence.texturesLoaded=Human.timer.now(),Human.stats.loadTimes.textureDownload=Human.stats.loadSequence.texturesLoaded-Human.stats.loadSequence.texturesRequested),0===--k&&f()}if(!e.texture)return void f();0===o&&(Human.stats.loadSequence.texturesRequested=Human.timer.now(),Human.stats.loadTimes.preTexture=Human.stats.loadSequence.texturesRequested-Human.stats.loadSequence.startTime);var h,i=e.texture,j=i.layers,k=j.length;o+=k,a.textures=new Array(k);for(var l=0,m=k;m>l;l++)h=j[l],h.compressedSrc?Human.utils.getBinary(h.compressedSrc,b(h,a,l,g),c(h,a,l,g)):d(h,a,l,g)}function b(a,b,c,d){return function(e){a.type="texture",a.compressedImage=e,a.uri=null,b.textures[c]=j.addNode(a),b.textureCompressionStats.compressed++,d()}}function c(a,b,c,e){return function(){Human.log.error("Compressed texture not found: "+a.compressedSrc),Human.log.error("Falling back to image: "+a.uri),a.compressedSrc=null,d(a,b,c,e)}}function d(a,b,c,d){var g=new Image;g.onload=e(g,a,b,c,d),g.onerror=f(a.uri,d),g.src=a.uri,a.uri=null,a.src=null}function e(a,b,c,d,e){return function(){b.type="texture",b.image=a,c.textures[d]=j.addNode(b),c.textureCompressionStats.uncompressed++,e()}}function f(a,b){return function(){Human.log.error("Texture image not found: "+a),b()}}function g(a,b,c){c=c||{};var d,e;switch(a.id&&(a.id=null),a.type){case"texture":var f;for(d=0,e=a.layers.length;e>d;d++)f=a.layers[d],f.uri=f.uri||f.src,f.uri?(k||(f.uri=b+f.uri),l||m||n?(h(f),f.compressedSrc+="?v="+Human.VERSION):f.uri+="?v="+Human.VERSION):(f.uri=".",Human.log.error("Human.assets.materials.parseManifest","Texture layer with no 'uri' or 'src' property")),f.preloadURI=f.preloadURI||f.preloadSrc,f.preloadURI&&(k?f.preloadURI+="?v="+Human.VERSION:f.preloadURI=b+f.preloadURI+"?v="+Human.VERSION),f.blendMode=f.blendMode||"add";c&&(c.texture=a);break;case"material":if(c&&(c.material=a,a.reflectionId)){var i=a.reflectionId,j=Human.assets.reflections,o=j.exportedReflectionIds[i];if(o){var p=Human.assets.reflections.reflections[o];p?c.reflection=p.node:Human.log.error("Human.assets.materials.parseManifest","Reflection not found: "+i)}else Human.log.error("Human.assets.materials.parseManifest","Reflection not found: "+i)}break;case"flags":c&&(c.flags=a)}if(a.nodes){for(d=0,e=a.nodes.length;e>d;d++)g(a.nodes[d],b,c);a.nodes=null}return c}function h(a){var b=a.uri.replace(/(\.jpg|\.jpeg|\.png)$/,"");return l?(a.compressedSrc=b+"-dxt1.dds",void(a.containerFormat="dds")):m?(a.compressedSrc=b+"-pvrtc.pvr",void(a.containerFormat="pvr")):n?(a.compressedSrc=b+"-etc1.pvr",void(a.containerFormat="pvr")):void 0}var i=Human.assets.materials={};i.materials={};var j,k=!1,l=!1,m=!1,n=!1;Human.events.on("loaded",function(){j=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Materials library"}),l=Human.renderer.checkWebGLExtension("WEBGL_compressed_texture_s3tc"),m=Human.renderer.checkWebGLExtension("WEBGL_compressed_texture_pvrtc"),n=Human.renderer.checkWebGLExtension("WEBGL_compressed_texture_etc1")}),i.parseAsset=function(a,b,c){var d=a.split("/"),e=d[1].split(".")[0],f="/content/states/"+d[0]+"/materials/"+e+"/";i.createMaterial(a,g(b,f),c)},i.findMaterial=function(a){var b=i.materials[a];return b?b:null},i.createMaterial=function(b,c,d){if(i.materials[b])return void Human.log.warn("Human.assets.materials.createMaterial","Material already loaded: "+b);var e={type:"material",textureCompressionStats:{compressed:0,uncompressed:0}};if(c.material){e.material=j.addNode({type:"material",baseColor:c.material.baseColor,specularColor:c.material.specularColor,emitColor:c.material.emitColor,shine:c.material.shine,alpha:c.material.alpha,emit:c.material.emit}),e.glassFactor=void 0!==c.material.glassFactor&&null!==c.material.glassFactor?c.material.glassFactor:1,e.murkiness=void 0!==c.material.murkiness&&null!==c.material.murkiness?c.material.murkiness:1;var f,g,h;c.material.baseFresnel&&(f=c.material.baseFresnel,e.fresnels=e.fresnels||{},g=void 0!==f.edge?f.edge:{r:1,g:1,b:1},h=void 0!==f.center?f.center:{r:0,g:0,b:0},e.fresnels.color=j.addNode({type:"fresnel",applyTo:"color",edgeBias:f.biasEdge,centerBias:f.biasCenter,power:f.power||1,edgeColor:g,centerColor:h})),c.material.alphaFresnel&&(f=c.material.alphaFresnel,e.fresnels=e.fresnels||{},g=void 0!==f.edge?f.edge:0,h=void 0!==f.center?f.center:1,e.fresnels.alpha=j.addNode({type:"fresnel",applyTo:"alpha",edgeBias:f.biasEdge,centerBias:f.biasCenter,power:f.power||1,edgeColor:{r:g,g:g,b:g},centerColor:{r:h,g:h,b:h}})),c.material.reflectionFresnel&&(f=c.material.reflectionFresnel,e.fresnels=e.fresnels||{},g=void 0!==f.edge?f.edge:1,h=void 0!==f.center?f.center:0,e.fresnels.reflect=j.addNode({type:"fresnel",applyTo:"reflect",centerBias:f.biasCenter,edgeBias:f.biasEdge,power:f.power||1,edgeColor:{r:g,g:g,b:g},centerColor:{r:h,g:h,b:h}})),c.material.specularFresnel&&(f=c.material.specularFresnel,e.fresnels=e.fresnels||{},g=void 0!==f.edge?f.edge:{r:0,g:0,b:0},h=void 0!==f.center?f.center:{r:1,g:1,b:1},e.fresnels.specular=j.addNode({type:"fresnel",applyTo:"specular",centerBias:f.biasCenter,edgeBias:f.biasEdge,power:f.power||1,edgeColor:g,centerColor:h})),c.material.emitFresnel&&(f=c.material.emitFresnel,e.fresnels=e.fresnels||{},g=void 0!==f.edge?f.edge:{r:0,g:0,b:0},h=void 0!==f.center?f.center:{r:1,g:1,b:1},e.fresnels.emit=j.addNode({type:"fresnel",applyTo:"emit",centerBias:f.biasCenter,edgeBias:f.biasEdge,power:f.power||1,edgeColor:g,centerColor:h}))}else e.glassFactor=1,e.murkiness=1;c.reflection&&(e.reflection=j.addNode({type:"reflect",coreId:c.reflection.getCoreId()}));var k,l;c.flags&&c.flags.flags.skybox&&(k=!1,l=Number.MIN_SAFE_INTEGER),c.flags&&(e.flags={backfaces:c.flags.flags.backfaces,frontface:c.flags.flags.frontface,solid:c.flags.flags.solid,skybox:c.flags.flags.skybox,billboard:c.flags.flags.billboard,depthMask:k,layer:l}),a(e,c,function(){i.materials[b]=e,d(e)})};var o=0;i.getTextureCompressionStats=function(){var a={compressed:0,uncompressed:0};for(var b in i.materials)i.materials.hasOwnProperty(b)&&(a.compressed+=i.materials[b].textureCompressionStats.compressed,a.uncompressed+=i.materials[b].textureCompressionStats.uncompressed);return a},i.destroyAsset=function(a){if(a){var b=i.materials[a];for(var c in b)b.hasOwnProperty(c)&&"function"==typeof b[c].destroy&&b[c].destroy();delete i.materials[a]}else i.reset()},i.reset=function(){for(var a in i.materials)i.materials.hasOwnProperty(a)&&i.destroyAsset(a)}}(),function(){"use strict";var a=Human.assets.regionMaps={};a.maps={},a.libraries={};var b;Human.events.on("loaded",function(){b=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Region Map library"})}),a.createLibrary=function(c){return a.libraries[c]?void Human.log.warn("Human.assets.regionMaps.createLibrary","Region map library already loaded: "+c):void(a.libraries[c]={node:b.addNode({type:"library",data:"libraryId = "+c}),libraryId:c,maps:{}})},a.createRegion=function(b,c,d){var e=a.libraries[b];if(!e)return void Human.log.error("Human.assets.regions.createRegion","Region library not found: "+b);if(a.maps[c])return void Human.log.warn("Human.assets.regions.createRegion","Region already loaded: "+c);var f={node:e.node.addNode({type:"regionMap",src:d.src,mode:d.mode||"highlight",regionData:d.regions,highlightFactor:d.highlightFactor||{r:1.2,g:1.2,b:1.2},hideAlpha:d.hideAlpha||0}),regionMapId:c};a.maps[c]=f,e.maps[c]=f},a.highlightRegion=function(b){b=b||{};var c,d=b.regionColor,e=b.regionMapId,f=b.highlight,g=a.maps;if(e)c=g[e],c.node.setRegionColor(f?d:{r:-1,g:-1,b:-1});else for(e in g)g.hasOwnProperty(e)&&(c=g[e],c.node.setRegionColor(f?d:{r:-1,g:-1,b:-1}))},a.destroyLibrary=function(b){if(b||""===b){var c=a.libraries[b];if(!c)return void Human.log.warn("Human.assets.regions.destroyLibrary","Region library not found: "+b);c.node.destroy();for(var d in c.maps)c.maps.hasOwnProperty(d)&&delete a.maps[d];delete a.libraries[b]}else a.reset()},a.reset=function(){for(var b in a.libraries)a.libraries.hasOwnProperty(b)&&a.destroyLibrary(b)}}(),function(){"use strict";Human.assets.regionMaps.loader=new Human.utils.Loader,Human.assets.regionMaps.loader._load=function(a,b,c,d,e,f){var g=c,h=b+"."+c;Human.net.getRegionsLibrary(g,function(a){Human.assets.regionMaps.createLibrary(h);var b,c,d=Human.net.getRegionsDir(g);for(var f in a)if(a.hasOwnProperty(f)){if(b=a[f],c=b.src,!c){Human.log.error("Human.assets.regionMaps.loader","Region property missing: src");continue}b.src=d+c.substring(c.lastIndexOf("/")+1)+"?v="+Human.VERSION,Human.assets.regionMaps.createRegion(h,h+"."+f,b)}Human.renderer.compile(),e()},function(a){f("failed to load manifest file for regions library '"+g+"': "+a)})},Human.assets.regionMaps.loader._unload=function(a){Human.assets.regionMaps.destroyLibrary(a)}}(),function(){"use strict";var a=Human.assets.transforms={};a.transforms={},a.parseAsset=function(b,c,d){if(a.transforms[b])return void Human.log.warn("Human.assets.transforms.createTransform","Transform already loaded, not reloading: "+b);var e=new Human.assets.transforms.Transform(c);a.transforms[b]=e,d(e)},a.findTransform=function(b){var c=a.transforms[b];return c?c:null},a.destroyAsset=function(b){b?delete a.transforms[b]:a.reset()},a.reset=function(){for(var b in a.transforms)a.transforms.hasOwnProperty(b)&&a.destroyAsset(b)}}(),function(){"use strict";Human.assets.transforms.Transform=function(a){this.type="transform",this.pivot={x:0,y:0,z:0},this.translate={x:0,y:0,z:0},this.scale={x:1,y:1,z:1},this.rotate={x:0,y:0,z:0},this.onUpdated=null,this.set(a)},Human.assets.transforms.Transform.prototype.set=function(a){a.pivot&&(void 0!==a.pivot.x&&(this.pivot.x=a.pivot.x),void 0!==a.pivot.y&&(this.pivot.y=a.pivot.y),void 0!==a.pivot.z&&(this.pivot.z=a.pivot.z)),a.translate&&(void 0!==a.translate.x&&(this.translate.x=a.translate.x),void 0!==a.translate.y&&(this.translate.y=a.translate.y),void 0!==a.translate.z&&(this.translate.z=a.translate.z)),a.scale&&(void 0!==a.scale.x&&(this.scale.x=a.scale.x),void 0!==a.scale.y&&(this.scale.y=a.scale.y),void 0!==a.scale.z&&(this.scale.z=a.scale.z)),a.rotate&&(void 0!==a.rotate.x&&(this.rotate.x=a.rotate.x),void 0!==a.rotate.y&&(this.rotate.y=a.rotate.y),void 0!==a.rotate.z&&(this.rotate.z=a.rotate.z)),this.onUpdated&&this.onUpdated()}}(),function(){"use strict";function a(a){for(var b,c={morphGeometry:{}},d=new Uint32Array(a,0,11),e=d[1],f=d[2],g=d[3],h=d[4],i=d[5],j=d[6],k=11*Uint32Array.BYTES_PER_ELEMENT,l=k+e,m=l+f,n=m+g,o=n+h,p=o+i,q=c.morphGeometry.keys=Human.utils.atoj(a,l,f),r=q.length,s=c.morphGeometry.targets=[],t=g/r,u=t/Float32Array.BYTES_PER_ELEMENT,v=h/r,w=v/Float32Array.BYTES_PER_ELEMENT,x=j/r,y=j/Float32Array.BYTES_PER_ELEMENT,z=0;r>z;z++)b={},g>0&&(b.positions=new Float32Array(a,m+z*t,u)),h>0&&(b.normals=new Float32Array(a,n+z*v,w)),j>0&&(b.uvs=new Float32Array(a,p+z*x,y)),s.push(b);return c}function b(a){var b,c,d={},e=new DataView(a),f=e.getUint32(4,!0),i=e.getUint32(8,!0),j=e.getUint32(12,!0),k=e.getUint32(20,!0),l=e.getUint32(24,!0),m=e.getUint16(32,!0),n=e.getUint8(34),o=new Array(n);for(c=0,b=36;n>c;c++,b+=5)o[c]={uvSize:e.getUint32(b,!0),uvDecodeSize:e.getUint8(b+4)};b=j+f,d.morphGeometry=Human.utils.atoj(a,b,i);var p,q=d.morphGeometry.keys,r=q.length,s=d.morphGeometry.targets=new Array(r);for(c=0;r>c;c++)s[c]={};d.positionTranslates=new Array(r),d.positionScales=new Array(r);var t=m/r,u=k/r,v=u/Uint16Array.BYTES_PER_ELEMENT,w=l/r,x=w/Int8Array.BYTES_PER_ELEMENT;if(b+=i,m>0)for(c=0;r>c;c++){p=s[c];var y=d.positionTranslates[c]=new Float32Array(a,b,3),z=d.positionScales[c]=new Float32Array(a,b+12,3);mat4.fromScaling(g,z),mat4.fromTranslation(h,y),p.positionDecodeMat=mat4.create(),mat4.multiply(p.positionDecodeMat,h,g),b+=t}if(k>0){for(c=0;r>c;c++)s[c].positions=new Uint16Array(a,b+c*u,v);b+=k}if(l>0)for(c=0;r>c;c++)s[c].normals=new Int8Array(a,b+c*w,x);return d}var c=Human.assets.morphs={};c.morphs={};var d;Human.events.on("loaded",function(){d=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Morphs library"})}),c.parseAsset=function(c,d,e){var f,g=new Uint32Array(d,0,1)[0];f=17===g?a(d):b(d),e(Human.assets.morphs.createMorph(c,f))},c.findMorph=function(a){var b=c.morphs[a];return b?b:null};var e=vec3.fromValues(0,0,0),f=vec3.fromValues(1,1,1);c.createMorph=function(a,b){var g=c.morphs[a];if(g)return Human.log.warn("Human.assets.morphs.createMorph","Morph already loaded: "+a),g;g={type:"morph",boundary:null,center:null,axisBoundary:null,_frameDirty:!0,positionTranslates:b.positionTranslates,positionScales:b.positionScales,updateBoundary:function(){if(this._frameDirty){var a,b,c,d,g={xmin:1e5,ymin:1e5,zmin:1e5,xmax:-1e5,ymax:-1e5,zmax:-1e5},h=this.morphGeometry.getCurrentFrame(),i=h.key1,j=h.key2,k=h.target1.positions,l=h.target2.positions,m=h.factor;this.positionTranslates&&this.positionScales?(b=this.positionTranslates[i],a=this.positionScales[i],d=this.positionTranslates[j],c=this.positionScales[j]):(b=e,a=f,d=e,c=f);for(var n,o,p,q,r,s,t,u,v,w=0,x=k.length-2;x>w;w+=3)n=k[w]*a[0]+b[0],o=k[w+1]*a[1]+b[1],p=k[w+2]*a[2]+b[2],q=l[w]*c[0]+d[0],r=l[w+1]*c[1]+d[1],s=l[w+2]*c[2]+d[2],"number"==typeof n&&"number"==typeof o&&"number"==typeof p&&"number"==typeof q&&"number"==typeof r&&"number"==typeof s&&(t=n+m*(q-n),u=o+m*(r-o),v=p+m*(s-p),g.xmin=Math.min(g.xmin,t),g.ymin=Math.min(g.ymin,u),g.zmin=Math.min(g.zmin,v),g.xmax=Math.max(g.xmax,t),g.ymax=Math.max(g.ymax,u),g.zmax=Math.max(g.zmax,v));this.boundary=g,this.axisBoundary=new Float32Array([g.xmin,g.ymin,g.zmin,g.xmax,g.ymax,g.zmax]),this.center=[.5*(g.xmax+g.xmin),.5*(g.ymax+g.ymin),.5*(g.zmax+g.zmin)],this._frameDirty=!1}}},b.morphGeometry&&(b.morphGeometry.type="morphGeometry",g.morphGeometry=d.addNode(b.morphGeometry),g.morphGeometry.onUpdate=function(){g._frameDirty=!0}),g.updateBoundary();var h=new Human.assets.morphs.Animation,i=b.morphGeometry.keys;h.addMorph(i[0],i[i.length-1],function(a){g.morphGeometry.setFactor(a)}),h.calculateTimeFrame(),Human.timeline.addAnimation(a,h);var j=a.split("/")[0],k=Human.timeline.leafTimelines[j]||new Human.timeline.LeafTimeline(j);return k.addAnimation(a,h),c.morphs[a]=g,g},c.destroyAsset=function(a){if(a){var b=c.morphs[a];if(!b)return void Human.log.warn("Human.assets.morphs.destroyMorph","Morph not found: "+a);b.morphGeometry.destroy(),delete c.morphs[a]}else c.reset()},c.reset=function(){for(var a in c.morphs)c.morphs.hasOwnProperty(a)&&c.destroyAsset(a)};var g=mat4.create(),h=mat4.create()}(),function(){"use strict";Human.assets.morphs.Animation=function(a){a=a||{},this.type="morph-animation",this._loop=a.loop!==!1,this._morphList=[],this.timeline=a.timeline,this.firstTime=null,this.lastTime=null},Human.assets.morphs.Animation.prototype.addMorph=function(a,b,c){this._morphList.push({firstTime:a,lastTime:b,update:c})},Human.assets.morphs.Animation.prototype.calculateTimeFrame=function(){for(var a,b=1e6,c=-1e6,d=this._morphList,e=0,f=this._morphList.length;f>e;e++)a=d[e],a.firstTime<b&&(b=a.firstTime),a.lastTime>c&&(c=a.lastTime);this.firstTime=b,this.lastTime=c},Human.assets.morphs.Animation.prototype.update=function(a,b){for(var c,d,e=0,f=this._morphList.length;f>e;e++)c=this._morphList[e],this._loop?d=b===c.lastTime?b:c.firstTime+b%(c.lastTime-c.firstTime):(d<c.firstTime&&(d=c.firstTime),d>c.lastTime&&(d=c.lastTime)),c.update(d)},Human.assets.morphs.Animation.prototype.destroy=function(){this.destroyed=!0}}(),function(){"use strict";var a=Human.assets.lights={},b={};a.parseLibrary=function(a,c,d,e){var f=b[a];if(f)return Human.log.warn("Human.assets.lights.parseLibrary","library already loaded"),void e();var g=c.lights;if(!g)return Human.log.error("Human.assets.lights.parseLibrary","'lights' section expected in lights library"),void e();f=[],b[a]=f,Human.view.lights.clearEnabled();for(var h,i,j=0,k=g.length;k>j;j++)h=g[j],h.lightId?(i=a+"."+h.lightId,h.lightId=i,h.enabled=!0,Human.view.lights.addLight(h),f.push(i)):(Human.log.error("Human.assets.lights.load","'lightId' missing on light"),e());e&&e()},a.unloadLibrary=function(a){var c=b[a];if(!c)return void Human.log.warn("Human.assets.lights.unloadLibrary","library not loaded");var d,e,f=Human.view.lights;for(d=0,e=c.length;e>d;d++)f.removeLight(c[d]);delete b[a]}}(),function(){"use strict";function a(a,b){return b.indexOf(".")<0?a+"-"+b:b}var b=Human.assets.tweens={};b.parseLibrary=function(b,c,d,e){var f,g,h,i,j,k,l,m,n=c.tweens||{},o=[],p=b.split("/")[0];Human.timeline.leafTimelines.hasOwnProperty(p)||(m=new Human.timeline.LeafTimeline(p));for(var q in n)if(n.hasOwnProperty(q)){if(f=n[q],!f.keys){Human.log.error("Human.timeline.tweenAnimationLoader","Tween attribute missing: 'keys'");continue}if(!f.targets){Human.log.error("Human.timeline.tweenAnimationLoader","Tween attribute missing: 'targets'");continue}if(f.keys.length<2||f.targets.length<2){Human.log.error("Human.timeline.tweenAnimationLoader","tween has insufficient keys or targets - minimum of two required");continue}if(f.keys.length!==f.targets.length){Human.log.error("Human.timeline.tweenAnimationLoader","tween has mismatching numbers of keys and targets");continue}if(f.options=Human.utils.applyIf(this.options,f.options||{}),g=f.type,!g){Human.log.error("Human.timeline.tweenAnimationLoader","Tween attribute missing: 'type'");continue}if(j=g.split(":"),h=j[0],i=j[1],"lerp"===h&&(h="tween"),!h||!i){Human.log.error("Human.timeline.tweenAnimationLoader","Tween attribute invalid: 'type'");continue}switch(i){case"objectAttr":k=new Human.timeline.ObjectControl({modelId:p,objectId:a(p,f.objectId||f.targetId)});break;case"objectXForm":k=new Human.timeline.ObjectTransformControl({modelId:p,objectId:a(p,f.objectId||f.targetId),initial:f.targets[0]});break;case"material":k=new Human.timeline.MaterialControl({modelId:p,materialId:a(p,f.materialId||f.targetId),attributes:f.targets[0]});break;case"texture":k=new Human.timeline.TextureControl({modelId:p,materialId:a(p,f.materialId||f.targetId),targetLayer:f.targetLayer});break;case"fresnel":k=new Human.timeline.FresnelControl({modelId:p,materialId:a(p,f.materialId),fresnelType:f.fresnelType});break;case"camera":k=new Human.timeline.CameraControl;break;default:Human.log.error("Human.timeline.tweenAnimationLoader","Unsupported tween type: "+g);continue}switch(h){case"tween":l=new Human.timeline.Tween({keys:f.keys,targets:f.targets,control:k});break;case"switch":l=new Human.timeline.Switch({keys:f.keys,targets:f.targets,control:k});break;default:Human.log.error("Human.timeline.tweenAnimationLoader","Unsupported tween type: "+g);continue}o.push(l)}if(o.length>0){var r=new Human.timeline.TweenAnimation({tweens:o});Human.timeline.addAnimation(b,r)}m=Human.timeline.leafTimelines[p],m.addAnimation(b,Human.timeline.animations[b]),e&&e()},b.unloadLibrary=function(){}}(),function(){"use strict";var a=Human.assets.reflections={},b={};a.reflections={},a.exportedReflectionIds={};var c;Human.events.on("loaded",function(){c=Human.renderer.getNode("assetLibraryRoot").addNode({type:"library",data:"Reflections library"})}),a.parseLibrary=function(c,d,e,f){var g=b[c];if(g)return Human.log.warn("Human.assets.reflections.parseLibrary","library already loaded"),void f();g=[],b[c]=g;var h,i,j,k,l=c.split("/"),m="/content/states/"+l[0]+"/reflections/"+l[1]+"/",n=Human.renderer.graph;for(var o in d)if(d.hasOwnProperty(o)){if(h=d[o],h.type="reflect",h.blendMode=h.blendMode||"add",i=h.src,!i){Human.log.error("Human.assets.reflections.loader","Reflection property missing: src");continue}if(!Human.utils.isArray(i)){Human.log.error("Human.assets.reflections.loader","Reflection property should be array: src");continue}for(var p=0,q=i.length;q>p;p++)i[p]=m+i[p]+"?v="+Human.VERSION;j=c+"."+o,k={node:n.insertNode(n.rootNodes.library,h)},a.reflections[j]=k,g.push(j)}Human.renderer.compile(),f&&f()},a.exportReflections=function(b){b=b||{};for(var c in b)if(b.hasOwnProperty(c)){var d=b[c];-1===d.indexOf("/")&&(b[c]=d.replace(/^([^\.]+)\./,"$1/"))}a.exportedReflectionIds=b||{}},a.unloadLibrary=function(c){var d=b[c];if(!d)return void Human.log.warn("Human.assets.reflections.unloadLibrary","library not loaded");var e,f,g,h;for(e=0,f=d.length;f>e;e++)g=d[e],h=a.reflections[g],h.node.destroy();delete b[c]}}(),function(){"use strict";var a=["showObjects","selectObjects","pickThroughObjects"],b=Human.assets.chapters={};b.parseLibrary=function(b,c,d,e){function f(b,c){a.forEach(function(a){if(b.hasOwnProperty(a))for(var d in b[a])if(b[a].hasOwnProperty(d)&&d.indexOf("-")<0){var e=c+"-"+d;b[a][e]=b[a][d],delete b[a][d]}})}function g(a,b){a.hasOwnProperty("annotations")&&a.annotations.forEach(function(a){a.hasOwnProperty("objectId")&&a.objectId.indexOf("-")<0&&(a.objectId=b+"-"+a.objectId)})}var h,i,j=d.moduleId,k=b.split("/")[0],l=c.chapters,m=[];if(Human.utils.isArray(l))m=l;else{i=0;for(var n in l)l.hasOwnProperty(n)&&(h=l[n],m.push(h))}var o=!0;for(i=0;o&&i<m.length;)h=m[i],h.hasOwnProperty("timelineMap")||(o=!1),i++;if(!o){var p=!0;for(i=0;p&&i<m.length;)h=m[i],h.hasOwnProperty("time")||(p=!1,Human.log.error("Human.timeline.chapterLoader","all chapters must either have all 'time' attributes or 'timelineMap' attributes.")),i++;var q=function(a,b){return a.time<b.time?-1:a.time>b.time?1:0};m=m.sort(q);var r;m.forEach(function(a,b){if(b<m.length-1)r=m[b+1].time;else{var c=a.duration;r=c?a.time+c:void 0}a.timelineMap=[],Human.modules.modules[j].modelIds.forEach(function(b){var c={};c.start=0,c.end=r-a.time,c.data={timeline:b,start:a.time,end:r,fit:!1,onEnd:"freeze"},a.timelineMap.push(c)})})}m.forEach(function(a,c){a.chapterId=b+"_"+c,f(a,k),g(a,k)}),Human.timeline.chapterList=m,e&&e()},b.unloadLibrary=function(){}}(),function(){"use strict";var a=Human.assets.audio={};a.parseLibrary=function(a,b,c,d){Human.media.audio.createLibrary(a,b),d&&d()},a.unloadLibrary=function(a){Human.media.audio.destroyLibrary(a)}}(),function(){"use strict";var a=Human.assets.video={};a.parseLibrary=function(a,b,c,d){Human.media.videos.createLibrary(a,b),d&&d()},a.unloadLibrary=function(a){Human.media.videos.destroyLibrary(a)}}(),function(){"use strict";function a(a,b){return a?a[b]===!0?!0:a[b]===!1?!1:!1:!0}function b(){var a=Human.modules.moduleLibs,b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(c);return b}function c(){var a=[];if(Human.modules.numActiveModules>0){var b=Human.modules.activeModules;for(var c in b)b.hasOwnProperty(c)&&a.push(c)}return a}function d(){return Human.view.camera.getLookAt()}function e(){return{dissect:Human.view.dissect.getEnabled(),highlight:Human.view.highlight.getEnabled(),isolate:Human.view.isolate.getEnabled(),labels:Human.view.labels.getEnabled(),xray:Human.view.xray.getEnabled(),singlePick:Human.view.pick.getSinglePickEnabled(),multiPick:Human.view.pick.getMultiPickEnabled()}}function f(){var a,b=Human.view.clip.clips,c={};for(var d in b)b.hasOwnProperty(d)&&(a=b[d],c[d]={clipId:a.clipId,type:a.type,progress:a.progress,state:a.state});return c}function g(){var a,b,c,d={},e=Human.scene,f=e.objects,g=e.enabledObjects,i=e.selectedObjects;for(var j in f)f.hasOwnProperty(j)&&(a=f[j],c=null,0===a.objects.length&&g[j]&&(c=c||{},c.enabled=!0,c.selected=!!i[j],b=h(a),b&&(c.transform=b),c.opacity=a.opacity),c&&(d[j]=c));return d}function h(a){if(null===a.pivot)return null;var b={};return 0!==a.pivot.x&&(b.pivot=b.pivot||{},b.pivot.x=a.pivot.x),0!==a.pivot.y&&(b.pivot=b.pivot||{},b.pivot.y=a.pivot.y),0!==a.pivot.z&&(b.pivot=b.pivot||{},b.pivot.z=a.pivot.z),0!==a.translate.x&&(b.translate=b.translate||{},b.translate.x=a.translate.x),0!==a.translate.y&&(b.translate=b.translate||{},b.translate.y=a.translate.y),0!==a.translate.z&&(b.translate=b.translate||{},b.translate.z=a.translate.z),1!==a.scale.x&&(b.scale=b.scale||{},b.scale.x=a.scale.x),1!==a.scale.y&&(b.scale=b.scale||{},b.scale.y=a.scale.y),1!==a.scale.z&&(b.scale=b.scale||{},b.scale.z=a.scale.z),0!==a.rotate.x&&(b.rotate=b.rotate||{},b.rotate.x=a.rotate.x),0!==a.rotate.y&&(b.rotate=b.rotate||{},b.rotate.y=a.rotate.y),0!==a.rotate.z&&(b.rotate=b.rotate||{},b.rotate.z=a.rotate.z),Object.keys(b).length>0?b:null}function i(){var a,b,c=[],d=Human.view.annotations.annotations,e=Array.prototype.slice;for(var f in d)d.hasOwnProperty(f)&&(a=d[f],a.saved&&(b={annotationId:f,title:a.label.title,description:a.label.description,pos:e.call(a.pin.pos),pinVec:e.call(a.pin.dir),shown:a.pin.shown,labelShown:a.label.shown,labelOffset:e.call(a.label.offset),occludable:a.occludable,primitiveIndex:a.pin.primitiveIndex,barycentric:a.pin.barycentric},a.object&&(b.objectId=a.object.objectId),c.push(b)));return c}function j(a){a.modules={},a.modules.activeModules=[],a.modules.moduleLibs=[],Human.utils.isObject(a.objects)||(a.objects={});var b=k(a.objects);b&&a.modules.activeModules.unshift(b)}function k(a){var b,c=null;for(var d in a)if(a.hasOwnProperty(d)&&(b=d.match(/^(fe)?maleAdult/))){c=["production",b[0],b[0]+".json"].join("/");break}return c}function l(a){var b,c,d={};for(b in a)a.hasOwnProperty(b)&&(c=a[b],c.enabled&&(b=Human.modules.convertBaseAnatomyObjectId(b),d[b]=!0));return d}function m(a,b,c,d){function e(){0===--f&&c()}var f=a.length;if(0===f)return void c();for(var g=0,h=f;h>g;g++){var i=a[g],j=null;Human.modules.isBaseModule(i)||(j=Human.modules.requiresBase(Object.keys(b))),Human.modules.activateModules({moduleId:i,extensions:j&&{showObjects:b}},e,d)}}function n(a,b){a.objects&&s(a.objects,b),a.modes&&q(a.modes)}function o(a){return a.timeline?void(a.timeline.scrub?Human.timeline.scrub(a.timeline.scrub):a.timeline.play&&Human.timeline.play(a.timeline.play)):void Human.timeline.stop();
  
  }function p(a,b){for(var c,d,e,f=0;f<B.length;f++)if(d=B[f],Human.utils.isObject(a[d])){e=d,"camera"===e&&(e="jumpTo"),c=a[d];break}e&&c?Human.view.camera.fly[e]({up:Human.utils.apply(c.up,{x:0,y:1,z:0}),eye:Human.utils.apply(c.eye,{x:0,y:0,z:-100}),look:Human.utils.apply(c.look,{x:0,y:0,z:0})},b):b&&b()}function q(a){void 0!==a.dissect&&null!==a.dissect,void 0!==a.highlight&&null!==a.highlight&&Human.rpc.call(null,"highlight.setEnabled",{enable:a.highlight}),Human.scene.anySelected()&&a.isolate?void 0!==a.isolate&&null!==a.isolate&&Human.rpc.call(null,"isolate.setEnabled",{enable:a.isolate}):void 0!==a.isolate&&null!==a.isolate&&Human.rpc.call(null,"isolate.setEnabled",{enable:!1}),void 0!==a.labels&&null!==a.labels&&Human.rpc.call(null,"labels.setEnabled",{enable:a.labels}),void 0!==a.singlePick&&null!==a.singlePick&&Human.rpc.call(null,"pick.single.setEnabled",{enable:a.singlePick}),void 0!==a.multiPick&&null!==a.multiPick&&Human.rpc.call(null,"pick.multi.setEnabled",{enable:a.multiPick}),void 0!==a.xray&&null!==a.xray&&Human.rpc.call(null,"xray.setEnabled",{enable:a.xray})}function r(a){Human.view.clip.reset();for(var b in a)a.hasOwnProperty(b)&&Human.view.clip.setClip(a[b])}function s(a,b){t(a,b),u(a,b),v(a),z(a)}function t(a,b){Human.scene.setEnabledObjects({objectIds:x(a,"enabled"),replace:!b})}function u(a,b){Human.scene.setSelectedObjects({objectIds:x(a,"selected"),replace:!b})}function v(a){a=a||{};var b,c,d;for(c in a)a.hasOwnProperty(c)&&(b=Human.scene.objects[c],d=a[c].transform,b&&d&&b.setTransform(w(b,d)))}function w(a,b){var c=a.pivot||{x:0,y:0,z:0},d=a.translate||{x:0,y:0,z:0},e=a.scale||{x:1,y:1,z:1},f=a.rotate||{x:0,y:0,z:0};return b.pivot=b.pivot||{},b.translate=b.translate||{},b.scale=b.scale||{},b.rotate=b.rotate||{},b.pivot.x=void 0===b.pivot.x?c.x:b.pivot.x,b.pivot.y=void 0===b.pivot.y?c.y:b.pivot.y,b.pivot.z=void 0===b.pivot.z?c.z:b.pivot.z,b.translate.x=void 0===b.translate.x?d.x:b.translate.x,b.translate.y=void 0===b.translate.y?d.y:b.translate.y,b.translate.z=void 0===b.translate.z?d.z:b.translate.z,b.scale.x=void 0===b.scale.x?e.x:b.scale.x,b.scale.y=void 0===b.scale.y?e.y:b.scale.y,b.scale.z=void 0===b.scale.z?e.z:b.scale.z,b.rotate.x=void 0===b.rotate.x?f.x:b.rotate.x,b.rotate.y=void 0===b.rotate.y?f.y:b.rotate.y,b.rotate.z=void 0===b.rotate.z?f.z:b.rotate.z,b}function x(a,b){var c,d={};a=a||{};var e;for(var f in a)if(a.hasOwnProperty(f)){if(e=Human.scene.objects[Human.modules.convertBaseAnatomyObjectId(f)],!e)continue;c=a[f][b],(c===!0||c===!1)&&(d[e.objectId]=c)}return d}function y(a,b){var c;b="undefined"==typeof b?!1:b;for(var d=0,e=a.length;e>d;d++)c=a[d],Human.view.annotations.createAnnotation({annotationId:c.annotationId,objectId:c.objectId,title:c.title||"",description:c.description||"",pos:c.offset||c.pos,dir:c.pinVec,shown:c.shown,type:c.type,labelShown:c.labelShown,labelOffset:c.labelOffset,saved:!0,isOwner:b,occludable:c.occludable,primitiveIndex:c.primitiveIndex,barycentric:c.barycentric})}function z(a){a=a||{};var b,c,d;for(c in a)a.hasOwnProperty(c)&&(b=Human.scene.objects[c],b&&(d=a[c].opacity,null!==d&&void 0!==d&&b.setOpacity(d)))}var A=Human.bookmarks={},B=["camera","flyTo","jumpTo"];A.capture=function(h){var j={engineVersion:Human.VERSION};a(h,"modules")&&(j.modules={moduleLibs:b(),activeModules:c()}),a(h,"camera")&&(j.camera=d()),a(h,"modes")&&(j.modes=e()),a(h,"clips")&&(j.clips=f()),a(h,"objects")&&(j.objects=g()),a(h,"annotations")&&(j.annotations=i()),a(h,"timeline")&&(j.timeline=Human.timeline.getBookmark()),j.plugins={};var k,l=Human.plugins;for(var m in l)l.hasOwnProperty(m)&&(k=l[m],k.writeBookmark&&k.writeBookmark(j));return j},A.restore=function(a,b){Human.events.fire("bookmarks.restoring"),Human.utils.isObject(a.modules)||j(a),Human.view.annotations.clearAnnotations();for(var c=a.modules.activeModules,d=c.length>1,e=l(a.objects),f=[],g=0,h=c.length;h>g;g++)f[g]=Human.modules.convertBaseAnatomyModuleId(c[g]);Human.utils.filterInPlace(f,function(a){return Human.modules.activeModules[a]?!1:d&&Human.modules.isBaseModule(a)?!1:!0}),Human.renderer.pushPause(),Human.renderer.pauseCompilation(),m(f,e,function(){var c,d=[];for(c in e)e.hasOwnProperty(c)&&Human.scene.objects[c]?d.push(Human.scene.objects[c]):Human.log.error("Bookmark showObject not found: "+c);Human.timeline.cancelCameraInit(),Human.timeline.cancelAnnotationInit(),Human.scene.graph.attachAssetSetsToSubtree(d,function(c,d,e){try{if(0===d&&(Human.timeline.initScene(),Human.view.lights.compile(),Human.view.effects.compile(),Human.renderer.resumeCompilation(),Human.renderer.compile(),n(a),p(a,function(){a.annotations&&y(a.annotations,a.is_owner)}),Human.renderer.popPause()),c.geometry&&a.clips&&r(a.clips),c.morph&&Human.timeline.addMorphs(Object.keys(Human.assets.morphs.morphs)),e){var f,g=Human.plugins;for(var h in g)g.hasOwnProperty(h)&&(f=g[h],f&&f.readBookmark&&f.readBookmark(a));o(a),Human.events.fire("bookmarks.restored",a),b&&b()}}catch(i){Human.log.error("Bookmark restore scene initialization error: "+i.message),Human.renderer.resumeCompilation(),Human.renderer.popPause()}},function(){Human.renderer.resumeCompilation(),Human.renderer.popPause()})})}}(),function(){"use strict";function a(a,b){if("function"==typeof b&&(b=b(a)),Human.utils.isObject(b))for(var c in b)b.hasOwnProperty(c)&&(a.hasOwnProperty(c)&&(a._overwritten||(a._overwritten={}),a._overwritten[c]=a[c]),a[c]=b[c])}function b(a){var b=a._overwritten;if(b){for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);delete a._overwritten}}function c(a,b,c){return t?void s.unshift({moduleId:a,options:b,ok:c}):void d(a,b,function(){c&&c(),e()})}function d(b,c,d){var e=n.modules[b];return e?(t=!0,Human.events.fire("modules.activating",{moduleId:b}),c.extensions&&a(e,c.extensions),void e.activate(c,function(){var a,c=Human.plugins;for(var f in c)c.hasOwnProperty(f)&&(a=c[f],a.readModule&&a.readModule(e));e.active=!0,e.timeActivated=Date.now(),n.activeModules[b]=e,n.numActiveModules++,Human.events.fire("modules.activated",{moduleId:b,timeActivated:e.timeActivated}),t=!1,d()})):(Human.log.error("Human.modules.activateModules","Module not found: "+b),void d())}function e(){if(s.length>0){var a=s.pop();d(a.moduleId,a.options,function(){a.ok(),e()})}}function f(a,b,c){g(a.slice(0),a.length,b,function(){c()})}function g(a,b,d,e){if(0===a.length)return void e();var f=a.shift();c(f,d,function(){g(a,b,d,e)})}function h(a,b,d){for(var e=r.findItems({matching:"atLeast",tags:a}),f=0,g=e.length;g>f;f++)return void c(e[f].moduleId,b,d);Human.log.warn("Human.modules.activateModules","Failed to activate module - no module found with these tags: "+JSON.stringify(a)),d()}function i(a){for(var b=r.findItems({matching:a.matching||"atLeast",tags:a.tags}),c=0,d=b.length;d>c;c++)j(b[c].moduleId)}function j(a,c){if(!t)if(a){var d=n.activeModules[a];d&&(Human.events.fire("modules.deactivating",{moduleId:a}),d.deactivate(c),d.active=!1,d.timeActivated=-1,b(d),delete n.activeModules[a],n.numActiveModules--,Human.events.fire("modules.deactivated",a))}else for(a in n.modules)n.modules.hasOwnProperty(a)&&n.activeModules[a]&&j(a,c)}function k(a){for(var b=r.findItems({matching:"atLeast",tags:a}),c=0,d=b.length;d>c;c++)l(b[c].moduleId)}function l(a){if(a){var b=n.modules[a];if(!b)return void Human.log.warn("Human.modules.destroyModules","Failed to destroy module - module not found: + "+a);if(j(a,!0),delete n.modules[a],r.removeItem(a),n.namesToModuleIds.hasOwnProperty(b.displayName)){var c=n.namesToModuleIds[b.displayName].indexOf(a);c&&n.namesToModuleIds[b.displayName].splice(c,1)}return q.putId(a),void Human.events.fire("modules.destroyed",a)}for(a in n.modules)n.modules.hasOwnProperty(a)&&l(a)}var m,n=Human.modules={},o=n.MALE_STATE_ID="maleAdult_standard",p=n.FEMALE_STATE_ID="femaleAdult_standard",q=new Human.utils.IDPool;n.modules={},n.moduleLibs={};var r=new Human.utils.TagMapList;n.activeModules={},n.numActiveModules=0;var s=[];n.namesToModuleIds={};var t=!1;Human.events.on("loaded",function(){m=!0}),n.createModule=function(a){var b;if(a.moduleId){if(b=a.moduleId,n.modules[b])return void Human.log.warn("Human.modules.createModule","Module already created, won't create again: + "+b)}else b=q.getId();a.moduleId=b,a.displayName=a.displayName||"",a.description=a.description||"",a.translations=a.translations,a.tags=a.tags||[],a.active=!1,a.timeActivated=-1;var c=new n.Module(a);return n.modules[b]=c,r.addItem(b,a.tags||["untagged"],c),n.namesToModuleIds[a.displayName]=n.namesToModuleIds[a.displayName]||[],n.namesToModuleIds[a.displayName].push(b),Human.events.fire("modules.created",a),b},n.activateModules=function(a,b,d){if(!m)return Human.log.error("Human.modules.activateModules","Human not loaded - modules can only be activated when Human loaded"),void(b&&b());var e=b;b=function(){e&&e()};var g=a;if(a.moduleId){var i=a.moduleId;if(!n.modules[i])return Human.log.info("Human.modules.activateModules","Module not found: '"+i+"' - attempting to load definition"),void Human.assets.server.getModuleDefinition(i,function(a){a.moduleId=i,n.createModule(a),c(i,g,b)},function(a){Human.log.info("Human.modules.activateModules","Failed to activate module: '"+i+"' - "+a),d&&d(a)});c(i,g,b)}else a.moduleIds?f(a.moduleIds.slice(0),g,b):a.tags&&h(a.tags,g,b)},n.activateModuleWithAssets=function(a,b,c){Human.renderer.pushPause(),Human.renderer.pauseCompilation(),n.activateModules({moduleId:a},function(){var c=Human.modules.activeModules[a];Human.scene.graph.attachAssetSetsToSubtree(c.assetObjects,function(c,d,e){0===d&&(Human.timeline.initScene(),Human.view.lights.compile(),Human.view.effects.compile(),Human.renderer.resumeCompilation(),Human.renderer.compile(),Human.timeline.initCamera(),Human.renderer.popPause()),c.morph&&Human.timeline.addMorphs(Object.keys(Human.assets.morphs.morphs)),e&&(Human.modules.activateTimeline(a),b&&b())})},function(){Human.renderer.resumeCompilation(),Human.renderer.popPause(),c&&c()})},n.activateTimeline=function(a,b){var c=n.modules[a];if(b=b||{},c&&null!==Human.timeline.activeRoot&&b.play!==!1){var d={which:"second",direction:"forwards"};Human.utils.isEmpty(c.animation)?Human.timeline.scrub({time:0},{boundaryCondition:d}):Human.timeline.play(c.animation||{})}},n.deactivateModules=function(a){a=a||{},a.tags?i(a):a.moduleId?j(a.moduleId):j()},n.destroyModules=function(a){a=a||{},a.tags?k(a.tags):l(a.moduleId)},n.query=function(a){var b,c,d;if(a){if(a.tags)return r.findItems(a);if(a.moduleId)return b=n.modules[a.moduleId],b?[b.module]:[];if(a.names){var e=[];for(var f in a.names)if(a.names.hasOwnProperty(f)){var g=a.names[f];if(n.namesToModuleIds.hasOwnProperty(g)){var h=n.namesToModuleIds[g];for(var i in h)h.hasOwnProperty(i)&&(c=h[i],n.modules.hasOwnProperty(c)&&(b=n.modules[c],e.push({moduleId:c,displayName:b.displayName,description:b.description,translations:b.translations,tags:b.tags,animation:b.animation,active:b.active,timeActivated:b.timeActivated})))}}return e}if(a.active){d=[];for(c in n.activeModules)n.activeModules.hasOwnProperty(c)&&(b=n.activeModules[c],d.push({moduleId:c,displayName:b.displayName,description:b.description,translations:b.translations,tags:b.tags,animation:b.animation,active:b.active,timeActivated:b.timeActivated}));return d}}d=[];for(c in n.modules)n.modules.hasOwnProperty(c)&&(b=n.modules[c],d.push({moduleId:c,displayName:b.displayName,description:b.description,translations:b.translations,tags:b.tags,animation:b.animation,active:b.active,timeActivated:b.timeActivated}));return d},n.isBase=function(a){var b=a.match(/^(femaleAdult|maleAdult)/);return b&&b[0]},n.isBaseModule=function(a){var b=a.split("/");return n.isBase(b[b.length-1])?a:!1},n.requiresBase=function(a){for(var b=!1,c=0;c<a.length&&!(b=n.isBase(a[c]));c++);return b};var u={"production/maleAdult/maleAdult.json":"production/maleAdult/maleAdult_standard.json","production/maleAdult/femaleAdult.json":"production/maleAdult/femaleAdult_standard.json"};n.convertBaseAnatomyModuleId=function(a){return u[a]||a},n.convertBaseAnatomyStateId=function(a){return a.replace(/^femaleAdult$/,p).replace(/^maleAdult$/,o)},n.convertBaseAnatomyObjectId=function(a){if(n.isBase(a)){var b=a.split("-"),c=n.convertBaseAnatomyStateId(b[0]);a=[c,b[1]].join("-"),/_ID$/.test(a)||(a+="_ID")}return a}}(),function(){"use strict";function a(a,b){if(Human.scene.setEnabledObjects({objectIds:a.showObjects,replace:!0}),0===Human.timeline.chapterList.length)Human.timeline.chapterList=[a];else{var c,d=[];Human.timeline.chapterList.forEach(function(b){c=new Human.timeline.chapter(b.id),c.merge(a),c.merge(b),d.push(c)}),Human.timeline.chapterList=d}var e,f=new Human.timeline.RootTimeline(a.id);Human.timeline.chapterList.forEach(function(a){e=new Human.timeline.BranchTimeline(a,"chapter"),f.addChapter(e,{rebuild:!1})}),f.build(),Human.timeline.activeRoot=f,Human.view.clip.reset(),b()}function b(a){for(var b,c,d=0,e=a.length;e>d;d++)b=a[d],c=Human.view.annotations.annotations[b.annotationId],c&&c.destroy()}var c=Human.modules.Module=function(a){this.moduleId=a.moduleId,this.displayName=a.displayName||"",this.description=a.description||"",this.translations=a.translations||{},this.tags=a.tags||[],this.ui=a.ui||{},this.active=!1,this._loadedLibs=[],this.rootObjects=[],this.assetObjects=[],this.hacks=a.hacks,this.animation=a.animation,this.camera=a.camera,this.jumpTo=a.jumpTo,this.flyTo=a.flyTo;var b=a.modelIds||a.stateId;this.modelIds=b?Human.utils.isArray(b)?b:[b]:[],this.hasBaseAnatomy=!1;for(var c=0;c<this.modelIds.length;c++)Human.modules.isBase(this.modelIds[c])&&(this.modelIds[c]=Human.modules.convertBaseAnatomyStateId(this.modelIds[c]),this.hasBaseAnatomy=!0);this.showObjects=a.showObjects,this.selectObjects=a.selectObjects,this.pickThroughObjects=a.pickThroughObjects,this.animation=a.animation,this.xray=a.xray,this.annotations=a.annotations,this.annotationsLayout=a.annotationsLayout,this.environment=a.environment,this.chapterCameraPath=!!a.chapterCameraPath,this.effects=a.effects,this.properties=a.properties,this.reflections=a.reflections,this.chapters=a.chapters||null,this.swapped=!1,this.swappedObjectId=null,this.background=a.background||null,this.customData=a.customData||{},this.cache=!1};c.prototype.activate=function(b,c){var d=this,e=!!b.swap;this.swapped=e,e&&(this.swappedObjectId=b.objectId),this.cache=!!b.cache,d.hacks&&(Human.properties.set({"hacks.neverBackfaces":!!d.hacks.neverBackfaces}),Human.properties.set({"hacks.alwaysBackfaces":!!d.hacks.alwaysBackfaces})),this.reflections&&(this.restoreReflections=Human.assets.reflections.active,Human.assets.reflections.exportReflections(this.reflections));var f,g=this.showObjects?Human.modules.requiresBase(Object.keys(this.showObjects)):!1;g&&(f=Human.modules.convertBaseAnatomyStateId(g),-1===this.modelIds.indexOf(f)&&this.modelIds.push(f)),this._loadScene(this.modelIds.slice(),function(){if(null!==d.chapters){var b="",e=0;for(e=0;e<d.chapters.length;e++)b=d.moduleId+e,d.chapters[e].id=b;Human.timeline.chapterList=d.chapters}if(-1!==d.modelIds.indexOf("bookmark"))Human.timeline.chapterList=[];else if(Human.modules.isBaseModule(d.moduleId)&&1===Human.timeline.chapterList.length){var h=Human.timeline.chapterList[0].id;Human.modules.isBaseModule(h)&&(Human.timeline.chapterList=[])}var i=new Human.timeline.chapter(d.moduleId,d);for(var j in i.showObjects)i.showObjects.hasOwnProperty(j)&&Human.scene.objects[j]&&d.assetObjects.push(Human.scene.objects[j]);g&&!d.hasBaseAnatomy?d._mergeBaseModule(g,f,function(b){a(b,c)}):a(i,c)})},c.prototype._mergeBaseModule=function(a,b,c){var d=this,e="production/"+a+"/"+b+".json";Human.assets.server.getModuleDefinition(e,function(a){var b=new Human.timeline.chapter(e,a);b.merge(d),c&&c(b)})},c.prototype.deactivate=function(a){if(Human.timeline.stop(),this.annotations&&b(this.annotations),Human.view.annotations.clearAnnotations(),!this.cache&&this.modelIds){a?this._destroyObjects():this._hideObjects(),Human.timeline.destroyChapterSet(this.moduleId);for(var c=0,d=this._loadedLibs.length;d>c;c++)Human.assets.putAssetLibrary(this._loadedLibs[c]);this._loadedLibs.length=0}},c.prototype._destroyObjects=function(){Human.scene.graph.destroySubtree(this.rootObjects),this.rootObjects.length=0},c.prototype._hideObjects=function(){for(var a,b={},c=this.modelIds,d=0,e=c.length;e>d;d++){a=Human.scene.modelObjects[c[d]];for(var f in a)a.hasOwnProperty(f)&&(b[f]=!1)}Human.scene.setEnabledObjects({objects:b,replace:!1})},c.prototype._loadScene=function(a,b){function c(a){!h&&a.hasLights&&(h=!0),0===--e&&b&&(g=null,h||Human.view.lights.restoreDefaults(),b())}var d=this,e=a.length,f=0,g={},h=!1;a.forEach(function(b){Human.assets.server.getStateIndex(b,function(h){g[b]=h,++f===e&&a.forEach(function(a){d._buildState(a,g[a],c)})})})},c.prototype._buildState=function(a,b,c){function d(){0===--h&&c(i)}function e(b,c,e,g,i){if(b){i=i||{};for(var j in b)if(b.hasOwnProperty(j)){h++;var k=a+"/"+j;Human.assets.getAssetLibrary(c,e,k,g,i,d),f._loadedLibs.push(k)}}}var f=this,g=b.data,h=0,i={hasLights:!1};if(b.data&&b.data.createObjects){var j=Human.scene.graph.buildSceneGraph(b.data.createObjects,a);f.rootObjects=f.rootObjects.concat(j)}g.lights&&(e(g.lights,"light","lights","outline"),i.hasLights=!0),g.animations&&Object.keys(g.animations).length>0&&(Human.timeline.leafTimelines[a]=new Human.timeline.LeafTimeline(a)),e(g.animations,"animation","animations","manifest"),e(g.reflections,"reflection","reflections","outline");var k=null!==f.chapters?!0:!1;k||e(g.chapters,"chapter","chapters","manifest",{moduleId:f.moduleId}),e(g.audio,"audio","audio","manifest"),e(g.videos,"videos","videos","manifest"),0===h&&Human.utils.async(c.bind(null,i))},c.prototype._parseObjectIds=function(a,b){var c;if(!a)return{};if(b){var d={};for(c in a)a.hasOwnProperty(c)&&this._hasObject(c)&&(d[c]=a[c]);void 0!==a["*"]&&null!==a["*"]&&(d["*"]=a["*"]),a=d}var e=a["*"];if(void 0===e||null===e)return a;var f=this.modelIds;if(f)for(var g=0,h=f.length;h>g;g++){var i=Human.scene.modelObjects[f[g]];for(c in i)i.hasOwnProperty(c)&&(a[c]=e)}return a},c.prototype._hasObject=function(a){var b=this.modelIds;if(!b)return!1;for(var c=0,d=this.modelIds.length;d>c;c++)if(0===a.indexOf(this.modelIds[c]))return!0;return!1}}(),function(){"use strict";Human.plugins={},Human.addPlugin=function(a,b){Human.plugins[a]=b}}(),function(){"use strict";var a,b,c,d,e,f,g,h,i,j=Human.math,k=!0,l=.2,m=20,n=45,o=.1,p=.0174532925,q=o*Math.tan(p*n/2),r={"landscape-primary":90,"landscape-secondary":-90,"portrait-secondary":180,"portrait-primary":0},s=0,t=vec3.create(),u=vec3.create(),v=!1,w=function(){var a=vec3.create(),g=vec3.create(),h=vec3.create();return function(i){var j=c.getEye(),k=c.getLook(),n=b.width/2,p=b.height,r=b.width/b.height,s=o/m;switch(i.pass){case 0:var t=c.getUp();a[0]=j.x,a[1]=j.y,a[2]=j.z,g[0]=k.x,g[1]=k.y,g[2]=k.z,vec3.subtract(h,a,g),vec3.cross(h,[t.x,t.y,t.z],h),vec3.normalize(h,h),vec3.scale(h,h,l/2),e.setEye({x:j.x+h[0],y:j.y+h[1],z:j.z+h[2]}),e.setLook({x:k.x+h[0],y:k.y+h[1],z:k.z+h[2]}),f.setOptics({type:"frustum",left:-r*q-.5*l*s,right:r*q-.5*l*s,top:2*q,bottom:2*-q}),d.setViewport({x:n,y:0,width:n,height:p});break;case 1:e.setEye({x:j.x-h[0],y:j.y-h[1],z:j.z-h[2]}),e.setLook({x:k.x-h[0],y:k.y-h[1],z:k.z-h[2]}),f.setOptics({left:-r*q+.5*l*s,right:r*q+.5*l*s,top:2*q,bottom:2*-q}),d.setViewport({x:0,y:0,width:n,height:p})}}}(),x=function(){i=window.screen.orientation||window.screen.mozOrientation||window.msOrientation||null,s=i?r[i]||0:0},y=function(a,b){var c=Math.cos(a[0]/2),d=Math.cos(a[1]/2),e=Math.cos(a[2]/2),f=Math.sin(a[0]/2),g=Math.sin(a[1]/2),h=Math.sin(a[2]/2);return b[0]=f*d*e+c*g*h,b[1]=c*g*e-f*d*h,b[2]=c*d*h-f*g*e,b[3]=c*d*e+f*g*h,b},z=function(){var a=vec3.create(),b=vec3.create(),c=vec3.create(),d=vec3.create(),e=vec3.create(),f=vec3.create(),g=vec3.create(),h=vec3.create(),i=quat.create();i[0]=-Math.sqrt(.5),i[3]=Math.sqrt(.5);var l=quat.create(),m=quat.create(),n=quat.create(),o=mat4.create();return function(q){var r=q.alpha?p*q.alpha:0,s=q.beta?p*q.beta:0,t=q.gamma?p*q.gamma:0,u=p*(window.orientation||0);a[0]=s,a[1]=r,a[2]=-t,y(a,l),quat.multiply(l,l,i),quat.setAxisAngle(m,[0,0,1],-u),quat.multiply(l,l,m),quat.multiply(l,l,n),mat4.fromQuat(o,l);var v=Human.view.camera,w=j.vec3ObjToArray(v.eye,b),x=j.vec3ObjToArray(v.look,c);vec3.subtract(d,x,w);var z=Math.abs(vec3.length(d));e[0]=0,e[1]=0,e[2]=z,vec3.transformMat4(e,e,o),f[0]=0,f[1]=1,f[2]=0,vec3.transformMat4(f,f,o),k?(vec3.add(g,e,x),v.setLookAt({eye:{x:g[0],y:g[1],z:g[2]},up:{x:f[0],y:f[1],z:f[2]}})):(vec3.subtract(h,w,e),v.setLookAt({look:{x:h[0],y:h[1],z:h[2]},up:{x:f[0],y:f[1],z:f[2]}}))}}(),A=function(a){var b=(a.interval,a.acceleration);b&&(t[0]=b.x,t[1]=b.y,t[2]=b.z);var c=a.accelerationIncludingGravity;c&&(u[0]=c.x,u[1]=c.y,u[2]=c.z);a.rotationRate},B=function(a){k=a},C=function(a){n=a||45,q=o*Math.tan(p*n/2)},D=function(a){l=a,Human.renderer.forceRenderFrame()},E=function(i){if(i=!!i,v!==i){var j;i?(j=c.disconnectNodes(),d=c.addNode({type:"renderer"}),e=d.addNode({type:"lookAt"}),e.addNodes(j),a.setNumPasses(2),h=f.getOptics(),Human.properties.set({"camera.gimbalLockY":!1}),g=a.on("rendering",w),window.addEventListener("orientationchange",x,!1),window.addEventListener("deviceorientation",z,!1),window.addEventListener("devicemotion",A,!1)):(j=e.disconnectNodes(),d.destroy(),c.addNodes(j),f.setOptics(h),d.setViewport({x:0,y:0,width:b.width,height:b.height}),a.setNumPasses(1),a.off(g),window.removeEventListener("orientationchange",x),window.removeEventListener("deviceorientation",z),window.removeEventListener("devicemotion",A)),v=i}},F=function(){return(a=Human.renderer.getScene())?(b=a.getCanvas(),c=Human.renderer.getNode(Human.LOOKAT_ID),f=Human.renderer.getNode(Human.CAMERA_ID),window.OrientationChangeEvent||Human.log.warn("Browser event not supported: orientationchange"),window.DeviceOrientationEvent||Human.log.warn("Browser event not supported: deviceorientation"),window.DeviceMotionEvent||Human.log.warn("Browser event not supported: devicemotion"),E("true"===Human.request.getSearchParams().cardboard),void B("false"!==Human.request.getSearchParams().cardboardOrbiting)):void requestAnimationFrame(F)};requestAnimationFrame(F),Human.addPlugin("cardboard",{setOrbiting:B,setFOV:C,setEyeSep:D,setEnabled:E})}(),function(){"use strict";Human.transitions={};var a={},b=function(){};b.prototype={_init:function(a){this.id=Human.utils.createUUID(),this.v1=a.v1,this.v2=a.v2,this.t=0,this.duration=a.duration||1e3,this.dir=1,this._startTime=null,this.finished=a.finished},enter:function(b){this.t=0,this.dir=1,this._startTime=null,this.finished=b||this.finished,a[this.id]=this},exit:function(b){this.t=1,this.dir=-1,this._startTime=null,this.finished=b||this.finished,a[this.id]=this},__update:function(b){var c;if(this._startTime){var d=b-this._startTime;if(d>this.duration)return void(a[this.id]&&(delete a[this.id],this.finished&&this.finished()));c=d/this.duration,this.dir<0&&(c=1-c)}else this._startTime=b,c=this.dir>0?0:1;this._update(c)},stop:function(){delete a[this.id]},destroy:function(){this.stop()}},Human.events.on("tick",function(){return function(b){var c=b.timeNow;for(var d in a)a.hasOwnProperty(d)&&a[d].__update(c)}}()),Human.transitions.newTransitionClass=function(a){var c=function(a){this._init(a)};return Human.utils.extend(c,b),c.prototype._update=a,c},Human.transitions.CanvasOpacityTransition=Human.transitions.newTransitionClass(function(a){Human.renderer.canvas.canvas[0].style.opacity=this.v1+(this.v2-this.v1)*a})}();